//change log
// 08-10-2001 akc  moved function myOpen to this .js file from the accviol.js
//                 file.  This function is used to prevent problems with the
//                 help window.  If the help was left open between screens,
//                 it was having problems.
//
//added generic function to fix months and days format - sometimes when passing
//data back and forth between subscripts, javascript assumes that the leading
//0 needs to be removed.  So a month that starts out as 02 becomes 2, and when
//strung together to make a date, the date looks like 2001215 instead of 20010215.
//function name is:  fixdates
//8/31/2001.  akc.
//
//added function FillPlanID.  It was in autoGeneral.js, but since it is a
//more generic-type function, it was moved here.  10/22/2001.  akc.
//
//added new function to format the date from the database from ccyymmdd to
//mm/dd/ccyy.  Function name is formatDate. 11-16-2001.  akc.
// added validate routine to check for all numeric-- no spaces or decimal   tdm 6/14/02
//020429 pja - changed to not allow the same digit to be used for the
// SSN# and DL # field.
// changed font size of status and app number to a larger size tdm 8/21/02

// new pop-up for inq date entry tdm 020487

//020831  11/20/2002  WPS : Added additional status codes for policies that are
//                          downloaded from the mainframe.
//030250  04/17/2003  JWM : Added a WriteTranser routine for the insured which
//                          will only do IMT Home Page and Contact Us transfers.
// 100175  10/20/2008 WPS : Fix navigation to point to new website.
// 102519  11/10/2009 JWM : Navigation was't correct for the insured on new website.

//set variable values for color and flashing speed.
        var x = 0;
        var colorful = new initArray("#000099","#CD050B","#000000");

function stopTheBlink (blinkMeto){

        var blinkIt = blinkMeto;

//        if (parent.heading_frame.blinkMe.clearInterval)
//        {
                clearInterval(blinkIt);

//        }
}


//function to cause colors in heading to flash
function chcolor(colorit, welcomeHead){

        if (x < (colorit.length-1)) {
                x++;
        }
        else {
                x = 0;
        }

        //Netscape goes through the first part of this 'if' statement
        //while IE goes through the second.
        if(navigator.appName == "Netscape") {
                parent.heading_frame.document.write('<center><font color="'+colorit[x]);
                parent.heading_frame.document.write('"><B><FONT FACE="arial" SIZE="+2">'+welcomeHead+'</font></b></center>');
                parent.heading_frame.document.close();
        }
        else if (navigator.appVersion.indexOf("MSIE") != -1){
                if (parent.heading_frame.document.all.c){
                        parent.heading_frame.document.all.c.style.color = colorit[x];
                }
        }
}


//funtion used to initialize the array for displaying the agency's name
function initArray(){
        this.length = initArray.arguments.length;
        for (var i = 0; i < this.length; i++) {
        this[i] = initArray.arguments[i];
           }
}

function flashName (name) {

        //define variables
        var speed = 1000;
        nameit = "Welcome "+name;

        if(navigator.appName == "Netscape") {
                parent.heading_frame.document.writeln("<TD></TD><TD>");
                parent.heading_frame.document.writeln('<layer id="c"><B><center><FONT FACE="arial" SIZE="+2">'+nameit+'</FONT></center></b></layer><br>');
                parent.heading_frame.document.writeln("</TD></TR>");
        }
        if (navigator.appVersion.indexOf("MSIE") != -1){
                parent.heading_frame.document.writeln("<TD></TD><TD>");
                parent.heading_frame.document.writeln('<div id="c"><center><FONT FACE="arial" SIZE="+2">'+nameit+'</FONT></center></div>');
                parent.heading_frame.document.writeln("</TD></TR>");
        }

        blinkMe = setInterval('chcolor(colorful, nameit)',speed);
        return blinkMe;
}



