
function PopoffWindow(DaURL, typeWindow) {

	switch (typeWindow){
		case "SendToFriend":
			ItsTheWindow = window.open(DaURL,"SendToFriend","top,status,height=280,width=400,resizable=no,scrollbars=0,toolbar=0");
			break;
		default:
			ItsTheWindow = window.open(DaURL,"800x600","status,height=600,width=800,resizable=no,toolbar=0");
			}
}

function validateMe(thisForm) {

  if (thisForm.fullName.value.length < 3)
        { alert('The full name field is incorrect!  It requires at least 3 characters!'); thisForm.fullName.focus(); return (false);}

  if (!(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(thisForm.emailAddress.value)))
        {  alert('Sorry, but the email you entered it is not a valid one!'); thisForm.emailAddress.focus(); return (false);}

  if (thisForm.address.value.length < 3)
        { alert('The address field is incorrect!  It requires at least 3 characters!'); thisForm.address.focus(); return (false);}        

  if (thisForm.city.value.length < 3)
        { alert('The city field is incorrect!  It requires at least 3 characters!'); thisForm.city.focus(); return (false);}

  if (thisForm.country.value.length < 1)
        { alert('Chose a country!'); thisForm.country.focus(); return (false);}   

  if (thisForm.phoneNumber.value.length < 1)
        { alert('The phone number field is incorrect!  It requires at least 6 characters!'); thisForm.phoneNumber.focus(); return (false);}   

}

function validateSendToAFriend(thisForm) {

  if (thisForm.senderName.value.length < 3)
        { alert('Your full name field is incorrect!  It requires at least 3 characters!'); thisForm.senderName.focus(); return (false);}

  if (!(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(thisForm.senderEmail.value)))
        {  alert('Sorry, but the email you entered it is not a valid one!'); thisForm.senderEmail.focus(); return (false);}

  if (thisForm.receiverName.value.length < 3)
        { alert('Your friend full name field is incorrect!  It requires at least 3 characters!'); thisForm.receiverName.focus(); return (false);}

  if (!(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(thisForm.receiverEmail.value)))
        {  alert('Sorry, but the email you entered it is not a valid one!'); thisForm.receiverEmail.focus(); return (false);}

}

function validateSearch(thisForm) {

  if (thisForm.searchQuery.value.length < 4)
        { alert('Search requires at least 4 characters!'); thisForm.searchQuery.focus(); return (false);}
}

function validateMeField(field) {
  var validNum = "0123456789 ";
 
  for (var i=0; i<field.value.length; i++) 
   	 {temp = "" + field.value.substring(i, i+1);
   	 if (validNum.indexOf(temp) == "-1") 
   		{  alert("Only numbers are accepted for this field!");field.focus(); return false;}
  }
}