function checkrequired(which) {
if (which.contactDate.value != "")
{		
	return false;
}
var pass=true;
if (document.images) {
for (i=0;i<which.length;i++) {
var tempobj=which.elements[i];
if (tempobj.name.substring(0,8)=="required") {
if (((tempobj.type=="text"||tempobj.type=="textarea")&&
tempobj.value=='')||(tempobj.type.toString().charAt(0)=="s"&&
tempobj.selectedIndex==0)) {
pass=false;
break;
         }
      }
   }
}
if (!pass) {
shortFieldName=tempobj.name.substring(8,30).toUpperCase();
alert("Please make sure the "+shortFieldName+" field was properly completed.");
return false;
}
else
return true;
}
//------------------- for clearing and replacing text in form input fields and textareas -------------------//



// New Change for VS 2005

// New Validate contact
function ValidateContactData()
{
    var element = document.getElementById('contactDate');
	if (element.value != "")
	{
		return false;
	}
	element = document.getElementById('requiredFirstName');
	if ((element.value == "") || (element.value == 'First Name'))
	{
		alert('Please, enter your First Name.');
		element.focus();
		return false;
	}
	element = document.getElementById('requiredLastName');
	if ((element.value == "") || (element.value == 'Last Name'))
	{
		alert('Please, enter your Last Name.');
		element.focus();
		return false;
	}
	element = document.getElementById('requiredEmail');
	if ((element.value == "") || (element.value == 'Email'))
	{
		alert('Please, enter your email.');
		element.focus();
		return false;
	}
	else
	{
		if(!ValidateEmail(element.value))
		{
			alert("Please check the emails address");
			element.focus();
			return false;
		}
	}
	
	element = document.getElementById('Comments');
	if ((element.value == "") || (element.value == 'Comments'))
	{
		alert('Please, enter your comments.');
		element.focus();
		return false;
	}
}

// Validate Small Contact
function ValidateSmallContact(form)
{
    var theForm = document.getElementById(form);
    
	if (theForm.contactDate.value != "")
	{
		return false;
	}
	
	if ((theForm.txt_Small_firstname.value == "") || (theForm.txt_Small_firstname.value == 'First Name'))
	{
		alert('Please, enter your First Name.');
		theForm.txt_Small_firstname.focus();
		return false;
	}
	
	if ((theForm.txt_Small_Lastname.value == "") || (theForm.txt_Small_Lastname.value == 'Last Name'))
	{
		alert('Please, enter your Last Name.');
		theForm.txt_Small_Lastname.focus();
		return false;
	}
	
	if ((theForm.txt_Small_Email.value == "") || (theForm.txt_Small_Email.value == 'Email'))
	{
		alert('Please, enter your email.');
		theForm.txt_Small_Email.focus();
		return false;
	}
	else
	{
		if(!ValidateEmail(theForm.txt_Small_Email.value))
		{
			alert("Please check the emails address");
			theForm.txt_Small_Email.focus();
			return false;
		}
	}
		
	if ((theForm.txt_Small_Comments.value == "") || (theForm.txt_Small_Comments.value == 'Comments'))
	{
		alert('Please, enter your comments.');
		theForm.txt_Small_Comments.focus();
		return false;
	}
	
	var newsLetter = '';
	if(theForm.chbx_small_SignUpNewsLetter.checked)
	{
	    newsLetter = "&chbx_small_SignUpNewsLetter=yes";
	}
	
	window.location.href = "/savesmallform.aspx?txt_Small_firstname=" + theForm.txt_Small_firstname.value + "&txt_Small_Lastname=" + theForm.txt_Small_Lastname.value +  "&txt_Small_Email="  + theForm.txt_Small_Email.value +  "&txt_Small_Comments=" + theForm.txt_Small_Comments.value + newsLetter;
}

//End New for Vs 2005



function clearText(thefield) {
  if (thefield.defaultValue==thefield.value) { thefield.value = "" }
} 
function replaceText(thefield) {
  if (thefield.value=="") { thefield.value = thefield.defaultValue }
}

function ValidateDataSmall(theForm)
{
	if (theForm.contactDate.value != "")
	{
		return false;
	}
	
	if ((theForm.txt_Small_firstname.value == "") || (theForm.txt_Small_firstname.value == 'First Name'))
	{
		alert('Please, enter your First Name.');
		theForm.txt_Small_firstname.focus();
		return false;
	}
	
	if ((theForm.txt_Small_Lastname.value == "") || (theForm.txt_Small_Lastname.value == 'Last Name'))
	{
		alert('Please, enter your Last Name.');
		theForm.txt_Small_Lastname.focus();
		return false;
	}
	
	if ((theForm.txt_Small_Email.value == "") || (theForm.txt_Small_Email.value == 'Email'))
	{
		alert('Please, enter your email.');
		theForm.txt_Small_Email.focus();
		return false;
	}
	else
	{
		if(!ValidateEmail(theForm.txt_Small_Email.value))
		{
			alert("Please check the emails address");
			theForm.txt_Small_Email.focus();
			return false;
		}
	}
		
	if ((theForm.txt_Small_Comments.value == "") || (theForm.txt_Small_Comments.value == 'Comments'))
	{
		alert('Please, enter your comments.');
		theForm.txt_Small_Comments.focus();
		return false;
	}
}

