//Begin dHTML Toolltip Variables
var	 tipTimer;
var s=new Array();
//End dHTML Toolltip Variables
function locateObject(n, d) { //v3.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=locateObject(n,d.layers[i].document); return x;
}

function wordWarp(text,size) {
	if (text.indexOf("<br />")>0) {
		txt=text.substring(0,text.indexOf("<br />"));
		if (txt.length>size)
			txt=wordWarp(txt,size);
		text=txt+"<br />"+wordWarp(text.substring(text.indexOf("<br />")+6,text.length),size)
	} else {
		if (text.length>size) {
			index=size;
			while (index!=0){
				if (text.charAt(index)==" ")
					break;
				else
					index--;
			}
			text = wordWarp(text.substring(0,index),size)+"<br />"+wordWarp(text.substring(index+1,text.length),size);
		}
	}
	return text
}

function hideTooltip(object)
{
if (document.all)
{
    locateObject(object).style.visibility="hidden"
    locateObject(object).style.left = 1;
    locateObject(object).style.top = 1;
return false
}
else if (document.layers)
{
    locateObject(object).visibility="hide"
    locateObject(object).left = 1;
    locateObject(object).top = 1;
    return false
}
else
    return true
}

function showTooltip(object,e, tipContent, backcolor, bordercolor, textcolor, displaytime, wordWarpSize)
{
    window.clearTimeout(tipTimer)

    if (document.all)
        {

        locateObject(object).innerHTML='<table style="font-family: Tahoma, Arial, Helvetica, sans-serif; font-size: 11px; border: '+bordercolor+'; border-style: solid; border-top-width: 2px; border-right-width: 2px; border-bottom-width: 2px; border-left-width: 2px; background-color: '+backcolor+'" width="10" border="0" cellspacing="2" cellpadding="2"><tr><td nowrap><font style="font-family: Tahoma, Arial, Helvetica, sans-serif; font-size: 11px; color: '+textcolor+'">'+unescape(wordWarp(tipContent,wordWarpSize))+'<\/font><\/td><\/tr><\/table> '

        if ((e.x + locateObject(object).clientWidth) > (document.body.clientWidth + document.body.scrollLeft))
            {
                locateObject(object).style.left = (document.body.clientWidth + document.body.scrollLeft) - locateObject(object).clientWidth-10;
            }
        else
	        locateObject(object).style.left=document.body.scrollLeft+event.clientX;
        if ((e.y + locateObject(object).clientHeight)+10 > (document.body.clientHeight))
            {
                locateObject(object).style.top = (document.body.clientHeight + document.body.scrollTop) - locateObject(object).clientHeight-30;
            }
        else
	       locateObject(object).style.top=document.body.scrollTop+event.clientY+20;
        locateObject(object).style.visibility="visible"
        tipTimer=window.setTimeout("hideTooltip('"+object+"')", displaytime);
        return true;
        }
    else if (document.layers)
        {
        locateObject(object).document.write('<table width="10" border="0" cellspacing="1" cellpadding="1"><tr bgcolor="'+bordercolor+'"><td><table width="10" border="0" cellspacing="0" cellpadding="2"><tr bgcolor="'+backcolor+'"><td nowrap><font style="font-family: Tahoma, Arial, Helvetica, sans-serif; font-size: 11px; color: '+textcolor+'">'+unescape(wordWarp(tipContent,wordWarpSize))+'<\/font><\/td><\/tr><\/table><\/td><\/tr><\/table>')
        locateObject(object).document.close()
        locateObject(object).top=e.y+20

        if ((e.x + locateObject(object).clip.width) > (window.pageXOffset + window.innerWidth))
            {
                locateObject(object).left = window.innerWidth - locateObject(object).clip.width-10;
            }
        else
            {
            locateObject(object).left=e.x;
            }
        locateObject(object).visibility="show"
        tipTimer=window.setTimeout("hideTooltip('"+object+"')", displaytime);
        return true;
    }
    else
    {
        return true;
    }
}

function FindGroup(grp, imageName) {
	var img = FWFindImage(document, imageName, 0);
	if (!img) return(false);
	var docGroup = eval("document.FWG_"+grp);
	if (!docGroup) {
		docGroup = new Object;
		eval("document.FWG_"+grp+" = docGroup");
		docGroup.theImages = new Array;
	}
	if (img) {
		var i;
		for (var i=0; i<docGroup.theImages.length; i++) {
			if (docGroup.theImages[i] == img) break;
		}
		docGroup.theImages[i] = img;
		if (!img.atRestSrc) {
			img.atRestSrc = img.src;
			img.initialSrc = img.src;
		}
	}
	return(docGroup);
}

function FWFindImage(doc, name, j)
{
	var theImage=false;
	if (doc.images) {
		theImage = doc.images[name];
	}
	if (theImage) return theImage;
	if (doc.layers) {
		for (j=0; j<doc.layers.length; j++) {
			theImage = FWFindImage(doc.layers[j].document, name, 0);
			if (theImage) return(theImage);
		}
	}
	return(false);
}

