var IE4 = (document.all)? true:false;
var IE5 = false;
var MOZ = false;

if (IE4) {	
	if (navigator.userAgent.indexOf('MSIE 5')>0) {	
		IE5 = true;	
	}
}

if(navigator.userAgent.indexOf("Gecko") != -1)
{
	MOZ = true;
}

// If the browser is not IE, we assume that the browser is NS.
var IE = document.all?true:false
// If NS -- that is, !IE -- then set up for mouse capture
if (!IE) document.captureEvents(Event.MOUSEMOVE)
// Set-up to use getMouseXY function onMouseMove
document.onmousemove = getMouseXY;
// Temporary variables to hold mouse x-y pos.s
var tempX = 0
var tempY = 0

function showColor(desc)
{

	var colorLyr = "colorDesc";
	if (IE4)
	{
		colorLyr=eval(colorLyr);
		colorLyr.innerHTML = "<b>"+desc+"</b"; 
	}
	else if (MOZ)
	{
		document.getElementById(colorLyr).innerHTML = desc;
	}
	else{
	}
}

function flipColor(url)
{
	var swatchID = document.getElementById('bigSwatch');
	swatchID.src=url;
	return false;

}

function clearColor()
{

	var colorLyr = "colorDesc";
	var clearText = "Move your mouse over a color name";
	if (IE4)
	{
		colorLyr=eval(colorLyr);
		colorLyr.innerHTML = clearText; 
	}
	else if (MOZ)
	{
		document.getElementById(colorLyr).innerHTML = clearText;
	}
	else{
	}
}

function openColor(PN,ColorURL)
{
        colorWindow=window.open('/color_popup.php?pn='+PN+'&cu='+ColorURL,'CW','toolbar=no,location=no,directories=no,status=no,menubar=no,resizeable=yes,width=250,height=375');
}

// additions to simply open the color swatch instead of opening a new browser window

function popUpColor(ColorURL, ColorName) // for the color swatch pop ups
{
	
	object = document.getElementById('colorPopUp');
	object.innerHTML="<img src='" + ColorURL + "' width='150'><br /><center>" + ColorName + "</center>";
	object.style.visibility = 'visible';
	//object.style.left = getPosition(event).x +40;
	
	object.style.top = tempY - 210;
	object.style.left = 500;
	//object.style.top = 120;
	
}

function popUpColorSearch(ColorURL, ColorName) // When shopping by color
{
	
	object = document.getElementById('colorPopUpSearch');
	object.innerHTML="<img src='" + ColorURL + "' width='140'><br /><center>" + ColorName + "</center>";
	object.style.visibility = 'visible';
	//object.style.left = getPosition(event).x +40;
	
	object.style.top = 127;
	object.style.left = 9;
	//object.style.top = 120;
	
}

function popHideColor()
{	
	object.style.visibility = 'hidden';
	object = null;
}


function getMouseXY(e) {
  if (IE) { //  x-y pos.s if browser is IE
    tempX = event.clientX + document.body.scrollLeft
    tempY = event.clientY + document.body.scrollTop
  } else {  //  x-y pos.s if browser is NS, FF
    tempX = e.pageX
    tempY = e.pageY
  }  

 
  return tempX, tempY, true
}

function selectColor(color)
{
	document.getElementById("" + color + "").selected = true;
}