function ValidateDataSmall(theForm)
{
	if (theForm.contactDate.value != "")
	{
		return false;
	}
	
	if ((theForm.txt_Small_firstname.value == "") || (theForm.txt_Small_firstname.value == 'First Name'))
	{
		alert('Please, enter your First Name.');
		theForm.txt_Small_firstname.focus();
		return false;
	}
	
	if ((theForm.txt_Small_Lastname.value == "") || (theForm.txt_Small_Lastname.value == 'Last Name'))
	{
		alert('Please, enter your Last Name.');
		theForm.txt_Small_Lastname.focus();
		return false;
	}
	
	if ((theForm.txt_Small_Email.value == "") || (theForm.txt_Small_Email.value == 'Email'))
	{
		alert('Please, enter your email.');
		theForm.txt_Small_Email.focus();
		return false;
	}
	else
	{
		if(!ValidateEmail(theForm.txt_Small_Email.value))
		{
			alert("Please check the emails address");
			theForm.txt_Small_Email.focus();
			return false;
		}
	}
		
	if ((theForm.txt_Small_Comments.value == "") || (theForm.txt_Small_Comments.value == 'Comments'))
	{
		alert('Please, enter your comments.');
		theForm.txt_Small_Comments.focus();
		return false;
	}
}
function ValidateData(theForm)
{
	if (theForm.contactDate.value != "")
	{
		return false;
	}
	
	if ((theForm.requiredFirstName.value == "") || (theForm.requiredFirstName.value == 'First Name'))
	{
		alert('Please, enter your First Name.');
		theForm.requiredFirstName.focus();
		return false;
	}
	
	if ((theForm.requiredLastName.value == "") || (theForm.requiredLastName.value == 'Last Name'))
	{
		alert('Please, enter your Last Name.');
		theForm.requiredLastName.focus();
		return false;
	}
	
	if ((theForm.requiredEmail.value == "") || (theForm.requiredEmail.value == 'Email'))
	{
		alert('Please, enter your email.');
		theForm.requiredEmail.focus();
		return false;
	}
	else
	{
		if(!ValidateEmail(theForm.requiredEmail.value))
		{
			alert("Please check the emails address");
			theForm.requiredEmail.focus();
			return false;
		}
	}
		
	if ((theForm.Comments.value == "") || (theForm.Comments.value == 'Comments'))
	{
		alert('Please, enter your comments.');
		theForm.Comments.focus();
		return false;
	}
}

function ValidateEmail(valor) 
{    
    if (/^\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/.test(valor))
	    return true;
    else
	    return false;
}

function ValidateDataSmallSpanish(theForm)
{
	if (theForm.contactDate.value != "")
	{
		return false;
	}
	
	if ((theForm.txt_Small_firstname.value == "") || (theForm.txt_Small_firstname.value == 'First Name'))
	{
		alert('Por favor, ingrese su Nombre.');
		theForm.txt_Small_firstname.focus();
		return false;
	}
	
	if ((theForm.txt_Small_Lastname.value == "") || (theForm.txt_Small_Lastname.value == 'Last Name'))
	{
		alert('Por favor, ingrese su Apellido.');
		theForm.txt_Small_Lastname.focus();
		return false;
	}
	
	if ((theForm.txt_Small_Email.value == "") || (theForm.txt_Small_Email.value == 'Email'))
	{
		alert('Por favor, ingrese su Email.');
		theForm.txt_Small_Email.focus();
		return false;
	}
	else
	{
		if(!ValidateEmail(theForm.txt_Small_Email.value))
		{
			alert('Por favor, verifique su Email.');
			theForm.txt_Small_Email.focus();
			return false;
		}
	}
		
	if ((theForm.txt_Small_Comments.value == "") || (theForm.txt_Small_Comments.value == 'Comments'))
	{
		alert('Por favor, ingrese sus Comentarios.');
		theForm.txt_Small_Comments.focus();
		return false;
	}
}

function ValidateDataSpanish(theForm)
{
	if (theForm.contactDate.value != "")
	{
		return false;
	}
	
	if ((theForm.requiredFirstName.value == "") || (theForm.requiredFirstName.value == 'First Name'))
	{
		alert('Por favor, ingrese su Nombre.');
		theForm.requiredFirstName.focus();
		return false;
	}
	
	if ((theForm.requiredLastName.value == "") || (theForm.requiredLastName.value == 'Last Name'))
	{
		alert('Por favor, ingrese su Apellido.');
		theForm.requiredLastName.focus();
		return false;
	}
	
	if ((theForm.requiredEmail.value == "") || (theForm.requiredEmail.value == 'Email'))
	{
		alert('Por favor, ingrese su Email.');
		theForm.requiredEmail.focus();
		return false;
	}
	else
	{
		if(!ValidateEmail(theForm.requiredEmail.value))
		{
			alert('Por favor, verifique su Email.');
			theForm.requiredEmail.focus();
			return false;
		}
	}
		
	if ((theForm.Comments.value == "") || (theForm.Comments.value == 'Comments'))
	{
		alert('Por favor, ingrese sus Comentarios o Preguntas.');
		theForm.Comments.focus();
		return false;
	}
}
