var globalElse = '0';

function preImg(img,img2,img3,img4) {
	loadimg0 = new Image;
	loadimg0.src = img;
	loadimg1 = new Image;
	loadimg1.src = img2;
	loadimg2 = new Image;
	loadimg2.src = img3;
	loadimg3 = new Image;
	loadimg3.src = img4;
}
function switchImg(oo,img) {
	if (oo == 'on') {
		if (img == 'xpadicon') {
			document.images['xpadicon'].src = '/images/xpadicon_on.gif';
		}
	} else {
		if (img == 'xpadicon') {
			document.images['xpadicon'].src = '/images/xpadicon.gif';
		}
	}
	return;
}

/**
 * The following code is a slightly modified version of code originating here:
 * http://kussatz.com/gurus/javascript_font_size_changers.html
 */
function GetCookie(name) {
	var cname = name + "=";
	var dc = document.cookie;
	if (dc.length > 0) {
		begin = dc.indexOf(cname);
		if (begin != -1) {
			begin += cname.length;
			end = dc.indexOf(";", begin);
			if (end == -1) end = dc.length;
			return unescape(dc.substring(begin, end));
		}
	}
	return null;
}
function SetCookie(name, value, expires, path, domain, secure) {
	document.cookie = name + "=" + escape(value) +
	((expires == null) ? "" : "; expires=" + expires.toGMTString()) +
	((path == null) ? "" : "; path=" + path) +
	((domain == null) ? "" : "; domain=" + domain) +
	((secure == null) ? "" : "; secure");
}
function DelCookie(name,path,domain) {
	if (GetCookie(name)) {
		document.cookie = name + "=" +
		((path == null) ? "" : "; path=" + path) +
		((domain == null) ? "" : "; domain=" + domain) +
		"; expires=Thu, 01-Jan-70 00:00:01 GMT";
	}
}
function GetExpires() {
	var now = new Date();
	var base = new Date(0);
	var skew = base.getTime();
	if (skew > 0)
		now.setTime(now.getTime() - skew);
		
	now.setTime(now.getTime() + 365 * 24 * 60 * 60 * 1000);
	return now;
}
function doSetLinks(f,e) {
	if (document.forms[f].elements[e].checked == true) {
		SetCookie("allin", '1', GetExpires(), "/");
		allLinksIn('1');
		globalElse = '1';
	} else {
		DelCookie("allin", "/");
		makeExLinks();
		globalElse = '0';
	}
}
function linkInit(f,e) {
	cookie = GetCookie("allin");
	if (cookie) {
		allLinksIn(parseInt(cookie));
		if (eval(document.forms[f])) {
			document.forms[f].elements[e].checked = true;
			globalElse = '1';
		}
	} else {
		if (eval(document.forms[f])) {
			document.forms[f].elements[e].checked = false;
			globalElse = '0';
		}
	}
}
/**
 * Done with that
 **/