function setBaseFontSize(sizeIndex)
{
	document.body.style.fontSize = sizeIndex+ 'em';
}

function DOTyear()
{
	var today = new Date();
	thisyear = today.getFullYear();
	DOTyear = thisyear - 6;
	if (DOTyear <= 1999)
	{
		DOTyearstring = DOTyear.toString();
		twodigit=DOTyearstring.substring(3);

	}
	if (DOTyear >= 2000)
	{
		DOTyearstring = DOTyear.toString();
		twodigit=DOTyearstring.substring(2);

	}
	return twodigit;
}
// -----------------------------------------------------------------------------------

function DOTweek(){
	var today = new Date();
	year=today.getYear();
	month=today.getMonth();
	day=today.getDate();
    month += 1; //use 1-12
    var a = Math.floor((14-(month))/12);
    var y = year+4800-a;
    var m = (month)+(12*a)-3;
    var jd = day + Math.floor(((153*m)+2)/5) +
                 (365*y) + Math.floor(y/4) - Math.floor(y/100) +
                 Math.floor(y/400) - 32045;      // (gregorian calendar)
    //var jd = (day+1)+Math.Round(((153*m)+2)/5)+(365+y) +
    //                 Math.round(y/4)-32083;    // (julian calendar)

    //now calc weeknumber according to JD
    var d4 = (jd+31741-(jd%7))%146097%36524%1461;
    var L = Math.floor(d4/1460);
    var d1 = ((d4-L)%365)+L;
    NumberOfWeek = Math.floor(d1/7) + 1;
    // turn it into a string and check its length. if the length is 1 then it's a single digit
    // and needs a leading "0" to be added to it to make sense
    NumberOfWeek = NumberOfWeek + "";
    if (NumberOfWeek.length == 1)
    {
    	NumberOfWeek = "0" + NumberOfWeek;
    }
    return NumberOfWeek;
}
// -----------------------------------------------------------------------------------


function countup (date)
{
	var now = new Date();
	// set this value to the countdown date.
	var then = new Date(date);
	var gap = now.getTime() - then.getTime();
	gap = Math.floor(gap / (1000 * 60 * 60 * 24));
	// gap = Math.floor(gap);
	return gap;
}
// -----------------------------------------------------------------------------------

function countdown (date)
{
	var now = new Date();
	// set this value to the countdown date.
	var then = new Date(date);
	var gap = then.getTime() - now.getTime();
	gap = Math.floor(gap / (1000 * 60 * 60 * 24));
	// gap = Math.floor(gap);
	return gap;
}
// -----------------------------------------------------------------------------------


// expand-o-matic from http://www.dustindiaz.com/dhtml-expand-and-collapse-div-menu/ 

function ExpandContract(obj) {
	var el = document.getElementById(obj);
	if ( el.style.display != "none" ) {
		el.style.display = 'none';
	}
	else {
		el.style.display = '';
	}
}

function collapseAll(objs) {
	var i;
	for (i=0;i<objs.length;i++ ) {
		objs[i].style.display = 'none';
	}
}

function expandAll(objs) {
	var i;
	for (i=0;i<objs.length;i++ ) {
		objs[i].style.display = '';
	}
}

function dollar() {
	var elements = new Array();
	for (var i = 0; i < arguments.length; i++) {
		var element = arguments[i];
		if (typeof element == 'string')
		element = document.getElementById(element);
		if (arguments.length == 1)
		return element;
		elements.push(element);
	}
	return elements;
}


// -----------------------------------------------------------------------------------
// This is the implementation of SimpleSwap
// by Jehiah Czebotar
// Version 1.1 - June 10, 2005
// Distributed under Creative Commons
// Include this script on your page
// then make image rollovers simple like:
// http://jehiah.com/archive/simple-swap
// -----------------------------------------------------------------------------------


function SimpleSwap(el,which){
  el.src=el.getAttribute(which || "origsrc");
}

function SimpleSwapSetup(){
  var x = document.getElementsByTagName("img");
  for (var i=0;i<x.length;i++){
    var oversrc = x[i].getAttribute("oversrc");
    if (!oversrc) continue;
      
    // preload image
    // comment the next two lines to disable image pre-loading
    x[i].oversrc_img = new Image();
    x[i].oversrc_img.src=oversrc;
    // set event handlers
    x[i].onmouseover = new Function("SimpleSwap(this,'oversrc');");
    x[i].onmouseout = new Function("SimpleSwap(this);");
    // save original src
    x[i].setAttribute("origsrc",x[i].src);
  }
}

// Functions run to initialise simpleswap images
var PreSimpleSwapOnload =(window.onload)? window.onload : function(){};
window.onload = function(){PreSimpleSwapOnload(); SimpleSwapSetup();}

// -----------------------------------------------------------------------------------

