// JavaScript Document

var Page = {
	curCon : false,
	elID : false,
	
	Load : function(el, type) {
		page = el.getAttribute('href');
		Main.type = type;
		if(type === 0) {
			ids = document.getElementById('con');
			this.curCon = ids.innerHTML;
			this.elID = 'con';
			ids.innerHTML = '<div id="content">' 
								+ '<img src="" alt="Loading" /> Loading page please wait!'
						  + '</div>';
			setTimeout("ids.innerHTML = '<iframe src=\"http://' + page + '\" style=\"width: 100%; height: 100%; border: none;\"></iframe>';", 1000);
		}else if(type === 1) {
			this.getCon('con', 'index', page);
		}
	},
	
	getCon : function (id, module, file) {
		ids = document.getElementById(id);
		this.curCon = ids.innerHTML;
		this.elID = id
		ids.innerHTML = '<div id="content">' 
							+ '<img src="/conf/images/loading.gif" alt="Loading" /> Loading page please wait!'
					  + '</div>';
		SERVER.POSTrequest('./scripts/PHP/load.php', 'module=' + module + '&page=' + file, this.setCon);
	},
	
	setCon : function () {
		var data = SERVER.Ontvangst();
		if(data != false && data != null) {
			if(Main.type === 0) {
				return false;
			}else if(Main.type === 1){
				ids.innerHTML = '<div id="content">' 
									+ data
							  + '</div>';
			}
		}else if(data == null) {
			ids.innerHTML = 'No data found to display!';
		}
	}
}