/* - - - - - - - - - - - - - - - - - - - - - - -
 JavaScript
 vendredi 27 février 2009 16:43:23
 HAPedit 3.1.11.111
 - - - - - - - - - - - - - - - - - - - - - - - */
function swap_java(nom)
{
if (document.getElementById(nom).style.display == 'none')
   {
   document.getElementById(nom).style.display = 'block';
   }
   else
   {
   document.getElementById(nom).style.display = 'none';
   }
   return false;
}


function swap_java2(nom,vitesse)
{
if (document.getElementById(nom).style.display == 'none')
   {
   Effect.SlideDown(nom,{ duration: vitesse });
   }
   else
   {
   /*document.getElementById(nom).style.display = 'none';*/
   Effect.SlideUp(nom,{ duration: vitesse });
   }
   return false;
}

function swap_java3(nom,vitesse,bouton,im1,im2)
{
    if(document.getElementById(nom)) {
        if (document.getElementById(nom).style.display == 'none') {
           document.getElementById(bouton).src = im2;
           Effect.SlideDown(nom,{ duration: vitesse });
        }
        else {
           document.getElementById(bouton).src= im1;
           Effect.SlideUp(nom,{ duration: vitesse });
        }
    }
    return false;
}

function f2(champ){
if (champ.id==champ.value)
{
champ.value='';
}
elseif(champ.value=='')
{
champ.style.color='#BABABA';
champ.value=champ.id;
}
}

function f3(champ)
{
if (champ.value==champ.id) {champ.style.color='#BABABA';} else {champ.style.color='#000000';}
if (champ.value=='') {champ.style.color='#BABABA';champ.value=champ.id;}
}
function f4(champ)
{
if (champ.id==champ.value)
{
champ.value='';
champ.style.color='#000000';
}
}

function chge_pwd()
{
    if (document.getElementById('pwd_input').value=='Password')
    {
        document.getElementById('pwd_input_span').innerHTML = '<input type="password" id="pwd_input" style="width:110px;height:12px;font-size:10px;" onblur="chge_pwd2();" name="password" />';
        setTimeout("document.getElementById('pwd_input').focus();", 10);
    }
}
function chge_pwd2()
{
    if (document.getElementById('pwd_input').value=='')
    {
        document.getElementById('pwd_input_span').innerHTML = '<input type="text" id="pwd_input" style="width:110px;height:12px;font-size:10px;" value="Password" onfocus="chge_pwd();" />';
    }
}

function chge_pwd_small()
{
    if (document.getElementById('pwd_small_input').value=='Password')
    {
        document.getElementById('pwd_small_input_span').innerHTML = '<input type="password" id="pwd_small_input" style="width:200px;font-size:12px;" onblur="chge_pwd2_small();" name="password" />';
        setTimeout("document.getElementById('pwd_small_input').focus();", 10);
    }
}
function chge_pwd2_small()
{
    if (document.getElementById('pwd_small_input').value=='')
    {
        document.getElementById('pwd_small_input_span').innerHTML = '<input type="text" id="pwd_small_input" style="width:200px;font-size:12px;" value="Password" onfocus="chge_pwd_small();" />';
    }
}

function EcrireCookie(nom, valeur)
{
var argv=EcrireCookie.arguments;
var argc=EcrireCookie.arguments.length;
var expires=(argc > 2) ? argv[2] : null;
var path=(argc > 3) ? argv[3] : null;
var domain=(argc > 4) ? argv[4] : null;
var secure=(argc > 5) ? argv[5] : false;
document.cookie=nom+"="+escape(valeur)+
((expires==null) ? "" : ("; expires="+expires.toGMTString()))+
((path==null) ? "" : ("; path="+path))+
((domain==null) ? "" : ("; domain="+domain))+
((secure==true) ? "; secure" : "");
}

function apostrophe(chaine)
{
chaine=chaine.replace("’","'");
$chaine=chaine.replace('“','"');
$chaine=chaine.replace('«','"');
$chaine=chaine.replace('»','"');
return chaine;
}

function createCookie(name,value,days) {
    if (days) {
        var date = new Date();
        date.setTime(date.getTime()+(days*24*60*60*1000));
        var expires = "; expires="+date.toGMTString();
    }
    else var expires = "";
    document.cookie = name+"="+value+expires+"; path=/";
}

function arguments_cookie(offset){
  var endstr=document.cookie.indexOf (";", offset);
  if (endstr==-1) endstr=document.cookie.length;
  return unescape(document.cookie.substring(offset, endstr)); 
}

function getCookie(name){
     if(document.cookie.length == 0)
       return null;

     var regSepCookie = new RegExp('(; )', 'g');
     var cookies = document.cookie.split(regSepCookie);

     for(var i = 0; i < cookies.length; i++){
       var regInfo = new RegExp('=', 'g');
       var infos = cookies[i].split(regInfo);
       if(infos[0] == name){
         return unescape(infos[1]);
       }
     }
     return null;
   }

function apparition_popup(truc)
{
new Effect.Appear('cache',{duration:0.2 ,from:0.0, to:0.7, afterFinish: function () {document.getElementById(truc).style.display='block';}});
}

function alr(cas){
	if(cas=='m')
		alert('Vous devez être connecté pour poster un message');	
	else if(cas=='a')
		alert('Vous devez être connecté pour les demandes de contact');
}
function ajup(url,id){
	new Ajax.Updater('block_ajax',url,{onComplete : apparition_popup('block_ajax'),method: 'post',parameters: {to:id}});	
}
function ajup2(url,id){
	new Ajax.Updater('popup-profile',url,{onComplete : apparition_popup('popup-profile'),method: 'post',parameters: {id:id}});	
}
