﻿function ValidatePinCodeLength(oSrc, args)
{
    var PCode = args.Value;
    PCode = PCode.trim();
    if(PCode.length < 5)
    {
        args.IsValid = false;
    }
    else
    {
        args.IsValid = true;
    }
   
}



 function ValidateCompPhone(oSrc, args)
{
    var CountryPhone = document.getElementById("detCompDet_txtCtryCompPhone").value;
    var StatePhone = document.getElementById("detCompDet_txtStatCompPhone").value;
    var CityPhone = document.getElementById("detCompDet_txtCityCompPhone").value;
    var CountryMobile = document.getElementById("detCompDet_txtCtryCompMobile").value;
    var CityMobile = document.getElementById("detCompDet_txtCityCompMobile").value;
    
    
    if(((CountryPhone != "") || (StatePhone != "") || (CityPhone != "")) && (!((CountryPhone != "") && (StatePhone != "") && (CityPhone != "")))  )    ////&&    (!((CountryMobile == "") && (CityMobile == "")))   )     //                                                                                                 &&     (((CountryMobile == "91") && (CityMobile == "")) ||   ((CountryMobile == "") && (CityMobile == "")) ||  (!((CityMobile.length >=10) &&  (CountryMobile.length >=1))) )       ) //  &&     (CityMobile.length < 10)    )
    {
        if(   !((CountryMobile == "") && (CityMobile == ""))  &&     ((CountryPhone == "") && (StatePhone == "") && (CityPhone == ""))  )
        {
            args.IsValid = true;
            return;
        }
        else
        {
            document.getElementById("detCompDet_cvCompPhone").innerHTML = "Phone number should be in Proper format";
            args.IsValid = false;
        }
    }
    else if((StatePhone.length < 3))         ////&&    (!((CountryMobile == "") && (CityMobile == "")))   )     //                                                                                                &&     (((CountryMobile == "91") && (CityMobile == "")) ||   ((CountryMobile == "") && (CityMobile == "")) ||  (!((CityMobile.length >=10) &&  (CountryMobile.length >=1))) )       )    //&&     (CityMobile.length < 10)    )
    {
        if(   !((CountryMobile == "") && (CityMobile == ""))  &&     ((CountryPhone == "") && (StatePhone == "") && (CityPhone == ""))  )
        {
            args.IsValid = true;
            return;
        }
        else
        {
            document.getElementById("detCompDet_cvCompPhone").innerHTML = "City Code should not be less than 3 digits";
            args.IsValid = false;
        }
    }
    else if((CityPhone.length < 5))           ////&&    (!((CountryMobile == "") && (CityMobile == "")))   )     //                                                                                                                     &&     (((CountryMobile == "91") && (CityMobile == "")) ||   ((CountryMobile == "") && (CityMobile == "")) ||  (!((CityMobile.length >=10) &&  (CountryMobile.length >=1))) )       )        //&&     (CityMobile.length < 10)    )
    {
        if(   !((CountryMobile == "") && (CityMobile == ""))  &&     ((CountryPhone == "") && (StatePhone == "") && (CityPhone == ""))  )
        {
            args.IsValid = true;
            return;
        }
        else
        {
            document.getElementById("detCompDet_cvCompPhone").innerHTML = "Phone number should not be less than 5 digits";
            args.IsValid = false;
        }
    }
    else if((CountryPhone != "") && (StatePhone != "") && (CityPhone != ""))
    {
        args.IsValid = true;
    }
    
    
}



