﻿// JScript File
var signal='false';
function AllowAlphabet(e){  
	keyEntry = e.keyCode;
      if(((keyEntry >= '65') && (keyEntry <= '90')) || ((keyEntry >= '97') && (keyEntry <= '122')) || (keyEntry=='46') || (keyEntry=='32') || keyEntry=='45' )       
      return true;        
else            
return false;}


String.prototype.trim = function() {
	return this.replace(/^\s+|\s+$/g,"");
}
String.prototype.ltrim = function() {
	return this.replace(/^\s+/,"");
}
String.prototype.rtrim = function() {
	return this.replace(/\s+$/,"");
}

function fnCheckAlphabets()
{
var iAsciiNull="";
if ((window.event.keyCode>=65 && window.event.keyCode<=90) || (window.event.keyCode>=97 && window.event.keyCode<=122) || window.event.keyCode==32)
{ 
return true;
}
else
 
window.event.keyCode=iAsciiNull;
return false; 
}

function containsdigit(param)
{
mystrLen = param.length;
for(i=0;i<mystrLen;i++)
{
if((param.charAt(i)=="0") || (param.charAt(i)=="1") || (param.charAt(i)=="2") || (param.charAt(i)=="3") || (param.charAt(i)=="4") || (param.charAt(i)=="5") || (param.charAt(i)=="6") || (param.charAt(i)=="7") || (param.charAt(i)=="8") || (param.charAt(i)=="9") || (param.charAt(i)=="/"))
{
return true;
}
}
return false;
}
//268261
function chk()
{
regExpression = /^[A-Za-z ]*$/ ;
var remobile=/^[7-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]$/;

	if(document.getElementById("txtName").value.trim()=="Name")
	{
		alert("Enter Name!");
		document.getElementById("txtName").focus();
		return false;
	}
if(document.getElementById("txtName").value.trim()=="")
	{
		 alert("Enter Name!");
		 document.getElementById("txtName").focus();
		 return false;
  	}


	else if(containsdigit(document.getElementById("txtName").value.trim())==true)
	{
		alert("Name contains numbers!");
		 document.getElementById("txtName").focus();
		return false;
	}

 if(!regExpression.test(document.form1.txtName.value)){
                  alert("Invalid Name");
                  document.form1.txtName.focus();
                  document.form1.txtName.select();
                  return false;
            }
 else if(document.getElementById("txtEmail").value.trim()=="")
	{
	    alert("Enter Email!");
		document.getElementById("txtEmail").focus();
		 return false;
	}
if(document.getElementById("txtEmail").value.trim() !="")
	{
	    if(echeck(document.getElementById("txtEmail").value.trim()))
	    {
	    }
	    else
	    {
	        document.getElementById("txtEmail").focus();
	        return false;
	    }
	}
if (document.getElementById("ddlCity").options[document.getElementById("ddlCity").selectedIndex].value=="Select City")
	{
		alert("Please select city");
		document.getElementById("ddlCity").focus();
		return;
	}

	if (document.getElementById("ddlCity").options[document.getElementById("ddlCity").selectedIndex].value=="")
	{
		alert("Please select city");
		document.getElementById("ddlCity").focus();
		return;
	}


	if((document.getElementById("txtContactNo").value.trim()=="") || (document.getElementById("txtContactNo").value=="Mobile Number"))
	{
		alert("Enter Mobile No.!");
		document.getElementById("txtContactNo").focus();
		return false;
	}

	if (document.getElementById("txtContactNo").value.trim() !="")
	{
	    if (checknumber(document.getElementById("txtContactNo").value.trim()))
	    {
	       alert("Invalid Mobile NO.!")
	       document.getElementById("txtContactNo").focus();
	        return false;
	    }
		if (parseFloat(document.getElementById("txtContactNo").value.length)<10)
		{
				alert("Invalid Mobile NO.!")
				document.getElementById("txtContactNo").focus();
				return false;
		}
		if (document.getElementById("txtContactNo").value.search(remobile)==-1)
			{
		alert("Please Enter A Valid Mobile Number");
		document.getElementById("txtContactNo").focus();
		return false;
		}

	}
	var a = document.form1.txtName.value;
	var b = document.form1.txtContactNo.value;
	var c = document.form1.txtEmail.value;
	var d = document.form1.ddlCity.value;
	var e = document.form1.campaign.value;
	var f = document.form1.website.value;
	var g = document.form1.adunitsize.value;

	emailwindow=dhtmlmodal.open('EmailBox', 'iframe', 'getsmscode.asp?a='+a+'&b='+b+'&c='+c+'&d='+d+'&e='+e+'&f='+f+'&g='+g, '', 'width=400px,height=250px,center=1,resize=0,scrolling=1')

	emailwindow.onclose=function(){
			//doc90ument.
			//alert("close");
			signal='true';
			document.form1.method="post";
			//enter your url below here
			//document.form1.action="connectionfile/ins.asp";
			document.form1.action='tq.asp?'+document.form1.txtContactNo.value;

			document.form1.submit();

			//document.getElementById("youremail").innerHTML='Mobile Number Verified';
			signal='true';
			//document.form1.txtName.disabled=true;
			//document.form1.txtContactNo.disabled=true;
			//document.form1.txtEmail.disabled=true;
			//document.form1.btngetcode.disabled=true;
			return true;
	}
	

	//document.form1.method="post";
	//document.form1.action="getsmscode.asp";
	//document.form1.submit();

}

function gogrowth()
{
	//alert("go");
	document.form1.method="post";
			//enter your url below here
			
			document.form1.action="http://www.lntmf.com/lntgrowth/index.asp";

			document.form1.submit();
}

