
// ******************* TOOLTIP SCRIPT ************************* //

var Xmouse, Ymouse;
var hidden = true;
var LayerWidth = 250;

// Init handler
if (document.layers){
	window.captureEvents(Event.MOUSEMOVE);
	window.onMouseMove = MoveHandler;
}
if (document.all){
	document.onmousemove = MoveHandler;
}

function MoveHandler(event) {
    var XMirror = false;
    var YMirror = false;

	if(document.layers){
		Xmouse = event.pageX + pageXOffset;
		if (Xmouse < 30) {Xmouse = 30}
		if (Xmouse > 230) {XMirror = true;}
		Ymouse = event.pageY + pageYOffset;
		if (Ymouse < 50) {Ymouse = 50}
		if (Ymouse > 650) {YMirror = true;}
	} else if(document.all) {
		Xmouse = window.event.x + document.body.scrollLeft;
		if (Xmouse < 30) {Xmouse = 30}
		if (Xmouse > 230) {XMirror = true;}
		Ymouse = window.event.y + document.body.scrollTop;
		if (Ymouse < 50) {Ymouse = 50}
		if (Ymouse > 650 + document.body.scrollTop) {YMirror = true;}
	}
	moveLayer("tooltip", Xmouse, Ymouse, XMirror, YMirror); // sets offset from cursor
}

function moveLayer(Id, x, y, XMirror, YMirror){
    var XLayerShift = -30;
    var YLayerShift = 18;

	x = Xmouse; y = Ymouse;

	if (document.all){
        if (XMirror) {document.all[Id].style.left = x - XLayerShift - LayerWidth;} 
		else {document.all[Id].style.left = x + XLayerShift;}
		if (YMirror) {document.all[Id].style.top = y - YLayerShift - 220;} 
		else {document.all[Id].style.top = y + YLayerShift;}	
    } else if (document.layers){
		if (XMirror) {document.layers[Id].right = x - XLayerShift;} 
		else {document.layers[Id].left = x + XLayerShift;}
		if (YMirror) {document.layers[Id].top = y - YLayerShift - document.layers[Id].document.height;} 
		else {document.layers[Id].top = y + YLayerShift;}
	}
}

function tooltest(message) {
	if(message){
		hidden = false;
		if (document.layers){
			document.tooltip.visibility = "show";
			with (document.tooltip.document){
				open();
				write("<table bgcolor=#000000 width=200 cellpadding=10 cellspacing=2 border=0><tr><td bgcolor='#770000'><FONT FACE='arial, helvetica' COLOR='#ffff99' SIZE=-1><I>" + message + "</I></FONT></td></tr></table>");
				close();
			}
		} else {
			document.all["tooltip"].innerHTML = "<table bgcolor=#000000 width=200 cellpadding=10 cellspacing=2 border=0><tr><td bgcolor='#770000'><FONT FACE='arial, helvetica' COLOR='#ffff99' SIZE=-1><I>" + message + "</I></FONT></td></tr></table>";
			document.all["tooltip"].style.visibility = "visible";
		}
	} else {
		hidden = true;
		if (document.all) {
			document.all["tooltip"].style.visibility = "hidden";
			document.all["tooltip"].innerHTML = "";
		} else if (document.layers){
			document.layers["tooltip"].visibility = "hide";
			with (document["tooltip"].document){
				open();
				write("");
				close();
			}
		}
	}
}

// ************************  Miscellaneous site specific scripts ***************************** //

function XanaWin(which, w, h) {
	popupWin = window.open(which, 'XanaWin', 'scrollbars,width='+w+',height='+h);
	popupWin.focus();
	}
	
function XanaWin2(which, w, h) {
	popupWin = window.open(which, 'XanaWin', 'width='+w+',height='+h);
	popupWin.focus();
	}
	
if (top.location != self.location) 
	{
	top.location = self.location
	}
	
function writemail(user,domain)
	{
		location.href = "mailto:"+user+"@"+domain;
	}
	
window.defaultStatus="Xanatos.com- Great Sites!";
