var ie4, ns4, ns6;
ie = document.all;
ns4 = document.layers;
ns6 = document.getElementById && !document.all;

function getElement(id) {
    if (document.all) return document.all[id];
    else if (document.getElementById)
    return document.getElementById(id);
    else
    return false;
}

function followmouse(e) {
    var xcoord=15;
    var ycoord=15;
    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 - 400; // Move to the left side of the cursor
        }
        else {
            xcoord += e.pageX;
        }
        if (docheight - e.pageY < (currentimageheight + 110)) {
            ycoord += e.pageY - Math.max(0,(110 + currentimageheight + e.pageY - docheight - truebody().scrollTop));
        }
        else {
            ycoord += e.pageY;
        }
    }
    else if (typeof window.event != "undefined") {
        if (docwidth - event.clientX < 380) {
            xcoord = event.clientX + truebody().scrollLeft - xcoord - 400; // Move to the left side of the cursor
        }
        else {
            xcoord += truebody().scrollLeft+event.clientX
        }
        if (docheight - event.clientY < (currentimageheight + 110)) {
            ycoord += event.clientY + truebody().scrollTop - Math.max(0,(110 + currentimageheight + event.clientY - docheight));
        }
        else {
            ycoord += truebody().scrollTop + event.clientY;
        }
    }
    if(ns6 || ie ) {
        document.getElementById('special_layer').style.left = (xcoord)+'px';
        document.getElementById('special_layer').style.top = (ycoord)+'px';
    }
   // if(ie) {
     //   document.getElementById('iframe1').style.left = (xcoord)+'px';
      //  document.getElementById('iframe1').style.top = (ycoord)+'px';
   /// }
}

function truebody() {
    return (!window.opera && document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}
var currentimageheight = 270;

function showLayer(url, w,h) {
    
    sHtml ="";
    sHtml = sHtml + '<div style="padding: 5px; background-color: #FFF; border: 1px solid #888;">';
    sHtml = sHtml + '<img src="'+url+'">';
    sHtml = sHtml + '</div>';
    currentimageheight = h;
    document.onmousemove=followmouse;
    document.getElementById("special_layer").innerHTML = sHtml;
    if(ns6 || ie ) {
        document.getElementById('special_layer').style.visibility = 'visible';
    }
    //if(ie) {
      //  document.getElementById('iframe1').style.visibility = 'visible';
    ///}
}

function hideLayer() {
    if(ns6 || ie) {
        document.getElementById('special_layer').style.visibility = 'hidden';
        document.getElementById('special_layer').style.left = "-500px";
    }
  //  if(ie) {
    //    document.getElementById('iframe1').style.visibility = 'hidden';
    //}
    document.onmousemove=""
}
document.write('<div id="special_layer" style="z-index:6;visibility:hidden;position:absolute;"></div>');
//document.write('');
