//*****************************************************************************
//*****************************************************************************
//Global Variables
lc_menu_image_to_highlight="xxx";
lc_menu_image_directory="images2/interior";

//*****************************************************************************
//** FUNCTION: Generates basic HTML for display of text
//** pci_text:         The text to be displayed.  If a Rollover button is requested, the name of the button can provided in "pci_text" but prefixed with "RO:"
//** pci_class:        The class to be used to display the text
//** pci_linkHref:     The page to link to if necessary; "nolink" should be passed if no link is necessary
//** pci_cellDivider : Indicator of whether the function should include a ROW and/or CELL dividers
//*****************************************************************************
function buildHTMLText( pci_text, pci_class, pci_linkHref, pci_cellDivider ) {

lc_thisFunctionName       = "buildHTMLText\n\n";

lc_returnText             = pci_text;
lc_rolloverName           = "";
lc_returnStringCellStart  = "";
lc_returnStringCellEnd    = "";
lc_returnStringClass      = "";
lc_returnString           = "";

    //alert(lc_thisFunctionName);

    //** Check to see if this is a rollover request
    if (pci_text.substring(0,3)=="RO:") {
        lc_rolloverName = pci_text.replace("RO:","")

        lc_returnText = "<img name='"+ lc_rolloverName +"' src='images2\\interior\\dk."+ lc_rolloverName +".of.gif' border=0 alt=''>"

        //** If the rollover request is for the main image to highlight representing the current page, then don't make it linkable as you are already on that page
        if (lc_rolloverName!=lc_menu_image_to_highlight)
            lc_returnText = "<a href='dk." + lc_rolloverName + ".html.asp' onmouseOver='mouseOverInt(0," + lc_rolloverName + ");' onmouseout='mouseOverInt(1," + lc_rolloverName + ");'>" + lc_returnText + "</a>"
        //alert(lc_thisFunctionName + lc_returnText);
    }

    //** Check to see if a class was provided
    if (pci_class!="defaultclass") {
        lc_returnStringClass      = " class="+pci_class ;
    }

    //** Check to see if a ROW was requested
    if (pci_cellDivider=="row") {
        lc_returnStringCellStart  = "<tr><td"+lc_returnStringClass+">";
        lc_returnStringCellEnd    = "</td></tr>";
    }

    //** Check to see if a CELL was requested
    if (pci_cellDivider=="cell") {
        lc_returnStringCellStart  = "<td"+lc_returnStringClass+">";
        lc_returnStringCellEnd    = "</td>";
    }

    //** Check to see if a link was provided
    if (pci_linkHref!="nolink") {
        lc_returnStringCellStart  += "<a href='"+pci_linkHref+"'"+lc_returnStringClass+">";
        lc_returnStringCellEnd    = "</a>"+lc_returnStringCellEnd;
    }


    lc_returnString = lc_returnStringCellStart + lc_returnText + lc_returnStringCellEnd

    //alert(lc_thisFunctionName + lc_returnString);

    return lc_returnString
}

//*****************************************************************************
//** FUNCTION: Preloads all rollover images by creating an empty image after the HTML body.
//*****************************************************************************
function preloadImages () {

lc_msg           ="";
li_i             =0;
li_j             =0;
la_tempPreLoadImage = new Array(30);

    //alert( "a"+document.images.length );
    for (li_i=0; li_i < document.images.length; li_i++) {

        if (document.images[li_i].src.indexOf('.of.') > 0) {
            //lc_msg += "Image["+li_i+"]="+document.images[li_i].src + "\n";
            lc_msg += "Image["+li_i+"]="+document.images[li_i].src.replace(".of.",".on.") + "\n";
            //document.writeln( "<img name=preload src='" + document.images[li_i].src.replace(".of.",".on.") + "' xwidth=1 xheight=1>" );
            li_j++;
            la_tempPreLoadImage[li_j] = new Image(1,1);
            la_tempPreLoadImage[li_j].src=document.images[li_i].src.replace(".of.",".on.");
            //alert( la_tempPreLoadImage[li_j].src );
        }
    }
      //alert( lc_msg + "\n\n" + la_tempPreLoadImage[li_j].src + "\n\n" + "Ending Number of Images" + document.images.length );
}
//*****************************************************************************
//*****************************************************************************
function mouseOver(piiAction, phiObject) {

    if ((piiAction==0) || (phiObject.name==lc_menu_image_to_highlight))
        //phiObject.src="images2/home/"+phiObject.src.substring(phiObject.src.lastIndexOf('/')+1,phiObject.src.length-7)+".on.gif";
        phiObject.src=phiObject.src.replace(".of.",".on.");
    else
        if (piiAction==1)
            //phiObject.src="images2/home/"+phiObject.src.substring(phiObject.src.lastIndexOf('/')+1,phiObject.src.length-7)+".of.gif";
            phiObject.src=phiObject.src.replace(".on.",".of.");
        else
            document.location=phiObject.src.substring(phiObject.src.lastIndexOf('/')+1,phiObject.src.length-7)+".html.asp";
}

