//
//
//
var xmlFile="partlists/products.xml";
var xmlProduct="HOTLINE";
var xmlXFile="partlists/exploded.xml";

function select_hotline()
{
    var x = null;
    var y = null;
    var z = null;

    loadXMLDoc( xmlFile );
    document.write( "<table class='ptable' align='center' width='95%' border='2'>" );
    document.write( "<thead>" );
    document.write( "<tr>" );
    document.write( "<th align='center'>Model Number</th>" );
    document.write( "<th align='center'>Volts</th>" );
    document.write( "<th align='center'>Amps</th>" );
    document.write( "<th align='center'>Heater (kW)</th>" );
    document.write( "<th align='center'>G.F.C.I. 220V</th>" );
//    document.write( "<th align='center'>Timer 24Hr.</th>" );
    document.write( "<th align='center'>Pump (HP)</th>" );
//    document.write( "<th align='center'>Booster (HP)</th>" );
//    document.write( "<th align='center'>Booster (HP)</th>" );
    document.write( "<th align='center'>Spa Side Ready</th>" );
    document.write( "<th align='center'>12V Light</th>" );
//    document.write( "<th align='center'>Independent Switching</th>" );
    document.write( "<th align='center'>Pump Speed</th>" );
//    document.write( "<th align='center'>Auxiliary Plugs</th>" );
//    document.write( "<th align='center'>Thermostat</th>" );
    document.write( "<th align='center'>UR Recognized</th>" );
    document.write( "<th align='center'>Limited Offer</th>" );
    document.write( "<th align='center'>Quantity</th>" );
    document.write( "</tr>" );
    document.write( "</thead>");
    document.write( "<tbody>" );
    x = xmlhttp.responseXML.documentElement.getElementsByTagName( xmlProduct );
    
    for (i = 0; i < x.length; i++)
    {
        document.write( "<tr>" );
        document.write( "<form name='hotline'>" );
        document.write( "<td width='15%'>" );
        document.write( x[i].getElementsByTagName( "MODEL" ) [0].childNodes[0].nodeValue );
        document.write( "<input type='hidden' name='ID_NUM' value='" + 
                        x[i].getElementsByTagName( "MODEL" ) [0].childNodes[0].nodeValue + "' />");
        document.write( "</td>" );
        document.write( "<td width='5%' align='center'>" );
        y = x[i].getElementsByTagName( "VOLTS" ) [0].childNodes[0].nodeValue;
        document.write( y );
        z = y + "V, ";
        document.write( "</td>" );
        document.write( "<td width='5%' align='center'>" );
        y = x[i].getElementsByTagName( "AMPS" ) [0].childNodes[0].nodeValue;
        document.write( y );
        z += y + "A, ";
        document.write( "</td>" );
        document.write( "<td width='5%' align='center'>" );
        document.write( x[i].getElementsByTagName( "HEATER" ) [0].childNodes[0].nodeValue );
        document.write( "</td>" );
        document.write( "<td width='5%' align='center'>" );
        document.write( x[i].getElementsByTagName( "GFI" ) [0].childNodes[0].nodeValue );
        document.write( "</td>" );
//        document.write( "<td width='5%' align='center'>" );
//        document.write( x[i].getElementsByTagName( "TIMER" ) [0].childNodes[0].nodeValue );
//        document.write( "</td>" );
        document.write( "<td width='5%' align='center'>" );
        y = x[i].getElementsByTagName( "PUMP" ) [0].childNodes[0].nodeValue;
        document.write( y );
        z += y + "hp";
        document.write( "<input type='hidden' name='NAME' value='" + z + "' />");
        document.write( "</td>" );
//        document.write( "<td width='5%' align='center'>" );
//        document.write( x[i].getElementsByTagName( "BOOSTER1" ) [0].childNodes[0].nodeValue );
//        document.write( "</td>" );
//        document.write( "<td width='5%' align='center'>" );
//        document.write( x[i].getElementsByTagName( "BOOSTER2" ) [0].childNodes[0].nodeValue );
//        document.write( "</td>" );
        document.write( "<td width='5%' align='center'>" );
        document.write( x[i].getElementsByTagName( "TOPSIDE" ) [0].childNodes[0].nodeValue );
        document.write( "</td>" );
        document.write( "<td width='5%' align='center'>" );
        document.write( x[i].getElementsByTagName( "LIGHT" ) [0].childNodes[0].nodeValue );
        document.write( "</td>" );
//        document.write( "<td width='5%' align='center'>" );
//        document.write( x[i].getElementsByTagName( "SWITCHING" ) [0].childNodes[0].nodeValue );
//        document.write( "</td>" );
        document.write( "<td width='5%' align='center'>" );
        document.write( x[i].getElementsByTagName( "PUMPSPD" ) [0].childNodes[0].nodeValue );
        document.write( "</td>" );
//        document.write( "<td width='5%' align='center'>" );
//        document.write( x[i].getElementsByTagName( "AUXPLUGS" ) [0].childNodes[0].nodeValue );
//        document.write( "</td>" );
//        document.write( "<td width='5%' align='center'>" );
//        document.write( x[i].getElementsByTagName( "THERMOSTAT" ) [0].childNodes[0].nodeValue );
//        document.write( "</td>" );
        document.write( "<td width='5%' align='center'>" );
        document.write( x[i].getElementsByTagName( "UR" ) [0].childNodes[0].nodeValue );
        document.write( "</td>" );
        document.write( "<td align='center'>" );
        z = x[i].getElementsByTagName( "PRICE" ) [0].childNodes[0].nodeValue;
        y = x[i].getElementsByTagName( "LIMITED" ) [0].childNodes[0].nodeValue;
        y.length == 1 ? y = 0 : y = y.slice( 1, y.length );
        if ( y > 0 ) {
            document.write( "<span style='color:red;'>" + z + "</span><br />" );
            document.write( "<s>" + y + "</s>" );
        }
        else {
            document.write( z );
        }
        z.length == 1 ? z = 0 : z = z.slice( 1, z.length );
        document.write( "<input type='hidden' name='PRICE' value='" + z + "' />");
        document.write( "</td>" );
        document.write( "<td width='10%' align='center'>" );
        if ( z == 0 ) {
            document.write( "&nbsp;" );
        } else {
            document.write( "<input type='text' size=6 maxlength=4 name='QUANTITY' onchange='this.value=CKquantity(this.value)' value='1' /><br />" );
            document.write( "<input type='button' value='Add to Order' class='btn-sml' onClick='AddToCart(this.form)' /><br />" );
            document.write( "<input type='button' value='View Order' class='btn-sml' onclick='DisplayCartAsWindow()' />" );
        }
        document.write( "</td>" );
        document.write( "</form>" );
        document.write( "</tr>" );
    }
    document.write( "</tbody>" );
    document.write( "</table>" );
}


