window.onload=show;
var timeout; 
function show(id) {
        var d = document.getElementById(id);
        for (var i = 1; i<=10; i++) {
             if (document.getElementById('smenu'+i)) {
                document.getElementById('smenu'+i).style.display='none';
             }
        }
        if (d) {d.style.display='block';}
}
function CacherDelai() {
        timeout = setTimeout('show()',650);
}
function AnnulerCacher() {
        if (timeout) {
                clearTimeout(timeout);
        }
}
function CacherMenus() {
        for(i=1;i<=nbmenu;i++) {
                if (document.getElementById("smenu"+i))//undefined
                        document.getElementById("smenu"+i).style.display='none';
        }
}
// http://rajshekhar.net/blog/archives/85-Rasmus-30-second-AJAX-Tutorial.html
// 
function createRequestObject() {
    var ro;
    var browser = navigator.appName;
    if(browser == "Microsoft Internet Explorer"){
        ro = new ActiveXObject("Microsoft.XMLHTTP");
    }else{
        ro = new XMLHttpRequest();
    }
    return ro;
}
var http = createRequestObject();

function sendRequest(action) {
    http.open('get','postit.php?action='+action);
    http.onreadystatechange = handleResponse;
    http.send(null);
}

function handleResponse() {
    if(http.readyState == 4){
        var response = http.responseText;
        var update = new Array();
        if(response.indexOf('|' != -1)) {
            update = response.split('|');
            document.getElementById(update[0]).innerHTML = update[1];
        }
    }
}
// deplacer cadre (composant "postit")
//
function deplacer(cible,x,y) {
    if(document.getElementById) {
         var addr = "";
         hautimage += y;
         gaucheimage += x;
         sendRequest("set&id="+cible+"&top="+hautimage+"&left="+gaucheimage);
         document.getElementById(cible).style.top = hautimage;
         document.getElementById(cadre).style.left = gaucheimage;
     }
}

function ident() {
    var wil = window.open ("../admin/cman.php?demande=ident", "wil", "width=500,  height=680,scrollbars=yes") ;
}
function map(id,domain,lang) {
    var wil = window.open ("../publi/map.php?id="+id+"&domain="+domain+"&lang="+lang, "sitemap",
           "width=530,height=740,scrollbars=yes") ;
}
function ident() {
    var wil = window.open ("../admin/cman.php?demande=ident", "wil", "width=500,  height=680,scrollbars=yes") ;
}

function wident(id,domain,lang) {
 var wil = window.open ("../admin/cman.php?demande=ident&page_id="+id+"&domain="+domain+"&lang="+lang, "wil", 
           "top=240px,left=240px,width=560,height=130,scrollbars=yes") ;
}
function lostpasswd(lang,domain) {
 var wil = window.open ("../admin/cman.php?demande=lostpasswd&lang="+lang+"&domain="+domain, "wil", 
           "top=240px,left=240px,width=560,height=130,scrollbars=yes") ;
}
function profil ()	{
  var wil = window.open ("../admin/cman.php?demande=creercompte", "wil", 
           "top=240px,left=240px,width=620,height=300,scrollbars=yes") ;
}
function mdp(lang,domain)	{
  var wil = window.open ("../admin/cman.php?demande=updpwd&lang="+lang+"&domain="+domain, "wil", 
           "width=500,height=560,scrollbars=yes") ;
}

