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];}}
}

var win= null;
function NewWindow(mypage,w,h){
window.open (mypage, 'newwindow', config='height='+h+',width='+w+', toolbar=no, menubar=no, scrollbars=no, resizable=no,location=no, directories=no, status=no')
}

 function doClear(theText) 
{
     if (theText.value == theText.defaultValue)
 {
         theText.value = ""
     }
 }


function MM_openBrWindow(theURL,winName,features) { //v2.0
  mywindow = window.open(theURL,winName,features);
  mywindow.moveTo("right","top");

}
//-->
function setParentItemCount(numItems){
   if(document.getElementById("cart_item_count"))
      document.getElementById("cart_item_count").innerHTML = numItems;
}
function setParentCartTotal(total){
   if(document.getElementById("cart_total"))
      document.getElementById("cart_total").innerHTML = total;
}

var lastID = 0;

function changepic(showpic,whichImg,itemID) {
if (lastID > 0) {
document.getElementById(lastID).className = "thumbNormal";
}
	document.images["mainpic"].src="/order/productphotos/"+showpic;
	document.getElementById(whichImg).className = "thumbHighlighted";
	document.getElementById('mainpicURL').href="javascript:MM_openBrWindow('/includes/GetPhotos.asp?ID=" + itemID + "&img=" + whichImg + "','ImageCart','scrollbars=no,width=525,height=700')";
	//document.getElementById(whichImg).style.borderColor="red";
	//document.getElementById(whichImg).style.borderStyle="solid";
	//document.getElementById(whichImg).style.borderWidth="thin";
lastID = whichImg;
	
}

var ie=document.all
var ns6=document.getElementById && !document.all

function mp3show(thetext){
if (ns6||ie){
document.getElementById("mp3player").innerHTML=thetext;
document.getElementById("mp3player").style.visibility="visible";
document.getElementById("mp3playercontainer").style.visibility="visible";
document.getElementById("mp3playerstop").style.visibility="visible";
return false
}
}

function mp3hide(){
if (ns6||ie){
document.getElementById("mp3player").innerHTML="";
document.getElementById("mp3player").style.visibility="hidden";
document.getElementById("mp3playercontainer").style.visibility="hidden";
document.getElementById("mp3playerstop").style.visibility="hidden";
return false
}
}

function mpVshow(thetext){
if (ns6||ie){
document.getElementById("mpVplayer").innerHTML=thetext;
document.getElementById("mpVplayer").style.visibility="visible";
document.getElementById("mpVplayercontainer").style.visibility="visible";
document.getElementById("mpVplayerstop").style.visibility="visible";
return false
}
}

function mpVhide(){
if (ns6||ie){
document.getElementById("mpVplayer").innerHTML="";
document.getElementById("mpVplayer").style.visibility="hidden";
document.getElementById("mpVplayercontainer").style.visibility="hidden";
document.getElementById("mpVplayerstop").style.visibility="hidden";
return false
}
}

function mpTshow(thetext){
if (ns6||ie){
document.getElementById("tutorialplayer").innerHTML=thetext;
document.getElementById("tutorialplayer").style.visibility="visible";
document.getElementById("tutorialplayercontainer").style.visibility="visible";
document.getElementById("tutorialplayerstop").style.visibility="visible";
return false
}
}

function mpThide(){
if (ns6||ie){
document.getElementById("tutorialplayer").innerHTML="";
document.getElementById("tutorialplayer").style.visibility="hidden";
document.getElementById("tutorialplayercontainer").style.visibility="hidden";
document.getElementById("tutorialplayerstop").style.visibility="hidden";
return false
}
}


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 (ie || ns6)
    var tipobj = document.all ? document.all["dhtmltooltip"] : document.getElementById ? document.getElementById("dhtmltooltip") : ""

function ietruebody() {
    return (document.compatMode && document.compatMode != "BackCompat") ? document.documentElement : document.body
}

function ddrivetip(thetext, thecolor, thewidth) {
    if (ns6 || ie) {
        if (typeof thewidth != "undefined") tipobj.style.width = thewidth + "px"
        if (typeof thecolor != "undefined" && thecolor != "") tipobj.style.backgroundColor = thecolor
        tipobj.style.display = "block"
        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 = "20px";

        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 hideddrivetip() {
    if (ns6 || ie) {
        enabletip = false
        tipobj.style.visibility = "hidden"
    }
}

document.onmousemove = positiontip