

// MAILBOX
function toggle(id,jid,server){
	var a = document.getElementById(id).style.display;
	if(a.indexOf('none')==0){
		document.getElementById(id).style.display='block';
		document.getElementById(id).style.visibility='visible';
		set_lu(id,jid,server);
	} else {
		document.getElementById(id).style.display='none';
		document.getElementById(id).style.visibility='hidden';
	}
}
function affiche(id){
	document.getElementById(id).style.display='block';
	document.getElementById(id).style.visibility='visible';
}

function set_lu(id,jid,server) { 
	if (window.XMLHttpRequest)   {              //  Objet de la fenêtre courant
		xhr = new XMLHttpRequest();     //  Firefox, Safari, ...
	} 
	else 
		if (window.ActiveXObject){
			xhr = new ActiveXObject("Microsoft.XMLHTTP");   // Internet Explorer 
		}
		
	xhr.onreadystatechange = function(){ 
		if (xhr.readyState == 4) { 

			document.getElementById("new"+id).innerHTML="";//id=>msgX
			/*var nb= parseInt(document.getElementById("nbMsg").innerHTML);
			nb=nb-1;
			document.getElementById("nbMsg").innerHTML=nb;*/
		}
	}
	idmp=id.replace("msg","");
	xhr.open("POST",'message_lu.php',true); 
	xhr.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); 
	xhr.send("id="+idmp+"&jid="+jid+"&server="+server);
	//xhr.open('GET', 'message_lu.php?id='+idmp+'&jid='+jid, true);                  
	//xhr.send(null);
}
function selectAll(){
	for(var i=0; i<m.length; i++)
		document.getElementById('m['+m[i]+']').checked = true;
}
//END MAILBOX


// PAGE 
function size_pub780(){
var x = (document.body.scrollWidth/2)+770/2+10;
if(x<780){ startX=780; }
document.getElementById('pub120').style.left = x+"px";
}

function adserver() {
   var m3_u = (location.protocol=='https:'?'https://adserver.feerik.com/www/delivery/ajs.php':'http://adserver.feerik.com/www/delivery/ajs.php');
   var m3_r = Math.floor(Math.random()*99999999999);
   if (!document.MAX_used) document.MAX_used = ',';
   document.write ("<scr"+"ipt type='text/javascript' src='"+m3_u);
   document.write ("?zoneid=12");
   document.write ('&amp;cb=' + m3_r);
   if (document.MAX_used != ',') document.write ("&amp;exclude=" + document.MAX_used);
   document.write ("&amp;loc=" + escape(window.location));
   if (document.referrer) document.write ("&amp;referer=" + escape(document.referrer));
   if (document.context) document.write ("&context=" + escape(document.context));
   if (document.mmm_fo) document.write ("&amp;mmm_fo=1");
   document.write ("'><\/scr"+"ipt>");
}
// END PAGE

// Goodies
function displayAvatar(img, pseudo){
	document.getElementById('avatar').innerHTML = "<img src='poney/"+img+".png?msn=1'>";
	
}

// TOGGLE Simple
function toggle2(id){
	var a = document.getElementById(id).style.display;
	if(a.indexOf('none')==0){
		document.getElementById(id).style.display='block';
		document.getElementById(id).style.visibility='visible';
	} else {
		document.getElementById(id).style.display='none';
		document.getElementById(id).style.visibility='hidden';
	}
}

//Inscription
function writediv(texte){ document.getElementById('emailbox').innerHTML = texte; }

function verifPseudo(pseudo) {

}

function verifEmail(email){
	t = file('ajax/email.php?email='+escape(email));
	if(t == "FALSE")
		 document.getElementById('emailbox').innerHTML = "<font color='red' size='+1'>{inscription._email_non_valide}</font>";
	else
		document.getElementById('emailbox').innerHTML = '';
}

function file(fichier){
	if(window.XMLHttpRequest) // FIREFOX
		xhr_object = new XMLHttpRequest();
	else if(window.ActiveXObject) // IE
		xhr_object = new ActiveXObject("Microsoft.XMLHTTP");
	else
		return(false);
	xhr_object.open("GET", fichier, false);
	xhr_object.send(null);
	if(xhr_object.readyState == 4) return(xhr_object.responseText);
	else return(false);
}
function feerikcoreg(form){
return true;
	if(form.idcamp244[1].checked == false && form.idcamp244[0].checked == false){
		alert("Vous devez choisir OUI ou NON pour toutes les offres.");
		return false;
	}
	return Coregistration128b(form);
}


/////////// BAR FEERIK 
function go() 
{
	url=document.network.lnk[document.network.lnk.selectedIndex].value
	if (url!="") {
		document.network.action=url; 
		document.network.submit();
	}
}
///////////// END BAR

