function setValues_Date(objMonth, objDay, objYear, objHiddenDay)
{
  
    var isLeapYear = false;
    var mm = objMonth.value; 
    var dd = objDay.value; 
    var yy = parseFloat(objYear.value);

    var cnt = 0;
    var selectedDay = objHiddenDay.value; 
                    
    
    objDay.selectedIndex= -1;
    objDay.options.length= 1;
    
    if (mm==1 || mm==3 || mm==5 || mm==7 || mm==8 || mm==10 || mm==12)
    {
        cnt=31;
    }
    
    if (mm==4 || mm==6 || mm==9 || mm==11)
    {
        cnt=30;
    }
    
    if (mm==2)
    {
      if(yy!=0 && yy % 4==0)
        cnt=29;
      else
        cnt=28;
    }
    
    var currDay = 1;
    for (var i=1; i<=cnt; i++)
    {
        objDay.options.length= objDay.options.length+1;
        objDay.options[i].text=i;
        objDay.options[i].value = i;

        if(selectedDay==0)
        {
          if(currDay==i)
          {
            objDay.options[i].selected=true;
            selectedDay=i;
          }
        }
    }
    if (selectedDay > 0 && selectedDay < objDay.options.length) 
        objDay.options[selectedDay].selected = true;      
    else
        objDay.options[objDay.options.length-1].selected = true;          

}

function dateValidationForGTCurrDate(objMonth, objDay, objYear)
{
    var flag = false;
    var errorText = "";
    
    // Getting all the current date values
    var curDay = document.getElementById('currDay').value;
    var curMonth = document.getElementById('currMonth').value;
    var curYear = document.getElementById('currYear').value;
    
    // Getting the selected values
    var selMon = objMonth 
    var selDay = objDay 
    var selYear = objYear 

    if(selMon*selDay*selYear !=0)
    {
        // if year are not same then no need to check
        if (parseFloat(selYear) > parseFloat(curYear))
        {
            flag = false;
        }
        else if (parseFloat(curYear) == parseFloat(selYear))
        {
            if ((parseFloat(curMonth) == parseFloat(selMon)) && (parseFloat(curDay) > parseFloat(selDay)))
                flag = true;
    
            if (parseFloat(curMonth) > parseFloat(selMon))
                flag = true;
        }
    
        if (flag == true)
        {
            errorText = " Date cannot be less than Current Date.\n";
        }
    }
    else
    {
        errorText = "";//"Proposed Effective "; 
        flag  = true;                    
        var error = "";
        
        if (parseFloat(selMon) == 0)
        {
            error = error + " Month";
        }
    
        if (parseFloat(selDay) == 0)
        {
            if(error.length == 0)
            {
                error = error + " Day";
            }
            else
            {
                error = error + ", Day";    
            }
        }
    
        if (selYear == 0)
        {
            if(error.length == 0)
            {
                error = error + " Year";
            }
            else
            {
                error =error +  ", Year";    
            }
        }
        errorText = errorText +  error + " value should be selected.\n";
    }
    return errorText;//return flag;
}


function dateValidationForLTCurrDate(objMonth, objDay, objYear)
{
    // Date is manadatory and equal or less than current date
    var flag = false;
    var errorText = "";
    
    // Getting all the current date values
    var curDay = document.getElementById('currDay').value;
    var curMonth = document.getElementById('currMonth').value;
    var curYear = document.getElementById('currYear').value;
    
    // Getting the selected values
    var selMon = objMonth.value;
    var selDay = objDay.value;
    var selYear = objYear.value;

    if(selMon*selDay*selYear !=0)
    {
        // if year are not same then no need to check
        if (parseFloat(curYear) > parseFloat(selYear))
        {
            flag = false;
        }
        else if (parseFloat(selYear) == parseFloat(curYear))
        {
            if ((parseFloat(selMon) == parseFloat(curMonth)) && (parseFloat(selDay) > parseFloat(curDay)))
                flag = true;
    
            if (parseFloat(selMon) > parseFloat(curMonth))
                flag = true;
        }
    
        if (flag == true)
        {
            errorText = " Date cannot be greater than Current Date.\n";
        }
    }
    else
    {
        errorText = "";
        flag  = true;                    
        var error = "";
        
        if (parseFloat(selMon) == 0)
        {
            error = error + " Month";
        }
    
        if (parseFloat(selDay) == 0)
        {
            if(error.length == 0)
            {
                error = error + " Day";
            }
            else
            {
                error = error + ", Day";    
            }
        }
    
        if (selYear == 0)
        {
            if(error.length == 0)
            {
                error = error + " Year";
            }
            else
            {
                error =error +  ", Year";    
            }
        }
        errorText = errorText +  error + " value should be selected.\n";
    }
    return errorText;//return flag;
}

