/***********************************************
* Fixed ToolTip script- ? Dynamic Drive (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit http://www.dynamicdrive.com/ for full source code
***********************************************/

var tipwidth='800px' //default tooltip width
var tipbgcolor='#ffffff'  //tooltip bgcolor
var disappeardelay=250  //tooltip disappear speed onMouseout (in miliseconds)
var vertical_offset="0px" //horizontal offset of tooltip from anchor link
var horizontal_offset="-400px" //horizontal offset of tooltip from anchor link

/////No further editting needed

var ie4=document.all
var ns6=document.getElementById&&!document.all

if (ie4||ns6)
document.write('<div id="fixedtipdiv" style="position:absolute; z-index:1; visibility:hidden;width:'+tipwidth+';background-color:'+tipbgcolor+'" onmouseover=\"clearhidetip()\" onmouseout=\"delayhidetip()\"></div>')

function getposOffset(what, offsettype){
var totaloffset=(offsettype=="left")? what.offsetLeft : what.offsetTop;
var parentEl=what.offsetParent;
while (parentEl!=null){
totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
parentEl=parentEl.offsetParent;
}
return totaloffset;
}


function showhide(obj, e, visible, hidden, tipwidth){
if (ie4||ns6)
dropmenuobj.style.left=dropmenuobj.style.top=-500
if (tipwidth!=""){
dropmenuobj.widthobj=dropmenuobj.style
dropmenuobj.widthobj.width=tipwidth
}
if (e.type=="click" && obj.visibility==hidden || e.type=="mouseover"){
obj.visibility=visible
}
else if (e.type=="click")
obj.visibility=hidden
}

function iecompattest(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function clearbrowseredge(obj, whichedge){
var edgeoffset=(whichedge=="rightedge")? parseInt(horizontal_offset)*-1 : parseInt(vertical_offset)*-1
if (whichedge=="rightedge"){
var windowedge=ie4 && !window.opera? iecompattest().scrollLeft+iecompattest().clientWidth-15 : window.pageXOffset+window.innerWidth-15
dropmenuobj.contentmeasure=dropmenuobj.offsetWidth
if (windowedge-dropmenuobj.x < dropmenuobj.contentmeasure)
edgeoffset=dropmenuobj.contentmeasure-obj.offsetWidth
}
else{
var windowedge=ie4 && !window.opera? iecompattest().scrollTop+iecompattest().clientHeight-15 : window.pageYOffset+window.innerHeight-18
dropmenuobj.contentmeasure=dropmenuobj.offsetHeight
if (windowedge-dropmenuobj.y < dropmenuobj.contentmeasure)
edgeoffset=dropmenuobj.contentmeasure+obj.offsetHeight
}
return edgeoffset
//return 0;
}

function fixedtooltip(menucontents, obj, e){
if (window.event) event.cancelBubble=true
else if (e.stopPropagation) e.stopPropagation()
clearhidetip()
dropmenuobj=document.getElementById? document.getElementById("fixedtipdiv") : fixedtipdiv


// small image will have a _small in the name; e.g.:  img1_small.jpg
// large image will have nothing in the name;  e.g.:  img1.jpg
var indexOfExtension = menucontents.lastIndexOf(".");
var extension = menucontents.substr(indexOfExtension);
var restOfName = menucontents.substr(0,indexOfExtension-"_small".length); // remove the "_zoomed" from the string
var newMenuContents = restOfName + extension;
//alert("old image: " + menucontents + "\nnew image:" + newMenuContents);

var imgHTML = "<div style=\"border:1px solid #a0a0a0; background-color: #ffffff; padding:10px;\"><img src=\"" + newMenuContents + "\" border=0></div>";
dropmenuobj.innerHTML=imgHTML;

if (ie4||ns6){
showhide(dropmenuobj.style, e, "visible", "hidden", '150px')
dropmenuobj.x=getposOffset(obj, "left")+100
dropmenuobj.y=getposOffset(obj, "top")-100
dropmenuobj.style.left=dropmenuobj.x-clearbrowseredge(obj, "rightedge")+"px"
dropmenuobj.style.top=dropmenuobj.y;//-clearbrowseredge(obj, "bottomedge")+obj.offsetHeight+"px"
}
}

function hidetip(e){
if (typeof dropmenuobj!="undefined"){
if (ie4||ns6)
dropmenuobj.style.visibility="hidden"
}
}

function delayhidetip(){
if (ie4||ns6)
delayhide=setTimeout("hidetip()",disappeardelay)
}

function clearhidetip(){
if (typeof delayhide!="undefined")
clearTimeout(delayhide)
}


function popupImage(imageObject)
{
	var imageSrc = imageObject.src;
	var popupWindow = window.open("","_bigpicture","width=100,height=100,menubar=no,resizable=yes,status=no,toolbar=no, scrollbars=yes");
	popupWindow.document.write("<head>");
	popupWindow.document.write("</head>");
	popupWindow.document.write("<body style='padding:0px;margin:0px'>");
	//popupWindow.document.write("<img id=\"image1\" src=\"" + imageSrc + "\" onclick=\"javascript:window.close()\">");
	popupWindow.document.write("<img id=\"image1\" src=\"" + imageSrc + "\">");
	popupWindow.document.write("</body>");

	var img = popupWindow.document.getElementById("image1");
	var imageWidth = img.width + 10;
	var imageHeight = img.height + 40;
	popupWindow.resizeTo(imageWidth,imageHeight);
	popupWindow.innerHeight = imageHeight;
	popupWindow.innerWidth = imageWidth;
}


