/***********************************************
* Orax Web Scripts
***********************************************/

function oraxLoad(divID,url) {
	var xhr = false;
	if (divID == '') { divID = 'sContent'; }
	var tDiv = document.getElementById(divID);
	var Ldr = document.getElementById('head_center');
	Ldr.innerHTML = 'loading...';
	if (window.XMLHttpRequest) {
		xhr = new XMLHttpRequest();
	}
	if (xhr) {
		xhr.onreadystatechange = function () { if (xhr.readyState == 4 && xhr.status == 200) { tDiv.innerHTML = xhr.responseText; Ldr.innerHTML = ''; } }
		xhr.open("GET", '/pages/' + url, true);
		xhr.send(null);
	} else { tDiv.innerHTML = 'Error loading data!'; }	
}

function oraxFetch(divID,url) {
	var xhr = false;
	if (divID == '') { divID = 'sContent'; }
	var tDiv = document.getElementById(divID);
	var Ldr = document.getElementById('head_center');
	Ldr.innerHTML = 'loading...';
	if (window.XMLHttpRequest) {
		xhr = new XMLHttpRequest();
	}
	if (xhr) {
		xhr.onreadystatechange = function () { if (xhr.readyState == 4 && xhr.status == 200) { tDiv.innerHTML = xhr.responseText; Ldr.innerHTML = ''; } }
		xhr.open("GET", '/portal/xContent.app?' + url, true);
		xhr.send(null);
	} else { tDiv.innerHTML = 'Error loading data!'; }	
}

function oraxAdd(divID,url) {
	var xhr = false;
	if (divID == '') { divID = 'sContent'; }
	var tDiv = document.getElementById(divID);
	if (window.XMLHttpRequest) {
		xhr = new XMLHttpRequest();
	}
	if (xhr) {
		xhr.onreadystatechange = function () { if (xhr.readyState == 4 && xhr.status == 200) { tDiv.innerHTML = tDiv.innerHTML + xhr.responseText; } }
		xhr.open("GET", '/portal/xContent.app?' + url, true);
		xhr.send(null);
	}	
}

function reset(divID) {
	var tDiv = document.getElementById(divID);
	tDiv.innerHTML = '';
}

function setpath(path,title) {
	if (path != '') { document.location = '#' + path; }
	if (title != '') { document.title = title; }
}