function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr,args=MM_swapImgRestore.arguments; if(args.length > 0 && args[0] == args[1]) return; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
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_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];}
}
// Write Page Borders based on Browser versions
if (navigator.userAgent.indexOf('MSIE 5') != -1 && navigator.userAgent.indexOf('Mac_PowerPC') != -1) {
	document.write("<style>");
	document.write('#border-top { height:30px;  background-repeat:no-repeat; background-image: url(/images/border-top.gif); }');
	document.write('#border-left { width:30px; height:100%; background-image: url(/images/border-left.gif); }');
	document.write('#border-right {	width:30px;	height:100%; background-image: url(/images/border-right.gif); }');
	document.write('#border-bottom { height:30px; background-repeat:no-repeat; background-image: url(/images/border-bottom.gif); }');
	document.write('</style>');
}
else if (ie==0) {
	document.write("<style>");
	document.write('#border-top { height:30px;  background-repeat:no-repeat; background-image: url(/images/border-top.png); }');
	document.write('#border-left { width:30px; height:100%; background-image: url(/images/border-left.png); }');
	document.write('#border-right {	width:30px;	height:100%; background-image: url(/images/border-right.png); }');
	document.write('#border-bottom { height:30px; background-repeat:no-repeat; background-image: url(/images/border-bottom.png); }');
	document.write('</style>');
}
else {
	document.write("<style>");
	document.write("#border-top { height:30px;  background-repeat:no-repeat;filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, sizingMethod=scale, src='/images/border-top.png'); }");
	document.write("#border-left { width:30px; height:100%; filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, sizingMethod=scale, src='/images/border-left.png'); }");
	document.write("#border-right {width:30px;height:100%; filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, sizingMethod=scale, src='/images/border-right.png'); }");
	document.write("#border-bottom{ height:30px; background-repeat:no-repeat; filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, sizingMethod=scale, src='/images/border-bottom.png'); }");
	document.write('</style>');
}
function ShowProductZoom(productID)
{
	OpenCenterPopup('productzoom-' + productID + '.htm','Zoom',519,519,0,0,0,0,0);
}
function ShowProductSwatch(swatchname,width,height)
{
	OpenCenterPopup(swatchname + '.htm','Swatch',width,height,0,0,0,0,0);
}
var win= null;
function OpenCenterPopup(page,name,w,h,scrollbars,resizable,toolbar,menubar,location)
{
	var winl = (screen.width-w)/2;
	var wint = (screen.height-h)/2;
	var settings ='height='+h+',';
	settings +='width='+w+',';
	settings +='top='+wint+',';
	settings +='left='+winl+',';
	settings +='scrollbars='+scrollbars+',';
	settings +='resizable='+resizable+',';
	settings +='menubar='+menubar+',';
	settings +='location='+location+',';
	settings +='toolbar='+toolbar;
	win=window.open(page,name,settings);
	if(parseInt(navigator.appVersion) >= 4){win.window.focus();}
} 
/* Client-side access to querystring name=value pairs
	Version 1.2.3
	22 Jun 2005
	Adam Vandenberg
*/
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
}
function popupWindow(asset,style)
{
	if (style == 'external') {
		document.popWin = window.open(asset, 'JudyVetter','height=625,width=750,location=yes,scrollbars=yes,menubars=yes,toolbars=yes,resizable=yes,status=yes,top=150,left=150');
	} else if (style == 'internal') {
		document.popWin = window.open(asset, 'JudyVetter','height=625,width=750,location=no,scrollbars=yes,menubars=no,toolbars=no,resizable=yes,status=no,top=150,left=150');
	} else if (style == 'pdf') {
		//alert(navigator.userAgent);
		if(navigator.userAgent.indexOf('Safari') != -1) {
			//Safari
			window.location = asset;
		} else if(navigator.userAgent.indexOf('Mac') != -1) {
			//Mac Power PC
			document.location = asset;
		} else if(navigator.userAgent.indexOf('Opera') != -1) {
			//Opera
			document.location = asset;
		} else {
			//Other
			document.popWin = window.open(asset, 'JudyVetter','height=625,width=750,location=no,scrollbars=yes,menubars=no,toolbars=no,resizable=yes,status=no,top=150,left=150');
		}
	}
	document.popWin.focus();
}