AtoLoad = new Array();
AtoUnLoad = new Array();
/**
* Execute au demarrage charge les differentes librairies
*/
function init() {
	for(j=0;j<AtoLoad.length;j++) {
		Flib = AtoLoad[j]+"()";
		eval(Flib);
	}
}
function destruct() {
	for(j=0;j<AtoUnLoad.length;j++) {
		Flib = AtoUnLoad[j]+"()";
		eval(Flib);
	}
}
function execute(prg) {
	var wsh = new ActiveXObject("WScript.Shell");
	var res = wsh.Run(prg);
}
function openDialog(sUrl, sWidth, sHeight, bResizable) {
	if(!sWidth) 	sWidth 	= "400px";
	if(!sHeight) 	sHeight = "200px";
	if(!bResizable)	bResizable = "yes";
	sFeat= "dialogWidth:"+sWidth+"; dialogHeight:"+sHeight+"; help:no;resizable:"+bResizable+"statusbar:no";
	w = showModalDialog(sUrl, null, sFeat)
	return false;
}
function openWindow(sUrl, sWidth, sHeight, bResizable, bScroll) {
	sWidth = (sWidth) ? sWidth : 350;
	sHeight = (sHeight) ? sHeight : 300;
	bResizable = (bResizable) ? bResizable : 1;
	bScroll = (bScroll) ? bScroll : 0;
	param = "height="+sHeight+",width="+sWidth+",location=0,menubar=0,resizable="+bResizable+",status=0,scrollbars="+bScroll;
	w = window.open(sUrl, "objectifs", param);
	return false;
}
/**
 * Gère les erreurs javascript
 */
function handleError(msg, url, ln) {
	ln--;
	msg+= "\nUrl..... : "+url;
	msg+= "\nLigne.. : "+ln;
	msg+= "\n------------------------------------------------------------------------------------------------------\n";
	el = document.getElementsByTagName("HTML");
	el = el[0];
	ct = el.innerHTML
	ar = ct.split("\n");
	leng = 4
	start = (ln>leng) ? (ln-leng) : ln;
	end   = (ln>(ar.length-(leng*2))) ? ar.length : ln+leng;
	for(i=start; i < end; i++) 	{
		if(i != ln) msg+= i+" | "+ar[i]+"\n";
		else msg+= i+">>>>"+ar[i]+"\n";
	}
	msg+= "------------------------------------------------------------------------------------------------------\n";
	alert(msg);
	return true;
}
window.onerror = handleError;
window.onload = init;
window.onbeforeunload = destruct;
