<!--

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('') } });
	} 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_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('border', '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('LSF',thePage,"");
	} else { 
		window.external.AddFavorite(thePage,'LSF');
	}
}

//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');
}

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;
}

-->
