function AJAX() {
   var ajax = false;
   try {
     ajax = new ActiveXObject("Msxml2.XMLHTTP"); 
   } catch (e) {
      try {
        ajax = new ActiveXObject("Microsoft.XMLHTTP");
      } catch (e) {
        ajax = false;
      }
   }
   if ( !ajax && typeof XMLHttpRequest != 'undefined' ) {
     try{
        ajax = new XMLHttpRequest();
     }catch(e) {    
        ajax = false;
     }
   }
   if ( !ajax && window.createRequest ) {
	 try{
        ajax = window.createRequest();
     }catch(e) {  
        ajax = false;
     }
   }
	return ajax;
}

function GetRequest(showload, TargetLayer, dosya, Qprm, tip) {
	ajax = new AJAX();
	if ( ajax ) {
		ajax.onreadystatechange = function () {}
		ajax.abort()
	}
    ajax.onreadystatechange = function () {	Loading(showload, TargetLayer, dosya,tip) }
	ajax.open('POST', dosya, true)
	ajax.setRequestHeader("If-Modified-Since", "Sat, 1 Jan 2000 00:00:00 GMT")
	ajax.setRequestHeader('Content-Type','application/x-www-form-urlencoded; charset=UTF-8')
    ajax.setRequestHeader("Content-length", Qprm.length)
    ajax.setRequestHeader("Connection", "close")
	ajax.send(Qprm)	
}

function fc_(text) {
	var temp;
	
	temp = encodeURIComponent(text);
	
	return temp;
}

function Loading(showload, TargetLayer, dosya, tip) {
	if( showload == 1 && TargetLayer != 'no_id' ) {
		if( ajax.readyState == 1 || ajax.readyState == 2 || ajax.readyState == 3 ) {
			var loading = '<div style="text-align:center;margin-top:20px;"><img src="../images/loading.gif" width="16" height="16"/></div>'
			document.getElementById(TargetLayer).innerHTML = loading;
		}
	}

	if( ajax.readyState == 4 && TargetLayer != 'no_id' ) {
		if (ajax.status == 200) {
			if (tip=='innerhtml'){
            document.getElementById(TargetLayer).innerHTML = ajax.responseText;}
			else if (tip=='value')
			{document.getElementById(TargetLayer).value = ajax.responseText;}
			else {document.getElementById(TargetLayer).innerHTML = ajax.responseXML;}
        } else {
            document.getElementById(TargetLayer).innerHTML = '<strong>HATA:</strong> ' + ajax.statusText;
        }
		function AJAX() {};
    }
}
function SlideNext() {
	if (ncnt<2)
		{return;}
	else
		{
			if(thisleft<-ncnt-(ncnt-2)*100)
			{thisleft=100;}
			Animateleft(1);
		}
}
function SlidePrevious() {
	if (ncnt<4)
		{return;}
	else
		{
			if(thisleft>-255)
			{thisleft=-ncnt-(ncnt-2)*255;}
			Animateleft(0);
		}
}
function Animateleft(direction) {
	if (acnt<100)
	{	
		if (direction==1){
			thisleft=thisleft-5;
		}
		else
		{
			thisleft=thisleft+5;
		}
		document.getElementById('yeniurun_in').style.marginTop=thisleft+'px';
		acnt=acnt+5;
		setTimeout("Animateleft("+direction+");",Math.ceil(5));
	}
	else
	{
		acnt=0;
	}
}
function processNext() {
	if (thispict == 7){thispict = 0;}else{thispict++;}
	if (thistext == 7){thistext = 0;}else{thistext++;}
	FadeOpacity('top_changer_image_cont1',100,0,1000,12,1);
}

function FadeOpacity(elemId, fromOpacity, toOpacity, time, fps, optype){
     var steps = Math.ceil(fps * (time / 1000));
     var delta = (toOpacity - fromOpacity) / steps;
     FadeOpacityStep(elemId, 0, steps, fromOpacity, 
                     delta, (time / steps), optype);
}

function FadeOpacityStep(elemId, stepNum, steps, fromOpacity, delta, timePerStep, optype){
    SetOpacity(document.getElementById(elemId), 
               Math.round(parseInt(fromOpacity) + (delta * stepNum)));
    if (stepNum < steps)
        {setTimeout("FadeOpacityStep('" + elemId + "', " + (stepNum+1) 
                 + ", " + steps + ", " + fromOpacity + ", "
                 + delta + ", " + timePerStep + "," +optype+");", 
                   timePerStep);}
		else
		{ResetPicture();
			}
	
}
function ResetPicture(){
	document.getElementById("top_changer_image_cont1").style.background = document.getElementById("top_changer_image_cont").style.background;
	SetOpacity(document.getElementById("top_changer_image_cont1"),101);
	SetOpacity(document.getElementById("top_changer_image_cont"),0);
	document.getElementById("htxt").innerHTML=txtlist[thistext];
	for (i=0; i<8; i++){document.getElementById("mli"+i).className="";}
	document.getElementById("mli"+thistext).className="selectedlink";
	document.getElementById("top_changer_image_cont").style.background = 'url('+pictlist[thispict]+')  center no-repeat';
	SetOpacity(document.getElementById("top_changer_image_cont"),101);
	
}


