var alertbox = false;
var isIE = (navigator.appName == "Microsoft Internet Explorer");

function bevitel_csakszam(e) {
var Key = e.keyCode;
if (Key == 0) {Key = e.which}
if ((Key >= 48 && Key <= 57) || Key == 8 || Key == 9 || Key == 37 || Key == 38 || Key == 39 || Key == 11 || Key == 12 || Key == 46) 
return true;
return false;
}


function db_modosit(db,id)
{
  
  if (!alertbox) {  document.location.href='index.php?m=shop&a=kosarba&db='+db+'&id='+id;}
}



var fotoablak1;
var fotoablak2;
var fotoablak3;
function termekablak(cim,x,y)
{
   fotoablak1 = window.open("about:blank","Fotoablak","width="+x+",height="+y);
   with (fotoablak1.document) {
   open("text/html");
   write('<html><head><title>Gastrocentrum</title></head><body MARGINHEIGHT="0" MARGINWIDTH="0" LEFTMARGIN="0" TOPMARGIN="0" ><img src="/kepek/shop/'+ cim +'_1.jpg"  border=0 alt="" /></body></html>');
   close();            
   }
}
function termekablak2(cim,x,y)
{
   fotoablak1 = window.open("about:blank","Fotoablak","width="+x+",height="+y);
   with (fotoablak1.document) {
   open("text/html");
   write('<html><head><title>Gastrocentrum</title></head><body MARGINHEIGHT="0" MARGINWIDTH="0" LEFTMARGIN="0" TOPMARGIN="0" ><img src="/kepek/shop/'+ cim +'_2.jpg"  border=0 alt="" /></body></html>');
   close();            
   }
}
function termekablak3(cim,x,y)
{
   fotoablak1 = window.open("about:blank","Fotoablak","width="+x+",height="+y);
   with (fotoablak1.document) {
   open("text/html");
   write('<html><head><title>Gastrocentrum</title></head><body MARGINHEIGHT="0" MARGINWIDTH="0" LEFTMARGIN="0" TOPMARGIN="0" ><img src="/kepek/shop/'+ cim +'_3.jpg"  border=0 alt="" /></body></html>');
   close();            
   }
}

function set_innerhtml(divnev,html)
{
if (document.getElementById)
{
// this is the way the standards work
var style2 = document.getElementById(divnev).innerHTML = html;
}
else if (document.all)
{
// this is the way old msie versions work
 document.all[divnev].innerHTML = html;
}
else if (document.layers)
{
// this is the way nn4 works
var style2 = document.layers[divnev].innerHTML = html;
}
}



/**
 * DHTML email validation script. Courtesy of SmartWebby.com (http://www.smartwebby.com/dhtml/)
 */

function echeck(str) {

		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		if (str.indexOf(at)==-1){
		   alert("Invalid E-mail ID")
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   alert("Invalid E-mail ID")
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    alert("Invalid E-mail ID")
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    alert("Invalid E-mail ID")
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    alert("Invalid E-mail ID")
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    alert("Invalid E-mail ID")
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1){
		    alert("Invalid E-mail ID")
		    return false
		 }

 		 return true					
	}

function validate(form_id,email) {
   var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
   var address = document.forms[form_id].elements[email].value;
   if(reg.test(address) == false) {
      return false;
   }
   else return true;
}


