function BigPicture(){
   var DivRef = document.getElementById('PictureBig');
   var IfrRef = document.getElementById('DivShim');

	if(DivRef.style.visibility=='hidden'){
		DivRef.style.visibility='visible'
		DivRef.style.zIndex=100;
		IfrRef.style.width = DivRef.offsetWidth;
		IfrRef.style.height = DivRef.offsetHeight;
		IfrRef.style.top = DivRef.style.top;
		IfrRef.style.left = DivRef.style.left;
		IfrRef.style.zIndex = DivRef.style.zIndex - 1;
		IfrRef.style.display = "block";
	}else{
		DivRef.style.visibility='hidden';
		DivRef.style.zIndex=-1;
		IfrRef.style.display = "none";
	}

}




function sizeEdit(){
	for (i=0;i<BuyFlower.price.length;i++) {
			if (BuyFlower.price[i].checked){
				sel=true;
				break;
			}
		}

	switch (BuyFlower.price[i].value){
		case 'list':
			PriceSpan.className="TextSpanEffectDetailsOn";
			UpgradeSpan.className="TextSpanEffectDetailsOff";
			CustomSpan.className="TextSpanEffectDetailsOff";
			BuyFlower.CustomPrice.value='';
			BuyFlower.CustomPrice.disabled=true;
			break;
		case 'upgrade':
			PriceSpan.className="TextSpanEffectDetailsOff";
			UpgradeSpan.className="TextSpanEffectDetailsOn";
			CustomSpan.className="TextSpanEffectDetailsOff";
			BuyFlower.CustomPrice.value='';
			BuyFlower.CustomPrice.disabled=true;
			break;
		case 'custom':
			PriceSpan.className="TextSpanEffectDetailsOff";
			UpgradeSpan.className="TextSpanEffectDetailsOff";
			CustomSpan.className="TextSpanEffectDetailsOn";
			BuyFlower.CustomPrice.disabled=false;
			BuyFlower.CustomPrice.focus();
			break;
	}
}

function popImageBig(idProd){
	OpenCenterPop("popImage.asp?idProduct=" + idProd, "ImagePop", 300, 380);
}

function OpenCenterPop(link, nombre, ancho, alto){
  derecha=(screen.width-ancho)/2;
  arriba=(screen.height-alto)/2;
  string="toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width="+ancho+",height="+alto+",left="+derecha+",top="+arriba+"";
  fin=window.open(link,nombre,string);
}

function OpenTaf(idProduct){
	OpenCenterPop("popTaf.asp?lang=en-us&idProduct=" + idProduct, "taf", 550, 352)
}

function RollOverIcons(num, msg){
	obj=document.getElementById("span" + num)
	switch (msg){
		case 'nothing':
			out=""
			break;
		case 'Taf':
			out="Tell a friend"
			break;
		case 'Info':
			out="View full description"
			break;
		case 'Whishlist':
			out="Add to favorites"
			break;
			}
	obj.innerHTML=out
}

function OptionChange(){
	if (signIn.Option(1).checked){
		signIn.password.disabled=true;
	}else{
		signIn.password.disabled=false;
	}
}

function checkForm(){

	var sel=false;
	for (i=0;i<signIn.length;i++) {
		if (signIn[i].checked){
			sel=true;
			break;
		}
	}

	if (!sel){
		MsgError.innerHTML="Choose a register kind."
		return(false)
	}

	if(signIn.email.value==''){
		MsgError.innerHTML="The email is blank."
		signIn.email.focus();
		return(false)
	}
	

	if (!echeck(signIn.email.value)){
		signIn.email.focus();
		return(false)
	}
	
	if (signIn.Option(0).checked && signIn.password.value==''){
		MsgError.innerHTML="The password must not be blank"
		signIn.password.focus();	
		return(false)
	}

}

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){
		   MsgError.innerHTML="Invalid E-mail Address"
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   MsgError.innerHTML= "Invalid E-mail Address"
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    MsgError.innerHTML= "Invalid E-mail Address"
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    MsgError.innerHTML= "Invalid E-mail Address"
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    MsgError.innerHTML= "Invalid E-mail Address"
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    MsgError.innerHTML= "Invalid E-mail Address"
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1){
		    MsgError.innerHTML= "Invalid E-mail Address"
		    return false
		 }

 		 return true					
}

