/* Simple Image Trail script- By JavaScriptKit.com Visit http://www.javascriptkit.com for this script and more This notice must stay intact */ /********************************************/ /* Altered and amended by Matt Rabe */ /* http://www.websolutionshack.com/ */ /********************************************/ var offsetfrommouse=[15,15]; //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 currentimageheight = 420; // maximum image size. if (document.getElementById || document.all){ document.write('
'); document.write('
'); } 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 } //////////////////////////////// // Popups that follow the mouse: //////////////////////////////// var over; function showFloater(img, width, height, border) { over = img; window.setTimeout('_showFloater(\''+img+'\', \''+width+'\', \''+height+'\', \''+border+'\');', 500); return false; } function _showFloater(img, width, height, border) { if (over != img) return false; currentimagewidth = width; currentimageheight = height; if (border != false) { borderHTML = 'border: 2px solid #001051; '; }else{ borderHTML = ''; } document.onmousemove=followmouse; newHTML = '
'; newHTML = newHTML + ''; newHTML = newHTML + '
'; gettrailobjnostyle().innerHTML = newHTML; gettrailobj().display="inline"; return false; } function hideFloater(){ over = ''; gettrailobj().innerHTML = " "; gettrailobj().display="none"; document.onmousemove=""; gettrailobj().left="-500px"; return false; } 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); if (typeof e != "undefined") { if (docwidth - e.pageX < parseInt(currentimagewidth) + 30) { xcoord = e.pageX - xcoord - currentimagewidth - 30; // Move image to left of cursor }else{ xcoord += e.pageX; } if (e.pageY - truebody().scrollTop < currentimageheight) { ycoord += e.pageY + 20; // Move to the bottom of the cursor }else{ ycoord += e.pageY - currentimageheight - 50; } }else if (typeof window.event != "undefined") { if (docwidth - event.clientX < parseInt(currentimagewidth) + 30) { xcoord = event.clientX + truebody().scrollLeft - xcoord - currentimagewidth - 10; // Move to the left side of the cursor }else{ xcoord += truebody().scrollLeft+event.clientX; } if (event.clientY > parseInt(currentimageheight) + 30) { ycoord += truebody().scrollTop + event.clientY - currentimageheight - 30; // Move to the top of the cursor }else{ ycoord += truebody().scrollTop + event.clientY + 20; } } if (ycoord < 0) { ycoord = ycoord * -1; } gettrailobj().left=xcoord+"px"; gettrailobj().top=ycoord+"px"; } function getmouse(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); if (typeof e != "undefined") { if (docwidth - e.pageX < 380) { xcoord = e.pageX - xcoord - 200; // Move to the left side of the cursor }else{ xcoord += e.pageX; } ycoord += e.pageY - 80; }else if (typeof window.event != "undefined") { if (docwidth - event.clientX < 380) { xcoord = event.clientX + truebody().scrollLeft - xcoord - 200; // Move to the left side of the cursor }else{ xcoord += truebody().scrollLeft+event.clientX; } ycoord += truebody().scrollTop + event.clientY - 80; } if (ycoord < 0) { ycoord = ycoord * -1; } gettrailobj().left=xcoord+"px"; gettrailobj().top=ycoord+"px"; document.onmousemove=void(0); } function showCustomPopup(string) { document.onmousemove=followmouseCustomPopup; newHTML = '
'; newHTML = newHTML + string.replace(/\[[^\]]*\]/g, '') + '
'; newHTML = newHTML + '
'; return false; } function hideCustomPopup() { gettrailobj().innerHTML = " "; document.onmousemove=getmouse; gettrailobj().display="none"; gettrailobj().left="-500px"; return false; } function followmouseCustomPopup(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); if (typeof e != "undefined") { if (docwidth - e.pageX < 380) { xcoord = e.pageX - xcoord - 215; // Move to the left side of the cursor }else{ xcoord += e.pageX; } if (docheight - e.pageY < 110) { ycoord += e.pageY - Math.max(0,(110 + e.pageY - docheight - truebody().scrollTop)); // Move to the top of the cursor }else{ ycoord += e.pageY; } }else if (typeof window.event != "undefined") { if (docwidth - event.clientX < 380) { xcoord = event.clientX + truebody().scrollLeft - xcoord - 190; // Move to the left side of the cursor }else{ xcoord += truebody().scrollLeft+event.clientX; } if (docheight - event.clientY < 110) { ycoord += event.clientY + truebody().scrollTop - Math.max(0,(110 + event.clientY - docheight)); // Move to the top of the cursor }else{ ycoord += truebody().scrollTop + event.clientY; } } if (ycoord < 0) { ycoord = ycoord * -1; } gettrailobj().left=xcoord+"px"; gettrailobj().top=ycoord+"px"; // Move the next two instructions to the last line of showNote() in the header doc to improve performance in IE. The Trade-off is that the boxes get jumpier. Seem to work fine in FF this way. gettrailobjnostyle().innerHTML = newHTML; gettrailobj().display="inline"; }