function git(s)
{       
var d = s.options[s.selectedIndex].value;
if (d!='.' && d!='http://www.tofas.com.tr/esatis/form_anasayfa.htm') {this.location.href = d;}
if(d=='http://www.tofas.com.tr/esatis/form_anasayfa.htm')
{
   window.open("http://www.tofas.com.tr/esatis/form_anasayfa.htm");
}
s.selectedIndex=0;
}

function git1(s)
{       
var d = s.options[s.selectedIndex].value;
  window.open("index.php?PageID="+d);
s.selectedIndex=0;
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
function openPictureWindow(imageName,alt) {
	newWindow = window.open("","newWindow","width=80,height=80");
	newWindow.document.open();
	newWindow.document.write('<html><head><title>Alfa Romeo</title><script language="javascript">function boyutlandir(alfa){genislik=eval(alfa.offsetWidth)+40;yukseklik=eval(alfa.offsetHeight)+100;window.resizeTo(genislik,yukseklik)');
	newWindow.document.write('}</script></head><body bgcolor=#FFFFFF  onload="boyutlandir(resim)">');
	newWindow.document.write('<table width=100% align=center><tr><td><img src='+imageName+' id=resim onload="boyutlandir(resim)" alt=""></td></tr><tr><td align=right height=35><a href=javascript:close()><img src=images/chiudi_chiara.gif  width=74 height=17 border=0></a></td></tr></table><script language="javascript">boyutlandir(resim);</script>');
	newWindow.document.write('</body></html>');
	newWindow.document.close();
	newWindow.focus();
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
//-->

function kidOpenWin() {
var kidStr = top.location.search;
var kidLength = kidStr.length;
var kidIndex = kidStr.indexOf("kid=");
var kid = kidStr.substring(kidIndex+4,kidLength); 
//alert(kid);
if ((kid !="") & (kid.length==1)) {
window.open('http://www.tofas.com.tr/esatis/form_satis_2b.php?hizmet=satis&kid='+ kid +'', 'nextWin', 'width=770,height=570,scrollbars=1,toolbar=0,location=0,status=1,resizable=0');  
 }
}

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);


function Querystring(qs) { 
	this.params = new Object()
	this.get=Querystring_get
	
	if (qs == null)
		qs=location.search.substring(1,location.search.length)

	if (qs.length == 0) return


	qs = qs.replace(/\+/g, ' ')
	var args = qs.split('&') // parse out name/value pairs separated via &
	
	for (var i=0;i<args.length;i++) {
		var value;
		var pair = args[i].split('=')
		var name = unescape(pair[0])

		if (pair.length == 2)
			value = unescape(pair[1])
		else
			value = name
		
		this.params[name] = value
	}
}

function Querystring_get(key, default_) {
	if (default_ == null) default_ = null;

	var value=this.params[key]
	if (value==null) value=default_;
	
	return value
}
function Right(str, n){
    if (n <= 0)
       return "";
    else if (n > String(str).length)
       return str;
    else {
       var iLen = String(str).length;
       return String(str).substring(iLen, iLen - n);
    }
}
function Kalan(str, n){
	if (n <= 0)
	    return "";
	else if (n > String(str).length)
	    return str;
	else
	    return String(str).substring(0,(String(str).length)-n);
}


  var XMLHttpRequestObject = false; 

  if (window.XMLHttpRequest) {
	XMLHttpRequestObject = new XMLHttpRequest();
  } else if (window.ActiveXObject) {
	XMLHttpRequestObject = new ActiveXObject("Microsoft.XMLHTTP");
  }
  
  

  function getData(dataSource, divID) 
  { 
	var d = new Date()
	var ID = '' + d.getDate()+d.getMonth() +1+d.getFullYear()+d.getHours()+d.getMinutes()+d.getSeconds();  
	if(XMLHttpRequestObject) {
	  var obj = document.getElementById(divID); 
	  XMLHttpRequestObject.open("GET", dataSource+'&'+ID); 

	  XMLHttpRequestObject.onreadystatechange = function() 
	  { 
		if (XMLHttpRequestObject.readyState == 4 && 
		  XMLHttpRequestObject.status == 200) { 
			obj.innerHTML = XMLHttpRequestObject.responseText; 
		} 
	  } 

	  XMLHttpRequestObject.send(null); 
	}
  }
  
  var XMLHttpRequestObject2 = false; 

  if (window.XMLHttpRequest) {
	XMLHttpRequestObject2 = new XMLHttpRequest();
  } else if (window.ActiveXObject) {
	XMLHttpRequestObject2 = new ActiveXObject("Microsoft.XMLHTTP");
  }
    
  
  function getData2(dataSource, divID) 
  { 
	var d = new Date()
	var ID = '' + d.getDate()+d.getMonth() +1+d.getFullYear()+d.getHours()+d.getMinutes()+d.getSeconds();   
	if(XMLHttpRequestObject2) {
	  var obj = document.getElementById(divID); 
	  XMLHttpRequestObject2.open("GET", dataSource+'&'+ID); 

	  XMLHttpRequestObject2.onreadystatechange = function() 
	  { 
		if (XMLHttpRequestObject2.readyState == 4 && 
		  XMLHttpRequestObject2.status == 200) { 
			obj.innerHTML = XMLHttpRequestObject2.responseText; 
		} 
	  } 

	  XMLHttpRequestObject2.send(null); 
	}
  }
  
  
  var XMLHttpRequestObject3 = false; 

  if (window.XMLHttpRequest) {
	XMLHttpRequestObject3 = new XMLHttpRequest();
  } else if (window.ActiveXObject) {
	XMLHttpRequestObject3 = new ActiveXObject("Microsoft.XMLHTTP");
  }
    
  
  function getData3(dataSource, divID) 
  { 
	var d = new Date()
	var ID = '' + d.getDate()+d.getMonth() +1+d.getFullYear()+d.getHours()+d.getMinutes()+d.getSeconds();   
	if(XMLHttpRequestObject3) {
	  var obj = document.getElementById(divID); 
	  XMLHttpRequestObject3.open("GET", dataSource+'&'+ID); 

	  XMLHttpRequestObject3.onreadystatechange = function() 
	  { 
		if (XMLHttpRequestObject3.readyState == 4 && 
		  XMLHttpRequestObject3.status == 200) { 
			obj.innerHTML = XMLHttpRequestObject3.responseText; 
		} 
	  } 

	  XMLHttpRequestObject3.send(null); 
	}
  }  
 


function online(id){
	
	if(document.getElementById(id).src){
		document.getElementById(id).src =(Kalan(document.getElementById(id).src,4)+"_on"+Right(document.getElementById(id).src,4));
	}
}

function li_online(id){
	document.getElementById(id).className='on';
}

var qs = new Querystring()
var pageid = qs.get("PageID")

function oto_online(otomobil){
	//getData('html_public/includes/otomobil.php?pageID='+pageid+'&oto='+otomobil, 'arabaheader');
}

function otogenelmenu_online(otomobil,target,flash){
	//getData2('html_public/includes/otomobilrightsubgenel.php?pageID='+pageid+'&oto='+otomobil, 'araba_sag_genel');

	if(flash){
		oto_flash_online(otomobil);
	}else{
		oto_online(otomobil);
	}
}

function otoaltmenu_online(otomobil,target){
	getData3('html_public/includes/otomobilrightsub.php?pageID='+pageid+'&oto='+otomobil, 'araba_sag_alt');	
	oto_online(otomobil);
}

function oto_flash_online(otomobil){
	getData('html_public/includes/otomobilrightsubflash.php?pageID='+pageid+'&oto='+otomobil, 'arabaheader');
}

/* Kampanyalar : Popup */

/***************************/
//@Author: Hasan ERZİ				
/***************************/

//Ayarlar
var BgAktif = 1;

//Popup'ı göster
function PopupYukle(pencere){
	if(BgAktif==0){
		$("#backgroundPopup").css({
			"opacity": "0.7"
		});		
		$("#backgroundPopup").fadeIn("slow");
	}
		$("#"+pencere).fadeIn("slow");
}

//Popup'ı gizle
function PopupIptal(pAdi){
	if(BgAktif ==1){
		$("#backgroundPopup").fadeOut("slow");		
	}
		$("#"+pAdi).fadeOut("slow");
}

//Popup'u ortala
function PopupOrtala(pencere){
    //ortalama bilgileri al
		var windowWidth = document.documentElement.clientWidth;  
		var windowHeight = document.documentElement.clientHeight;  
		var popupHeight = $("#"+pencere).height();  
		var popupWidth = $("#"+pencere).width();
		
		var windowST = 0;
		var windowSL = 0;		
		
 	if (document.documentElement && document.documentElement.scrollTop) { 
 		windowST = document.documentElement.scrollTop; 
 		windowSL = document.documentElement.scrollLeft; 
 		w = document.documentElement.scrollWidth; 
		h = document.documentElement.scrollHeight; 
 	} else if (document.body) { 
		windowST = document.body.scrollTop; 
		windowSL = document.body.scrollLeft; 
		w = document.body.scrollWidth; 
		h = document.body.scrollHeight; 
 	} 		
		

	//centering  
	$("#"+pencere).css({  
		"position": "absolute",
        "top": windowST + 300,
        "left": "25%"
	});  


  	$("#backgroundPopup").css({  
	"height": windowHeight  
});  

}