/* starter2 / poneyCeleste.tpl 

function couleur_random(id){
	var hex=new Array("0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F");
	artabus = "#";
	artabus += hex[Math.ceil(15 * Math.random())];
	artabus += hex[Math.ceil(15 * Math.random())];	
	artabus += hex[Math.ceil(15 * Math.random())];
	artabus += hex[Math.ceil(15 * Math.random())];	
	artabus += hex[Math.ceil(15 * Math.random())];
	artabus += hex[Math.ceil(15 * Math.random())];

	element = document.getElementById(id);

	element.title = artabus;
	element.style.backgroundColor = artabus;
	element.value =  parseInt(artabus.substr(1,2),16)+","+parseInt(artabus.substr(3,2),16)+","+parseInt(artabus.substr(5,2),16);
}

function parent_random(qui){
	couleur_random(qui+"['couleur_corps']");
	couleur_random(qui+"['couleur_yeux']");
	couleur_random(qui+"['couleur_criniere']");
	voir(qui);
}

function voir_img(qui){
	var s  = '<img src="poney/';
	s += 't_'+document.getElementById(qui+'[\'type\']').options[document.getElementById(qui+'[\'type\']').selectedIndex].value;
	s += '-cc_'+document.getElementById(qui+'[\'couleur_corps\']').value;
	s += '-cy_'+document.getElementById(qui+'[\'couleur_yeux\']').value;
	s += '-ccr_'+document.getElementById(qui+'[\'couleur_criniere\']').value;
	s += '-m_';
	s += '-gc_';
	s += '-gt_';
	s += '-gs_';
	s += '.png">';

	document.getElementById('visu'+qui).innerHTML = s;
}
function c_d2h(d){	
	a=d.split(',');
	var x = '';
	x += d2h(parseInt(a[0]));
	x += d2h(parseInt(a[1]));
	x += d2h(parseInt(a[2]));
	return x;
}

function d2h(d) {return d.toString(16);}

function voir(qui){
	var s  = '<img src="poney/';
	s += 't_'+document.getElementById(qui+'[\'type\']').options[document.getElementById(qui+'[\'type\']').selectedIndex].value;
	s += '-cc_'+document.getElementById(qui+'[\'couleur_corps\']').value;
	s += '-cy_'+document.getElementById(qui+'[\'couleur_yeux\']').value;
	s += '-ccr_'+document.getElementById(qui+'[\'couleur_criniere\']').value;
	s += '-m_';
	s += '-gc_';
	s += '-gt_';
	s += '-gs_';
	s += '.png">';

	type = document.getElementById(qui+'[\'type\']').options[document.getElementById(qui+'[\'type\']').selectedIndex].value;
	switch(parseInt(type)){
		case 0: type = 'terre'; break;
		case 1: type = 'air'; break;
		case 2: type = 'eau'; break;
		case 3: type = 'feu'; break;
		case 4: type = 'amour'; break;
		case 5: type = 'felin'; break;
		case 6: type = 'lumiere';break;
		default: type = 'terre';
	}
	
	
	var so = new SWFObject("flponey6.swf", "sotester", "270", "234", "8", "#FFFFFF");
	so.addParam("menu", "false");
	so.useExpressInstall("swfobject1-5/expressinstall.swf");
	so.addVariable("age", "bebe");
	so.addVariable("type", type);
	so.addVariable("cc", "0x"+c_d2h(document.getElementById(qui+'[\'couleur_corps\']').value));
	so.addVariable("co", "0x"+c_d2h(document.getElementById(qui+'[\'couleur_yeux\']').value));
	so.addVariable("ccr", "0x"+c_d2h(document.getElementById(qui+'[\'couleur_criniere\']').value));
	so.write("visu"+qui);
}
function cp(el){
	element = el;
	document.getElementById('temoin').style.backgroundColor = artabus = el.title;
	document.getElementById('colorpicker').style.visibility = 'visible';
	document.getElementById('colorpicker').style.display = 'block';
}
 function p(){
		element.title = artabus;
		element.style.backgroundColor = artabus;
		element.value =  parseInt(artabus.substr(1,2),16)+","+parseInt(artabus.substr(3,2),16)+","+parseInt(artabus.substr(5,2),16);

		document.getElementById('colorpicker').style.visibility = 'hidden';
		document.getElementById('colorpicker').style.display = 'none';
		voir('mere');
		voir('pere');
   }
 function t(e){
     source=ie?event.srcElement:e.target
     if(source.tagName=="TABLE") return
     while(source.tagName!="TD" && source.tagName!="HTML")source=ns6?source.parentNode:source.parentElement
     document.getElementById('temoin').style.backgroundColor=artabus=source.bgColor
   }
   
  function run() {
	  var total=1657;
   var X=Y=j=RG=B=0;
   var aR=new Array(total);
   var aG=new Array(total);
   var aB=new Array(total);
   for (var i=0;i<256;i++){
     aR[i+510]=aR[i+765]=aG[i+1020]=aG[i+5*255]=aB[i]=aB[i+255]=0;
     aR[510-i]=aR[i+1020]=aG[i]=aG[1020-i]=aB[i+510]=aB[1530-i]=i;
     aR[i]=aR[1530-i]=aG[i+255]=aG[i+510]=aB[i+765]=aB[i+1020]=255;
     if(i<255){
       aR[i/2+1530]=127;aG[i/2+1530]=127;aB[i/2+1530]=127;
     }
   }
   var hexbase=new Array("0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F");
   var i=0;
   var jl=new Array();
   for(x=0;x<16;x++)
     for(y=0;y<16;y++)
       jl[i++]=hexbase[x]+hexbase[y];
   document.write('<'+'table border="0" cellspacing="0" cellpadding="0" onMouseover="t(event)" onClick="p()">');
   var H=W=63;
   for (Y=0;Y<=H;Y++){
      s='<'+'tr height=2>';j=Math.round(Y*(510/(H+1))-255)
      for (X=0;X<=W;X++){
         i=Math.round(X*(total/W))
         R=aR[i]-j;if(R<0)R=0;if(R>255||isNaN(R))R=255
         G=aG[i]-j;if(G<0)G=0;if(G>255||isNaN(G))G=255
         B=aB[i]-j;if(B<0)B=0;if(B>255||isNaN(B))B=255
         s=s+'<'+'td width=2 bgcolor=#'+jl[R]+jl[G]+jl[B]+'><'+'/td>'
      }
      document.write(s+'<'+'/tr>')
   }
   document.write('<'+'/table>');
   var ns6=document.getElementById&&!document.all
   var ie=document.all
   var artabus=''
  }*/