function GrpSwap(grp){
	var i,j=0,newSrc,objName;
	var docGroup = false;
	for (var i=1; i < (GrpSwap.arguments.length-1); i+=2) {
		objName = GrpSwap.arguments[i];
		newSrc = GrpSwap.arguments[i+1];
		docGroup = FindGroup(grp, objName);
		if (!docGroup) continue;
		obj = FWFindImage(document,objName,0);
		if (!obj) continue;
		if (obj.isDown) {
			if (obj.downOver) {
				obj.src = obj.downOver;
			}
		} else {
			obj.src = newSrc;
			obj.atRestSrc = obj.initialSrc;
		}
		obj.skipMe = true;
		j++;
	}
	if (!docGroup) return;
	theImages = docGroup.theImages;
	if (theImages) {
		for (var i=0; i<theImages.length; i++) {
			var curImg = theImages[i];
			if (curImg.atRestSrc && !curImg.skipMe) {
				curImg.src = curImg.atRestSrc;
			}
			curImg.skipMe = false;
		}
	}
}
function InitGrp(grp) {
	var cmd = false; if (getCookie) cmd = getCookie(grp);
	if (cmd) {
		eval("GrpDown("+cmd+")");
		eval("GrpRestore("+cmd+")");
	}
}

function getCookie(Name) {
   var search = Name + "="
   var retVal = "";
   if (document.cookie.length > 0) { // if there are any cookies
     offset = document.cookie.indexOf(search);
     if (offset != -1) { // if cookie exists
         // set index of beginning of value
         end = document.cookie.indexOf(";", offset)
         // set index of end of cookie value
         offset += search.length
         if (end == -1)
            end = document.cookie.length;
         retVal = unescape(document.cookie.substring(offset, end)) ;
     }
   }
   return(retVal);
}

function setCookie(name, value) {
   document.cookie = name + "=" + escape(value)
}

function GrpDown(grp){
	var i,j=0,downSrc,downOver,objName;
	var cmd = "'" + grp + "'";
	var docGroup=false;
	for (var i=1; i < (GrpDown.arguments.length-2); i+=3) {
		objName = GrpDown.arguments[i];
		downSrc = GrpDown.arguments[i+1];
		downOver = GrpDown.arguments[i+2];
		if(!downOver) downOver = downSrc;
		var docGroup = FindGroup(grp, objName);
		if (!docGroup || !downSrc) continue;
		obj = FWFindImage(document,objName,0);
		if (!obj) continue;
		obj.atRestSrc = downSrc; obj.downOver = downOver;
		obj.src = downOver; obj.isDown = true;
		obj.skipMe = true;
		cmd += ",'" + objName + "','" + downSrc + "','" + downOver + "'";
		j++;
	}
	setCookie(grp, cmd);
	if (!docGroup) return;
	var theImages = docGroup.theImages;
	if (theImages) {
		for (var i=0; i<theImages.length; i++) {
			var curImg = theImages[i];
			if (curImg && !curImg.skipMe) {
				curImg.atRestSrc = curImg.initialSrc;
				curImg.isDown = false; curImg.downOver = false;
				curImg.src = curImg.initialSrc;
			}
			curImg.skipMe = false;
		}
	}
}

function GrpRestore(grp) { //v2.0
	var docGroup = eval("document.FWG_"+grp);if (!docGroup) return;
	var oldSwap = docGroup.oldSwap;
	var newSwap = docGroup.curSwap;
	if (newSwap) {docGroup.oldSwap = newSwap;	docGroup.curSwap = null;}
	if (oldSwap) {
		for (var i=0; i<oldSwap.length; i++) {
			var curImg = oldSwap[i];
			var restore = true;
			if (newSwap) 
				for (j=0; j<newSwap.length; j++) {
					if (curImg == newSwap[j]) {
						restore = false;
					}
				}
			if (restore) {
				if (curImg.atRestSrc) {
					curImg.src = curImg.atRestSrc;
				} else if (curImg.origSrc) {
					curImg.src = curImg.origSrc;
				}
			}
		}
	}
	theImages = docGroup.theImages;
	if (theImages) {
		for (var i=0; i<theImages.length; i++) {
			var curImg = theImages[i];
			var restore = true;
			if (newSwap) for (j=0; j<newSwap.length; j++) {
				if (curImg == newSwap[j]) {
					restore = false;
				}
			}
			if (restore) {
				if (curImg.atRestSrc) {
					curImg.src = curImg.atRestSrc;
				}
			}
		}
	}
}