function Standard_Heading(var_head){

        document.writeln("<TABLE BORDER='0' CELLSPACING='0' CELLPADDING='0' COLS='3'")
        document.writeln("WIDTH='100%' HEIGHT='65'>")
        document.writeln("<TR>")
        document.writeln("        <TD WIDTH='10%' HEIGHT='46%'")
        document.writeln("                BACKGROUND='phraseback.gif' NOSAVE>&nbsp")
        document.writeln("        </td>")

        document.writeln("        <TD WIDTH='64%'")
        document.writeln("                BACKGROUND='topmenuback.gif' NOSAVE>&nbsp")
        document.writeln("        </TD>")

        document.writeln("<TD ROWSPAN='2' WIDTH='26%'")
        document.writeln("        BACKGROUND='bimtlogo.gif' NOSAVE>&nbsp")
        document.writeln("</TD>")
        document.writeln("</TR>")

        document.writeln("<TR>")
        document.writeln("<TD COLSPAN='2'><B><FONT SIZE='+1'>" + var_head + "</FONT></B></TD>")
        document.writeln("</TR>")

        document.writeln("</TABLE>")
}

function Standard_Frame_Heading(var_head, flashOrNot){

         parent.heading_frame.document.open();

         parent.heading_frame.document.writeln("<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01//EN' 'http://www.w3.org/TR/html4/strict.dtd'>");
          parent.heading_frame.document.writeln("<HTML>");
         parent.heading_frame.document.writeln("<HEAD>");
         parent.heading_frame.document.writeln("<TITLE>Generic Frames heading</TITLE>");
         parent.heading_frame.document.writeln("<LINK REV='made' HREF='mailto:webadmin@theimtgroup.com'>");
           parent.heading_frame.document.writeln("<META HTTP-EQUIV='Content-Type' CONTENT='text/html; charset=ISO 8859-1'>");
           parent.heading_frame.document.writeln("<META NAME='generator' CONTENT='NoteTab Light 4.82'>");
           parent.heading_frame.document.writeln("<META NAME='author' CONTENT='Kathy Coster'>");
           parent.heading_frame.document.writeln("<META NAME='description' CONTENT='IMT Heading auto_scripts.js  Standard_Frame_Heading'>");
           parent.heading_frame.document.writeln("<META NAME='keywords' CONTENT=''>");
           parent.heading_frame.document.writeln("<BASE TARGET='heading_frame'>");
            parent.heading_frame.document.writeln("</HEAD>");
           parent.heading_frame.document.writeln("<Body BACKGROUND='bTexture_brown_051.jpg' STYLE='color: #000099'>");
        parent.heading_frame.document.writeln("<TABLE BORDER='0' CELLSPACING='0' CELLPADDING='0' COLS='4'");
         parent.heading_frame.document.writeln("WIDTH=100% HEIGHT='65'>");
         parent.heading_frame.document.writeln("<TR>")

         parent.heading_frame.document.writeln("<TD ROWSPAN='2' WIDTH='140' ALIGN=LEFT'");
         parent.heading_frame.document.writeln("        BACKGROUND='bimtlogo.gif' NOSAVE>&nbsp");
         parent.heading_frame.document.writeln("</TD>");

//           if (flashOrNot == 'no')
//           {
                           var blinkMe = false;
                           parent.heading_frame.document.writeln("<TD ROWSPAN='1' ALIGN=RIGHT><FONT SIZE='+2' face='helvetica,arial'><CENTER>Welcome to " + var_head + "</CENTER></FONT></TD>");
//             }
//           else
//           {
//                   blinkMe = flashName(var_head);
//           }

            //this section of code determines the status of the app/quote based on
            //what was read from the database, then moves it to the heading section
            //of the screen.  Also shows the app number.
            var stat_variable = '';

            if (parent.detail_frame.app_status)
            {
                    if (parent.detail_frame.app_status == 'I' ||
                                parent.detail_frame.app_status == 'P')
                    {
                            stat_variable = 'Issued App &nbsp &nbsp &nbsp ';
                    }
                    else if (parent.detail_frame.app_status == 'Q' ||
                                parent.detail_frame.app_status == 'A')
                    {
                            stat_variable = 'Unissued App &nbsp &nbsp &nbsp ';
                    }
                    else if (parent.detail_frame.app_status == 'B')
                    {
                            stat_variable = 'Active &nbsp &nbsp &nbsp ';
                    }
                    else if (parent.detail_frame.app_status == 'R')
                    {
                            stat_variable = 'Inactive Renewal &nbsp &nbsp &nbsp ';
                    }
                    else if (parent.detail_frame.app_status == 'C')
                    {
                            stat_variable = 'Cancelled &nbsp &nbsp &nbsp ';
                    }
                    else if (parent.detail_frame.app_status == 'X')
                    {
                            stat_variable = 'Expired &nbsp &nbsp &nbsp ';
                    }
                else
                {
                        stat_variable = 'UNKNOWN &nbsp &nbsp &nbsp ';
                }
            }

            if (parent.detail_frame.typeoftransactionw)
            {
                parent.heading_frame.document.writeln("<TD VALIGN=BOTTOM ALIGN=RIGHT><FONT SIZE='-1' face='helvetica,arial'>Status: " + stat_variable + "  App No: " + parent.detail_frame.appno +"</FONT></TD>");
                   parent.heading_frame.document.writeln("</TR>");
                parent.heading_frame.document.writeln("</TABLE>");
        }

            //end of section that prints the app number and status in the heading

          parent.heading_frame.document.writeln("<input type='hidden' name='blinkMeNot' value="+blinkMe+">");
         parent.heading_frame.document.writeln("</BODY>");
         parent.heading_frame.document.writeln("</HTML>");

        parent.heading_frame.document.close();

}

