
//adds script to window's onload event while preserving the current onload event (appends)
function windowOnload(s) {
	var sPreviousOnload = window.onload;
	window.onload = function(){ 
		if(sPreviousOnload){
			sPreviousOnload(); 
		}
		eval(s); 
	}
}

// return the name of the browser
function detectBrowser() {
	var N=navigator.appName;
	if (N=="Microsoft Internet Explorer") {
		return "MSIE";
	}else if (N=="Opera") {
		return "Opera";	
	}else if (N=="Netscape") {
		return "Netscape";
	}
}


// loading bar (adds a . every 300 ms )
var nLoadingIdx = 1;	
var intervalUpdate = "";
function updating(sLoading,sDiv){
	switch(nLoadingIdx){
		case 1:
			document.getElementById(sDiv).innerHTML = sLoading;
			break;
		case 2:
			document.getElementById(sDiv).innerHTML = sLoading + " .";
			break;
		case 3:
			document.getElementById(sDiv).innerHTML = sLoading + " ..";
			break;
		case 4:
			document.getElementById(sDiv).innerHTML = sLoading + " ...";
			nLoadingIdx = 0;
			break;
	}
	nLoadingIdx = nLoadingIdx + 1;
	intervalUpdate = setTimeout(function(){updating(sLoading,sDiv)}, 300);
}

// used with the above updating function
function clearTimer(){
	window.clearTimeout(intervalUpdate);
}