//menu rollovers

if (document.images) {

	img1on = new Image(72,32);
	img1on.src = '/gfx/bmenu2_01.gif';
	img1off = new Image(72,32);
	img1off.src = '/gfx/bmenu1_01.gif';
	
	img2on = new Image(72,32);
	img2on.src = '/gfx/bmenu2_02.gif';
	img2off = new Image(72,32);
	img2off.src = '/gfx/bmenu1_02.gif';
	
	img3on = new Image(72,32);
	img3on.src = '/gfx/bmenu2_03.gif';
	img3off = new Image(72,32);
	img3off.src = '/gfx/bmenu1_03.gif';
	
	img4on = new Image(72,32);
	img4on.src = '/gfx/bmenu2_04.gif';
	img4off = new Image(72,32);
	img4off.src = '/gfx/bmenu1_04.gif';
	
	img5on = new Image(72,32);
	img5on.src = '/gfx/bmenu2_05.gif';
	img5off = new Image(72,32);
	img5off.src = '/gfx/bmenu1_05.gif';
	
	img6on = new Image(72,32);
	img6on.src = '/gfx/bmenu2_06.gif';
	img6off = new Image(72,32);
	img6off.src = '/gfx/bmenu1_06.gif';
	
	img7on = new Image(72,32);
	img7on.src = '/gfx/bmenu2_07.gif';
	img7off = new Image(72,32);
	img7off.src = '/gfx/bmenu1_07.gif';

	img8on = new Image(72,32);
	img8on.src = '/gfx/bmenu2_08.gif';
	img8off = new Image(72,32);
	img8off.src = '/gfx/bmenu1_08.gif';
	
	img9on = new Image(72,32);
	img9on.src = '/gfx/bmenu2_09.gif';
	img9off = new Image(72,32);
	img9off.src = '/gfx/bmenu1_09.gif';
	
	img10on = new Image(72,32);
	img10on.src = '/gfx/bmenu2_10.gif';
	img10off = new Image(72,32);
	img10off.src = '/gfx/bmenu1_10.gif';

}


function imgOn(imgName) {
        if (document.images) {
            document[imgName].src = eval(imgName + "on.src");
        }
}
function imgOff(imgName) {
        if (document.images) {
            document[imgName].src = eval(imgName + "off.src");
        }
}

function setActiveStyleSheet(title) {
  var i, a, main;
  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
    if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title")) {
      a.disabled = true;
      if(a.getAttribute("title") == title) a.disabled = false;
    }
  }
}

function getActiveStyleSheet() {
  var i, a;
  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
    if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title") && !a.disabled) return a.getAttribute("title");
  }
  return null;
}

function getPreferredStyleSheet() {
  var i, a;
  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
    if(a.getAttribute("rel").indexOf("style") != -1
       && a.getAttribute("rel").indexOf("alt") == -1
       && a.getAttribute("title")
       ) return a.getAttribute("title");
  }
  return null;
}

function createCookie(name,value,days) {
  if (days) {
    var date = new Date();
    date.setTime(date.getTime()+(days*24*60*60*1000));
    var expires = "; expires="+date.toGMTString();
  }
  else expires = "";
  document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) {
  var nameEQ = name + "=";
  var ca = document.cookie.split(';');
  for(var i=0;i < ca.length;i++) {
    var c = ca[i];
    while (c.charAt(0)==' ') c = c.substring(1,c.length);
    if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
  }
  return null;
}

window.onload = function(e) {
  var cookie = readCookie("style");
  var title = cookie ? cookie : getPreferredStyleSheet();
  setActiveStyleSheet(title);
}

window.onunload = function(e) {
  var title = getActiveStyleSheet();
  createCookie("style", title, 365);
}

var cookie = readCookie("style");
var title = cookie ? cookie : getPreferredStyleSheet();
setActiveStyleSheet(title);

