function MM_findObj(n, d) { //v4.0
  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 && document.getElementById) x=document.getElementById(n); return x;
}

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_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
// -->

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];}
}

function MM_showHideLayers() { //v3.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v='hide')?'hidden':v; }
    obj.visibility=v; }
}

function clearSearch() {
	if (searchform.words.value == 'keyword or catalog quick shop') {
		searchform.words.value = '';
	}
}


function WS_hideall() {
	MM_showHideLayers('catlayer1','','hide');
	MM_showHideLayers('catlayer2','','hide');
	MM_showHideLayers('catlayer3','','hide');
	MM_showHideLayers('catlayer4','','hide');
	MM_showHideLayers('catlayer5','','hide');
}
	
function WS_initialize() {
	WS_hideall();		
	MM_swapImgRestore();
}

function WS_showCurrent () {
	WS_hideall();
	MM_showHideLayers('catlayer2','','show');
}

var WS_menu=null;

function WS_doinCat(num) {
	MM_swapImgRestore();
	// MM_swapImage('cat' + num,'',switchOn,1);
	MM_swapImage('cat' + num,'',eval('cat' + num + 'on'),1);
	MM_showHideLayers('catlayer' + num,'','show');
	if (WS_menu != null) {window.clearTimeout(WS_menu);}
}

function WS_dooutCat(num) {
	if (WS_menu != null) {window.clearTimeout(WS_menu);}
	WS_menu=window.setTimeout('WS_initialize()',500);
}

function createPopUp (url, name, optionString) {
	if (url.length == 0) { var url = "/view.cfm?pop=1"; }
	if (name.length == 0) { var name = "newwnd"; }
	if (optionString.length == 0) { var optionString = "toolbar=no,location=no,directories=no,scrollbars=yes,resizable=yes,height=520,width=390,screenX=4,screenY=4,top=4,left=4"; }
	win = window.open (url, name, optionString);
	win.focus ();
}

// for cart popups
function createCartPopUp(url, name, optionString) {
	if (!name){
		name = "newwnd";
	}
	if (!optionString){
		optionString = "toolbar=no,location=no,directories=no,scrollbars=1,resizable=0,height=390,width=470,screenX=4,screenY=4,top=4,left=4";
	}		
	win = window.open(url, name, optionString);
	win.focus();
}

var supported = navigator.userAgent.indexOf("Mozilla") == 0 && navigator.userAgent.substring(8,9) >= 3;
function shiptoPopUp(filename, windowname, width, height) {
	if(supported) {
		popup = window.open(filename,windowname,"resizable=yes,scrollbars=yes,status=no,width="+width+",height="+height);
		popup.focus();
		return false;
	} else {
		return true;
	}
}

function LinkFromFlash(href, redirect) {
	var confirm_redirect = true;
	// Add dbcmlv=1 to the URL to debug
	// (Short for DeBug CoreMetrics LiveView)
	if (document.URL.indexOf('dbcmlv=1') != -1) {
		if (redirect) {
			confirm_redirect = confirm("LinkFromFlash, OK to redirect:\nHref: "
										+ href + "\nName: " + name);
		} else {
			alert("LinkFromFlash:\nHref: " + href + "\nName: " + name);
		}
	}
	if (redirect && confirm_redirect) {
		document.location = href;
	}
}

// Gift Footer
function WS_hideallGiftFooter() {
	MM_showHideLayers('tcontent1','','hide');
	MM_showHideLayers('tcontent2','','hide');
	MM_showHideLayers('tcontent3','','hide');
}

function WS_showGiftFooter(tnum) {
	WS_hideallGiftFooter();
	MM_swapImgRestore(); 
	MM_showHideLayers('tcontent' + tnum,'','show');
}
