function checkEmail()
	{
	var strEmail, strError, countAtRate, countDot, i;
	var checkAtRate, checkDot;
	var ValidChars,CountValidChars;
	ValidChars="abcdefghijklmnopqrstuvwxyz0123456789_.@ABCDEFGHIJKLMNOPQRSTUVWXYZ-";
	strEmail = checkEmail.arguments[0];

	countAtRate=0;
	countDot=0;
	CountValidChars=0;
	if (strEmail.length >= 7)
		{
		for(i=0;i<strEmail.length;i++)
			{
			if(strEmail.charAt(i)=="@")
				countAtRate++;
			if(strEmail.charAt(i)==".")
				countDot++;
			CountValidChars=0;
			for(j=0;j<ValidChars.length;j++)
				{
				if(strEmail.charAt(i)==ValidChars.charAt(j))
					{
					CountValidChars++;
					}
				}
			if(CountValidChars==0)
				{
				strError=0;
				break;
				}
			}
		}
	checkAtRate=strEmail.indexOf("@",1);
	checkDot=strEmail.indexOf(".",1);
	for(i=1;i<countDot;i++)
		checkDot=strEmail.indexOf(".",checkDot+1);
	if(countAtRate==1 && countDot > 0 && strEmail.length >=7 && strError != 0)
		strError=1;
	else
		strError=0;
	if(checkDot>=strEmail.length-2)
		strError=0;
	if(strEmail.charAt(0)=="@" || strEmail.charAt(strEmail.length-1)=="@")
		strError=0;
	if(strEmail.charAt(0)=="." || strEmail.charAt(strEmail.length-1)==".")
		strError=0;
	if(checkDot < checkAtRate)
		strError=0;

	return strError;
}

function isBlank(C) {
	for (i=0;i<C.length;i++) {if (C.charAt(i) != " ") return false}
	return true;
}

function RTrim(VALUE){
	var w_space = String.fromCharCode(32);
	var v_length = VALUE.length;
	var strTemp = "";
	if(v_length < 0){
		return"";
	}
	var iTemp = v_length -1;

	while(iTemp > -1){
		if(VALUE.charAt(iTemp) == w_space){
		}
		else{
			strTemp = VALUE.substring(0,iTemp +1);
			break;
		}
		iTemp = iTemp-1;

	} //End While
	return strTemp;
} //End Function


function LTrim(VALUE){
	var w_space = String.fromCharCode(32);
	if(v_length < 1){
		return"";
	}
	var v_length = VALUE.length;
	var strTemp = "";

	var iTemp = 0;

	while(iTemp < v_length){
		if(VALUE.charAt(iTemp) == w_space){
		}
		else{
			strTemp = VALUE.substring(iTemp,v_length);
			break;
		}
		iTemp = iTemp + 1;
	} //End While
	return strTemp;
} //End Function


function frmQuickDownloadFormValidate(dm){	
	var strError = "";
	if(LTrim(dm.txtName.value)=="")
		strError += "Name\n";
	if(LTrim(dm.txtCompany.value)=="")
		strError += "Company\n";
	if(LTrim(dm.txtEmail.value)=="")
		strError += "E-mail\n";
	else if(checkEmail(dm.txtEmail.value)==0)
		strError += "E-mail\n";
	
	if(strError!=""){
		alert("Please check the following required field(s)\n---------------------------------------------------\n"+ strError);
		return false;
	}
	else {
		location.href='send-email-quickdownloads.asp';
		return true;
	}
}


function checkData()
	{
	var correct = true
	if (document.frmComments.first.value == "") {correct = false; alert("Please enter Your FIRST Name"); return correct}
		if (document.frmComments.first.value == " ") {correct = false; alert("Please enter Your FIRST Name"); return correct}
			if (document.frmComments.last.value == "") {correct = false; alert("Please enter Your LAST Name"); return correct}
		if (document.frmComments.last.value == " ") {correct = false; alert("Please enter Your LAST Name"); return correct}
		if (document.frmComments.title.value == "") {correct = false; alert("Please enter your TITLE"); return correct}
		if (document.frmComments.title.value == " ") {correct = false; alert("Please enter your TITLE"); return correct}
		if (document.frmComments.company.value == "") {correct = false; alert("Please enter your COMPANY"); return correct}
		if (document.frmComments.company.value == " ") {correct = false; alert("Please enter your COMPANY"); return correct}
		if (document.frmComments.phone.value == "") {correct = false; alert("Please enter your Phone Number"); return correct}
		if (document.frmComments.phone.value == " ") {correct = false; alert("Please enter your Phone Number"); return correct}
	if (document.frmComments.email.value == "") {correct = false; alert("Please enter your Email"); return correct}
		if (document.frmComments.email.value == " ") {correct = false; alert("Please enter your Email"); return correct}
 	if (document.register.phone_number.value == "") {correct = false; alert("Please enter your Phone Number"); return correct}
	if (document.register.address_1.value == "") {correct = false; alert("Please enter your Address"); return correct}
	if (document.register.city.value == "") {correct = false; alert("Please enter your City"); return correct}
	if (document.register.state.value == "") {correct = false; alert("Please enter your State"); return correct}
	if (document.register.zip.value == "") {correct = false; alert("Please enter your Zip Code"); return correct}
	if (document.register.country.value == "") {correct = false; alert("Please enter your Country"); return correct}
	if (document.register.partner_name.value == "") {correct = false; alert("Please enter your Selling Partner Name"); return correct}
	if (document.register.sales_person.value == "") {correct = false; alert("Please enter your Sales Person Name"); return correct}
	if (document.register.donotagree.value != "") {correct = false; alert("Please agree to the one time fee before continuing"); return correct}
	 if (correct){correct = true}
	return correct
	}


