



function submit_on_enter(myfield,e)
{
var keycode;
if (window.event) keycode = window.event.keyCode;
else if (e) keycode = e.which;
else return true;
if (keycode == 13)
{
myfield.form.submit();
return false;
}
else
return true;
}


function printon(){
	if (document.all) {
        if (navigator.appVersion.indexOf("5.0") == -1) {
            var OLECMDID_PRINT = 6;
            var OLECMDEXECOPT_DONTPROMPTUSER = 2;
            var OLECMDEXECOPT_PROMPTUSER = 1;
            var WebBrowser = "<OBJECT ID=\"WebBrowser1\" WIDTH=0 HEIGHT=0 CLASSID=\"CLSID:8856F961-340A-11D0-A96B-00C04FD705A2\"></OBJECT>";
            document.body.insertAdjacentHTML("beforeEnd", WebBrowser);
            WebBrowser1.ExecWB(6, 2);
            WebBrowser1.outerHTML = "";
        } else {
			self.print();
        }
    } else {
		self.print();
    }
}

function popup(sPicURL) {
window.open("foto.htm?"+sPicURL, "", "resizable=1,HEIGHT=300,WIDTH=200");
}


function centra(page)
{
var w = screen.width; 
var h = screen.height; 
var x = Math.round(w / 2) - Math.round(700/2); 
var y = Math.round(h / 2) - Math.round(450/2); 
newwindow = window.open(page, null, 'scrollbars=1, left=' + x + ', screenX=' + x + ',top=' + y + 'screenY=' + y +',width=700,height=450'); 
window.opener=self
}

function vaisopra() {
window.top.scroll(0,0);
}


function ltrim(s) {return s.replace( /^\s*/, "" );}
function rtrim(s) {return s.replace( /\s*$/, "" );}
function trim (s) {return rtrim(ltrim(s));}

