function validate_contactus_form() {
	var pb=document.contactus_form;
	var name_check = /^([a-zA-Z\s])+([\s])*([a-zA-Z\s])*$/;
	var email_check = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	
	if (pb.personName.value == 0) {
		alert("Please enter your name");
		pb.personName.focus();
		return false;
	}
	if(!name_check.test(pb.personName.value)) {
		alert("Name should be in alphabets only");
		pb.personName.focus();
		return false;
	}
	
	if (pb.city.value == 0) {
		alert("Please enter your city");
		pb.city.focus();
		return false;
	}
	
	if (pb.address.value == 0) {
		alert("Please enter your address");
		pb.address.focus();
		return false;
	}	
	
	if((pb.email.value.length >= 0) && (!email_check.test(pb.email.value))) {
		alert("Please enter a valid Email ID");
		pb.email.focus();
		return false;
	}
	
	if (pb.phone.value!=0) {
		if (pb.phone.value.length < 8) {
			alert("Please enter a valid phone number");
			pb.phone.focus();
			return false;
		}
		if (isNaN(pb.phone.value)) {
			alert("Phone number should be numeric only");
			pb.phone.focus();
			return false;
		}
	}
	
	if (pb.fax.value!=0) {
		if (pb.fax.value.length < 8) {
			alert("Please enter a valid fax number");
			pb.fax.focus();
			return false;
		}
		if (isNaN(pb.fax.value)) {
			alert("Fax number should be numeric only");
			pb.fax.focus();
			return false;
		}
	}
	
	if (pb.country.options[pb.country.selectedIndex].value == "") {
		alert("Please select your country");
		pb.country.focus();
		return false;
	}
	
	if (pb.comments.value==0) {
		alert("Please enter a your comments / remarks / suggestions etc.");
		pb.comments.focus();
		return false;						
	}
	
	if(pb.security_code.value.length < 5){
		alert("Please enter verification code");
		pb.security_code.focus();
		return false;	
	}
}


function validate_login_form() {
	var pb=document.login_form;
	var email_check = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	
	if((pb.email.value.length >= 0) && (!email_check.test(pb.email.value))) {
		alert("Please enter a valid Email ID");
		pb.email.focus();
		return false;
	}
		
	if (pb.pwd.value == 0) {
		alert("Please enter your password");
		pb.pwd.focus();
		return false;
	}	
}


function validate_change_password() {
	var pb=document.change_password;
	if (pb.opwd.value==0) {
		alert("Please enter your old password");
		pb.opwd.focus();
		return false;
	}
	
	if (pb.npwd.value == 0) {
		alert("Please enter your new password");
		pb.npwd.focus();
		return false;
	}
	
	if (pb.cpwd.value == 0) {
		alert("Please confirm your new password");
		pb.cpwd.focus();
		return false;
	}
	
	if (pb.npwd.value != pb.cpwd.value) {
		alert("Confirm Password does not match");
		pb.cpwd.focus();
		return false;
	}	
}


function validate_join_free_form() {
	var pb=document.join_free_form;
	var email_check = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	
	if (pb.country.options[pb.country.selectedIndex].value == "") {
		alert("Please select your country");
		pb.country.focus();
		return false;
	}
	
	if (pb.email.value==0) {
		alert("Please enter your Email ID");
		pb.email.focus();
		return false;
	}
	
	if(!email_check.test(pb.email.value)) {
		alert("Please enter a valid Email ID");
		pb.email.focus();
		return false;
	}
	
	var pkb=0;
	
	var len=document.getElementsByName('businessType').length;
	var obj=document.getElementsByName('businessType');
	
	for (var i=0; i < len; i++) {
		if (obj[i].checked) {
			pkb=1;
			break;
		}
	}
	
	if (pkb == 0) {
		alert('Please select atleast one deals in option.');
		pb.businessType[0].focus();
		return false;
	}
}


