﻿
function ResetDefault()
{
    document.getElementById("txtname").value = '';
    document.getElementById("txtphone").value = '';
    document.getElementById("txtemail").value = '';
    document.getElementById("txtcomment").value = '';
}

function ValidateDefault()
{
    var StrMsg = "Please Provide...\n";
    var Str = "";
    var emailExp = /^[\w\-\.\+]+\@[a-zA-Z0-9\-\.]+\.[a-zA-z0-9]{2,4}$/;
    if(document.getElementById("txtname").value == "")
    {
        Str = Str + "* Name.\n"; 
    }   
    if(document.getElementById("txtphone").value == "")
    {
        Str = Str + "* Phone.\n"; 
    }
    if(document.getElementById("txtemail").value == "")
    {
        Str = Str + "* Email.\n"; 
    }
    if(document.getElementById("txtcomment").value == "")
    {
        Str = Str + "* Comment.\n"; 
    }
    if(Str.length > 0)
    {
        alert(StrMsg + Str);
        return false;
    }
    if(!illegalChars(document.getElementById("txtname").value))
    {
        Str += "* The Name contains illegal characters.\n";
    }
    if(!document.getElementById("txtemail").value.match(emailExp))
    {
        Str +="* Please Enter A Valid Email Address.\n";
    }
    if(Str.length > 0)
    {
        alert(Str);
        return false;
    } 
}


function illegalChars(data)
{
    var illegalChars = /^[a-zA-Z'. ]+$/;
    data=data.replace(" ","");
    if (illegalChars.test(data))
    {
        return true;
    } 
    else
    {
        return false;
    }
}

function ResetContactUs()
{
    document.getElementById("txtname").value = '';
    document.getElementById("txtaddress").value = '';
    document.getElementById("txtcity").value = '';
    document.getElementById("ddlstate").value = '';
    document.getElementById("txtzip").value = '';
    document.getElementById("ddlcountry").value = '';    
    document.getElementById("txtphone").value = '';
    document.getElementById("txtfax").value = '';
    document.getElementById("txtemail").value = '';
    document.getElementById("txtsuggestion").value = '';
}

function ValidateContactus()
{
    var StrMsg = "Please Provide...\n";
    var Str = "";
    var emailExp = /^[\w\-\.\+]+\@[a-zA-Z0-9\-\.]+\.[a-zA-z0-9]{2,4}$/;
    if(document.getElementById("txtname").value == "")
    {
        Str = Str + "* Name.\n"; 
    }
    if(document.getElementById("txtaddress").value == "")
    {
        Str = Str + "* Address.\n"; 
    } 
    if(document.getElementById("txtcity").value == "")
    {
        Str = Str + "* City.\n"; 
    }
    if(document.getElementById("ddlstate").value == "")
    {
        Str = Str + "* State.\n"; 
    } 
    if(document.getElementById("txtzip").value == "")
    {
        Str = Str + "* Zip Code.\n"; 
    } 
    if(document.getElementById("ddlcountry").value == "")
    {
        Str = Str + "* Country.\n"; 
    }    
    if(document.getElementById("txtphone").value == "")
    {
        Str = Str + "* Phone.\n"; 
    }
    if(document.getElementById("txtemail").value == "")
    {
        Str = Str + "* Email.\n"; 
    }
    if(document.getElementById("txtsuggestion").value == "")
    {
        Str = Str + "* Suggestion/Inquiry.\n"; 
    }
    if(Str.length > 0)
    {
        alert(StrMsg + Str);
        return false;
    }
    if(!illegalChars(document.getElementById("txtname").value))
    {
        Str += "* The Name contains illegal characters.\n";
    }
    if(!document.getElementById("txtemail").value.match(emailExp))
    {
        Str +="* Please Enter A Valid Email Address.\n";
    }
    if(Str.length > 0)
    {
        alert(Str);
        return false;
    }
}


function taLimittextarea(strtextname,strlength)
{
    
    var taObj= document.getElementById(strtextname).value;
    if (taObj.length == strlength ) return false;
}