
<!--
function switchImages( name1, source1 ){
		if ( document.images ){
			document[name1].src=source1;

        }
}

function doSiteSearch()
{		
	var searchVal = document.getElementById("SiteSearch").value;
	var redir = '/search/site-search.aspx?search=' + searchVal;
	location.href = redir;
	return false;	
	
}

// Function to trap enter key clicks.
function fnTrapSiteSearchKD(btn, event){

	if (document.all){		
		if (event.keyCode == 13){ 
			event.returnValue=false; 
			event.cancel = true; 			
			//btn.click(); 
			doSiteSearch();
		}
	}
	
	else if(document.layers){		
		if(event.which == 13){
			event.returnValue=false;
			event.cancel = true;
			//btn.click(); 
			doSiteSearch();
		}
	}
		
	else if (document.getElementById){		
		if (event.which == 13){
			event.returnValue=false;
			event.cancel = true;
			//btn.click(); 
			doSiteSearch();
		}
	}
}

function doPartNumberSearch()
{		
	var searchVal = document.getElementById("PartNumberSearch").value;
	var redir = '/search/part-number-search.aspx?prodsearch=' + searchVal;
	location.href = redir;
	return false;	
	
}

// Function to trap enter key clicks.
function fnTrapPartSearchKD(btn, event){

	if (document.all){		
		if (event.keyCode == 13){ 
			event.returnValue=false; 
			event.cancel = true; 			
			//btn.click(); 
			doPartNumberSearch();
		}
	}
	
	else if(document.layers){		
		if(event.which == 13){
			event.returnValue=false;
			event.cancel = true;
			//btn.click(); 
			doPartNumberSearch();
		}
	}
		
	else if (document.getElementById){		
		if (event.which == 13){
			event.returnValue=false;
			event.cancel = true;
			//btn.click(); 
			doPartNumberSearch();
		}
	}
}

function openPopCenter(url,height,width,features){

	// Get left and top coordinates so window can be opened centered on the screen
	var screenx = ((screen.availWidth / 2) - (width / 2))
	var screeny = ((screen.availHeight / 2) - (height / 2))

	var featureList = 'height=' + height + ',width=' + width + ',left=' + screenx + ',top=' + screeny;
	if (features != '')
		featureList += ',' + features
		
	var newWin = window.open(url,"window",featureList);
}

function openEmailWindow(url,height,width,features){

	// Get left and top coordinates so window can be opened centered on the screen
	var screenx = ((screen.availWidth / 2) - (width / 2))
	var screeny = ((screen.availHeight / 2) - (height / 2))

	var featureList = 'height=' + height + ',width=' + width + ',left=' + screenx + ',top=' + screeny;
	if (features != '')
		featureList += ',' + features

	url = url + "?CallingPage=" + window.location

	var newWin = window.open(url,"window",featureList);
}

// JavaScript to interpolate random images into a page.
var ic = 4;					// Number of alternative images
var xoxo = new Array(ic);	// Array to hold filenames
        
xoxo[0] = "/files/swf/auto_4178_08.swf";
xoxo[1] = "/files/swf/computing_4178_05.swf";
xoxo[2] = "/files/swf/ism_4178_05.swf";
xoxo[3] = "/files/swf/meter_4178_10.swf";

function pickRandom(range) {
	if (Math.random)
		return Math.round(Math.random() * (range-1));
	else {
		var now = new Date();
		return (now.getTime() / 1000) % range;
	}
}

// Retrieve random image
var choice = pickRandom(ic);

var DOM = false 
var IE = false 
var NS = false 
 
if (document.getElementById) { DOM = true} 
if (navigator.appName.indexOf("Microsoft Internet Explorer") > -1) IE = true 
if (DOM && !IE) NS = true

function showHide(sTblId)
{

	var tblId
	var moveTable

	tblId = document.getElementById(sTblId)

	if(tblId.style.display=="none")
	{
		tblId.style.display = "block"
		tblId.style.position = "relative"        
        
		if(isNaN(parseInt(tblId.style.left)))
			tblId.oldLeft = 0
		else
			tblId.oldLeft = parseInt(tblId.style.left)

		moveTable = tblId.oldLeft + 20;		
		tblId.style.left = eval(String.fromCharCode(34) + moveTable + "px" + String.fromCharCode(34))
	}
	else
	{
		tblId.style.display = "none"
		tblId.style.position = "relative"
		tblId.style.left = tblId.oldLeft
	}
}

function showHideIcon(sTblId, ico)
{

	var icoObj
	var tblId
	var moveTable

	tblId = document.getElementById(sTblId)
	

	if(tblId.style.display=="none")
	{
		tblId.style.display = "block"
		tblId.style.position = "relative"

		if(isNaN(parseInt(tblId.style.left)))
			tblId.oldLeft = 0
		else
			tblId.oldLeft = parseInt(tblId.style.left)

		moveTable = tblId.oldLeft + 20
		tblId.style.left = eval(String.fromCharCode(34) + moveTable + "px" + String.fromCharCode(34))

		icoObj = document.getElementById(ico)
		icoObj.src = "/images/minus_icon.gif"
	}
	else
	{
		tblId.style.display = "none"
		tblId.style.position = "relative"

		if(!isNaN(tblId.oldLeft))
			tblId.style.left = tblId.oldLeft

		icoObj = document.getElementById(ico)
		icoObj.src = "/images/plus_icon.gif"
	}
}