function validate_register_member_form() {
	var pb=document.register_member_form;
	var email_check = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	var pwd_check = /^([a-zA-Z0-9])+$/;
	var name_check = /^([a-zA-Z\s])+([\s])*([a-zA-Z\s])*$/;
	
	if (pb.email.value==0) {
		alert("Please enter your Email ID");
		pb.email.focus();
		return false;
	}
	
	if(!email_check.test(pb.email.value)) {
		alert("Please enter a valid Email ID");
		pb.email.focus();
		return false;
	}
	
	if (pb.pwd.value == 0) {
		alert("Please enter your password");
		pb.pwd.focus();
		return false;
	}
	if (pb.pwd.value.length < 5) {
		alert("Password must be atleast 5 characters long (a-z, A-Z, 0-9 only");
		pb.pwd.focus();
		return false;
	}
	if((pb.pwd.value.length > 0) && (!pwd_check.test(pb.pwd.value))) {
		alert("Password must be atleast 5 characters long (a-z, A-Z, 0-9 only)");
		pb.pwd.focus();
		return false;
	}
	
	if (pb.pwd.value != pb.cpwd.value) {
		alert("Confirm Password does not match");
		pb.cpwd.focus();
		return false;
	}
	
	if (pb.memberName.value==0) {
		alert("Member Name is must");
		pb.memberName.focus();
		return false;
	}
	if (!name_check.test(pb.memberName.value)) {
		alert("Member Name should be in alphabets only");
		pb.memberName.focus();
		return false;
	}
	
	if (pb.companyName.value==0) {
		alert("Company name is must");
		pb.companyName.focus();
		return false;
	}
	
	if (pb.address.value==0) {
		alert("Please enter your address");
		pb.address.focus();
		return false;
	}
	
	if (pb.city.value==0) {
		alert("Please enter your city");
		pb.city.focus();
		return false;
	}
	
	if (pb.zipcode.value!=0) {
		if (pb.zipcode.value.length < 5) {
			alert("Please enter a valid zipcode number");
			pb.zipcode.focus();
			return false;
		}
		if (isNaN(pb.zipcode.value)) {
			alert("Zipcode number should be numeric only");
			pb.zipcode.focus();
			return false;
		}
	}	
	
	if (pb.country.options[pb.country.selectedIndex].value == "") {
		alert("Please select your country");
		pb.country.focus();
		return false;
	}
	
	if (pb.countryCodePhone.value.length > 0) {
		if (isNaN(pb.countryCodePhone.value)) {
			alert("Country code should be numeric only");
			pb.countryCodePhone.focus();
			return false;
		}
	}
	
	if (pb.areaCodePhone.value.length > 0) {
		if (isNaN(pb.areaCodePhone.value)) {
			alert("Area code should be numeric only");
			pb.areaCodePhone.focus();
			return false;
		}
	}
	
	if (pb.phone.value.length > 0) {
		if (isNaN(pb.phone.value)) {
			alert("Phone number should be numeric only");
			pb.phone.focus();
			return false;
		}
	}
	
	if (pb.countryCodeFax.value.length > 0) {
		if (isNaN(pb.countryCodeFax.value)) {
			alert("Country code should be numeric only");
			pb.countryCodeFax.focus();
			return false;
		}
	}
	
	if (pb.areaCodeFax.value.length > 0) {
		if (isNaN(pb.areaCodeFax.value)) {
			alert("Area code should be numeric only");
			pb.areaCodeFax.focus();
			return false;
		}
	}
	
	if (pb.fax.value.length > 0) {
		if (isNaN(pb.fax.value)) {
			alert("Fax number should be numeric only");
			pb.fax.focus();
			return false;
		}
	}
	
	if (pb.mobileNo.value==0) {
		if (isNaN(pb.mobileNo.value)) {
			alert("Mobile number should be numeric only");
			pb.mobileNo.focus();
			return false;
		}
		if (pb.mobileNo.value.length < 10) {
			alert("Please enter a valid mobile number");
			pb.mobileNo.focus();
			return false;
		}
	}
	
	if (pb.ownerName.value==0) {
		alert("Please enter your company's owner name");
		pb.ownerName.focus();
		return false;
	}
	if (!name_check.test(pb.ownerName.value)) {
		alert("Owner Name should be in alphabets only");
		pb.ownerName.focus();
		return false;
	}
	
	if (pb.yoe.value==0 || pb.yoe.value.length!=4) {
		alert("Please enter year established in ie 1990, 2001 etc");
		pb.yoe.focus();
		return false;
	}
	if (isNaN(pb.yoe.value)) {
		alert("Established year should be numeric only");
		pb.yoe.focus();
		return false;
	}
	
	if (pb.mainMarket.value==0) {
		alert("Please enter your main market");
		pb.mainMarket.focus();
		return false;
	}
	
	if (pb.companyLogo.value!=0) {
		if ((pb.companyLogo.value.lastIndexOf('.jpg')==-1) && (pb.companyLogo.value.lastIndexOf('.gif')==-1) && (pb.companyLogo.value.lastIndexOf('.jpeg')==-1) && (pb.companyLogo.value.lastIndexOf('.png')==-1)) {
			alert('You May Only Upload .jpg, .jpeg, .png, .gif Files');
			pb.companyLogo.focus();
			return false;
		}
	}
	
	if (pb.companyVideo.value != 0) {
		if ((pb.companyVideo.value.lastIndexOf('.mov')==-1) && (pb.companyVideo.value.lastIndexOf('.mpg')==-1) && (pb.companyVideo.value.lastIndexOf('.mpeg')==-1) && (pb.companyVideo.value.lastIndexOf('.wmv')==-1) && (pb.companyVideo.value.lastIndexOf('.aac')==-1) && (pb.companyVideo.value.lastIndexOf('.mp4')==-1) && (pb.companyVideo.value.lastIndexOf('.mp3')==-1) && (pb.companyVideo.value.lastIndexOf('.dat')==-1)) {
			alert('You May Only Upload .mov, .mpg, .mpeg, .wmv, .aac, .mp4, .mp3, .dat Files');
			pb.companyVideo.focus();
			return false;
		}
	}
	
	/*
	if (pb.companySize.options[pb.companySize.selectedIndex].value == "") {
		alert("Please select your company size");
		pb.companySize.focus();
		return false;
	}	
	*/
	
	if (pb.businessCountry.options[pb.businessCountry.selectedIndex].value == "") {
		alert("Please select your business country");
		pb.businessCountry.focus();
		return false;
	}
	
	var pkb=0;
	
	var len=document.getElementsByName('businessNature').length;
	var obj=document.getElementsByName('businessNature');
	
	for (var i=0; i < len; i++) {
		if (obj[i].checked) {
			pkb=1;
			break;
		}
	}
	
	if (pkb == 0) {
		alert('Please select atleast one business nature.');
		pb.businessNature[0].focus();
		return false;
	}		
	
	if (pb.mainCategory.options[pb.mainCategory.selectedIndex].value == "") {
		alert("Please select your category type");
		pb.mainCategory.focus();
		return false;
	}
	
	var pkb=0;
	var len=pb.industryType.length;
	
	if (!len) {
		if (!pb.industryType.checked) {
			alert("Please check atleaset one Sub Categories");
			pb.industryType.focus();
			return false;
		}
	}
	else {
		for (var i=0; i < len; i++) {
			if (pb.industryType[i].checked) {
				pkb=1;
				break;
			}
		}
		if (pkb == 0) {
			alert("Please check atleaset one Sub Categories");
			pb.industryType[0].focus();
			return false;
		}
	}
	
	if (pb.companyDescription.value==0) {
		alert("Please enter your company description");
		pb.companyDescription.focus();
		return false;
	}
	
	if (pb.companyDescription.value.length < 350) {
		alert("Please enter company description minimum of 350 characters.");
		pb.companyDescription.focus();
		return false;
	}
		
	if(pb.security_code.value.length < 5){
		alert("Please enter verification code");
		pb.security_code.focus();
		return false;	
	}
	
	if (pb.terms.value != "Y") {
		alert("Please select terms of use");
		pb.terms.focus();
		return false;
	}
}