function gomip()
{
	//alert("go");
	document.form1.method="post";
			//enter your url below here
			
			document.form1.action="http://www.lntmf.com/lntmip/index.asp";

			document.form1.submit();
}

function ValidateContact()
{
		regExpression = /^[A-Za-z ]*$/ ;
		var remobile=/^[7-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]$/;
	if(!regExpression.test(document.form1.txtName.value)){
		  alert("Invalid Name");
		  document.form1.txtName.focus();
		  document.form1.txtName.select();
		  return false ;
	}
    if(document.getElementById("txtName").value.trim()=="")
	{
		 alert("Enter Name!");
		 document.getElementById("txtName").focus();
		 return false ;
  	}
	if(containsdigit(document.getElementById("txtName").value.trim())==true)
	{
		alert("Name contains numbers!");
		 document.getElementById("txtName").focus();
		return false ;
	}

	if(!regExpression.test(document.form1.txtCompanyName.value)){
		  alert("Invalid Company Name");
		  document.form1.txtCompanyName.focus();
		  document.form1.txtCompanyName.select();
		  return false ;
	}
    if(document.getElementById("txtCompanyName").value.trim()=="")
	{
		 alert("Enter Company Name!");
		 document.getElementById("txtCompanyName").focus();
		 return false ;
  	}
	//else if(containsdigit(document.getElementById("txtCompanyName").value.trim())==true)
	//{
	//	alert("Company Name contains numbers!");
	//	 document.getElementById("txtCompanyName").focus();
	//	return false ;
	//}

	if ((document.getElementById("txtCountry").value.trim() !="") && (containsdigit(document.getElementById("txtCountry").value.trim())==true))
	{
		alert("Country contains numbers");
		document.getElementById("txtCountry").focus();
		 return false ;
	}

	if ((document.getElementById("txtCity").value.trim() !="") && (containsdigit(document.getElementById("txtCity").value.trim())==true))
	{
		alert("City contains numbers");
		document.getElementById("txtCity").focus();
		 return false ;
	}

	if(document.getElementById("txtContactNo").value.trim()=="")
	{
		alert("Enter Contact No.!");
		document.getElementById("txtContactNo").focus();
		return false ;
	}
	
	
	
	if (document.getElementById("txtContactNo").value.trim() !="")
	{
		//alert("hi");
	    if (checknumber(document.getElementById("txtContactNo").value.trim()))
	    {
			   alert("Invalid Contact No.!")
			   document.getElementById("txtContactNo").focus();
				return false ;
	    }

		if (parseFloat(document.getElementById("txtContactNo").value.length)<10)
		{
				alert("Invalid Mobile No.!")
				document.getElementById("txtContactNo").focus();
				return false ;
		}

		if (document.getElementById("txtContactNo").value.search(remobile)==-1)
		{
				alert("Please Enter A Valid Mobile Number");
				document.getElementById("txtContactNo").focus();
				return false ;
		}

	}
	 if(document.getElementById("txtEmail").value.trim()=="")
	{
	    alert("Enter Email!");
		document.getElementById("txtEmail").focus();
		 return false ;
	}
	
	 if(document.getElementById("txtEmail").value.trim() !="")
	{
	    if(echeck(document.getElementById("txtEmail").value.trim()))
	    {
	    }
	    else
	    {
	        document.getElementById("txtEmail").focus();
	        return false ;
	    }
	}

	
	if(document.getElementById("txtReq").value.trim()=="")
	{
	    alert("Enter your query!");
		document.getElementById("txtReq").focus();
		 return false ;
	}
	//if (document.getElementById("ddlCity").options[document.getElementById("ddlCity").selectedIndex].value=="")
//	{
//		alert("Please select city");
//		document.getElementById("ddlCity").focus();
//		return;
//	}


	document.form1.method="post";
	//enter your url below here
	//document.form1.action="connectionfile/ins.asp";
	document.form1.action="ins.asp";

	document.form1.submit();
	return true;
}

function hidediv()
{
	document.getElementById("vcodediv").style.display = "none";
	document.getElementById("vcodediv").style.visibility = "hidden";
}

function showmydiv()
{
	document.getElementById("vcodediv").style.display = "block";
	document.getElementById("vcodediv").style.visibility = "visible";
}

function checknumber_Old(vSTR)
{
    var anum=/(^\d+$)|(^\d+\.\d+$)/
    if (anum.test(vSTR))
        testresult=false;
    else
    {
        testresult=true;
    }
        return testresult;
}


function checknumber(vSTR)
    {
        var stripped =vSTR.replace(/([0-9\-\+\.\(\)]+)/,'')
        stripped =stripped.replace(/([0-9\-\+\.\(\)]+)/,'')
        //alert(stripped)
        
        if (isNaN(parseInt(stripped)))
        {
            if(stripped=="")
            {
                testresult=false;
            }
            else
            {
                testresult=true;
            }
        }
        else
        {
            testresult=false;
        }
            return testresult;
    }

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 Email Id!");
		   return false;
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr)
		{
		   alert("Invalid Email Id!");
		   return false;
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr-1)
		{
		    alert("Invalid Email Id!");
		    return false;
		}
    	if (str.indexOf(at,(lat+1))!=-1)
		{
		   alert("Invalid Email Id!");
		   return false;
		}

		if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot)
		{
		   alert("Invalid Email Id!");
		   return false;
		}

		if (str.indexOf(dot,(lat+2))==-1)
		{
		   alert("Invalid Email Id!");
		   return false;
		}
		if (str.indexOf(" ")!=-1)
		{
		   alert("Invalid Email Id!");
		   return false;
		}
		return true;
}


