function add_bookmark(link,nom) {
	var ua=navigator.userAgent.toLowerCase();
	var konq=(ua.indexOf('konqueror')!=-1);
	var saf=(ua.indexOf('webkit')!=-1);
	var mac=(ua.indexOf('mac')!=-1);
	var ctrlKey=mac?'Command/Cmd':'CTRL';

	if(window.external && (!document.createTextNode ||(typeof(window.external.AddFavorite)=='unknown'))) {
		window.external.AddFavorite(""+ link +"",""+ nom +" - BusinessPatrol.com");
	}
	else if(konq) {
		alert('Thanks to press CTRL + B to bookmark this web site.');
	} else if(window.opera) {
		void(0);
	} else if(window.home||saf) {
		alert('Thanks to press '+ctrlKey+' + D to bookmark this web site.');

	} else if(!window.print || mac) {
		alert('Thanks to press Command/Cmd + D to bookmark this web site.');
	} else {
		alert('We do not recognize your web browser. Thanks to bookmark this web site manually.');
	}
}
function resizeIframe() {
    var height = document.documentElement.clientHeight;
    height -= document.getElementById('extFRM').offsetTop;

    // not sure how to get this dynamically
    height -= 1; /* whatever you set your body bottom margin/padding to be */

    document.getElementById('extFRM').style.height = height +"px";

}
function show(obj){
var reg = "libdet";
if(obj=="serv") { document.getElementById(obj).style.backgroundColor = "#FFFFFF"; document.getElementById(obj).style.color = "#FE4400";}
else if(obj.match(reg)) { document.getElementById(obj).style.visibility = 'visible';}
else {
document.getElementById(obj).style.color = "#FFFFFF";
document.getElementById(obj).style.backgroundColor = "#FE4400";
document.getElementById(obj).style.borderBottomColor = "#FE4400";}
}
function fade(obj){
var reg = "libdet";
if(obj=="serv") { document.getElementById(obj).style.backgroundColor = "#D0D9EA"; document.getElementById(obj).style.color = "#FFFFFF";}
else if(obj.match(reg)) { document.getElementById(obj).style.visibility = 'hidden';}
else {
document.getElementById(obj).style.color = "#000000";
document.getElementById(obj).style.backgroundColor = "#FFFFFF";
document.getElementById(obj).style.borderBottomColor = "#FFFFFF";}
}
function closenomen(obj) { document.getElementById(obj).style.display = 'none'; }

var http_request = false;
function makeRequest(url, parameters, dest) { http_request = false; var retour; if (window.XMLHttpRequest) { http_request = new XMLHttpRequest(); if (http_request.overrideMimeType) { http_request.overrideMimeType('text/html');}
} else if (window.ActiveXObject) { try { http_request = new ActiveXObject("Msxml2.XMLHTTP");} catch (e) { try { http_request = new ActiveXObject("Microsoft.XMLHTTP");} catch (e) {}
}
}
if (!http_request) { alert('Cannot create XMLHTTP instance'); return false;}
if(dest == "interm" ) { http_request.onreadystatechange = alertContents;}
if(dest == "interm2" ) { http_request.onreadystatechange = alertContents2;}
if(dest == "interm3" ) { http_request.onreadystatechange = alertContents3;}
if(dest == "interm4" ) { http_request.onreadystatechange = alertContents4;}
http_request.open('POST', url, true); http_request.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); http_request.setRequestHeader("Content-length", parameters.length); http_request.setRequestHeader("Connection", "close"); http_request.send(parameters);return retour;}
function alertContents() { var result; if (http_request.readyState == 4) { if (http_request.status == 200) { result = http_request.responseText; document.getElementById('spl').style.display = 'none'; document.getElementById('interm').style.display = 'block'; document.getElementById('interm').innerHTML = result;} else { alert('There was a problem with the request.');}
}
}
function alertContents2() { var result; if (http_request.readyState == 4) { if (http_request.status == 200) { result = http_request.responseText; document.getElementById('spl2').style.display = 'none'; document.getElementById('interm2').style.display = 'block'; document.getElementById('interm2').innerHTML = result;} else { alert('There was a problem with the request.');}
}
}
function alertContents3() { var result; if (http_request.readyState == 4) { if (http_request.status == 200) { result = http_request.responseText; document.getElementById('spl3').style.display = 'none'; document.getElementById('interm3').style.display = 'block'; document.getElementById('interm3').innerHTML = result;} else { alert('There was a problem with the request.');}
}
}
function alertContents4() { var result; if (http_request.readyState == 4) { if (http_request.status == 200) { result = http_request.responseText; document.getElementById('spl4').style.display = 'none'; document.getElementById('interm4').style.display = 'block'; document.getElementById('interm4').innerHTML = result;} else { alert('There was a problem with the request.');}
}
}
function get(bse,ob,dest) {
var obj = document.getElementById(ob);
if(dest == "interm" ) { document.getElementById('spl').style.display = 'block';}
if(dest == "interm2" ) { document.getElementById('spl2').style.display = 'block';}
if(dest == "interm3" ) { document.getElementById('spl3').style.display = 'block';}
if(dest == "interm4" ) { document.getElementById('spl4').style.display = 'block';}
var getstr =""; var i; for (i=0; i<obj.childNodes.length; i++) {
if (obj.childNodes[i].nodeName == "INPUT") {
if (obj.childNodes[i].type == "hidden") { getstr += obj.childNodes[i].name + "=" + escape(encodeURI( obj.childNodes[i].value )) + "&";}
if (obj.childNodes[i].type == "text") { getstr += obj.childNodes[i].name + "=" + escape(encodeURI( obj.childNodes[i].value )) + "&";}
if (obj.childNodes[i].type == "checkbox") { if (obj.childNodes[i].checked) { getstr += obj.childNodes[i].name + "=" + escape(encodeURI( obj.childNodes[i].value )) + "&";} else { getstr += obj.childNodes[i].name + "=&";}}
if (obj.childNodes[i].type == "radio") { if (obj.childNodes[i].checked) { getstr += obj.childNodes[i].name + "=" + escape(encodeURI( obj.childNodes[i].value )) + "&";}}
}
if (obj.childNodes[i].nodeName == "SELECT") { var sel = obj.childNodes[i]; getstr += sel.name + "=" + escape(encodeURI( sel.options[sel.selectedIndex].value )) + "&";}
}
makeRequest(bse + '/interm.php', getstr, dest);}