function validate_admin_manage_member_form() {
	var pb=document.admin_manage_member_form;
	var email_check = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	var pwd_check = /^([a-zA-Z0-9])+$/;
	var name_check = /^([a-zA-Z\s])+([\s])*([a-zA-Z\s])*$/;
	
	if (pb.email.value==0) {
		alert("Please enter your Email ID");
		pb.email.focus();
		return false;
	}
	
	if(!email_check.test(pb.email.value)) {
		alert("Please enter a valid Email ID");
		pb.email.focus();
		return false;
	}
	
	if (pb.pwd.value == 0) {
		alert("Please enter your password");
		pb.pwd.focus();
		return false;
	}
	if (pb.pwd.value.length < 5) {
		alert("Password must be atleast 5 characters long (a-z, A-Z, 0-9 only");
		pb.pwd.focus();
		return false;
	}
	if((pb.pwd.value.length > 0) && (!pwd_check.test(pb.pwd.value))) {
		alert("Password must be atleast 5 characters long (a-z, A-Z, 0-9 only)");
		pb.pwd.focus();
		return false;
	}
	
	if (pb.memberName.value==0) {
		alert("Member Name is must");
		pb.memberName.focus();
		return false;
	}
	if (!name_check.test(pb.memberName.value)) {
		alert("Member Name should be in alphabets only");
		pb.memberName.focus();
		return false;
	}
	
	if (pb.companyName.value==0) {
		alert("Company name is must");
		pb.companyName.focus();
		return false;
	}
	
	if (pb.address.value==0) {
		alert("Please enter your address");
		pb.address.focus();
		return false;
	}
	
	if (pb.city.value==0) {
		alert("Please enter your city");
		pb.city.focus();
		return false;
	}
	
	if (pb.zipcode.value!=0) {
		if (pb.zipcode.value.length < 5) {
			alert("Please enter a valid zipcode number");
			pb.zipcode.focus();
			return false;
		}
		if (isNaN(pb.zipcode.value)) {
			alert("Zipcode number should be numeric only");
			pb.zipcode.focus();
			return false;
		}
	}	
	
	if (pb.country.options[pb.country.selectedIndex].value == "") {
		alert("Please select your country");
		pb.country.focus();
		return false;
	}
	
	if (pb.countryCodePhone.value.length > 0) {
		if (isNaN(pb.countryCodePhone.value)) {
			alert("Country code should be numeric only");
			pb.countryCodePhone.focus();
			return false;
		}
	}
	
	if (pb.areaCodePhone.value.length > 0) {
		if (isNaN(pb.areaCodePhone.value)) {
			alert("Area code should be numeric only");
			pb.areaCodePhone.focus();
			return false;
		}
	}
	
	if (pb.phone.value.length > 0) {
		if (isNaN(pb.phone.value)) {
			alert("Phone number should be numeric only");
			pb.phone.focus();
			return false;
		}
	}
	
	if (pb.countryCodeFax.value.length > 0) {
		if (isNaN(pb.countryCodeFax.value)) {
			alert("Country code should be numeric only");
			pb.countryCodeFax.focus();
			return false;
		}
	}
	
	if (pb.areaCodeFax.value.length > 0) {
		if (isNaN(pb.areaCodeFax.value)) {
			alert("Area code should be numeric only");
			pb.areaCodeFax.focus();
			return false;
		}
	}
	
	if (pb.fax.value.length > 0) {
		if (isNaN(pb.fax.value)) {
			alert("Fax number should be numeric only");
			pb.fax.focus();
			return false;
		}
	}
	
	if (pb.mobileNo.value==0) {
		if (isNaN(pb.mobileNo.value)) {
			alert("Mobile number should be numeric only");
			pb.mobileNo.focus();
			return false;
		}
		if (pb.mobileNo.value.length < 10) {
			alert("Please enter a valid mobile number");
			pb.mobileNo.focus();
			return false;
		}
	}
	
	if (pb.ownerName.value==0) {
		alert("Please enter your company's owner name");
		pb.ownerName.focus();
		return false;
	}
	if (!name_check.test(pb.ownerName.value)) {
		alert("Owner Name should be in alphabets only");
		pb.ownerName.focus();
		return false;
	}
	
	if (pb.yoe.value==0 || pb.yoe.value.length!=4) {
		alert("Please enter year established in ie 1990, 2001 etc");
		pb.yoe.focus();
		return false;
	}
	if (isNaN(pb.yoe.value)) {
		alert("Established year should be numeric only");
		pb.yoe.focus();
		return false;
	}
	
	if (pb.mainMarket.value==0) {
		alert("Please enter your main market");
		pb.mainMarket.focus();
		return false;
	}
	
	/*
	if (pb.companyLogo.value!=0) {
		if ((pb.companyLogo.value.lastIndexOf('.jpg')==-1) && (pb.companyLogo.value.lastIndexOf('.gif')==-1) && (pb.companyLogo.value.lastIndexOf('.jpeg')==-1) && (pb.companyLogo.value.lastIndexOf('.png')==-1)) {
			alert('You May Only Upload .jpg, .jpeg, .png, .gif Files');
			pb.companyLogo.focus();
			return false;
		}
	}	
	
	if (pb.companyVideo.value != 0) {
		if ((pb.companyVideo.value.lastIndexOf('.mov')==-1) && (pb.companyVideo.value.lastIndexOf('.mpg')==-1) && (pb.companyVideo.value.lastIndexOf('.mpeg')==-1) && (pb.companyVideo.value.lastIndexOf('.wmv')==-1) && (pb.companyVideo.value.lastIndexOf('.aac')==-1) && (pb.companyVideo.value.lastIndexOf('.mp4')==-1) && (pb.companyVideo.value.lastIndexOf('.mp3')==-1) && (pb.companyVideo.value.lastIndexOf('.dat')==-1)) {
			alert('You May Only Upload .mov, .mpg, .mpeg, .wmv, .aac, .mp4, .mp3, .dat Files');
			pb.companyVideo.focus();
			return false;
		}
	}
	*/
	
	if (pb.businessCountry.options[pb.businessCountry.selectedIndex].value == "") {
		alert("Please select your business country");
		pb.businessCountry.focus();
		return false;
	}
	
	var pkb=0;
	
	var len=document.getElementsByName('businessNature').length;
	var obj=document.getElementsByName('businessNature');
	
	for (var i=0; i < len; i++) {
		if (obj[i].checked) {
			pkb=1;
			break;
		}
	}
	
	if (pkb == 0) {
		alert('Please select atleast one business nature.');
		pb.businessNature[0].focus();
		return false;
	}		
	
	if (pb.mainCategory.options[pb.mainCategory.selectedIndex].value == "") {
		alert("Please select your category type");
		pb.mainCategory.focus();
		return false;
	}
	
	var pkb=0;
	var len=pb.industryType.length;
	
	if (!len) {
		if (!pb.industryType.checked) {
			alert("Please check atleaset one Sub Categories");
			pb.industryType.focus();
			return false;
		}
	}
	else {
		for (var i=0; i < len; i++) {
			if (pb.industryType[i].checked) {
				pkb=1;
				break;
			}
		}
		if (pkb == 0) {
			alert("Please check atleaset one Sub Categories");
			pb.industryType[0].focus();
			return false;
		}
	}
	
	if (pb.companyDescription.value==0) {
		alert("Please enter your company description");
		pb.companyDescription.focus();
		return false;
	}
	
	if (pb.companyDescription.value.length < 350) {
		alert("Please enter company description minimum of 350 characters.");
		pb.companyDescription.focus();
		return false;
	}
}


