var isDHTML = 0;var isLayers = 0;var isAll = 0;var isID = 0;if(document.getElementById){	isID = 1; 	isDHTML = 1;}else {	browserVersion = parseInt(navigator.appVersion);	if ((navigator.appName.indexOf('Netscape') != -1) && (browserVersion == 4)) 	{		isLayers = 1; 		isDHTML = 1;	}	else 	{		if (document.all) 		{			isAll = 1; 			isDHTML = 1;		}	}}function findDOM(objectID,withStyle) {		var menuArea = "menuArea";	if (withStyle == 1) 	{		if (isID) { return (document.getElementById(objectID).style) ; }		else 		{ 			if (isAll) { return (document.all[objectID].style); }			else 			{				if (isLayers) { return (document.layers[menuArea].layers[objectID]); }			}			}	}	else 	{		if (isID) { return (document.getElementById(objectID)) ; }		else 		{ 			if (isAll) { return (document.all[objectID]); }			else 			{				if (isLayers) { return (document.layers[menuArea].layers[objectID]); }			}		}	}}

function swapClass(objectID, cssClass)
{
	dom = findDOM(objectID, 0);
	dom.className = cssClass;
}

function showMenu(objectID, menuStyle)
{
	domStyle = findDOM(objectID, 1);
	if(menuStyle == 'Sliding')
	{			
		if(domStyle.display == 'none' || domStyle.display == '')			
			domStyle.display = 'block';
		else
			window.alert(domStyle.display);
	}
	else
	{			
		if(domStyle.visibility == 'hidden' || domStyle.visibility == 'hide' || domStyle.visibility == '')
			domStyle.visibility = 'visible';
	}
}

function hideMenu(objectID, menuStyle)
{
	domStyle = findDOM(objectID, 1);
	if(menuStyle == 'Sliding')
	{			
		if(domStyle.display == 'block')
			domStyle.display = 'none';
	}
	else
	{			
		if(domStyle.visibility == 'visible' || domStyle.visibility == 'show')
			domStyle.visibility = 'hidden';
	}	
}// Added Sep 02 09 - SC for homepage changesfunction createCookie(name,value,days) {	if (days) {		var date = new Date();		date.setTime(date.getTime()+(days*24*60*60*1000));		var expires = "; expires="+date.toGMTString();	}	else var expires = "";	document.cookie = name+"="+value+expires+"; path=/";} function readCookie(name) {	var nameEQ = name + "=";	var ca = document.cookie.split(';');	for(var i=0;i < ca.length;i++) {		var c = ca[i];		while (c.charAt(0)==' ') c = c.substring(1,c.length);		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);	}	return null;} function eraseCookie(name) {	createCookie(name,"",-1);} function setVisibility(eid, visibility) {   document.getElementById(eid).style.display = visibility;    createCookie("myVis"+eid,visibility,356);   changeMyImg();}function setVisibility1(id, visibility) {   document.getElementById(id).style.display = visibility; }////END Sep 02 09 Add

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//Added Sep 02 09 - SCfunction MM_openBrWindow(theURL,winName,features) { //v2.0  window.open(theURL,winName,features);}//// End Add
function MM_nbGroup(event, grpName) { //v6.0
var i,img,nbArr,args=MM_nbGroup.arguments;
  if (event == "init" && args.length > 2) {
    if ((img = MM_findObj(args[2])) != null && !img.MM_init) {
      img.MM_init = true; img.MM_up = args[3]; img.MM_dn = img.src;
      if ((nbArr = document[grpName]) == null) nbArr = document[grpName] = new Array();
      nbArr[nbArr.length] = img;
      for (i=4; i < args.length-1; i+=2) if ((img = MM_findObj(args[i])) != null) {
        if (!img.MM_up) img.MM_up = img.src;
        img.src = img.MM_dn = args[i+1];
        nbArr[nbArr.length] = img;
    } }
  } else if (event == "over") {
    document.MM_nbOver = nbArr = new Array();
    for (i=1; i < args.length-1; i+=3) if ((img = MM_findObj(args[i])) != null) {
      if (!img.MM_up) img.MM_up = img.src;
      img.src = (img.MM_dn && args[i+2]) ? args[i+2] : ((args[i+1])?args[i+1] : img.MM_up);
      nbArr[nbArr.length] = img;
    }
  } else if (event == "out" ) {
    for (i=0; i < document.MM_nbOver.length; i++) { img = document.MM_nbOver[i]; img.src = (img.MM_dn) ? img.MM_dn : img.MM_up; }
  } else if (event == "down") {
    nbArr = document[grpName];
    if (nbArr) for (i=0; i < nbArr.length; i++) { img=nbArr[i]; img.src = img.MM_up; img.MM_dn = 0; }
    document[grpName] = nbArr = new Array();
    for (i=2; i < args.length-1; i+=2) if ((img = MM_findObj(args[i])) != null) {
      if (!img.MM_up) img.MM_up = img.src;
      img.src = img.MM_dn = (args[i+1])? args[i+1] : img.MM_up;
      nbArr[nbArr.length] = img;
  } }
}

/* GT - Displays a Credit Card Validation Popup Message*/
function cvvPop(URL) 
{
	day = new Date();
	id = day.getTime();
	eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,width=500,height=425,left = 640,top = 325');");
}

/* GT - Keeps Catalog Request Payment panel from scrolling to bottom.*/
function pScroll(){
	window.scrollTo(0,0);
}