function MM_displayStatusMsg(msgStr) { //v1.0
  status=msgStr;
  document.MM_returnValue = true;
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_callJS(jsStr) { //v2.0
  return eval(jsStr)
}

function windowMsg(name,style,width,heigth){
	this.name=name;
	this.window=null;
	this.style=style;
	this.text="";
	this.width=width;
	this.heigth=heigth;
	this.x=0;
	this.y=0;
	this.title="";
	this.label="";
	this.color="";
	this.elements=new Array();
	if (typeof(_bsindowMsgPrototypeCalled) == 'undefined')
		initwindowMsg();
}
new windowMsg(null,null,null,null,null);

function initwindowMsg(){
	_bsindowMsgPrototypeCalled=true;
	windowMsg.prototype.getText=windowMsgGetText;
	windowMsg.prototype.setHTML=windowMsgSetHTML;
	windowMsg.prototype.get=windowMsgGet;
	windowMsg.prototype.setTitle=windowMsgSetTitle;
	windowMsg.prototype.setLabel=windowMsgSetLabel;
	windowMsg.prototype.setColor=windowMsgSetColor;
	windowMsg.prototype.addElement=windowAddElement;
	windowMsg.prototype.getListElements=windowGetListElements;
}
function windowMsgSetTitle(title) {
	this.title=title;
}
function windowMsgSetLabel(label) {
	this.label=label;
}
function windowMsgSetColor(color) {
	this.color=color;
}
function windowMsgGet(evnt) {
	var value="\n\t"+this.getText(this.getListElements("window"),evnt)+"style=\"color: "+this.color+"; font-weight: bold\">"+this.label+"</a>\n";
	return(value);
}

function windowMsgSetHTML(html,extra,e,absolute) {
	if (!absolute) {
		xConst=html.length/(document.body.clientWidth + document.body.scrollLeft)*2.5
		this.width=html.length/(xConst+.4);
		yConst=html.length/document.body.clientHeight
		this.height=html.length/(yConst+.9);
	}
	var textReturn="";
	this.text='<html><head><title>'+this.title+'</title>'
	if (this.style!='')
		this.text+='<link rel=stylesheet href='+this.style+'>'
	this.text+='</head><body>'+html
	if (extra!=null)
		this.text+='<br>'+extra;
	this.text+='</body></html>';
	if (this.window!=null) 
		this.window.close();
	if(e != null) {
		if(navigator.appName == "Microsoft Internet Explorer") {
			if (e.x + this.width > (document.body.clientWidth + document.body.scrollLeft))
			    {
				this.x = (document.body.clientWidth + document.body.scrollLeft) - this.width-10;
			    }
			else
			    this.x=document.body.scrollLeft+event.clientX;
			if (e.y +this.height+10 > (document.body.clientHeight))
			    {
				this.y = (document.body.clientHeight) - this.height-30;
			    }
			else
			   this.y=event.clientY+20;
		} else { // Navigator coordinates must be adjusted for scrolling
			this.x=(e.screenX - pageXOffset + 10)
			this.y=(e.screenY - pageYOffset + 10)
		}
	}
	this.window=window.open('',this.name,'toolbar=no,location=no,directories=no,menubar=no,status=no,scrollbar,resizable,width='+this.width+',height='+this.height+',left='+this.x+',top='+this.y+',screenX='+this.x+',screenY='+this.y);
	this.window.document.write(this.text);
	this.window.document.close();
	return;
}


function windowMsgGetText(text) {
	var textReturn="";
	textReturn="<a onMouseOver=\"t='"+this.getListElements("window")+"';showTooltip('dHTMLToolTip',event,t,'"+bkCl+"','"+brCl+"','"+txCl+"','1000000',"+wpSz+")\" onMouseOut=\"hideTooltip('dHTMLToolTip')\" href=\"javascript:void(0)\" onClick=\"";
	this.text='&lt;html>&lt;head>&lt;title>'+this.title+'&lt;/title>&lt;link rel=stylesheet href='+this.style+'>&lt;/head>&lt;body>&quot;+t+&quot;&lt;/body>&lt;/html>';
	textReturn+=this.name+"=window.open(\'\',\'"+this.name+"\',\'toolbar=no,location=no,directories=no,menubar=no,status=no,scrollbar,resizable,width="+this.width+",height="+this.heigth+"\');"+this.name+".document.write(&quot;"+this.text+"&quot;);"+this.name+".document.close();\" ";
	return (textReturn);
}

function windowAddElement(label,element) {
	var num=this.elements.length;
	this.elements[num]=new Array();
	this.elements[num].label=label;
	this.elements[num].element=element;
}

function windowGetListElements(mode) {
	var textReturn="";
	for (var i=0;i<this.elements.length;i++) {
		if (this.elements[i].element!=null&&this.elements[i].element!=""){
			if (mode=="span") {
				textReturn+=this.elements[i].label+this.elements[i].element;
				if (i<this.elements.length-1)
					textReturn+="\n"
			}
			if (mode=="window") {
				//extReturn+="<strong>"+this.elements[i].label+"</strong>"+this.elements[i].element;
				if (i<this.elements.length-1)
					textReturn+="<br>"
			}
		}
	}
	return(textReturn)
}

winDef=new windowMsg('winDef2','/CORPORATE/paho_main.css','350','400');