var IE=(document.all)?1:0;
var SAF=navigator.userAgent.indexOf("Safari")>=0;
var NS=navigator.userAgent.indexOf('Netscape')>0;
var OP=navigator.userAgent.indexOf('Opera')>0;
var IE7=((navigator.appName.indexOf("Explorer") >= 0) && (navigator.appVersion.indexOf('7.0')>=0 ));
var indef;
// Get object with its ID
function _gel(v_id){return document.getElementById?(document.getElementById(v_id)?document.getElementById(v_id):null):document.all[v_id];}

function changeOpac(opacity, id) {
    var object = _gel(id).style;
	if (!IE) {
		object.opacity = (opacity / 100);
	    object.MozOpacity = (opacity / 100);
	    object.KhtmlOpacity = (opacity / 100);
	} else object.filter = "alpha(opacity=" + opacity + ")";
}

function opacity(id, opacStart, opacEnd, millisec, retour) {
    //speed for each frame
    var speed = Math.round(millisec / 100);
    var timer = 0;
	var response=false;

    //determine the direction for the blending, if start and end are the same nothing happens
    if(opacStart > opacEnd) {
        for(i = opacStart; i >= opacEnd; i--) {
            dummytimer=setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
            timer++;
        }
    } else if(opacStart < opacEnd) {
        for(i = opacStart; i <= opacEnd; i++)
            {
            dummytimer=setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
            timer++;
        }
    } else if (retour!=indef) {
		response=true;
		return response;
	}
}
function addclic(v_bid) {
	executescr("scr_banniere_addclic.php","bid="+v_bid);
}
// Execute PHP script with XML file
function executescr(v_scr,v_vars){
	var l_noerror=true;
	var xmlhttp=null;
	if (window.XMLHttpRequest) {
		xmlhttp = new XMLHttpRequest();
	} else if (window.ActiveXObject) {
		xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
	}
	else {alert(lg("msgXMLnav"));l_noerror=false;}
	xmlhttp.onreadystatechange = function() {
		if (xmlhttp.readyState == 4) {// only if req shows "loaded"
			if (xmlhttp.status >= 400) {
				alert(lg("msgXMLfile"));l_noerror=false;
			} 
		}
	}
	var l_feed="front_office/ajax/"+v_scr;
	xmlhttp.open("POST",l_feed, true);
	xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
	xmlhttp.send(v_vars);
	return l_noerror;
}

