////////////////////////////////////////////////////////////////
// Change la couleur des lignes d'un tableau
function setPointer(theRow, thePointerColor)
{
	
//	if (thePointerColor == '' || typeof(theRow.style) == 'undefined') {
//		return false;
//	}
	if (typeof(document.getElementsByTagName) != 'undefined') {
		var theCells = theRow.getElementsByTagName('td');
	}
	else if (typeof(theRow.cells) != 'undefined') {
		var theCells = theRow.cells;
	}
	else {
		return false;
	}
	var rowCellsCnt  = theCells.length;
	for (var c = 0; c < rowCellsCnt; c++) {
	theCells[c].style.backgroundColor = thePointerColor;
	}
	return true;
}
function setPointerTD(theCell, thePointerColor)
{
	if (thePointerColor == '' || typeof(theCell.style) == 'undefined') {
		return false;
	}
	if (typeof(document.getElementsByTagName) != 'undefined') {
		//var theCells = theRow.getElementsByTagName('td');
	}
	else if (typeof(theRow.cells) != 'undefined') {
		//var theCells = theRow.cells;
	}
	else {
		return false;
	}


	theCell.style.backgroundColor = thePointerColor;

	return true;
}

////////////////////////////////////////////////////////////////
 // DEPLIE OU REPLIE UN DIV
function depliRepli(nameDiv)
	{
	if (document.getElementById(nameDiv).style.display == 'none')
	{
		document.getElementById(nameDiv).style.display='block';
	}
	else
	{
		document.getElementById(nameDiv).style.display='none';
	}
}

////////////////////////////////////////////////////////////////
// RECUPÉRATION DES INFO DU NAVIGATEUR
function getNavigateur()
{
	// Récupération des infos du navigateur
	var N=navigator.appName; var V=navigator.appVersion;
	var version="?"; var nom=N; var os="?"; var langue="?";
	if (N=="Microsoft Internet Explorer") 
	{
		langue=navigator.systemLanguage
		version=V.substring(V.indexOf("MSIE",0)+5,V.indexOf(";",V.indexOf("MSIE",0)));
		if (V.indexOf("Win",0)>0) 
		{
			if ( V.indexOf(";",V.indexOf("Win",0)) > 0 ) 
			{
				os=V.substring(V.indexOf("Win",0),V.indexOf(";",V.indexOf("Win",0)));
			} else 
			{
				os=V.substring(V.indexOf("Win",0),V.indexOf(")",V.indexOf("Win",0)));
			}
		}
		if (V.indexOf("Mac",0)>0) 
		{
			os="Macintosh";
			version=V.substring(V.indexOf("MSIE",0)+6,V.indexOf(" ",V.indexOf("MSIE",0)));
		}
	}
	if (N=="Netscape") 
	{
		langue=navigator.systemLanguage
		version=(V.substring(0,V.indexOf("(",0)));
		if (V.indexOf("Mac",0)>0) 
		{
			os="Macintosh";
		}
		if (V.indexOf("Linux",0)>0) 
		{
			os="Linux";
		}
		if (V.indexOf("Win",0)>0) 
		{
			os=V.substring(V.indexOf("Win",0),V.indexOf(";",V.indexOf("Win",0)));
		}
		if (version==5) 
		{
			version="6.0"
		}
	}
	return (nom+"#"+version.substr(0,3)+"#"+os+"#"+langue)
}
////////////////////////////////////////////////////////////////

function confirmSuppr(page,id)
{
	if (confirm("Etes-vous sûr de vouloir supprimer cet enregistrement ?"))
	{
		var test = getNavigateur();
		if (test.indexOf("Mac",0)>0)
		{
			document.write("<form name=\"confirmSupprc\" action=\"" + page + "\" method=\"POST\"");
			document.write("<input type=\"hidden\" name=\"action\" value=\"delete\">");
			document.write("<input type=\"hidden\" name=\"id\" value=\"" + id + "\">");
			document.write("</form>");
			document.confirmSuppr.submit();
		}
		else
		{
			//alert("Feu");
			return document.location.href = "" + page + "?action=delete&id="+id;
			//return window.open("" + page + "?action=delete&id="+id,"_self");
		}
	}
	else
	{
		alert("Demande de suppression annulée !");
	}
}


