/* * * * * * * * * * * * * */
/*       general.js        */
/*       ----------        */
/*  general.js is a simple */
/* javascript library that */
/* makes  dynamic design a */
/* lot easier. Include the */
/* general.js  file in any */
/* webpage  on  which  you */
/* require  tooltips ,  or */
/* other functionality.    */
/*       ----------        */
/* created by Jason Miller */
/*  jasonmillerdesign.com  */
/* * * * * * * * * * * * * */


function alert2(text) {
	text = unescape(text);
	
	var winH = (window.innerHeight&&window.innerHeight>document.body.offsetHeight)?window.innerHeight:((document.documentElement&&document.documentElement.offsetHeight>document.body.offsetHeight)?document.documentElement.offsetHeight-5:document.body.offsetHeight);
	//var winW = window.innerWidth?window.innerWidth:document.body.offsetWidth;
	
	var dsocTop = navigator.appName.indexOf("Microsoft")>-1?document.body.scrollTop:window.pageYOffset;
	
	var d=document.createElement("div");
	d.id = "alert2_fader_"+Math.round(Math.random()*1000,0);
	d.style.cssText = "z-index:999; position:absolute; width:100%; height:"+winH+"px; left:0px; top:0px; background:#000; opacity:0.7; filter:alpha(opacity=70);";
	d.setAttribute("style",d.style.cssText);
	document.body.appendChild(d);
	
	var a=document.createElement("div");
	a.id = "alert2_"+Math.round(Math.random()*1000,0);
	a.style.cssText = "z-index:1000; position:absolute; padding:30px; width:300px; height:auto; left:50%; margin-left:-180px; top:50%; background:#FFFFFF; border:1px solid #F3C317;";
	a.setAttribute("style",a.style.cssText);
	a.innerHTML = text + "<span onclick=\"document.body.removeChild(document.getElementById('"+d.id+"')); document.body.removeChild(document.getElementById('"+a.id+"'));\" style=\"position:absolute; right:-6px; top:-6px; padding:0px 4px 0px 4px; background:#AA0000; border:1px solid #000000; cursor:pointer;\">X</span>";
	a.style.marginTop = (-a.offsetHeight/2-30)+"px";
	document.body.appendChild(a);
	a.Fader = d;
	a.Close = function() {
		document.body.removeChild(this.Fader);
		document.body.removeChild(this);
	};
}










/* * * * * * * * * * * * * * * */
/*  Extremely Simple Tooltips  */
/* Free to distribute and use  */
/* * * * * * * * * * * * * * * */

//  Place this script inside the <head></head> of a document,
//  Follow these instructions:

//  To give any HTML element it's own tooltip, 
//  simply add the following to that element:
//      onmouseover="tooltip(this,'[replace with desired tooltip text]');"
//
//  example:
//    <a href="#" onmouseover="tooltip(this, 'Extremely Simple Tooltips:<br />An easy-to-use tooltip function.');"> link </a>
//
//  NOTE: you should stylize tooltips in your CSS stylesheet!
//        An example style follows:
//
//    div#tooltip {
//      background:#CCCCCC;
//      border:1px solid #000000;
//      color:#555555; font-size:10px;
//    }
//
// // // // // // // // // // // // // // // // //

var tooltip_oldmouseouts = new Array();
function tooltip( el_input , text ) {			// parameters:  element receiving tooltip ,  tooltip text
	if(!text)
		return false;
	var el = el_input?el_input:this;
	el.onmousemove = function(e) {
		if(!e){ e=window.event; }
		var mouseX, mouseY;
		if(e.pageX) { mouseX = e.pageX; mouseY = e.pageY; }
		else if(e.clientX) { mouseX = e.clientX+document.body.scrollLeft+document.documentElement.scrollLeft; mouseY = e.clientY+document.body.scrollTop+document.documentElement.scrollTop; }
		var tip = document.getElementById('tooltip');
		if(!tip) {
			sid = "tooltip_inner_"+Math.floor(Math.random()*999999);
			tip = document.createElement('div');
			tip.setAttribute("id","tooltip");
			tip.style.position = "absolute";
			tip.style.left = "-999em";
			tip.style.top = "-999em";
			tip.innerHTML = "<span id=\""+sid+"\">"+text+"</span>";
			document.body.appendChild(tip);
			if(document.getElementById(sid).offsetWidth < tip.offsetWidth)
				tip.style.width = document.getElementById(sid).offsetWidth + "px";
		}
		var winH = (window.innerHeight && window.innerHeight>document.body.offsetHeight)?window.innerHeight:document.body.offsetHeight;
		var winW = (window.innerWidth && window.innerWidth>document.body.offsetWidth)?window.innerWidth:document.body.offsetWidth;
		if(mouseY+20+tip.offsetHeight < winH)
			tip.style.top = (mouseY+20)+"px";
		else
			tip.style.top = (mouseY - tip.offsetHeight - 20) + "px";
		if(mouseX+20+tip.offsetWidth < winW)
			tip.style.left = (mouseX+20)+"px";
		else
			tip.style.left = (winW - tip.offsetWidth) + "px";
	}
	tooltip_oldmouseouts[el] = el.onmouseout?el.onmouseout:function(e){};
	el.onmouseout = function(e) {
		this.onmouseout=tooltip_oldmouseouts[this];
		if(document.getElementById("tooltip"))
			document.getElementById("tooltip").parentNode.removeChild(document.getElementById("tooltip"));
		this.onmouseout(e);
	}
	return true;
}
