/* <![CDATA[
	Creates CSS styled tooltips in place of real ones...
	(Requires jQuery)
	*/
domReady(function(){
var cssTip = (cssTip)?cssTip:document.createElement('span');
	var testCSS = (typeof document.defaultView != "undefined" && typeof document.defaultView.getComputedStyle != "undefined")?document.defaultView.getComputedStyle(document.getElementById("main-t"),"").getPropertyValue("display"):(typeof document.getElementById("main-t").currentStyle != "undefined")?document.getElementById("main-t").currentStyle.display:"inline";
	if (testCSS != "inline"){ 
			var titleVal =""; var cssTip; var tt;
			$("#content-wrapper *[title]").hover(function(e){
													if (this.title.length>1) {	
													titleVal = this.title;
													this.title = "";
													cssTip = (cssTip)?cssTip:document.createElement('span');
													//initial position
													cssTip.style.left = ((e.pageX-$(window).scrollLeft()+$(cssTip).outerWidth() >= $(window).width())?(e.pageX-$(cssTip).outerWidth()):e.pageX) +'px';																				
													cssTip.style.top = ((e.pageY-$(window).scrollTop()+$(cssTip).outerHeight()+18 >= $(window).height())?(e.pageY-($(cssTip).outerHeight()+28)):e.pageY) +'px';
													
													cssTip.className="tooltip";
												
													cssTip.innerHTML=titleVal.replace(/\n/g,"<br />");
													$(this).mousemove(function(e){//set tip position at cursor (+ reposition if it doesnt fit on screen)
																		cssTip.style.left = ((e.pageX-$(window).scrollLeft()+$(cssTip).outerWidth() >= $(window).width())?(e.pageX-$(cssTip).outerWidth()):e.pageX) +'px';																				
																		cssTip.style.top = ((e.pageY-$(window).scrollTop()+$(cssTip).outerHeight()+18 >= $(window).height())?(e.pageY-($(cssTip).outerHeight()+28)):e.pageY) +'px';
																		});
													//insert the element...
													$("#content-wrapper").after(cssTip);
													//fade and destroy after [time in text length + pause]...
													//tt = setTimeout(function(){$(cssTip).fadeOut("slow", function(){this.title=titleVal;$(cssTip).remove();});},(800 + titleVal.length*80));
													// destroy on click...
													$(this).click(function(){this.title=titleVal;
																		   //$(cssTip).remove();
																		   });
													}}													
									,function(){	//alert("out");									
												  try {this.title=titleVal;cssTip.className="";clearTimeout(tt);$(cssTip).remove();
												  } catch(err) {return;}
										}//callback destroys tip and cancels fade
									);
			}

})
/* ]]> */