// JavaScript Document
var oldSpanId = "";
var newSpanId = "";
function openClose(Id){
    oldSpanId = newSpanId;
    newSpanId = Id;

	if(oldSpanId == newSpanId){
		if(document.getElementById("span"+newSpanId).style.display == "inline"){
			document.getElementById("span"+newSpanId).style.display = "none"; 
		}else{
			document.getElementById("span"+newSpanId).style.display = "inline";
		}
	}
	else{
		if(document.getElementById("span"+newSpanId )){
			document.getElementById("span"+newSpanId ).style.display = "inline";
		}

		if(oldSpanId!=""){
			document.getElementById("span"+oldSpanId).style.display = "none";       
		}
	
	}
}

function PicViewBg(src)
{
	var x;
	if (self.innerHeight)
		x = self.innerWidth;
	else if (document.documentElement && document.documentElement.clientHeight)
		x = document.documentElement.clientWidth;
	else if (document.body)
		x = document.body.clientWidth;

	var obj		= document.getElementById('picviewer').style;
	obj.background 	= "#fff url('"+src+"') no-repeat center";
	obj.left 	= x/2-10+'px';

}

function PicView2(src)
{
	var x;
	if (self.innerHeight)
		x = self.innerWidth;
	else if (document.documentElement && document.documentElement.clientHeight)
		x = document.documentElement.clientWidth;
	else if (document.body)
		x = document.body.clientWidth;

	var obj		= document.getElementById('picviewer2').style;
	obj.background 	= "#fff url('"+src+"') no-repeat center";
	obj.left 	= x/2-210+'px';

}

///email ellenorzés
function echeck(str) {
		
		var errM="Hibás e-mail cím!"
		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		if (str.indexOf(at)==-1){
		   alert(errM)
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   alert(errM)
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    alert(errM)
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    alert(errM)
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    alert(errM)
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    alert(errM)
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1){
		    alert(errM)
		    return false
		 }

 		 return true					
	}

function ValidateForm(){
	var emailID=document.cart.email
	var nameID=document.cart.name
	var telID=document.cart.tel
	var boltID=document.cart.bolt
	
	if ((nameID.value==null)||(nameID.value=="")){
		alert("Adja meg a nevét!")
		nameID.focus()
		return false
	}
	if ((emailID.value==null)||(emailID.value=="")){
		alert("Nem adott meg e-mail címet!")
		emailID.focus()
		return false
	}
	if (echeck(emailID.value)==false){
		emailID.value=""
		emailID.focus()
		return false
	}
	if ((telID.value==null)||(telID.value=="")){
		alert("Adja meg a telefonszámát!")
		telID.focus()
		return false
	}
	if ((boltID.value==null)||(boltID.value=="_none_")){
		alert("Adja meg a vásárlás helyét!")
		telID.focus()
		return false
	}
	return true
 }
/// end e-mail 