function WriteTransfers()
{
//document.write("<CENTER><A HREF='http://www.imtins.com/' TARGET='_top'>IMT Home Page</A>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<A HREF='http://www.imtins.com/contactus/contactus.htm' TARGET='_top'>Contact Us</A>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<A HREF='http://www.imtins.com/agentsonly/index.htm' TARGET='_top'>Agents Only</A></CENTER>");
document.write("<CENTER><A HREF='http://www.imtins.com/' TARGET='_top'>IMT Home Page</A>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<A HREF='https://www.imtins.com/agents/agent-contact-imt.pl' TARGET='_top'>Contact Us</A>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<A HREF='https://www.imtins.com/agents/agent-welcome.pl' TARGET='_top'>Agents Only</A></CENTER>");
}

function InsuredTransfers()
{
//SVC #102519 ***//
//document.write("<CENTER><A HREF='http://www.imtins.com/' TARGET='_top'>IMT Home Page</A>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<A HREF='https://www.imtins.com/website/agents/agent-contact-imt.pl' TARGET='_top'>Contact Us</A></CENTER>");
document.write("<CENTER><A HREF='http://www.imtins.com/' TARGET='_top'>IMT Home Page</A>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<A HREF='https://www.imtins.com/contact-IMT.html' TARGET='_top'>Contact Us</A></CENTER>");
}

function GoToUrl(url)
{
        top.location.href = url
}

function Pop_Up_Manual(manual_var){

        //if imt manual window doesn't exist, create
        //and open it
        //else, if it exists and is just out of focus, move it
        //back into focus.
        if (!window.manual_window)
        {
                manual_window = window.open('http://63.64.74.158/manuals/overall.htm','manual_window','height=380,width=390,left=120,top=100,scrollbars=yes,resizable=yes,toolbar=yes,location=no,directories=yes,status=yes,menubar=yes');
         }
        else
        if (manual_window.closed == true)
        {
                manual_window = window.open('','manual_window','height=380,width=390,left=120,top=100,scrollbars=yes,resizable=yes,toolbar=yes,location=no,directories=yes,status=yes,menubar=yes');
                manual_window.document.open();
                 manual_window.document.location.href=manual_var;
         }
        else
      if (!manual_window.closed)
                {
                manual_window.focus();
                }

 }

 function Pop_Up_Date()
{
        Date_window = window.open('Policy_date.htm','Date_window','height=100,width=220,left=120,top=100,scrollbars=yes,resizable=yes,toolbar=no,location=no,directories=no,status=no,menubar=no');
}