function validate_trade_alert_subscribe() {
	pb=document.trade_alert_subscribe;
	var email_check = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	
	if (pb.email.value==0) {
		alert("Please enter email id");
		pb.email.focus();
		return false;
	}
	
	if((pb.email.value.length >= 0) && (!email_check.test(pb.email.value))) {
		alert("Please enter a valid Email ID");
		pb.email.focus();
		return false;
	}
	
	if (pb.pwd.value==0) {
		alert("Please enter your password");
		pb.pwd.focus();
		return false;
	}
	
	if (pb.tradeAlert[0].checked==true) {
		var chk3=document.getElementById('interestedCategories').value;
		var chk4=0;
		for(var i=0;i<chk3.length;i++) {
			if (pb.interestedCategories[i].checked==true) {
				chk4++;
				break;
			}
		}
		
		if (chk4 <= 0) {
			alert("Please select your categories of involvement for trade alert");
			return false;
		}
	}
}


function validate_become_sponsor_form() {
	pb=document.become_sponsor_form;
	
	var pkb=0;
	
	var len=document.getElementsByName('categoryIDs').length;
	var obj=document.getElementsByName('categoryIDs');
	
	for (var i=0; i < len; i++) {
		if (obj[i].checked) {
			pkb=1;
			break;
		}
	}
	
	if (pkb == 0) {
		alert('Please select atleast one Category.');
		pb.categoryIDs[0].focus();
		return false;
	}	
}


