

function checklogin ( form )
{
 

  // ** START **
 
 if (CheckEmail(form.email.value) == 1) {
    alert( "Insert a valid Email" );
    form.email.focus();
    return false ;
  }


else if (form.pass.value == "") {
    alert( "Insert a Password" );
    form.pass.focus();
    return false ;
  }



	return true;
}


function CheckEmail(email) {

AtPos = email.indexOf("@")
StopPos = email.lastIndexOf(".")
Message = ""

if (email == "") {
return 1;

}

if (AtPos == 0) {
return 1;
}

if (AtPos == -1 || StopPos == -1) {
return 1;
}

if (StopPos < AtPos) {
return 1;
}

if (StopPos - AtPos == 1) {
return 1;
}

return 0;

}



function checkreg ( form )
{
 

 if (CheckEmail(form.email.value) == 1) {
    alert( "Insert a valid Email" );
    form.email.focus();
    form.email.style.backgroundColor = 'yellow';
    return false ;
  }

else if (form.pass1.value == "") {
    alert( "Insert a Password" );
    form.pass1.focus();
    form.pass1.style.backgroundColor = 'yellow';
    return false ;
  }

else if (form.pass2.value == "") {
    alert( "Retype la Password" );
    form.pass2.focus();
    form.pass2.style.backgroundColor = 'yellow';
    return false ;
  }

else if (form.pass1.value !== form.pass2.value) {
    alert( "Passwords don't match." );
    form.pass1.focus();
    form.pass1.style.backgroundColor = 'yellow';
    form.pass2.style.backgroundColor = 'yellow';
    return false ;
  }

else if (form.country.value == "---") {
    alert( "Select a Country" );
    form.country.focus();
    form.country.style.backgroundColor = 'yellow';
    return false ;
  }

else if (form.city.value == "") {
    alert( "Insert your City" );
    form.city.focus();
    form.city.style.backgroundColor = 'yellow';
    return false ;
  }

	return true;
}