function openZoom(chemin,fichier){
	window.open('index.php?action=zoom&chemin='+chemin+"&ref="+fichier+'','zoom','top=0,left=0,width=1000,height=700,scrollbars=yes');
}

function loadBandeau(activeRub,lg){
	var flash = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="734" height="168" id="bTop" align="middle"><param name="allowScriptAccess" value="sameDomain" /><param name="movie" value="/image/bandeau'+lg+'.swf?activeRub='+activeRub+'" /><param name="quality" value="best" /><param name="wmode" value="transparent" /><embed src="/image/bandeau'+lg+'.swf?activeRub='+activeRub+'" wmode="transparent" quality="high" width="734" height="168" name="bTop" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /></object>';
	document.getElementById('flashObjectTop').innerHTML = flash;
}

function loadBandeau2(activeRub,lg){
	var flash = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="734" height="168" id="bTop" align="middle"><param name="allowScriptAccess" value="sameDomain" /><param name="movie" value="/image/bandeau2'+lg+'.swf?activeRub='+activeRub+'" /><param name="quality" value="best" /><param name="wmode" value="transparent" /><embed src="/image/bandeau2'+lg+'.swf?activeRub='+activeRub+'" wmode="transparent" quality="high" width="734" height="168" name="bTop" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /></object>';
	document.getElementById('flashObjectTop').innerHTML = flash;
}

function searchPictures(){
	var critere = document.forms['0'].critere.value;
	if(critere.length < 3){
		alert("insuffisant");
		return false;
	}
	else{
		document.forms['0'].submit();
	}
}

function changePage(page){
	showMask();
	xajax_showPage(page,"");
}

var largeurEcran =0;
var hauteurEcran = 0;
function setdimScreen(){
	largeurEcran = document.body.clientWidth;
	hauteurEcran = document.body.scrollHeight;
}

function showMask(){
	new Effect.Appear('images', { duration: 0.5, from: 1, to: 0.3,queue:'end'});
}



function hideMask(){
	new Effect.Appear('images', { duration: 0.5, from: 0.3, to: 1,queue:'end'});
}

function showMaskGeneral(){
	new Effect.Morph('maskGeneral',{style:'width:'+document.body.clientWidth+'px;height:'+document.body.scrollHeight+'px', duration:0.0,queue:'front'});
	new Effect.Appear('maskGeneral', { duration: 0.5, from: 0.0, to: 0.7,queue:'end'});
}

function hideMaskGeneral(){
	new Effect.Appear('maskGeneral', { duration: 0.5, from: 0.7, to: 0.0});
	new Effect.Morph('maskGeneral',{style:'width:0px;height:0px', duration:0.0,queue:'end'});
	
}

function showFiltre(){
	new Effect.Morph('maskGeneral',{style:'width:'+document.body.clientWidth+'px;height:'+document.body.scrollHeight+'px', duration:0.0,queue:'front'});
	new Effect.Appear('maskGeneral', { duration: 0.5, from: 0.0, to: 0.7});
	document.getElementById('filtresContent').style.display="block";
	
}
function hideFiltre(){
	new Effect.Appear('maskGeneral', { duration: 0.5, from: 0.7, to: 0.0});
	new Effect.Morph('maskGeneral',{style:'width:0px;height:0px', duration:0.0,queue:'end'});
	document.getElementById('filtresContent').style.display="none";
}

function showMaskFiltres(){
	document.getElementById('filtresContentMask').innerHTML = "<table width='100%' align='center' height='100%'><tr><td align='center'><br><br><br><img src='/image/load.gif'><br><br><br></td></tr></table>";
}

var dragobj;

