function switchshoppic(id){
	var theImageSource = "store/images/parts/details/"+id+".jpg";
	var theImage = document.getElementById("sampleImage");
	theImage.src = theImageSource;
	theDiv = document.getElementById("imagefloater");
	theDiv.style.display = "inline";
	followmouse();
	}
function switchsitupic(id){
	var theImageSource = "store/images/parts/fitted/details/"+id+".jpg";
	var theImage = document.getElementById("sampleImage");
	theImage.src = theImageSource;
	theDiv = document.getElementById("imagefloater");
	theDiv.style.display = "inline";
	followmouse();
	}	
function switchpic(id){
	var theImageSource = "images/gallerypics/image"+id+".jpg";
	var theImage = document.getElementById("sampleImage");
	theImage.src = theImageSource;
	theDiv = document.getElementById("imagefloater");
	theDiv.style.display = "inline";
	followmouse();
	}
function simplepic(id){
	var theImageSource = "images/casepics/image"+id+".jpg";
	var theImage = document.getElementById("sampleImage");
	theImage.src = theImageSource;
	theDiv = document.getElementById("imagefloater");
	theDiv.style.display = "inline";
	followmouse();
	}	
function switchstudypic(id,text,number){
	var theImageSource = "images/casepics/image"+id+".jpg";
	var theImage = document.getElementById("sampleImage");
	theImage.src = theImageSource;
	var thetext = "<p>"+text+"</p>";
	var theTextbox = document.getElementById("texter");
	theTextbox.innerHTML = "<p>"+number+". "+text+"</p>";
	theDiv = document.getElementById("imagefloater");
	theDiv.style.display = "inline";
	followmouse();
	}	
function clearPic(){
		gettrailobj().display="none";
	}

function truebody(){
return (!window.opera && document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body;
}

function gettrailobj(){
	return document.getElementById("imagefloater").style;
}

function followmouse(e){

	var xcoord=5
	var ycoord=5

	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);

	if (typeof e != "undefined"){
		if (docwidth - e.pageX < 460){
			xcoord = e.pageX - xcoord - 460; // Move to the left side of the cursor
		} else {
			xcoord += e.pageX;
		}
		if (docheight - e.pageY < (500)){
			ycoord += e.pageY - Math.max(0,(500 + e.pageY - docheight - truebody().scrollTop) +5);
		} else {
			ycoord += e.pageY;
		}

	} else if (typeof window.event != "undefined"){
		if (docwidth - event.clientX < 460){
			xcoord = event.clientX + truebody().scrollLeft - xcoord - 460; // Move to the left side of the cursor
		} else {
			xcoord += truebody().scrollLeft+event.clientX
		}
		if (docheight - event.clientY < (500)){
			ycoord += event.clientY + truebody().scrollTop - Math.max(0,(500 + event.clientY - docheight));
		} else {
			ycoord += truebody().scrollTop + event.clientY;
		}
	}

	var docwidth=document.all? truebody().scrollLeft+truebody().clientWidth : pageXOffset+window.innerWidth-15
	var docheight=document.all? Math.max(truebody().scrollHeight, truebody().clientHeight) : Math.max(document.body.offsetHeight, window.innerHeight)
		if(ycoord < 0) { ycoord = ycoord*-1; }
	if (gettrailobj().display == "none"){
	}else{
	gettrailobj().left=xcoord+"px";
	gettrailobj().top=ycoord+"px";
	}
}

document.onmousemove=followmouse;