function ValidateCompMobile(oSrc, args)
{
    var CountryPhone = document.getElementById("detCompDet_txtCtryCompPhone").value;
    var StatePhone = document.getElementById("detCompDet_txtStatCompPhone").value;
    var CityPhone = document.getElementById("detCompDet_txtCityCompPhone").value;
    var CountryMobile = document.getElementById("detCompDet_txtCtryCompMobile").value;
    var CityMobile = document.getElementById("detCompDet_txtCityCompMobile").value;
    

    if(((CountryMobile != "") || (CityMobile != "")) &&  (!((CountryMobile != "") && (CityMobile != "")))  )    ////&& (!((CountryPhone == "") && (StatePhone == "") && (CityPhone == "")))  )     //                                                           &&     (((CountryPhone == "91") && (StatePhone == "") && (CityPhone == "")) ||   ((CountryPhone == "") && (StatePhone == "") && (CityPhone == "")) ||  (!((StatePhone.length >=5) && (CityPhone.length >=5) && (CountryPhone.length >=1)))   )           )              //  &&   ((StatePhone.length < 5)  && (CityPhone.length < 5))   )   
    {
        if((!((CountryPhone == "") && (StatePhone == "") && (CityPhone == ""))) && ((CountryMobile == "") && (CityMobile == "")))
        {
            args.IsValid = true;
            return;
        }
        else
        {
            document.getElementById("detCompDet_cvCompMobile").innerHTML = "Mobile Number should be in Proper format";
            args.IsValid = false;
        }
    }
    else if((CityMobile.length < 10))         ////&& (!((CountryPhone == "") && (StatePhone == "") && (CityPhone == "")))  )      //                                                                                     &&     (((CountryPhone == "91") && (StatePhone == "") && (CityPhone == "")) ||   ((CountryPhone == "") && (StatePhone == "") && (CityPhone == "")) ||  (!((StatePhone.length >=5) && (CityPhone.length >=5) && (CountryPhone.length >=1)))   )           )      //&&   ((StatePhone.length < 5)  && (CityPhone.length < 5))   )
    {
        if((!((CountryPhone == "") && (StatePhone == "") && (CityPhone == ""))) && ((CountryMobile == "") && (CityMobile == "")))
        {
            args.IsValid = true;
            return;
        }
        else
        {
            document.getElementById("detCompDet_cvCompMobile").innerHTML = "Mobile Number should be atleast 10 digits";
            args.IsValid = false;
        }
    }
    else if((CountryMobile != "") && (CityMobile != ""))
    {
        args.IsValid = true;
    }
    
}   


function ValidateCompPhMob(oSrc, args)
{
 
   var CountryPhone = document.getElementById("detCompDet_txtCtryCompPhone").value;
    var StatePhone = document.getElementById("detCompDet_txtStatCompPhone").value;
    var CityPhone = document.getElementById("detCompDet_txtCityCompPhone").value;
    var CountryMobile = document.getElementById("detCompDet_txtCtryCompMobile").value;
    var CityMobile = document.getElementById("detCompDet_txtCityCompMobile").value;   
      
    
   
    
    if((CountryPhone == "91") && (StatePhone == "") && (CityPhone == "") && (CountryMobile == "91") && (CityMobile == ""))
    {
        args.IsValid = false;
    }
    else if((CountryPhone == "") && (StatePhone == "") && (CityPhone == "") && (CountryMobile == "") && (CityMobile == ""))
    {
        args.IsValid = false;
    }
    else
    {
        args.IsValid = true;
    }
 }
 
 
 
 
 
 function ValidatePhone(oSrc, args)
{
    
    var CountryPhone = document.getElementById("dvAdminInfo_txtCtryPhone").value;
    var StatePhone = document.getElementById("dvAdminInfo_txtStatPhone").value;
    var CityPhone = document.getElementById("dvAdminInfo_txtCityPhone").value;  
    var CountryMobile = document.getElementById("dvAdminInfo_txtCtryMobile").value;
    var CityMobile = document.getElementById("dvAdminInfo_txtCityMobile").value;
    
    if(((CountryPhone != "") || (StatePhone != "") || (CityPhone != "")) && (!((CountryPhone != "") && (StatePhone != "") && (CityPhone != "")))  )    ////&&    (!((CountryMobile == "") && (CityMobile == "")))   )     //                                                                                                 &&     (((CountryMobile == "91") && (CityMobile == "")) ||   ((CountryMobile == "") && (CityMobile == "")) ||  (!((CityMobile.length >=10) &&  (CountryMobile.length >=1))) )       ) //  &&     (CityMobile.length < 10)    )
    {
        if(   !((CountryMobile == "") && (CityMobile == ""))  &&     ((CountryPhone == "") && (StatePhone == "") && (CityPhone == ""))  )
        {
            args.IsValid = true;
            return;
        }
        else
        {
            document.getElementById("dvAdminInfo_cvPhone").innerHTML = "Phone number should be in Proper format";
            args.IsValid = false;
        }
    }
    else if((StatePhone.length < 3))         ////&&    (!((CountryMobile == "") && (CityMobile == "")))   )     //                                                                                                &&     (((CountryMobile == "91") && (CityMobile == "")) ||   ((CountryMobile == "") && (CityMobile == "")) ||  (!((CityMobile.length >=10) &&  (CountryMobile.length >=1))) )       )    //&&     (CityMobile.length < 10)    )
    {
        if(   !((CountryMobile == "") && (CityMobile == ""))  &&     ((CountryPhone == "") && (StatePhone == "") && (CityPhone == ""))  )
        {
            args.IsValid = true;
            return;
        }
        else
        {
            document.getElementById("dvAdminInfo_cvPhone").innerHTML = "City Code should not be less than 3 digits";
            args.IsValid = false;
        }
    }
    else if((CityPhone.length < 5))           ////&&    (!((CountryMobile == "") && (CityMobile == "")))   )     //                                                                                                                     &&     (((CountryMobile == "91") && (CityMobile == "")) ||   ((CountryMobile == "") && (CityMobile == "")) ||  (!((CityMobile.length >=10) &&  (CountryMobile.length >=1))) )       )        //&&     (CityMobile.length < 10)    )
    {
        if(   !((CountryMobile == "") && (CityMobile == ""))  &&     ((CountryPhone == "") && (StatePhone == "") && (CityPhone == ""))  )
        {
            args.IsValid = true;
            return;
        }
        else
        {
            document.getElementById("dvAdminInfo_cvPhone").innerHTML = "Phone number should not be less than 5 digits";
            args.IsValid = false;
        }
    }
    else if((CountryPhone != "") && (StatePhone != "") && (CityPhone != ""))
    {
        args.IsValid = true;
    }
    
    
}