//*****************************************************************************
//*****************************************************************************
function mouseOverInt(piiAction, phiObject) {

  //0- Graphic representing "on" state
  //1- Graphic representing "off" state
  //2- html page to click to


    if ((piiAction==0) || (phiObject.name==lc_menu_image_to_highlight))
        //phiObject.src="images2/interior/"+phiObject.src.substring(phiObject.src.lastIndexOf('/')+1,phiObject.src.length-7)+".on.gif";
        phiObject.src=phiObject.src.replace(".of.",".on.");
    else
        if (piiAction==1)
            //phiObject.src="images2/interior/"+phiObject.src.substring(phiObject.src.lastIndexOf('/')+1,phiObject.src.length-7)+".of.gif";
            phiObject.src=phiObject.src.replace(".on.",".of.");
        else
            document.location=phiObject.src.substring(phiObject.src.lastIndexOf('/')+1,phiObject.src.length-7)+".html.asp";
}
//*****************************************************************************
//*****************************************************************************
function validate(form) {
lc_errorText = "";

        if (form.nameFirst.value.length == 0) {
                lc_errorText += 'Please enter your first name.\n';
                form.nameFirst.focus();
        }
        if (form.nameLast.value.length == 0) {
                lc_errorText += 'Please enter your last name.\n';
                form.nameLast.focus();
        }
        if (form.Phone.value.length == 0) {
                lc_errorText += 'Please enter your phone number.\n';
                form.Phone.focus();
        }
        if (form.Email.value.length == 0) {
                lc_errorText += 'Please enter your email address.\n';
                form.Email.focus();
        }

     // //isNumber()
     // for (i=0; i<form.Phone.value.length; i++) {
     //         if (form.Phone.value.charAt(i) < "0" || form.Phone.value.charAt(i) > "9") {
     //                lc_errorText += 'Phone number should contain only numbers.\n';
     //                i=form.Phone.value.length;
     //         }
     // }
     //
     // //isAlpha()
     // for (i=0; i<form.Phone.value.length; i++) {
     //         if (form.Phone.value.charAt(i) >= "0" && form.Phone.value.charAt(i) <= "9") {
     //                lc_errorText += 'Phone number should not contain numbers.\n';
     //                i=form.Phone.value.length;
     //         }
     // }

      //var regExpr = /^((\(?[1-9][0-9][0-9]\)?)?\s?[1-9][0-9][0-9]\s?\d{4})?$/;
 //     var regExpr = /^((\(?[1-9][0-9][0-9]\)?)\s?[1-9][0-9][0-9]\-?\d{4})$/;
 //
 //     if ((form.Phone.value.length > 0) && !(regExpr.test(form.Phone.value))) {
 //             lc_errorText += 'Invalid phone format.  Please provide a valid phone number in format of "\(xxx\) xxx-xxxx".\n';
 //             form.Phone.focus();
 //     };
 //
 //     var regExpr = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/;
 //
 //     if ((form.Email.value.length > 0) && !(regExpr.test(form.Email.value))) {
 //             lc_errorText += 'Invalid email format.  Please provide a valid email address.\n';
 //             form.Email.focus();
 //     };
 //
 //
 //     // Verify at least one checknbox has been selected
 //   //var amenityChecked = 0;
 //   //for (i=0; i<form.amenities.length; i++) {
 //   //        if (form.amenities[i].checked) {
 //   //                amenityChecked = 1;
 //   //        };
 //   //};
 //
 //   //if ((amenityChecked==0) && (form.additionalrequests.value=="")) {
 //     if ((form.PROPERTY_ID.value.length == 0) && (form.comments.value=="")) {
 //             lc_errorText += 'Please provide us an PROPERTY_ID or comments about the property you are interested in.\n';
 //     };
 //
        if (lc_errorText.length<2)
            return true;
        else {
            alert( lc_errorText + "\nThank you!" );
            return false;
        }

}


