weekday = new Array(
   'Sunday',
   'Monday',
   'Tuesday',
   'Wednesday', 
   'Thursday',"Friday","Saturday");
monthname=new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec");



function setTitle(title) {
   try {
      if (typeof top.frames['headerframe'] != 'undefined') {
         title = title.substr(0, 1).toUpperCase() + title.substr(1, title.length);
         top.frames['headerframe'].document.getElementById('title').firstChild.nodeValue = title;
      }
   }
   catch (e) {
   }
}

function firstToUpper(str) {
   return str.charAt(0).toUpperCase() + str.substring(1);
}

if (typeof Number.prototype.toFixed == 'undefined') {
   Number.prototype.toFixed = function(n) {
      var p = Math.pow(10,n);
      var sFixedNum = (Math.round(this * p) / p).toString();
      
      var aFixedNum = sFixedNum.split('.');
      if (aFixedNum.length == 1) aFixedNum[1] = '';
      
      var l = aFixedNum[1].length;
      while (l++ < n) aFixedNum[1] += '0';
      
      return aFixedNum.join('.');
   }
}

function indexOf(val, arr) {
   for (var i = 0; i < arr.length; i++) {
      if (arr[i] == val) {
         return i;
      }
   }
   return -1;
}

function doPrint() {
   top.frames['contentframe'].focus();
   top.frames['contentframe'].print();
}

function switchNav(mainCategory) {
   parent.frames['menuframe'].location.href = 'menu.html?main-category=' + mainCategory;
}

function loadNav(url) {
   if (!top.frames['contentframe'].frames['menuframe']) {
      top.frames['contentframe'].location.href = 'frameset.html';
   }
   for (i = 0; i < 10000; i++); // slow down thread
   top.frames['contentframe'].frames['menuframe'].location.href = url;
}

function popUp (fileName, popUpWidth, popUpHeight) {
   margeLeft = (screen.width - popUpWidth) / 2;
   margeTop = (screen.height - popUpHeight) / 2;
   
   parameterString = "width=" + popUpWidth + ",height=" + popUpHeight + ",left=" + margeLeft + ",top=" + margeTop + ",scrollbars=no";
   popWindow = window.open(fileName, "_blank", parameterString);
   popWindow.focus();
}

function popup ( aElement ) {
   if ( aElement && aElement.href ) {
      popUpS ( aElement.href, 500, 400 );
      return false;
   }
   return true;
}

function popUpS (fileName, popUpWidth, popUpHeight) {
   margeLeft = (screen.width - popUpWidth) / 2;
   margeTop = (screen.height - popUpHeight) / 2;
   
   parameterString = "width=" + popUpWidth + ",height=" + popUpHeight + ",left=" + margeLeft + ",top=" + margeTop + ",scrollbars=yes";
   popWindow = window.open(fileName, "_blank", parameterString);
   popWindow.focus();
}
