function check()
{   

if(document.getElementById("sname").value=="")
    {
        alert('Please enter Your Name');
        document.getElementById("sname").focus();
        return false;    
    }
	
	if(document.getElementById("txtph").value=="")
    {
        alert('Please enter Phone no');
        document.getElementById("txtph").focus();
        return false;    
    }
	  
	
    var email=document.getElementById("txtemail").value;
    len=email.length;
    var no=0;
    for(var i=0;i<len;i++)
    {
        if(email.charAt(i)=="@" || email.charAt(i)==",")
        {
            //alert(i);
            no=no+1;
            //alert(no);
        }
    }
    var dat=Date();
    //alert(dat);
    document.getElementById("txtstran").value=dat;
    if (email == 0 || email=="" )
    {
        alert("Please enter your email address!");
        document.getElementById("txtemail").focus();
        return false;
    }
    else if (email.indexOf("@") < 0)
    {
        alert("Please enter valid Email address!");
        document.getElementById("txtemail").focus();
        return false;
    }
    // Email Checker
    else if (email.indexOf(".") < 0)
    {
        alert("Incorrect email address. Please re-enter!");
        document.getElementById("txtemail").focus();
        return false;
    }
    // Email Checker
    else if (email.indexOf(" ") >= 0)
    {
        alert("Incorrect email address. Please re-enter!");
        document.getElementById("txtemail").focus();
        return false;
    }
    else if (len > 50)
    {
        //length1=email.length;
        //alert(length1);
        alert("Email should not exceed more than 50 characters!");
        document.getElementById("txtEmail").focus();
        return false;
    }
    else if (no >= 2)
    {
        //length1=email.length;
        //alert(length1);
        alert("Please do not enter more than one email address!");
        document.getElementById("txtEmail").focus();
        return false;
    }
   if(document.getElementById("txtcountry").value=="")
    {
        alert('Please enter Your City');
        document.getElementById("txtcountry").focus();
        return false;    
    }   
   if(document.getElementById("txtaddress").value=="")
    {
        alert('Please enter Your message/ Comments');
        document.getElementById("txtaddress").focus();
        return false;    
    }
    document.getElementById("CMS_form").action="act_contactus.php";
    document.getElementById("CMS_form").submit();
    return true;
}
function formatPhone(AddingText,objTxtBox)
{
    y=objTxtBox.value;
    abc=/-/gi;
    rep=y.replace(abc,0)
    if (isNaN(rep))
    {
        ab=/(a*)(b*)(c*)(d*)(e*)(f*)(g*)(h*)(i*)(j*)(k*)(l*)(m*)(n*)(o*)(p*)(q*)(r*)(s*)(t*)(u*)(v*)(w*)(x*)(y*)(z*)/gi;
        re=y.replace(ab,"")
        objTxtBox.value="";
        strMsg=AddingText+" Should be numeric";
        intCheckError=1;
        alert(strMsg);
        objTxtBox.focus();
    }
}

function clearr()
{
document.getElementById("txtstran").value="";
}


