function checkFeedBack() {
	document.forms[0].visitorName.value = trimSpaces(document.forms[0].visitorName.value);
	if(document.forms[0].visitorName.value.length <= 0) {
		alert("Please enter your name");
		document.forms[0].visitorName.focus();
		return false;
	}

	document.forms[0].emailAddress.value = trimSpaces(document.forms[0].emailAddress.value);
	if(document.forms[0].emailAddress.value.length <= 0) {
		alert("Please enter your email address");
		document.forms[0].emailAddress.focus();
		return false;
	}
	if(!checkEmail(document.forms[0].emailAddress.value)) {
		document.forms[0].emailAddress.focus();
		document.forms[0].emailAddress.select();
		return false;
	}
	document.forms[0].visitorComments.value = trimSpaces(document.forms[0].visitorComments.value);
	if(document.forms[0].visitorComments.value.length <= 0) {
		alert("Please enter your comments");
		document.forms[0].visitorComments.focus();
		return false;
	}
	document.forms[0].frmAction.value = "update";
}


function checkContact(){
	contactname = trimSpaces(document.forms[0].contactname.value);
	contactemail = trimSpaces(document.forms[0].contactemail.value);
	contactphone = trimSpaces(document.forms[0].contactphone.value);
	suggestions = trimSpaces(document.forms[0].suggestions.value);

	if(contactname.length <= 0){
		alert("Please enter your name.");
		document.forms[0].contactname.focus();
		return false;
	}
	if(!checkEmail(contactemail)) {
		document.forms[0].contactemail.focus();
		return false;
	}
	if(contactphone.length <= 0){
		alert("Please enter your telephone #.");
		document.forms[0].contactphone.focus();
		return false;
	}
	if(suggestions.length <= 0){
		alert("Please enter your queries/suggestions.");
		document.forms[0].suggestions.focus();
		return false;
	}
	
	document.forms[0].frmAction.value = "yes";

}

function closeWindow() {
	parent.window.opener.window.focus();
	parent.window.close();
}

function printWindow() {
	parent.mainFrame.focus();
	window.print(parent.mainFrame);
}

function hideText(frmElement){
	frmObject = eval("document.forms[0]." + frmElement);
	frmObject.value = "";
}

function checkSubscription() {
	
	firstName = trimSpaces(document.forms[0].firstName.value);
	if(firstName.length <= 0) {
		alert("Please enter your first name.");
		document.forms[0].firstName.focus();
		return false;
	}
	
	lastName = trimSpaces(document.forms[0].lastName.value);
	if(lastName.length <= 0) {
		alert("Please enter your last name.");
		document.forms[0].lastName.focus();
		return false;
	}
	
	subscriberEmail = trimSpaces(document.forms[0].subscriberemail.value);
	if(subscriberEmail.length <= 0) {
		alert("Please enter your email.");
		document.forms[0].subscriberemail.focus();
		return false;
	}
	if(subscriberEmail.length > 0){
		if(!checkEmail(subscriberEmail)){
			document.forms[0].subscriberemail.focus();
			return false;
		}
	}
	
	document.forms[0].frmAction.value = "update";

}

function checkQuote(){
	lastname = trimSpaces(document.forms[0].lastName.value);
	firstname = trimSpaces(document.forms[0].firstName.value);
//telephone = trimSpaces(document.forms[0].telephone.value);
	email = trimSpaces(document.forms[0].email.value);
	//productLength = document.forms[0].elements["products"].length;
	
	if(firstname.length <= 0){
		alert("Please enter the firstname name.");
		document.forms[0].firstName.focus();
		return false;
	}
	if(lastname.length <= 0){
		alert("Please enter the lastname .");
		document.forms[0].lastName.focus();
		return false;
	}
	if(email.length > 0){
	
	if(!checkEmail(email)){
		document.forms[0].email.focus();
		return false;
	}}
	document.forms[0].frmAction.value = "send";
}

