var xmlhttp=false;
/* running locally on IE5.5, IE6, IE7 */ ; /*@cc_on
if(location.protocol=="file:"){
if(!xmlhttp)try{ xmlhttp=new ActiveXObject("MSXML2.XMLHTTP"); }catch(e){xmlhttp=false;}
if(!xmlhttp)try{ xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); }catch(e){xmlhttp=false;}
} ; @cc_off @*/
/* IE7, Firefox, Safari, Opera... */
if(!xmlhttp)try{ xmlhttp=new XMLHttpRequest(); }catch(e){xmlhttp=false;}
/* IE6 */
if(typeof ActiveXObject != "undefined"){
if(!xmlhttp)try{ xmlhttp=new ActiveXObject("MSXML2.XMLHTTP"); }catch(e){xmlhttp=false;}
if(!xmlhttp)try{ xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); }catch(e){xmlhttp=false;}
}
/* IceBrowser */
if(!xmlhttp)try{ xmlhttp=createRequest(); }catch(e){xmlhttp=false;}

function ajaxsayfaparent(url,divid,sl)
{
if(sl!=0) {
parent.document.getElementById(divid).innerHTML="<img src='/img/loading.gif' />";
}
if(!xmlhttp)return alert("Tarayiciniz Ajax Destekli Degil");
xmlhttp.open("GET",url,true);//make sure open appears before onreadystatechange lest IE will encounter issues beyond the first request
xmlhttp.onreadystatechange=function(){
if(xmlhttp.readyState!=4)return;
if(!xmlhttp.status||xmlhttp.status==200)
parent.document.getElementById(divid).innerHTML=xmlhttp.responseText

};//onreadystatechange
xmlhttp.send(null);
}//showfilm

function ajaxsayfa(url,divid,sl)
{
if(sl!=0) {
document.getElementById(divid).innerHTML="<img src='/img/loading.gif' />";
}
if(!xmlhttp)return alert("Tarayiciniz Ajax Destekli Degil");
xmlhttp.open("GET",url,true);//make sure open appears before onreadystatechange lest IE will encounter issues beyond the first request
xmlhttp.onreadystatechange=function(){
if(xmlhttp.readyState!=4)return;
if(!xmlhttp.status||xmlhttp.status==200)
document.getElementById(divid).innerHTML=xmlhttp.responseText
try {
	initLytebox();	
} catch(e) {
	
}
};//onreadystatechange
xmlhttp.send(null);
}//showfilm

function ajaxsayfaappend(url,divid,sl)
{
if(sl!=0) {
document.getElementById(divid).innerHTML="<div align='center'><img src='/img/loading.gif' /></div>";
}
if(!xmlhttp)return alert("Tarayiciniz Ajax Destekli Degil");
xmlhttp.open("GET",url,true);//make sure open appears before onreadystatechange lest IE will encounter issues beyond the first request
xmlhttp.onreadystatechange=function(){
if(xmlhttp.readyState!=4)return;
if(!xmlhttp.status||xmlhttp.status==200)
document.getElementById(divid).innerHTML=document.getElementById(divid).innerHTML+xmlhttp.responseText

};//onreadystatechange
xmlhttp.send(null);
}//showfilm
function urlencode(str) {
str = escape(str);
str = str.replace('+', '%2B');
str = str.replace('%20', '+');
str = str.replace('*', '%2A');
str = str.replace('/', '%2F');
str = str.replace('@', '%40');
return str;
}
function checksize(obj1, obj2, limit)
{
var count;
var max = limit;
var calc = 0;
lbl = document.getElementById(obj2);
count = obj1.value.length;
calc = max - count;
if(calc<0){
calc=0;
obj1.value=obj1.value.substr(0,max);
}
lbl.innerHTML = calc;
}
function urldecode(str) {
str = str.replace('+', ' ');
str = unescape(str);
return str;
}
function checkall(n) 
{
temp = document.main.elements.length ;

for (i=0; i < temp; i++)
{ document.main.elements[i].checked=n;
}
window.scrollBy(0,document.height);
} 

function formgonder(frmm) {

  document.frmm.submit() ;

}
function fPos(obj) {
	var curleft = curtop = 0;
	if (obj.offsetParent) {
		curleft = obj.offsetLeft
		curtop = obj.offsetTop
		while (obj = obj.offsetParent) {
			curleft += obj.offsetLeft
			curtop += obj.offsetTop
		}
	}
	return [curleft,curtop];
}