function validate_upload_banner_form() {
	pb=document.upload_banner_form;
	
	if (pb.bannerUrl.value==0) {
		alert("Banner URL is must");
		pb.bannerUrl.focus();
		return false;
	}
	
	if (pb.banner.value==0) {
		alert("Banner is must");
		pb.banner.focus();
		return false;
	}
	
	if (pb.banner.value!=0) {
		if ((pb.banner.value.lastIndexOf('.jpg')==-1) && (pb.banner.value.lastIndexOf('.gif')==-1) && (pb.banner.value.lastIndexOf('.jpeg')==-1) && (pb.banner.value.lastIndexOf('.png')==-1)) {
			alert('You May Only Upload .jpg, .jpeg, .png, .gif Files');
			pb.banner.focus();
			return false;
		}
	}
	
	if(pb.security_code.value.length < 5){
		alert("Please enter verification code");
		pb.security_code.focus();
		return false;	
	}
}


function validate_company_description_chars_left() {
	var len=parseInt((document.getElementById('companyDescription').value).length);
	document.getElementById('company_description_chars_total').value=parseInt(len);
	
	if (len <= 350) {		
		document.getElementById('company_description_chars_left').value=350-parseInt(len);
	}
	else {
		document.getElementById('company_description_chars_left').value=0;
	}
}


function validate_post_trade_lead() {
	var pb=document.post_trade_lead;
	if (pb.mainCategory.options[pb.mainCategory.selectedIndex].value == "") {
		alert("Please select your category");
		pb.mainCategory.focus();
		return false;
	}
	
	var pkb=0;
	var len=pb.industryType.length;
	
	if (!len) {
		if (!pb.industryType.checked) {
			alert("Please check atleaset one Sub Categories");
			pb.industryType.focus();
			return false;
		}
	}
	else {
		for (var i=0; i < len; i++) {
			if (pb.industryType[i].checked) {
				pkb=1;
				break;
			}
		}
		if (pkb == 0) {
			alert("Please check atleaset one Sub Categories");
			pb.industryType[0].focus();
			return false;
		}
	}
	
	if(pb.leadTitle.value == 0){
		alert("Please enter trade lead title");
		pb.leadTitle.focus();
		return false;	
	}
	
	if(pb.leadDescription.value == 0){
		alert("Please enter trade lead description");
		pb.leadDescription.focus();
		return false;	
	}
	
	if (pb.image1.value!=0) {
		if ((pb.image1.value.lastIndexOf('.jpg')==-1) && (pb.image1.value.lastIndexOf('.gif')==-1) && (pb.image1.value.lastIndexOf('.jpeg')==-1) && (pb.image1.value.lastIndexOf('.png')==-1)) {
			alert('You May Only Upload .jpg, .jpeg, .png, .gif Files');
			pb.image1.focus();
			return false;
		}
	}
	
	/*
	if(pb.expiryDate.value == 0){
		alert("Please enter trade lead expiry date");
		//pb.expiryDate.focus();
		return false;	
	}
	*/	
}


function validate_add_new_product_form() {
	var pb=document.add_new_product_form;
		
	if(pb.productName.value == 0){
		alert("Please enter product name");
		pb.productName.focus();
		return false;	
	}
	
	if(pb.productCode.value == 0){
		alert("Please enter product code");
		pb.productCode.focus();
		return false;	
	}
	
	if (pb.image1.value!=0) {
		if ((pb.image1.value.lastIndexOf('.jpg')==-1) && (pb.image1.value.lastIndexOf('.gif')==-1) && (pb.image1.value.lastIndexOf('.jpeg')==-1) && (pb.image1.value.lastIndexOf('.png')==-1)) {
			alert('You May Only Upload .jpg, .jpeg, .png, .gif Files');
			pb.image1.focus();
			return false;
		}
	}
	
	if(pb.keyword.value == 0){
		alert("Please enter product keyword");
		pb.keyword.focus();
		return false;	
	}
	
	if (pb.mainCategory.options[pb.mainCategory.selectedIndex].value == "") {
		alert("Please select your category");
		pb.mainCategory.focus();
		return false;
	}
	
	var pkb=0;
	var len=pb.industryType.length;
	
	if (!len) {
		if (!pb.industryType.checked) {
			alert("Please check atleaset one Sub Categories");
			pb.industryType.focus();
			return false;
		}
	}
	else {
		for (var i=0; i < len; i++) {
			if (pb.industryType[i].checked) {
				pkb=1;
				break;
			}
		}
		if (pkb == 0) {
			alert("Please check atleaset one Sub Categories");
			pb.industryType[0].focus();
			return false;
		}
	}
	
	if(pb.productPrice.value == 0){
		alert("Please enter product price");
		pb.productPrice.focus();
		return false;	
	}
	if (isNaN(pb.productPrice.value)) {	
		alert("Please enter only numeric values");
		pb.productPrice.focus();
		return false;	
	}
	
	if(pb.discountedPrice.value != 0){
		if (isNaN(pb.productPrice.value)) {	
			alert("Please enter only numeric values");
			pb.productPrice.focus();
			return false;	
		}
	}
	
	if(pb.minimumOrder.value == 0){
		alert("Please enter product minimum order");
		pb.minimumOrder.focus();
		return false;	
	}
	if (isNaN(pb.minimumOrder.value)) {	
		alert("Please enter only numeric values");
		pb.minimumOrder.focus();
		return false;	
	}	
	
	if(pb.paymentTerms.value == 0){
		alert("Please enter product payment terms");
		pb.paymentTerms.focus();
		return false;	
	}
	
	if(pb.deliveryTime.value == 0){
		alert("Please enter product delivery time");
		pb.deliveryTime.focus();
		return false;	
	}
	
	if(pb.completeDescription.value == 0){
		alert("Please enter product description");
		pb.completeDescription.focus();
		return false;	
	}
}