function doNothing(){}

function showHide2(tblId)
{

	if(tblId.style.display=="none")
	{
		tblId.style.display = "block"
		tblId.style.position = "relative"

		tblId.oldLeft = tblId.style.left
		tblId.style.left = tblId.style.left + 20
	}
	else
	{
		tblId.style.display = "none"
		tblId.style.position = "relative"
		tblId.style.left = tblId.oldLeft
	}
}

function showHideIcon2(tblId, ico)
{

	var icoObj

	if(tblId.style.display=="none")
	{
		tblId.style.display = "block"
		tblId.style.position = "relative"

		tblId.oldLeft = tblId.style.left
		tblId.style.left = tblId.style.left + 20

		icoObj = document.all(ico)
		icoObj.src = "/images/minus_icon.gif"
	}
	else
	{
		tblId.style.display = "none"
		tblId.style.position = "relative"
		tblId.style.left = tblId.oldLeft

		icoObj = document.all(ico)
		icoObj.src = "/images/plus_icon.gif"
	}
}

//--
// Loop through all the elements and any
// table elements with a hidden display
// will be set to inline.
//--
function showAllHidden()
{
	var eleColl
	var showHide
	var showImg
	var i

	eleColl = window.top.document.getElementsByTagName("table")
	showImg = document.getElementById("aShowHide")

	if(showImg.src.indexOf("button_show") != -1)
	{
		showHide = "block"
		showImg.src = "/images/button_hide.gif"
	}
	else
	{
		showHide = "none"
		showImg.src = "/images/button_show.gif"
	}

	for(i=0; i < eleColl.length; i++)
	{
		if(eleColl[i].id != "")
			eleColl[i].style.display = showHide
	}

	//--
	// Code for expander images
	//--
	eleColl = window.top.document.getElementsByTagName("img")
	for(i=0; i < eleColl.length; i++)
	{

//		if(eleColl[i].src.indexOf("/images/plus_icon.gif") != -1)
//			eleColl[i].src = "/images/minus_icon.gif"
//		else if(eleColl[i].src.indexOf("/images/minus_icon.gif") != -1)
//			eleColl[i].src = "/images/plus_icon.gif"
		
		if(showImg.src.indexOf("button_show") != -1 &&
		    (eleColl[i].src.indexOf("/images/minus_icon.gif") != -1 || eleColl[i].src.indexOf("/images/minus_icon.gif") != -1))
		    eleColl[i].src = "/images/plus_icon.gif";
		else if(showImg.src.indexOf("button_show") == -1 &&
		    (eleColl[i].src.indexOf("/images/plus_icon.gif") != -1 || eleColl[i].src.indexOf("/images/plus_icon.gif") != -1))
		    eleColl[i].src = "/images/minus_icon.gif";
	}

}

function moveAttribute(action,lstAtt,lstSelectedAtt){
	
	var frm = document.aspnetForm;
	var lstAttributes = frm.elements[lstAtt];
	var lstSelectedAttributes = frm.elements[lstSelectedAtt];
	var selInd;
	var selValue;
	var selText;
	var upValue;
	var upText;
	
	//Based on the action, move the selected attribute
	if (action == 'Add'){
		selInd = lstAttributes.selectedIndex;
		
		if (selInd == -1){
			alert('Please select an attribute to add.')
			return false;
		}
		
		opt = new Option(lstAttributes.options[selInd].text,lstAttributes.options[selInd].value,true,true);
		lstSelectedAttributes.options[lstSelectedAttributes.length] = opt;				
		lstAttributes.remove(selInd);
	}
	else if (action == 'Remove'){
		selInd = lstSelectedAttributes.selectedIndex;
		
		if (selInd == -1){
			alert('Please select an attribute to remove.')
			return false;
		}				
		opt = new Option(lstSelectedAttributes.options[selInd].text,lstSelectedAttributes.options[selInd].value,false,false);
		lstAttributes.options[lstAttributes.length] = opt;
		lstSelectedAttributes.remove(selInd);
		sortNames(lstAttributes)
	}
	else if (action == 'Up'){

		selInd = lstSelectedAttributes.selectedIndex;

		//If no attribute selected, show message.
		if (selInd == -1){
			alert('Please select an attribute to move up.')
			return false;
		}
		
		//If the first attribute is selected, show message.
		if (selInd == 0){
			alert('This attribute cannot be moved any higher.')
			return false;
		}
		
		selValue = lstSelectedAttributes.options[selInd].value;
		selText = lstSelectedAttributes.options[selInd].text;
		upValue = lstSelectedAttributes.options[selInd - 1].value;
		upText = lstSelectedAttributes.options[selInd - 1].text;
		
		lstSelectedAttributes.options[selInd].value = upValue;
		lstSelectedAttributes.options[selInd].text = upText;
		lstSelectedAttributes.options[selInd - 1].value = selValue;
		lstSelectedAttributes.options[selInd - 1].text = selText;
		
		lstSelectedAttributes.selectedIndex = selInd - 1;				
	}			
	
} //function moveAttribute(frm,action){

