var next_off = new Image();   next_off.src = "/skins/skin_7/images/product/link_next_image.off.gif";
var next_on = new Image();   next_on.src = "/skins/skin_7/images/product/link_next_image.on.gif";

var previous_off = new Image();   previous_off.src = "/skins/skin_7/images/product/link_prev_image.off.gif";
var previous_on = new Image();   previous_on.src = "/skins/skin_7/images/product/link_prev_image.on.gif";

function turnon(div)
{

	var ie=document.all
	var ns6=document.getElementById && !document.all
	var enabletip=false
	if (ie||ns6)
	var thediv=document.all? document.all[div] : document.getElementById? document.getElementById(div) : ""

	function ietruebody(){
	return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
	}

	// modified by celst 03.15.06
	// Simple follow the mouse script
	// copyright Stephen Chapman, 30th September 2005
	// you may copy this script provided that you retain the copyright notice

	// positioning code lifted from:
/***********************************************
* Cool DHTML tooltip script II- © 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 offsetfromcursorX=-280 //Customize x offset of tooltip
	var offsetfromcursorY=10 //Customize y offset of tooltip
		
	// no changes required below this line
	function mouseX(evt)
	{
	
		/*
		if (!evt) evt = window.event;
		
		if (evt.pageX) return evt.pageX; 
		
		else if (evt.clientX) return evt.clientX + (document.documentElement.scrollLeft ?  document.documentElement.scrollLeft : document.body.scrollLeft); 
	
		else return 0;
		*/
		
		var curX=(ns6)?evt.pageX : event.clientX+ietruebody().scrollLeft;

		var winwidth=ie&&!window.opera? ietruebody().clientWidth : window.innerWidth-20

		var rightedge=ie&&!window.opera? winwidth-event.clientX-offsetfromcursorX : winwidth-evt.clientX-offsetfromcursorX
		var leftedge=(offsetfromcursorX<0)? offsetfromcursorX*(-1) : -1000
		
		if (rightedge<thediv.offsetWidth){
		//move the horizontal position of the menu to the left by it's width
		return curX-thediv.offsetWidth
			}
		else if (curX<leftedge)
			return 5
		else
			//position the horizontal position of the menu where the mouse is positioned
			return curX+offsetfromcursorX

		
	} 
	
	function mouseY(evt) 
	{
		/*
		if (!evt) evt = window.event;
		
		if (evt.pageY) return evt.pageY;
	
		else if (evt.clientY)return evt.clientY + (document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop);
	
		else return 0;
		*/
		
		var curY=(ns6)?evt.pageY : event.clientY+ietruebody().scrollTop;
		
		var winheight=ie&&!window.opera? ietruebody().clientHeight : window.innerHeight-20
		
		var bottomedge=ie&&!window.opera? winheight-event.clientY-offsetfromcursorY : winheight-evt.clientY-offsetfromcursorY
		
		if (bottomedge<thediv.offsetHeight)
			return curY-thediv.offsetHeight-offsetfromcursorY
		else
			return curY+offsetfromcursorY

	}
	
	
	function follow(evt)
	{
		if (document.getElementById)
		{
			var obj = document.getElementById(div).style;
			obj.left = (parseInt(mouseX(evt))) + 'px';  obj.top = (parseInt(mouseY(evt))) + 'px';
	
		}
	} 
	
	document.onmousemove = follow;

	// change display css to block
	// put this at the end or PCI makes it appear early
	thediv.style.display="block";

}

function devNull() {
	return false;
}


function turnoff(div)
{
	var thediv = document.getElementById(div);
  
  document.onmousemove = devNull;
	// change display css to none
	thediv.style.display="none";
			thediv.style.left = '-9999px';  thediv.style.top = '-9999px';
}

function prevImage() {
	if (!((ProductPicIndex - 1) < 1))
	{
		ProductPicIndex -= 1;
		setcolorpicidx(ProductPicIndex);
		if (ProductPicIndex == 1) {
			document.getElementById("prev_link").src = previous_off.src;
		}
		document.getElementById("next_link").src = next_on.src;
	}
}

function nextImage() {
	if (!((ProductPicIndex + 1) > pixcount) && (ProductPicIndex != pixcount))
	{
		ProductPicIndex += 1;
		setcolorpicidx(ProductPicIndex);
		if (ProductPicIndex == pixcount) {
			document.getElementById("next_link").src = next_off.src;
		}
		document.getElementById("prev_link").src = previous_on.src;
	}
}