function validate_contact_form() {
	var pb=document.contact_form;
	
	if (pb.contactName.value==0) {
		alert("Name is must");
		pb.contactName.focus();
		return false;
	}
	if (!isNaN(pb.contactName.value)) {
		alert("Your Name should be in alphabets only");
		pb.contactName.focus();
		return false;
	}
	
	if (pb.companyName.value==0) {
		alert("Company name is must");
		pb.companyName.focus();
		return false;
	}
	if (!isNaN(pb.companyName.value)) {
		alert("Company name should be in alphabets only");
		pb.companyName.focus();
		return false;
	}
	
	var email_check = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	
	if((pb.email_id.value.length >= 0) && (!email_check.test(pb.email_id.value))) {
		alert("Please enter a valid email ID");
		pb.email_id.focus();
		return false;
	}
	
	if (pb.phone.value == 0) {
		alert("Please enter your phone number");
		pb.phone.focus();
		return false;
	}
	if (pb.phone.value.length < 8) {
		alert("Please enter a valid phone number");
		pb.phone.focus();
		return false;
	}
	if (isNaN(pb.phone.value)) {
		alert("Phone number should be numeric only");
		pb.phone.focus();
		return false;
	}
	
	if (pb.fax.value!=0) {
		if (pb.fax.value.length < 8) {
			alert("Please enter a valid fax number");
			pb.fax.focus();
			return false;
		}
		if (isNaN(pb.fax.value)) {
			alert("Fax number should be numeric only");
			pb.fax.focus();
			return false;
		}
	}
	
	if (pb.subject.value == 0) {
		alert("Please enter your enquiry subject");
		pb.subject.focus();
		return false;
	}
	
	if (pb.comments.value == 0) {
		alert("Please enter your comments");
		pb.comments.focus();
		return false;
	}
	
	if(pb.security_code.value.length < 5){
		alert("Please enter verification code");
		pb.security_code.focus();
		return false;	
	}
}


function validate_reply_form() {
	var pb=document.reply_form;
	
	if (pb.subject.value==0) {
		alert("Subject is must");
		pb.subject.focus();
		return false;
	}
	
	if (pb.comments.value==0) {
		alert("Comments are must");
		pb.comments.focus();
		return false;
	}
}


function validate_feedback_form() {
	var pb=document.feedback_form;
	
	if (pb.name.value==0) {
		alert("Name is must");
		pb.name.focus();
		return false;
	}
	
	if (!isNaN(pb.name.value)) {
		alert("Name should be in alphabets only");
		pb.name.focus();
		return false;
	}
	
	var email_check = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	
	if((pb.email.value.length >= 0) && (!email_check.test(pb.email.value))) {
		alert("Please enter a valid email ID");
		pb.email.focus();
		return false;
	}
	
	if (pb.contactNo.value==0) {
		alert("Contact number is must");
		pb.contactNo.focus();
		return false;
	}	
	if (pb.contactNo.value.length < 8) {
		alert("Please enter a valid contact number");
		pb.contactNo.focus();
		return false;
	}
	if (isNaN(pb.contactNo.value)) {
		alert("Contact number should be numeric only");
		pb.contactNo.focus();
		return false;
	}
	
	if (pb.feedbackTitle.value==0) {
		alert("Feedback title is must");
		pb.feedbackTitle.focus();
		return false;
	}
	
	if (pb.comments.value == 0) {
		alert("Please enter your comments");
		pb.comments.focus();
		return false;
	}
	
	if(pb.security_code.value.length < 5){
		alert("Please enter verification code");
		pb.security_code.focus();
		return false;	
	}
}


function validate_advertise_form() {
	var pb=document.advertise_form;
	
	if (pb.personName.value==0) {
		alert("Name is must");
		pb.personName.focus();
		return false;
	}
	
	if (!isNaN(pb.personName.value)) {
		alert("Name should be in alphabets only");
		pb.personName.focus();
		return false;
	}
	
	if (pb.companyName.value==0) {
		alert("Company name is must");
		pb.companyName.focus();
		return false;
	}
	
	if (pb.industry.value==0) {
		alert("Industry name is must");
		pb.industry.focus();
		return false;
	}
	
	if (pb.bannerUrl.value==0) {
		alert("Banner URL is must");
		pb.bannerUrl.focus();
		return false;
	}
	
	if (pb.banner.value==0) {
		alert("Banner is must");
		pb.banner.focus();
		return false;
	}
	
	if (pb.banner.value!=0) {
		if ((pb.banner.value.lastIndexOf('.jpg')==-1) && (pb.banner.value.lastIndexOf('.gif')==-1) && (pb.banner.value.lastIndexOf('.jpeg')==-1) && (pb.banner.value.lastIndexOf('.png')==-1)) {
			alert('You May Only Upload .jpg, .jpeg, .png, .gif Files');
			pb.banner.focus();
			return false;
		}
	}
	
	if(pb.security_code.value.length < 5){
		alert("Please enter verification code");
		pb.security_code.focus();
		return false;	
	}
}


