
var errorMessages = new Array();

errorMessages[0] = 'Unfortunately, your browser does not support this function.  Please select Print from the File menu.';
errorMessages[1] = '';
errorMessages[2] = '';
errorMessages[3] = '';
errorMessages[4] = '';
errorMessages[5] = '';
errorMessages[6] = '';
errorMessages[7] = '';
errorMessages[8] = '';
errorMessages[9] = '';
errorMessages[10] = '';
errorMessages[11] = '';
errorMessages[12] = '';
errorMessages[13] = '';
errorMessages[14] = '';
errorMessages[-7] = 'You have not completed all of the required fields. Please check the information you have provided and enter all required fields.';
errorMessages[-29] = 'You do not have permission to perform this action.';

var texts = new Array();

texts[0] = 'Sunday';
texts[1] = 'Monday';
texts[2] = 'Tuesday';
texts[3] = 'Wednesday';
texts[4] = 'Thursday';
texts[5] = 'Friday';
texts[6] = 'Saturday';
texts[7] = 'Sun';
texts[8] = 'Mon';
texts[9] = 'Tue';
texts[10] = 'Wed';
texts[11] = 'Thu';
texts[12] = 'Fri';
texts[13] = 'Sat';
texts[14] = 'January';
texts[15] = 'February';
texts[16] = 'March';
texts[17] = 'April';
texts[18] = 'May';
texts[19] = 'June';
texts[20] = 'July';
texts[21] = 'August';
texts[22] = 'September';
texts[23] = 'October';
texts[24] = 'November';
texts[25] = 'December';
texts[26] = 'Jan';
texts[27] = 'Feb';
texts[28] = 'Mar';
texts[29] = 'Apr';
texts[30] = 'May';
texts[31] = 'Jun';
texts[32] = 'Jul';
texts[33] = 'Aug';
texts[34] = 'Sep';
texts[35] = 'Oct';
texts[36] = 'Nov';
texts[37] = 'Dec';
texts[38] = 'Loading';
texts[39] = 'Establishing connection ...';
texts[40] = 'Reading data ...';
texts[41] = 'Closing connection ...';
texts[42] = 'Done';

function get_error_message(errorNo) {
    return errorMessages[errorNo];
}

function get_text(textNo) {
    return texts[textNo];
}var time = new Date();
var popupcount = time.getTime();
function newpopup(url, w, h, scroll) {
   if ("" + scroll == "undefined") {
     scroll = "no";
   }
   var options = "width=" + w + ",height=" + h +",";
   options += "resizable=no,scrollbars=" + scroll + ",status=no,";
   options += "menubar=no,toolbar=no,location=no,directories=no";
   var newWin = window.open(url, 'newWin'+popupcount, options);
   newWin.focus();
   popupcount++;
//   return false;
}

function toggleVisibility(pTarget, pDirection) {
  var targetObject = document.getElementById(pTarget);
  if ((targetObject.style.visibility!="visible") && (pDirection!=0)) {
//    targetObject.style.position="fixed";
    targetObject.style.visibility="visible";
  } else if (pDirection!=1) {
//    targetObject.style.position="absolute";
    targetObject.style.visibility="hidden";
  }
}