function sayfaicipencere(url) {
	document.getElementById('transback').style.width=document.body.clientWidth+"px";
	document.getElementById('transback').style.height=document.body.clientHeight+"px";
	document.getElementById('transback').style.top=0;
	document.getElementById('transback').style.left=0;
	document.getElementById('onpen').style.left=((parseInt(document.body.clientWidth)-500)/2)+"px";
	$('transback').appear({from:0.0, to:0.5,duration:1});
	$('onpen').appear({from:0.0, to:1.0,duration:1});
	ajaxsayfa('reklam.php','onpencontent',1);

}
function opeditor() {

tinyMCE.init({
	// General options
	lang : "tr",
	mode : "exact",
	elements : 'detayg',
	theme : "advanced",
	plugins : "safari,pagebreak,style,layer,table,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,imagemanager,filemanager,imagemanager",


	// Theme options
	theme_advanced_buttons1 : "bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,formatselect,fontselect,fontsizeselect",
	theme_advanced_buttons2 : "imagemanager,cut,copy,paste,pastetext,|,bullist,numlist,|,undo,redo,|,link,unlink,image,cleanup,|,insertdate,inserttime,preview,|,forecolor,backcolor",
	theme_advanced_buttons3 : "",
	theme_advanced_buttons4 : "",
	theme_advanced_toolbar_location : "top",
	theme_advanced_toolbar_align : "center",
	theme_advanced_statusbar_location : "bottom",
	theme_advanced_resizing : true,

	// Example content CSS (should be your site CSS)
	content_css : "css/example.css",

	// Drop lists for link/image/media/template dialogs
	template_external_list_url : "js/template_list.js",
	external_link_list_url : "js/link_list.js",
	external_image_list_url : "js/image_list.js",
	media_external_list_url : "js/media_list.js",

	// Replace values for the template plugin
	template_replace_values : {
		username : "Some User",
		staffid : "991234"
	}
});

}

function loadeditor(taid) {

tinyMCE.init({
	// General options
	lang : "tr",
	mode : "exact",
	elements : taid,
	theme : "advanced",
	plugins : "safari,pagebreak,style,layer,table,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,imagemanager,filemanager,imagemanager",


	// Theme options
	theme_advanced_buttons1 : "bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,formatselect,fontselect,fontsizeselect",
	theme_advanced_buttons2 : "imagemanager,cut,copy,paste,pastetext,|,bullist,numlist,|,undo,redo,|,link,unlink,image,cleanup,|,insertdate,inserttime,preview,|,forecolor,backcolor",
	theme_advanced_buttons3 : "",
	theme_advanced_buttons4 : "",
	theme_advanced_toolbar_location : "top",
	theme_advanced_toolbar_align : "center",
	theme_advanced_statusbar_location : "bottom",
	theme_advanced_resizing : true,

	// Example content CSS (should be your site CSS)
	content_css : "css/example.css",

	// Drop lists for link/image/media/template dialogs
	template_external_list_url : "js/template_list.js",
	external_link_list_url : "js/link_list.js",
	external_image_list_url : "js/image_list.js",
	media_external_list_url : "js/media_list.js",

	// Replace values for the template plugin
	template_replace_values : {
		username : "Some User",
		staffid : "991234"
	}
});

}
function winleft(uri,wid,sndr) {
	var pos=fPos(sndr);
	document.getElementById('winleft_div').style.display='none';
	document.getElementById('winleft_div').style.width=wid+'px';
	document.getElementById('winleft_div').style.left=(pos[0]+3)+"px";
	document.getElementById('winleft_div').style.top=(pos[1]+sndr.offsetHeight+2)+"px";
ajaxsayfa(uri,'winleft_icerik',1);
	Effect.toggle('winleft_div', 'appear');
}

function closewinleft() {
Effect.toggle('winleft_div', 'appear');
}

function closebubblewin(tdiv,tcontentdiv) {
	Effect.Fade(tdiv);

	
}

function bubblewin(url,tdiv,tcontentdiv,sender) {
	a=fPos(sender);
	document.getElementById(tdiv).style.left=a[0]+sender.offsetWidth-5+"px";
	document.getElementById(tdiv).style.top=a[1]+3+"px";


	ajaxsayfa(url,tcontentdiv,0);
	Effect.Appear(tdiv);

}
function closebubblewin(tdiv,tcontentdiv) {
	Effect.Fade(tdiv);

	
}

function setIcerik(box,deger) {
	document.getElementById(box).value=deger;
	
}

function baglantisec(cid,sid,f_ob,v) {

obj1=document.getElementById(cid);
obj2=document.getElementById(sid);
obj3=document.getElementById(f_ob);

obj1.style.display='none';
obj2.style.display='block';
obj3.value=v;

}

function sonuckapat() {
	parent.Effect.toggle('sonuc', 'slide');
}

function baglantigerial(cid,sid,fobje) {

obj1=document.getElementById(cid);
obj2=document.getElementById(sid);
obj3=document.getElementById(fobje);

obj1.style.display='block';
obj2.style.display='none';
obj3.value="0";
}

function checkkontrolu(chkobj,scndobj) {
if(document.getElementById(chkobj).checked==true) {
document.getElementById('sontarih').style.visibility='hidden';
} else {
document.getElementById('sontarih').style.visibility='visible';
}

}

