tamekran=0;
function getImageWidth(myImage,w,h)
{
	if(tamekran==0)
	{
		$('#tam1').css('height',$('body').height());
		$('#tam1').css('padding-top',document.documentElement.scrollTop);
		document.getElementById('tam1').innerHTML='<div style="width:1120px;padding-top:16px;">' +
		'<center><div style="width:'+w+'px;height:21px;">' +
			'<img style="cursor:pointer;float:right;" onclick="getImageWidth()" src="images/gapat.png">' +
		'</div>' +
		'<div style="background:url(images/siyahT2.png);width:'+w+'px;height:'+h+'px;padding:10px">' +
			'<object id="tam1Flash" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0" width="'+w+'" height="'+h+'">' +
			'<param name="movie" value="oyunlar/'+myImage+'.swf" />' +
			'<param name="quality" value="high" />' +
			'<embed src="oyunlar/'+myImage+'.swf" quality="high" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="'+w+'" height="'+h+'"></embed>' +
			'</object>' +
		'</div></center>' +
//		'<img alt="Eski boyuta dönmek için tıklayınız" title="Eski boyuta dönmek için tıklayınız" id=cacheimg src=http://gazete.netgazete.com/Gazete/aksam.jpg  onclick=getImageWidth(this)  style="margin:10px;cursor: -moz-zoom-out;cursor:url(\'images/graphics/zoomout.cur\');">' +
		'</div>';
		$('#tam1').show(1250);
		tamekran=1;
	}
	else
	{
		$('#tam1Flash').hide();
		$('#tam1').hide(500);
		//$('#tam1').hide(1000,function(){window.scroll(0,200)});
		tamekran=0;
		//window.pageYOffset ==200;
	}
}

function mnst(mid)
{
	act_id=$("#mnst_num li").index($(".act_li"));
	if (mid!=act_id) {
		$("#mnst_num .act_li").removeClass('act_li');
		$("#mnst_num li#"+mid).addClass('act_li');
		$("#mnst a").fadeOut(400);
		//$("#mnst"+mid).css('margin-left',((mid<act_id)?'-':'')+'20px').fadeIn(200).animate({marginLeft:'0px'},100);
		$("#mnst"+mid).fadeIn(400);

	}
}
function mnst_player(limit,time)
{
	act_li=$("#mnst_num li").index($(".act_li"));
	timer_Mnst=setTimeout('mnst('+((act_li<limit)?(act_li+1):0)+');' +
	'mnst_player('+limit+','+time+')',time);
}

var key2=true;
function pt_slider2(mydiv,clicklimit,dir)  // up-down
{
	if (key2) {
		key2=false;
		var slider_framediv=$('#'+mydiv+' .slider_framediv');
		var slider_div=$('#'+mydiv+' .slider_div');
		var mTop=slider_div.css('margin-top').split("px")[0];
		var changing=$('#'+mydiv+' .slider_div a').height();
		if (Math.abs(mTop)==clicklimit*changing && dir==1) { dir=0; changing*=clicklimit;}
		if (mTop==0 && dir==0) { dir=1; changing*=clicklimit;}
		slider_div.animate({marginTop:''+((dir==1) ? '-' : '+')+'='+changing+'px'},500,function() {key2=true});
		changing=slider_framediv.height()/clicklimit;
	}
}
function pt_slideplayer2(mydiv,clicklimit,dir,time) // auto  up-down
{
	timer_P2=setTimeout('pt_slider2("'+mydiv+'",'+clicklimit+','+dir+');' +
	'pt_slideplayer2("'+mydiv+'",'+clicklimit+','+dir+','+time+')',time);
}

function sayac(field,countfield,maxlimit)
{
	if (field.value.length > maxlimit)
	field.value = field.value.substring(0,maxlimit);
	else 
	countfield.value = maxlimit - field.value.length;
}

function poll_submit()
{
	durum=false;
	form=document.anketForm;
	for(i=0;i<form.secenek.length;i++)
	if(form.secenek[i].checked) durum=true;
	if (!durum) $("#anketHata").html('&nbsp;* Lütfen bir seçim yapınız..').slideDown(100);
	else {
		$.ajax({
			type: 'POST',
			url: 'ajax.php?page=anket',
			data: $('#anketForm').serialize(),
			beforeSend: function() {
				$("#anketSonuc").html("<img src="+ldng_img1+">");
			},
			success: function(anketCvp) {
				$('#anketSonuc').html(anketCvp);
				$('#anketOyla').css('display','none');
				$("#anketHata").css('display','none');
			}
		});
	}
}

