var link=''

function swapPhoto(photoSRC) {

document.images.imgPhoto.src = 'http://www.passegginichicco.com/immagini/articoli/foto/'+photoSRC;
link='http://www.passegginichicco.com/immagini/articoli/foto480/'+photoSRC;
window.location.href="#zoom"
//swap thumbnail pics with main pic

}

function erroreColore(){
		alert("You need to select one of the available options");
		return false;
		}

var cookiesEnabled = false;
 

// Check whether cookies enabled

   document.cookie = "Enabled=true";
   var cookieValid = document.cookie;
   
   // if retrieving the VALUE we just set actually works 
   // then we know cookies enabled
   if (cookieValid.indexOf("Enabled=true") != -1)
   {
      cookiesEnabled = true;
   }
   else
   {
      cookiesEnabled = false;
   }

//if((cookiesEnabled)||(window.location!="cookies.asp")) window.location="cookies.asp"
//else document.write("resi.asp")

function checkSearch(){
	i=document.ricerca.cerca.value;
	j=document.ricerca.prezzoMin.value;
	k=document.ricerca.prezzoMax.value;
	
	if ((i==0) && (j==0) && (k==0)) {
	alert("Fill the search field with at least one word!");
	document.ricerca.cerca.focus();
	return false;}
	
	if ((isNaN(j) || isNaN(k)) && (i==0)) {
	alert("Inserire solo valori numerici senza decimali nč punti nč virgole.");
	document.ricerca.cerca.focus();
	return false;}

	if (isNaN(j) && (j!=0)) {
	alert("Inserire solo valori numerici senza decimali nč punti nč virgole.");
	document.ricerca.cerca.focus();
	return false;}

	if (isNaN(k) && (k!=0)) {
	alert("Inserire solo valori numerici senza decimali nč punti nč virgole.");
	document.ricerca.cerca.focus();
	return false;}

	if ((j.indexOf(",")!=-1) || (j.indexOf(".")!=-1) || (k.indexOf(",")!=-1) || (k.indexOf(".")!=-1)){
	alert("Inserire solo valori numerici senza decimali nč punti nč virgole.");
	document.ricerca.cerca.focus();
	return false;}
	}


function checkCountry(){
	ok=0
	for (i=0;i<document.cartItems.radioGroup.length;i++){
	if (document.cartItems.radioGroup[i].checked==true)
	ok=1
	}
	if (ok==0) {
	alert("You need to select your country in order to proceed");
	return false;}
	}

function colore(){
	i=document.form1.colore.value;
	if (i==0) {
	alert("You need to pick a colour among the available ones");
	document.form1.colore.focus();
	return false;}
	}

function carrozza(){
	
	OK=false;
	for(var j=0;j<document.modulo.idTelaio.length;j++)
	 {if (document.modulo.idTelaio[j].checked)  {
	 OK=true;}
	 }
	
	if (OK==false) {
	alert("You need to pick a chassis among the available ones");
	return false;}
	
	}

function corredo(){
	OK=false;
	for(var j=0;j<document.modulo.elements.length;j++)
	 {if (document.modulo.elements[j].type=="checkbox")  {
			 if (document.modulo.elements[j].checked)  {
			 OK=true;}
	 }
	 }
	
	if (OK==false) {
	alert("You need to pick at least one item among the available ones");
	return false;}

	i=document.form1.colore.value;
	
	if (i==0) {
	alert("You need to pick a colour among the available ones");
	document.form1.colore.focus();
	return false;}	
	}

function checkCercaOrdine(){
	i=document.cercaOrdine.email.value.length;
	if (i==0) {
	alert("Please fill in the email field");
	document.cercaOrdine.email.focus();
	return false;}
	
	i=document.cercaOrdine.codiceOrdine.value.length;
	if (i==0) {
	alert("Please fill in the order field");
	document.cercaOrdine.codiceOrdine.focus();
	return false;}
	}

function formValidation(){
	i=document.moduloOrdine.cognome.value.length;
	if (i==0) {
	alert("Please fill in the surname field");
	document.moduloOrdine.cognome.focus();
	return false;}
	
	i=document.moduloOrdine.nazione.value;
	if (i==-1) {
	alert("You need to select your country");
	document.moduloOrdine.nazione.focus();
	return false;}

	i=document.moduloOrdine.nome.value.length;
	if (i==0) {
	alert("Please fill in the name field");
	document.moduloOrdine.nome.focus();
	return false;}
		
	i=document.moduloOrdine.cap.value.length;
	if (i==0) {
	alert("Please fill in the zip code field");
	document.moduloOrdine.cap.focus();
	return false;}
	
	i=document.moduloOrdine.comune.value.length;
	if (i==0) {
	alert("Please fill in the town field");
	document.moduloOrdine.comune.focus();
	return false;}
	
	i=document.moduloOrdine.provincia.value;
	if (i==-1) {
	alert("Please fill in the county field");
	document.moduloOrdine.provincia.focus();
	return false;}

	i=document.moduloOrdine.telefono.value.length;
	if (i==0) {
	alert("Please fill in the phone field");
	document.moduloOrdine.telefono.focus();
	return false;}

	i=document.moduloOrdine.indirizzo.value.length;
	if (i==0) {
	alert("Please fill in the address field");
	document.moduloOrdine.indirizzo.focus();
	return false;}

	i=document.moduloOrdine.email.value.length;
	if (i==0) {
	alert("Please fill in the email field");
	document.moduloOrdine.email.focus();
	return false;}

}

function newWindow(mypage,myname,w,h,features) {
  if(screen.width){
  var winl = (screen.width-w)/2;
  var wint = (screen.height-h)/2;
  }else{winl = 0;wint =0;}
  if (winl < 0) winl = 0;
  if (wint < 0) wint = 0;
  var settings = 'height=' + h + ',';
  settings += 'width=' + w + ',';
  settings += 'top=' + wint + ',';
  settings += 'left=' + winl + ',';
  settings += features;
  win = window.open(mypage,myname,settings);
  win.window.focus();
}

function newWindowPromo(mypage,myname,w,h,features) {
  if(screen.width){
  var winl = (screen.width-w)/2;
  var wint = 10;
  }else{winl = 0;wint =0;}
  if (winl < 0) winl = 0;
  if (wint < 0) wint = 0;
  var settings = 'height=' + h + ',';
  settings += 'width=' + w + ',';
  settings += 'top=' + wint + ',';
  settings += 'left=' + winl + ',';
  settings += features;
  win = window.open(mypage,myname,settings);
  win.window.focus();
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}