function SetOpacity(elem, opacityAsInt){
    var opacityAsDecimal = opacityAsInt;
    
    if (opacityAsInt > 100)
        opacityAsInt = opacityAsDecimal = 100; 
    else if (opacityAsInt < 0)
        opacityAsInt = opacityAsDecimal = 0; 
    
    opacityAsDecimal /= 100;
    if (opacityAsInt < 1)
        opacityAsInt = 1; // IE7 bug, text smoothing cuts out if 0
    
    elem.style.opacity = (opacityAsDecimal);
    elem.style.filter  = "alpha(opacity=" + opacityAsInt + ")";
}
function CheckAll(){

	var c = document.getElementById('tumunusec').value;
	var tpldeger = 0;
	if (c == "false"){
		bolCheck = 1;
		document.getElementById('tumunusec').value = "true";
	}else{
		bolCheck = 0;
		document.getElementById('tumunusec').value = "false";
	}
	if(document.liste.record_id) {
		if (document.liste.record_id.length){
		for (var i=0; i<document.liste.record_id.length; i++){
			if (!document.liste.record_id[i].disabled){
			document.liste.record_id[i].checked = bolCheck;}
		}}else{document.liste.record_id.checked=bolCheck;}
	}
}

function DeleteRecord(tbl){
	if (checkcount()<=0){return;}
	var r=confirm("Seçilen Kayıtlar Silinecek Onaylıyormusunuz?");
	if (r==true)
	  {
		var idlist=''
		if(document.liste.record_id) {
			if (document.liste.record_id.length){
			for (var i=0; i<document.liste.record_id.length; i++){
				if(document.liste.record_id[i].checked){
					if (idlist!='') {idlist=idlist+', '+document.liste.record_id[i].value; }
						else {idlist=idlist+document.liste.record_id[i].value; }
				}
			}}else{if(document.liste.record_id.checked){idlist=document.liste.record_id.value;}}
		}	
		var postprm ='idlist='+fc_(idlist)+'&tbl='+fc_(tbl);
  		GetRequest(0, '', 'deleterecord.asp', postprm,'innerhtml');
	  }
	else
	  {
		return;
	  }
	  window.location.reload();

}
function Yayimla(deger,id,tbl){
		var postprm ='id='+fc_(id)+'&deger='+fc_(deger)+'&tbl='+fc_(tbl);
  		GetRequest(0, '', 'yayimla.asp', postprm,'innerhtml');
	  window.location.reload();
}
function checkcount(){
	var toplamsecim=0;
	if(document.liste.record_id) {
		if (document.liste.record_id.length){
		for (var i=0; i<document.liste.record_id.length; i++){
			if (document.liste.record_id[i].checked){toplamsecim=toplamsecim+1;}
		}}else{if (document.liste.record_id.checked){toplamsecim=toplamsecim+1;}}
	}
	return toplamsecim;
}
function PageSelectCopy(){

	document.getElementById('page_footer').innerHTML=document.getElementById('page_select').innerHTML;
}
function ValidateForm(objlist){
	var obj = new Array();
	obj=objlist.split(',');
	for (i=0; i<obj.length; i++){
	if (document.getElementById(obj[i]).value.length ==0){
			alert("Yetersiz Bilgi Girişi..!");
			document.getElementById(obj[i]).style.border='1px solid #84251f';
			return false;
	}
	}

	return true;
}
function Editpermalink(obj){

	if (document.getElementById(obj).readOnly==true)
		{
			document.getElementById(obj).readOnly=false;
			document.getElementById(obj).style.background='#fff';
			document.getElementById(obj).focus();
		}
	else
		{
			document.getElementById(obj).readOnly=true;
			document.getElementById(obj).style.background='#ffc';
			
		}
}
function CreatePermalink(tobj,sobj,dil,tblname,id){
	if (document.getElementById(sobj).value.length==0)
	{return;}
	var sval=document.getElementById(sobj).value;
	var skatval=document.getElementById('grpid').value;
	var postprm ='sval='+fc_(sval)+'&dil='+fc_(dil)+'&skatval='+fc_(skatval)+'&tblname='+fc_(tblname)+'&id='+fc_(id);
	GetRequest(0, tobj, 'createpermalink.asp', postprm,'value');
}
function DeletePictureFile(Pfile,Pfolder){
	var r=confirm(Pfile+" resim dosyası silinecek..?");
	if (r==true)
	  {
		var postprm ='pfile='+Pfile+'&pfolder='+Pfolder;
  		GetRequest(0, '', 'picturedelete.asp', postprm,'innerhtml');
	  }
	else
	  {
		return;
	  }
	  window.location.reload();

}
function DeleteFile(Pfile,Pfolder){
	var r=confirm(Pfile+" isimli dosya silinecek..?");
	if (r==true)
	  {
		var postprm ='pfile='+Pfile+'&pfolder='+Pfolder;
  		GetRequest(0, '', 'filedelete.asp', postprm,'innerhtml');
	  }
	else
	  {
		return;
	  }
	  window.location.reload();

}

function popup(a) {
yeni=window.open(a,"_blank","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,dependent=no,resizable=no,width=400,height=280,top="+((screen.height/2)-140)+",left="+((screen.width/2)-200)+"");
if(navigator.appName == "Microsoft Internet Explorer" &&
  parseInt(navigator.appVersion) >= 4) {
      yeni.focus();
      } else {
      if(navigator.appName != "Microsoft Internet Explorer")
      yeni.focus(); }
}
function set_hover(r,c) {
	document.all(r).style.backgroundColor="Red";
}
function get_hover(r,c) {
	document.all(r).style.backgroundColor=c;
}
function popup_ac(a,b,c) {
yeni=window.open(a,"_blank","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,dependent=no,resizable=no,width="+b+",height="+c+",top="+((screen.height/2)-(c/2))+",left="+((screen.width/2)-(b/2))+"");
if(navigator.appName == "Microsoft Internet Explorer" &&
  parseInt(navigator.appVersion) >= 4) {
      yeni.focus();
      } else {
      if(navigator.appName != "Microsoft Internet Explorer")
      yeni.focus(); }
}