var offsetfrommouse=[15,25]; 
var displayduration=0; //duration in seconds image should remain visible. 0 for always.

var defaultimageheight = 40;	// maximum image size.
var defaultimagewidth = 40;	// maximum image size.

var timer;

function truebody(){
return (!window.opera && document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function followmouse(e){

	var xcoord=offsetfrommouse[0]
	var ycoord=offsetfrommouse[1]

	var docwidth=document.all? truebody().scrollLeft+truebody().clientWidth : pageXOffset+window.innerWidth-15
	var docheight=document.all? Math.min(truebody().scrollHeight, truebody().clientHeight) : Math.min(window.innerHeight)

	if (typeof e != "undefined"){
		if (docwidth - e.pageX < defaultimagewidth + 2*offsetfrommouse[0]){
			xcoord = e.pageX - xcoord - defaultimagewidth; // Move to the left side of the cursor
		} else {
			xcoord += e.pageX;
		}
		if (docheight - e.pageY < defaultimageheight + 2*offsetfrommouse[1]){
			ycoord += e.pageY - Math.max(0,(2*offsetfrommouse[1] + defaultimageheight + e.pageY - docheight - truebody().scrollTop));
		} else {
			ycoord += e.pageY;
		}

	} else if (typeof window.event != "undefined"){
		if (docwidth - event.clientX < defaultimagewidth + 2*offsetfrommouse[0]){
			xcoord = event.clientX + truebody().scrollLeft - xcoord - defaultimagewidth; // Move to the left side of the cursor
		} else {
			xcoord += truebody().scrollLeft+event.clientX
		}
		if (docheight - event.clientY < (defaultimageheight + 2*offsetfrommouse[1])){
			ycoord += event.clientY + truebody().scrollTop - Math.max(0,(2*offsetfrommouse[1] + defaultimageheight + event.clientY - docheight));
		} else {
			ycoord += truebody().scrollTop + event.clientY;
		}
	}
	var obje=document.getElementById("kucres");
	
	if (obje.style.left>800+"px"){obje.style.left=800;}
	if (obje.style.top<400+"px"){obje.style.top=400;}
	obje.style.left=xcoord+"px"
	obje.style.top=ycoord-230+"px"
}


function detaykontrol(){
//window.clearTimeout(timer);
if(document.getElementById('kucres').innerHTML!=""){document.getElementById('kucres').innerHTML="";}
}

function renkal(id){
document.getElementById('renkler').innerHTML="<TABLE BORDER=0 CELLPADDING=2 CELLSPACING=2 width=250><TR><TD align='left' width='100'><img src=images/"+id+" width=30 height=18 style='border:2px solid white;'></TD><TD align='left' width='150'><a href='javascript:void(0)' onclick='javascript:renklerac()'; style='text-decoration:none;'><img src='images/renkler.jpg' width=89 height=12 border=0></a>";
}
function renklerac(){
document.getElementById('renkler').innerHTML="<TABLE BORDER=0 CELLPADDING=2 CELLSPACING=2><TR><TD bgcolor='white'><img src='images/c1.jpg' width='30' height='18' alt='' style='cursor:hand;' onclick=renkal('c1.jpg');></TD><TD bgcolor='white'><img src='images/c2.jpg' width='30' height='18' alt='' style='cursor:hand;' onclick=renkal('c2.jpg');></TD><TD bgcolor='white'><img src='images/c3.jpg' width='30' height='18' alt='' style='cursor:hand;' onclick=renkal('c3.jpg');></TD><TD bgcolor='white'><img src='images/c4.jpg' width='30' height='18' alt='' style='cursor:hand;' onclick=renkal('c4.jpg');></TD><TD bgcolor='white'><img src='images/c5.jpg' width='30' height='18' alt='' style='cursor:hand;' onclick=renkal('c5.jpg');></TD></TR></TABLE>";
}
function kapat(){
document.getElementById('kucres').innerHTML="";
}
function detalya(id,sol){
//window.clearTimeout(timer);
document.getElementById('kucres').innerHTML="<table bgcolor='#ffffff' width='145' height='230' align='center' style='border:1px solid gray;'><tr><td align='center' valign='middle'><img src='images/loading.gif' width=60 height=48 border=0></td></tr></table>";
var IS_IE = document.all && window.ActiveXObject &&  navigator.userAgent.toLowerCase().indexOf("msie") > -1 ;   
var  IS_GECKO = document.implementation && document.implementation.createDocument  && window.XMLHttpRequest && true;    
if (IS_GECKO) {http = new XMLHttpRequest();} else if(IS_IE) {http= new ActiveXObject("Microsoft.XMLHTTP");}
http.open("get", "urunres.php?res="+id);
http.onreadystatechange =function(){if(http.readyState== 4){
document.getElementById('kucres').innerHTML=http.responseText;
document.onmousemove=followmouse;
}}
http.send(null);}

function stokkontrol(stokkodu){
var beden=document.getElementById("beden").value;
var renk=document.getElementById("renk").value;
var adet=document.getElementById("adet").value;

if(beden!=0 && renk!=""){
document.getElementById("stac").innerHTML="";
var IS_IE = document.all && window.ActiveXObject &&  navigator.userAgent.toLowerCase().indexOf("msie") > -1 ;   
var  IS_GECKO = document.implementation && document.implementation.createDocument  && window.XMLHttpRequest && true;    
if (IS_GECKO) {http = new XMLHttpRequest();} else if(IS_IE) {http= new ActiveXObject("Microsoft.XMLHTTP");}
http.open("get", "stkontrol.php?beden="+beden+"&renk="+renk+"&stokkodu="+stokkodu+"&adet="+adet);
http.onreadystatechange =function(){if(http.readyState== 4){
if (beden!="" && renk!=""){
stokkodu=http.responseText;

if (stokkodu.match("<")) {
document.getElementById("stac").innerHTML=http.responseText;
}

stokkontrol2(stokkodu);
stokkontrol3(stokkodu);
}

}}
http.send(null);
}
}

function stokkontrolprom(){
var adet=document.getElementById("adet").value;
var stokkodu=document.getElementById('beden').value;
var beden=document.getElementById('beden').value;
if(beden!=""){
document.getElementById("stac").innerHTML="";
var IS_IE = document.all && window.ActiveXObject &&  navigator.userAgent.toLowerCase().indexOf("msie") > -1 ;   
var IS_GECKO = document.implementation && document.implementation.createDocument  && window.XMLHttpRequest && true;    
if (IS_GECKO) {
	http = new XMLHttpRequest();
} else if(IS_IE) {
	http= new ActiveXObject("Microsoft.XMLHTTP");
}
http.open("get", "stkontrolprom.php?stokkodu="+stokkodu+"&adet="+adet);
http.onreadystatechange =function(){
	if(http.readyState== 4){
		if (beden!=""){
			stokkodu=http.responseText;
			if (stokkodu.match("<")) {
			document.getElementById("stac").innerHTML=http.responseText;
			}
			stokkontrol2(stokkodu);
			stokkontrol3(stokkodu);
	}

}}
http.send(null);
}
}


function adetdegistir(idsi){
var adet=document.getElementById("adet").value;
document.getElementById('satinal').innerHTML="<A href='addbasket.php?id="+idsi+"&adet="+adet+"&islem=add' ><IMG SRC='images/urun-ek_01.jpg' BORDER=0 ALT=''></A>";
document.getElementById('hsatinal').innerHTML="<A HREF='purchasenom.php?urunid="+idsi+"&adet="+adet+"&islem=add'><IMG SRC='images/urun-ek_03.jpg' BORDER=0 ALT=''></A>";
}

function tavsiye(){
window.open('tavsiye.php?sayfa='+location+'&groupid=<?=$groupid?>','new','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no, copyhistory=no,width=200,height=200');
}


function stokkontrol2(stokkodu){
document.getElementById('satinal').innerHTML="";
var adet=document.getElementById("adet").value;
var IS_IE = document.all && window.ActiveXObject &&  navigator.userAgent.toLowerCase().indexOf("msie") > -1 ;   
var IS_GECKO = document.implementation && document.implementation.createDocument  && window.XMLHttpRequest && true;    
if (IS_GECKO) {http = new XMLHttpRequest();} else if(IS_IE) {http= new ActiveXObject("Microsoft.XMLHTTP");}
http.open("get", "stkontrol2.php?stokkodu="+stokkodu+"&adet="+adet);
http.onreadystatechange =function(){if(http.readyState== 4){
document.getElementById('satinal').innerHTML=http.responseText;}

}
http.send(null);
}


function beden(clid2){
document.getElementById('beden').innerHTML="";
var IS_IE = document.all && window.ActiveXObject &&  navigator.userAgent.toLowerCase().indexOf("msie") > -1 ;   
var  IS_GECKO = document.implementation && document.implementation.createDocument  && window.XMLHttpRequest && true;    
if (IS_GECKO) {http = new XMLHttpRequest();} else if(IS_IE) {http= new ActiveXObject("Microsoft.XMLHTTP");}
http.open("get", "bedengetir.php?clid="+clid2);
http.onreadystatechange =function(){if(http.readyState== 4){
document.getElementById('beden').innerHTML=http.responseText;}

}
http.send(null);
}

function beden2(clid2){
document.getElementById('beden2').innerHTML="";
var IS_IE = document.all && window.ActiveXObject &&  navigator.userAgent.toLowerCase().indexOf("msie") > -1 ;   
var  IS_GECKO = document.implementation && document.implementation.createDocument  && window.XMLHttpRequest && true;    
if (IS_GECKO) {http2 = new XMLHttpRequest();} else if(IS_IE) {http2= new ActiveXObject("Microsoft.XMLHTTP");}
http2.open("get", "bedengetir2.php?clid="+clid2);
http2.onreadystatechange =function(){if(http2.readyState== 4){
document.getElementById('beden2').innerHTML=http2.responseText;}

}
http2.send(null);
}

function cesit(clid){
document.getElementById('cesit2').innerHTML="";
var IS_IE = document.all && window.ActiveXObject &&  navigator.userAgent.toLowerCase().indexOf("msie") > -1 ;   
var  IS_GECKO = document.implementation && document.implementation.createDocument  && window.XMLHttpRequest && true;    
if (IS_GECKO) {http = new XMLHttpRequest();} else if(IS_IE) {http= new ActiveXObject("Microsoft.XMLHTTP");}
http.open("get", "cesitgetir.php?clid="+clid);
http.onreadystatechange =function(){if(http.readyState== 4){
document.getElementById('cesit2').innerHTML=http.responseText;}
}
http.send(null);
}


function stokkontrol3(stokkodu){
document.getElementById('hsatinal').innerHTML="";
var adet=document.getElementById("adet").value;
var IS_IE = document.all && window.ActiveXObject &&  navigator.userAgent.toLowerCase().indexOf("msie") > -1 ;   
var IS_GECKO = document.implementation && document.implementation.createDocument  && window.XMLHttpRequest && true;    
if (IS_GECKO) {http2 = new XMLHttpRequest();} else if(IS_IE) {http2= new ActiveXObject("Microsoft.XMLHTTP");}
http2.open("get", "stkontrol3.php?stokkodu="+stokkodu+"&adet="+adet);
http2.onreadystatechange =function(){if(http2.readyState== 4){
document.getElementById('hsatinal').innerHTML=http2.responseText;}
}
http2.send(null);
}

function resdeg(resim){
document.getElementById('anares').innerHTML="<img src=yuv.php?res="+resim+">";
}

function hatirekle(stokkodu){
var hatirmail=document.getElementById("hatirmail").value;
var IS_IE = document.all && window.ActiveXObject &&  navigator.userAgent.toLowerCase().indexOf("msie") > -1 ;   
var IS_GECKO = document.implementation && document.implementation.createDocument  && window.XMLHttpRequest && true;    
if (IS_GECKO) {http2 = new XMLHttpRequest();} else if(IS_IE) {http2= new ActiveXObject("Microsoft.XMLHTTP");}
http2.open("get", "hatirekle.php?stokkodu="+stokkodu+"&hatirmail="+hatirmail);
http2.onreadystatechange =function(){if(http2.readyState== 4){
document.getElementById('stac').innerHTML=http2.responseText;}
}
http2.send(null);



}
function mailekle(stokkodu){
	if (stokkodu=='') {
		alert("Lütfen doðru email adresinizi girin.");
	}else{
		document.getElementById('stac').innerHTML="<font face='Arial,Helvetica,sans-serif' size='1' color='#ffffff'><br>Lütfen bekleyin..</font>";
		document.getElementById('hatirmail').value="";
		var hatirmail=document.getElementById("hatirmail").value;
		var IS_IE = document.all && window.ActiveXObject &&  navigator.userAgent.toLowerCase().indexOf("msie") > -1 ;   
		var IS_GECKO = document.implementation && document.implementation.createDocument  && window.XMLHttpRequest && true;    
		if (IS_GECKO) {	http = new XMLHttpRequest(); }
		else if(IS_IE) { http= new ActiveXObject("Microsoft.XMLHTTP"); }
		http.open("get", "hatirekle.php?stokkodu="+stokkodu+"&hatirmail="+hatirmail);
		http.onreadystatechange =function(){
			if(http.readyState== 4){
				document.getElementById('stac').innerHTML=http.responseText;
			}
		}
		http.send(null);
	}
}

function hatirekle2(stokkodu){
	var IS_IE = document.all && window.ActiveXObject &&  navigator.userAgent.toLowerCase().indexOf("msie") > -1 ;   
	var IS_GECKO = document.implementation && document.implementation.createDocument  && window.XMLHttpRequest && true;    
	if (IS_GECKO) {http2 = new XMLHttpRequest();} else if(IS_IE) {http2= new ActiveXObject("Microsoft.XMLHTTP");}
	http2.open("get", "hatirekle.php?stokkodu="+stokkodu);
	http2.onreadystatechange =function(){if(http2.readyState== 4){
		document.getElementById('stac').innerHTML=http2.responseText;}
	}
	http2.send(null);
}




function sizin(sayfa){		
		var IS_IE    = document.all && window.ActiveXObject && navigator.userAgent.toLowerCase().indexOf("msie") > -1 ;   
		var IS_GECKO = document.implementation && document.implementation.createDocument  && window.XMLHttpRequest && true;    
		if(IS_GECKO){
		  http2 = new XMLHttpRequest();
		} else if(IS_IE) {
		  http2= new ActiveXObject("Microsoft.XMLHTTP");
		}

		http2.open("get", "tarifler.php?t="+sayfa);
		http2.onreadystatechange = function(){					
			if(http2.readyState==4){
			  document.getElementById('sizinID').innerHTML = http2.responseText;
		    }
	    }
		http2.send(null);
}





function burc(){
  window.open('burclar.php','new','width=1024,height=700');
}

function habergetir(id,divid,toplamsay){
	for(a=1;a<toplamsay;a++){
	  document.getElementById(a).innerHTML="";
	}
    
	document.getElementById(toplamsay).innerHTML="";
	
	var IS_IE = document.all && window.ActiveXObject &&  navigator.userAgent.toLowerCase().indexOf("msie") > -1 ;   
	var IS_GECKO = document.implementation && document.implementation.createDocument  && window.XMLHttpRequest && true;    
		if (IS_GECKO) {http2 = new XMLHttpRequest();} else if(IS_IE) {http2= new ActiveXObject("Microsoft.XMLHTTP");}
		http2.open("get", "habergetir.php?id="+id);
		http2.onreadystatechange = function(){if(http2.readyState== 4){
			document.getElementById(divid).innerHTML=http2.responseText;
		}
	}
	
	http2.send(null);
}
