
var flashinstalled = 0;
var flashversion = 0;
MSDetect = "false";
if (navigator.plugins && navigator.plugins.length)
{
	x = navigator.plugins["Shockwave Flash"];
	if (x)
	{
		flashinstalled = 2;
		if (x.description)
		{
			y = x.description;
			flashversion = y.charAt(y.indexOf('.')-1);
		}
	}
	else
		flashinstalled = 1;
	if (navigator.plugins["Shockwave Flash 2.0"])
	{
		flashinstalled = 2;
		flashversion = 2;
	}
}
else if (navigator.mimeTypes && navigator.mimeTypes.length)
{
	x = navigator.mimeTypes['application/x-shockwave-flash'];
	if (x && x.enabledPlugin)
		flashinstalled = 2;
	else
		flashinstalled = 1;
}
else
	MSDetect = "true";



/*var isFlash = false;
// Pour tous navigateurs sauf IE
if (navigator.plugins && navigator.plugins.length > 0) {
	var pluginsArrayLength = navigator.plugins.length;
	// Pour chaque plugin du navigateur...
	for (pluginsArrayCounter=0; pluginsArrayCounter < pluginsArrayLength; pluginsArrayCounter++ ) {
		if(navigator.plugins[pluginsArrayCounter].name.indexOf("Shockwave Flash") >= 0){ // Si 1 des plugins contient Shockwave Flash
			isFlash = true; // Alors flash player OK
			break;
		}
	}
} 
*/

function detectFlash() {
	alert('sssssssss')
	if( navigator.mimeTypes.length > 0 ) {
		return navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin != null;
	} else if( window.ActiveXObject ) {
		try {
			new ActiveXObject( "ShockwaveFlash.ShockwaveFlash" );
			return true;
		}
		catch( oError ) {
			return false;
		}
	} else {
		return false;
	}
}




function blink_show() {
	if ( document.all ) {
		blink_tags  = document.all.tags('blink');
		blink_count = blink_tags.length;
		for ( i = 0; i < blink_count; i++ ) {
			blink_tags[i].style.visibility = 'visible';
		}		
		window.setTimeout( 'blink_hide()', 700 );
	}
}
	
function blink_hide() {
	if ( document.all ) {
		blink_tags  = document.all.tags('blink');
		blink_count = blink_tags.length;
		for ( i = 0; i < blink_count; i++ ) {
			blink_tags[i].style.visibility = 'hidden';
		}		
		window.setTimeout( 'blink_show()', 250 );
	}
}



function onBOver(nm, cls){
	obj = document.getElementById(nm)
	obj.className=cls+"Over"
}
function onBOut(nm, cls){
	obj = document.getElementById(nm)
	obj.className=cls+"Out"
}

function submitForm(varaction, action, name) {
	if ( (action == 'js_action_ap_install_photo') || (action == 'js_action_fam_install_photo') ) {
		obj = document.getElementById('overlay_blanc')
		obj.style.display = 'inline'
		obj = document.getElementById('overlay_sablier')
		obj.style.display = 'inline'
	}
	faction = eval('document.'+name+'.'+varaction)
	faction.value = action
	f = eval('document.'+name)
	f.submit()
}

var a_1 = new Image(); 
var a_2 = new Image(); 
var a_3 = new Image(); 
var a_4 = new Image(); 
var a_5 = new Image(); 
var numImageBando = 1;

function initPage(memberid, txt, lang) {	
	initTxtMsg(txt)
	seekBottomDiv(lang)
	readMsgNonLu(memberid)
	s = setInterval("readMsgNonLu("+memberid+")", 30000)
	//initBandoDefil(0)

	/*
	a_1.src = 'images/illu_01.jpg';
	a_2.src = 'images/illu_02.jpg';
	a_3.src = 'images/illu_03.jpg';
	a_4.src = 'images/illu_04.jpg';
	a_5.src = 'images/illu_05.jpg';
	s = setInterval("blendimage('illustration','idIllustration', numImageBando, 1000)", 5000);
	*/

	if (document.forms.length == 1) {
		if (document.forms[0].name == "loginForm") {
			if (document.forms[0].login_email) {
				document.forms[0].login_email.focus()
			}
		}
	}

	blink_show()
}

function changeOpac(opacity, id) { 
    var object = document.getElementById(id).style; 
    object.opacity = (opacity / 100); 
    object.MozOpacity = (opacity / 100); 
    object.KhtmlOpacity = (opacity / 100); 
    object.filter = "alpha(opacity=" + opacity + ")"; 
}

function blendimage(divid, imageid, imagefile, millisec) {
	
	/*
    var speed = Math.round(millisec / 100); 
    var timer = 0; 
     
    //set the current image as background
   	document.getElementById(divid).style.backgroundImage = "url(" + document.getElementById(imageid).src + ")";
   	
    //set the current image as background
    changeOpac(0, imageid); 
    */
     
    //make new image 
	obj = document.getElementById(imageid)
	if (numImageBando == 6)    
		numImageBando = 1; 
	obj.src = eval("a_" + numImageBando + ".src");
	numImageBando++;

	/*
    //fade in image 
    for(j = 1; j <= 99; j++) { 
        r = window.setTimeout("changeOpac(" + j + ",'" + imageid + "')",(timer * speed));
        //clearTimeout(r);
        timer++; 
	}
	*/

} 

