var xmlcompare = null;
var xmlNavAce = null;
var xmlNavDK = null;
var xmlNavElkayRes = null;
var xmlNavElkayCom = null;
var xmlNavElkayWTB = null;
var xmlNavHD = null;
var xmlNavLowes = null;
var xmlNavNeptune = null;
var xmlNavTV = null;
var InitMenu = true;
var arVersion = navigator.appVersion.split("MSIE");
var version = parseFloat(arVersion[1]);
function resetFilters()
{
    var DDL = document.getElementById("filterArea").getElementsByTagName("select");
    for(x = 0; x < DDL.length; x++)
    {
        if(DDL[x].value != "*")
        {
        DDL[x].value = "*";
        }
    }
    filterSearch();
}
function checkReadyState(obj)
{
    if(obj.readyState == 4){if(obj.status == 200){return true;}}
}
function filterSearch()
{
    var Elements = document.getElementById("filterArea");
    var DDL = Elements.getElementsByTagName("select");
    filterString = "";
    for(x = 0; x < DDL.length; x++)
    {
        if(DDL[x].id != "veritySort")
        {
            if(DDL[x].value != "*")
            {
                if(DDL[x].id == "Xlength")
                {
                    filterString += " AND length" + DDL[x].value;
                }
                else
                {
                    filterString += " AND " + DDL[x].id + DDL[x].value;
                }
            }
        }
    }
    if(document.getElementById("veritySort").value == "*")
    {
        document.getElementById("filterOrder").value = "*";
        document.getElementById("filterSort").value = "*";
    }
    else
    {
        loc = document.getElementById("veritySort").value.indexOf("^");
        document.getElementById("filterOrder").value = document.getElementById("veritySort").value.substring(loc+1);
        document.getElementById("filterSort").value = document.getElementById("veritySort").value.substring(0, loc);
    }
    document.getElementById("filterQuery").value = filterString;
    document.forms.filterForm.submit();
}
function emailFriend(subject,filename){
    var encSubject = escape(subject);
    var encFilename = escape(filename);
    window.open('emailafriend.aspx?subj=' + encSubject + '&fn=' + encFilename, '_blank', 'width=370,height=400,left=10,top=0,toolbar=yes,scrollbars=yes,status=yes,location=no,menubar=yes,resizable=yes,directories=yes');
}
function compareproduct(Type, Room, SKU, Brand)
{
    var url = "http://" + location.host + "/AddCompare.aspx?&guid=" + escape(sessionID) + "&Type=" + escape(Type) + "&Room=" + escape(Room) + "&SKU=" + escape(SKU) + "&Brand=" + escape(Brand) + "&timestamp=" + new Date().getTime();
    if (window.XMLHttpRequest){xmlcompare = new XMLHttpRequest();}
    else if (window.ActiveXObject){xmlcompare = new ActiveXObject("Microsoft.XMLHTTP");}
    if (xmlcompare !== null){xmlcompare.onreadystatechange = compareproduct_response;xmlcompare.open("GET", url, true);xmlcompare.send(null);}
    return false;
}
function compareproduct_cb_click(cb, Type, Room, SKU, Brand, GroupSKU)
{
    if( cb.checked )
    {
        var url = "http://" + location.host + "/AddCompare.aspx?&guid=" + escape(sessionID) + "&Type=" + escape(Type) + "&Room=" + escape(Room) + "&SKU=" + escape(SKU) + "&Brand=" + escape(Brand) + "&timestamp=" + new Date().getTime();
        if (window.XMLHttpRequest){xmlcompare = new XMLHttpRequest();}
        else if (window.ActiveXObject){xmlcompare = new ActiveXObject("Microsoft.XMLHTTP");}
        if (xmlcompare !== null){xmlcompare.onreadystatechange = compareproduct_response;xmlcompare.open("GET", url, true);xmlcompare.send(null);}
        document.getElementById('compare_text_prod_'+SKU).innerHTML = 'Remove from compare';
    }
    else
    {
        var url = "http://" + location.host + "/delCompare.aspx?guid=" + escape(sessionID) + "&products=" + escape(GroupSKU) + "&timestamp=" + new Date().getTime();
        if( window.XMLHttpRequest ) {xmlcompare = new XMLHttpRequest();}
        else if( window.ActiveXObject ) {xmlcompare = new ActiveXObject("Microsoft.XMLHTTP");}
        if( xmlcompare != null )
        {
            xmlcompare.onreadystatechange = compareproduct_response;
            xmlcompare.open("GET", url, true);
            xmlcompare.send(null);
        }
        document.getElementById('compare_text_prod_'+SKU).innerHTML = 'Add to compare';
    }
    return false;
}
function compareproduct_response()
{
    if (checkReadyState(xmlcompare))
    {
        // Do nothing but have kept these lines here in case a status (i.e. - Product(s) added to compare) or error message is wanted
//        var xmldoc = xmlcompare.responseXML;
//        var status = xmldoc.getElementsByTagName('status').item(0);
//        alert(status.childNodes[0].data);
//        var error = xmldoc.getElementsByTagName('error').item(0);
//        if(error !== null)
//        {
//            alert(error.childNodes[0].data);
//        }
    }
}
function compare_cb_click(cb,group_sku)
{
    if( cb.checked )
    {
        var AjaxURL = "http://" + location.host + "/AddCompare.aspx?guid=" + escape(sessionID) + "&Brand=" + escape(page_brand) + "&products=" + escape(group_sku) + "&timestamp=" + new Date().getTime();
        if( window.XMLHttpRequest ) {xmlcompare = new XMLHttpRequest();}
        else if( window.ActiveXObject ) {xmlcompare = new ActiveXObject("Microsoft.XMLHTTP");}
        if( xmlcompare != null )
        {
            xmlcompare.onreadystatechange = comparebygroupsku_response;
            xmlcompare.open("GET", AjaxURL, true);
            xmlcompare.send(null);
        }
        document.getElementById('compare_text_'+group_sku).innerHTML = 'Remove from compare';
    }
    else
    {
        var AjaxURL = "http://" + location.host + "/delCompare.aspx?guid=" + escape(sessionID) + "&products=" + escape(group_sku) + "&timestamp=" + new Date().getTime();
        if( window.XMLHttpRequest ) {xmlcompare = new XMLHttpRequest();}
        else if( window.ActiveXObject ) {xmlcompare = new ActiveXObject("Microsoft.XMLHTTP");}
        if( xmlcompare != null )
        {
            xmlcompare.onreadystatechange = comparebygroupsku_response;
            xmlcompare.open("GET", AjaxURL, true);
            xmlcompare.send(null);
        }
        document.getElementById('compare_text_'+group_sku).innerHTML = 'Add to compare';
    }
}
function comparebygroupsku_response()
{
    if( checkReadyState(xmlcompare) )
    {
        // Do nothing but have kept these lines here in case a status (i.e. - Product(s) added to compare) or error message is wanted
//        var xmldoc = xmlcompare.responseXML;
//        var status = xmldoc.getElementsByTagName('status').item(0);
//        alert(status.childNodes[0].data);
//        var error = xmldoc.getElementsByTagName('error').item(0);
//        if(error != null)
//        {
//            alert(error.childNodes[0].data);
//        }
    }
}
function getNavAce()
{
    var url = "http://" + location.host + "/nav-ace.htm";
    if (window.XMLHttpRequest){xmlNavAce = new XMLHttpRequest();}
    else if (window.ActiveXObject){xmlNavAce = new ActiveXObject("Microsoft.XMLHTTP");}
    if (xmlNavAce !== null){xmlNavAce.onreadystatechange = getNavAce_response;xmlNavAce.open("GET", url, true);xmlNavAce.send(null);}
    return false;
}
function getNavAce_response()
{
    if (checkReadyState(xmlNavAce)){
        strHTML = xmlNavAce.responseText;
        if ((version >= 5.5) && (version < 7) && (document.body.filters)){
        strHTML2 = strHTML.replace(/hdr_menu_right.png/g,"blank.gif");
        strHTML = strHTML2.replace(/hdr_menu_left.png/g,"blank.gif");}
        document.getElementById('ajaxNavAce').innerHTML = strHTML;if(InitMenu){initializeMenus();}}
}
function getNavDK()
{
    var url = "http://" + location.host + "/nav-dk.htm";
    if (window.XMLHttpRequest){xmlNavDK = new XMLHttpRequest();}
    else if (window.ActiveXObject){xmlNavDK = new ActiveXObject("Microsoft.XMLHTTP");}
    if (xmlNavDK !== null){xmlNavDK.onreadystatechange = getNavDK_response;xmlNavDK.open("GET", url, true);xmlNavDK.send(null);}
    return false;
}
function getNavDK_response()
{
    if (checkReadyState(xmlNavDK)){
        strHTML = xmlNavDK.responseText;
        if ((version >= 5.5) && (version < 7) && (document.body.filters)){
        strHTML2 = strHTML.replace(/hdr_menu_right.png/g,"blank.gif");
        strHTML = strHTML2.replace(/hdr_menu_left.png/g,"blank.gif");}
        document.getElementById('ajaxNavDK').innerHTML = strHTML;if(InitMenu){initializeMenus();}}
}
function getNavElkayRes()
{
    var url = "http://" + location.host + "/nav-elkay-res.htm";
    if (window.XMLHttpRequest){xmlNavElkayRes = new XMLHttpRequest();}
    else if (window.ActiveXObject){xmlNavElkayRes = new ActiveXObject("Microsoft.XMLHTTP");}
    if (xmlNavElkayRes !== null){xmlNavElkayRes.onreadystatechange = getNavElkayRes_response;xmlNavElkayRes.open("GET", url, true);xmlNavElkayRes.send(null);}
    return false;
}
function getNavElkayRes_response()
{
    if (checkReadyState(xmlNavElkayRes)){
        strHTML = xmlNavElkayRes.responseText;
        if ((version >= 5.5) && (version < 7) && (document.body.filters)){
        strHTML2 = strHTML.replace(/hdr_menu_right.png/g,"blank.gif");
        strHTML = strHTML2.replace(/hdr_menu_left.png/g,"blank.gif");}
        document.getElementById('ajaxNavElkayRes').innerHTML = strHTML;if(InitMenu){initializeMenus();}}
}
function getNavElkayCom()
{
    var url = "http://" + location.host + "/nav-elkay-com.htm";
    if (window.XMLHttpRequest){xmlNavElkayCom = new XMLHttpRequest();}
    else if (window.ActiveXObject){xmlNavElkayCom = new ActiveXObject("Microsoft.XMLHTTP");}
    if (xmlNavElkayCom !== null){xmlNavElkayCom.onreadystatechange = getNavElkayCom_response;xmlNavElkayCom.open("GET", url, true);xmlNavElkayCom.send(null);}
    return false;
}
function getNavElkayCom_response()
{
    if (checkReadyState(xmlNavElkayCom)){
        strHTML=xmlNavElkayCom.responseText;
        if ((version >= 5.5) && (version < 7) && (document.body.filters)){
        strHTML2 = strHTML.replace(/hdr_menu_right.png/g,"blank.gif");
        strHTML = strHTML2.replace(/hdr_menu_left.png/g,"blank.gif");}
        document.getElementById('ajaxNavElkayCom').innerHTML = strHTML;if(InitMenu){initializeMenus();}}
}
function getNavElkayWTB()
{
    var url = "http://" + location.host + "/nav-elkay-wtb.aspx";
    if (window.XMLHttpRequest){xmlNavElkayWTB = new XMLHttpRequest();}
    else if (window.ActiveXObject){xmlNavElkayWTB = new ActiveXObject("Microsoft.XMLHTTP");}
    if (xmlNavElkayWTB !== null){xmlNavElkayWTB.onreadystatechange = getNavElkayWTB_response;xmlNavElkayWTB.open("GET", url, true);xmlNavElkayWTB.send(null);}
    return false;
}
function getNavElkayWTB_response()
{
    if (checkReadyState(xmlNavElkayWTB)){
        strHTML = xmlNavElkayWTB.responseText;
        if ((version >= 5.5) && (version < 7) && (document.body.filters)){
        strHTML2 = strHTML.replace(/hdr_menu_right.png/g,"blank.gif");
        strHTML = strHTML2.replace(/hdr_menu_left.png/g,"blank.gif");}
        document.getElementById('ajaxNavElkayWTB').innerHTML = strHTML;if(InitMenu){initializeMenus();}}
}
function getNavHD()
{
    var url = "http://" + location.host + "/nav-hd.htm";
    if (window.XMLHttpRequest){xmlNavHD = new XMLHttpRequest();}
    else if (window.ActiveXObject){xmlNavHD = new ActiveXObject("Microsoft.XMLHTTP");}
    if (xmlNavHD !== null){xmlNavHD.onreadystatechange = getNavHD_response;xmlNavHD.open("GET", url, true);xmlNavHD.send(null);}
    return false;
}
function getNavHD_response()
{
    if (checkReadyState(xmlNavHD)){
        strHTML = xmlNavHD.responseText;
        if ((version >= 5.5) && (version < 7) && (document.body.filters)){
        strHTML2 = strHTML.replace(/hdr_menu_right.png/g,"blank.gif");
        strHTML = strHTML2.replace(/hdr_menu_left.png/g,"blank.gif");}
        document.getElementById('ajaxNavHD').innerHTML = strHTML;if(InitMenu){initializeMenus();}}
}
function getNavLowes()
{
    var url = "http://" + location.host + "/nav-lowes.htm";
    if (window.XMLHttpRequest){xmlNavLowes = new XMLHttpRequest();}
    else if (window.ActiveXObject){xmlNavLowes = new ActiveXObject("Microsoft.XMLHTTP");}
    if (xmlNavLowes !== null){xmlNavLowes.onreadystatechange = getNavLowes_response;xmlNavLowes.open("GET", url, true);xmlNavLowes.send(null);}
    return false;
}
function getNavLowes_response()
{
    if (checkReadyState(xmlNavLowes)){
        strHTML = xmlNavLowes.responseText;
        if ((version >= 5.5) && (version < 7) && (document.body.filters)){
        strHTML2 = strHTML.replace(/hdr_menu_right.png/g,"blank.gif");
        strHTML = strHTML2.replace(/hdr_menu_left.png/g,"blank.gif");}
        document.getElementById('ajaxNavLowes').innerHTML = strHTML;if(InitMenu){initializeMenus();}}
}
function getNavNeptune()
{
    var url = "http://" + location.host + "/nav-neptune.htm";
    if (window.XMLHttpRequest){xmlNavNeptune = new XMLHttpRequest();}
    else if (window.ActiveXObject){xmlNavNeptune = new ActiveXObject("Microsoft.XMLHTTP");}
    if (xmlNavNeptune !== null){xmlNavNeptune.onreadystatechange = getNavNeptune_response;xmlNavNeptune.open("GET", url, true);xmlNavNeptune.send(null);}
    return false;
}
function getNavNeptune_response()
{
    if (checkReadyState(xmlNavNeptune)){
        strHTML = xmlNavNeptune.responseText;
        if ((version >= 5.5) && (version < 7) && (document.body.filters)){
        strHTML2 = strHTML.replace(/hdr_menu_right.png/g,"blank.gif");
        strHTML = strHTML2.replace(/hdr_menu_left.png/g,"blank.gif");}
        document.getElementById('ajaxNavNeptune').innerHTML = strHTML;if(InitMenu){initializeMenus();}}
}
function getNavTV()
{
    var url = "http://" + location.host + "/nav-tv.htm";
    if (window.XMLHttpRequest){xmlNavTV = new XMLHttpRequest();}
    else if (window.ActiveXObject){xmlNavTV = new ActiveXObject("Microsoft.XMLHTTP");}
    if (xmlNavTV !== null){xmlNavTV.onreadystatechange = getNavTV_response;xmlNavTV.open("GET", url, true);xmlNavTV.send(null);}
    return false;
}
function getNavTV_response()
{
    if (checkReadyState(xmlNavTV)){
        strHTML = xmlNavTV.responseText;
        if ((version >= 5.5) && (version < 7) && (document.body.filters)){
        strHTML2 = strHTML.replace(/hdr_menu_right.png/g,"blank.gif");
        strHTML = strHTML2.replace(/hdr_menu_left.png/g,"blank.gif");}
        document.getElementById('ajaxNavTV').innerHTML = strHTML;if(InitMenu){initializeMenus();}}
}
function getNavMenards()
{
    var url = "http://" + location.host + "/nav-menards.htm";
    if (window.XMLHttpRequest){xmlNavMenards = new XMLHttpRequest();}
    else if (window.ActiveXObject){xmlNavMenards = new ActiveXObject("Microsoft.XMLHTTP");}
    if (xmlNavMenards !== null){xmlNavMenards.onreadystatechange = getNavMenards_response;xmlNavMenards.open("GET", url, true);xmlNavMenards.send(null);}
    return false;
}
function getNavMenards_response()
{
    if (checkReadyState(xmlNavMenards)){
        strHTML = xmlNavMenards.responseText;
        if ((version >= 5.5) && (version < 7) && (document.body.filters)){
        strHTML2 = strHTML.replace(/hdr_menu_right.png/g,"blank.gif");
        strHTML = strHTML2.replace(/hdr_menu_left.png/g,"blank.gif");}
        document.getElementById('ajaxNavMenards').innerHTML = strHTML;if(InitMenu){initializeMenus();}}
}
function getNavExpo()
{
    var url = "http://" + location.host + "/nav-expo.htm";
    if (window.XMLHttpRequest){xmlNavExpo = new XMLHttpRequest();}
    else if (window.ActiveXObject){xmlNavExpo = new ActiveXObject("Microsoft.XMLHTTP");}
    if (xmlNavExpo !== null){xmlNavExpo.onreadystatechange = getNavExpo_response;xmlNavExpo.open("GET", url, true);xmlNavExpo.send(null);}
    return false;
}
function getNavExpo_response()
{
    if (checkReadyState(xmlNavExpo)){
        strHTML = xmlNavExpo.responseText;
        if ((version >= 5.5) && (version < 7) && (document.body.filters)){
        strHTML2 = strHTML.replace(/hdr_menu_right.png/g,"blank.gif");
        strHTML = strHTML2.replace(/hdr_menu_left.png/g,"blank.gif");}
        document.getElementById('ajaxNavExpo').innerHTML = strHTML;if(InitMenu){initializeMenus();}}
}
function showStatementFlash(flashDivID, imageDivID){
    document.getElementById(imageDivID).style.display = "none";
    document.getElementById(flashDivID).style.display = "inline";    
 }
function showDetailMainImages(flashDivID, imageDivID){
    document.getElementById(imageDivID).style.display = "inline";
    document.getElementById(flashDivID).style.display = "none"; 
 }
function detailPageSlideShow(id, src, flashDivID, imageDivID) {
   if (navigator.userAgent.indexOf("MSIE") == -1) {
      document.getElementById(id).src = src;
      showDetailMainImages(flashDivID, imageDivID);
   } else {
      setTimeout("document.getElementById('" + id + "').src = '" + src + "';", 250);
      setTimeout("showDetailMainImages('" + flashDivID + "', '" + imageDivID + "');", 250);
   }
}