var popupHandle = null;

function PopUp(url,title,w,h,scroll){
  if(popupHandle != null){
    if(popupHandle.closed){
      ;
    } else {
      popupHandle.close();
    }
  }
  var setting = "toolbar=0,location=0,directories=0,status=0,menubar=0,resizable=0,scrollbars=" + scroll + ",width=" + w + ",height=" + h;
  popupHandle = window.open(url,title,setting);
  if(popupHandle.window.focus){
    popupHandle.window.focus();
  }
}

function PopUp2(url,title,w,h,scroll){
  if(popupHandle != null){
    if(popupHandle.closed){
      ;
    } else {
      popupHandle.close();
    }
  }
  var setting = "toolbar=0,location=0,directories=0,status=0,menubar=1,resizable=1,scrollbars=" + scroll + ",width=" + w + ",height=" + h;
  popupHandle = window.open(url,title,setting);
  if(popupHandle.window.focus){
    popupHandle.window.focus();
  }
}

function ViewImage(ifile,ix,iy,ititle){
  var win;
  var sWidth;
  var sHeight;
  var NS = (document.layers) ? 1 : 0;
  win =   window.open("","imageviewer","width="+ix+",height="+iy+",menubar=no,toolbar=no");
  if (NS){
    sWidth = win.innerWidth;
    sHeight = win.innerHeight;
  } else {
    sWidth = win.document.body.clientWidth;
    sHeight = win.document.body.clientHeight;
  }
  if(sWidth!=ix || sHeight!=iy){
    win.close();
    setTimeout("ViewImage('"+ifile+"',"+ix+","+iy+",'"+ititle+"')", 250);
    return;
  }
  win.document.open();
  win.document.write("<html><head><title>"+ititle+"</title>");
  win.document.write("</head><body>");
  win.document.write('<div   style="position:absolute;width:'+ix+'px;height:'+iy+'px;left:0px;top:0px">');
  win.document.write("<img src="+ifile+"></div></body></html>");
  win.document.close();
}


function lib_bwcheck(){ //Browsercheck (needed)
	this.ver=navigator.appVersion
	this.agent=navigator.userAgent
	this.dom=document.getElementById?1:0
	this.opera5=(navigator.userAgent.indexOf("Opera")>-1 && document.getElementById)?1:0
	this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom && !this.opera5)?1:0; 
	this.ie6=(this.ver.indexOf("MSIE 6")>-1 && this.dom && !this.opera5)?1:0;
	this.ie4=(document.all && !this.dom && !this.opera5)?1:0;
	this.ie=this.ie4||this.ie5||this.ie6
	this.mac=this.agent.indexOf("Mac")>-1
	this.ns6=(this.dom && parseInt(this.ver) >= 5) ?1:0; 
	this.ns4=(document.layers && !this.dom)?1:0;
	this.bw=(this.ie6 || this.ie5 || this.ie4 || this.ns4 || this.ns6 || this.opera5)
	return this
}
var bw=lib_bwcheck()

/***************************************************************************************
Variables to set:
***************************************************************************************/
messages=new Array()
//Write your descriptions in here.
messages[0] = '<div class="clCaption">&nbsp;&nbsp; Low &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Avg &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; High</div><br> &nbsp;-51.6 &nbsp;&nbsp;&nbsp;&nbsp; 4.3 &nbsp;&nbsp;&nbsp;&nbsp; 379.72</div>'

messages[1] = '<div class="clCaption">&nbsp;&nbsp; Low &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Avg &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; High</div><br> &nbsp;-76.2 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 5.9 &nbsp;&nbsp;&nbsp; 398.37</div>'

messages[2] = '<div class="clCaption">&nbsp;&nbsp; Low &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Avg &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; High</div><br> &nbsp;-73.7 &nbsp;&nbsp;&nbsp;&nbsp; 8.87 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 585</div>'

messages[3] = '<div class="clCaption">&nbsp;&nbsp; Low &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Avg &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; High</div><br> &nbsp;-35.2 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 9.5 &nbsp;&nbsp;&nbsp; 244.97</div>'

messages[4] = '<div class="clCaption">&nbsp;&nbsp; Low &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Avg &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; High</div><br> &nbsp;-30.2 &nbsp;&nbsp;&nbsp;&nbsp; 10.2 &nbsp;&nbsp;&nbsp; 230.27</div>'

messages[5] = '<div class="clCaption">&nbsp;&nbsp; Low &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Avg &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; High</div><br> &nbsp;-2.21 &nbsp;&nbsp;&nbsp;&nbsp; 0.83 &nbsp;&nbsp;&nbsp;&nbsp; 3.54</div>'

