// JavaScript Document
function registerCheck()
	{
		var theform = document.registerform;
		
		if(theform.fullname.value == "")
		{
			alert("Full name can not empty!");
			theform.fullname.focus();
			return false;
		}
		if(theform.username.value == "")
		{
			alert("Username can not empty!");
			theform.username.focus();
			return false;
		}		
		if(theform.email.value == "")
		{
			alert("Email can not empty!");
			theform.email.focus();
			return false;
		}
		if(theform.email.value != "")
		{
			var str = theform.email.value;
			if((str.indexOf('@',0) == -1)||(str.indexOf('.') == -1)||(str.length <5))
			{
				alert("Wrong Email Format!");
				theform.email.focus();
				return false;
			}
		}
		if(theform.password.value == "")
		{
			alert("Password can not empty!");
			theform.password.focus();
			return false;
		}
		if(theform.repassword.value == "")
		{
			alert("Repassword can not empty!");
			theform.repassword.focus();
			return false;
		}
		if(theform.repassword.value != theform.password.value)
		{
			alert("Password and Repassword don't match!");
			theform.password.focus();
			return false;
		}
		if(theform.verificationcode.value == "")
		{
			alert("Verify can not empty!");
			theform.verificationcode.focus();
			return false;
		}
		if(theform.agreement.checked == false)
		{
			alert("You have to accept Freebizznet terms if you login.");
			theform.agreement.focus();
			return false;
		}			
	}
function loginCheck(){
	var theform = document.loginform;
	
	if(theform.username.value == "") {
		alert("Please enter your username/email!");
		theform.fullname.focus();			
		return false;
	}
	if(theform.password.value == "")
	{
		alert("Password can not empty!");
		theform.password.focus();
		return false;
	}			
}

function contactinfoCheck(){
	var theform = document.contactinfo;
	
	if(theform.companyname.value == "") {
		alert("Please enter your companyname!");
		theform.companyname.focus();			
		return false;
	}
	if(theform.address.value == "") {
		alert("Please enter your street + number!");
		theform.address.focus();			
		return false;
	}
	if((theform.companyemail.value.indexOf('@',0) == -1)||(theform.companyemail.value.indexOf('.') == -1)||(theform.companyemail.value.length <5)){
		alert("Please enter your email!");
		theform.companyemail.focus();
		return false;
	}	
	if(theform.companyphone.value == "") {
		alert("Please enter your company phone!");
		theform.companyphone.focus();			
		return false;
	}
	if(theform.contactname.value == "") {
		alert("Please enter the contact name!");
		theform.contactname.focus();			
		return false;
	}
	if(theform.contactphone.value == "") {
		alert("Please enter the contact phone!");
		theform.contactphone.focus();			
		return false;
	}
	if((theform.contactemail.value.indexOf('@',0) == -1)||(theform.contactemail.value.indexOf('.') == -1)||(theform.contactemail.value.length <5)){
		alert("Please enter the contact email!");
		theform.contactemail.focus();
		return false;
	}	
}
function validationCheck(){
	var theform = document.validationform;
	
	if(theform.forename.value == "") {
		alert("Please enter the contact forename!");
		theform.forename.focus();			
		return false;
	}
	if(theform.familyname.value == "") {
		alert("Please enter the contact familyname!");
		theform.familyname.focus();			
		return false;
	}
	if(theform.functioncompany.value == "") {
		alert("Please enter the contact functioncompany!");
		theform.functioncompany.focus();			
		return false;
	}
	if(theform.street.value == "") {
		alert("Please enter the street address + number!");
		theform.street.focus();			
		return false;
	}
	if(theform.city.value == "") {
		alert("Please enter the city!");
		theform.city.focus();			
		return false;
	}
	if(theform.country.value == "0") {
		alert("Please select the country!");
		theform.country.focus();			
		return false;
	}
	if(theform.telephone.value == "") {
		alert("Please enter the contact telephone !");
		theform.telephone.focus();			
		return false;
	}
	if((theform.email.value.indexOf('@',0) == -1)||(theform.email.value.indexOf('.') == -1)||(theform.email.value.length <5)){
		alert("Please enter the contact email!");
		theform.email.focus();
		return false;
	}		
	if(theform.companynumber.value == "") {
		alert("Please enter the company registration number at the Chamber of Commerce!");
		theform.companynumber.focus();			
		return false;
	}
	if(theform.legalform.value == "") {
		alert("Please enter the company legal form!");
		theform.legalform.focus();			
		return false;
	}	
	if(theform.companydirector.value == "") {
		alert("Please enter the name of company director!");
		theform.companydirector.focus();			
		return false;
	}
	if(theform.companydirector.value == "") {
		alert("Please enter the name of company director!");
		theform.companydirector.focus();			
		return false;
	}
	if(theform.accept.checked == false)
	{
		alert("You have to accept the term and condition of FreeBizzNet Match Making services.");
		theform.accept.focus();
		return false;
	}
}

