var gSafeOnload = new Array();
function SafeAddOnload(f)
{
	if  (window.onload)
	{
		if (window.onload != SafeOnload)
		{
			gSafeOnload[0] = window.onload;
			window.onload = SafeOnload;
		}		
		gSafeOnload[gSafeOnload.length] = f;
	}
	else
		window.onload = f;
}
function SafeOnload()
{
	for (var i=0;i<gSafeOnload.length;i++)
		gSafeOnload[i]();
}
function imgHover(this_img, action)
{
	if (action == 0)
	{
		this_img.style.moz_opacity = .6;
		this_img.style.opacity = .6;
		this_img.style.filter = 'alpha(opacity=60)';
	}
	else
	{
		this_img.style.moz_opacity = 1;
		this_img.style.opacity = 1
		this_img.style.filter = 'alpha(opacity=100)';
	}
}

function keepHighlighted(id,disp)
{
	image = document.getElementById('navimg_' + id);
	imgHover(image, disp);

}

/* Code for IE rollovers */
startList = function() {

	if (document.all&&document.getElementById) {
		navRoot = document.getElementById("nav");
		for (i=0; i<navRoot.childNodes.length; i++) {
			node = navRoot.childNodes[i];
			if (node.nodeName=="LI") {
				node.onmouseover=function() {
					this.className+=" over";
				}
				node.onmouseout=function() {
					this.className=this.className.replace(" over", "");
				}
			}
		}
	}
}
SafeAddOnload(startList);






/*
Simple Image Trail script- By JavaScriptKit.com
Visit http://www.javascriptkit.com for this script and more
This notice must stay intact
*/

var offsetfrommouse	= [10,10]; //image x,y offsets from cursor position in pixels. Enter 0,0 for no offset
var imageHeight 	= 100;
var imageWidth		= 300;
if (document.getElementById || document.all)
{
	document.write('<div id="trailimageid">');
	document.write('</div>');
}

function gettrailobj()
{
	if (document.getElementById)
	return document.getElementById("trailimageid").style
	else if (document.all)
	return document.all.trailimagid.style
}

function gettrailobjnostyle()
{
	if (document.getElementById)
	return document.getElementById("trailimageid")
	else if (document.all)
	return document.all.trailimagid
}


function truebody(){
return (!window.opera && document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function showtrail(imagename)
{
	if (imagename != '' && imagename != 'images/')
	{
		document.onmousemove=followmouse;
	
		newHTML = '<div class="preview-box">';
		newHTML = newHTML + '<img src="' + imagename + '" class="border-space" alt="" id="thisImage" />';
		newHTML = newHTML + '</div>';
	
		gettrailobjnostyle().innerHTML = newHTML;
	
		imageWidth = document.getElementById('thisImage').width;
		imageHeight= document.getElementById('thisImage').height;
	
		gettrailobj().visibility="visible";
	}
}


function hidetrail()
{
	gettrailobj().visibility="hidden";
	document.onmousemove = stopfollow;
}

function followmouse(e)
{

	var xcoord=offsetfrommouse[0]
	var ycoord=offsetfrommouse[1]

	var docwidth=document.all? truebody().scrollLeft+truebody().clientWidth : pageXOffset+window.innerWidth-15
	var docheight=document.all? Math.min(truebody().scrollHeight, truebody().clientHeight) : Math.min(window.innerHeight)

	imageWidth  = imageWidth < 100 ? 100 : imageWidth;
	imageHeight = imageHeight < 100 ? 100 : imageHeight;
	
	if (typeof e != "undefined"){
		if (docwidth - e.pageX < imageWidth){
			xcoord = e.pageX - xcoord - imageWidth - 20; // Move to the left side of the cursor
		} else {
			xcoord += e.pageX;
		}
		
		if (docheight - e.pageY < (imageHeight)){
			ycoord += e.pageY - Math.max(0,(imageHeight + 20 + e.pageY - docheight - truebody().scrollTop));
		} else {
			ycoord += e.pageY;
		}

	} else if (typeof window.event != "undefined"){
		if (docwidth - event.clientX < imageWidth){
			xcoord = event.clientX + truebody().scrollLeft - imageWidth - 20; // Move to the left side of the cursor
		} else {
			xcoord += truebody().scrollLeft+event.clientX
		}
		if (docheight - event.clientY < imageHeight){
			ycoord += event.clientY + truebody().scrollTop - Math.max(0,(imageHeight + 20  + event.clientY - docheight));
		} else {
			ycoord += truebody().scrollTop + event.clientY;
		}
	}

	if(ycoord < 0) { ycoord = ycoord*-1; }
	gettrailobj().left=xcoord+"px"
	gettrailobj().top=ycoord+"px"

}
function stopfollow(e)
{
	return false;
}