function lookForRunningInfo(pageRunning) {
	
	if (pageRunning.indexOf('.htm')<=0) pageRunning+='index_en.htm';	
	var lengthRunningUrl, nbCharCodeLang, nbCharPageExp, lookForLangStart, lookForPageStart, lookForPageEnd;
	var arrayPageRunning	= pageRunning.split(".htm");
	var runningInformation	= new Array;
	
	lengthRunningUrl		= arrayPageRunning[0].length;
	
	nbCharCodeLang			= 2;
	lookForLangStart		= lengthRunningUrl-nbCharCodeLang;
	
	nbCharPageExp			= 3;
	lookForPageStart		= arrayPageRunning[0].lastIndexOf('/',lengthRunningUrl)+1;
	lookForPageEnd			= lengthRunningUrl-nbCharPageExp;	
	
	runningInformation['lang'] = arrayPageRunning[0].substring(lookForLangStart,lengthRunningUrl);
	runningInformation['page'] = arrayPageRunning[0].substring(lookForPageStart,lookForPageEnd);
	
	return runningInformation;
}


function buildTagSelect(id_ul, id_button, id_container)
	{
	if($(id_ul))
		{
		var innerContent	= new Array;
		var innerValue		= new Array;
		var innerHref		= new Array;
		var selectTagHtml 	= '';
		
		var itemClassName	= $(id_ul).className;
		
		each_index = 1;
		$$('#'+id_ul+' li').each(function(el)
			{
			var optionText	= '';
			var hrefExpr	= '';
			
			if (el.className != 'displaynone')
				{
				if (Browser.Engine.trident)
					{
					optionText 	= el.firstChild.innerHTML;
					hrefExpr	= el.firstChild.href;
					}
					else
					{
					optionText 	= el.childNodes[1].innerHTML;
					hrefExpr	= el.childNodes[1].href;
					}
				}
				else
				{
				hrefExpr	= '#';
				optionText	= el.innerHTML;
				}
			
			//alert(optionText+': '+hrefExpr);
			
			/* IE9 */
			if(navigator.appName.indexOf('Microsoft Internet Explorer') != -1 && navigator.appVersion.indexOf('MSIE 9.0') != -1)
				{
				//alert(el.getElement('a').title);
				//return false;	
				if(el.getElement('a'))
					{
					var optionText	= el.getElement('a').title +' ('+el.getElement('a').innerHTML+') ';
					var attOptValue	= el.getElement('a').href 
					//alert(optionText)
					}
					else
					{
					var optionText	= el.getElement('span').title +' ('+el.getElement('span').innerHTML+') ';
					}
				}
			/* /IE9 */
			
			innerValue.include(optionText);
			innerHref.include(hrefExpr + '#' + each_index);
			
			each_index ++;
			});			
		
		innerContent 	= innerValue.associate(innerHref);
		
		var selectTag	= new Element('select', {
						'name': id_ul, 
						'id': id_ul
		});
		
		
		each_index = 1;
		$each(innerContent, function(value, key)
			{
			var optionLine = '';
				
			optionLine += '<option';
			if ($chk(key))
				{
				tab_key = new Array	;
				tab_key = key.split('#');
				
				optionLine += ' value="'+tab_key[0]+'"';
				}
			
			optionLine += '>';
			optionLine += value;
			optionLine += '</option>';
			
			selectTagHtml += optionLine;
			
			each_index ++;
			});
		
		selectTag.set('html', selectTagHtml);
		
		//	Write new element
		selectTag.replaces($(id_ul));
		selectTag.setStyle('display','inline');
		
		if($(id_button))
			{
			$(id_button).getParent('a').addEvent('click', function(el){
				alert($(id_ul).getSelected().getProperty('value'));
				window.location.href = $(id_ul).getSelected().getProperty('value');
				
				el.preventDefault();
			});
			}
			else
			{
			$(id_ul).addEvent('change', function(el){
				window.location.href = this.value;
				});
			}
		}
	}





function makeSelectLang(runningInfo, ulIdLang, divIdLang, optionLang) {
	
	var innerLanguage		= new Array;
	var innerLangKey		= new Array;
	var innerLangValue	= new Array;
	var selectLang 			= '';	
	
	if ($(ulIdLang).title){labelLang=$(ulIdLang).title}else{labelLang=''};
	selectLang += '<label for="'+ulIdLang+'" class="displaynone">'+labelLang+'</label><select name="'+ulIdLang+'" id="'+ulIdLang+'" onChange="location=this.options[this.selectedIndex].value;">';

	$$('#'+ulIdLang+' li').each(function(el){
		
		var idLanguage	= el.id.replace(optionLang,'');
		var optionText	= el.childNodes[1].title +' ('+el.childNodes[1].innerHTML+') ';
		var attOptValue		= el.childNodes[1].href;
		if(navigator.appName.indexOf('Microsoft Internet Explorer') != -1) {
			var optionText	= el.firstChild.title +' ('+el.firstChild.innerHTML+') ';
			var attOptValue	= el.firstChild.href ;
		}
		
		/* IE9 */
		if(navigator.appName.indexOf('Microsoft Internet Explorer') != -1 && navigator.appVersion.indexOf('MSIE 9.0') != -1)
			{
			//alert(el.getElement('a').title);
			//return false;	
			if(el.getElement('a'))
				{
				var optionText	= el.getElement('a').title +' ('+el.getElement('a').innerHTML+') ';
				var attOptValue	= el.getElement('a').href 
				//alert(optionText)
				}
				else
				{
				var optionText	= el.getElement('span').title +' ('+el.getElement('span').innerHTML+') ';
				}
			}
		/* /IE9 */
		
		attOptSelected='';
		
		if (idLanguage == runningInfo['lang']) {

			attOptValue		= '#';
			attOptSelected	= ' selected="selected"';
		}
		
		selectLang += '<option id="'+idLanguage+'" value="'+attOptValue+'"'+attOptSelected+'>';
		selectLang += optionText;
		selectLang += '</option>';
	});	
	selectLang += '</select>';
	
	$(divIdLang).innerHTML = selectLang;
}




function gen_accordion(selector_div, selector_toggler, selector_panel)
	{
	myAccordion = new Accordion($(selector_div), selector_toggler, selector_panel, {
		opacity: false,
		onActive: function(toggler, element){
			toggler.setStyle('color', '#000000');
			$(toggler).getElement('img').src = '/images/template/fleche_grise_active.gif';
			},
		onBackground: function(toggler, element){
			toggler.setStyle('color', '#1376bf');
			$(toggler).getElement('img').src = '/images/template/fleche_grise.gif';
			}
		});
	}
	
	
	
	
	
// ccs switcher
function cssSwitch(prefix, newCss){
	$$('link').each(function(el){
		if(el.getProperty('rel') == "stylesheet"){
			if(el.href.indexOf(prefix+'.') != -1){
				regfile=new RegExp("\/"+prefix+"\\.[a-z0-9]+\.css$","g");
				el.href=el.href.replace(regfile,"/"+newCss+".css");
				}
			}
		});
	}





function cookieWrite(cookieName,cookieValue){
	Cookie.write(cookieName, cookieValue, {duration:365, path:"/"});
	}

function cookieDelete(cookieName){
	Cookie.dispose(cookieName);
	} 

	
	
	
	
	
	
	
	
	
	

