// JavaScript Document
function ShowProfile()
{
	document.getElementById("dropmenu1").style.display="block";
}

function ShowProfile2()
{
	document.getElementById("dropmenu4").style.display="block";
}

function ShowProfile3()
{
	document.getElementById("dropmenu2").style.display="block";
}
function ShowProfile4()
{
	document.getElementById("dropmenu3").style.display="block";
}
function ShowProfile5()
{
	document.getElementById("dropmenu5").style.display="block";
}
function ShowProfile6()
{
	document.getElementById("dropmenu6").style.display="block";
}
// Slide Show

// Back
function backPage()
{
history.back();	
}
// Email check
function isEmail(Ml) {
	if(!Ml) {
		return true;
	}
	if( Ml.indexOf("@") <= 0 ||
		Ml.indexOf("@") == Ml.length-1 ||
		Ml.indexOf(".") <= 0 || 
		Ml.indexOf(".") == Ml.length-1 ||
		Ml.indexOf("..") != -1 ||
		Ml.indexOf("@@") != -1 ||
		Ml.indexOf("@.") != -1 ||
		Ml.indexOf(".@") != -1 ) {
		return false;
	}
	else {
		return true;
	}
}

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){   return false }

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){   return false		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){    return false	}
		
		if (str.indexOf(at,(lat+1))!=-1){   return false }

		if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){    return false	 }
		
		if (str.indexOf(dot,(lat+2))==-1) {   return false }
		
		if (str.indexOf(" ")!=-1){   return false }

 		return true					
}
//Function for alpha-numeric|numeric check
function keyRestrict(e, validchars) 
{
	 var key='', keychar='';
	 key = getKeyCode(e);
	 if (key == null) return true;
	 keychar = String.fromCharCode(key);
	 keychar = keychar.toLowerCase();
	 validchars = validchars.toLowerCase();
	 if (validchars.indexOf(keychar) != -1)
	  return true;
	 if ( key==null || key==0 || key==8 || key==9 || key==13 || key==27 )
	  return true;
	 return false;
}
function getKeyCode(e)
{
	 if (window.event)
		return window.event.keyCode;
	 else if (e)
		return e.which;
	 else
	 return null;
}
// Contact Us Validation
function contactUsValidation()
{
	 var txt = "";
	 if(document.frmContactUs.fullName.value == "") {
			txt += "Name cannot be blank.\n";
	 }
	 if(document.frmContactUs.companyName.value == "") {
			txt += "Company name cannot be blank.\n";
	 }
	 if(document.frmContactUs.email.value == "") {
			txt += "Email cannot be blank.\n";
	 }
	 if(document.frmContactUs.email.value != "") {
			if(echeck(document.frmContactUs.email.value)==false) {
				txt += "Please enter a Valid Email.\n";
			}
	 }
	 if(document.frmContactUs.confirmEmail.value == "") {
			txt += "Confirm email cannot be blank.\n";
	 }
	 if(document.frmContactUs.confirmEmail.value != "") {
			if(echeck(document.frmContactUs.confirmEmail.value)==false) {
				txt += "Please enter a valid confirm email.\n";
			}
	 }
	 if(document.frmContactUs.email.value!=document.frmContactUs.confirmEmail.value) {
			txt += "Email and confirm email does not match.\n";
	 }
	 if(document.frmContactUs.message.value == "") {
			txt += "Message cannot be blank.\n";
	 }
	 if(document.frmContactUs.captchatext.value == "") {
			txt += "Enter security code.\n";
	 }
	 if(txt!="")   {
			alert("Hey guest, following fields are mandatory :\n\n"+txt);
			return false;
	 }
}
// Submit Testimonial Validation
function chk_Testi_validation()
{
	 var txt = "";
	 if(document.frmTesti.testi_name.value == "") {
			txt += "Name cannot be blank.\n";
	 }
	 if(document.frmTesti.testi_email.value == "") {
			txt += "Email cannot be blank.\n";
	 }
	 if(document.frmTesti.testi_email.value != "") {
			if(echeck(document.frmTesti.testi_email.value)==false) {
				txt += "Please enter a Valid Email.\n";
			}
	 }
	 if(document.frmTesti.testi_company.value == "") {
			txt += "Company cannot be blank.\n";
	 }
	 if(document.frmTesti.testi_message.value == "") {
			txt += "Message cannot be blank.\n";
	 }
	 if(document.frmTesti.contact_security.value == "") {
		txt += "Security Code cannot be blank.\n";
	 }
	 if(txt!="")   {
			alert("Hey guest, following fields are mandatory :\n\n"+txt);
			return false;
	 }
}


