function verify()
{
if ((document.frm.zcode.value == '') || !isNumeric(document.frm.zcode.value) || (document.frm.zcode.value.length != 5))
{
alert("Please enter the Zip Code of the property to be insured.");
document.frm.zcode.focus();
return false;
}
if (!document.frm.hasins[0].checked && !document.frm.hasins[1].checked )
{
alert('Please indicate rather you are curently insured or have been insured in the last 30 days.');
document.frm.hasins.focus();
return false;
}
if (document.frm.hasins[0].checked && document.frm.insco.value =="n/a")
{
alert('Please indicate your current company. If you are currently uninsured, please indicate as such. We want to make sure we do not send you quotes from your current company.');
document.frm.insco.focus();
return false;
}
return true;
}

function validate_hq(frm){
        //
        var reg_zip = /\d{5}/;
        var bool_valid = true;

        //
        if(!reg_zip.test(frm.zcode.value)){
                alert("Please enter the Zip Code of the property to be insured.");
                frm.zcode.focus();
                bool_valid = false;
        }

        //
        else if (('hasins' in frm ) && (!frm.hasins[0].checked && !frm.hasins[1].checked )){
                alert('Please indicate whether you are curently insured or have been insured in the last 30 days.');
                frm.hasins.focus();
                bool_valid = false;
        }

        //
        else if (('hasins' in frm ) && (frm.hasins[0].checked && frm.insco.value =="n/a")){
                alert('Please indicate your current company. If you are currently uninsured, please indicate as such. We want to make sure we do not send you quotes from your current company.');
                frm.insco.focus();
                bool_valid = false;
        }

        return bool_valid;
}

//
function process_hq(frm){
        if(validate_hq(frm)){
                var zcode = ('zcode' in frm)?frm.zcode.value:'';
                var insco = ('insco' in frm)?frm.insco.value:'';
                var hasins = '';
                if('hasins' in frm){
                        hasins = frm.hasins[0].checked?frm.hasins[0].value:frm.hasins[1].value;
                }
                window.open('http://www.renters-insurance-quotes.com/process_hq.php?zcode='+zcode+'&insco='+insco+'&hasins='+hasins);
                window.location = 'http://www.renters-insurance-quotes.com/Thankyou.php?zip='+zcode;
                return false;
        }
        return false;
}