function Pop_Up_Help(help_var){

        var help_window = window.open('','help_window','height=250,width=250,left=120,top=100,resizable=yes,scrollbars=yes');

        help_window.document.open();
        help_window.document.writeln("<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01//EN' 'http://www.w3.org/TR/html4/strict.dtd'>");
          help_window.document.writeln("<HTML>");
         help_window.document.writeln("<HEAD>");
         help_window.document.writeln("<TITLE>IMT Help</TITLE>");
         help_window.document.writeln("<LINK REV='made' HREF='mailto:webadmin@theimtgroup.com'>");
           help_window.document.writeln("<META HTTP-EQUIV='Content-Type' CONTENT='text/html; charset=ISO 8859-1'>");
           help_window.document.writeln("<META NAME='generator' CONTENT='NoteTab Light 4.82'>");
           help_window.document.writeln("<META NAME='author' CONTENT='Kathy Coster'>");
           help_window.document.writeln("<META NAME='description' CONTENT='Pop_Up_Help from auto_scripts.js'>");
           help_window.document.writeln("<META NAME='keywords' CONTENT=''>");
          help_window.document.writeln("</HEAD>");
         help_window.document.writeln("<BODY>");
        help_window.document.writeln("<FONT SIZE='2'>" + help_var + "</FONT></TD>");
         help_window.document.writeln("</TABLE>");
         help_window.document.writeln("</BODY>");
         help_window.document.writeln("</HTML>");

        help_window.document.close();


}

function List_all_States()
{
document.writeln("<OPTION></OPTION>");
document.writeln("<OPTION>Alabama</OPTION>");document.writeln("<OPTION>Alaska</OPTION>");document.writeln("<OPTION>Arizona</OPTION>");document.writeln("<OPTION>Arkansas</OPTION>");
document.writeln("<OPTION>California</OPTION>");document.writeln("<OPTION>Colorado</OPTION>");document.writeln("<OPTION>Connecticut</OPTION>");document.writeln("<OPTION>Delaware</OPTION>");
document.writeln("<OPTION>DC</OPTION>");document.writeln("<OPTION>Florida</OPTION>");document.writeln("<OPTION>Georgia</OPTION>");document.writeln("<OPTION>Hawaii</OPTION>");
document.writeln("<OPTION>Iowa</OPTION>");document.writeln("<OPTION>Illinois</OPTION>");document.writeln("<OPTION>Idaho</OPTION>");document.writeln("<OPTION>Kansas</OPTION>");
document.writeln("<OPTION>Kentucky</OPTION>");document.writeln("<OPTION>Louisiana</OPTION>");document.writeln("<OPTION>Maine</OPTION>");document.writeln("<OPTION>Maryland</OPTION>");
document.writeln("<OPTION>Massachusetts</OPTION>");document.writeln("<OPTION>Michigan</OPTION>");document.writeln("<OPTION>Minnesota</OPTION>");document.writeln("<OPTION>Mississippi</OPTION>");
document.writeln("<OPTION>Missouri</OPTION>");document.writeln("<OPTION>Montana</OPTION>");document.writeln("<OPTION>Nebraska</OPTION>");document.writeln("<OPTION>Nevada</OPTION>");
document.writeln("<OPTION>New Hampshire</OPTION>");document.writeln("<OPTION>New Jersey</OPTION>");document.writeln("<OPTION>New Mexico</OPTION>");document.writeln("<OPTION>New York</OPTION>");
document.writeln("<OPTION>North Carolina</OPTION>");document.writeln("<OPTION>North Dakota</OPTION>");document.writeln("<OPTION>Ohio</OPTION>");document.writeln("<OPTION>Oklahoma</OPTION>");
document.writeln("<OPTION>Oregon</OPTION>");document.writeln("<OPTION>Pennsylvania</OPTION>");document.writeln("<OPTION>Rhode Island</OPTION>");document.writeln("<OPTION>South Dakota</OPTION>");
document.writeln("<OPTION>South Carolina</OPTION>");document.writeln("<OPTION>Tennessee</OPTION>");document.writeln("<OPTION>Texas</OPTION>");document.writeln("<OPTION>Utah</OPTION>");
document.writeln("<OPTION>Vermont</OPTION>");document.writeln("<OPTION>Virginia</OPTION>");document.writeln("<OPTION>Wisconsin</OPTION>");document.writeln("<OPTION>Washington</OPTION>");
document.writeln("<OPTION>West Virginia</OPTION>");document.writeln("<OPTION>Wyoming</OPTION>");
}

