////////  Div visible false and true //////////////
function vedio_box(){
		add = document.getElementById("video");
		//height = document.getElementById("video").clientHeight;
		add.style.visibility = (add.style.visibility == "visible") ? "hidden" : "visible";
		add.style.height = (add.style.height == "150px") ? "0px" : "150px";
}
function photo_box(){
		add = document.getElementById("photography");
		add.style.visibility = (add.style.visibility == "visible") ? "hidden" : "visible";
		add.style.height = (add.style.height == "150px") ? "0px" : "150px";
}



/////////////////// Validate Form fields///////////////////////
function form_submit(){
    if(document.form.txtFirstName.value==''){
		alert("First Name field cannot be blank !");
		document.form.txtFirstName.focus();
		return false;
	}
	if(document.form.txtLastName.value==''){
		alert("Last Name field cannot be blank !");
		document.form.txtLastName.focus();
		return false;
	}
    if(document.form.txtCompanyName.value==''){
		alert("Please Enter the company Name !");
		document.form.txtCompanyName.focus();
		return false;
	}
	  if(document.form.txtCompanyUrl.value==''){
		alert("Please Enter the company website URL !");
		document.form.txtCompanyUrl.focus();
		return false;
	}
    if(document.form.txtPhoneNumber.value==''){
		alert("Telephone field cannot be blank !");
		document.form.txtPhoneNumber.focus();
		return false;
	}
	var emailID=document.form.txtEmailAddress
	
	if ((emailID.value==null)||(emailID.value=="")){
		alert("Please Enter your Email ID")
		emailID.focus()
		return false
	}
	if (echeck(emailID.value)==false){
		emailID.value=""
		emailID.focus()
		return false
	}
    if(document.form.txtSubject.value==''){
		alert("Please enter the subject!");
		document.form.txtSubject.focus();
		return false;
	} 
	
    if(document.form.txtMessage.value==''){
		alert("Please typ your Message!");
		document.form.txtMessage.focus();
		return false;
	} 		
	document.form.action="send_mail.php";
	document.form.submit();
	return true;
}

///////Check validity of the email ///////////////
function echeck(str) {

		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		if (str.indexOf(at)==-1){
		   alert("Invalid E-mail ID")
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   alert("Invalid E-mail ID")
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    alert("Invalid E-mail ID")
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    alert("Invalid E-mail ID")
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    alert("Invalid E-mail ID")
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    alert("Invalid E-mail ID")
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1){
		    alert("Invalid E-mail ID")
		    return false
		 }

 		 return true					
	}