messages[6] = '<div class="clCaption">&nbsp;&nbsp; Low &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Avg &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; High</div><br> -39.17 &nbsp;&nbsp;&nbsp; -0.6 &nbsp;&nbsp;&nbsp;&nbsp; 87.98</div>'

messages[7] = '<div class="clCaption">&nbsp;&nbsp; Low &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Avg &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; High</div><br> &nbsp;&nbsp;&nbsp;0.2 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0.3 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0.5</div>'

messages[8] = '<div class="clCaption">&nbsp;&nbsp; Low &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Avg &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; High</div><br> &nbsp;&nbsp;0.07 &nbsp;&nbsp;&nbsp; 16.87 &nbsp;&nbsp;&nbsp; 160.5</div>'

messages[9] = '<div class="clCaption">&nbsp;&nbsp; Low &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Avg &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; High</div><br> &nbsp;&nbsp;&nbsp;20 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 150 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 150</div>'

messages[10] = '<div class="clCaption">&nbsp;&nbsp; Low &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Avg &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; High</div><br> &nbsp;&nbsp;&nbsp;&nbsp;0 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1.23 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 10</div>'

messages[11] = '<div class="clCaption">&nbsp;&nbsp; Low &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Avg &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; High</div><br> &nbsp;&nbsp;0.03 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1.4 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 3.1</div>'

messages[12] = '<div class="clCaption">&nbsp;&nbsp; Low &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Avg &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; High</div><br >-35.14 &nbsp; 104.77 &nbsp;&nbsp;&nbsp; 5734</div>'

//To have more descriptions just add to the array.

fromX = 25 //How much from the actual mouse X should the description box appear?
fromY = -25 //How much from the actual mouse Y should the description box appear?

//To set the font size, font type, border color or remove the border or whatever,
//change the clDescription class in the stylesheet.

//Makes crossbrowser object.
function makeObj(obj){								
   	this.evnt=bw.dom? document.getElementById(obj):bw.ie4?document.all[obj]:bw.ns4?document.layers[obj]:0;
	if(!this.evnt) return false
	this.css=bw.dom||bw.ie4?this.evnt.style:bw.ns4?this.evnt:0;	
   	this.wref=bw.dom||bw.ie4?this.evnt:bw.ns4?this.css.document:0;		
	this.writeIt=b_writeIt;																
	return this
}

// A unit of measure that will be added when setting the position of a layer.
var px = bw.ns4||window.opera?"":"px";

function b_writeIt(text){
	if (bw.ns4){this.wref.write(text);this.wref.close()}
	else this.wref.innerHTML = text
}

//Capturing mousemove
var descx = 0
var descy = 0
function popmousemove(e){descx=bw.ns4||bw.ns6?e.pageX:event.x; descy=bw.ns4||bw.ns6?e.pageY:event.y}

var oDesc;
//Shows the messages
function popup(num){
    if(oDesc){
		oDesc.writeIt('<div class="clDescription">'+messages[num]+'</div>')
		if(bw.ie5||bw.ie6) descy = descy+document.body.scrollTop
		oDesc.css.left = (descx+fromX)+px
		oDesc.css.top = (descy+fromY)+px
		oDesc.css.visibility = "visible"
    }
}
//Hides it
function popout(){
	if(oDesc) oDesc.css.visibility = "hidden"
}
function setPopup(){
   	if(bw.ns4)document.captureEvents(Event.MOUSEMOVE)
    document.onmousemove = popmousemove;
	oDesc = new makeObj('divDescription')
}


function NewPopUp(url,title,l,t,w,h,scroll){
  if(popupHandle != null){
    if(popupHandle.closed){
      ;
    } else {
      popupHandle.close();
    }
  }
  var setting = "toolbar=0,location=0,directories=0,status=0,menubar=0,resizable=0,scrollbars=" + scroll + ",left="+ l +",top="+ t + ", width=" + w + ",height=" + h;
  popupHandle = window.open(url,title,setting);
  if(popupHandle.window.focus){
    popupHandle.window.focus();
  }
}


function gothere(){
  var thebox = document.quicklinks
  if (thebox.value = "reportstatement.htm"){
    newwindow=window.open("")
    newwindow.location=thebox.select.options[thebox.select.selectedIndex].value
    thebox.value = null;
  } else {
    window.self.location=thebox.select.options[thebox.select.selectedIndex].value
    thebox.value = null;
  }
}


var new_url = "";
function goTo(){
  if ( (new_url != "")  &&  (new_url != null) )
    window.self.location = new_url;
}
