// JavaScript Document

function numberonly(x){
if (isNaN(x.value)){
x.focus();
x.select();
alert("\"" + x.value + "\"" + " is not a number, please re-enter a valid number.");
}
}

function cleartext(x){
x.value = "";
}

 function pop_window(url) {
  var popit = window.open(url,'console','scrollbars,menu,width=500,height='+(screen.height-100)+',left=0,top=0');
 }

//Script:     Print Current Window From A Link
//Function:   Opens printer dialogue to print current page
//Browsers:   Version 4 and later (others degrade gracefully)
//<a href="javascript:printWindow()">Print This Page</a>
function printWindow(){
   bV = parseInt(navigator.appVersion)
   if (bV >= 4) window.print()
}

//This function write the date
function writeDate(){
	var months=new Array(13);
	months[1]="January";
	months[2]="February";
	months[3]="March";
	months[4]="April";
	months[5]="May";
	months[6]="June";
	months[7]="July";
	months[8]="August";
	months[9]="September";
	months[10]="October";
	months[11]="November";
	months[12]="December";
	var time=new Date();
	var lmonth=months[time.getMonth() + 1];
	var date=time.getDate();
	var year=time.getYear();
	if (year < 2000)    // Y2K Fix
	year = year + 1900; //
	document.write(lmonth + " ");
	document.write(date + ", " + year);
}
	

// Text Input Field Highlight
function setBgImage(element,imageFile) {
  element.style.backgroundImage="url("+imageFile+")";
  element.style.color="#354D73";
}

// Text Input Field Normal
function setBgImageOver(element,imageFile) {
  element.style.backgroundImage="url("+imageFile+")";
  element.style.color="#FFFFFF";
}

function expand(listID) {
        if (listID.style.display=="none") {
                listID.style.display="";
        }
        else {
                listID.style.display="none";
        }
        window.event.cancelBubble=true;
}
function contract(listID) {
        if (listID.style.display=="show") {
                listID.style.display="";
        }
        else {
                listID.style.display="none";
        }
        window.event.cancelBubble=true;
}
function mouseover(el) {
  el.className = "leftMainNavHover";
}

function mouseout(el) {
  el.className = "leftMainNav";
}

function mousedown(el) {
  el.className = "pressed";
}

function mouseup(el) {
  el.className = "leftMainNavHover";
}
// Button Rollovers
function changeColor(color){
  var el=event.srcElement;
  if (el.tagName=="INPUT"&&(el.type=="button"||el.type=="submit"||el.type=="reset"))
  event.srcElement.style.backgroundColor=color;
}
function launchwin(winurl,winname,winfeatures)
{
	//This launches a new window and then
	//focuses it if window.focus() is supported.
	newwin = window.open(winurl,winname,winfeatures);
	if(parseInt(navigator.appVersion) >= 4)
	{
		//delay a bit here because IE4 encounters errors
		//when trying to focus a recently opened window
 		setTimeout('newwin.focus();',250);
	}
}
function launchFullWin(winurl,winname)
{
	//This launches a new window and then
	//focuses it if window.focus() is supported.
  	var winl = 0;//screen.width / 2;
  	var wint = 0;//screen.height / 2;
	newwin = window.open(winurl,winname,'scrollbars=yes,resizable=yes,menubar=yes,toolbar=yes,top=' + wint + ',left=' + winl + ',width=' + screen.width + ',height=' + screen.weight);
	if(parseInt(navigator.appVersion) >= 4)
	{
		//delay a bit here because IE4 encounters errors
		//when trying to focus a recently opened window
 		setTimeout('newwin.focus();',250);
	}
}
function launchCenteredWin(url, name, width, height, otherfeatures)
{
  var str = "height=" + height + ",innerHeight=" + height;
  str += ",width=" + width + ",innerWidth=" + width;
  if (window.screen) {
    var ah = screen.availHeight - 30;
    var aw = screen.availWidth - 10;

    var xc = (aw - width) / 2;
    var yc = (ah - height) / 2;

    str += ",left=" + xc + ",screenX=" + xc;
    str += ",top=" + yc + ",screenY=" + yc;
  }
  newwin = window.open(url, name, str + ',' + otherfeatures);
  if(parseInt(navigator.appVersion) >= 4)
  {
	//delay a bit here because IE4 encounters errors
	//when trying to focus a recently opened window
 	setTimeout('newwin.focus();',250);
  }
}

//news scroller functions
 function scrollerObj(name,initH,initW,heightB,widthB,content,initBg,Bg,speed,initFl){
    this.name=name;
    this.initH=initH;
    this.initW=initW;
    this.heightB=heightB;
    this.widthB=widthB;
    this.content=content;
    this.initBg=initBg;
    this.Bg=Bg;
    this.iniFl=initFl;
    this.speed=parseInt(speed);
    this.timer = name + "Timer";
    this.elem;
    this.getElement = getElement;
    this.createLayer=createLayer;
    this.scrollLayer = scrollLayer; 
    this.scrollLoop=scrollLoop;
    this.createLayer();
    this.getElement();
    this.scrollLayer();
    }

    function scrollLoop(s){
    this.speed = s;
    }

    function scrollLayer(){
    if(parseInt(this.elem.style.top)>(this.elem.offsetHeight*(-1))){
        this.elem.style.top = parseInt(this.elem.style.top)-this.speed;
    }
    else {this.elem.style.top = this.initH;}
    }

    function getElement(){
    if(document.getElementById){
        this.elem = document.getElementById(this.name);
        }
    else if (document.all){
    this.elem = document.all[name];
        }
    else if (document.layers){
    this.elem = document.layers[name];
        }
    }

    function createLayer(){
    if(document.getElementById || document.all){
    document.write('<div id="layer'+this.name+'" style="position:relative;overflow:hidden;float:'+this.initFl+';background-color:#'+this.initBg+';border:1px solid black;width:'+this.initW+'px;height:'+this.initH+'px;" onMouseover="'+this.name+'.scrollLoop(0)" onMouseout="'+this.name+'.scrollLoop('+this.speed+')">');
    document.write('<div id="'+this.name+'" style="position:absolute;top:'+this.initH+'px;left:0px;border:0px solid black;width:'+this.widthB+'px;height:'+this.heightB+'px;background-color:#'+this.Bg+'">');
    document.write(this.content);
    document.write('<\/div><\/div>');}
    else if(document.layers){
     document.write('<ilayer name="'+this.name+'" bgcolor="#'+this.Bg+'" width="'+this.widthB+'" height="'+this.heightB+'">'+this.content+'<\/ilayer>');
        return;
    }

    if(this.scrollLayer){
      this.timer = setInterval(this.name+'.scrollLayer()','30');
    }
    }
	
//Macromedia Functions
function MM_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=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_validateForm() { //v4.0
  var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
  for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
    if (val) { nm=val.name; if ((val=val.value)!="") {
      if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
        if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
      } else if (test!='R') { num = parseFloat(val);
        if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
        if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
          min=test.substring(8,p); max=test.substring(p+1);
          if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
    } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }
  } if (errors) alert('The following error(s) occurred:\n'+errors);
  document.MM_returnValue = (errors == '');
}


