/*function loadContent(file){
  var scriptTag = document.getElementById('loadScript');
  var head = document.getElementsByTagName('head').item(0)
  if(scriptTag) head.removeChild(scriptTag);
  script = document.createElement('script');
  script.src = file;
	script.type = 'text/javascript';
	script.id = 'loadScript';
	head.appendChild(script)
}*/


function DisableEnableForm(xForm,xHow){
  objElems = xForm.elements;
  for(i=0;i<objElems.length;i++){
    objElems[i].disabled = xHow;
  }
}
function RTrim(chaine){
var carriageReturn = new String("\n\r");
var s = new String(chaine);
if (carriageReturn.indexOf(s.charAt(s.length-1)) != -1) {
var i = s.length - 1;
while (i >= 0 && carriageReturn.indexOf(s.charAt(i)) != -1)
i--;
s = s.substring(0, i+1);
}
return s;
}
function ajaxText(file,params){
	myAjax = new Ajax.Request(file, {asynchronous: false, method: 'post', parameters: params});
	return (myAjax.transport.responseText);
}
function ajaxReq(file,p){ajaxText(file,p);return false;}

function disableSite(text){
	$('SubFrameAlert').style.display='block'; 
	$('GeneralFrameAlert').style.display='block'; 
	if (text)
		$('SubFrameAlert').innerHTML='<div>'+text+'</div>';
}
function enableSite(){
	$('SubFrameAlert').style.display='none'; 
	$('GeneralFrameAlert').style.display='none'; 
	$('SubFrameAlert').innerHTML='';
}

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

function getUrlParameters(url){
	parameters = {};
	indexCarac = url.indexOf('?');
	if(indexCarac > -1){
		items = url.slice(indexCarac+1).split('&');
		for(a=0; a<items.length; a++){
			indexCarac = items[a].indexOf('=');
			if(indexCarac > -1)
				parameters[items[a].slice(0, indexCarac)] = items[a].slice(indexCarac + 1);
			else if(items[a].length == 1)
				parameters[items[a]] = '';
		}
	}
	return parameters;
}

function fenetre(URL,NOM,LARG,HAUT,TOP,LEFT,TITRE,PHOTO){  
	window.open(LILIOS_ROOT+'affichePhoto.php?titre='+TITRE+'&photo='+PHOTO,NOM,'toolbar=0,location=0,status=0,menubar=0,width=' + LARG + ',height=' + HAUT + ',top=' + TOP + ',left=' + LEFT + 'scrollbars=0')  
} 

var time = 3000;
var numofitems = 1;

//menu constructor
function menu(allitems,thisitem,startstate){ 
  callname= "gl"+thisitem;
  divname="subglobal"+thisitem;  
  this.numberofmenuitems = 1;
  this.caller = document.getElementById(callname);
  this.thediv = document.getElementById(divname);
  this.thediv.style.visibility = startstate;
}

//menu methods
function ehandler(event,theobj){
  for (var i=1; i<= theobj.numberofmenuitems; i++){
    var shutdiv =eval( "menuitem"+i+".thediv");
    shutdiv.style.visibility="hidden";
  }
  theobj.thediv.style.visibility="visible";
}
				
function closesubnav(event){
  if ((event.clientY <48)||(event.clientY > 107)){
    for (var i=1; i<= numofitems; i++){
      var shutdiv =eval('menuitem'+i+'.thediv');
      shutdiv.style.visibility='hidden';
    }
  }
}





function dumpobj(obj){
	var result= "", i= "";
	for(i in obj){ result += i + " = " + obj[i] + "<BR>" ; }
	return '<br>'+result+'</br>' ;
}

function ajaxText(file , params){
	myAjax = new Ajax.Request(file, {asynchronous: false, method: 'post', parameters: params});
	return (myAjax.transport.responseText);
}

function ajaxReq(file , p){
	this.ajaxText(file , p);return false;
}

function 	$id		(id) 		{ return document.getElementById(id); }
function 	$name	(name)	 	{ return document.getElementByName(name); }

function CHAT_CN(id,val) {	
	if ($id(id))
		$id(id).className = val; 
}
function WBID(id,text) {	// Write by id
	if ($id(id))
		$id(id).innerHTML = text; 
}
function ABID(id,text) {	// Add by id
	if ($id(id))
		$id(id).innerHTML = $id(id).innerHTML + text; 
}
function IBID(id,text) {	// Add by id
	if ($id(id))
		$id(id).innerHTML = text+$id(id).innerHTML  ; 
}
function RBID(id) {	// remove by id
	if ( $id(id) ){
		var idToRemove = $id(id);
		idToRemove.parentNode.removeChild(idToRemove);
	}else{
		return false;
	}
}
function progress(){
	return '<img src="'+LILIOS_ROOT+'system/imgs/progress.gif" alt="[progress]" />';
}






















Array.prototype.unShiftValue = function(value){
	for ( i=0 ; i<this.length ; i++){
		if ( this[i] == value )
		this.splice(i,1);
	}
			
}

Array.prototype.inArray = function(value){
	for ( i=0 ; i<this.length ; i++){
		if ( this[i] == value ){
			return i;
		}
	}
}
Array.prototype.shiftValue = function(value){
		if (! this.inArray(value))
			this.push(value);
}


String.prototype.replaceAll = function(search, repl) {
    var str = this;
    while (str.indexOf(search) != -1)
       str = str.replace(search, repl);
    return str;
}

String.prototype.trim = function() {
    return this.replace(/(^\s*)|(\s*$)/g, "");
}

String.prototype.isDate = function() {
    if (/^\d{2}[\/]\d{2}[\/]\d{4}$/.test(this)) {
        var dat1 = this.split("/");
        var dat2 = new Date(dat1[2], dat1[1] - 1, dat1[0]);
        return (dat2.getDate() == dat1[0] && dat2.getMonth() == dat1[1]-1 && dat2.getFullYear() == dat1[2]);
    }
    return false;
}


String.prototype.isEqTo = function(what) {
 var t = this.replaceAll(what,'');
 if (! t.isNotEmpty())
	return true;
}
String.prototype.isNotEqTo = function(what) {
 var t = this.replaceAll(what,'');
 if ( t.isNotEmpty())
	return true;
}
String.prototype.contain = function(what) {
 var t = this.replaceAll(what,'');
 if ( t.length < this.length )
	return true;
}


String.prototype.isEmail = function() {
	var verif 	= /^([a-zA-Z0-9_-])+([.]?[a-zA-Z0-9_-]{1,})*@([a-zA-Z0-9-_]{2,}[.])+[a-zA-Z]{2,3}$/;
	if (verif.exec(this) != null)
		return true;
}






String.prototype.isAlpha = function() {
return true ;
}
String.prototype.isAlphaNum = function() {
return true ;
}


String.prototype.isNumeric = function() {
return true ;
}

String.prototype.isNumber = function() {
return true ;
}

String.prototype.isNotEmpty = function() {
return true ;
}


/*

String.prototype.isAlpha = function() {
    return /^[A-Za-zÀÂÇÈÉÊËÎÔÙÛàâçèéêëîôùû\s]+$/.test(this);
}

String.prototype.isAlphaNum = function() {
    return /^[\a-zA-Z0-9\s]+$/.test(this);
}


String.prototype.isNumeric = function() {
    return /^\d+$/.test(this);
}

String.prototype.isNumber = function() {
    return /^[-]?\d+$/.test(this);
}

String.prototype.isNotEmpty = function() {
    return !/^\s*$/.test(this);
}
*/