// JavaScript Document

function disp_need()
{
	if (document.getElementById("how_many_status").value == "Yes")
	{
		document.getElementById("need_div").style.display = "block";
	}
	else 
	{
		document.getElementById("need_div").style.display = "none";
	}
}

function disp_site()
{
	if (document.getElementById("website").value == "Yes")
	{
		document.getElementById("site_div").style.display = "block";
	}
	else 
	{
		document.getElementById("site_div").style.display = "none";
	}
}

function checkBlankField (txt)
			{
			var mint_txt = txt.length;
			var mstr_txt = txt;
			var mint_count = 0;
		    for (var iloop = 0; iloop<mint_txt; iloop++)
		    {
				        if (mstr_txt.charAt(iloop) == " ")
				        {
				           mint_count = mint_count+1;
				        }
				 }    
// if nothing entered in the field
   	 				if (txt == "")
   	 				{
					return false;
				    }
				    	 else if (mint_count == mint_txt)
				    	{
						return false;
						}
				return true;
				}
				
				function valid_email(eml)
{
	//declare the required variables
	var mint_len;
	var mstr_eml=eml;
	var mint_at=0;
	var mint_atnum=0;
	var mint_dot=0;
	var mint_dotnum=0;

	mint_len = eml.length; //takes the length of the email address entered
	//checking for the symbol single quote. If found replace it with its html code
	if (mstr_eml.indexOf("'")!=-1)
	{	
		mstr_eml=mstr_eml.replace("'","'");
	}
	//checking for the (@) & (.) symbol
	for(var iloop=0;iloop<mint_len;iloop++)
	{
		if(mstr_eml.charAt(iloop)=="@")
		{
			mint_at=iloop+1;
			mint_atnum=mint_atnum+1;
		}
		if(mstr_eml.charAt(iloop)==".")
		{
			mint_dot=iloop+1;
			mint_dotnum=mint_dotnum+1;
		}
	}
	//if nothing entered in the field
	if (mstr_eml=="")
	{
		return true;
	}
	//if @ entered more than once & dot (.) entered more than 4 times
	else if((mint_atnum!=1)||(mint_dotnum>4)||((mint_dot-mint_at)<2)||((mint_len-mint_dot)<2)||(mint_at<3))
	{
		return true;
	}
	//if any blank space is entered in the email address
	else if (mstr_eml.indexOf(" ")!=-1)
	{
		return true;
	}
	return false;
}

							
function contact()

	
			{
			
			
			
			
			
			if(checkBlankField(document.form_01.name.value) == false){
			alert("please enter the name");
			document.form_01.name.select();
			return false
			}
			
			if(checkBlankField(document.form_01.company.value) == false){
			alert("please enter the company");
			document.form_01.company.select();
			return false
			}
			
			if(checkBlankField(document.form_01.email.value) == false){
			alert("please enter the email");
			document.form_01.email.select();
			return false
			}
			
			if(valid_email(document.form_01.email.value) == true){
			alert("Plese enter correct e-mail address");
			document.form_01.email.select();
			return false
			}
		
			if(checkBlankField(document.form_01.phone.value) == false){
			alert("please enter the phone");
			document.form_01.phone.select();
			return false
			}
		
		if(checkBlankField(document.form_01.security_code.value) == false){
			alert("please enter the security code");
			document.form_01.security_code.select();
			return false
			}
			
		
			}
			
			function contact_frm()



	

			{

			

			if(checkBlankField(document.form_01.name.value) == false){

			alert("please enter the name");

			document.form_01.name.select();

			return false

			}

			

			if(checkBlankField(document.form_01.company.value) == false){

			alert("please enter the company");

			document.form_01.company.select();

			return false

			}

			

			if(checkBlankField(document.form_01.email.value) == false){

			alert("please enter the email");

			document.form_01.email.select();

			return false

			}

			

			if(valid_email(document.form_01.email.value) == true){

			alert("Plese enter correct e-mail address");

			document.form_01.email.select();

			return false

			}

		

			if(checkBlankField(document.form_01.phone.value) == false){

			alert("please enter the phone");

			document.form_01.phone.select();

			return false

			}

		

			if(checkBlankField(document.form_01.comment.value) == false){

			alert("please enter the comment");

			document.form_01.comment.select();

			return false

			}

		

		if(checkBlankField(document.form_01.security_code.value) == false){

			alert("please enter the security code");

			document.form_01.security_code.select();

			return false

			}

			}