/**
 * @param sorce String src of js file
 * @param autoRemove Bool
 * @param id String Element's id when autoRemove:false
 * @author zhys9
 * @date 10-12-2007 dd-mm-yyyy
 * @todo Load javascript file async
 */
function jLoader (source,autoRemove,id,charset){
	id = id||"";
	if(id) var obj = document.getElementById(id);
	if(typeof(obj) != 'undefined' && obj) {
		obj.parentNode.removeChild(obj);
	} else {
		autoRemove = autoRemove||false;
		var b=document.getElementsByTagName("head")[0];
		var c=document.createElement("script");
		c.type="text/javascript";
		c.charset = charset || "utf-8";
		if(id){
			c.id = id;
		}
		c.src=source;
		var remove=function(){
			c.onload=null;
			var h=c.parentNode;
			if(h) {
				h.removeChild(c);
			}
			delete c;
		};
		var e=function(h){
			var j=(h?h:window.event).target?(h?h:window.event).target:(h?h:window.event).srcElement;
			if(j && (j.readyState=="loaded"||j.readyState=="complete"))
			{
				j.onreadystatechange=null;
				if(autoRemove){
					remove();
				}
			}
		};
		if(navigator.product=="Gecko"&&autoRemove){
			c.onload=remove;
		}
		else{
			c.onreadystatechange=e;
		}
		b.appendChild(c);
	}
}