// the tooltip object
var tooltip = {
    // setup properties of tooltip object
    id:"tooltip",
    offsetx : -95,
    offsety : -45,
    _x : -95,
    _y : -45,
    _tooltipElement:null,
    _saveonmouseover:null
}

/**
* Open ToolTip. The title attribute of the htmlelement is the text of the tooltip
* Call this method on the mouseover event on your htmlelement
* ex :  <div id="myHtmlElement" onmouseover="tooltip.show(this)"...></div>
*/
tooltip.show = function (htmlelement) {

    // we save text of title attribute to avoid the showing of tooltip generated by browser
    var text=htmlelement.getAttribute("title");
    htmlelement.setAttribute("title","");
    htmlelement.setAttribute("title_saved",text);

	if(document.getElementById){
        this._tooltipElement = document.getElementById(this.id);
	}else if ( document.all ) {
        this._tooltipElement = document.all[this.id].style;
	}

    this._saveonmouseover = document.onmousemove;
    document.onmousemove = this.mouseMove;

    this._tooltipElement.innerHTML = text;

    this.moveTo(this._x + this.offsetx , this._y + this.offsety);

    if(this._tooltipElement.style){
        this._tooltipElement.style.visibility ="visible";
    }else{
        this._tooltipElement.visibility = "visible";
    }
   return false;
}

/**
* hide tooltip
* call this method on the mouseout event of the html element
* ex : <div id="myHtmlElement" ... onmouseout="tooltip.hide(this)"></div>
*/
tooltip.hide = function (htmlelement) {
    htmlelement.setAttribute("title",htmlelement.getAttribute("title_saved"));
    htmlelement.removeAttribute("title_saved");

    if(this._tooltipElement.style){
        this._tooltipElement.style.visibility ="hidden";
    }else{
        this._tooltipElement.visibility = "hidden";
    }
    document.onmousemove=this._saveonmouseover;
}



// Moves the tooltip element
tooltip.mouseMove = function (e) {
   // we don't use "this" because this method is assign to an event of document
   // and so is dereferenced
    if(e == undefined)
        e = event;

    if( e.pageX != undefined){ // gecko, konqueror,
        tooltip._x = e.pageX;
        tooltip._y = e.pageY;
    }else if(event != undefined && event.x != undefined && event.clientX == undefined){ // ie4 ?
        tooltip._x = event.x;
        tooltip._y = event.y;
    }else if(e.clientX != undefined ){ // IE6,  IE7, IE5.5
        if(document.documentElement){
            tooltip._x = e.clientX + ( document.documentElement.scrollLeft || document.body.scrollLeft);
            tooltip._y = e.clientY + ( document.documentElement.scrollTop || document.body.scrollTop);
        }else{
            tooltip._x = e.clientX + document.body.scrollLeft;
            tooltip._y = e.clientY + document.body.scrollTop;
        }
    /*}else if(event != undefined && event.x != undefined){ // IE6,  IE7, IE5.5
        tooltip.x = event.x + ( document.documentElement.scrollLeft || document.body.scrollLeft);
        tooltip.y = event.y + ( document.documentElement.scrollTop || document.body.scrollTop);
    */
    }else{
        tooltip._x = 0;
        tooltip._y = 0;
    }
    tooltip.moveTo( tooltip._x +tooltip.offsetx , tooltip._y + tooltip.offsety);

}

// Move the tooltip element
tooltip.moveTo = function (xL,yL) {
    if(this._tooltipElement.style){
        this._tooltipElement.style.left = xL +"px";
        this._tooltipElement.style.top = yL +"px";
    }else{
        this._tooltipElement.left = xL;
        this._tooltipElement.top = yL;
    }

}

