function isset(  ) {  
    var a=arguments; var l=a.length; var i=0;    
    if (l==0) { 
        throw new Error('Empty isset'); 
    }                                            
    while (i!=l) {
        if (typeof(a[i])=='undefined' || a[i]===null) { 
            return false; 
        } else { 
            i++; 
        }
    }
    return true;
}

function is_object( mixed_var ){  
    if(mixed_var instanceof Array) {
        return false;
    } else {             
        return (mixed_var !== null) && (typeof( mixed_var ) == 'object');
    }
}

function importScript(url){
    var tag = document.createElement("script");
    tag.type="text/javascript";
    tag.src = url;
    document.body.appendChild(tag);
}
function addClass(element, value) {
    if(!element.className) {
        element.className = value;
    } else {
        newClassName = element.className;
        newClassName+= " ";
        newClassName+= value;
        element.className = newClassName;
    }
}

function addEvent( obj, type, fn ) {
    if(is_object(obj))
    {
        if ( obj.attachEvent ) {
            obj['e'+type+fn] = fn;
            obj[type+fn] = function(){obj['e'+type+fn]( window.event );}
            obj.attachEvent( 'on'+type, obj[type+fn] );
        } else
            obj.addEventListener( type, fn, false );
    }
}    

if (Prototype.Browser.IE) {
     Prototype.Browser.IEVersion = parseFloat(navigator.appVersion.split(';')[1].strip().split(' ')[1]);
     Prototype.Browser.IE6 = Prototype.Browser.IEVersion == 6;
     Prototype.Browser.IE7 = Prototype.Browser.IEVersion == 7;
}

if(Prototype.Browser.Gecko)                                          
    addClass(document.getElementsByTagName('html')[0], 'mozilla');   
else if(Prototype.Browser.IE6)                                   
    addClass(document.getElementsByTagName('html')[0], 'ie6');                                   
else if(Prototype.Browser.IE7)                                       
    addClass(document.getElementsByTagName('html')[0], 'ie7'); 

function removeEvent( obj, type, fn ) {
    if ( obj.detachEvent ) {
        obj.detachEvent( 'on'+type, obj[type+fn] );
        obj[type+fn] = null;
    } 
    else
        obj.removeEventListener( type, fn, false );
}

function valid_ok()
{  
    $("valid_OK").style.display = "block";
    new Effect.Highlight("valid_OK", { startcolor: "#83D10C",endcolor: "#DAF5B8"});
    setTimeout("BlindUp_OK()",'4000');
}
function BlindUp_OK()
{
    new Effect.BlindUp("valid_OK");
}
function BlindUp_NO()
{
    new Effect.BlindUp("valid_NO");
}

function bloc_liste_over(id,class_name)
{
    if(class_name == '')
        $(id).className = "bloc_liste_hover";
    else
        $(id).className = class_name;
}
function bloc_liste_normal(id,class_name)
{
    if(class_name == '')
        $(id).className = "bloc_liste";
    else
        $(id).className = class_name;
}

/*slider disponiblité*/
var t ="";
if($("bt_slider") != null)
{
    var slider = new Control.Slider('bt_slider','bloc_slider', 
    {
        sliderValue: 0,
        onChange:function(value) {   
            if(value<=0.5)
            {
                if(t != '')
                    clearTimeout(t);                          
                t = setTimeout("sliderSetValue(2)",100);
                $('bt_slider').className = "bt_slider_yes";
            }
             if(value>0.5)
            {
                if(t != '')
                    clearTimeout(t);                          
                t = setTimeout("sliderSetValue(1)",100);
                $('bt_slider').className = "bt_slider_no";
            }
        }
    });
}
                          

/*SPECIFIQUE SV - TOOLTYPE*/
function aff_tooltype(id)
{
    $(id).style.display = 'block';
}

function cache_tooltype(id)
{
    $(id).style.display = 'none';
}
/*SPECIFIQUE SV - TOOLTYPE*/

function block(id)
{
    $(id).style.display = 'block';
}

function none(id)
{
    $(id).style.display = 'none';
}

function add_stats(idban)
{
    var pars = "idban="+idban;
    var myAjax = new Ajax.Updater('refresh_ajax', 'http://'+window.location.host+'/add_stats.php?action=ban', {method: 'post',parameters:pars, evalScripts : true}); 
}

