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.ngstores.com/urun.resim.php?id="+ID, "center", 15, 15, 'RESIM');
}

function BSAKontrol(){
var HataMesaji = "";
if(!document.getElementById('bsaadi').value) {
HataMesaji += "Lütfen Adınızı Yazınız\n";
}
if(!document.getElementById('bsasoyadi').value) {
HataMesaji += "Lütfen Soyadınızı Yazınız\n";
}
if(!document.getElementById('bsatel').value) {
HataMesaji += "Lütfen Telefonunuzu Yazınız\n";
}
if(HataMesaji) {
alert(HataMesaji);
}else{
document.getElementById('formbsa').submit();
}
}



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.ngstores.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;

}

function gradient(id, level)
{
	var box = document.getElementById(id);
	box.style.opacity = level;
	box.style.MozOpacity = level;
	box.style.KhtmlOpacity = level;
	box.style.filter = "alpha(opacity=" + level * 100 + ")";
	box.style.display="block";
	return;
}


function fadein(id)
{
	var level = 0;
	while(level <= 1)
	{
		setTimeout( "gradient('" + id + "'," + level + ")", (level* 1000) + 10);
		level += 0.01;
	}
}


// Open the lightbox


function openbox(formtitle, fadin)
{
  //$("body","html").css({height: "100%", width: "100%"});
  //$("html").css("overflow","hidden");
  var box = document.getElementById('box');
  document.getElementById('filter').style.display='block';


  if(fadin)
  {
	 gradient("box", 0);
	 fadein("box");
  }
  else
  {
    box.style.display='block';
  }
}


// Close the lightbox

function closebox()
{
   document.getElementById('box').style.display='none';
   document.getElementById('filter').style.display='none';
}

function sifu()
{
    window.location.href = "http://www.ngstores.com/hesabim/sifremi-unuttum/";
}