function initBandoDefil(i) {
	obj = document.getElementById('txtfordef')
	obj.innerHTML = txtBand[i]	
	i+=1
	if (i == nbTextBand)
		i = 0
	setTimeout("initBandoDefil("+i+")", 3000)
}

/*
rd=-1;
function c1() {
	el=document.getElementById("txtdef")
	if (rd<-200)
		rd=600
	rd-=10;
	el.style.left=rd
	setTimeout("c1()", 100)
}
*/
function seekBottomDiv(lang) {

	if (doSeek) {

		if(document.getElementById('interior')) {
			obj1 = document.getElementById('interior')
			hInterior = obj1.offsetHeight
			if (hInterior > 1500) {
				obj1.style.height="1500px"
			}
		}

		obj1 = document.getElementById('bando20090513_'+lang)
		h1 = obj1.offsetHeight
		obj1 = document.getElementById('onglets')
		h2 = obj1.offsetHeight	
		hTop = (h1+h2)*1

		hh1 = 0
		obj1 = document.getElementById('login')
		hh2 = obj1.offsetHeight
		obj1 = document.getElementById('stats')
		hh5 = obj1.offsetHeight
		if(document.getElementById('profilap')) {
			obj1 = document.getElementById('profilap')
			hh3 = obj1.offsetHeight
			obj1 = document.getElementById('profilfam')
			hh4 = obj1.offsetHeight
		}
		hh6 = 0
		if(document.getElementById('fraude')) {
			obj1 = document.getElementById('fraude')
			hh6 = obj1.offsetHeight
		}
		hRight = (hh1 + hh2 + hh3 + hh4 + hh5 + hh6 + (3*20) ) * 1

		obj1 = document.getElementById('main')
		hh1 = obj1.offsetHeight
		hCenter = (hh1) * 1

		if (hCenter>hRight) { hReste=hCenter } else { hReste=hRight }

		h_total = (50 + hTop + hReste) * 1

		obj = document.getElementById('annonce')
		obj.style.top = h_total+'px'

		obj1 = document.getElementById('annonce')
		h = obj1.offsetHeight

		h_total = (h_total + h) * 1

		obj = document.getElementById('droit')
		obj.style.top = h_total+'px'
	}

}

function appFunKeyPress(event, namefct, action, js_command, formName) {
	fct = namefct+"('"+action+"', '"+js_command+"', '"+formName+"')"
	funKeyPress(event, fct)
}

function funKeyPress(e, fun) {

	//alert(fun)

	var keynum
	var keychar
	var numcheck

	if(window.event) { // IE
		keynum = e.keyCode
	}
	else if(e.which) { // Netscape/Firefox/Opera
		keynum = e.which
	}
	if (keynum == 13) {
		eval(fun+'()')
	}
}

function submitForm2(varaction, action, name) {
	var info=""
	evalElem = eval('document.'+name+'.listpages')
	info = evalElem.value
	var tableau = info.split(':')
	evalElem = eval('document.'+name+'.pagename')
	evalElem.value=tableau[0]
	evalElem = eval('document.'+name+'.optionnumber')
	evalElem.value=tableau[1]
	evalElem = eval('document.'+name+'.'+varaction)
	evalElem.value = action
	f = eval('document.'+name)
	f.submit();
}

winPhoto = '';

function zoomphoto(p, f, wp, hp) {
	widthScreen = screen.width
	heightScreen = screen.height
	hp = ((hp*1) + (50*1)) * 1
	wp = ((wp*1) + (20*1)) * 1
	dw = (widthScreen-wp)/2
	dh = (heightScreen-hp)/2
	if (winPhoto.location && !winPhoto.closed) {
		winPhoto.close();
	}
	winPhoto = window.open("viewphoto.php?p="+p+"&f="+f,"viewphoto","location=no,toolbar=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,width="+wp+",height="+hp+",left="+dw+",top="+dh)
}

function activeAgeEnfFam(status, name) {
	f = eval('document.'+name)
	nbElem = f.length;
	for (i=0; i<nbElem; i++) {
		var n = f.elements[i].name
		p = n.indexOf("ageenf_")
		if (p>=0) {
			elemCurrent = eval('f.'+n)
			if ( status == 1 ) {
				elemCurrent.disabled = false
			} else {
				elemCurrent.disabled = true
			}
		}
	}
}

