/*
Simple Image Trail script- By JavaScriptKit.com
Visit http://www.javascriptkit.com for this script and more
This notice must stay intact
*/

var offsetfrommouse = [5, 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 currentimageheight = 270; // maximum image size.

if (document.getElementById || document.all) {
    document.write('<div id="trailimageid">');
    document.write('</div>');
}

function gettrailobj() {
    if (document.getElementById && document.getElementById("trailimageid"))
        return document.getElementById("trailimageid").style
    else if (document.all)
        return document.all.trailimagid.style
}

function gettrailobjnostyle() {
    if (document.getElementById && document.getElementById("trailimageid"))
        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, type, title, width, height, catid, copyright, description) {

    document.onmousemove = followmouse;

    var newHTML = '<table border="0" width="240" cellpadding="3" cellspacing="3">';
    newHTML = newHTML + '<tr><td width="100%" valign="top">';
    newHTML = newHTML + '<table class="thin" width="222">';
    newHTML = newHTML + '<tr><td width="100%"><table border="0" width="100%" cellspacing="0" cellpadding="0">';
    newHTML = newHTML + '<tr><td width="100%"><p align="center">';

    if (type == 'photo') {
        newHTML = newHTML + '<div align="center" style="padding:5px;background:#fff;border:solid 1px #000">';
        newHTML = newHTML + '<img src="' + imagename + '" border="0"">';
        newHTML = newHTML + '</div>';
    }
    if (type == 'video') {

        var browser = navigator.appName;
        var b_version = navigator.appVersion;
        var version = parseFloat(b_version);
        if ((browser == "Microsoft Internet Explorer") && (version >= 4)) {
            extra1 = "";
            extra2 = "";
        } else {
            extra1 = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="' + width + '" height="' + height + '">';
            extra2 = '</object>';
        }

        temp = '<div style=" background-color: #e1e1e1; border:solid 9px #e1e1e1;width:' + width + 'px;height:' + height + '">' + extra1 + '<embed'
		+ '		src="player.swf"'
		+ '		width="' + width + '"'
		+ '		height="' + height + '"'
		+ '		allowscriptaccess="sameDomain"'
		+ '		allowfullscreen="false"'
		+ '		flashvars=autostart=true&repeat=true&height=' + height + '&width=' + width + '&file=' + imagename + '&controlbar=none&fullscreen=false"'
		+ '		/>' + extra2 + '</div>';

        newHTML = newHTML + '<div align="center" style="border:solid 0px #ccc">';
        newHTML = newHTML += temp;
        newHTML = newHTML + '</div>';
    }
    gettrailobjnostyle().innerHTML = newHTML;
    gettrailobj().visibility = "visible";
}


function hidetrail() {
    gettrailobj().visibility = "hidden";
    gettrailobjnostyle().innerHTML = "";
    document.onmousemove = "";
    gettrailobj().left = "-500px";
}

function followmouse(e) {

    var xcoord = offsetfrommouse[0];
    var ycoord = offsetfrommouse[1];

    if (typeof e != "undefined") {
        xcoord += e.pageX;
        ycoord += e.pageY;

    } else if (typeof window.event != "undefined") {
    xcoord += truebody().scrollLeft + event.clientX;
    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);

    gettrailobj().left = xcoord + "px";
    gettrailobj().top = ycoord + "px";

}