function srch_cont()
{
	srch_form=document.ara_form;
	if (srch_form.sw.value=='') srch_form.sw.value='Haberler için kelime giriniz..';
	if (srch_form.sw.value=='Haberler için kelime giriniz..') return false;
	else
	location.href="search?q="+$i('sw').value;
}
function srch_cont1()
{
	srch_form=document.firm_form;
	if (srch_form.sw1.value=='') srch_form.sw1.value='Firmalar için kelime giriniz..';
	if (srch_form.sw1.value=='Firmalar için kelime giriniz..') return false;
	else
	location.href="firmarehberi/index.php?p=arama&sw="+$i('sw1').value;
}


function addFavori(url,title)
{
	if (window.sidebar) 
	{ // Mozilla Firefox
		window.sidebar.addPanel(title, url, "");
	} 
	else if( window.external ) 
	{ // IE
		window.external.AddFavorite(url, title); 
	}
}


function defaultHomepage(x)
{
	if (document.all) 
	{
		document.body.style.behavior='url(#default#homepage)';
		document.body.setHomePage("http://www.haber5.com");
	} 
	else if (window.sidebar) 
	{
		if(window.netscape) 
		{
			try {  
				netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");  
			} 
			catch(e) 
			{  
				alert("Bu özellik tarayıcınız tarafından desteklenmiyor.");  
			}
		} 
		var prefs = Components.classes['@mozilla.org/preferences-service;1'].getService(Components.interfaces.nsIPrefBranch);
		prefs.setCharPref('browser.startup.homepage',"http://www.haber5.com");
	}
}

function go_url(slct)
{
	var URL = slct.options[slct.selectedIndex].value;
	location.href = URL;
}

function openPage(url,width,height)
{
	width=width + 10;
	height=height + 10;
	window.open(url, '_blank', 'toolbar=0, location=0, directories=0, status=0, menuBar=0, scrollBars=1, resizable=0, width='+ width +', height='+ height +', top=0' ) ;
}

function addComment(mode,id,uid)
{
	if ( typeof(uid) == 'undefined' ) uid = -1;
	url='addComment.php?mode=' + mode + '&id=' + id + '&uid=' + uid;
	window.open(url, '_blank', 'width=500, height=360,top=0, toolbar=0, location=0, directories=0, status=0, menuBar=0, scrollBars=1, resizable=0' ) ;
}

function sendFriend(mode,id)
{
	url='sendFriend.php?mode=' + mode + '&id=' + id;
	window.open(url, '_blank', 'toolbar=0, location=0, directories=0, status=0, menuBar=0, scrollBars=1, resizable=0, width=500, height=300, top=0' ) ;
}

function printf(mode,id)
{
	url='printf.php?mode=' + mode + '&id=' + id;
	window.open(url, '_blank', 'toolbar=0, location=0, directories=0, status=0, menuBar=0, scrollBars=1, resizable=0, width=550, height=550, top=0' ) ;
}

function printFile(path,width,height)
{
	var ext=path.substring(path.lastIndexOf(".") + 1,path.length);
	var html = '';
	if(ext=="swf")
	{
		if(width==468 && height>60)
		{
			i="i";
			html += '<DIV id="AdID12766" onmouseover="isBrowserComplient(\'AdID22766\',\'over\');" onmouseout="isBrowserComplient(\'AdID22766\',\'out\');">';
			html += '<DIV id="AdID22766" style="position: relative; width: 468px; height: 60px; z-index: +5;visibility:collapse">';
			html += '<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0"';
			html += ' width="468" height="'+ height +'" style="position: absolute; left: 0; top: 0;">';
			html += '<PARAM name="Movie" value="'+ path +'">';
			html += '<PARAM name="WMode" value="Transparent">';
			html += '<!--['+i+'f !IE]><-->';
			html += '<OBJECT data="'+ path +'"';
			html += 'width="468" height="'+ height +'" type="application/x-shockwave-flash" style="position: absolute; left: 0; top: 0;">';
			html += '<PARAM name="WMode" value="Transparent">';
			html += '<PARAM name="pluginurl" value="http://www.macromedia.com/go/getflashplayer">';
			html += '<\/OBJECT>';
			html += '<!--><![end'+i+'f]-->';
			html += '<\/OBJECT>';
			html += '<\/DIV>';
			html += '<\/DIV>';
		}
		else
		{
			html += '<div style="z-index:111111111;"><object  classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="'+ width +'" height="'+ height +'">';
			html += '      <param name="menu" value="false">';
			html += '      <param name="movie" value="'+ path +'" />';
			html += '      <param name="quality" value="high" />';
			html += '      <param name="wmode" value="transparent" />';
			html += '      <embed src="'+ path +'" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="'+ width +'" height="'+ height +'" wmode="transparent"></embed>';
			html += '    </object></div>';
		}
	}
	else if(ext=="jpg" || ext=="jpeg" || ext=="gif")
	{
		html +='<img src="'+ path +'" width="'+ width +'" height="'+ height +'" border="0">';
	}
	document.write(html);
}

