// URLS maxweb20.js v1.2.1
// Copyright (c) 2006-2007 Max Demian (http://max.subfighter.com/)

// Global Variables
if(navigator.appName == "Microsoft Internet Explorer"){
	var nn6 = false;
} else {
	var nn6 = true;
}

// Div Functions
function resetdiv(whichdiv, width, height, position, opacity) {
	document.getElementById(whichdiv).style.width = width;
	document.getElementById(whichdiv).style.height = height;
	document.getElementById(whichdiv).style.opacity =  (opacity / 100);
	document.getElementById(whichdiv).style.filter = "alpha(opacity=" + opacity + ")";
	document.getElementById(whichdiv).style.position = position;
	document.getElementById(whichdiv).style.display = "";
}

function splashimage(bgdiv, fgdiv, bgcolor, bgopac) {
	document.getElementById(bgdiv).style.zIndex = 99;
	document.getElementById(fgdiv).style.zIndex = 100;

	document.getElementById(bgdiv).style.top = 0;
	document.getElementById(fgdiv).style.top = (nn6 ? window.pageYOffset : document.body.scrollTop);
	document.getElementById(bgdiv).style.left = 0;
	document.getElementById(fgdiv).style.left = 0;

	document.getElementById(bgdiv).style.height = window.screen.height;
	document.getElementById(fgdiv).style.height = (nn6 ? window.innerHeight : document.body.offsetHeight);
	document.getElementById(bgdiv).style.width = window.screen.width;
	document.getElementById(fgdiv).style.width = (nn6 ? window.innerWidth : document.body.offsetWidth);

	document.getElementById(bgdiv).style.backgroundColor = bgcolor;
	document.getElementById(bgdiv).style.opacity = bgopac/100;
	document.getElementById(bgdiv).style.filter = "alpha(opacity=" + bgopac + ");";

	document.getElementById(bgdiv).style.position = "absolute";
	document.getElementById(fgdiv).style.position = "absolute";

	document.getElementById(bgdiv).style.display = "";
	document.getElementById(fgdiv).style.display = "";
}

function removesplash(bgdiv, fgdiv) {
	document.getElementById(bgdiv).style.display = "none";
	document.getElementById(fgdiv).style.display = "none";
}

function showdivcursor(whichdiv, plusx, plusy, e) {
	var lLeft = 0;
	var lTop = 0;

	lLeft = (nn6 ? (pageXOffset + e.clientX + plusx) : (document.body.scrollLeft +event.clientX + plusx));
	lTop = (nn6 ? (pageYOffset + e.clientY + plusy) : (document.body.scrollTop  + event.clientY + plusy));

	document.getElementById(whichdiv).style.left = lLeft + 'px';
	document.getElementById(whichdiv).style.top = lTop + 'px';
	document.getElementById(whichdiv).style.zIndex = 100;
	document.getElementById(whichdiv).style.display = "";
}

function fadein(whichdiv, speed, opac) {
	if (!opac) { var opac = 0; }
	if (opac < 10) {
		if (opac == 0) {
			document.getElementById(whichdiv).style.display = "";
		}
		opac++;
		document.getElementById(whichdiv).style.opacity = opac/10;
		document.getElementById(whichdiv).style.filter = "alpha(opacity=" + opac*10 + ")";
		setTimeout("fadein('" + whichdiv + "', '" + speed + "', '" + opac + "')", speed);
	}
}

function fadeout(whichdiv, speed, opac) {
	if (!opac) { var opac = 10; }

	if (opac > 0) {
		opac--;
		document.getElementById(whichdiv).style.opacity = opac/10;
		document.getElementById(whichdiv).style.filter = "alpha(opacity=" + opac*10 + ")";
		setTimeout("fadeout('" + whichdiv + "', '" + speed + "', '" + opac + "')", speed);
	} else {
		document.getElementById(whichdiv).style.display = "none";
	}
}

function rollup(whichdiv, speed, height, orig) {
	if (height > 0) {
		height = ((height / orig) - .01) * orig;
		document.getElementById(whichdiv).style.height = height;
		setTimeout("rollup('" + whichdiv + "', '" + speed + "', '" + height + "', '" + orig + "')", speed);
	} else {
		document.getElementById(whichdiv).style.display = "none";
	}
}

function rolldown(whichdiv, speed, height, orig) {
	if (parseInt(height) < parseInt(orig)) {
		if (height == 0) {
			document.getElementById(whichdiv).style.display = "";
		}
		height = ((height / orig) + .01) * orig;
		document.getElementById(whichdiv).style.height = height;
		setTimeout("rolldown('" + whichdiv + "', '" + speed + "', '" + height + "', '" + orig + "')", speed);
	}
}

function foldin(whichdiv, speed, width, orig) {
	if (width > 0) {
		width = ((width / orig) - .01) * orig;
		document.getElementById(whichdiv).style.width = width;
		setTimeout("foldin('" + whichdiv + "', '" + speed + "', '" + width + "', '" + orig + "')", speed);
	} else {
		document.getElementById(whichdiv).style.display = "none";
	}
}

function foldout(whichdiv, speed, width, orig) {
	if (parseInt(width) < parseInt(orig)) {
		if (width == 0) {
			document.getElementById(whichdiv).style.display = "";
		}
		width = ((width / orig) + .01) * orig;
		document.getElementById(whichdiv).style.width = width;
		setTimeout("foldout('" + whichdiv + "', '" + speed + "', '" + width + "', '" + orig + "')", speed);
	}
}

