var ie4, ns4, ns6;
ie = document.all;
ns4 = document.layers;
ns6 = document.getElementById && !document.all;
flag =0;

function getElement(id) {
    if (document.all) return document.all[id];
    else if (document.getElementById)
    return document.getElementById(id);
    else
    return false;
}

function followmouse(e) {
if(flag == 0){
    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';
    }
	 
	 }
	 flag =1;
}

function truebody() {
    return (!window.opera && document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}
var currentimageheight = 270;


function showGoogleMaps(e,lg,lt,zm, w,h,n) {
    flag = 0;
    sHtml ="";
    sHtml = sHtml + '<div style="padding: 5px; background-color: #FFF; border: 1px solid #888;text-align:right">';
	 sHtml = sHtml + '<a style="cursor:hand" onclick="hideGoogleMaps()">X</a>';
    sHtml = sHtml + '<div id="gmap" style="width: 400px; height: 300px"></div>';
    sHtml = sHtml + '</div>';
	
	 
	 
	 
	 document.getElementById("special_layer").innerHTML = sHtml;
        currentimageheight = h;
	  if(ie)
		 followmouse();
	  else	
		followmouse(e);

	 setTimeout( function() {var showmaps = new ShowMap( document.getElementById('gmap'), lt , lg  ,zm,  n, 745 );}, 1000);
	 
   
    if(ns6 || ie ) {
        document.getElementById('special_layer').style.visibility = 'visible';
    }

}

function hideGoogleMaps() {
    if(ns6 || ie) {
        document.getElementById('special_layer').style.visibility = 'hidden';
        document.getElementById('special_layer').style.left = "-500px";
    }
    document.onmousemove=""
}
document.write('<div id="special_layer" style="z-index:6;visibility:hidden;position:absolute;"></div>');