function productCheck(){
	var theform = document.product;
	if(theform.title.value == "") {
		alert("Please enter the product name!");
		theform.title.focus();			
		return false;
	}
}

function videoCheck(){
	var theform = document.video;
	if(theform.title.value == "") {
		alert("Please enter the video clip name!");
		theform.title.focus();			
		return false;
	}
	if(theform.videourl.value == "") {
		alert("Please enter the video clip url!");
		theform.videourl.focus();			
		return false;
	}	
}

function uploadleadCheck(){
	var theform = document.uploadlead;
	if(theform.title.value == "") {
		alert("Please enter the title!");
		theform.title.focus();			
		return false;
	}
	if(theform.description.value == "") {
		alert("Please enter the description!");
		theform.description.focus();			
		return false;
	}	
	if(theform.description.value == "") {
		alert("Please enter the description!");
		theform.description.focus();			
		return false;
	}		
}

function contactcompanyCheck(){
	var theform = document.contactcompany;
	
	if(theform.companyname.value == "") {
		alert("Please enter your company name!");
		theform.companyname.focus();			
		return false;
	}
	if(theform.contactname.value == "") {
		alert("Please enter your name!");
		theform.contactname.focus();			
		return false;
	}
	if((theform.contactemail.value.indexOf('@',0) == -1)||(theform.contactemail.value.indexOf('.') == -1)||(theform.contactemail.value.length <5)){
		alert("Please enter your email!");
		theform.contactemail.focus();
		return false;
	}	
	if(theform.contactcontent.value == "") {
		alert("Please enter your message!");
		theform.contactcontent.focus();			
		return false;
	}
	if(theform.verificationcode.value == "") {
		alert("Please enter the verification code!");
		theform.verificationcode.focus();			
		return false;
	}	
}
function isCheck()
	{
		var theform = document.contactform;
		
		if(theform.fullname.value == "") {
			alert("Please enter your name!");
			theform.fullname.focus();			
			return false;
		}
		if(theform.company.value == "")
		{
			alert("Please enter your company name!");
			theform.company.focus();
			return false;
		}		
		if(theform.diachi.value == "") {
			alert("Please enter your address");
			theform.diachi.focus();
			return false;
		}
		if(theform.dienthoai.value == "") {
			alert("Please enter your telephone");
			 
			theform.dienthoai.focus();
			return false;
		}
		if(theform.email.value == "")
		{
			alert("Please enter your email!");
			theform.email.focus();
			return false;
		}
		if(theform.email.value != "")
		{
			var str = theform.email.value;
			if((str.indexOf('@',0) == -1)||(str.indexOf('.') == -1)||(str.length <5))
			{
				alert("Wrong email format!");
				theform.email.focus();
				return false;
			}
		}	
	}
	function closeWindow(){
		agreewin.hide();
	}
	function check_contact_us(){
		var theform = document.contact_us;

		if(theform.name.value == "")
		{
			alert("Please enter your fullname!");
			theform.name.focus();
			return false;
		}
		if(theform.email.value == "")
		{
			alert("Please enter your email!");
			theform.email.focus();
			return false;
		}
		if(theform.email.value != "")
		{
			var str = theform.email.value;
			if((str.indexOf('@',0) == -1)||(str.indexOf('.') == -1)||(str.length <5))
			{
				alert("Wrong email format!");
				theform.email.focus();
				return false;
			}
		}
		if(theform.subject.value == "")
		{
			alert("Please enter your subject!");
			theform.subject.focus();
			return false;
		}
		if(theform.content.value == "")
		{
			alert("Please enter your content!");
			theform.content.focus();
			return false;
		}		
		if(theform.verificationcode.value == "")
		{
			alert("Please enter the verification code!");
			theform.verificationcode.focus();
			return false;
		}		
	}
	
	function opportunityCheck(){
		var theform = document.opportunity;
		if(theform.continent.value == "0")
		{
			alert("Please select the location!");
			theform.continent.focus();
			return false;
		}
		if(theform.parentcatbox.value == "0")
		{
			alert("Please select the business category!");
			theform.parentcatbox.focus();
			return false;
		}
		if(theform.categorybox.value == "0")
		{
			alert("Please select the subcategory!");
			theform.categorybox.focus();
			return false;
		}
		if(theform.title.value == "")
		{
			alert("The opportunity title cannot be empty!");
			theform.title.focus();
			return false;
		}
		if(theform.description.value == "")
		{
			alert("The Opportunity description cannot be empty!");
			theform.description.focus();
			return false;
		}
		if(theform.expertiseneed.value == "")
		{
			alert("The Conditions or Criteria cannot be empty!");
			theform.expertiseneed.focus();
			return false;
		}		
	}
	
	