function setCookie(c_name,value,expiredays)
{var exdate=new Date();exdate.setDate(exdate.getDate()+expiredays);
document.cookie=c_name+ "=" +escape(value)+
((expiredays==null) ? "" : ";expires="+exdate.toGMTString());
}

function $i(x) // ekmek :)
{
	return document.getElementById(x);
}

var news_text_default = '-1';
function fontSize(elem,x)
{
	var htmlTag = new Array("FONT","SPAN","DIV","TD","P","B","A","CENTER","U","I","SUP","SUB","PRE","UL","LI","OL","H1","H2","H3","H4","H5","H6","S","TT","DL","DT","DD");
	
	if(news_text_default=='-1')news_text_default=$i("news_text").innerHTML;
	
	if(x==12)
	{
		$i("news_text").style.fontSize = '';
		$i("news_text").innerHTML=news_text_default;
	}
	else
	{
		$i("news_text").innerHTML=news_text_default;
		$i("news_text").style.fontSize = x + 'pt';
		for (var t = 0; t < htmlTag.length; t++) 
		{
			var tag = $i("news_text").getElementsByTagName(htmlTag[t]);
			for (var i = 0; i < tag.length; i++) 
			{
				tag[i].style.fontSize = x + 'pt';
			}
		}
	}
}

var img_object = new Image();
function img_obj_src_funcx(Arr,opt)
{
	var imgpathx=(opt!=null) ? "img/thm" : "img";
	for (i=0;i<Arr.length;i++)
	img_object.src = imgpathx+"/"+Arr[i]['foto'];
}

function nesneyarat()
{
    var nesne;
    if(navigator.appName=="Microsoft Internet Explorer")
    nesne = new ActiveXObject("Microsoft.XMLHTTP");
    else nesne = new XMLHttpRequest();
    return nesne;
}
var http = nesneyarat();

//var ldng_img="images/loading_0.gif";
//img_object.src = ldng_img;
var ldng_img1="images/7hwy7at6.gif";
img_object.src = ldng_img1;

//city_arr=Array ("ANKARA","ISTANBUL","IZMIR","ADANA","DIYARBAKIR","ERZURUM","SAMSUN");
function havadurum(city)
{
	//$i('city_'+indis).style.display="none";
	//for (i=0;i<7;i++) if(i!=indis) $i('city_'+i).style.display="block";
	//$i('hd_cities').style.display="none";
	//$i('hd_city').innerHTML=city_arr[indis];
	http.open('get','ajax.php?page=havadurum&city='+city);
	http.onreadystatechange = function() {
		if(http.readyState==1) $i('hd_prgrss').style.display="";
		if(http.readyState==4) {
			$i('hd_value').innerHTML = http.responseText;
			for (i=0;i<4;i++)
			$i('hdimg_'+i).src='http://www.dmi.gov.tr/sunum/tahmingor-a1.aspx?g='+(i+1)+'&m='+city;
			$i('hd_prgrss').style.display="none";
		}
	};
	http.send(null);
}

function namazVakti(x)
{            
	if(x=="s")x="ISTANBUL";
	var url = "ajax.php?page=namaz&sehir=" + x;
	var xml = new JKL.ParseXML( url );
	var data = xml.parse();	
//	$i("nsehir").innerHTML=data.namazvakitleri.sehir;
	$i("imsak").innerHTML=data.namazvakitleri.imsak;
	$i("gunes").innerHTML=data.namazvakitleri.gunes;
	$i("ogle").innerHTML=data.namazvakitleri.ogle;
	$i("ikindi").innerHTML=data.namazvakitleri.ikindi;
	$i("aksam").innerHTML=data.namazvakitleri.aksam;
	$i("yatsi").innerHTML=data.namazvakitleri.yatsi;
}

var anahtarOyun=false;
function tumOyunlar()
{
	if (!anahtarOyun) {
		$.ajax({
			url: 'ajax.php?page=oyunlar',
			beforeSend: function() {
				$("#oyunDevam").html("<img src='"+ldng_img1+"' id='tuprgrssimg'>");
			},
			success: function(oyunCvp) {
				$('#oyunDevam').html(oyunCvp);
			}
		});
		anahtarOyun=true;
	}
	else { $('#oyunDevam').html(""); anahtarOyun=false }
}

var anahtarGm=false;
function gmansetler()
{
	if (!anahtarGm) {
		$('#gmDevam').show().html("<img src='"+ldng_img1+"' id='tuprgrssimg'>").load('ajax.php?page=gmansetler');
		anahtarGm=true;
	}
	else { $('#gmDevam').hide(); anahtarGm=false }
}