// JavaScript Document
var prefsLoaded = false;
var currentFontSize = 12;
var currentFontType = 1;
var currentStyle = "black";



function revertStyles(){
	currentFontType = 1;
	setFontFace(1);
	
	currentFontSize = 12;
	changeFontSize(0);
	
	currentStyle = "black";
	setColor("black");
	
	currentWidth = 990;
	setWidth(990);
}
function toggleColors(){
	if(currentStyle == "black"){
		setColor("white");
		}else{
		setColor("black");
	}
	
}
function setColor(color){
	d=new Date();
	flash=Math.round(Math.random()*d.getTime());
	if(color != "black"){
		document.body.className = 'Retro';
		currentStyle = "white";
		
	}else{
		document.body.className = '';
		currentStyle = "black";
	}
}

function changeFontSize(sizeDifference){
	currentFontSize = parseInt(currentFontSize) + parseInt(sizeDifference);

	if(currentFontType == 1){
		if(currentFontSize > 16){
			currentFontSize = 16;
		}else if(currentFontSize < 8){
			currentFontSize = 8;
		}
	}else{
		if(currentFontSize > 19){
			currentFontSize = 19;
		}else if(currentFontSize < 8){
			currentFontSize = 8;
		}
	}
	setFontSize(currentFontSize);
};
function setFontSize(fontSize){
	var stObj = (document.getElementById) ? document.getElementById('content') : document.all('content');
	stObj.style.fontSize = fontSize + 'px';
};


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 =  setUserOptions; document.getElementsByTagName('object');

function setUserOptions(){
	if(!prefsLoaded){
		
		cookie = readCookie("fontSize");
		currentFontSize = cookie ? cookie : 12;
		setFontSize(currentFontSize);
		
		cookie = readCookie("pageColor");
		currentStyle = cookie ? cookie : "black";
		setColor(currentStyle);

		prefsLoaded = true;
	}

}

window.onunload = saveSettings;

function saveSettings()
{
  createCookie("fontSize", currentFontSize, 16);
  createCookie("fontFace", currentFontType, 16);
  createCookie("pageColor", currentStyle, 16);
}

function toggle (targetId) { if (document.getElementById) { target = document.getElementById (targetId); if 
(target.style.display == "none") { target.style.display = ""; } else { target.style.display = "none"; } } }

function newWindow(url) {
				window.open(url, "utd_event", "fullscreen=no,toolbar=no,status=no,menubar=no,scrollbars=yes,resizable=no,directories=no,location=no,width=650,height=410");
			}