//for blokno other then "numbers"
function blockNonNumbers(obj, e, allowDecimal, allowNegative, allowDollar)
{
    var key;
    var isCtrl = false;
    var keychar;
    var reg;
    var allowCommas = false;
    
    if(allowDollar)
        allowCommas = true;
    
    if(window.event) 
    {
        key = e.keyCode;
        isCtrl = window.event.ctrlKey
    }
    else if(e.which) 
    {
        key = e.which;
        isCtrl = e.ctrlKey;
    }
	
    if (key != '$' && key != ',' && isNaN(key)) 
        return true;
    
    keychar = String.fromCharCode(key);
    
    // check for backspace or delete, or if Ctrl was pressed
    //alert(key + ', isCtrl = ' + isCtrl + ',key = ' + key)
    if (key == 8 || isCtrl)
    {
        return true;
    }
    
    reg = /\d/;
    
    var isFirstN = allowNegative ? keychar == '-' && obj.value.indexOf('-') == -1 : false;
    var isFirstD = allowDecimal ? keychar == '.' && obj.value.indexOf('.') == -1 : false;
    var isFirst$ = allowDollar ? keychar == '$' && obj.value.indexOf('$') == -1 : false;
    var isCommas = allowCommas ? keychar == ',' : false;
    
    //var isFirst$ = allowDollar ? keychar == ',' : false;
    
    return isFirstN || isFirstD || isFirst$ || isCommas || reg.test(keychar);
}

function ChkPercantageValue(obj)
{
    if(parseFloat(obj.value) > 100)
    {
        alert("Percantage value should be in between 0 to 100")
        obj.value="";
        obj.focus();
        return false;
    }
    else
    {
        return true;
    }
}

function checkPhoneInNumberFormat(phoneNo)
{
    var flag = false;
    var sign1 = phoneNo.substring(0,1);
    var phone1 = trimString(phoneNo.substring(1,4));
    var sign2 = trimString(phoneNo.substring(4,5));
    var phone2 = trimString(phoneNo.substring(5,8));
    var sign3 = trimString(phoneNo.substring(8,9));
    var phone3 = trimString(phoneNo.substring(9,13));

    if(phoneNo.length < 13)
        flag = true;
    if(phone1.length == 0 || phone2.length == 0 || phone3.length == 0)
      flag = true;

    if(sign1 != '(')
      flag = true;
      
    if(sign2 != ')')
      flag = true;
    
    if(sign3 != '-')
      flag = true;
    
    if(isNaN(phone1) || phone1.indexOf(".") != -1)
      flag = true;
    if(isNaN(phone2) || phone2.indexOf(".") != -1)
      flag = true;
    if(isNaN(phone3) || phone3.indexOf(".") != -1)
      flag = true;
    return flag;
}
    

function funValidEmail(email,obj)
{
    var inputStr = email; 
    if(inputStr == "") 
        return true; 
        
    var filter=/^[a-zA-Z]+[0-9]*([-\._]{0,1}[a-zA-Z0-9]+)*@[a-zA-Z0-9]+([-]{0,1}[a-zA-Z0-9]+)*([.][a-zA-Z]{2,4})+$/i; 
    
    if (filter.test(inputStr))
    { 
        return true; 
    } 
    else 
    { 
        alert("Please provide a Valid Email Address");
        obj.value = "";
        obj.focus();
        return false; 
    } 
}