function ValidateMobile(oSrc, args)
{
 
    var CountryPhone = document.getElementById("dvAdminInfo_txtCtryPhone").value;
    var StatePhone = document.getElementById("dvAdminInfo_txtStatPhone").value;
    var CityPhone = document.getElementById("dvAdminInfo_txtCityPhone").value;
    var CountryMobile = document.getElementById("dvAdminInfo_txtCtryMobile").value;
    var CityMobile = document.getElementById("dvAdminInfo_txtCityMobile").value;
    

    if(((CountryMobile != "") || (CityMobile != "")) &&  (!((CountryMobile != "") && (CityMobile != "")))  )    ////&& (!((CountryPhone == "") && (StatePhone == "") && (CityPhone == "")))  )     //                                                           &&     (((CountryPhone == "91") && (StatePhone == "") && (CityPhone == "")) ||   ((CountryPhone == "") && (StatePhone == "") && (CityPhone == "")) ||  (!((StatePhone.length >=5) && (CityPhone.length >=5) && (CountryPhone.length >=1)))   )           )              //  &&   ((StatePhone.length < 5)  && (CityPhone.length < 5))   )   
    {
        if((!((CountryPhone == "") && (StatePhone == "") && (CityPhone == ""))) && ((CountryMobile == "") && (CityMobile == "")))
        {
            args.IsValid = true;
            return;
        }
        else
        {
            document.getElementById("dvAdminInfo_cvMobile").innerHTML = "Mobile Number should be in Proper format";
            args.IsValid = false;
        }
    }
    else if((CityMobile.length < 10))         ////&& (!((CountryPhone == "") && (StatePhone == "") && (CityPhone == "")))  )      //                                                                                     &&     (((CountryPhone == "91") && (StatePhone == "") && (CityPhone == "")) ||   ((CountryPhone == "") && (StatePhone == "") && (CityPhone == "")) ||  (!((StatePhone.length >=5) && (CityPhone.length >=5) && (CountryPhone.length >=1)))   )           )      //&&   ((StatePhone.length < 5)  && (CityPhone.length < 5))   )
    {
        if((!((CountryPhone == "") && (StatePhone == "") && (CityPhone == ""))) && ((CountryMobile == "") && (CityMobile == "")))
        {
            args.IsValid = true;
            return;
        }
        else
        {
            document.getElementById("dvAdminInfo_cvMobile").innerHTML = "Mobile Number should be atleast 10 digits";
            args.IsValid = false;
        }
    }
    else if((CountryMobile != "") && (CityMobile != ""))
    {
        args.IsValid = true;
    }
    
}   
    
    
    
    
function ValidatePhMob(oSrc, args)
{

    var CountryPhone = document.getElementById("dvAdminInfo_txtCtryPhone").value;
    var StatePhone = document.getElementById("dvAdminInfo_txtStatPhone").value;
    var CityPhone = document.getElementById("dvAdminInfo_txtCityPhone").value;  
    var CountryMobile = document.getElementById("dvAdminInfo_txtCtryMobile").value;
    var CityMobile = document.getElementById("dvAdminInfo_txtCityMobile").value;
    
    if((CountryPhone == "91") && (StatePhone == "") && (CityPhone == "") && (CountryMobile == "91") && (CityMobile == ""))
    {
        args.IsValid = false;
    }
    else if((CountryPhone == "") && (StatePhone == "") && (CityPhone == "") && (CountryMobile == "") && (CityMobile == ""))
    {
        args.IsValid = false;
    }
    else
    {
        args.IsValid = true;
    }
 }
 
 