//*****************************************************************************
//* Verify that the user really wants to delete the property listing
//*****************************************************************************
function confirmDelete( pii_property_ID  ) {

    if(confirm("You are about to delete this property permanently.\n\nClick 'OK' to delete or 'Cancel' to keep."))
        document.location='dk.adminedit.asp?action=delete&property_ID=' + pii_property_ID

}

//*****************************************************************************
//*****************************************************************************
function displayHeader() {
    document.writeln("<table border=0 cellpadding='0' cellspacing='0' width=800>")

    document.writeln("<tr>")
        document.writeln("<td>")
        document.writeln("<table border=0 cellpadding='0' cellspacing='0' >")
            document.writeln("<tr>")
                document.writeln("<td            ><a href='dk.navdiana.html.asp'> <img name='index'     src='images2\\interior\\dk_int_row1_1.jpg'    border=0 alt='About Diana'></a></td>")
                document.writeln("<td>            <a href='index.html.asp'>       <img name='dkgroup'   src='images2\\interior\\dk_int_row1_2.gif'    border=0 alt='Home Page' ></td>")
                document.writeln(          buildHTMLText( "RO:contactus"      , "defaultclass", "nolink", "cell") );
            document.writeln("</tr>")
        document.writeln("</table>")
        document.writeln("</td>")
    document.writeln("</tr>")
}

//*****************************************************************************
//*****************************************************************************
function displayMenuBar() {
    document.writeln("<tr>")
        document.writeln("<td>")
        document.writeln("<table border=0 cellpadding='0' cellspacing='0' >")
            document.writeln("<tr>")
                document.writeln("<td ><a href='dk.navdiana.html.asp'><img name='Web_final_flat2' src='images2\\interior\\dk_int_row2_01.jpg'     border=0 alt='About Diana'></a></td>")
                document.writeln("<td >                               <img name='Web_final_flat3' src='images2\\interior\\dk_int_row2_2.gif'      border=0 ></td>")

                document.writeln(                                buildHTMLText( "RO:forsale"      , "defaultclass", "nolink", "cell") );
                document.writeln(                                buildHTMLText( "RO:afford"       , "defaultclass", "nolink", "cell") );
                document.writeln(                                buildHTMLText( "RO:aboutthearea" , "defaultclass", "nolink", "cell") );
                document.writeln(                                buildHTMLText( "RO:schools"      , "defaultclass", "nolink", "cell") );
                document.writeln(                                buildHTMLText( "RO:whykeeling"   , "defaultclass", "nolink", "cell") );
                document.writeln(                                buildHTMLText( "RO:buysellnotes" , "defaultclass", "nolink", "cell") );

            document.writeln("</tr>")
        document.writeln("</table>")
        document.writeln("</td>")
    document.writeln("</tr>")
}

