<!--

function getPageScroll() {
	var xScroll, yScroll;

	if (self.pageYOffset) {
		yScroll = self.pageYOffset;
		xScroll = self.pageXOffset;
	} else if (document.documentElement && document.documentElement.scrollTop){	 // Explorer 6 Strict
		yScroll = document.documentElement.scrollTop;
		xScroll = document.documentElement.scrollLeft;
	} else if (document.body) {// all other Explorers
		yScroll = document.body.scrollTop;
		xScroll = document.body.scrollLeft;	
	}

	arrayPageScroll = new Array(xScroll,yScroll) 
	return arrayPageScroll;
}

function getPageSize() {
	var xScroll, yScroll;
	
	if (window.innerHeight && window.scrollMaxY) {	
		xScroll = window.innerWidth + window.scrollMaxX;
		yScroll = window.innerHeight + window.scrollMaxY;
	} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
		xScroll = document.body.scrollWidth;
		yScroll = document.body.scrollHeight;
	} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
		xScroll = document.body.offsetWidth;
		yScroll = document.body.offsetHeight;
	}
	
	var windowWidth, windowHeight;

	if (self.innerHeight) {	// all except Explorer
		if(document.documentElement.clientWidth){
			windowWidth = document.documentElement.clientWidth; 
		} else {
			windowWidth = self.innerWidth;
		}
		windowHeight = self.innerHeight;
	} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
		windowWidth = document.documentElement.clientWidth;
		windowHeight = document.documentElement.clientHeight;
	} else if (document.body) { // other Explorers
		windowWidth = document.body.clientWidth;
		windowHeight = document.body.clientHeight;
	}	
	
	// for small pages with total height less then height of the viewport
	if(yScroll < windowHeight){
		pageHeight = windowHeight;
	} else { 
		pageHeight = yScroll;
	}

	// for small pages with total width less then width of the viewport
	if(xScroll < windowWidth){	
		pageWidth = xScroll;		
	} else {
		pageWidth = windowWidth;
	}
	
	arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight) 
	return arrayPageSize;
}

function displayModalBox(url, type, width, height) {
	if ($('overlay').getStyle('display') == 'block') {
		//new Effect.Fade('overlay');
		//new Effect.Fade('overlay_content', { duration: 0.3, afterFinish: function() { $('overlay_content').update('') } });
		$('overlay').hide();
		$('overlay_content').hide();
		$('overlay_content').update('');
	} else {
		if (width != '') $('overlay_content').setStyle({ width: width +'px', marginLeft: '-' + width/2 + 'px' });
		if (height != '') $('overlay_content').setStyle({ height: height +'px' });
		
		var arrayPageSize = getPageSize();
		var arrayPageScroll = getPageScroll();
		var boxTop = arrayPageScroll[1] + (arrayPageSize[3] / 10);
		$('overlay').setStyle({ height: arrayPageSize[1] +'px' });
		$('overlay_content').setStyle({ top: boxTop +'px' });
		
		//new Effect.Appear('overlay', { duration: 0.3, from: 0.0, to: 0.6 });
		//new Effect.Appear('overlay', {duration:1, fps:25, from:0.0, to:0.6});
		$('overlay').show();
		$('overlay_content').show();

		new Effect.Appear('overlay_content');
		if (type == 'ajax') {
			new Ajax.Updater('overlay_content', url, { evalScripts: true });
		} else if (type == 'iframe') {
			if (width == '') width = '100%';
			if (height == '') height = 480;
			var iframe = document.createElement('iframe');
			iframe.setAttribute('width', width-10);
			iframe.setAttribute('height', height-10);
			//iframe.setAttribute('frameborder', '0');
			iframe.setAttribute('frameBorder', '0');
			iframe.setAttribute('border', '0');
			iframe.setAttribute('cellspacing', '0');
			iframe.setAttribute('src', url);
			iframe.setAttribute('id', 'iframe');
			$('overlay_content').appendChild(iframe);
			$('iframe').src = url;
		}
	}
}

function favoris(){
	var thePage = location.href;
	if(thePage.lastIndexOf('#')!=-1){
		thePage = thePage.substring(0,thePage.lastIndexOf('#'));
	}			
	if ( navigator.appName != 'Microsoft Internet Explorer' ) {
		window.sidebar.addPanel('La-DA.com',thePage,"");
	} else { 
		window.external.AddFavorite(thePage,'La-DA.com');
	}
}

//openwindow simple : sans scroll sans menu
function openwindow(newURL, newWidth, newHeight) {
    //declaration des variables du coin de la nouvelle fenetre
    var calcLeft = 100;
    var calcTop = 100;

    if (parseInt(navigator.appVersion) >= 4) {
        calcTop = screen.availHeight / 2 - newHeight /2;
        calcLeft = screen.availWidth /2 - newWidth / 2;
	}

    remoteWindow = window.open(newURL, 'remote', 'status=no,toolbar=no,menubar=no,location=no,scrollbars=no,width=' + newWidth + ',height=' + newHeight + ',left=' + calcLeft + ',top=' + calcTop + ',resizable=no');
}

//openwindow simple : avec scroll sans menu
function openwindow3(newURL, newWidth, newHeight)
{
    //declaration des variables du coin de la nouvelle fenetre
    var calcLeft = 100;
    var calcTop = 100;

    if (parseInt(navigator.appVersion) >= 4){
        calcTop = screen.availHeight / 2 - newHeight /2;
        calcLeft = screen.availWidth /2 - newWidth / 2;}

    remoteWindow = window.open(newURL, 'remote', 'status=no,toolbar=no,menubar=no,location=no,scrollbars=yes,width=' + newWidth + ',height=' + newHeight + ',left=' + calcLeft + ',top=' + calcTop + ',resizable=no');

}

function clearValue(object) {
	if (object.value == object.defaultValue) {
		object.value = '';
	}
}

function restoreValue(object) {
	if (object.value == '') {
		object.value = object.defaultValue; 
	}
}

/**
 * Returns the value of the selected radio button in the radio group, null if
 * none are selected, and false if the button group doesn't exist
 *
 * @param {radio Object} or {radio id} el
 * OR
 * @param {form Object} or {form id} el
 * @param {radio group name} radioGroup
 */
function $RF(el, radioGroup) {
    if($(el).type && $(el).type.toLowerCase() == 'radio') {
        var radioGroup = $(el).name;
        var el = $(el).form;
    } else if ($(el).tagName.toLowerCase() != 'form') {
        return false;
    }

    var checked = $(el).getInputs('radio', radioGroup).find(
        function(re) {return re.checked;}
    );
    return (checked) ? $F(checked) : null;
}

//php.js
function in_array(needle, haystack, strict) {
    // http://kevin.vanzonneveld.net
    // +   original by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // *     example 1: in_array('van', ['Kevin', 'van', 'Zonneveld']);
    // *     returns 1: true
 
    var found = false, key, strict = !!strict;
 
    for (key in haystack) {
        if ((strict && haystack[key] === needle) || (!strict && haystack[key] == needle)) {
            found = true;
            break;
        }
    }
 
    return found;
}

//utilisé dans tous les modules utilisant un textearea pour verifier le nombre de caractéres
function verif_longueur(obj,size,aff) {
   len = obj.value.length;
   if ( len > size ) {
      obj.value = obj.value.substring(0,size);
   }
   aff.value=len;
}

//pour les menus de reroutage
function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}
-->