var xmlhttp;
function loadContent( sUrl ){
	xmlhttp=null;
	// code for Firefox, Opera, IE7, etc.
	if ( window.XMLHttpRequest ){
	  xmlhttp=new XMLHttpRequest();	
	// code for IE6, IE5	
	} else if ( window.ActiveXObject ){
		xmlhttp=new ActiveXObject( "Microsoft.XMLHTTP" );
	}
	
	if (xmlhttp!=null){

		xmlhttp.onreadystatechange=state_Change;
	  	xmlhttp.open( "GET", sUrl + '&nocahe=' + Math.random(), true );
	  	xmlhttp.send( null );
	} else {
	  	alert( "Your browser does not support XMLHTTP." );
	}
}

function state_Change() {
	if(xmlhttp.readyState == 1) { 
		document.getElementById( sPane ).innerHTML = '<div style="height:300px;background:url(images/loading.gif) no-repeat center"></div>';
	 } 
	// 4 = "loaded"
	if ( xmlhttp.readyState == 4) {
	
		// 200 = "OK"
		if ( xmlhttp.status == 200) {
	    	document.getElementById( sPane ).innerHTML = xmlhttp.responseText;
	    	setAndExecute(sPane, document.getElementById( sPane ).innerHTML );
	    } else {
	   		alert("Problem Loading Content" + xmlhttp.statusText);
	    }
	}
}

function setAndExecute(divId, innerHTML)
{
   var div = document.getElementById(divId);
   div.innerHTML = innerHTML;
   var x = div.getElementsByTagName("script");
   for(var i=0;i<x.length;i++){
       eval(x[i].text);
   }
}