function validate_catalog_form() {
	var pb=document.catalog_form;
	
	if (pb.companyName.value==0) {
		alert("Company name is must");
		pb.companyName.focus();
		return false;
	}
	
	if (!isNaN(pb.companyName.value)) {
		alert("Company name should be in alphabets only");
		pb.companyName.focus();
		return false;
	}
	
	if (pb.company_logo.value==0 && pb.companyLogo.value==0) {
		alert("Company logo is must");
		pb.companyLogo.focus();
		return false;
	}
	
	if (pb.companyLogo.value!=0) {
		if ((pb.companyLogo.value.lastIndexOf('.jpg')==-1) && (pb.companyLogo.value.lastIndexOf('.gif')==-1) && (pb.companyLogo.value.lastIndexOf('.jpeg')==-1) && (pb.companyLogo.value.lastIndexOf('.png')==-1)) {
			alert('You May Only Upload .jpg, .jpeg, .png, .gif Files');
			pb.companyLogo.focus();
			return false;
		}
	}
	
	if (pb.header_image.value==0 && pb.headerImage.value==0) {
		alert("Header image is must");
		pb.headerImage.focus();
		return false;
	}
	
	if (pb.headerImage.value!=0) {
		if ((pb.headerImage.value.lastIndexOf('.jpg')==-1) && (pb.headerImage.value.lastIndexOf('.gif')==-1) && (pb.headerImage.value.lastIndexOf('.jpeg')==-1) && (pb.headerImage.value.lastIndexOf('.png')==-1)) {
			alert('You May Only Upload .jpg, .jpeg, .png, .gif Files');
			pb.headerImage.focus();
			return false;
		}
	}
	
	if (pb.companyProfile.value==0) {
		alert("Company profile is must");
		//pb.companyProfile.focus();
		return false;
	}
	
	if (pb.aboutUs.value==0) {
		alert("About us is must");
		//pb.aboutUs.focus();
		return false;
	}
	
	if (pb.contactUs.value==0) {
		alert("Contact us is must");
		//pb.contactUs.focus();
		return false;
	}
	
	if (pb.welcomeNote.value==0) {
		alert("Welcome note is must");
		//pb.welcomeNote.focus();
		return false;
	}
}


function validate_currency_converter_form() {
	var pb=document.currency_converter_form;
	if (pb.amount.value!=0) {
		if (isNaN(pb.amount.value)) {
			alert("Please enter numbers only");
			pb.amount.value="";
			pb.amount.focus();
			return false;
		}
	}
}


function validate_order_form(qty) {
	var pb=document.order_form;
	var email_check = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	
	if (pb.quantity.value < qty) {
		alert("Product quantity is less than minimum order");
		pb.quantity.focus();
		return false;
	}
	
	if (pb.quantity.value == 0) {
		alert("Please enter product quantity required");
		pb.quantity.focus();
		return false;
	}
	
	if (isNaN(pb.quantity.value)) {	
		alert("Please enter product quantity in numbers only");
		pb.quantity.focus();
		return false;
	}
	
	if (pb.customerName.value == 0) {
		alert("Please enter your name");
		pb.customerName.focus();
		return false;
	}
	
	if (pb.billingAddress.value == 0) {
		alert("Please enter your billing address");
		pb.billingAddress.focus();
		return false;
	}
	
	if (pb.mobileNo.value == 0) {
		alert("Please enter your mobile number");
		pb.mobileNo.focus();
		return false;
	}
	if (isNaN(pb.mobileNo.value)) {	
		alert("Please enter mobile number in numbers only");
		pb.mobileNo.focus();
		return false;
	}
	if (pb.mobileNo.value.length < 10) {
		alert("Please enter a valid mobile number");
		pb.mobileNo.focus();
		return false;
	}
	
	
	if((pb.email.value.length >= 0) && (!email_check.test(pb.email.value))) {
		alert("Please enter a valid Email ID");
		pb.email.focus();
		return false;
	}		
}


function validate_search_top() {
	var pb=document.search_top;
	
	if (pb.seachFor.options[pb.seachFor.selectedIndex].value == "") {	
		alert("Please select search for");
		pb.seachFor.focus();
		return false;
	}
}


function set_search_top_form_action() {
	var pb=document.search_top;
	document.search_top.action=pb.seachFor.value;
}


function validate_advanced_search() {
	var pb=document.advanced_search;
	
	if (pb.seachFor.options[pb.seachFor.selectedIndex].value == "") {	
		alert("Please select search for");
		pb.seachFor.focus();
		return false;
	}
}


function set_advanced_search_form_action() {
	var pb=document.advanced_search;
	document.advanced_search.action=pb.seachFor.value;
	
	document.getElementById("disp_product_search_options").style.display='none';
	document.getElementById("disp_company_search_options").style.display='none';
	
	if (pb.seachFor.value.indexOf("products.php") != -1) {
		document.getElementById("disp_product_search_options").style.display='block';
	}
	
	if (pb.seachFor.value.indexOf("classified_listing.php") != -1) {
		document.getElementById("disp_company_search_options").style.display='block';
	}	
}


function filldata() {
	var f1=document.manage_members;
  if(f1.chk.checked==1) {
	  f1.addressShip.value=f1.address.value;
	  f1.cityShip.value=f1.city.value;
	  f1.zipcodeShip.value=f1.zipcode.value;
	  f1.stateShip.value=f1.state.value;
	  f1.countryShip.value=f1.country.value;
	  f1.phoneShip.value=f1.phone.value;
	  f1.faxShip.value=f1.fax.value;
  }
  else{
	  f1.addressShip.value="";
	  f1.cityShip.value="";
	  f1.zipcodeShip.value="";
	  f1.stateShip.value="";
	  f1.countryShip.value="";
	  f1.phoneShip.value="";
	  f1.faxShip.value="";
  }
}