//*****************************************************************************
//*****************************************************************************
function displayLeftNav( pvi_TitleGraphic ) {
    document.writeln("<tr>")
        document.writeln("<td>")
        document.writeln("<table border=0 cellpadding='0' cellspacing='0' >")
            document.writeln("<tr valign=top width=100%>")
                document.writeln("<td>")
//alert("function displayLeftNav")
                    document.writeln("<table border=0 cellpadding='0' cellspacing='0' >")
                        //document.writeln( buildHTMLText( "RO:navvicki"  , "defaultclass", "nolink", "row") );
                        document.writeln("<tr><td><img name='navblocks1' src='images2\\interior\\dk_int_row3_1.gif' border=0 alt='' ></td></tr>")
                        document.writeln("<tr><td><img name='navblocks1' src='images2\\interior\\dk_int_row4_1.gif' border=0 alt='' ></td></tr>")
                        document.writeln("<tr><td><img name='navblocks1' src='images2\\interior\\dk_int_row5_1.gif' border=0 alt='' ></td></tr>")
                        document.writeln("<tr><td><img name='navblocks1' src='images2\\interior\\dk_int_row6_1.gif' border=0 alt='' ></td></tr>")
                        //document.writeln( buildHTMLText( "RO:navpatti"  , "defaultclass", "nolink", "row") );
                        //document.writeln( buildHTMLText( "RO:navchris"  , "defaultclass", "nolink", "row") );
                        document.writeln("<tr><td><a href='dk.adminlogin.asp'><img name='navblocks2' src='images2\\interior\\dk_int_row7_1.gif' border=0 ></a></td></tr>")
                    document.writeln("</table>")

                document.writeln("</td>")

                document.writeln("<td valign=top width=100%>")

                    document.writeln("<table border=0 cellpadding='18' cellspacing='0' width=100%>")

                        //****************************************
                        //If in admin mode, display admin buttons - BEGIN
                        //****************************************
                        if (gc_admin == 1) {
                            document.writeln( "    <tr class=bgpurplelite align=center><td>")
                            document.writeln( "        <a class=white href='dk.dianalistings.asp?action=summary'>&gt;&gt;Property Listings</a>&nbsp; ")
                            document.writeln( "        <a class=white href='dk.adminedit.asp?action=add'>&gt;&gt;Add New Property</a>&nbsp; ")
                            //document.writeln( "        <a href='dk.adminpicture.asp'>&gt;&gt;Picture Maintenance</a>&nbsp; ")
                            document.writeln( "        <a class=white href='dk.adminaccesslog.asp'>&gt;&gt;Review Access Log</a>&nbsp; ")
                            document.writeln( "        <a class=white href='dk.adminedit.asp?action=adminoff'>&gt;&gt;Admin Logout</a>&nbsp; ")
                            document.writeln( "    </td></tr>")
                        }
                        else
                            document.writeln("<tr><td><img src='images2\\interior\\dk.blank.gif' height=1></td></tr>")
                        //****************************************
                        //If in admin mode, display admin buttons - END
                        //****************************************

                        if (pvi_TitleGraphic.length < 1)
                            document.writeln("<tr><td><img src='images2\\interior\\dk.blank.gif' height=1><br>")
                        else
                            document.writeln("<tr><td><img src='images2\\interior\\"+pvi_TitleGraphic+"'><br>")


}

//*****************************************************************************
//*****************************************************************************
function displayTeamTrailer( pvi_ScreenName ){
    document.writeln("<p class=mainpurplebi>")
        document.writeln("<img src='images2\\interior\\dk_int_contentarrow_20.gif'><br>")
        document.writeln("<a href='dk.navdiana.html.asp' >About Diana Keeling</a>")
        document.writeln("<br>")
      //document.writeln("<a href='dk.navvicki.html.asp' >About Vicki Wilson</a>")
      //document.writeln("<br>")
        document.writeln("<a href='dk.navpatti.html.asp' >About Patti Quinn</a>")
        document.writeln("<br>")
        document.writeln("<a href='dk.navmarlene.html.asp' >About Marlene Aisenberg</a>")
        document.writeln("<br>")
      //document.writeln("<a href='dk.navchris.html.asp' >About Christopher Keeling</a>")
      //document.writeln("<br>")
        document.writeln("<a href='dk.clients.html.asp'  >What Our Clients Are Saying</a>")
    document.writeln("</p>")

}

//*****************************************************************************
//*****************************************************************************
function displayCalculatorTrailer( pvi_ScreenName ){
    document.writeln("<p class=mainpurplebi>")
        document.writeln("<img src='images2\\interior\\dk_int_contentarrow_20.gif'><br>")
        document.writeln("<a href='dk.calcmortgage.html.asp' >Mortgage Calculator</a>")
        document.writeln("<br>")
        document.writeln("<a href='dk.calc1530year.html.asp' >15-year vs. 30-year Mortgage Comparison</a>")
    document.writeln("</p>")

}