//--
// This function keeps the two server listboxes in sync. Viewstate
// does not change for server listboxes so we essentially need to
// rebuild them each time in the event that their data gets changed
// on the client.
//--
function fillSelectedAndAvailable(lstAtt,lstSelectedAtt,hidSelectedAttributes,hidSelectedValues,hidAvailableAttributes,hidAvailableValues)
{
    var frm = document.aspnetForm;
    var lstAttributes = frm.elements[lstAtt];
    var lstSelectedAttributes = frm.elements[lstSelectedAtt];    
	var selectedAttributes
	var availableAttributes
	var oneItem
	var oneValue
	var listItems = ""
	var listValues = ""

	selectedAttributes = lstSelectedAttributes.innerHTML
    
	while(selectedAttributes.length > 0)
	{
		oneValue = selectedAttributes.substring(selectedAttributes.indexOf("value=")+6)
		oneValue = oneValue.substring(0,oneValue.indexOf(">"))
		oneValue = oneValue.replace('"','')
		oneValue = oneValue.replace(" ","")
		oneValue = oneValue.replace("selected","")

		selectedAttributes = selectedAttributes.substring(selectedAttributes.indexOf(">")+1)
		oneItem = selectedAttributes.substring(0,selectedAttributes.indexOf("<"))

		selectedAttributes = selectedAttributes.substring(selectedAttributes.indexOf(">")+1)
		selectedAttributes = selectedAttributes.replace(" ","")

		if(oneItem.length > 0)
		{
			listItems = listItems + oneItem + ","
			listValues = listValues + oneValue + ","
		}
	}

	listItems = listItems.substring(0,listItems.length - 1)
	listValues = listValues.substring(0,listValues.length)

    frm.elements[hidSelectedAttributes].value = listItems;
	frm.elements[hidSelectedValues].value = listValues;	

	listItems = ""
	listValues = ""

	availableAttributes = lstAttributes.innerHTML

	while(availableAttributes.length > 0)
	{
		oneValue = availableAttributes.substring(availableAttributes.indexOf("value=")+6)
		oneValue = oneValue.substring(0,oneValue.indexOf(">"))
		oneValue = oneValue.replace('"','')
		oneValue = oneValue.replace(" ","")
		oneValue = oneValue.replace("selected","")

		availableAttributes = availableAttributes.substring(availableAttributes.indexOf(">")+1)
		oneItem = availableAttributes.substring(0,availableAttributes.indexOf("<"))

		availableAttributes = availableAttributes.substring(availableAttributes.indexOf(">")+1)
		availableAttributes = availableAttributes.replace(" ","")

		if(oneItem.length > 0)
		{
			listItems = listItems + oneItem + ","
			listValues = listValues + oneValue + ","
		}
	}

	listItems = listItems.substring(0,listItems.length - 1)
	listValues = listValues.substring(0,listValues.length - 1)

	frm.elements[hidAvailableAttributes].value = listItems;
	frm.elements[hidAvailableValues].value = listValues;
}

function sortNames(objSelect)
{
    var nameOrder = new Array()

    if (objSelect.options==null)
    {
	    return 
    }

    for (var i=0; i < objSelect.options.length; i++)
    {
	    nameOrder[nameOrder.length] = new Option( objSelect.options[i].text, objSelect.options[i].value, 
		    objSelect.options[i].defaultSelected, objSelect.options[i].selected)
    }

    if (nameOrder.length==0)
    {
	    return
    }

    nameOrder = nameOrder.sort( 
	    function(a,b)
	    { 
		    if ((a.text+"") < (b.text+""))
			    return -1
		    if ((a.text+"") > (b.text+""))
			    return 1

		    return 0
	    } 
	    )

    for (var i=0; i < nameOrder.length; i++)
    {
	    objSelect.options[i] = new Option(nameOrder[i].text, nameOrder[i].value, 
		    nameOrder[i].defaultSelected, nameOrder[i].selected);
    }
}

function Querystring(qs) { // optionally pass a querystring to parse
	this.params = new Object()
	this.get=Querystring_get
	
	if (qs == null)
		qs=location.search.substring(1,location.search.length)

	if (qs.length == 0) return

// Turn <plus> back to <space>
// See: http://www.w3.org/TR/REC-html40/interact/forms.html#h-17.13.4.1
	qs = qs.replace(/\+/g, ' ')
	var args = qs.split('&') // parse out name/value pairs separated via &
	
// split out each name=value pair
	for (var i=0;i<args.length;i++) {
		var value;
		var pair = args[i].split('=')
		var name = unescape(pair[0])

		if (pair.length == 2)
			value = unescape(pair[1])
		else
			value = name
		
		this.params[name] = value
	}
}

function Querystring_get(key, default_) {
	// This silly looking line changes UNDEFINED to NULL
	if (default_ == null) default_ = null;
	
	var value=this.params[key]
	if (value==null) value=default_;
	
	return value
}

// End --> 