function ValidatePhone()
	{
      p=p1.value
      if(p.length==3)
      {
          pp=p;
          d4=p.indexOf('(')
          d5=p.indexOf(')')
          if(d4==-1)
          {
            pp="("+pp;
            if(d5==-1)
            {
              pp=pp+")";
            }
          }
          document.getElementById(id).value="";
          document.getElementById(id).value=pp;
      }
      
      if(p.length>3)
      {
          d1=p.indexOf('(')
          d2=p.indexOf(')')
          if (d2==-1)
          {
              l30=p.length;
              p30=p.substring(0,4)
              strCloseBrace = p.substring(4,5)
              if(p.substring(4,5) == ')')
              {
                p30=p30
              }
              else
              {
                p30=p30+")"
              }
        
            //		p31=p.substring(4,l30);
              p31=p.substring(4,l30);
              pp=p30+p31;
              //alert(p31);
              //alert('phone ' + p)
              document.getElementById(id).value="";
              document.getElementById(id).value=pp;
          }
      }
  
      if(p.length>5)
      {
          p11=p.substring(d1+1,d2);
          if(p11.length>3)
          {
            p12=p11;
            l12=p12.length;
            l15=p.length
            //l12=l12-3
            p13=p11.substring(0,3);
            p14=p11.substring(3,l12);
            p15=p.substring(d2+1,l15);
            document.getElementById(id).value="";
            pp="("+p13+")"+p14+p15;
            document.getElementById(id).value=pp;
            //obj1.value="";
            //obj1.value=pp;
          }
      
          l16=p.length;
          p16=p.substring(d2+1,l16)
          l17=p16.length;
          if(l17>3&&p16.indexOf('-')==-1)
          {
              p17=p.substring(d2+1,d2+4);
              p18=p.substring(d2+4,l16);
              p19=p.substring(0,d2+1);
              //alert(p19);
              pp=p19+p17+"-"+p18;
              document.getElementById(id).value="";
              document.getElementById(id).value=pp;
              //obj1.value="";
              //obj1.value=pp;
          }
          else
          {
              var temp = p.substring(4,6)
              if(temp == '))')
              {
                pp=p.substring(0,d2+1) + p.substring(d2+2,p.length)
                document.getElementById(id).value="";
                document.getElementById(id).value=pp;
              }
          }
      }
      //}
      //setTimeout(ValidatePhone,100)
    }
    

function PhoneNumberFormat(objName)
{
    p1=document.getElementById(objName);
    id = objName
    ValidatePhone()
}

function ValidateTextAreaLength(field,maxlimit) 
{ 
	if (field.value.length > maxlimit) // if too long...trim it! 
	{
            //alert("max limit")
            field.value = field.value.substring(0, maxlimit); 
        }
}

// This function will enable or disable element as per value of SelObj.
function funEnaDisElementsFromSelValue(SelObj,TBObjList,CBObjList,Selvalue)
{
    var CBObjArray = new Array();
    var TBObjArray = new Array();
    
    if(TBObjList != "")
    {
        TBObjArray = TBObjList.split("~");
        if(SelObj.value == Selvalue)
        {
            for(var i=0;i<TBObjArray.length;i++)
            {
                document.getElementById(TBObjArray[i]).readOnly = false;
            }
            document.getElementById(TBObjArray[0]).focus();
        }
        else
        {
            for(var i=0;i<TBObjArray.length;i++)
            {
                document.getElementById(TBObjArray[i]).value = "";
                document.getElementById(TBObjArray[i]).readOnly = true;
            }
        }
    }
    if(CBObjList != "")
    {
        CBObjArray = CBObjList.split("~");
        if(SelObj.value == Selvalue)
        {
            for(var i=0;i<CBObjArray.length;i++)
            {
                document.getElementById(CBObjArray[i]).disabled = false;
            }
            document.getElementById(CBObjArray[0]).focus();
        }
        else
        {
            for(var i=0;i<CBObjArray.length;i++)
            {
                document.getElementById(CBObjArray[i]).options[0].selected = true;
                document.getElementById(CBObjArray[i]).disabled = true;
            }
        }
    }
}