function popTaf(idProd){
	OpenCenterPop("popTaf.asp?idProduct=" + idProd, "TafPop", 350, 394);
}

function SearchFocus(action){
	if (action=='in'){
		if (searchForm.Search.value=="Search"){
			searchForm.Search.value="";
		}
	}else{
		if (searchForm.Search.value==""){
			searchForm.Search.value="Search";
		}
	}
}


function checkCampo(nombrecampo, nombre, tipo, requerido){

	var temp=""
	var obj=document.getElementById(nombrecampo)
	objError=document.getElementById("ErrorSpam")

	valor=obj.value

	for (i=0; i<valor.length ; i++){
		if (valor.charAt(i)!="'"){
			temp=temp + valor.charAt(i)
		}
		
	}
	valor=temp
	
	if (tipo=="numero"){
		if (requerido==1 && (valor=="" || valor=="0")){
			objError.innerHTML="<font face=verdana size=1 color=red><b>"+nombre + " can not be blank.</b></font>";
			obj.focus();
			location.hash="#";
			return (false)
		}
	}else{
		if (requerido==1 && valor==""){
			objError.innerHTML="<font face=verdana size=1 color=red><b>"+nombre + " can not be blank.</b></font>";
			obj.focus();
			location.hash="#";
			return (false)
		}
	}
	
	if (tipo=="email" && valor!=""){
		if (valor.indexOf("@")<2 || valor.lastIndexOf("@")>=valor.length-2 || valor.lastIndexOf(".")<valor.lastIndexOf("@")){
			objError.innerHTML="<font face=verdana size=1 color=red><b>"+nombre + " must be a valid e-mail address.</b></font>";
			obj.focus();
			location.hash="#";
			return (false)
		}
	}
	obj.value=valor
	
	return "ok"
		
}

function MemberLogin(){
	if (DivRegisterBanner.style.visibility=='hidden'){
		 DivRegisterBanner.style.visibility='visible'
	}else{
		DivRegisterBanner.style.visibility="hidden"
	}
}



function checkField(errorOut, nombrecampo, nombre, tipo, requerido){
//Llamada: if (checkField('idDelSpanDondeSeMuestraElError', 'NameDelCampo', 'TextoNombreDelCampo', 'Tipo', Requerido1o0)!="ok") return
//Atencion: si el tipo es radio se le pasa el nombre del campo no el id.


	var temp=""
	var obj=document.getElementById(nombrecampo)
	objDiv=document.getElementById("Div_" + errorOut)
	objError=document.getElementById(errorOut)
	objError.innerHTML=""
	objDiv.style.visibility="hidden"
	obj.style.backgroundColor="white"
	
	valor=obj.value

	if (tipo!="radio"){
		//saca del valor las '
		for (i=0; i<valor.length ; i++){
			if (valor.charAt(i)!="'"){
				temp=temp + valor.charAt(i)
			}
		}
		valor=temp
	}
	
	if (requerido==1 && valor==""){
		objDiv.style.visibility="visible"
		objError.innerHTML="<font face=verdana size=1 color=red><b>" + nombre + " can not be blank.</b></font>"
		location.hash="href_" + errorOut;
		obj.style.backgroundColor="#F9FF9D"
		obj.focus();
		return (false)
	}
	switch (tipo){
		case "numero":
			if (isNaN(valor)){
				objDiv.style.visibility="visible"
				objError.innerHTML="<font face=verdana size=1 color=red><b>" + nombre + " must be numeric.</b></font>"
				location.hash="href_" + errorOut;
				obj.style.backgroundColor="#F9FF9D"
				obj.focus();
				return (false)
			}
			break
			
		case "email":
			if (valor.length>0){
				chequeoEmail=emailCheck(valor)
				if (chequeoEmail=="Invalid E-mail Address"){
					objDiv.style.visibility="visible"
					objError.innerHTML="<font face=verdana size=1 color=red><b>" + chequeoEmail + "</b></font>"
					location.hash="href_" + errorOut;
					obj.style.backgroundColor="#F9FF9D"
					obj.focus();
					return (false)
				}
			}
			break
			
		case "radio":
			var obj=document.getElementsByName(nombrecampo)
			if (requerido==1){
				for (i=0;i<obj.length;i++) {
					if (obj[i].checked){
						sel=true;
						break;
					}
				}
				if (!sel){
					objDiv.style.visibility="visible"
					objError.innerHTML="<font face=verdana size=1 color=red><b>Please select a "+nombre + ".</b></font>";
					location.hash="href_" + errorOut;
					obj.style.backgroundColor="#F9FF9D"
					obj.focus();
					return (false)
				}
			}

	}
	if (tipo!="radio"){
		obj.value=valor
	}
	

	return "ok"
		
}

