function PreLoad() {
	var i = 0;
	imageObj = new Image();
	images = new Array();
	images[0]="/cms/images/button_addcontent_on.gif";
	images[1]="/cms/images/button_addnewpage_on.gif";
	images[2]="/cms/images/button_cancelapproval_on.gif";
	images[3]="/cms/images/button_canceledits_on.gif";
	images[4]="/cms/images/button_delete_on.gif";
	images[5]="/cms/images/button_deleteblock_on.gif";
	images[6]="/cms/images/button_deletepage_on.gif";
	images[7]="/cms/images/button_edit_on.gif";
	images[8]="/cms/images/button_editpage_on.gif";
	images[9]="/cms/images/button_hideeditingtools_on.gif";
	images[10]="/cms/images/button_publish_on.gif";
	images[11]="/cms/images/button_savedraft_on.gif";
	images[12]="/cms/images/button_showeditingtools_on.gif";
	images[13]="/cms/images/button_submitforapproval_on.gif";
	images[14]="/cms/images/button_logout_on.gif";
	images[15]="/cms/images/button_sitenavigation_on.gif";
	images[16]="/cms/images/button_close_on.gif";
	images[17]="/cms/images/button_manageusers_on.gif";
	images[18]="/cms/images/button_returntouserlist_on.gif";
	images[19]="/cms/images/button_dashboard_on.gif";
	images[20]="/cms/images/button_history_on.gif";
	images[21]="/cms/images/button_history_sm_on.gif";
	for(i=0; i<=3; i++) {
		imageObj.src=images[i];
	}
} 
// ------------------ SHOW AND HIDE LAYERS ------------------- //
function ShowNav(id) {
	var t = setTimeout("document.getElementById(" + id + ").style.display = 'block'", 500);
}
function HideNav(id) {
	var t = setTimeout("document.getElementById(" + id + ").style.display = 'none'", 500);
}
// ------------------ SHOW AND HIDE LAYERS ------------------- //
function ShowLayer(id) {
	document.getElementById(id).style.display = "block";
}
function HideLayer(id) {
	document.getElementById(id).style.display = "none";
}
// ------------------ SHOW HIDE LAYER ------------------- //
function ShowHideLayer(id) {
	if (document.getElementById(id).style.display == "block") {
		document.getElementById(id).style.display = "none";
	} else if (document.getElementById(id).style.display == "none") {
		document.getElementById(id).style.display = "block";
	}
}
// ------------------ MAIN NAV ROLL ------------------- //
function MainNavRoll(id) {
	document.getElementById('main' + id).style.background = "url(/images/nbar_bg_main_on.gif) repeat-x";
	document.getElementById('main' + id).style.color = "#ffffff";
	document.style.cursor = 'pointer';
}
function HideLayer(id) {
	document.getElementById(id).style.display = "none";
}
// ------------------ ADMIN POPUP ------------------- //
function AdminPopUp(type,id) {
	if (screen) {
		leftPos = (screen.width / 2) - 437;
		topPos = (screen.height / 2) - 400;
	}
	myWindow = window.open( "/admin.php?ContentID=" + id + "&Type=" + type, "myWindow", "status=1, height=650, width=875, resizable=0, scrollbars=yes, left=" + leftPos + ", top=" + topPos );
	myWindow.focus();
}
// ------------------ ADMIN POPUP WITH SCROLL ------------------- //
function AdminPopUpScroll(type,id) {
	if (screen) {
		leftPos = (screen.width / 2) - 437;
		topPos = (screen.height / 2) - 400;
	}
	myWindow = window.open( "/admin.php?ContentID=" + id + "&Type=" + type, "myWindow", "status=1, height=650, width=875, resizable=0, scrollbars=yes, left=" + leftPos + ", top=" + topPos );
	myWindow.focus();
}
// ------------------ IMAGE ROLLOVERS ------------------- //
function RollOver(name,file) {
	document[name].src = "/images/" + file;
}
// ------------------ CMS BUTTON ROLLOVERS ------------------- //
function ButtonRollOver(name,file) {
	document[name].src = "/cms/images/" + file;
}
// ------------------ CLOSE & REFRESH ------------------- //
function CloseRefresh() {
	window.opener.location.reload();
	window.opener.focus();
	window.close();
}
// ------------------ CLOSE TO NEW ------------------- //
function CloseToNew(page) {
	window.opener.location = page;
	window.opener.focus();
	window.close();
}
// ------------------ SET ACTION ------------------- //
function SetAction(action) {
	document.forms[0].elements['Action'].value = action;
}
// ------------------ NAV OPEN CLOSE ------------------- //
function NavOpenClose(id,span,sign) {
	var ajaxRequest;
	// Set XMLHttpRequest Object
	try { ajaxRequest = new XMLHttpRequest(); } catch (e) { try { ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) { alert("Your browser broke!"); return false; } } }
	// Create a function that will receive data sent from the server
	ajaxRequest.onreadystatechange = function() {
		if (ajaxRequest.readyState == 4) {
			if (sign == "plus") {
				document.getElementById(span).innerHTML = '<a href="javascript:NavOpenClose(\'' + id + '\',\'' + span + '\',\'minus\');"><img src="cms/images/icon_plus.gif" alt="Show/Hide Pages" /></a>';
			} else {
				document.getElementById(span).innerHTML = '<a href="javascript:NavOpenClose(\'' + id + '\',\'' + span + '\',\'plus\');"><img src="cms/images/icon_minus.gif" alt="Show/Hide Pages" /></a>';
			}
			ShowHideLayer(id);
			//document.getElementById(id).innerHTML = '';
		}
	}
	// Send Request
	myid = id.substring(7);
	ajaxRequest.open("GET", "/cms/handle_navigation.php?PageID=" + myid + "&Action=openstate", true);
	ajaxRequest.send(null);	
}
// ------------------ NAV REORDER ------------------- //
function NavReOrder(id,order,dir) {
	var ajaxRequest;
	// Set XMLHttpRequest Object
	try { ajaxRequest = new XMLHttpRequest(); } catch (e) { try { ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) { alert("Your browser broke!"); return false; } } }
	// Create a function that will receive data sent from the server
	ajaxRequest.onreadystatechange = function() {
		if (ajaxRequest.readyState == 4) {
			document.getElementById('navigationadmin').innerHTML = ajaxRequest.responseText;
		}
	}
	// Send Request
	ajaxRequest.open("GET", "/cms/handle_navigation.php?PageID=" + id + "&Action=navreorder&Order=" + order + "&Direction=" + dir, true);
	ajaxRequest.send(null);	
}
// ------------------ NON NAV REORDER ------------------- //
function NonNavReOrder(id,order,dir) {
	var ajaxRequest;
	// Set XMLHttpRequest Object
	try { ajaxRequest = new XMLHttpRequest(); } catch (e) { try { ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) { alert("Your browser broke!"); return false; } } }
	// Create a function that will receive data sent from the server
	ajaxRequest.onreadystatechange = function() {
		if (ajaxRequest.readyState == 4) {
			document.getElementById('nonnavigationadmin').innerHTML = ajaxRequest.responseText;
		}
	}
	// Send Request
	ajaxRequest.open("GET", "/cms/handle_navigation.php?PageID=" + id + "&Action=nonnavreorder&Order=" + order + "&Direction=" + dir, true);
	ajaxRequest.send(null);	
}
// ------------------ PAGE DETAILS ------------------- //
function PageDetails(id) {
	var ajaxRequest;
	// Set XMLHttpRequest Object
	try { ajaxRequest = new XMLHttpRequest(); } catch (e) { try { ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) { alert("Your browser broke!"); return false; } } }
	// Create a function that will receive data sent from the server
	ajaxRequest.onreadystatechange = function() {
		if (ajaxRequest.readyState == 4) {
			document.getElementById('details' + id).innerHTML = ajaxRequest.responseText;
			ShowLayer('details' + id);
		}
	}
	// Send Request
	ajaxRequest.open("GET", "/cms/handle_navigation.php?PageID=" + id + "&Action=details", true);
	ajaxRequest.send(null);	
}
// ------------------ UPDATE RIGHTS ------------------- //
function MyRights(myid,type,id,right) {
	var ajaxRequest;
	// Set XMLHttpRequest Object
	try { ajaxRequest = new XMLHttpRequest(); } catch (e) { try { ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) { alert("Your browser broke!"); return false; } } }
	// Create a function that will receive data sent from the server
	ajaxRequest.onreadystatechange = function() {
		if (ajaxRequest.readyState == 4) {
			//alert(ajaxRequest.responseText);
		}
	}
	// Send Request
	ajaxRequest.open("GET", "/cms/handle_" + type + ".php?UserID=" + myid + "&ThisID=" + id + "&Right=" + right + "&Action=updaterights", true);
	ajaxRequest.send(null);	
}
// ------------------ PAGE CONTENT ------------------- //
function PageContent(id,template,user) {
	var ajaxRequest;
	// Set XMLHttpRequest Object
	try { ajaxRequest = new XMLHttpRequest(); } catch (e) { try { ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) { alert("Your browser broke!"); return false; } } }
	// Create a function that will receive data sent from the server
	ajaxRequest.onreadystatechange = function() {
		if (ajaxRequest.readyState == 4) {
			document.getElementById('content' + id).innerHTML = ajaxRequest.responseText;
			ShowLayer('content' + id);
		}
	}
	// Send Request
	ajaxRequest.open("GET", "/cms/handle_users.php?PageID=" + id + "&Template=" + template + "&UserID=" + user + "&Action=content", true);
	ajaxRequest.send(null);	
}







