//set the wrapper height by the amount of content
function setHeight()
{
	var contentheight = document.getElementById('mainContent').clientHeight;
	var navheight = document.getElementById('leftnavmenu').clientHeight;
	var fillheight;
	
	fillheight = contentheight - navheight - 14;
	if (fillheight >= 0) 
	{
		document.getElementById('leftnavfill').style.height = fillheight + 'px';
	}
}

function submitsearch()
{
	document.frmsearch.submit();
}

function swapChart(chartPre, activeTab, chartId, activeChartImg)
{
	var i, img;
	for (i=0; i < document.images.length; i++)
	{
		img = document.images[i];
		if (img.name.search(chartPre) == 0)
		{
			if (img.name == chartPre + activeTab) img.src=img.src.replace("-off", "-active");
			else img.src=img.src.replace("-active", "-off");
		}
	}
	document.getElementById(chartId).src = activeChartImg;
}

////////////////////////////////////////////////////////////////////////////////////////
/* This script and many more are available free online at
The JavaScript Source :: http://javascript.internet.com
Created by: JTricks.com :: http://www.jtricks.com/ */

function move_box(an, box, offsetLeft, offsetTop) 
{
  //change starting point to overlap thumnail picture
  var cleft = offsetLeft;
  var ctop = offsetTop;
  var obj = an;
  while (obj.offsetParent) {
    cleft += obj.offsetLeft;
    ctop += obj.offsetTop;
    
    obj = obj.offsetParent;
  }
  box.style.left = cleft + 'px';
  ctop += an.offsetHeight;
  box.style.top = ctop + 'px';
}

function show_hide_box(an, popup, url, width, height, borderStyle, offsetLeft, offsetTop, mouseout) 
{
  var boxdiv = document.getElementById(popup);
  if (boxdiv != null) 
  {
	if (boxdiv.style.display=='none') 
	{
      move_box(an, boxdiv, offsetLeft, offsetTop);
      boxdiv.style.display='block';
    } 
    else
      boxdiv.style.display='none';
    return false;
  }

  boxdiv = document.createElement('div');
  boxdiv.setAttribute('id', popup);
  boxdiv.style.display = 'block';
  boxdiv.style.position = 'absolute';
  boxdiv.style.width = width + 'px';
  boxdiv.style.height = height + 'px';
  boxdiv.style.border = borderStyle;
  var mouseouttext = '';
  if (mouseout) mouseouttext = 'onmouseout="return show_hide_box(this,\'' + popup + '\',' + width + ',' + height + ',\'' + borderStyle + '\',offsetLeft,offsetTop);"';
  boxdiv.innerHTML = '<img src="' + popup + '" height="' + height + '" width="' + width + '" alt=""' + mouseouttext + ' />';
  boxdiv.innerHTML = '<a href="' + url + '">' + boxdiv.innerHTML + '</a>';
  document.body.appendChild(boxdiv);
  move_box(an, boxdiv, offsetLeft, offsetTop);

  return false;
}
////////////////////////////////////////////////////////////////

//rollover functions
function AZ_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.AZ_p) d.AZ_p=new Array();
    var i,j=d.AZ_p.length,a=AZ_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.AZ_p[j]=new Image; d.AZ_p[j++].src=a[i];}}
}
function AZ_swapImgRestore() { //v3.0
  var i,x,a=document.AZ_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function AZ_findObj(n, d) { //v4.01
  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=AZ_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function AZ_swapImage() { //v3.0
  var i,j=0,x,a=AZ_swapImage.arguments; document.AZ_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=AZ_findObj(a[i]))!=null){document.AZ_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}


function setCookie(c_name,value,expiredays)
{
	var exdate = new Date()
	exdate.setDate(exdate.getDate()+expiredays);
	document.cookie=c_name+ "=" +escape(value)+((expiredays==null) ? "" : ";expires="+exdate.toGMTString());
}
function getCookie(c_name)
{
	if (document.cookie.length > 0)
	{
		c_start=document.cookie.indexOf(c_name + "=");
		if (c_start != -1)
		{ 
			c_start = c_start + c_name.length + 1;
			c_end = document.cookie.indexOf(";", c_start);
			if (c_end == -1)
				{c_end = document.cookie.length;
			}
			return unescape(document.cookie.substring(c_start,c_end));
		} 
	}
	return "";
}
