
/********** START Netscape friendly hoover effect **********/
  function errorsuppressor() {
    return true;
  }

  window.onerror=errorsuppressor

  var saved_onOver = new Array();
  var the_onOut;
  var hovrLayr;

  // Used to prevent multiple reloads under NS4.0x
  NS4 = document.layers;
  if (NS4) {
    origWidth = innerWidth;
    origHeight = innerHeight;
  }

  function startHover() {
    if(document.layers) {
      hovrLayr=new Layer(300);
      for(i=0 ; i<document.links.length ; i++)
        if(document.links[i].text != null) {
          if(document.links[i].target == "_self" || document.links[i].target == 'external_link') {
            save_it(document.links[i]);
            document.links[i].onmouseover=hvr_on;
          }
        }
      window.captureEvents(Event.RESIZE);
      window.onresize=handle_resize;
    }
  }

  function save_it(obj) {
    var hash_it = "onM" + obj.x + "_" + obj.y;
    saved_onOver[hash_it] = obj.onmouseover;
  }

  function hvr_on(evt) {
    var obj=evt.target;
    var hash_it = "onM" + obj.x + "_" + obj.y;
    var hovr_txt = "<A HREF=\"" + obj.href + "\"";

    if(obj.target)
      hovr_txt += (" TARGET=\"" + obj.target + "\"");
    hovr_txt += (" onMouseOut=\"hvr_off()\">" +obj.text+ "</A>");
    hovrLayr.document.open();
    hovrLayr.document.write(hovr_txt);
    hovrLayr.document.close();
    hovrLayr.left=obj.x;
    hovrLayr.top =obj.y;
    hovrLayr.document.links[0].onmouseover = saved_onOver[hash_it];
    hovrLayr.document.links[0].onclick     = obj.onclick;
    hovrLayr.visibility = "show";
    the_onOut=obj.onmouseout;
  }

  function hvr_off() {
    hovrLayr.visibility = "hide";
    if(the_onOut)
      (the_onOut)();
  }

  function handle_resize() {
    if (innerWidth != origWidth || innerHeight != origHeight) {
      location.reload();
      return false;
    }
  }

  function nsHover() {
    if(!document.layers) return;

    document.tags.A.fontFamily     = "arial,helvetica,sans-serif";
    document.tags.A.fontSize       = "10px";
    document.tags.A.color          = "#990000";
    document.tags.A.textDecoration = "none";

    startHover();
  }
/********** END Netscape friendly hoover effect **********/


/********** START cross-browser layer toggle from ourPartner **********/
  if (navigator.appName == "Netscape") {
    useLayer="document.layers";
    useStyle="";
  } else {
    useLayer="document.all";
    useStyle=".style";
  }

  function showLayer(thisLayer) {
    eval(useLayer+'["'+thisLayer+'"]'+useStyle+'.visibility="visible"');
  }

  function hideLayer(thisLayer) {
    eval(useLayer+'["'+thisLayer+'"]'+useStyle+'.visibility="hidden"');
  }
/********** END cross-browser layer toggle from ourPartner **********/


/********** START Window Functions **********/
	//HC:Popup window script that is dynamic and will regain focus
	// Modified link system to use this one script and pass parameters
	// for lighter page weight and more flexibility.
	function pop(u,n,f){
		var d = "default";
		var sf = "directories,location,menubar,resizable,scrollbars,status,toolbar";
		if (!n){n = d}
		if (!f){f = sf}
		pw = window.open(u,n,f);
		pw.focus();
	}

	// AP: This function changes the location of the Parent window and closes the corresponding pop-up
	function changeParentWindow(url) {
		opener.location=url;
		self.close();
		opener.focus();
	}

	function changeParentFrameWindow(url) {
		opener.top.location.href=url;
		self.close();
		opener.focus();
	}

	function closeWindow() {
		self.close ()
	}

	// AP: Timed window function, takes time parameter in seconds
	var timerID = null;
	function wait(time) {
		timerID = setTimeout("closeWindow()",time*1000)
	}
/********** END Window Functions **********/


/********** START Flash detection script. **********/
  var isIE = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;
  var isWin = (navigator.appVersion.indexOf("Windows") != -1) ? true : false;

  var hasFlash3 = false;
  var hasFlash4 = false;
  var hasFlash5 = false;
  var pluginVersion = 0;

  function flashDetect() {
    if (isIE && isWin) {
      document.writeln('<SCRIPT language="VBScript">');
      document.writeln('on error resume next');
      document.writeln('hasFlash5 = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.5")))');
      document.writeln('hasFlash4 = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.4")))');
      document.writeln('hasFlash3 = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.3")))');
      document.writeln('</SCR'+'IPT\>');
    } else if (navigator.plugins.length>0) {
      if(navigator.plugins["Shockwave Flash"]) {
        var flashDescriptor = navigator.plugins["Shockwave Flash"].description;
        pluginVersion = parseInt(flashDescriptor.charAt(flashDescriptor.indexOf('.') - 1));
        switch(pluginVersion) {
          case 5: hasFlash5 = true;
          case 4: hasFlash4 = true;
          case 3: hasFlash3 = true;
        }
      }
    }
  }

  function pluginAlert() {
    if(hasFlash5==true) {
      alert("Flash 5 supported");
    }
    if(hasFlash4==true) {
      alert("Flash 4 supported");
    }
    if(hasFlash3==true) {
      alert("Flash 3 supported");
    }
  }

  flashDetect()
/*********** END Flash detection script. **********/


/*********** BEGIN buildFeaturedBrandsURL **********/
	// JC: This function is used to parse entries in the featuredBrandsDropdown (used on main 8 cat_01 & cat_04 pages).
	// Allows us to mix/match syndicated URLs, Product IDs and pop-up windows.
	function buildFeaturedBrandsURL() {
		Current = document.featuredBrands.FeaturedBrand.selectedIndex;
		Value = document.featuredBrands.FeaturedBrand.options[Current].value;
		if (Value != "NOSELECTION"){
			if (isNumber(Value)) {
				document.featuredBrands.submit();
			}
			else {
				location.href=Value;
			}
		}
	}

	// JC: Test to differentiate between syndicated URLs and Product IDs. Called by buildFeaturedBrandsURL().
	function isNumber(Input){
		var numbers = "0123456789";
		var CharacterCheck = "";
		var counter = 0;

		for (var i=0; i < Input.length; i++) {
			CharacterCheck = Input.substring(i,i+1);
			if (numbers.indexOf(CharacterCheck) != -1){
				counter ++;
			}
		}
		if (counter != Input.length) {
			return false;
		}
		else {
			return true;
		}
	}
/*********** END buildFeaturedBrandsURL **********/


//JC:16.1 Function used to add tracking info
function trackURL(URL,type) {
	var                   LinkType  = "&LinkType=";
	if      (type == "E") LinkType += "EverGreen";
	else if (type == "D") LinkType += "DepthPath";
	else if (type == "F") LinkType += "FlyOut";
	else                  LinkType += "Unknown";
	var newURL = URL + ((URL.indexOf('?') != -1)? LinkType : "?" + LinkType);
	window.location.href = newURL;
}


		