//Following function will validate all the form field having attribute 'reuired=true' 
function funValidateFormMendFields(thisForm)
{
    var formName = "";
    if(thisForm.id != null || thisForm.id != "")
    {
        formName = thisForm.id;
    }
    else
    {
        formName = thisForm.name;
    }
    
    var elements = $(formName).getElementsBySelector('[required="true"]');
    //var elements = $$('input[required="true"]'); 
    //elements = elements.concat($$('select[required="true"]')); 
    //alert(elements); 
    var errMsg = "Please Check the Following Fields.\n\n"; 
    var ctr =0; 

    //this will chk all the element with required = true value.
    for(var x =0; x < elements.length; x++) 
    { 
        //alert(elements[x].name); 
        if(!validate(elements[x])) 
            errMsg += "["+(++ctr)+"] "+elements[x].readAttribute("label")+"\n"; 
    } 
    
    // this will check the number for the given format 
    elements = $$('input[numberformat]'); 
    for(var x =0; x < elements.length; x++) 
    {
        if(elements[x].value.length != 0)
        {
            if(!chkPhoneNoFormat(elements[x])) 
                errMsg += "["+(++ctr)+"] "+elements[x].readAttribute("label")+" should be in number with format "+elements[x].readAttribute("numberformat")+".\n"; 
        }
    } 

    // this will check the email 
    elements = $$('input[emailvalidate="true"]'); 
    for(var x =0; x < elements.length; x++) 
    { 
        if(elements[x].value.length != 0) 
        { 
            if(!validateEmail(elements[x])) 
                errMsg += "["+(++ctr)+"] "+elements[x].readAttribute("label")+" is not valid.\n"; 
        } 
    } 

    if(ctr != 0) 
    { 
        alert(errMsg); 
        return false; 
    } 
    return true; 
} 

// Used to check eamil validation when page submits.
function validateEmail(objEmail) 
{ 
    if(objEmail.value.strip().length != 0) 
    { 
        var emailRegExp = /^[a-zA-Z]+[0-9]*([-\._]{0,1}[a-zA-Z0-9]+)*@[a-zA-Z0-9]+([-]{0,1}[a-zA-Z0-9]+)*([.][a-zA-Z]{2,4})+$/i; 
        return emailRegExp.test(objEmail.value.strip()); 
    } 
} 


function chkPhoneNoFormat(obj) 
{ 
    var noFormat = obj.readAttribute("numberformat").strip(); 
    var regStr = ""; 
    
    if(obj.value.length != noFormat.length) 
        return false; 
    else 
    { 
        for(var i=0; i < noFormat.length; i++) 
        { 
            if(noFormat.charAt(i) == "#") 
            { 
                regStr += "[0-9]"; 
            } 
            else 
            { 
                regStr += "["+noFormat.charAt(i)+"]"; 
            } 
        } 

        var regExp = new RegExp(regStr); 
        return regExp.test(obj.value); 
    } 
} 


function validate(fieldObj) 
{ 
    with(fieldObj) 
    { 
        if(type == "text" || type == "textarea") 
        { 
            if((value.strip() == null || value.strip() == "") && readAttribute("blank") == null) 
                return false; 
            else 
                return true; 
        } 
        else if(type == "radio") 
        { 
            var radioElements = document.getElementsByName(name); 
            var returnValue = false; 
    
            for (var i=0 ; i < radioElements.length; i++) 
            { 
                if(radioElements[i].checked) 
                    returnValue = true; 
            } 
            return returnValue; 
        } 
        else if(type == "checkbox") 
        { 
            return checked; 
        } 
        else 
        { 
            if (value.strip() == null|| value.strip() == "0"|| value.strip() == "") 
                return false; 
            else 
                return true; 
        } 
    } 
}

//Following function will set the attrValue to attrName of element obj.
function setValueByAttr(obj,attrName,attrValue) 
{ 
    var returnVal = ""; 
    for(var i=0; i < obj.attributes.length; i++) 
    { 
        if(obj.attributes[i].name == attrName) 
        obj.attributes[i].value = attrValue; 
    } 
    return returnVal; 
} 

        

