// JavaScript Document
function popUp(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,width=560,height=560,left = 100,top = 0');");
}

function CaricaFoto(img){
  foto1= new Image();
  foto1.src=(img);
  Controlla(img);
}
function Controlla(img){
  if((foto1.width!=0)&&(foto1.height!=0)){
    viewFoto(img);
  }
  else{
    funzione="Controlla('"+img+"')";
    intervallo=setTimeout(funzione,20);
  }
}
function viewFoto(img){
  largh=foto1.width+20;
  altez=foto1.height+20;
  stringa="width="+largh+",height="+altez;
  finestra=window.open(img,"",stringa);
}

function checkform(thisform)
	{
	// This function checks the entire form before it is submitted
	// note: This function needs to be customized to fit your form
	with (thisform)
	{
	if (Empty(THENAME,"Please enter your name ")) {THENAME.focus(); return false;};
	if (!isValidEmail(EMAIL,"Please enter a valid E-mail address")) {EMAIL.focus(); return false;}
	if (Empty(COMMENT,"Please enter a comment or enquiry ")) {COMMENT.focus(); return false;};
	}
	}
	
function Empty(entered, alertbox){
	// checks a value is specified (not empty)
	with (entered)
	{
	if (value==null || value=="")
		{if (alertbox!="") {alert(alertbox);} return true;}
	else {return false;}
	}
	}
	
function isSame(entered1, entered2, alertbox){
	// same emails 
	if (entered1.value != entered2.value)
	{if (alertbox!="") {alert(alertbox);} return false;}
	else {return true;}
	}
	
function isValidEmail(entered, alertbox) {
	// checks for a valid email address
	with (entered)
	{
	apos=value.indexOf("@"); 
	dotpos=value.lastIndexOf(".");
	lastpos=value.length-1;
	if (apos<1 || dotpos-apos<2 || lastpos-dotpos>3 || lastpos-dotpos<2) 
		{if (alertbox) {alert(alertbox);} return false;}
	else 
		{return true;}
	}
	}