/*
	XML-driven page layout object
	Inserts container elements in the #page based on the template in the source XML
	The template templates/section.html will add: #title, #menu
	The menuObject will provide the following container elements: #content, #accordion, #breadcrumb, #image
	Parameter source: URL to the page's XML source
*/
function pageObject(source) {
	this.template = '';
	this.title = '';
	this.body = '';
	this.image = '';
	this.menu = null;
	var page = this;
	$.ajax({
		type:"GET",
		url:'/DocXMLController?documentId='+source+'&level=1',
		dataType:"text",
		success:function(data) {
			var xml;
			if (typeof data == "string") {
				if ($.browser.msie) {
					xml = new ActiveXObject("Microsoft.XMLDOM");
					xml.async = false;
					xml.loadXML(data);
				} else {
					parser = new DOMParser();
					xml = parser.parseFromString(data,"text/xml");
				}
			} else {
				xml = data;
			}
			// Get page elements from source
			page.title = 'Communications Solutions';
			page.body = $('#body').text();
			// Initialize menu data from source
			page.menu = new columnMenu(page, xml);
			page.menu.setup('menu');
		},
		error:function() {
			alert('Error loading XML data for this page.');
		}
	});
}