function activeDestination(name) {
	f = eval('document.'+name)
	nbElem = f.length;
	for (i=0; i<nbElem; i++) {
		var n = f.elements[i].name
		p = n.indexOf("destinationAI")
		if (p>=0) {
			elemDestAI = eval('f.'+n)
		} else {
			p = n.indexOf("destination_")
			if (p>=0) {
				obj = document.getElementById(n)
				elemCurrent = eval('f.'+n)
				if ( elemDestAI.checked ) {
					elemCurrent.disabled = true
					obj.className="cl_control_input_disable"
				} else {
					elemCurrent.disabled = false
					obj.className="cl_control_input"
				}
			}
		}
	}
}

function paintlineover(lineid) {
	obj = document.getElementById(lineid)
	obj.className="lineover"
}

function paintlineout(lineid) {
	obj = document.getElementById(lineid)
	obj.className="lineout"
	//obj = document.getElementById('writemsg')
	//obj.innerHTML = "&nbsp;"	
	//seekBottomDiv()
}

function depaintdisplaymsg() {
	//obj = document.getElementById('writemsg')
	//obj.innerHTML = ''	
	obj = document.getElementById('displaymsg')
	obj.style.visibility = 'hidden'
}

function paintdisplaymsg(mid, iline, lineid, msg, mailboxid, lang) {

	//obj = document.getElementById('writemsg')
	//obj.innerHTML = msg	

	obj = document.getElementById('displaymsg')
	//coord(event);
	//obj.style.top=Coordy+'px';
	obj.style.visibility = 'visible'
	obj = document.getElementById('writemsg')
	obj.innerHTML = msg+strPlus
	

	obj = document.getElementById('tdname_'+iline)
	//obj.className="clsnormal"		
	obj.style.font='normal 12px Arial, Verdana, sans-serif';
	obj = document.getElementById('tddate_'+iline)
	//obj.className="clsnormal"		
	//obj.style.font='normal 11px Arial, Verdana, sans-serif';
	//obj = document.getElementById('tdheure_'+iline)
	//obj.className="clsnormal"		
	obj.style.font='normal 11px Arial, Verdana, sans-serif';
	obj = document.getElementById('tdsujet_'+iline)
	//obj.className="clsnormal"		
	obj.style.font='normal 11px Arial, Verdana, sans-serif';
	seekBottomDiv(lang)
	updateMsgForLu(mid, mailboxid)
}

function openWin(link) {
	window.location.replace(link)
}

function openWinConfirm(link, msg) {
	if (confirm(msg)) 
		window.location.replace(link)
}

winProfil = ""

function openprofil(mid, type) {
	//if (winProfil.location && !winProfil.closed) {
	if (winProfil && !winProfil.closed && winProfil.location) {
		winProfil.close();
	}
	winProfil = window.open("displayprofil"+type+".php?memberid="+mid,"viewprofil","location=no,toolbar=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=970,height=750")
}

function colorLine(id, bcol) {
	obj = document.getElementById(id)
	obj.className='colLine_'+bcol
}

function activeonglet(onglet) {
	obj = document.getElementById(onglet)
	obj.className='onglet_mouseover'
}

function deactiveonglet(onglet) {
	obj = document.getElementById(onglet)
	obj.className=onglet
}

var Coordx = 0; 
var Coordy = 0;
var info1  = null;
e=window.event;

function mousex(e){
	if(document.layers) {return e.x;}
	else {return event.clientX;}
	}
function mousey(e){
	if(document.layers) {return event.y;}
	else {return event.clientY;}
	}
function coord(e){ 
Coordx = mousex(); 
Coordy = mousey();
Coordy = Coordy + 100;
} 
/*
function ow0(theURL,larg,haut,posX,posY) {
	larg = Math.ceil(screen.width * (larg/100)*(1024/screen.width));
	if(larg > screen.width) { larg = Math.ceil(larg*(95/100)); }
	haut = Math.ceil(screen.height * (haut/100));
	if (info1) {
		info1.close();
		info1 =	window.open(theURL,"info1","scrollbars=yes,menubar=yes,resizable=yes,width="+ larg +"px,height="+ haut +"px,outerwidth="+ larg +"px,outerheight="+ haut +"px,top="+posY+",left="+posX+",screenX="+posX+",screenY="+posY);
		info1.focus();
	} else {
		info1 =	window.open(theURL,"info1","scrollbars=yes,menubar=yes,resizable=yes,width="+ larg +"px,height="+ haut +"px,outerwidth="+ larg +"px,outerheight="+ haut +"px,top="+posY+",left="+posX+",screenX="+posX+",screenY="+posY);
		info1.focus();
	}
}
*/

function popupAlignMiddle(nomDiv) {
	var e = new Object();
	var boite = document.getElementById(nomDiv);
	if(window.event) { // IE
		var newTop = document.body.scrollTop + document.documentElement.scrollTop + (document.body.clientHeight + document.documentElement.clientHeight) / 2;
		boite.style.top = newTop + 'px';
	}
	else if(e.which) { // Netscape/Firefox/Opera
		var newTop = window.pageYOffset + document.documentElement.scrollTop + (document.body.clientHeight + document.documentElement.clientHeight) / 2;
		boite.style.top = newTop + 'px';
	}
	//alert(newTop)
}
