<!--
// PRELOAD & SWAP IMAGES
// 
function swapImgRestore() { //v3.0
  var i,x,a=document.sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.p) d.p=new Array();
    var i,j=d.p.length,a=preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.p[j]=new Image; d.p[j++].src=a[i];}}
}

function 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=findObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}

function swapImage() { //v3.0
  var i,j=0,x,a=swapImage.arguments; document.sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=findObj(a[i]))!=null){document.sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function fncLoad() {
	preloadImages('/img/btn-home-dn.gif','/img/btn-newproducts-dn.gif','/img/btn-specials-dn.gif','/img/btn-account-dn.gif','/img/btn-cart-dn.gif','/img/btn-checkout-dn.gif','/img/nav-contact-dn','/img/nav-support-dn','/img/nav-account-dn','/img/nav-privacy-dn')
}

// REMOVE IE LINK BOX //

function CSRemoveIEbox(){
if (document.images&&navigator.userAgent.indexOf("MSIE")!=-1){
	for(i=0;i<document.links.length;i++){
		target=eval("document.links[i]")
		target.onfocus=blurHandler
		}
	}
}

function blurHandler(){
obj=window.event.srcElement
if(obj.tagName == "A"||obj.tagName=="AREA") obj.blur()
}

// ONMOUSEOVER BORDER CHANGE //

function flipBgColor(This, color) { if(This.style) { This.style.background = color;} return true; }

function fncCenteredChildWindow(URL,vHeight,vWidth,vScroll,vStatus) {
	if (screen.width) {
		var winl=(screen.width-vWidth)/2;
		var wint=(screen.height-vHeight)/2;
	} else { 
		winl=0;wint=0;
	}
	if(winl<0)winl=0;
	if(wint<0)wint=0;
	var child = window.open(URL,'myWin','height='+vHeight+',width='+vWidth+',scrollbars='+vScroll+',status='+vStatus+',top='+wint+',left='+winl+',resizable=no');
	child.focus();
}

//require fields in a form and redirect to url
function fncSubmit(obj,url) {
	var req = obj.required_fields;
	var submitflag = true;
	var notice = "Some of the required fields are blank:\n\n";
	if (req) {
		//Means the required fields are present, let's check for values
		var arrFields = obj.required_fields.value.split("|")
		for(var x=0; x<=arrFields.length-1; x++) {
			var arrName = arrFields[x].split(",");
			arrLabel=arrName[0];
			
			if (obj.elements[arrLabel]){
				
				var str = "if (obj."+arrName[0]+".value == '') { notice += '-->  "+arrName[1]+"\\n'; submitflag = false;}";
				eval(str);
			}
    }
		notice += "\nPlease fill in these fields and resubmit!";
	} else {
		//Means there isn't a required fields parameter; keep going
	}
	if (submitflag) {
		
		obj.action = url;
		obj.submit();
	} else {
		alert(notice);
	}
}

function cartSubmit(obj, incId){
		
		obj.includeProdId.value =  incId;
		obj.submit();
}


/////////////////////////////// image pop up




/***********************************************
* Cool DHTML tooltip script- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/

var offsetxpoint=-60 //Customize x offset of tooltip
var offsetypoint=20 //Customize y offset of tooltip
var ie=document.all
var ns6=document.getElementById && !document.all
var enabletip=false
if (ns6||ie)
var tipobj=document.getElementById? document.getElementById("dhtmltooltip") : document.all? document.all["dhtmltooltip"] : ""
//var tipobj = document.getElementById("dhtmltooltip")

function ietruebody(){
	return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function rciImagetip(thetext, thecolor, thewidth){
	if (ns6||ie && tipobj.style != null){
		if (typeof thewidth!="undefined" && tipobj != "") tipobj.style.width=thewidth+"px"
		if (typeof thecolor!="undefined" && thecolor!="" && tipobj != "") tipobj.style.backgroundColor=thecolor
		tipobj.innerHTML=thetext
		enabletip=true
		return false
	}
}

function positiontip(e){
	if (enabletip){
		var curX=(ns6)?e.pageX : event.clientX+ietruebody().scrollLeft;
		var curY=(ns6)?e.pageY : event.clientY+ietruebody().scrollTop;
		//Find out how close the mouse is to the corner of the window
		var rightedge=ie&&!window.opera? ietruebody().clientWidth-event.clientX-offsetxpoint : window.innerWidth-e.clientX-offsetxpoint-20
		var bottomedge=ie&&!window.opera? ietruebody().clientHeight-event.clientY-offsetypoint : window.innerHeight-e.clientY-offsetypoint-20

		var leftedge=(offsetxpoint<0)? offsetxpoint*(-1) : -1000
		
		//if the horizontal distance isn't enough to accomodate the width of the context menu
		if (rightedge<tipobj.offsetWidth)
			//move the horizontal position of the menu to the left by it's width
			tipobj.style.left=ie? ietruebody().scrollLeft+event.clientX-tipobj.offsetWidth+"px" : window.pageXOffset+e.clientX-tipobj.offsetWidth+"px"
		else if (curX<leftedge)
			tipobj.style.left="5px"
		else
			//position the horizontal position of the menu where the mouse is positioned
			tipobj.style.left=curX+offsetxpoint+"px"
	
	//same concept with the vertical position
		if (bottomedge<tipobj.offsetHeight)
			tipobj.style.top=ie? ietruebody().scrollTop+event.clientY-tipobj.offsetHeight-offsetypoint+"px" : window.pageYOffset+e.clientY-tipobj.offsetHeight-offsetypoint+"px"
		else
			tipobj.style.top=curY+offsetypoint+"px"
			tipobj.style.visibility="visible"
	}
}

function hiderciImagetip(){
	if (ns6||ie && tipobj.style != null){
		enabletip=false
		tipobj.style.visibility="hidden"
		tipobj.style.left="-1000px"
		tipobj.style.backgroundColor=''
		tipobj.style.width=''
	}
}

document.onmousemove=positiontip
/////////////////////////////////  end image pop code
//-->