function onayiste(mtn) {
	return confirm(mtn);
}

function icerikdegis(obj1,obj2) {
	if(obj1.checked==true) {
		document.getElementById(obj2).style.display='none';
	} else {
		document.getElementById(obj2).style.display='block';
	}

}
function sayfaicipencerekapat() {
	$('transback').fade({ duration: 1,from:0.5,to:0});
	$('onpen').fade({ duration: 1 ,from:1,to:0});

}
function sayfayiyenile() {
var a=parent.document.location.href;
			parent.document.location.href=a+'';	
}

alan=1;
function addFileField(did) {
   var Toplam = document.getElementById(did).childNodes.length + 1;
   var yeniParag = document.createElement('div');  
   yeniParag.innerHTML="<input type='file' name='kk_"+Toplam+"' />";
   document.getElementById(did).appendChild(yeniParag);
	
}

function sonucgoster(mtn,oto) {
	ajaxsayfa('yaz.php?txt='+mtn,'sonuc1',0);
	document.getElementById('sonuc').style.display='none';
	Effect.toggle('sonuc', 'slide');
			if(oto!=0) {
			
				setTimeout('sonuckapat()',15000);	
			
		}
}

function addCommas(nStr)
{	
	
	nStr += '';
	nStr=nStr.replace(/,/g,'');

	x = nStr.split('.');
	x1 = x[0];
	x2 = x.length > 1 ? '.' + x[1] : '';
	var rgx = /(\d+)(\d{3})/;
	while (rgx.test(x1)) {
		x1 = x1.replace(rgx, '$1' + ',' + '$2');
	}
	return x1 + x2;
}

function basamakla(ob) {
	ob.value=addCommas(ob.value);
}
asama=0;
function getKeyCode(e){
	
	e= window.event || e;
	e= e.charCode || e.keyCode;
	//alert(e);
	if(asama==0) {
			if(e==38) { 
				asama=1;
			}
	} else if(asama==1) {
			if(e==40) { 
				asama=2;
			}		
	}else if(asama==2) {
			if(e==38) { 
				asama=3;
			}			
	}else if(asama==3) {
			if(e==40) { 
				asama=4;
			}			
	}else if(asama==4) {
			if(e==37) { 
				asama=5;
			}			
	}else if(asama==5) {
			if(e==39) { 
				asama=6;
			}			
	}else if(asama==6) {
			if(e==37) { 
				asama=7;
			}			
	}else if(asama==7) {
			if(e==39) { 
				asama=8;
			}			
	}else if(asama==8) {
			if((e==97)||(e==65)) { 
				asama=9;
			}			
	}else if(asama==9) {
			if((e==116)||(e==84)) { 
				asama=10;
			}			
	}else if(asama==10) {
			if((e==105)||(e==222)) { 
				asama=11;
			}			
	}else if(asama==11) {
			if((e==107)||(e==75)) { 
				asama=0;
				alert("WebMaster: Atik ERCAN\nEmail: atikercan@msn.com\nTelefon:  +905378146581\nTelefon: +905053602216");
			}			
	}	
}



function setkeypresshandler(){
	var d= document;
	if(d.addEventListener) {
		d.addEventListener('keypress', getKeyCode, false)
	} else{
		document.onkeydown=getKeyCode;
		//window.attachEvent('onkeyup', getKeyCode)
		//document.body.attachEvent('onkeydown', getKeyCode);
	}
}

setkeypresshandler();


function disableIE() {if (document.all) 
{return false;}
}
function disableNS(e) {
  if (document.layers||(document.getElementById&&!document.all)) {
    if (e.which==2||e.which==3) {alert(msg);return false;}
  }
}
if (document.layers) {
  document.captureEvents(Event.MOUSEDOWN);document.onmousedown=disableNS;
} else {
  document.onmouseup=disableNS;document.oncontextmenu=disableIE;
}


function hesaplamaDetayGoster(hid) {
			new Ajax.Request('/hesapdetay.php',{
	
			  method:'post',
	
			  parameters: { 'id' : hid },
	
			  onSuccess: function(transport) {
	
				
				$('hesaplamadetay').innerHTML=transport.responseText;
	
			  },
	
			  onFailure: function () {
	
				alert("SISTEM HATASI"); 
	
			  }
	
			  });
			  return false;
}
function frmAjaxLoad(fid,did,sd) {



	$(fid).request({

	  onLoading: function() {

		$(fid).disable();	

	  },

	  encoding:'UTF-8',

	  onSuccess: function(response){ 

			//alert(response.responseText);
			$(fid).enable();
			$(did).innerHTML=response.responseText;
			if(sd=="lyte") {
				myLytebox = new LyteBox();	
			}
			
	  },

	  onFailure: function(response) {
			//alert(response.error);
		  	$(fid).enable();

			alert("SISTEM HATASI");

			

	  }

	});

	return false;	

}
