function pageFade(opacity)
{
	$('tmplPage').style.opacity = (opacity/100);
	$('tmplPage').style.MozOpacity = (opacity/100);
	$('tmplPage').style.KhtmlOpacity = (opacity/100);
	$('tmplPage').style.filter="alpha(opacity=" + opacity + ")";
}

function coloreBouton(num)
{
document.getElementById('barreMenu'+num).style.color='#98E136';
document.getElementById('barreMenu'+num).onmouseout=function()
													{
														//do nothing
													};
document.getElementById('barreMenu'+num).onmouseover=function()
													{
														//do nothing
													};
}

function selectVideo()
{
	if($('lesVideos'))
	{
		unselectVideo();
		var toSelect=document.getElementById('selectTypeVideo').value;
		var contained=document.getElementById('lesVideos').getElementsByTagName('input');
		//alert(toSelect);
		if(toSelect==0)
			for (var i = 0; i < contained.length; i++) 
			{
				var elem = contained[i];
				var elemId=elem.id;
				if(elemId.substr(0, 3)=='vid')
					elem.checked=true;
			}
		else if(toSelect!='')
		{
			if(toSelect==4)
				toSelect=0;
			for (var i = 0; i < contained.length; i++) 
			{
				var elem = contained[i];
				var elemId=elem.id;
				if(elemId.substr(0, 5)=='vid_'+toSelect)
					elem.checked=true;
			}
		}
	}
}

function unselectVideo()
{
	if($('lesVideos'))
	{
		var contained=document.getElementById('lesVideos').getElementsByTagName('input');
		for (var i = 0; i < contained.length; i++) 
		{
			var elem = contained[i];
			var elemId=elem.id;
			if(elemId.substr(0, 3)=='vid')
				elem.checked=false;
		}
	}
}

function ouvreLogicielAnalyse(url)
{
	 ouvrePopupDemo(url,1034,778);
}

function ouvrePopupDemo(url,width,height)
{
	new Ajax.Updater('visioPopup', url, {asynchronous:true, evalScripts:true, onSuccess:function(request, json){}});
	
	var overlay = document.getElementById("overlayPopup");
	overlay.innerHTML = "<table style = 'height:100%;width:100%;' valign = 'center' border = '0' align = 'center'><tr><td></td></tr></table>"; 
	overlay.style.visibility = "visible"; // modification du style	 
	//overlay.style.display = "block";		 
	overlay.style.height=document.body.clientHeight+'px';//1024px		 
		 
	 var div_window = document.getElementById('windowPopup'); //affichage de la fenetre conteneur de centrage horizontal
	 div_window.style.visibility = "visible";
	 div_window.style.width=document.body.clientWidth+"px";//605
		 //div_window.style.height="420px";
	
	//reglage fenetre affichage
	var visioPopup=document.getElementById("visioPopup");
	if(width==0)
		width=640;
	if(height==0)
		height=480;
	visioPopup.style.width=width+"px";visioPopup.style.height=height+"px";	 
	
	//c joli mais ca marche po bien partout
	//new Effect.Scale(visioPopup, 100,{scaleFromCenter: true,scaleFrom: 1});
	
	//placement case fermeture
	var caseFermeture=document.getElementById("caseFermeturePopup");
	caseFermeture.style.top="-"+(height+15)+"px";
	var largeurPage=document.body.clientWidth;
	caseFermeture.style.left=(((largeurPage+width)/2)-15)+"px";
		
		 // affichage du corps de la fenêtre (balise iframe)
		// var div_comtempwindow = document.getElementById('contempwindow'); 
	//	 div_comtempwindow.style.visibility = "visible";
		
		
		// frames['contempwindow'].location.href= url;//"http://www.visioswing.com/callVisioLight/index" ;
}

function closePopup()
{
	new Ajax.Updater('visioPopup', '/PublicPrincipaleP50/unload', {asynchronous:true, evalScripts:true, onSuccess:function(request, json){}});
	
	var overlay = document.getElementById("overlayPopup");
	overlay.style.visibility = "hidden";
	var div_window = document.getElementById('windowPopup');//affichage de la fenetre
	
	div_window.style.visibility = "hidden";
}
/*
function updateCom()
{
	var texteCom,texteMess;
	texteCom=document.getElementById('theCom').value;
	texteMess=document.getElementById('message').value;
	document.getElementById('message').value=texteCom+'\r\n'+texteMess;
}
*/
var OneRowHeight = 0;
function textareaSize(textArea) 
{
	if (OneRowHeight == 0) OneRowHeight = textArea.style.height;
	var rows = textArea.value.split('\n');
	nRows=-1;
	for (i=0;i < rows.length; i++) {
		if (rows[i].length >= textArea.cols) nRows+= Math.floor(rows[i].length/textArea.cols);
	}
	nRows += rows.length;
	if (nRows >= textArea.rows) {
		textArea.rows = nRows;
		textArea.style.height = "auto";
	} else if (nRows == 1) {
		textArea.rows = 1;
	} else if (nRows == 0) {
		textArea.rows = 1;
		textArea.style.height = OneRowHeight;
	}
}
// Convert HTML breaks to newline
String.prototype.br2nl =
  function() {
    return this.replace(/<br\s*\/?>/mg,"\n");
  };