function List_all_States_Abb(selectedState)
{
document.writeln("<OPTION></OPTION>");
if (selectedState == "AK"){document.writeln("<OPTION Value='AK' SELECTED>AK</OPTION>");}else{document.writeln("<OPTION Value='AK' >AK</OPTION>");}
if (selectedState == "AL"){document.writeln("<OPTION Value='AL' SELECTED>AL</OPTION>");}else{document.writeln("<OPTION Value='AL' >AL</OPTION>");}
if (selectedState == "AZ"){document.writeln("<OPTION Value='AZ' SELECTED>AZ</OPTION>");}else{document.writeln("<OPTION Value='AZ' >AZ</OPTION>");}
if (selectedState == "AR"){document.writeln("<OPTION Value='AR' SELECTED>AR</OPTION>");}else{document.writeln("<OPTION Value='AR' >AR</OPTION>");}
if (selectedState == "CA"){document.writeln("<OPTION Value='CA' SELECTED>CA</OPTION>");}else{document.writeln("<OPTION Value='CA' >CA</OPTION>");}
if (selectedState == "CO"){document.writeln("<OPTION Value='CO' SELECTED>CO</OPTION>");}else{document.writeln("<OPTION Value='CO' >CO</OPTION>");}
if (selectedState == "CT"){document.writeln("<OPTION Value='CT' SELECTED>CT</OPTION>");}else{document.writeln("<OPTION Value='CT' >CT</OPTION>");}
if (selectedState == "DC"){document.writeln("<OPTION Value='DC' SELECTED>DC</OPTION>");}else{document.writeln("<OPTION Value='DC' >DC</OPTION>");}
if (selectedState == "DE"){document.writeln("<OPTION Value='DE' SELECTED>DE</OPTION>");}else{document.writeln("<OPTION Value='DE' >DE</OPTION>");}
if (selectedState == "FL"){document.writeln("<OPTION Value='FL' SELECTED>FL</OPTION>");}else{document.writeln("<OPTION Value='FL' >FL</OPTION>");}
if (selectedState == "GA"){document.writeln("<OPTION Value='GA' SELECTED>GA</OPTION>");}else{document.writeln("<OPTION Value='GA' >GA</OPTION>");}
if (selectedState == "HI"){document.writeln("<OPTION Value='HI' SELECTED>HI</OPTION>");}else{document.writeln("<OPTION Value='HI' >HI</OPTION>");}
if (selectedState == "IA"){document.writeln("<OPTION Value='IA' SELECTED>IA</OPTION>");}else{document.writeln("<OPTION Value='IA'>IA</OPTION>");}
if (selectedState == "IL"){document.writeln("<OPTION Value='IL' SELECTED>IL</OPTION>");}else{document.writeln("<OPTION Value='IL' >IL</OPTION>");}
if (selectedState == "IN"){document.writeln("<OPTION Value='IN' SELECTED>IN</OPTION>");}else{document.writeln("<OPTION Value='IN' >IN</OPTION>");}
if (selectedState == "ID"){document.writeln("<OPTION Value='ID' SELECTED>ID</OPTION>");}else{document.writeln("<OPTION Value='ID' >ID</OPTION>");}
if (selectedState == "KS"){document.writeln("<OPTION Value='KS' SELECTED>KS</OPTION>");}else{document.writeln("<OPTION Value='KS' >KS</OPTION>");}
if (selectedState == "KY"){document.writeln("<OPTION Value='KY' SELECTED>KY</OPTION>");}else{document.writeln("<OPTION Value='KY' >KY</OPTION>");}
if (selectedState == "LA"){document.writeln("<OPTION Value='LA' SELECTED>LA</OPTION>");}else{document.writeln("<OPTION Value='LA' >LA</OPTION>");}
if (selectedState == "MA"){document.writeln("<OPTION Value='MA' SELECTED>MA</OPTION>");}else{document.writeln("<OPTION Value='MA' >MA</OPTION>");}
if (selectedState == "MD"){document.writeln("<OPTION Value='MD' SELECTED>MD</OPTION>");}else{document.writeln("<OPTION Value='MD' >MD</OPTION>");}
if (selectedState == "ME"){document.writeln("<OPTION Value='ME' SELECTED>ME</OPTION>");}else{document.writeln("<OPTION Value='ME' >ME</OPTION>");}
if (selectedState == "MI"){document.writeln("<OPTION Value='MI' SELECTED>MI</OPTION>");}else{document.writeln("<OPTION Value='MI' >MI</OPTION>");}
if (selectedState == "MN"){document.writeln("<OPTION Value='MN' SELECTED>MN</OPTION>");}else{document.writeln("<OPTION Value='MN' >MN</OPTION>");}
if (selectedState == "MO"){document.writeln("<OPTION Value='MO' SELECTED>MO</OPTION>");}else{document.writeln("<OPTION Value='MO' >MO</OPTION>");}
if (selectedState == "MS"){document.writeln("<OPTION Value='MS' SELECTED>MS</OPTION>");}else{document.writeln("<OPTION Value='MS' >MS</OPTION>");}
if (selectedState == "MT"){document.writeln("<OPTION Value='MT' SELECTED>MT</OPTION>");}else{document.writeln("<OPTION Value='MT' >MT</OPTION>");}
if (selectedState == "NE"){document.writeln("<OPTION Value='NE' SELECTED>NE</OPTION>");}else{document.writeln("<OPTION Value='NE' >NE</OPTION>");}
if (selectedState == "NC"){document.writeln("<OPTION Value='NC' SELECTED>NC</OPTION>");}else{document.writeln("<OPTION Value='NC' >NC</OPTION>");}
if (selectedState == "ND"){document.writeln("<OPTION Value='ND' SELECTED>ND</OPTION>");}else{document.writeln("<OPTION Value='ND' >ND</OPTION>");}
if (selectedState == "NH"){document.writeln("<OPTION Value='NH' SELECTED>NH</OPTION>");}else{document.writeln("<OPTION Value='NH' >NH</OPTION>");}
if (selectedState == "NJ"){document.writeln("<OPTION Value='NJ' SELECTED>NJ</OPTION>");}else{document.writeln("<OPTION Value='NJ' >NJ</OPTION>");}
if (selectedState == "NM"){document.writeln("<OPTION Value='NM' SELECTED>NM</OPTION>");}else{document.writeln("<OPTION Value='NM' >NM</OPTION>");}
if (selectedState == "NV"){document.writeln("<OPTION Value='NV' SELECTED>NV</OPTION>");}else{document.writeln("<OPTION Value='NV' >NV</OPTION>");}
if (selectedState == "NY"){document.writeln("<OPTION Value='NY' SELECTED>NY</OPTION>");}else{document.writeln("<OPTION Value='NY' >NY</OPTION>");}
if (selectedState == "OH"){document.writeln("<OPTION Value='OH' SELECTED>OH</OPTION>");}else{document.writeln("<OPTION Value='OH' >OH</OPTION>");}
if (selectedState == "OK"){document.writeln("<OPTION Value='OK' SELECTED>OK</OPTION>");}else{document.writeln("<OPTION Value='OK' >OK</OPTION>");}
if (selectedState == "OR"){document.writeln("<OPTION Value='OR' SELECTED>OR</OPTION>");}else{document.writeln("<OPTION Value='OR' >OR</OPTION>");}
if (selectedState == "PA"){document.writeln("<OPTION Value='PA' SELECTED>PA</OPTION>");}else{document.writeln("<OPTION Value='PA' >PA</OPTION>");}
if (selectedState == "RI"){document.writeln("<OPTION Value='RI' SELECTED>RI</OPTION>");}else{document.writeln("<OPTION Value='RI' >RI</OPTION>");}
if (selectedState == "SD"){document.writeln("<OPTION Value='SD' SELECTED>SD</OPTION>");}else{document.writeln("<OPTION Value='SD' >SD</OPTION>");}
if (selectedState == "SC"){document.writeln("<OPTION Value='SC' SELECTED>SC</OPTION>");}else{document.writeln("<OPTION Value='SC' >SC</OPTION>");}
if (selectedState == "TN"){document.writeln("<OPTION Value='TN' SELECTED>TN</OPTION>");}else{document.writeln("<OPTION Value='TN' >TN</OPTION>");}
if (selectedState == "TX"){document.writeln("<OPTION Value='TX' SELECTED>TX</OPTION>");}else{document.writeln("<OPTION Value='TX' >TX</OPTION>");}
if (selectedState == "UT"){document.writeln("<OPTION Value='UT' SELECTED>UT</OPTION>");}else{document.writeln("<OPTION Value='UT' >UT</OPTION>");}
if (selectedState == "VT"){document.writeln("<OPTION Value='VT' SELECTED>VT</OPTION>");}else{document.writeln("<OPTION Value='VT' >VT</OPTION>");}
if (selectedState == "VA"){document.writeln("<OPTION Value='VA' SELECTED>VA</OPTION>");}else{document.writeln("<OPTION Value='VA' >VA</OPTION>");}
if (selectedState == "WI"){document.writeln("<OPTION Value='WI' SELECTED>WI</OPTION>");}else{document.writeln("<OPTION Value='WI' >WI</OPTION>");}
if (selectedState == "WA"){document.writeln("<OPTION Value='WA' SELECTED>WA</OPTION>");}else{document.writeln("<OPTION Value='WA' >WA</OPTION>");}
if (selectedState == "WV"){document.writeln("<OPTION Value='WV' SELECTED>WV</OPTION>");}else{document.writeln("<OPTION Value='WV' >WV</OPTION>");}
if (selectedState == "WY"){document.writeln("<OPTION Value='WY' SELECTED>WY</OPTION>");}else{document.writeln("<OPTION Value='WY' >WY</OPTION>");}
}