/* GT - Validate Zip Code.*/
/* To use, add onBlur="isZip(MainForm.tbShippingPostCode.value);" to address form. */
function isZip(s) 
{
	// Check for correct zip code
	reZip = new RegExp(/(^\d{5}$)|(^\d{5}-\d{4}$)/);

	if (!reZip.test(s))
	{
		alert("Zip Code Is Not Valid");
		return false;
	}
	return true;
}

/* ViewProducts.aspx */
function findLivePageWidth()
{
	if(window.innerWidth != null)
		return window.innderWidth;
	if(document.body.clientWidth != null)
		return document.body.clientWidth;
	return null;
}

function popUp(evt, objectID, text)
{
	if(isDHTML)
	{
		var livePageWidth = findLivePageWidth();
		domStyle = findDOM(objectID, 1);
		dom = findDOM(objectID, 0);
		dom.innerHTML = text;
		domStyle.width = text.length * .65 + "em";
		state = domStyle.visibility;
		if(dom.offsetWidth)
			elemWidth = dom.offsetWidth;
		else
		{
			if(dom.clip.width)
				elemWidth = dom.clip.width;
		}
		if(state == "visible" || state == "show")
		{
			domStyle.visibility = "hidden";
		}
		else
		{
			if(evt.pageY)
			{
				topVal = evt.pageY - 10;
				leftVal = evt.pageX + 10;
			}
			else
			{
				if(evt.y)
				{
					topVal = evt.y - 10 + document.body.scrollTop;
					leftVal = evt.x + 10 + document.body.scrollLeft;
				}
			}
			if(leftVal < 2)
			{
				leftVal = leftVal - (elemWidth / 2);
			}
			else
			{
				if((leftVal + elemWidth) > livePageWidth)
				{
					leftVal = leftVal - 20 - (elemWidth);
				}
			}				
			domStyle.top = topVal;
			domStyle.left = leftVal;				
			domStyle.visibility = "visible";
		}
	}
}

function popDown(objectID)
{
	domStyle = findDOM(objectID, 1);
	domStyle.visibility = 'hidden';
}

function imgMapClick(anchor)
{				
	document.forms['MainForm'].elements['funcParam'].value = anchor;
}

/* ViewCloseOuts.aspx */
function OpenWindow(ID)
{
	window.open("/shop/closeoutinfo.aspx?ID=" + ID, "MoreInfo", "toolbar=no,scrollbar=no,menubar=no");
}


/* UPPER NAV AND MENU SCRIPTS */

function at_show_aux(parent, child)
{
  var p = document.getElementById(parent);
  var c = document.getElementById(child );

  var top  = (c["at_position"] == "y") ? p.offsetHeight+2 : 0;
  var left = (c["at_position"] == "x") ? p.offsetWidth +2 : 0;

  for (; p; p = p.offsetParent)
  {
    top  += p.offsetTop;
    left += p.offsetLeft;
  }

  c.style.position   = "absolute";
  c.style.top        = top +'px';
  c.style.left       = left+'px';
  c.style.visibility = "visible";
}

function at_show()
{
  var p = document.getElementById(this["at_parent"]);
  var c = document.getElementById(this["at_child" ]);

  at_show_aux(p.id, c.id);
  clearTimeout(c["at_timeout"]);
}

function at_hide()
{
  var p = document.getElementById(this["at_parent"]);
  var c = document.getElementById(this["at_child" ]);

  c["at_timeout"] = setTimeout("document.getElementById('"+c.id+"').style.visibility = 'hidden'", 333);
}

function at_click()
{
  var p = document.getElementById(this["at_parent"]);
  var c = document.getElementById(this["at_child" ]);

  if (c.style.visibility != "visible") at_show_aux(p.id, c.id); else c.style.visibility = "hidden";
  return false;
}

// PARAMETERS:
// parent   - id of the parent html element
// child    - id of the child  html element that should be droped down
// showtype - "click" = drop down child html element on mouse click
//            "hover" = drop down child html element on mouse over
// position - "x" = display the child html element to the right
//            "y" = display the child html element below
// cursor   - omit to use default cursor or specify CSS cursor name

function attach(parent, child, showtype, position, cursor)
{
  var p = document.getElementById(parent);
  var c = document.getElementById(child);

  p["at_parent"]     = p.id;
  c["at_parent"]     = p.id;
  p["at_child"]      = c.id;
  c["at_child"]      = c.id;
  p["at_position"]   = position;
  c["at_position"]   = position;

  c.style.position   = "absolute";
  c.style.visibility = "hidden";

  if (cursor != undefined) p.style.cursor = cursor;

  switch (showtype)
  {
    case "click":
      p.onclick     = at_click;
      p.onmouseout  = at_hide;
      c.onmouseover = at_show;
      c.onmouseout  = at_hide;
      break;
    case "hover":
      p.onmouseover = at_show;
      p.onmouseout  = at_hide;
      c.onmouseover = at_show;
      c.onmouseout  = at_hide;
      break;
  }
}

/* END UPPER NAV AND MENU SCRIPTS */

/*Stored Visibility*/// Sep 02 09 Sc if (readCookie('myVisdisplay_prod')==null) {    createCookie('myVisdisplay_prod', 'inline', 0); }setVisibility('display_prod', readCookie('myVisdisplay_prod'));
