function validate()
{
    var fromZip = document.getElementById('ctl00_CP_txtZip');
    var srvType=document.getElementById('ctl00_CP_ddlSrvType');
    var movingTo = document.getElementById('ctl00_CP_txtToZip');
    var intlMovingTo =document.getElementById('ctl00_CP_ddlCountry');
    var ddlStorage = document.getElementById('ctl00_CP_ddlStorage');

    if(srvType.value == "Local Moves" || srvType.value == "Long Distance Moves" || srvType.value == "Auto Transport" || srvType.value == "Office Relocation")
    {
        if(!zipcheck(fromZip))
        {
            alert('Valid 5 Digits From Zip is Required');
            return false;
        }
        else if(!zipcheck(movingTo))
        {
            alert('Valid 5 Digits To Zip is Required');
            return false;
        }
        else
            return true;
    }
    else if(srvType.value == "International Moves")
    {
        if(!zipcheck(fromZip))
        {
            alert('Valid 5 Digits From Zip is Required');
            return false;
        }
        else if(intlMovingTo.value == "")
        {
            alert('Moving To Country is required');
            return false;
        }
        else
            return true;
    }
    else if(srvType.value == "Storage")
    {
        if(!zipcheck(fromZip))
        {
            alert('Valid 5 Digits Zip Code is Required');
            return false;
        }
        else if(ddlStorage.value == "")
        {
            alert('Storage Radius is Required');
            return false;
        }
        else
            return true;
    }
}

function zipcheck(cntrl)
{
    if(cntrl.value == "" || cntrl.value.length != 5)
        return false;
    else if(isNaN(cntrl.value))
        return false;
    else
        return true;
}

function serviceType()
{    
    loadSrvControls('ctl00_CP_ddlSrvType');
}

function loadSrvControls(srvType)
{
    var srvType=document.getElementById(srvType); 
    var divIntl=document.getElementById('divIntl'); 
    var divAllMovingTo=document.getElementById('divAllMovingTo'); 
    var divStorage=document.getElementById('divStorage'); 
    var zipcode=document.getElementById('zipcode');
    var intlMovingTo =document.getElementById('ctl00_CP_ddlCountry'); 
   
    zipcode.innerHTML = "Moving From";  

    document.getElementById('ctl00_CP_txtZip').value = 'Zip Code';

    if(srvType.value == "International Moves")
    {
        divIntl.style.display = "";  
        divAllMovingTo.style.display = "none";  
        divStorage.style.display = "none";  
        loadCountries(intlMovingTo);
    }
    else if(srvType.value == "Long Distance Moves" || srvType.value == "Local Moves" || srvType.value == "Auto Transport" || srvType.value == "Office Relocation")
    {
        divAllMovingTo.style.display = "";  
        divIntl.style.display = "none";  
        divStorage.style.display = "none";  
	document.getElementById('ctl00_CP_txtToZip').value = 'Zip Code';
    }
    else if(srvType.value == "Storage")
    {
        divStorage.style.display = "";  
        divAllMovingTo.style.display = "none";  
        divIntl.style.display = "none"; 
        zipcode.innerHTML = "Storage At";
    }
}
var isIE = document.all?true:false;
var isNS = document.layers?true:false;
if (isNS) document.captureEvents(Event.KEYPRESS);
document.onkeypress=Digits;    
function Digits(et)
{
    var rturn = true;
    if (isIE)
    {
        if (window.event.keyCode < 48 || window.event.keyCode > 57)
        {
            window.event.keyCode = 0;
            rturn = false;
        }
    }
    if (isNS)
    {
        if (et.which < 48 || et.which > 57)
        {
            et.which = 0;
            rturn = false;
        }
    }
    
    return (rturn); 
}

function setCountry()
{
    var country = document.getElementById('ctl00_CP_hfCountry'); 
    var intlMovingTo = document.getElementById('ctl00_CP_ddlCountry'); 
    country.value = intlMovingTo.value;
}
function ClearField(cntrl)
{
    if(cntrl.value == 'Zip Code')
        cntrl.value = '';
}

function FillField(cntrl)
{
    if(cntrl.value == '')
        cntrl.value = 'Zip Code';
}