
// ####################################################################

function js_popup_img ( img ) {
	titre="";
	w=open("",'image','width=400,height=400,toolbar=no,scrollbars=no,resizable=no');	
	w.document.write("<HTML><HEAD><TITLE>"+titre+"</TITLE></HEAD>");
	w.document.write("<SCRIPT language=javascript>function checksize()  { if (document.images[0].complete) {  window.resizeTo(document.images[0].width+10,document.images[0].height+55); window.focus();} else { setTimeout('check()',250) } }</"+"SCRIPT>");
	w.document.write("<BODY onload='checksize()' leftMargin=0 topMargin=0 marginwidth=0 marginheight=0><A HREF='javascript:window.close()'><IMG src='"+img+"' border=0></A>");
	w.document.write("");
	w.document.write("</BODY></HTML>");
	w.document.close();
}

// ####################################################################

function js_date( plang ) {
  var dday = new Date();
  var an = dday.getYear();
	if (an<200) an = 1900 + an;
  switch ( plang ) {
  case "fr" :
  	var m = new Array("","Janvier","Février","Mars","Avril","Mai","Juin","Juillet","Aout","Septembre","Octobre","Novembre","Décembre");
    var d = new Array("","Dimanche","Lundi","Mardi","Mercredi","Jeudi","Vendredi","Samedi");
    date = d[dday.getDay()+1] + " " + dday.getDate() + " " + m[dday.getMonth()+1] + " " + an;
    break;
  default :
  	var m = new Array("",'January','February','May','April','May','June','July','August','September','Octobtre','November','December');
    var d = new Array("",'Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday');
    date = d[dday.getDay()+1] + " " + dday.getDate() + " " + m[dday.getMonth()+1] + " " + an;
    break;
  }
	document.write(date);
}

// ####################################################################

function js_new_window ( url, name, larg, haut, p_resizable, p_toolbar ) {
    if ( p_resizable == 1 ) WindowParam = 'resizable=yes,scrollbars=yes';
    else WindowParam = 'resizable=no,scrollbars=no';

    if ( p_toolbar == 1 ) WindowParam = WindowParam + ',toolbar=yes,location=yes,directories=yes,status=yes,menubar=yes';
    else WindowParam = WindowParam + ',toolbar=no,location=no,directories=no,status=no,menubar=no';

    if (larg == 0) {
        window2 = window.open(url, name, 'width='+screen.width+',height='+screen.height+',screenX=0,screenY=0,left=0,top=0,'+WindowParam);
    } else {
        var WinPosX = (screen.width - larg) / 2;
        var WinPosY = (screen.height - haut) / 2;
        window2 = window.open (url, name, 'width='+larg+',height='+haut+',screenX='+WinPosX+',screenY='+WinPosY+',left='+WinPosX+',top='+WinPosY+','+WindowParam);
    }
    window2.focus();
}

// ####################################################################

function js_confirm ( question, url ){
    resultat = confirm( question );
    if (resultat == "1"){document.location = url}
};

// ####################################################################

function js_print () {
    if (window.print) self.print();
    else if (navigator.appName.indexOf('Microsoft') != -1) VBPrint();
}

// ####################################################################

function js_checkall( nom ) {
    var len = document.formulaire.elements.length;
    var dim = nom.length;
    for (var i = 0; i < len; i++) {
      if (document.formulaire.elements[i].name.substring(0,dim) == nom) document.formulaire.elements[i].checked = true;
    }
}

// ####################################################################

function js_clearall( nom ) {
    var len = document.myform.elements.length;
    var dim = nom.length;
    for (var i = 0; i < len; i++) {
        if (document.myform.elements[i].name.substring(0,dim) == nom) document.myform.elements[i].checked = false;
    }
}

// ####################################################################

function js_netstat ( site, universe, menu, userid ) {
    var f = '' + unescape(document.referrer);
    var w = screen.width;   
    var h = screen.height;
    var v = navigator.appName; 
    if (v != 'Netscape') {var c=screen.colorDepth;}
    else {var c=screen.pixelDepth;}    
    document.write( "<img src='mod/netstat.php?site=" + site + "&universe=" + universe + "&menu=" + menu + "&jsres=" + w + "x" + h +"&jscolor=" + c + "&jsref=" + f + "&userid=" + userid + "' height=1 width=1>\n" );  
}

// ####################################################################