function showNews(newsid, pageType) {
	sWidth = screen.availWidth;
	sHeight = screen.availHeight;
	
	winWidth = 600;
	winHeight = 500;
	
	sLeft = (sWidth - winWidth) / 2;
	sTop = (sHeight - winHeight) / 2;
	
	if(pageType == "home") {
		pageUrl = "php/";
	}
	else {
		pageUrl = "";
	}

	window.open(pageUrl + "showNewsFrame.php?newsid=" + newsid, "news", "width=" + winWidth + ",height=" + winHeight + ",top=" + sTop + ",left=" + sLeft + ",toolbar=0,menubar=0,status=0,scrollbars=1,resizable=0");
	return;
}
function checkLogin(){
	username = trimSpaces(document.forms[0].username.value);
	if(username.length <= 0){
		alert("Please enter your username.");
		document.forms[0].username.focus();
		return false;
	}
	password = trimSpaces(document.forms[0].password.value);
	if(password.length <= 0){
		alert("Please enter your password.");
		document.forms[0].password.focus();
		return false;
	}	
}
function checkJob(){
	name = trimSpaces(document.forms[0].name.value);
	if(name.length <= 0){
		alert("Please enter your name.");
		document.forms[0].name.focus();
		return false;
	}
}	
function checkLoginHome(){
	username = trimSpaces(document.forms[0].username.value);
	if(username.length <= 0){
		alert("Please enter your username.");
		document.forms[0].username.focus();
		return false;
	}
	password = trimSpaces(document.forms[0].password.value);
	if(password.length <= 0){
		alert("Please enter your password.");
		document.forms[0].password.focus();
		return false;
	}	
	document.forms[0].frmAction.value = 'Login';
}
function chkUpload(res) {
	works = trimSpaces(document.forms[0].works.value);
	if(works.length <= 0) {
		alert("Please select the file.");
		document.forms[0].works.focus();
		return false;
    }
	if(res == 'save'){ 
	document.forms[0].fileAction.value = 'save';
	}else{
	document.forms[0].fileAction.value = 'save&up';
	}
	document.forms[0].frmAction.value = 'Upload';
	document.forms[0].submit();
}
function checkUploadReg() {
	firstname = trimSpaces(document.forms[0].firstname.value);
	if(firstname.length <= 0) {
		alert("Enter your firstname");
		document.forms[0].firstname.focus();
		return false;
    }
	email = trimSpaces(document.forms[0].email.value);
	if(email.length <= 0) {
		alert("Enter your Email");
		document.forms[0].email.focus();
		return false;
    }	
	if(!checkEmail(document.forms[0].email.value)) {
	  return false;
    }
	phone = trimSpaces(document.forms[0].phone.value);
	if(phone.length <= 0) {
		alert("Enter your phone");
		document.forms[0].phone.focus();
		return false;
    }
	document.forms[0].frmAction.value = 'update';
}
function checkRegistration() {
	username = trimSpaces(document.forms[0].username.value);
	if(username.length <= 0) {
		alert("Enter your username");
		document.forms[0].username.focus();
		return false;
    }
	if(username.length < 6) {
		alert("Enter username between 6 to 20 characters");
		document.forms[0].username.focus();
		return false;
    }		
	password = trimSpaces(document.forms[0].password.value);
	if(password.length <= 0) {
		alert("Enter your password");
		document.forms[0].password.focus();
		return false;
    }
	if(password.length < 6) {
		alert("Enter password between 6 to 20 characters");
		document.forms[0].password.focus();
		return false;
    }	
	repassword = trimSpaces(document.forms[0].repassword.value);
	if(password != repassword) {
		alert("Your passwords does not match");
		document.forms[0].password.focus();
		return false;
    }			 
	firstname = trimSpaces(document.forms[0].firstname.value);
	if(firstname.length <= 0) {
		alert("Enter your First Name");
		document.forms[0].firstname.focus();
		return false;
    }	
	lastname = trimSpaces(document.forms[0].lastname.value);
	if(lastname.length <= 0) {
		alert("Enter your Last Name");
		document.forms[0].lastname.focus();
		return false;
    }	
	company = trimSpaces(document.forms[0].company.value);
	if(company.length <= 0) {
		alert("Enter your Company");
		document.forms[0].company.focus();
		return false;
    }	
	address1 = trimSpaces(document.forms[0].address1.value);
	if(address1.length <= 0) {
		alert("Enter your Address");
		document.forms[0].address1.focus();
		return false;
    }	
	city = trimSpaces(document.forms[0].city.value);
	if(city.length <= 0) {
		alert("Enter your City");
		document.forms[0].city.focus();
		return false;
    }	
	state = trimSpaces(document.forms[0].state.value);
	if(state.length <= 0) {
		alert("Enter your State");
		document.forms[0].state.focus();
		return false;
    }	
	zip = trimSpaces(document.forms[0].zip.value);
	if(zip.length <= 0) {
		alert("Enter your Zip Code");
		document.forms[0].zip.focus();
		return false;
    }	
	country = trimSpaces(document.forms[0].country.value);
	if(country.length <= 0) {
		alert("Enter your Country");
		document.forms[0].country.focus();
		return false;
    }	
	phone = trimSpaces(document.forms[0].phone.value);
	if(phone.length <= 0) {
		alert("Enter your Phone No.");
		document.forms[0].phone.focus();
		return false;
    }	
	phone = trimSpaces(document.forms[0].phone.value);
	if(phone.length <= 0) {
		alert("Enter your Phone No.");
		document.forms[0].phone.focus();
		return false;
    }	
	email = trimSpaces(document.forms[0].email.value);
	if(email.length <= 0) {
		alert("Enter your Email");
		document.forms[0].email.focus();
		return false;
    }	
	if(!checkEmail(document.forms[0].email.value)) {
	  return false;
    }
	purchaseorder = trimSpaces(document.forms[0].purchaseorder.value);
	if(purchaseorder.length <= 0) {
		alert("Enter your Purchase Order");
		document.forms[0].purchaseorder.focus();
		return false;
    }	
	comments = trimSpaces(document.forms[0].comments.value);
	if(comments.length <= 0) {
		alert("Enter your Comments");
		document.forms[0].comments.focus();
		return false;
    }	
    document.forms[0].frmAction.value="send";
    return true;
 }
 
 function forgotPassword() {
 	email = trimSpaces(document.forms[0].email.value);
	if(email.length <= 0) {
		alert("Enter your Email");
		document.forms[0].email.focus();
		return false;
    }	
	if(!checkEmail(document.forms[0].email.value)) {
	  return false;
    }
    document.forms[0].frmAction.value="send";
    return true;
}	