function show(){
	dragobj = document.getElementById('miniView');
	dragobj.style.width = '0';
	dragobj.style.height = '0';
	
	var left = (document.body.clientWidth - 500) / 2;
	var top = document.body.scrollTop + (document.body.clientHeight  - 500) / 2;

	dragobj.style.left = left;
	dragobj.style.top = top;
	dragobj.style.display = 'block';
	new Effect.Morph('miniView',{style:'width:500px;height:500px', duration:0.5});
}

function showFormat(){
	dragobj = document.getElementById('formats');
	dragobj.style.width = '0';
	dragobj.style.height = '0';
	
	var left = (document.body.clientWidth - 700) / 2;
	var top = document.body.scrollTop + (document.body.clientHeight  - 300) / 2;

	dragobj.style.left = left;
	dragobj.style.top = top;
	dragobj.style.display = 'block';
	new Effect.Morph('formats',{style:'width:700px;height:300px', duration:0.5});
}

function upSize(i){
	dragobj.style.width = i*20;
	dragobj.style.height = i*20;
	i++;
	if(i <= 20)
		t1 = setTimeout('upSize('+ i +')',5);
}

function hide(){
	new Effect.Morph('miniView',{style:'width:0px;height:0px', duration:0.5});
  	hideMaskGeneral();
}

function swap(td,etat){
	if(etat == "on"){
		new Effect.Appear(td, { duration: 0.3, from: 0.7, to: 1});

	}
	else{
			new Effect.Appear(td, { duration: 0.3, from: 1, to: 0.7});
	}
}

function showFormat(){
	new Effect.Morph('maskFormat',{style:'width:'+document.body.clientWidth+'px;height:'+document.body.scrollHeight+'px', duration:0.0,queue:'front'});
	new Effect.Appear('maskFormat', { duration: 0.5, from: 0.0, to: 0.7,queue:'end'});
	dragobj = document.getElementById('formats');
	dragobj.style.width = '0';
	dragobj.style.height = '0';
	
	var left = (document.body.clientWidth - 700) / 2;
	var top = document.body.scrollTop + (document.body.clientHeight  - 500) / 2;

	dragobj.style.left = left;
	dragobj.style.top = top;
	dragobj.style.display = 'block';
	new Effect.Morph('formats',{style:'width:700px;height:500px', duration:0.5});
}

function hideFormat(){
	new Effect.Morph('formats',{style:'width:0px;height:0px', duration:0.5});
	new Effect.Appear('maskFormat', { duration: 0.5, from: 0.7, to: 0.0});
	new Effect.Morph('maskFormat',{style:'width:0px;height:0px', duration:0.0,queue:'end'});
}

function showCompte(){
	dragobj = document.getElementById('compte');
	dragobj.style.width = '0';
	dragobj.style.height = '0';
	
	var left = (document.body.clientWidth - 700) / 2;
	var top = document.body.scrollTop + (document.body.clientHeight  - 500) / 2;

	dragobj.style.left = left;
	dragobj.style.top = top;
	dragobj.style.display = 'block';
	new Effect.Morph('compte',{style:'width:700px;height:500px', duration:0.5});
}
function hideCompte(){
	new Effect.Morph('compte',{style:'width:0px;height:0px', duration:0.5});
  	hideMaskGeneral();
}

function showFormPortFolio(){
	dragobj = document.getElementById('formPortFolio');
	dragobj.style.width = '0';
	dragobj.style.height = '0';
	
	var left = (document.body.clientWidth - 500) / 2;
	var top = document.body.scrollTop + (document.body.clientHeight  - 500) / 2;

	dragobj.style.left = left;
	dragobj.style.top = top;
	dragobj.style.display = 'block';
	new Effect.Morph('formPortFolio',{style:'width:500px;height:500px', duration:0.5});
}
function hideFormPortFolio(){
	new Effect.Morph('formPortFolio',{style:'width:0px;height:0px', duration:0.5});
	//hideMaskGeneral();

}