// JavaScript Document

function validate1()
{
	var txt="";

    if (document.getElementById("<%=CType(freequote1.FindControl("ddMoveType"), DropDownList).ClientID%>").selectedIndex == 0 )
    {
         alert("Errors have been found. Please correct:\r\nMove Type is required");
         document.getElementById("<%=CType(freequote1.FindControl("ddMoveType"), DropDownList).ClientID%>").focus();
         return false; 
    }
    else
    {
        if ((document.getElementById("<%=CType(freequote1.FindControl("ddMoveType"), DropDownList).ClientID%>").selectedIndex == 1 ) ||

	    (document.getElementById("<%=CType(freequote1.FindControl("ddMoveType"), DropDownList).ClientID%>").selectedIndex == 2 ) ||

	    (document.getElementById("<%=CType(freequote1.FindControl("ddMoveType"), DropDownList).ClientID%>").selectedIndex == 3 ) ||

	    (document.getElementById("<%=CType(freequote1.FindControl("ddMoveType"), DropDownList).ClientID%>").selectedIndex == 4 ) ||

	    (document.getElementById("<%=CType(freequote1.FindControl("ddMoveType"), DropDownList).ClientID%>").selectedIndex == 5 ) ||

	    (document.getElementById("<%=CType(freequote1.FindControl("ddMoveType"), DropDownList).ClientID%>").selectedIndex == 6 ) ||

	    (document.getElementById("<%=CType(freequote1.FindControl("ddMoveType"), DropDownList).ClientID%>").selectedIndex == 7 ) )

	    {
	        if (document.getElementById("<%=CType(freequote1.FindControl("txtMoveFrom"), TextBox).ClientID%>").value == "") 
		    {
			    txt = txt + "Move From is Required\r\n"
			    document.getElementById("<%=CType(freequote1.FindControl("txtMoveFrom"), TextBox).ClientID%>").focus();
         	}
            if (document.getElementById("<%=CType(freequote1.FindControl("txtMoveTo"), TextBox).ClientID%>").value == "") 
		    {
			    txt = txt + "Move To is Required\r\n"
			    document.getElementById("<%=CType(freequote1.FindControl("txtMoveTo"), TextBox).ClientID%>").focus();
		    }

		    if (txt != "") 
		    {
		        txt = "Errors have been found. Please correct:\r\n" + txt
		        alert(txt)
			    return false; 
		    }	
		
	    }
	    else
	    {
		    return true;
        }
	}
    
    
}

function validate2()
{
	var txt="";

    
        if (document.getElementById("<%=CType(freequote1.FindControl("txtName"), TextBox).ClientID%>").value == "") 
	    {
		    txt = txt + "Name is Required\r\n"
		    document.getElementById("<%=CType(freequote1.FindControl("txtName"), TextBox).ClientID%>").focus();
     	}
        if (document.getElementById("<%=CType(freequote1.FindControl("txtPhone"), TextBox).ClientID%>").value == "") 
	    {
		    txt = txt + "Phone To is Required\r\n"
		    document.getElementById("<%=CType(freequote1.FindControl("txtPhone"), TextBox).ClientID%>").focus();
	    }
	    else
	    {
	        var phonePat = /^[01]?[- .]?(\([2-9]\d{2}\)|[2-9]\d{2})[- .]?\d{3}[- .]?\d{4}$/;
            var phoneid=document.getElementById("<%=CType(freequote1.FindControl("txtPhone"), TextBox).ClientID %>").value;
            var matchPhoneArray = phoneid.match(phonePat);
	        if (matchPhoneArray == null)
            {
                txt = txt + "Phone is incorrect\r\n"  
                document.getElementById("<%=CType(freequote1.FindControl("txtPhone"), TextBox).ClientID %>").focus();
                
            }
	    }
	    
	    if (document.getElementById("<%=CType(freequote1.FindControl("txtemail"), TextBox).ClientID%>").value == "") 
	    {
		    txt = txt + "Email is Required\r\n"
		    document.getElementById("<%=CType(freequote1.FindControl("txtemail"), TextBox).ClientID%>").focus();
	    }
	    else
	    {
	        var emailPat = /^([a-zA-Z0-9_\-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-zA-Z0-9\-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$/;
            var emailid=document.getElementById("<%=CType(freequote1.FindControl("txtemail"), TextBox).ClientID %>").value;
            var matchEmailArray = emailid.match(emailPat);
	        if (matchEmailArray == null)
            {
                txt = txt + "Email is incorrect\r\n"  
                document.getElementById("<%=CType(freequote1.FindControl("txtemail"), TextBox).ClientID %>").focus();
                
            }
	    }

	    if (txt != "") 
	    {
	        txt = "Errors have been found. Please correct:\r\n" + txt
	        alert(txt)
		    return false; 
	    }	
		else
	    {
		    return true;
        }
	
    
    
}