/*
	Fichier Inclut dans les sites externes pour l'audience.
	De cette facon, il est possible d'ajouter des JS sans changer qqc chez le client !

	Création: 31.01.2007 13:32 => Laurent Constantin
*/

function include_js(file,callback) {
    var html_doc = document.getElementsByTagName('head')[0];
    js = document.createElement('script');
    js.setAttribute('type', 'text/javascript');
    js.setAttribute('src', file);
    html_doc.appendChild(js);
    // This will load the javascript for Safari, but it won't
    // let us know when it's been loaded.  The following will.
    if(/WebKit|Khtml/i.test(navigator.userAgent)) {
        var iframe = document.createElement('iframe');
        iframe.style.display = 'none';
        iframe.setAttribute('src',file);
        document.getElementsByTagName('body').item(0).appendChild(iframe);
        // Fires in Saf
        iframe.onload = function() {
           execute_callBack(callback)
        }
    }    
    // Fires in IE, also modified the test to cover both states
    js.onreadystatechange = function () {
        if (/complete|loaded/.test(js.readyState)) {
           execute_callBack(callback)
        }
    }
    // Fires in FF
    js.onload = function () {
       execute_callBack(callback)
    }
    return false;
}


function execute_callBack(callback){
	if(!callback)return;
	
	if(typeof callback == "function")callback();
	if(typeof callback == "string")eval(callback);
}