function popup(page, name, width, height)
{
    if(name==null)
        name="dune_popup"
    sb="no"; var rsz="yes";status="no";toolbar="no"
    if(width==null && height==null)
    {
        width=400;
        height=200;
       
        switch(name)
        {
            case "allopass":        width=480;height=550;sb="no";break;
            case "localiser":       width=250;height=120;sb="no";break;
            case "virements":       width=660;height=500;sb="no";break;
            case "decoration":      width=660;height=500;sb="no";break;
            case "escouade":        width=500;height=400;sb="no";break;
            case "evenements":      width=750;height=570;sb="no";break;
            case "cv":              width=750;height=550;sb="no";break;
            case "famille":         width=600;height=400;sb="no";break;
            case "detail_carac":    width=850;height=500;sb="yes";break;
            case "message":         width=600;height=500;sb="no";break;
            case "telegramme":      width=750;height=570;sb="no";break;
            case "holomessagerie":  width=725;height=605;sb="no";rsz="no";break;
            case "hmparam":         width=300;height=300;sb="yes";break;
            case "hmcontact":       width=400;height=300;sb="no";break;
			case "info":          	width=653;height=672;rsz="no";sb="no";break;
			case "info_context":    width=1150;height=670;rsz="yes";toolbar="yes";sb="yes";status="yes";break;
            case "config":          width=850;height=650;sb="no";break;
            case "fiche":           width=400;height=250;sb="no";break;
            case "carte":           width=810;height=810;sb="yes";break;
            case "moninventaire":   width=600;height=600;sb="no";break;
            case "magasinier":      width=900;height=600;sb="no";break;
            case "magasinierV3":    width=882;height=600;sb="no";rsz="no";break;
            case "solaris":         width=550;height=440;sb="no";break;
            case "rechercheperso":  width=500;height=300;sb="no";break;
            case "message_perso":   width=370;height=210;rsz="no";sb="no";break;
            case "grade":           width=670;height=440;sb="no";break;
            case "camps":           width=670;height=420;sb="no";break;
            case "recherche":       width=450;height=300;sb="no";break;
            case "artillerie":      width=200;height=50;sb="no";break;
            case "impots":      width=500;height=350;sb="no";break;
            case "classements":      width=950;height=650;sb="no";break;
        }
    }
    var w = window.open(page, name, "resizable="+rsz+", location=no, toolbar="+toolbar+", width="+width+", height="+height+", menubar=no, status="+status+", scrollbars="+sb+"")

    if(w!=null)
        w.focus();
}


function menu_over(elem)
{
    var deb="button"
    var def=""
    if(elem.attributes.getNamedItem("debut_class") != null)
        deb = elem.attributes.getNamedItem("debut_class").value
    if(elem.attributes.getNamedItem("defaut_class") != null)
        def = elem.attributes.getNamedItem("defaut_class").value

    elem.className=def+" "+deb+"_over"
}
function menu_out(elem)
{
    var deb="button"
    var def=""
    if(elem.attributes.getNamedItem("debut_class") != null)
        deb = elem.attributes.getNamedItem("debut_class").value
    if(elem.attributes.getNamedItem("defaut_class") != null)
        def = elem.attributes.getNamedItem("defaut_class").value

    elem.className=def+" "+deb+"_normal"
}

function csv2array(text, separateur)
{
    var tableau_final = new Array()
    if(!separateur)
        separateur=';'
    text_tableau = text.split(separateur)
    for(var i=0; i<text_tableau.length; i++)
    {
        tmp = text_tableau[i].split(":");
        if(tmp.length==1)
            tableau_final[tmp[0]] = true;
        else
            tableau_final[tmp[0]] = tmp[1];
    }
    return tableau_final
}

var the_idperso_target = null
var the_idbatiment_target = null
function search_perso(element, mode)
{
    the_idperso_target = element
    popup('../marchand/recherche_perso.php?mode_recherche='+(mode==null?"":mode), 'recherche')
}
function search_batiment(element, mode)
{
    the_idbatiment_target = element
    popup('../marchand/recherche_batiment.php?mode_recherche='+(mode==null?"":mode), 'recherche')
}


String.prototype.trim = function ()
{
    var reg = new RegExp("^\\s*");
    var reg2 = new RegExp("\\s*$");
    return this.replace(reg, "").replace(reg2, "");
}


function setTransparency(eid,opacityAsInt)
{
var elem = document.getElementById(eid);
var opacityAsDecimal = opacityAsInt;

if (opacityAsInt > 100)
      opacityAsInt = opacityAsDecimal = 100; 
     else if (opacityAsInt < 0)
         opacityAsInt = opacityAsDecimal = 0;      

opacityAsDecimal /= 100;

if (opacityAsInt < 1)
        opacityAsInt = 1; // IE7 bug
    
elem.style.opacity = (opacityAsDecimal);
elem.style.filter  = "alpha(opacity=" + opacityAsInt + ")";
}




if(typeof(loaded)=="undefined")
    var loaded = new Array()
loaded["tools"]=true

