var popUpWin=0;
function popPencere(URLStr, align, width, height, msgid){
	if( align == 'center' ){
		var left = (screen.width/2) - width/2;
		var top = (screen.height/2) - height/2;
	} else {
		var left = 0;
		var top = 0;
	}
	popUpWin = open(URLStr, 'popUpWin'+msgid, 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbar=no,resizable=yes,copyhistory=yes,width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+'');
}

function RG(ID){
         popPencere("http://www.indirimci.com/v2/urun.resim.php?id="+ID, "center", 15, 15, 'RESIM');
}




function keyDown(evt)
{
var urunler = document.getElementsByTagName('urun');
var Secilen;

if(evt.keyCode == 40) {
Secilen=1;
for (i = 1; i <= urunler.length; i++) {
  if(document.getElementById('a'+i).className=='b') {
     Secilen = i+1;
  }
}

if(Secilen>10) {
Secilen = 1;
}

for (i = 1; i <= urunler.length; i++) {
  if(Secilen == i) {
     document.getElementById('a'+i).className='b';
     document.getElementById("kelime").value = document.getElementById('a'+i).title;
  }else{
     document.getElementById('a'+i).className='a';
  }
}


}

if(evt.keyCode == 38) {
Secilen=10;
for (i = 1; i <= urunler.length; i++) {
  if(document.getElementById('a'+i).className=='b') {
     Secilen = i-1;
  }
}
if(Secilen<1) {
Secilen = 10;
}
for (i = 1; i <= urunler.length; i++) {
  if(Secilen == i) {
     document.getElementById('a'+i).className='b';
     document.getElementById("kelime").value = document.getElementById('a'+i).title;

  }else{
     document.getElementById('a'+i).className='a';
  }
}

}

}

var xmlHttp

function disableEnterKey(e)
{
     var key;
     if(window.event)
          key = window.event.keyCode; //IE
     else
          key = e.which; //firefox

     return (key != 13);
}

function temizle(){
 document.getElementById("livesearch").innerHTML="";
 document.getElementById("livesearch").style.border="0px";
}

function showResult(str,evt)
{
if((evt.keyCode != 38) && (evt.keyCode != 40)) {

if (((str.length==0) && (str=='')) || (str.length < 3))
 {
 temizle();
 return
 }

xmlHttp=GetXmlHttpObject();

if (xmlHttp==null)
 {
 alert ("Browser does not support HTTP Request")
 return
 }


var url="http://www.beratpazarlama.com/livesearch.php"
url=url+"?q="+str
url=url+"&sid="+Math.random()
xmlHttp.onreadystatechange=stateChanged

xmlHttp.open("GET",url,true)
xmlHttp.send(null)

}
}

function stateChanged()
{
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 {
 document.getElementById("livesearch").innerHTML=xmlHttp.responseText;
 document.getElementById("livesearch").style.border="1px solid #A5ACB2";
 }
}

function GetXmlHttpObject()
{
var xmlHttp=null;
try
 {
 // Firefox, Opera 8.0+, Safari
 xmlHttp=new XMLHttpRequest();
 }
catch (e)
 {
 // Internet Explorer
 try
  {
  xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
  }
 catch (e)
  {
  xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
 }
return xmlHttp;

}