function emailCheck(str) {
		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		if (str.indexOf(at)==-1){
		   return "Invalid E-mail Address"
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   return "Invalid E-mail Address"
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		   return "Invalid E-mail Address"
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    return "Invalid E-mail Address"
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    return "Invalid E-mail Address"
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    return "Invalid E-mail Address"
		 }
		
		 if (str.indexOf(" ")!=-1){
		    return "Invalid E-mail Address"
		 }

 		 return str					
}


function checkField(errorOut, nombrecampo, nombre, tipo, requerido){

//Llamada: if (checkField('idDelSpanDondeSeMuestraElError', 'NameDelCampo', 'TextoNombreDelCampo', 'Tipo', Requerido1o0)!="ok") return
//Atencion: si el tipo es radio se le pasa el nombre del campo no el id.


	var temp=""
	var obj=document.getElementById(nombrecampo)
	objError=document.getElementById(errorOut)
	objError.innerHTML=""
	obj.style.backgroundColor="white"
	var min=6;
	valor=obj.value

	if (tipo!="radio"){
		//saca del valor las '
		for (i=0; i<valor.length ; i++){
			if (valor.charAt(i)!="'"){
				temp=temp + valor.charAt(i)
			}
		}
		valor=temp
	}
	
	if (requerido==1 && valor==""){
		objError.innerHTML="" + nombre + " can not be blank."
		location.hash="href_" + errorOut;
		obj.style.backgroundColor="#F9FF9D"
		obj.focus();
		return (false)
	}
	switch (tipo){
		case "numero":
			if (isNaN(valor)){
				objError.innerHTML="" + nombre + " must be numeric."
				location.hash="href_" + errorOut;
				obj.style.backgroundColor="#F9FF9D"
				obj.focus();
				return (false)
			}
			break
			
		case "email":
			if (valor.length>0){
				chequeoEmail=emailCheck(valor)
				if (chequeoEmail=="Invalid E-mail Address"){
					objError.innerHTML="" + chequeoEmail + ""
					location.hash="href_" + errorOut;
					obj.style.backgroundColor="#F9FF9D"
					obj.focus();
					return (false)
				}
			}
			break
			
		case "radio":
			var obj=document.getElementsByName(nombrecampo)
			if (requerido==1){
				for (i=0;i<obj.length;i++) {
					if (obj[i].checked){
						sel=true;
						break;
					}
				}
				if (!sel){
					objError.innerHTML="Please select a "+nombre + ".";
					location.hash="href_" + errorOut;
					obj.style.backgroundColor="#F9FF9D"
					obj.focus();
					return (false)
				}
			}
		case "clave":
			if (valor.length>0 && valor.length < min){
				objError.innerHTML="" + nombre + " must be at least " + min + " characters long.";
				obj.focus();
				location.hash="#";
				return (false)
			}
			break
		}
	if (tipo!="radio"){
		obj.value=valor
	}
	

	return "ok"
		
}

function CheckNewsForm(){
	if (checkField('newsLetterMsgSpan', 'NewsEmail', '<%=getlang(page, language, "jsEmail")%>', 'email', 1)!="ok") event.returnValue=false
}