function List_all_Monthes()
{
document.writeln("<OPTION></OPTION>");
document.writeln("<OPTION VALUE='01'> January</OPTION>");document.writeln("<OPTION VALUE='02'>February</OPTION>");document.writeln("<OPTION VALUE='03'>March</OPTION>");document.writeln("<OPTION VALUE='04'>April</OPTION>");
document.writeln("<OPTION VALUE='05'>May</OPTION>");document.writeln("<OPTION VALUE='06'>June</OPTION>");document.writeln("<OPTION VALUE='07'>July</OPTION>");document.writeln("<OPTION VALUE='08'>August</OPTION>");
document.writeln("<OPTION VALUE='09'>September</OPTION>");document.writeln("<OPTION VALUE='10'>October</OPTION>");document.writeln("<OPTION VALUE='11'>November</OPTION>");document.writeln("<OPTION VALUE='12'>December</OPTION>");
}

function WriteOptions(x)
{

for (var i=0; i < x; i++ )
{
        document.writeln("<OPTION></OPTION>");
}
}


//this subroutine will return a false value if there is a problem with the date,
//and a true value if the date is valid

function Validate_Month_Day(mm, dd, yy)
{
// Check for valid month & day

        var work_month = mm;
        var work_day = dd;
        var work_year = yy;

        //document.write ("got here in autoscripts.js");
        //document.write ("month is "+work_month);
        //document.write ("day is "+work_day);
        //document.write ("year is "+work_year);


        if (work_month == 1 ||
                work_month == 3 ||
                work_month == 5 ||
                work_month == 7 ||
                work_month == 8 ||
                work_month == 10 ||
                work_month == 12)
        {
          if (work_day < 1 ||
                    work_day > 31)
          {
                  return false;
          }
        }

        //document.write ("got here2 in autoscripts.js");
    if (work_month == 2)
           if (work_day < 1 ||
                   work_day > 29)
          {
                return false;
          }

          //document.write ("got here3 in autoscripts.js");
      if (work_month == 2)
           if (work_day > 28)
            if ((work_year % 4) !== 0)
            {
                return false;
            }
            //document.write ("got here4 in autoscripts.js");
        if (work_month == 4 ||
                work_month == 6 ||
                work_month == 9 ||
                work_month == 11)
           if (work_day < 1 ||
                   work_day > 30)
          {
                return false;
          }
        //document.write ("got here5 in autoscripts.js");
        return true;
}



