﻿var sPartImage = "";

function hideSearchFields()
{
    document.getElementById("SearchBox").style.display = "none";
    document.getElementById("BrowseOptions").style.display = "none";
}
function cboSearch_Change(cboSearch)
{
    hideSearchFields();  
    
    switch(cboSearch.selectedIndex) 
    {
        case 1:
            document.getElementById("BrowseOptions").style.display = "inline";
            break;
        default:
            document.getElementById("SearchBox").style.display = "inline";
            document.getElementById("ctl00$txtSearch").value = "Enter Part #";
            break;
    }
}
function btnSearch_Click()
{
    document.getElementById("Series").innerHTML = "";
    document.getElementById("Categories").innerHTML = "";
}
function txtSearch_onFocus(txtSearch)
{
    txtSearch.value = '';
}
function txtSearch_onBlur(txtSearch)
{
    if(txtSearch.value == '')
        txtSearch.value = "Enter Part #";
}
function switchPartImage(sImage,iIndex)
{
    oList = document.getElementById("ctl00_Content_lstImages");
    oImage = document.getElementById("ctl00_Content_imgPartImage");
    iFFCount = 0;
    for(iCount=0;iCount<oList.childNodes.length;iCount++)
    {
        oListItem = oList.childNodes[iCount];
        if(oListItem.nodeName == "LI")
        {
            oListItem.className="";
            if(iCount == iIndex + iFFCount)
            {
                oListItem.className = "selected";
                oImage.src = "Image.aspx?src=" + escape(sImage) + "&w=515&h=220";
                document.getElementById("ctl00_Content_hlEnlarge").href = "Image.aspx?src=" + escape(sImage) + "&w=960&h=720";
            }
        }
        else
            iFFCount++;
    }
}

function mpOnLoad()
{
    tabberArgs = {};
    cboSearch_Change(document.getElementById('ctl00_cboSearch'));
    tabberAutomatic(tabberArgs);
}

function browseCombo_Change(comboBox,hiddenField)
{
    document.getElementById(hiddenField).value = comboBox.options[comboBox.selectedIndex].value;
    window.location.href = "Products.aspx?search=2&familyId=" + document.getElementById("ctl00_hdnSeriesId").value + "&typeId=" + document.getElementById("ctl00_hdnCategoryId").value + "&applicationId=" + document.getElementById("ctl00_hdnApplicationId").value;
}