function funDisEnbRow(obj,trID,eleID,value)
{
    var EleIDArray = new Array();  
    var TRIDArray = new Array();  
 
   TRIDArray  =  trID.split("~");
   EleIDArray = eleID.split("~");

    if(obj.value == value)
    {
        for(var i=0;i<TRIDArray.length;i++)
        {
            try
            {
                document.getElementById(TRIDArray[i]).style.display = "table-row";
            }
            catch(err)
            {
                document.getElementById(TRIDArray[i]).style.display = "block";
            }
            
            setValueByAttr(document.getElementById(EleIDArray[i]),'required','true');
        }
        if(obj.name == 'isAnyWorkSubContr')
        {
            return getServerData('SUBCONTCLASS','subContrClassID','');
         }
    }
    else
    {
        for(var i=0;i<TRIDArray.length;i++)
        {
            document.getElementById(TRIDArray[i]).style.display = "none";
            
            if(document.getElementById(EleIDArray[i]).type == 'select-one')
            {
                document.getElementById(EleIDArray[i]).options[0].selected = true;
            }
            else
            {
                document.getElementById(EleIDArray[i]).value = "";
            }
            setValueByAttr(document.getElementById(EleIDArray[i]),'required','false'); 
         }
    }
}

function ReferToUnderWriter(obj,value)
{
    if(obj.name == "estAnnualSales")
    {
       if(parseFloat(obj.value) > parseFloat(value))
       {
            var answer = confirm("Annual Sales should not be greater than "+value+". Please Submit to Liberty Excess & Surplus, Inc. for approval.\n\n" + "Press OK to exit this application or Cancel if you wish to edit your response.");
    
            if (answer == true)
            {
                document.getElementById("refer").value = "yes";
                document.forms[0].submit();
                return true;                        
            }
            else
            {
                obj.value = "";
                obj.focus();
                return false;
            }
        }
    }
    if(obj.name == "totSquareFootage")
    {
       if(parseFloat(obj.value) >  parseFloat(value))
       {
            var answer = confirm("Total Square Footage should not be greater than "+value+". Please Submit to Liberty Excess & Surplus, Inc. for approval.\n\n" + "Press OK to exit this application or Cancel if you wish to edit your response.");
    
            if (answer == true)
            {
                document.getElementById("refer").value = "yes";
                document.forms[0].submit();
                return true;                        
            }
            else
            {
                obj.value = "";
                obj.focus();
                return false;
            }
        }
    }
    if(obj.name == "custSquareFootage")
    {
       if(parseFloat(obj.value) >  parseFloat(value))
       {
            var answer = confirm("Customer Square Foot Area should not be greater than "+value+". Please Submit to Liberty Excess & Surplus, Inc. for approval.\n\n" + "Press OK to exit this application or Cancel if you wish to edit your response.");
    
            if (answer == true)
            {
                document.getElementById("refer").value = "yes";
                document.forms[0].submit();
                return true;                        
            }
            else
            {
                obj.value = "";
                obj.focus();
                return false;
            }
        }
    }
    
    if(obj.name == "isAnsulSysReqforCook")
    {
       if(obj.value  ==  value)
       {
            var answer = confirm("Risk does not qualify program because there is No Ansul System. Please Submit to Liberty Excess & Surplus, Inc. for approval.\n\n" + "Press OK to exit this application or Cancel if you wish to edit your response.");
    
            if (answer == true)
            {
                document.getElementById("refer").value = "yes";
                document.forms[0].submit();
                return true;                        
            }
            else
            {
                obj.options[0].selected = true;
                obj.focus();
                return false;
            }
        }
    }

    if(obj.name == "isBuildhaveUpdttoWiriPlumEle")
    {
       if(obj.value  ==  value)
       {
            var answer = confirm("Value of Does Building have updates?  is NO. Please Submit to Liberty Excess & Surplus, Inc. for approval.\n\n" + "Press OK to exit this application or Cancel if you wish to edit your response.");
    
            if (answer == true)
            {
                document.getElementById("refer").value = "yes";
                document.forms[0].submit();
                return true;                        
            }
            else
            {
                obj.options[0].selected = true;
                obj.focus();
                return false;
            }
        }
    }

    if(obj.name == "isRoofbeUpdated")
    {
       if(obj.value  ==  value)
       {
            var answer = confirm("Value of Has Roof been updated ? is NO. Please Submit to Liberty Excess & Surplus, Inc. for approval.\n\n" + "Press OK to exit this application or Cancel if you wish to edit your response.");
    
            if (answer == true)
            {
                document.getElementById("refer").value = "yes";
                document.forms[0].submit();
                return true;                        
            }
            else
            {
                obj.options[0].selected = true;
                obj.focus();
                return false;
            }
        }
    }
    
    if(obj.name == "isKtypeFireExtReq")
    {
       if(obj.value  ==  value)
       {
            var answer = confirm("Value of Are there K-type fire extinguishers in kitchen? is NO. Please Submit to Liberty Excess & Surplus, Inc. for approval.\n\n" + "Press OK to exit this application or Cancel if you wish to edit your response.");
    
            if (answer == true)
            {
                document.getElementById("refer").value = "yes";
                document.forms[0].submit();
                return true;                        
            }
            else
            {
                obj.options[0].selected = true;
                obj.focus();
                return false;
            }
        }
    }

    if(obj.name == "isCentralHeatSys")
    {
       if(obj.value  ==  value)
       {
            var answer = confirm("Value of Is there a Working Central Heating System? is NO. Please Submit to Liberty Excess & Surplus, Inc. for approval.\n\n" + "Press OK to exit this application or Cancel if you wish to edit your response.");
    
            if (answer == true)
            {
                document.getElementById("refer").value = "yes";
                document.forms[0].submit();
                return true;                        
            }
            else
            {
                obj.options[0].selected = true;
                obj.focus();
                return false;
            }
        }
    }

    // Refer Condition of contractor program
    
    if(obj.name == "isQualifyProgram")
    {
       if(obj.value  ==  value)
       {
            var answer = confirm("Value of Verify all operations of the insured's; Do they qualify for program? is NO. Please Submit to Liberty Excess & Surplus, Inc. for approval.\n\n" + "Press OK to exit this application or Cancel if you wish to edit your response.");
    
            if (answer == true)
            {
                document.getElementById("refer").value = "yes";
                document.forms[0].submit();
                return true;                        
            }
            else
            {
                obj.options[0].selected = true;
                obj.focus();
                return false;
            }
        }
    }

    if(obj.name == "isInsurWorkOverFiveStor")
    {
       if(obj.value  ==  value)
       {
            var answer = confirm("Value of Does insured work over 5 stories? is Yes. Please Submit to Liberty Excess & Surplus, Inc. for approval.\n\n" + "Press OK to exit this application or Cancel if you wish to edit your response.");
    
            if (answer == true)
            {
                document.getElementById("refer").value = "yes";
                document.forms[0].submit();
                return true;                        
            }
            else
            {
                obj.options[1].selected = true;
                obj.focus();
                return false;
            }
        }
    }
    
    if(obj.name == "insuredAnnaulReceipts")
    {
        if( parseFloat(obj.value)  >  parseFloat(value))
       {
            var answer = confirm("Value What are insured's annual receipts? is greater than "+value+". Please Submit to Liberty Excess & Surplus, Inc. for approval.\n\n" + "Press OK to exit this application or Cancel if you wish to edit your response.");
    
            if (answer == true)
            {
                document.getElementById("refer").value = "yes";
                document.forms[0].submit();
                return true;                        
            }
            else
            {
                obj.value = "";
                obj.focus();
                return false;
            }
        }
    }
    
    if(obj.name == "isRiskhavepriorlosses")
    {
       if(obj.value  ==  value)
       {
            var answer = confirm("Value of Does risk have any prior losses? is Yes. Please Submit to Liberty Excess & Surplus, Inc. for approval.\n\n" + "Press OK to exit this application or Cancel if you wish to edit your response.");
    
            if (answer == true)
            {
                document.getElementById("refer").value = "yes";
                document.forms[0].submit();
                return true;                        
            }
            else
            {
                obj.options[1].selected = true;
                obj.focus();
                return false;
            }
        }
    }
    
    if(obj.name == "isAnyCurrorPasrConstDefect")
    {
       if(obj.value  ==  value)
       {
            var answer = confirm("Value of Any current or past construction defects, incidents or claims? is Yes. Please Submit to Liberty Excess & Surplus, Inc. for approval.\n\n" + "Press OK to exit this application or Cancel if you wish to edit your response.");
    
            if (answer == true)
            {
                document.getElementById("refer").value = "yes";
                document.forms[0].submit();
                return true;                        
            }
            else
            {
                obj.options[1].selected = true;
                obj.focus();
                return false;
            }
        }
    }

    if(obj.name == "isAnyDredgingWork")
    {
       if(obj.value  ==  value)
       {
            var answer = confirm("Value of Any dredging Work? is Yes. Please Submit to Liberty Excess & Surplus, Inc. for approval.\n\n" + "Press OK to exit this application or Cancel if you wish to edit your response.");
    
            if (answer == true)
            {
                document.getElementById("refer").value = "yes";
                document.forms[0].submit();
                return true;                        
            }
            else
            {
                obj.options[1].selected = true;
                obj.focus();
                return false;
            }
        }
    }
    
    if(obj.name == "isSubContrcarryequalLimit")
    {
       if(obj.value  ==  value)
       {
            var answer = confirm("Value of Do Sub-Contractors carry equal limits? is No. Please Submit to Liberty Excess & Surplus, Inc. for approval.\n\n" + "Press OK to exit this application or Cancel if you wish to edit your response.");
    
            if (answer == true)
            {
                document.getElementById("refer").value = "yes";
                document.forms[0].submit();
                return true;                        
            }
            else
            {
                obj.options[0].selected = true;
                obj.focus();
                return false;
            }
        }
    }

    if(obj.name == "isAnyRemovalofudrgrndTanks")
    {
       if(obj.value  ==  value)
       {
            var answer = confirm("Value of Any removal of underground fuel tanks? is Yes. Please Submit to Liberty Excess & Surplus, Inc. for approval.\n\n" + "Press OK to exit this application or Cancel if you wish to edit your response.");
    
            if (answer == true)
            {
                document.getElementById("refer").value = "yes";
                document.forms[0].submit();
                return true;                        
            }
            else
            {
                obj.options[1].selected = true;
                obj.focus();
                return false;
            }
        }
    }
    
    if(obj.name == "isApplorSubContruseExplo")
    {
       if(obj.value  ==  value)
       {
            var answer = confirm("Value of Does the applicant or Sub-Contractor use explosives? is Yes. Please Submit to Liberty Excess & Surplus, Inc. for approval.\n\n" + "Press OK to exit this application or Cancel if you wish to edit your response.");
    
            if (answer == true)
            {
                document.getElementById("refer").value = "yes";
                document.forms[0].submit();
                return true;                        
            }
            else
            {
                obj.options[1].selected = true;
                obj.focus();
                return false;
            }
        }
    }
    
    if(obj.name == "isAnyworkinOilRifChemorPetro")
    {
       if(obj.value  ==  value)
       {
            var answer = confirm("Value of Any work in oil refineries, chemical or petroleum plants? is Yes. Please Submit to Liberty Excess & Surplus, Inc. for approval.\n\n" + "Press OK to exit this application or Cancel if you wish to edit your response.");
    
            if (answer == true)
            {
                document.getElementById("refer").value = "yes";
                document.forms[0].submit();
                return true;                        
            }
            else
            {
                obj.options[1].selected = true;
                obj.focus();
                return false;
            }
        }
    }
       
    if(obj.name == "isAnyworkonHillorSlopes")
    {
       if(obj.value  ==  value)
       {
            var answer = confirm("Value of Any work on hillsides or slopes? is Yes. Please Submit to Liberty Excess & Surplus, Inc. for approval.\n\n" + "Press OK to exit this application or Cancel if you wish to edit your response.");
    
            if (answer == true)
            {
                document.getElementById("refer").value = "yes";
                document.forms[0].submit();
                return true;                        
            }
            else
            {
                obj.options[1].selected = true;
                obj.focus();
                return false;
            }
        }
    }

    if(obj.name == "subContrClassID")
    {
       if(obj.value  ==  value)
       {
            var answer = confirm("For selected Sub-Contractor Classification. Please Submit to Liberty Excess & Surplus, Inc. for Calculation and Minimum Premiums Applicable.\n\n" + "Press OK to exit this application or Cancel if you wish to edit your response.");
    
            if (answer == true)
            {
                document.getElementById("refer").value = "yes";
                document.forms[0].submit();
                return true;                        
            }
            else
            {
                obj.options[0].selected = true;
                obj.focus();
                return false;
            }
        }
    }

    // Refer Condition of Vacant program
    
    if(obj.name == "propBecomeVacant")
    {
       if(obj.value  ==  value)
       {
            var answer = confirm("Did the property become vacant, foreclosure, estate sale, lease, etc? is NO. Please Submit to Liberty Excess & Surplus, Inc. for approval.\n\n" + "Press OK to exit this application or Cancel if you wish to edit your response.");
    
            if (answer == true)
            {
                document.getElementById("refer").value = "yes";
                document.forms[0].submit();
                return true;                        
            }
            else
            {
                obj.options[0].selected = true;
                obj.focus();
                return false;
            }
        }
    }

    if(obj.name == "isNeighborhoodImproving")
    {
       if(obj.value  ==  value)
       {
            var answer = confirm("Is the neighborhood improving, stable or declining? is NO. Please Submit to Liberty Excess & Surplus, Inc. for approval.\n\n" + "Press OK to exit this application or Cancel if you wish to edit your response.");
    
            if (answer == true)
            {
                document.getElementById("refer").value = "yes";
                document.forms[0].submit();
                return true;                        
            }
            else
            {
                obj.options[0].selected = true;
                obj.focus();
                return false;
            }
        }
    }

    if(obj.name == "isPropertySecured")
    {
       if(obj.value  ==  value)
       {
            var answer = confirm("Is the property secured and locked up? is NO. Please Submit to Liberty Excess & Surplus, Inc. for approval.\n\n" + "Press OK to exit this application or Cancel if you wish to edit your response.");
    
            if (answer == true)
            {
                document.getElementById("refer").value = "yes";
                document.forms[0].submit();
                return true;                        
            }
            else
            {
                obj.options[0].selected = true;
                obj.focus();
                return false;
            }
        }
    }

    if(obj.name == "areRegularSecurity")
    {
       if(obj.value  ==  value)
       {
        var answer = confirm("Are regular security checks made? is NO. Please Submit to Liberty Excess & Surplus, Inc. for approval.\n\n" + "Press OK to exit this application or Cancel if you wish to edit your response.");
    
            if (answer == true)
            {
                document.getElementById("refer").value = "yes";
                document.forms[0].submit();
                return true;                        
            }
            else
            {
                obj.options[0].selected = true;
                obj.focus();
                return false;
            }
        }
    }

    if(obj.name == "haveCentralStation")
    {
       if(obj.value  ==  value)
       {
        var answer = confirm("Have central station alarm or 24 hour security service certified for Special Form when the building has copper wiring/pipes? is NO. Please Submit to Liberty Excess & Surplus, Inc. for approval.\n\n" + "Press OK to exit this application or Cancel if you wish to edit your response.");
    
            if (answer == true)
            {
                document.getElementById("refer").value = "yes";
                document.forms[0].submit();
                return true;                        
            }
            else
            {
                obj.options[0].selected = true;
                obj.focus();
                return false;
            }
        }
    }
    if(obj.name == "lossOfCause")
    {
         var policyType = document.getElementById('policyType').value;
         var lossOfCause = document.getElementById('lossOfCause').value;
         //alert('policyType = '+policyType);
         //alert('lossOfCause = '+lossOfCause);
         if(policyType == "Property" || policyType == "Package")
         {
            if(lossOfCause == "Broad" || lossOfCause == "Specialform")
            {
                var answer = confirm("You have selected Broad/Special Form. Please Submit to Liberty Excess & Surplus, Inc. for approval.\n\n" + "Press OK to exit this application or Cancel if you wish to edit your response.");

                if (answer == true)
                {
                    document.getElementById("refer").value = "yes";
                    document.forms[0].submit();
                    return true;                        
                }
                else
                {
                    obj.options[0].selected = true;
                    obj.focus();
                    return false;
                }
            }
         }
    }
}