function verify(frm)
{
	if (frm.name == 'cambia')
	{
		if(frm.nome.value == '' || frm.cognome.value == '' || frm.telefono.value == '' || frm.email.value == '' || frm.password.value == '')
		{
			errorString = "All fields are mandatory";
			alert(errorString);
			frm.nome.focus();
			return false;
			
		}
		
	}
	
	else if (frm.name == 'profilo')
	{
		p1=frm.password1.value;
		p2=frm.password2.value;
		
		if (p1=="" || p2=="")
		{
			errorString = "You must insert password in both text fields";
			alert(errorString);
			return false;
		}
		if (p1==p2)
		{
			
			document.profilo.submit();
		}
		else
		{
			
			errorString = "You must insert same password in both text fields";
			alert(errorString);
			frm.password2.focus();
			return false;
		}
	}

if (frm.name == 'contact')
{

ok = 0;

Ctrl = frm.email;
result = false;
space_tokens = Ctrl.value.split(" ");
if (space_tokens.length == 1) {
at_tokens = Ctrl.value.split("@");
if (at_tokens.length == 2) {
if (at_tokens[1].length != 0) {
   right_dot_tokens = at_tokens[1].split(".");
   if (right_dot_tokens.length >= 2) {
   if (right_dot_tokens[1].length != 0) {
   result=true;}}}}}


if (frm.firstname.value == "")
    {
     errorString = "FIRST NAME field is mandatory";
     alert(errorString);
     frm.firstname.focus();
     ok = 1;
    }

else if (frm.lastname.value == "")
    {
     errorString = "LAST NAME field is mandatory";
     alert(errorString);
     frm.lastname.focus();
     ok = 1;
    }

else if (!result){
           errorString = "EMAIL incorrect, please insert again";
           alert(errorString);
           Ctrl.focus();
           ok = 1;
           }


else if (frm.message.value == "")
    {
     errorString = "MESSAGE field is mandatory";
     alert(errorString);
     frm.message.focus();
     ok = 1;
    }


if (ok == 0)
   return(false);
else
   return(false);


}

if (frm.name == 'group')
{

ok = 0;

Ctrl = frm.email;
result = false;
space_tokens = Ctrl.value.split(" ");
if (space_tokens.length == 1) {
at_tokens = Ctrl.value.split("@");
if (at_tokens.length == 2) {
if (at_tokens[1].length != 0) {
   right_dot_tokens = at_tokens[1].split(".");
   if (right_dot_tokens.length >= 2) {
   if (right_dot_tokens[1].length != 0) {
   result=true;}}}}}


radio = false
for (counter = 0; counter < frm.week.length; counter++)
{
if (frm.week[counter].checked)
   radio = true; 
}

if (radio == false) {  
   errorString = "Please select a WEEK";
   alert(errorString); 
   ok = 1}

else if (frm.name_.value == "")
    {
     errorString = "NAME field is mandatory";
     alert(errorString);
     frm.name_.focus();
     ok = 1;
    }

else if (frm.occupation.value == "")
    {
     errorString = "OCCUPATION field is mandatory";
     alert(errorString);
     frm.occupation.focus();
     ok = 1;
    }

else if (frm.age.value == "")
    {
     errorString = "AGE field is mandatory";
     alert(errorString);
     frm.age.focus();
     ok = 1;
    }

else if (frm.address.value == "")
    {
     errorString = "ADDRESS field is mandatory";
     alert(errorString);
     frm.address.focus();
     ok = 1;
    }

else if (frm.city.value == "")
    {
     errorString = "CITY field is mandatory";
     alert(errorString);
     frm.city.focus();
     ok = 1;
    }

else if (frm.state.value == "")
    {
     errorString = "STATE field is mandatory";
     alert(errorString);
     frm.state.focus();
     ok = 1;
    }

else if (frm.zip.value == "")
    {
     errorString = "ZIP field is mandatory";
     alert(errorString);
     frm.zip.focus();
     ok = 1;
    }

else if (frm.residence_phone.value == "")
    {
     errorString = "RESIDENCE PHONE field is mandatory";
     alert(errorString);
     frm.residence_phone.focus();
     ok = 1;
    }

else if (frm.business_phone.value == "")
    {
     errorString = "BUSINESS PHONE field is mandatory";
     alert(errorString);
     frm.business_phone.focus();
     ok = 1;
    }

else if (!result){
           errorString = "EMAIL incorrect, please insert again";
           alert(errorString);
           Ctrl.focus();
           ok = 1;
           }


if (ok == 0)
   document.group.submit();

}

if (frm.name == 'booking')
{

ok = 0;

Ctrl = frm.email;
result = false;
space_tokens = Ctrl.value.split(" ");
if (space_tokens.length == 1) {
at_tokens = Ctrl.value.split("@");
if (at_tokens.length == 2) {
if (at_tokens[1].length != 0) {
   right_dot_tokens = at_tokens[1].split(".");
   if (right_dot_tokens.length >= 2) {
   if (right_dot_tokens[1].length != 0) {
   result=true;}}}}}


radio = false
for (counter = 0; counter < frm.week.length; counter++)
{
if (frm.week[counter].checked)
   radio = true; 
}

if (radio == false) {  
   errorString = "Please select a WEEK";
   alert(errorString); 
   ok = 1}


else if (frm.name_.value == "")
    {
     errorString = "NAME field is mandatory";
     alert(errorString);
     frm.name_.focus();
     ok = 1;
    }


else if (frm.giorno.value == "--" && frm.mese.value == "--" && frm.anno.value == "--")
    {
     errorString = "BIRTH DATE is mandatory";
     alert(errorString);
     frm.giorno.focus();
     ok = 1;
    }

else if (frm.giorno.value == "--")
    {
     errorString = "BIRTH DATE is incomplete, please enter the BIRTH DAY";
     alert(errorString);
     frm.giorno.focus();
     ok = 1;
    }

else if (frm.mese.value == "--")
    {
     errorString = "BIRTH DATE is incomplete, please enter the BIRTH MONTH";
     alert(errorString);
     frm.mese.focus();
     ok = 1;
    }

else if (frm.anno.value == "--")
    {
     errorString = "BIRTH DATE is incomplete, please enter the BIRTH YEAR";
     alert(errorString);
     frm.anno.focus();
     ok = 1;
    }


else if (frm.tshirt.value == "--")
    {
     errorString = "TSHIRT SIZE is mandatory";
     alert(errorString);
     frm.tshirt.focus();
     ok = 1;
    }

else if (frm.school.value == "")
    {
     errorString = "SCHOOL field is mandatory";
     alert(errorString);
     frm.school.focus();
     ok = 1;
    }

else if (frm.name_parent.value == "")
    {
     errorString = "PARENT NAME field is mandatory";
     alert(errorString);
     frm.name_parent.focus();
     ok = 1;
    }

else if (frm.age.value == "")
    {
     errorString = "AGE field is mandatory";
     alert(errorString);
     frm.age.focus();
     ok = 1;
    }

else if (frm.address.value == "")
    {
     errorString = "ADDRESS field is mandatory";
     alert(errorString);
     frm.address.focus();
     ok = 1;
    }

else if (frm.city.value == "")
    {
     errorString = "CITY field is mandatory";
     alert(errorString);
     frm.city.focus();
     ok = 1;
    }

else if (frm.state.value == "")
    {
     errorString = "STATE field is mandatory";
     alert(errorString);
     frm.state.focus();
     ok = 1;
    }

else if (frm.zip.value == "")
    {
     errorString = "ZIP field is mandatory";
     alert(errorString);
     frm.zip.focus();
     ok = 1;
    }

else if (frm.residence_phone.value == "")
    {
     errorString = "RESIDENCE PHONE field is mandatory";
     alert(errorString);
     frm.residence_phone.focus();
     ok = 1;
    }

else if (frm.business_phone.value == "")
    {
     errorString = "BUSINESS PHONE field is mandatory";
     alert(errorString);
     frm.business_phone.focus();
     ok = 1;
    }

else if (!result){
           errorString = "EMAIL incorrect, please insert again";
           alert(errorString);
           Ctrl.focus();
           ok = 1;
           }

else if (frm.name_emergency.value == "")
    {
     errorString = "EMERGENCY NAME field is mandatory";
     alert(errorString);
     frm.name_emergency.focus();
     ok = 1;
    }

else if (frm.phone_emergency.value == "")
    {
     errorString = "EMERGENCY PHONE field is mandatory";
     alert(errorString);
     frm.phone_emergency.focus();
     ok = 1;
    }


if (ok == 0)
   document.booking.submit();

}


}
 
function start(winflash, x, y, bar)
{
window.open(winflash,'','scrollbars='+bar+',screenX=150,screenY=50,left=150,top=50,resizable=0,menubar=0,toolbar=0,status=0,width='+x+',height='+y);
}

function openflash(winflash, x, y)
{
ind="immagini/"+winflash;
window.open(ind,'','scrollbars=0,screenX=150,screenY=50,left=150,top=50,resizable=0,menubar=0,toolbar=0,status=0,width='+x+',height='+y);
}
