var currentSize = 76;
var currentAlign = "justify";

function swap() {
	this.className="msie"
	}
	
function swapBack() {
	this.className="dropdown"
	}
	
function swapfocus() {
	this.parentNode.parentNode.parentNode.className="msie"
	}
	
function swapblur() {
	this.parentNode.parentNode.parentNode.className="dropdown"
	}
	
function SetupEvents() {
	if (document.getElementById){
		
		var menuLI = document.getElementsByTagName("li");
		var allmenuLI= menuLI.length;
		
		for(var x=0;x<allmenuLI;x++){ 
			if(menuLI[x].parentNode.parentNode.className=="dropdown")
				{
					menuLI[x].firstChild.onfocus=swapfocus;
					menuLI[x].firstChild.onblur=swapblur;
				}
				
			if(menuLI[x].className=="dropdown")	
				{
					menuLI[x].onmouseover=swap;
					menuLI[x].onmouseout=swapBack;
				}
		}
	}
	
}

function setFontSize(ev, percentage, prevent)
{
    if (document.getElementsByTagName) {
	currentSize = percentage;
	document.getElementsByTagName("body")[0].style.fontSize = currentSize + '%';

	if (window.event) {
	    window.event.returnValue = false;
	} else {
	    ev.preventDefault();
	}
    }
}

function decreaseFontSize(ev)
{
    setFontSize(ev, currentSize / 1.13, true);
    window.location.href = window.location.href;
}

function defaultFontSize(ev)
{
    setFontSize(ev, 76, true);
    window.location.href = window.location.href;
}

function increaseFontSize(ev)
{
    setFontSize(ev, currentSize * 1.13, true);
}

function setTextAlign(ev, alignment, prevent)
{
    if (document.getElementsByTagName) {
	currentAlign = alignment
	for( var x = 0; x < document.getElementsByTagName("p").length; x++ ) {
	document.getElementsByTagName("p")[x].style.textAlign = currentAlign;
}
	for( var x = 0; x < document.getElementsByTagName("dl").length; x++ ) {
	document.getElementsByTagName("dl")[x].style.textAlign = currentAlign;
}
	if (window.event) {
	    window.event.returnValue = false;
	} else {
	    ev.preventDefault();
	}
    }
}

function leftalignText(ev)
{
    setTextAlign(ev, 'left', true);
}
function justifyText(ev)
{
    setTextAlign(ev, 'justify', true);
}