function myOpen(url,name) {
    if (window.help_window && !help_window.closed) help_window.close();
    help_window = window.open(url,name,'width=450,height=100,resizable=yes,scrollbars=yes');
}

function fixdates (num)
{
        var number = num;

        if (number == 1)
        {
                number = "01";
        }
        if (number == 2)
        {
                number = "02";
        }
        if (number == 3)
        {
                number = "03";
        }
        if (number == 4)
        {
                number = "04";
        }
        if (number == 5)
        {
                number = "05";
        }
        if (number == 6)
        {
                number = "06";
        }
        if (number == 7)
        {
                number = "07";
        }
        if (number == 8)
        {
                number = "08";
        }
        if (number == 9)
        {
                number = "09";
        }

        return number;

}



function formatDate(datefield)
{
//this function takes a date coming in as ccyymmdd format and reformats it
//for display purposes to mm/dd/ccyy.  For example:  incoming date is 19990423
//the returned date would be 04/23/1999.

        var workDate = datefield;

        var workYear = workDate.substring(0, 4);
        var workMonth = workDate.substring(4, 6);
        var workDay = workDate.substring(6, 8);

        var newDate = workMonth+"\/"+workDay+"\/"+workYear;
        return newDate;
}


function validate(string) {
    if (!string) return false;
    var Chars = "0123456789";

    for (var i = 0; i < string.length; i++) {
       if (Chars.indexOf(string.charAt(i)) == -1)
          return false;
    }
    return true;
}


function editString(fixMyString)
{
    wrkStrg = fixMyString;
    badOne = 'N';

//how long is this string coming in?
    howManyBytes = wrkStrg.length;

//pull off the first byte
    firstByte = wrkStrg.substr(0, 1);
    var ByteCntr = 0;
//window.alert("wrkStrg  = "+wrkStrg);

    for (var i = 0; i < wrkStrg.length; i++)
    {
//bump thru the field a byte at a time to make sure that the field is
// NOT all the same number or character; such as 11111,22222,etc
//if it is al the same character return false else return true
       CompareByte = wrkStrg.substr(i, 1);
       if (CompareByte == firstByte)
         {
            ++ByteCntr;
         }
    }
    if (ByteCntr == howManyBytes)
    {
          return false;
    }
    else
    {
             return true;
    }
}
