/** Sets/unsets the pointer in browse mode *
 * @param   object   the table row
 * @param   object   the color to use for this row
 * @return  boolean  whether pointer is set or not */
function setPointer(theRow, thePointerColor)
{if (typeof(theRow.style) == 'undefined' || typeof(theRow.cells) == 'undefined')
	{return false;}
 var row_cells_cnt           = theRow.cells.length;
 for (var c = 0; c < row_cells_cnt; c++)
	{theRow.cells[c].bgColor = thePointerColor;}
 return true;}
/**Cryptage**/
var codesHexa="0123456789ABCDEF";


function codeHexa (octetDec) // octet décimal ==> hexadécimal
	{
	return (codesHexa.charAt(octetDec>>>4)+codesHexa.charAt(octetDec&15));
	}


function decodeHexa (octetHex) // octet hexadécimal ==> décimal
	{
	return ( (codesHexa.indexOf(octetHex.charAt(0))<<4) + codesHexa.indexOf(octetHex.charAt(1)) );
	}


// FONCTIONS DE CRYPTAGE


var clef="9Ajf0kDhD4GBwnuis1ys1d45br7uyZ"; // Vous pouvez modifier cette clef


function crypte (texte) // texte en clair ==> texte crypté
	{
	resultat="";
	l=texte.length;
	lc=clef.length;

	m=0;
	for (n=0;n<l;n++)
		{
		c=texte.charCodeAt(n);
		if (c<256) // Uniquement les caractères ASCII
			{
     			resultat+=codeHexa( c ^ clef.charCodeAt(m%lc) );
			m++;
			}
		}

	return resultat;
	}


function decrypte (texte) // texte crypté ==> texte en clair
	{
	resultat="";
	l=texte.length;
	lc=clef.length;

	m=0;
	for (n=0;n<l;n+=2)
		{
		c=decodeHexa(texte.substr(n,2));
		resultat+=String.fromCharCode( c ^ clef.charCodeAt(m%lc) );
		m++;
		}
		return resultat;
	}
	
/** Ouverture pop-up */

function winopen(page,nom,pgwidth,pgheight,pgleft,pgtop,pgtool,pgmenu,pgscroll)
{var proprietes = 'width='+pgwidth+',height='+pgheight+',left='+pgleft+',top='+pgtop+',screenX=0,screenY=0,toolbar='+pgtool+',menubar='+pgmenu+',scrollbars='+pgscroll;
 window.open(page, nom, proprietes);}

function setPointerMouse()
    { if (document.all) for (var i=0;i < document.all.length; i++) document.all(i).style.cursor = 'wait'; } 

/** Fondu image **/
	var nbimage = 4;
	var numimage = 1;
	
	nextimage = new Image;
	nextimage.src = '/img/bp-main'+ numimage +'.jpg';
	
	function RefreshImg1() 
	{
		nextimage = new Image;
		numimage=numimage+1; if (numimage>nbimage) {numimage=1;}
		nextimage.src = '/img/bp-main'+ numimage +'.jpg';
		ModifAlpha(1,100);
		timeOutR1Img = window.setTimeout("RefreshImg2()",10000);
	}
	
	function RefreshImg2() 
	{
		ModifAlpha(1,0);
		timeOutR2Img = window.setTimeout("RefreshImg3()",1500);
	}
	
	function RefreshImg3() 
	{
		document.images.img1.src = nextimage.src;
		timeOutR3Img = window.setTimeout("RefreshImg1()",1500);
	}
	
	var TabAlpha=new Array();
	TabAlpha.length=1;		// 5 images alpha A MODIFIER SI PLUS D'IMAGES
	
	for (var alphaI=0;alphaI<TabAlpha.length;alphaI++) {
		TabAlpha[alphaI]=-1;
	}
	
	function ModifAlpha(no,alpha){
		if (document.images["img"+no]) {
			if (document.images["img"+no].filters) {
				TabAlpha[no]=alpha;
				if (tjstimer==0) {setTimeout("tjstimerAlpha()",30)}
			}
		}
	}
	
	var tjstimer=0;
	
	function tjstimerAlpha() {
		var opacity=0;
		for (var alphaI=0;alphaI<TabAlpha.length;alphaI++) {
			if (TabAlpha[alphaI]!=-1) {
				opacity =TabAlpha[alphaI] - document.images["img"+alphaI].filters.alpha.opacity;
				if (opacity!=0) {
					tjstimer=1;
					document.images["img"+alphaI].filters.alpha.opacity+=Math.abs(opacity)/opacity * 5;		
				} else {
					TabAlpha[alphaI]=-1
				}
			}
		}
		if (tjstimer==1) {setTimeout("tjstimerAlpha()",50);} else {tjstimer=0}
	}

if(navigator.appVersion.charAt(0)>=3){
	movimg=new Array()
	movimg[0] = new Image();movimg[0].src='img/bp-accueil-on.jpg';	
	movimg[1] = new Image();movimg[1].src='img/bp-accueil-off.jpg';	
	movimg[2] = new Image();movimg[2].src='img/bp-jmecs-on.jpg';	
	movimg[3] = new Image();movimg[3].src='img/bp-jmecs-off.jpg';
	movimg[4] = new Image();movimg[4].src='img/bp-muscles-on.jpg';	
	movimg[5] = new Image();movimg[5].src='img/bp-muscles-off.jpg';	
	movimg[6] = new Image();movimg[6].src='img/bp-poilus-on.jpg';	
	movimg[7] = new Image();movimg[7].src='img/bp-poilus-off.jpg';
	movimg[8] = new Image();movimg[8].src='img/bp-asiats-on.jpg';		
	movimg[9] = new Image();movimg[9].src='img/bp-asiats-off.jpg';		
}

function changImg(pic,status){
	if(navigator.appVersion.charAt(0)>=3){
		document.images[pic].src=movimg[status].src;
	}
}	