function MM_swapImgRestore() {
  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() {
  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_findObj(n, d) {
  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); return x;
}
function MM_swapImage() {
  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_jumpMenu(targ,selObj,restore){ //v3.0
  if(selObj.options[selObj.selectedIndex].value == GGchooseone){
     return false;
  }else{
  eval(targ+".location='/"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
  }
}
function mOvr(src,clrOver) {
   if (!src.contains(event.fromElement))
   {
   src.style.cursor = 'hand';
   src.bgColor = clrOver;
   }
}
function mOut(src,clrIn) {
   if (!src.contains(event.toElement))
   {
   src.style.cursor = 'default';
   src.bgColor = clrIn;
   }
}

function mOvrClass(src,classOver) {
   if (!src.contains(event.fromElement))
   {
   src.style.cursor = 'hand';
   src.className = classOver;
   }
}
function mOutClass(src,classIn) {
   if (!src.contains(event.toElement))
   {
   src.style.cursor = 'default';
   src.className = classIn;
   }
}


function PrintPage(){
   if (window.print != null) {
      window.print();
   } else {
      alert(get_error_message(0));
   }
}
function CenterWindow(){
  var isNav4, isIE4;
  if (parseInt(navigator.appVersion.charAt(0)) >= 4) {
    isNav4 = (navigator.appName == "Netscape") ? 1 : 0;
    isIE4 = (navigator.appName.indexOf("Microsoft") != -1) ? 1 : 0;
  }
  if (isNav4) {
    winw = window.innerWidth;
    winh = window.innerHeight;
  }
  if (isIE4) {
    winw = document.body.clientWidth;
    winh = document.body.clientHeight;
  }
  swidth = (screen.width / 2) - (winw / 2);
  sheight = (screen.height / 2) - (winh / 2);
  self.moveTo(swidth,sheight);
}
function redirect(url) {
   if (url != null) {
      location.href = url;
   }
   return false;
}

function DateSuffix(dt){
   switch(dt){
      case "1":
         return "1st";
         break;
      case "2":
         return "2nd";
         break;
      case "3":
         return "3rd";
         break;
      case "01":
         return "1st";
         break;
      case "02":
         return "2nd";
         break;
      case "03":
         return "3rd";
         break;
      case "21":
         return "21st";
         break;
      case "22":
         return "22nd";
         break;
      case "23":
         return "23rd";
         break;
      case "31":
         return "31st";
         break;
      default:
         return dt + "th";
         break;
   }
}

function statusSet(newStat){
  window.status = newStat;
  return true;
}

// These variables are used to determine which DOM is available to us
var isDOM   = (typeof(document.getElementsByTagName) != 'undefined' && typeof(document.createElement) != 'undefined') ? 1 : 0;
var isIE4   = (typeof(document.all) != 'undefined' && parseInt(navigator.appVersion) >= 4 && !typeof(window.opera)) ? 1 : 0;
var capable = (isDOM || isIE4) ? 1 : 0;

// Calculates the location of the object we are after, based on the DOM
// supported by this user agent. Works out the object based on the user agent
function getObj(el) {
  var whichEl = false;
  if (isDOM) {
    var whichEl = document.getElementById(el);
  } else if (isIE4) {
    var whichEl = document.all(el);
  }
  return whichEl;
}// Expands an element, given an element name. If the second parameter is true, it will
// collapse all other open of this prefix elements first.
function _expand(elNo) {
  if (!capable) return;
  if (!this.multiple) this.collapseAll();
  var whichEl = getObj(this.prefix + elNo + 'Child');
  whichEl.style.display  = 'block';
  return false;
}

// Collapse an element, given an element name.
function _collapse(elNo) {
  if (!capable) return;
  var whichEl = getObj(this.prefix + elNo + 'Child');
  whichEl.style.display  = 'none';
  return false;
}

// Toggles the display mode. Probably the most useful method here - this
// will open a closed element, or close an opened one, given the element name
function _toggle(elNo) {
  if (!capable) return;
  var whichEl = getObj(this.prefix + elNo + 'Child');
  if (whichEl.style.display == 'block'){
    this.collapse(elNo);
  } else {
    this.expand(elNo);
  }
  return false;
}

// Find out the number of elements in this prefix.
// IMPORTANT: Only works if element numbers are sequential integers with no gaps.
function _getNumElements() {
  var i=0;
  while (++i){
    var obj = getObj(this.prefix + i + 'Parent');
    if (!obj) return i-1;
  }
}

// Collapses all elements of this prefix
function _collapseAll() {
  var numElements = this.getNumElements();
  for(i = 1; i <= numElements; i++) this.collapse(i);
  return;
}

// Master object - allows multiple versions of this code to run on the same page
function hiddenContent(prefix, multiple) {

    // Properties
    this.prefix   = prefix; // (string) the prefix used for page object controlled from this object
    this.multiple = multiple; // (bool) allow several <div> tags of the same prefix to be open at once?

    // Methods
    this.getNumElements = _getNumElements;
    this.collapseAll    = _collapseAll;
    this.expand         = _expand;
    this.collapse       = _collapse;
    this.toggle         = _toggle;
}