function check_uncheck(form_name) {
	dml=eval('document.'+form_name);
	len=dml.elements.length;
	var i=0;
	for (i=0; i<len; i++) {
		if (dml.elements[i].type == "checkbox") {
			dml.elements[i].checked=dml.check_all.checked			
		}
	}	
}


function chk_unchk(val, form_name) {
	dml=eval('document.'+form_name);
	len=dml.elements.length;
	var i=0;
	var ids="";
	for (i=0; i<len; i++) {
		if (dml.elements[i].type == "checkbox") {
			if (val == 1) {
				dml.elements[i].checked=true;
				ids+=dml.elements[i].value+"^";
			}
			else {
				dml.elements[i].checked=false;
			}
		}
	}
	document.getElementById('leadIDs').value=ids;	
}


function chk_unchk_single(form_name) {
	dml=eval('document.'+form_name);
	len=dml.elements.length;
	var i=0;
	var ids="";
	for (i=0; i<len; i++) {
		if (dml.elements[i].type == "checkbox") {
			if (dml.elements[i].checked==true) {
				ids+=dml.elements[i].value+"^";				
			}			
		}
	}
	document.getElementById('leadIDs').value=ids;
}


function contact_window() {
	var ids=document.getElementById('leadIDs').value;	
	if (ids==0) {
		alert("Please select a trade lead first");		
		return false;	
	}
	window.open('tradelead_enquiry.php?ids='+ids,'royale', 'toolbar=no,width=500,height=540,left=250,top=100, screenX=250,screenY=150,status=no,scrollbars=no, resizable=no,')
}


function chk_unchk1(val, form_name) {
	dml=eval('document.'+form_name);
	len=dml.elements.length;
	var i=0;
	var ids="";
	for (i=0; i<len; i++) {
		if (dml.elements[i].type == "checkbox") {
			if (val == 1) {
				dml.elements[i].checked=true;
				ids+=dml.elements[i].value+"^";				
			}
			else {
				dml.elements[i].checked=false;
			}
		}
	}
	document.getElementById('memberIDs').value=ids;
}


function chk_unchk_single1(form_name) {
	dml=eval('document.'+form_name);
	len=dml.elements.length;
	var i=0;
	var ids="";
	for (i=0; i<len; i++) {
		if (dml.elements[i].type == "checkbox") {
			if (dml.elements[i].checked==true) {
				ids+=dml.elements[i].value+"^";				
			}			
		}
	}
	document.getElementById('memberIDs').value=ids;
}


function contact_business_window() {
	var ids=document.getElementById('memberIDs').value;	
	if (ids==0) {
		alert("Please select a business classified first");		
		return false;	
	}
	window.open('company_enquiry.php?ids='+ids,'royale', 'toolbar=no,width=500,height=540,left=250,top=100, screenX=250,screenY=150,, status=no, scrollbars=no, resizable=no,')
}


function chk_unchk2(val, form_name) {
	dml=eval('document.'+form_name);
	len=dml.elements.length;
	var i=0;
	var ids="";
	for (i=0; i<len; i++) {
		if (dml.elements[i].type == "checkbox") {
			if (val == 1) {
				dml.elements[i].checked=true;
				ids+=dml.elements[i].value+"^";				
			}
			else {
				dml.elements[i].checked=false;
			}
		}
	}
	document.getElementById('productIDs').value=ids;
}


function chk_unchk_single2(form_name) {
	dml=eval('document.'+form_name);
	len=dml.elements.length;
	var i=0;
	var ids="";
	for (i=0; i<len; i++) {
		if (dml.elements[i].type == "checkbox") {
			if (dml.elements[i].checked==true) {
				ids+=dml.elements[i].value+"^";				
			}			
		}
	}
	document.getElementById('productIDs').value=ids;
}


function contact_product_window() {
	var ids=document.getElementById('productIDs').value;	
	if (ids==0) {
		alert("Please select a product first");		
		return false;	
	}
	window.open('product_enquiry.php?ids='+ids,'royale', 'toolbar=no,width=500,height=540,left=250,top=100, screenX=250,screenY=150,, status=no, scrollbars=no, resizable=no,')
}


function submitAdvertisement(page,position,price,duration) {
	document.getElementById('page').value=page;
	document.getElementById('position').value=position;
	document.getElementById('price').value=price;
	document.getElementById('duration').value=document.getElementById(duration).value;	
}


function submit_form(dropVal,slno) {	
	document.formn.recordID.value=slno;
	document.formn.hotLead.value=dropVal;
	document.formn.submit();	
}


function submit_form1(dropVal,slno) {	
	document.formn.recordID.value=slno;
	document.formn.premiumMember.value=dropVal;
	document.formn.submit();	
}


function submit_form2(dropVal,slno) {	
	document.formn.recordID.value=slno;
	document.formn.featuredProduct.value=dropVal;
	document.formn.submit();	
}


function submit_form3(dropVal,slno) {	
	document.formn.recordID.value=slno;
	document.formn.expressProduct.value=dropVal;
	document.formn.submit();	
}


