if (typeof(km_scripts) == 'undefined') var km_scripts = new Object();

function Importer(){
	
}
Importer.load=function(path){
	
	  if (km_scripts[path] != null ) return;
	 
	

	var lock=true;;
	
		var xmlhttp=GetXmlHttpObject();
		xmlhttp.onreadystatechange=function(){
		if (xmlhttp.readyState==4){
											
				var req=xmlhttp.responseText;
				var strs=path.split(".");
				
				if(strs[strs.length-1]=="js"){
					var scriptElt = document.createElement('SCRIPT');
					scriptElt.text=req;
				 }else{
					var scriptElt = document.createElement('STYLE');
					var text=document.createTextNode(req);
					
					scriptElt.type = 'text/css';
					if(scriptElt.styleSheet)
						scriptElt.styleSheet.cssText = text.nodeValue;
					else
					scriptElt.appendChild(text);
				 }
			
					//
				  document.getElementsByTagName('head')[0].appendChild(scriptElt);
				
				  km_scripts[path] = path; // or whatever value your prefer
			lock=false;
				 
			}
		}
		xmlhttp.open('POST',path,false);
		xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=utf-8');
		var queryString=encodeURIComponent('1') +'='+ encodeURIComponent('1');
				

		xmlhttp.send(queryString);
		 
		if(navigator.appName=="Netscape"){
			  if (km_scripts[path]!= null) return;
			var req=xmlhttp.responseText;
				
					var strs=path.split(".");
				if(strs[1]=="js"){
					var scriptElt = document.createElement('SCRIPT');
					scriptElt.text=req;
				 }else{
					var scriptElt = document.createElement('STYLE');
						var text=document.createTextNode(req);
					scriptElt.type = 'text/css';
					if(scriptElt.styleSheet)
						scriptElt.styleSheet.cssText = text.nodeValue;
					else
					scriptElt.appendChild(text);
				 }
				
				//	scriptElt.innerHTML=req;
				  document.getElementsByTagName('head')[0].appendChild(scriptElt);
				
				  km_scripts[path] = path; // or whatever value your prefer
			
				
		}
		
	}	
function GetXmlHttpObject(){
		if (window.XMLHttpRequest) {
		  // code for IE7+, Firefox, Chrome, Opera, Safari
		  return new XMLHttpRequest();
		 }else if (window.ActiveXObject){
		  // code for IE6, IE5
		  return new ActiveXObject('Microsoft.XMLHTTP');
		 }
		return null;
}

