/*
 * <br/><b>Description:</b> CommonAjax
 * <br/><b>Company:</b> Accenture Technology Solutions <i>S</i>.<i>r</i>.<i>l</i>.
 * <br/><b>Copyright:</b> Copyright (c) 2008
 * </p>
 * @author Tiziano Treccani
 * @version 2.0.0
 */

function getParam(name) {
	name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
  	var regexS = "[\\?&]"+name+"=([^&#]*)";
  	var regex = new RegExp( regexS );
  	var results = regex.exec( window.location.href );
  	if( results == null )
    	return "";
  	else
    	return results[1];
}


function setBackgroundUrl(backcgroundService){
	var bgStyle = "";
	jQuery.ajax({
		type: "GET",
		async: false,
		url: backcgroundService,
		cache: true,
		success: function(xml){
			bgStyle = changeBackground(xml);
		}
	});
	return bgStyle;
}


function readContent(xmlDoc, nodeName){
	return xmlDoc.getElementsByTagName(nodeName).item(0).firstChild.nodeValue;
}


function changeBackground(xml){
	var backgroundUrl = readContent(xml, 'background_url');
	document.body.style.background = 'url(' + backgroundUrl + ') top center no-repeat #FDFCFA';
	return document.body.style.background;
}