//*****************************************************************************
//*****************************************************************************
function displayForSaleTrailer( pvi_ScreenName ){
    document.writeln("<p class=mainpurplebi>")
        document.writeln("<img src='images2\\interior\\dk_int_contentarrow_20.gif'><br>")
        document.writeln("<a href='dk.dianalistings.asp?action=summary'>Our Featured Listings</a><br>")
        //document.writeln("<br><a href="dk.popup.body.html.asp?site=http://cbmove.com/homefinder/login.aspx?ReturnUrl=%2fpersonalization%2fpersonalizationhome.aspx%3fsi%3d10&si=10" target="_blank">Search MLS Listings</a>
        document.writeln("<a href='dk.popup.body.html.asp?site=cbmove.com/homefinder/login.aspx?ReturnUrl=%2fpersonalization%2fpersonalizationhome.aspx%3fsi%3d10&si=10' target='_blank'>Search MLS Listings</a>")

    document.writeln("</p>")

}

//*****************************************************************************
//*****************************************************************************
function displayNewsTrailer( pvi_ScreenName ){
    document.writeln("<p class=mainpurplebi>")
        document.writeln("<img src='images2\\interior\\dk_int_contentarrow_20.gif'><br>")
        document.writeln("<a href='dk.popup.body.html.asp?site=www.washingtonpost.com/wp-dyn/content/realestate/' target='_blank'>Washington DC Real Estate Guide</a><br>")

        document.writeln("<a href='dk.popup.body.html.asp?site=www.MyMoney.Gov' target='_blank'>Consumer Information including Budgeting, Taxes, Credit, Financial Planning and Homeownership</a>")
        document.writeln("<a href='dk.popup.body.html.asp?site=www.hud.gov/buying/index.cfm' target='_blank'>Department of Housing and Urban Development</a><br>")
        document.writeln("<a href='dk.popup.body.html.asp?site=www.freddiemac.com/creditsmart' target='_blank'>Freddie Macs Credit Smart Program</a><br>")
        document.writeln("<a href='dk.popup.body.html.asp?site=www.fdic.gov/consumers/consumer/moneysmart/overview.html' target='_blank'>FDIC's Money Smart Program</A><BR>")
        document.writeln("<a href='dk.popup.body.html.asp?site=www.realtor.org/gapublic.nsf/files/fcrabroch.pdf/$file/fcrabroch.pdf' target='_blank'>The Fair Credit Reporting Act and Your Credit History</a><br>")
        document.writeln("<a href='dk.popup.body.html.asp?site=www.fanniemae.com/homebuyers/homepath/index.jhtml' target='_blank'>Fannie Mae Foundation Homebuying Guides</a><br>")

        //document.writeln("<a href='\\news\\dk.news.link2.html.asp' >Link2</a><br>")
    document.writeln("</p>")

}

//*****************************************************************************
//*****************************************************************************
function displayGlobalTrailer() {

    document.writeln("<img src='images2\\interior\\dk_int_contentarrow_20.gif'><br>")
    //document.writeln("<span style='color:#72406e;font-weight:bold;'>Contact Diana Keeling</span><br><b>Direct: 301-634-4121<br>Fax: 301-941-2323<br>Cell: 301-537-3703<br><b>Email: <a href='mailto:dkeeling@cbmove.com'>dkeeling@cbmove.com</a></b>")
    document.writeln("<b>Direct: 301-634-4121<br>Fax: 301-941-2323<br>Cell: 301-537-3703<br><b>Email: <a href='mailto:dkeeling@cbmove.com'>dkeeling@cbmove.com</a></b>")
}
//*****************************************************************************
//*****************************************************************************
function setMenuBarOn() {

    lc_cmd_test="document."+lc_menu_image_to_highlight;
    lc_cmd="document."+lc_menu_image_to_highlight+".src='"+lc_menu_image_directory + "/dk." + lc_menu_image_to_highlight+".on.gif'";
    //alert(lc_cmd);
    if (eval(lc_cmd_test)) eval(lc_cmd);

    preloadImages ();

}
//*****************************************************************************
//** FUNCTION: Uncheck all other Home Page display checkboxes on the screen
//** pii_PictureNumberSet : Indicator as to which number should be set
//*****************************************************************************
function unsetCheckBoxes( pii_PictureNumberSet ) {
li_i        = 0;
lc_formItem = "";

    for (li_i=0; li_i <= 6; li_i++) {

        if ( li_i != pii_PictureNumberSet ) {
            lc_formItem = "document.form1.picture_" + li_i + "_HomePage_YN.checked = false";
            eval( lc_formItem );
        }

    }
}