function select_hotline_exploded()
{
    var x = null;
    var y = null;

    loadXMLDoc( xmlXFile );
    document.write( "<table class='ptable' align='center' width='90%' border='2' cellpadding='2'>" );
    document.write( "<thead>" );
    document.write( "<tr>" );
    document.write( "<th align='center'>Index Number:</th>" );
    document.write( "<th align='center'>Part Number:</th>" );
    document.write( "<th align='center'>Description:</th>" );
    document.write( "<th align='center'>List Price:</th>" );
    document.write( "<th align='center'>Quantity:</th>" );
    document.write( "</tr>" );
    document.write( "</thead>");
    document.write( "<tbody>" );
    x = xmlhttp.responseXML.documentElement.getElementsByTagName( xmlProduct );

    for (i = 0; i < x.length; i++)
    {
        document.write( "<tr>" );
        document.write( "<form name='parts'>" );
        document.write( "<td width='10%'>" );
        document.write( x[i].getElementsByTagName( "INDEX" ) [0].childNodes[0].nodeValue );
        document.write( "</td>" );
        document.write( "<td width='15%'>" );
        document.write( x[i].getElementsByTagName( "PART_NUM" ) [0].childNodes[0].nodeValue );
        document.write( "<input type='hidden' name='ID_NUM' value='" + 
                        x[i].getElementsByTagName( "PART_NUM" ) [0].childNodes[0].nodeValue + "' />");
        document.write( "</td>" );
        document.write( "<td width='55%' align='left'>" );
        document.write( x[i].getElementsByTagName( "DESCRIPTION" ) [0].childNodes[0].nodeValue );
        document.write( "<input type='hidden' name='NAME' value='" + 
                        x[i].getElementsByTagName( "DESCRIPTION" ) [0].childNodes[0].nodeValue + "' />");
        document.write( "</td>" );
        document.write( "<td width='20%' align='center'>" );
        y = x[i].getElementsByTagName( "PRICE" ) [0].childNodes[0].nodeValue;
        document.write( y );
        y.length == 1 ? y = 0 : y = y.slice( 1, y.length );
        document.write( "<input type='hidden' name='PRICE' value='" + y + "' />");
        document.write( "</td>" );
        document.write( "<td width='10%' align='center'>" );
        if ( y == 0 ) {
            document.write( "&nbsp;" );
        } else {
            document.write( "<input type='text' size=6 maxlength=4 name='QUANTITY' onchange='this.value=CKquantity(this.value)' value='1' /><br />" );
            document.write( "<input type='button' value='Add to Order' class='btn-sml' onClick='AddToCart(this.form)' /><br />" );
            document.write( "<input type='button' value='View Order' class='btn-sml' onclick='DisplayCartAsWindow()' />" );
        }
        document.write( "</td>" );
        document.write( "</form>" );
        document.write( "</tr>" );
    }
    document.write( "</tbody>" );
    document.write( "</table>" );
}