function puff(whichdiv, speed, width, height, size) {
	if (!size) { var size = 0; }

	if (size == 0) {
		var dleft = document.getElementById(whichdiv).offsetLeft + document.getElementById(whichdiv).offsetParent.offsetLeft;
		var dtop = document.getElementById(whichdiv).offsetTop + document.getElementById(whichdiv).offsetParent.offsetTop;
		document.getElementById(whichdiv).style.position = "absolute";
		document.getElementById(whichdiv).style.left = dleft + 'px';
		document.getElementById(whichdiv).style.top = dtop + 'px';
	}

	if (size < 100) {
		size++;
		width++;
		height++;
		opac = 100 - size;
		document.getElementById(whichdiv).style.opacity = opac/100;
		document.getElementById(whichdiv).style.filter = "alpha(opacity=" + opac + ")";
		document.getElementById(whichdiv).style.width = width;
		document.getElementById(whichdiv).style.height = height;
		setTimeout("puff('" + whichdiv + "', '" + speed + "', '" + width + "', '" + height + "', '" + size + "')", speed);
	} else {
		document.getElementById(whichdiv).style.display = "none";
	}
}

function implode(whichdiv, speed, width, height, size) {
	if (!size) { var size = 100; }

	if (size > 0) {
		size--;
		document.getElementById(whichdiv).style.opacity = size/100;
		document.getElementById(whichdiv).style.filter = "alpha(opacity=" + size + ")";
		document.getElementById(whichdiv).style.width = (size / 100)  * width;
		document.getElementById(whichdiv).style.height = (size / 100)  * height;
		setTimeout("implode('" + whichdiv + "', '" + speed + "', '" + width + "', '" + height + "', '" + size + "')", speed);
	} else {
		document.getElementById(whichdiv).style.display = "none";
	}
}

function grow(whichdiv, speed, width, height, size) {
	if (!size) { var size = 0; }

	if (size < 100) {
		if (size == 0) {
			document.getElementById(whichdiv).style.display = "";
		}
		size++;
		document.getElementById(whichdiv).style.width = (size / 100)  * width;
		document.getElementById(whichdiv).style.height = (size / 100)  * height;
		setTimeout("grow('" + whichdiv + "', '" + speed + "', '" + width + "', '" + height + "', '" + size + "')", speed);
	}
}

function shrink(whichdiv, speed, width, height, size) {
	if (!size) { var size = 100; }

	if (size > 0) {
		size--;
		document.getElementById(whichdiv).style.width = (size / 100)  * width;
		document.getElementById(whichdiv).style.height = (size / 100)  * height;
		setTimeout("shrink('" + whichdiv + "', '" + speed + "', '" + width + "', '" + height + "', '" + size + "')", speed);
	} else {
		document.getElementById(whichdiv).style.display = "none";
	}
}

function togglediv(whichdiv) {
	if (document.getElementById(whichdiv).style.display == "none") {
		document.getElementById(whichdiv).style.display = "";
	} else {
		document.getElementById(whichdiv).style.display = "none";
	}
}

// Drag Functions
var isdrag = false;
var x, y;
var dobj;

document.onmousedown = selectmouse;
document.onmouseup = new Function("isdrag=false");

function movemouse(e) {
	if (isdrag) {
		dobj.style.left = (nn6 ? tx + e.clientX - x : tx + event.clientX - x);
		dobj.style.top  = (nn6 ? ty + e.clientY - y : ty + event.clientY - y);
		return false;
	}
}

function selectmouse(e) {
	var fobj = (nn6 ? e.target : event.srcElement);
	var topelement = (nn6 ? "HTML" : "BODY");

	while (fobj.tagName != topelement && fobj.className != "drag") {
		fobj = (nn6 ? fobj.parentNode : fobj.parentElement);
	}

	if (fobj.className == "drag") {
		isdrag = true;
		dobj = fobj;
		tx = parseInt(dobj.style.left + 0);
		ty = parseInt(dobj.style.top + 0);
		x = (nn6 ? e.clientX : event.clientX);
		y = (nn6 ? e.clientY : event.clientY);
		document.onmousemove = movemouse;
		return false;
	}
}

// Ajax Functions

if (nn6) {
	var http = new XMLHttpRequest();
} else {
	var http = new ActiveXObject("Microsoft.XMLHTTP");
}

var wdiv;

function ajaxGetURL(pageurl, divid, loadimage) {
	wdiv = divid;

	if (loadimage && loadimage != "") {
		document.getElementById(wdiv).innerHTML = "<img src='" + loadimage + "' alt='Loading' title='Loading'>";
	}

	http.open('GET', pageurl, true);
	http.onreadystatechange = handleResponse;
	http.send('variableweareforcedtoputheretofixtheinternetexplorercachingbug=1');
}

function ajaxPostURL(pageurl, divid, loadimage) {
	wdiv = divid;

	if (loadimage && loadimage != "") {
		document.getElementById(wdiv).innerHTML = "<img src='" + loadimage + "' alt='Loading' title='Loading'>";
	}

	http.open('POST', pageurl, true);
	http.onreadystatechange = handleResponse;
	http.send('variableweareforcedtoputheretofixtheinternetexplorercachingbug=1');
}

function handleResponse() {
	if(http.readyState == 4){
		var response = http.responseText;

		document.getElementById(wdiv).innerHTML = response;
	}
}