function activateLinks(){
	for (var i = 0; document.links.length > i; i++){
		if (
			(document.links[i].onclick == undefined ||
			document.links[i].onclick.toString().indexOf('return') == -1) &&
			document.links[i].target == ''
		){
			document.links[i].onmousedown = clickHandler;
		}
	}

	if (document.all == undefined) return;

	for (var i = 0; document.forms.length > i; i++){	
		for (var j = 0; document.forms[i].all.length > j; j++){
			if (
				document.forms[i].all[j].type == 'image' &&
				(document.forms[i].all[j].onclick == undefined ||
				document.forms[i].all[j].onclick == null ||
				document.forms[i].all[j].onclick.toString().indexOf('return') == -1)
			){
				document.forms[i].all[j].onmousedown = clickHandler;
			}
		}
	}
}


function clickHandler(){
	this.style.cursor = document.body.style.cursor = 'wait';
}


function resetLinks(){
	for (var i = 0; document.links.length > i; i++){
			if (document.links[i].style.cursor != undefined) document.links[i].style.cursor = document.body.style.cursor = 'auto';
	}

	if (document.all == undefined) return;

	for (var i = 0; document.forms.length > i; i++){
		for (var j = 0; document.forms[i].all.length > j; j++){
			if (document.forms[i].all[j].style != undefined) document.forms[i].all[j].style.cursor = document.body.style.cursor = 'auto';
		}
	}
}


function openWindow(mySource, myName, myParams, myTempMessage){
	if (mySource == undefined) mySource = 'about:blank';
	if (myTempMessage == undefined) myTempMessage = 'Loading ...';

	if (myParams){
		re = /width=(\d+)/;
		if (re.test(myParams)) myWidth = RegExp.$1;
		re = /height=(\d+)/;
		if (re.test(myParams)) myHeight = RegExp.$1;
	}

	if (myWidth != undefined){
		myParams = myParams + ',left=' + (screen.width / 2 - myWidth / 2);
	}

	if (myHeight != undefined){
		myParams = myParams + ',top=' + (screen.height / 2 - myHeight / 2);
	}

	myTempMessage = '<HTML><BODY><P>&nbsp;</P><P ALIGN=CENTER><FONT FACE=Verdana SIZE=2><B>' + myTempMessage + '</B></FONT></P></BODY><SCRIPT>window.location=\\\'' + mySource + '\\\'</SCRIPT></HTML>';
	myNewSource = "javascript:document.write('" + myTempMessage + "')";

	window.open(myNewSource, myName, myParams);
}


function pageInit(){
	resetLinks();
	activateLinks();
}


function moveList(myBox){
	var allSelected = new Array();
	for (i = 0; i < myBox.options.length; i++){
		if (myBox.options[i].selected) allSelected[allSelected.length] = i;
	}


	if (allSelected.length > 0) myBox.selectedIndex = allSelected[allSelected.length - 1];
	for (i = (allSelected.length - 2); i >= 0; i--){
		myBox.options[allSelected[i]].selected = true;
	}
}
