var loadfavitem;
loadfavitem="hide";

var lastopenTHEME;
lastopenTHEME="themechannel_1";

var lastopenTITLE;
lastopenTITLE="titlethemechannel_1";

var lastopen;
lastopen="null";

var main_container;
main_container="hide";

var logo_desktop;
logo_desktop="show";

var loadzone;
loadzone="hide";

var lockcurnews;
lockcurnews="0";
// -------------------------------------------------------------------------------------------------//
function myconsoselect2(){
 if ( document.getElementById('consopref').style.display=='block')
      { document.getElementById('consopref').style.display='none'; }
 if ( document.getElementById('topnewsleftid').style.display=='none')      
      { document.getElementById('topnewsleftid').style.display='block';}  
			 }
// -------------------------------------------------------------------------------------------------//
function myconsoselect()  
                    {
		    if ( document.getElementById('consopref').style.display=='block') 
		       { document.getElementById('consopref').style.display='none'; 
		         document.getElementById('topnewsleftid').style.display='block';
		         return true; }
		    
		    document.getElementById('consopref').style.display='block';
		    document.getElementById('topnewsleftid').style.display='none';
		    document.getElementById(lastopenTHEME).style.display='none';
		    document.getElementById(lastopenTITLE).style.display='block';
		    }
// -------------------------------------------------------------------------------------------------//
function myrssconso(_id_){
var titlethemechannel_x ='titlethemechannel_'+_id_;
var themechannel_x ='themechannel_'+_id_;
var panoTHEME_x ='panoTHEME_'+_id_;
var panofolder_x ='panofolder_'+_id_;

if( (document.getElementById(titlethemechannel_x).style.display=='block') || (document.getElementById(titlethemechannel_x).style.display==''))    
    { 
    document.getElementById(titlethemechannel_x).style.display='none'; 
    document.getElementById(panoTHEME_x).style.display='none';
    document.getElementById(panofolder_x).style.display='none';
    document.getElementById('myconso'+_id_).style.color='#bbbbbb';
    }
else
      { 
      document.getElementById(titlethemechannel_x).style.display='block'; 
      document.getElementById(panoTHEME_x).style.display='block';
      document.getElementById(panofolder_x).style.display='block';
      document.getElementById('myconso'+_id_).style.color='#000000'; 
      }
}
// -------------------------------------------------------------------------------------------------//

function logme() { 
		   var b=document.getElementById('_pass_').value; var a=document.getElementById('_email_').value;
		   new Ajax.Updater('main','librss/loadcontent.php?datatxt=loginpanel&l='+a+'&p='+b, {asynchronous:true});
		 }



function Semaine(){ this[0] = "dimanche";  this[1] = "lundi";  this[2] = "mardi"; this[3] = "mercredi"; this[4] = "jeudi";     this[5] = "vendredi";this[6] = "samedi"; }
function Mois()   { this[0] = "janvier";    this[1] = "f&eacute;vrier";this[2] = "mars"; this[3] = "avril";this[4] = "mai"; this[5] = "juin"; this[6] = "juillet";    this[7] = "ao&ucirc;t";this[8] = "septembre";  this[9] = "octobre";this[10] = "novembre";  this[11] = "d&eacute;cembre";}
function loadmenupano() { new Ajax.Updater('topnewsblock', 'librss/returnmenupano.php', {asynchronous:true}); }
var semaine=new Semaine();
var mois=new Mois();
var myDate=new Date();
var date_du_jour = semaine[myDate.getDay()]+' '+myDate.getDate()+' '+mois[myDate.getMonth()]+' '+myDate.getFullYear();

function displayIDloading(_id_) { document.getElementById(_id_).innerHTML = '<center><img src="images/loading.gif" border="0" style="margin-bottom:25px;margin-top:25px;"></center>'; }
function displayIDblock(_ID_)   { document.getElementById(_ID_).style.display='block'; }

function loadpano()
		 {
		 var waittopnewsblock=0.1;

		document.getElementById('main').innerHTML='';
    		document.getElementById('main').style.display='none';
			 
        	 if  (document.getElementById('topnewsblock').style.display != 'none')
	         { Effect.SlideUp('topnewsblock',{delay:0.1,duration:0.7});  waittopnewsblock=0.8;}
		 
        	 if  (document.getElementById('logodesktop').style.display != 'none')
	        { Effect.SlideUp('logodesktop',{delay:waittopnewsblock,duration:0.4}); waittopnewsblock=waittopnewsblock+0.4;}
		    		 
		 if(document.getElementById('panomenu').style.display == 'none')
		 Effect.Appear('panomenu',{delay:waittopnewsblock,duration:0.6});
        	 main_container='show';
		 logo_desktop='hide';
		 }

function unloadhome(data)
	  {
	  var delay1=1;
          if(document.getElementById('panomenu').style.display != 'none') document.getElementById('panomenu').style.display='none';
	  document.getElementById('homebuttonover').src='images/homebutton.gif';
	  document.getElementById('main').innerHTML='';
	  document.getElementById('main').style.display='none';
	  if  (document.getElementById('topnewsblock').style.display != 'none')
	  { Effect.SlideUp('topnewsblock',{delay:0.3,duration:0.7}); delay1=delay1+1;}
	  if  (document.getElementById('logodesktop').style.display != 'none')
	  { Effect.SlideUp('logodesktop',{delay:1,duration:0.4}); delay1=delay1+1.4;}
	  new Ajax.Updater('main', 'librss/loadcontent.php?datatxt='+data, {asynchronous:true});
	  Effect.Appear('main',{delay:delay1,duration:0.7});
	  main_container='show';
	  logo_desktop='hide';
	  }

function loadhome()
	 {
	 if(document.getElementById('panomenu').style.display != 'none') document.getElementById('panomenu').style.display='none';
	 // var unloadhomevar="hide";
	 Effect.Fade('focusvisit',{delay:0.1,duration:0.3});
	 document.getElementById('homebuttonover').src='images/homebutton.gif';
	 document.getElementById('main').innerHTML='';
	 document.getElementById('main').style.display='none';
	 if (logo_desktop=='hide') { 
				   Effect.BlindDown('logodesktop',{delay:0.2,duration:0.5});
				   Effect.BlindDown('topnewsblock', {delay:0.8,duration:0.5});
				   logo_desktop='show';
				   }
	 document.getElementById('focusvisit').innerHTML = '';
	 return true;
	 }


function dispyesnoTHEME(id,id2)
    {
    loadhome();
    if ( (lastopenTHEME != 'null') & (lastopenTHEME != id) )	
	{ 
// document.getElementById(id2).style.display='none';
	Effect.BlindUp(id2,{delay:0.1,duration:0.3});
	Effect.BlindUp(lastopenTHEME,{delay:0.4,duration:0.5});
	}
	
    if (document.getElementById(id).style.display == 'none')    
	{ 
	Effect.BlindDown(id,{delay:0.7,duration:0.5});
	Effect.BlindDown(lastopenTITLE,{delay:0.7,duration:0.3});
// document.getElementById(lastopenTITLE).style.display='block';
	lastopenTHEME=id;
	lastopenTITLE=id2;
	}

    if (loadfavitem=='show')
       {
       Effect.SlideUp('favoitem',{duration:0.3});
       document.getElementById('favoitem').style.display='none';
       displayIDloading('favoitem');       
       loadfavitem='hide';
       }
    if  (lastopen != 'null')
        { document.getElementById(lastopen).style.display='none';displayIDloading(lastopen); }
    }


function dispyesno(id,rssdata)
    {
    if(document.getElementById('panomenu').style.display != 'none') document.getElementById('panomenu').style.display='none';

    Effect.Fade('focusvisit',{delay:0.1,duration:0.3});
    document.getElementById('main').innerHTML='';
    document.getElementById('main').style.display='none';
    document.getElementById('homebuttonover').src='images/homebutton.gif';

    if (main_container=='show' &&  (logo_desktop=='hide') )
				{ 
				Effect.Appear('logodesktop',{delay:0.5, duration:0.8});
				Effect.BlindDown('topnewsblock',{delay:1.4, duration:0.5}) 				
				logo_desktop='show';
				}
    
    if  ( (lastopen != 'null') & (lastopen != id) ) 
	{ 
	Effect.SlideUp(lastopen,{duration:0.3});
	document.getElementById(lastopen).style.display='none';
	displayIDloading(lastopen);
	}

   if   (loadfavitem=='show')
	{
	Effect.SlideUp('favoitem',{duration:0.3});
	document.getElementById('favoitem').style.display='none';
	displayIDloading('favoitem');
	loadfavitem='hide';
	}

    if  (document.getElementById(id).style.display=='none') 
	{ 
	Effect.SlideDown(id,{duration:0.3});
	document.getElementById(id).style.display='block';
	lastopen=id;
	}

    new Ajax.Updater(id, 'librss/onerss.php?data='+rssdata, {asynchronous:true});
    document.getElementById('focusvisit').innerHTML='';
    }

function loadmain(data,delaymin)
	{
	var duration1=0.5;
	var delay1=0.1;
	var duration2=0.5;
	var delay2=duration1+delay1;
	var duration3=0.5;
	var delay3=duration2+delay2;
	var duration4=0.4;
	var delay4=duration3+delay3;
	var fullduration=((duration1+duration2+duration3)*1000)+1000; 
	var fullduration2=(duration4+fullduration)+1000; 
	
	if(document.getElementById('panomenu').style.display != 'none')document.getElementById('panomenu').style.display='none';
	
	if (main_container=='show') { 
				    document.getElementById('main').style.display='none';
				    document.getElementById('main').innerHTML='';
				    main_container='hide';
				    }
	if (main_container=='hide') { 
				    document.getElementById('homebuttonover').src='images/button-loader.gif';				    
				    new Ajax.Updater('main', 'librss/url2iframe.php?urldata='+data,{asynchronous:true});				    
				    if(delaymin!=0) { delay1=delay1+delaymin; 
						      delay2=delay2+delaymin; 
						      delay3=delay3+delaymin; 
						      delay4=delay4+delaymin;
						      }				    
				    if (logo_desktop=='show') {
				    // Effect.SlideUp('topnewsblock',{delay:delay1,duration:duration2});
				    document.getElementById('topnewsblock').style.display='none';
				    Effect.SlideUp('logodesktop',{delay:delay2,duration:duration2});
							      }				    
				    loadzone="show";
				    logo_desktop='hide';
				    main_container='show';
				    setTimeout("displayIDblock('main')","fullduration2");
				    }
	}


/* function loadaction(urldata,visites) */
function loadaction(visites)
		    {
/*		    new Ajax.Request('librss/addlog.php?urldata='+urldata, {asynchronous:true}); */
		    document.getElementById('homebuttonover').src='images/homebutton.gif';
		    document.getElementById('focusvisit').innerHTML = visites;
		    Effect.Appear('focusvisit',{delay:0.1,duration:0.3});
		    }

function blackscreen() {
		       document.getElementById('waiting').innerHTML='<img src="images/homelogo.png" border="0" style="margin-top:130px;"><br>Chargement<br><img src="images/wait.gif" border="0">';
		       Effect.SlideUp('waiting',{delay:1.5,duration:0.8});
		    // Effect.BlindDown('themechannel_1',{delay:2.3,duration:0.3});
		       document.getElementById('titlethemechannel_1').style.display='none';
		       document.getElementById('themechannel_1').style.display='block';
		       focusout();
		       }

function addfavorite(urldata)
		    {
		    if(document.getElementById('nbfavo').style.display=='none') document.getElementById('nbfavo').style.display='block';
		    new Ajax.Request('librss/addfavorite.php?data='+urldata, {asynchronous:true});
		    }


function removehisto(idremove) { new Ajax.Request('librss/delfavorite.php?_i_='+idremove, {asynchronous:true}); }

function loadfavfromremove()   { new Ajax.Updater('favoitem', 'librss/readfavorite.php', {asynchronous:true}); }

function prefsupdate(_p_) 
                    {
		    new Ajax.Updater('myconsomessage', 'librss/updateconspref.php?p='+_p_, {asynchronous:true});
		    document.getElementById('changepassfield').style.display='none';
		    document.getElementById('changemypassbutton').style.display='block';
		    document.getElementById('pass_').value=_p_;document.getElementById('cpass_').value=_p_;
		    }
										

function loadfav()  {
		    if ( document.getElementById('favoitem').style.display=='block') { document.getElementById('favoitem').style.display='none'; return true;}
		    if(lastopen!='null'){ displayIDloading(lastopen); Effect.SlideUp(lastopen,{duration:0.3}); lastopen="null";}
		    document.getElementById('favoitem').style.display='block';
		    new Ajax.Updater('favoitem', 'librss/readfavorite.php', {asynchronous:true});
		    loadfavitem="show";
		    }

function dispfocusover(_DESCRIPTION_)
		    {
		    document.getElementById('loupeimg').src='images/loupe.gif';
		    document.getElementById('focuslink').innerHTML=_DESCRIPTION_;
		    }		    
function dispfocusover3(_DESCRIPTION_, imagerss)
		    {
		    document.getElementById('loupeimg').src='images/picrss/'+imagerss;
		    document.getElementById('focuslink').innerHTML='<div style="font-size:13px;">'+_DESCRIPTION_+'</div>';
		    }
function dispfocusover2(_DESCRIPTION_)
		    {
		    document.getElementById('loupeimg').src='images/loupe.gif';
		    document.getElementById('focuslink').innerHTML='<div class="focusicons">'+_DESCRIPTION_+'</div>';
		    }

function addbookmark()  {
			if ( navigator.appName != 'Microsoft Internet Explorer' ) { window.sidebar.addPanel('Consomonaute.fr','http://www.consomonaute.fr',''); }
			else 							  { window.external.addfavorite('http://www.consomonaute.fr', 'Consomonaute.fr, toute l\'info en ligne.'); }
			}

function focusout()     { document.getElementById('focuslink').innerHTML='<div class="focustitlehome" >Bienvenue sur <b>Consomonaute.fr</b><div style="margin-left:3px;float:left;"><a href="#" onclick="unloadhome(\'helptxt\');" class="linkfocustop">Un peu d\'<b style="color:white;">aide ?</b></a> | <a href="javascript:addbookmark();" class="linkfocustop"><b style="color:white;">Ajouter</b> ce site &agrave; vos favoris</a> | <a onclick="dispformemail();" href="#" class="linkfocustop"><b style="color:white;">Envoyer</b> le lien du site &agrave; un(e) ami(e)</a> | <b style="color:white;font-size:10px;">Th&egrave;mes</b></div><div style="margin:3px 0px 0px 5px;width:65px;float:left;"><a href="javascript:setStyle(\'stdconso\')"  style="font-size:0px;" alt="Choisir le th&egrave;me Classic" title="Choisir le th&egrave;me Classic" style="font-size:0px;"><div style="width:12px;height:10px;margin:1px;background:#a30000;float:left;font-size:0px;"></div></a><a href="javascript:setStyle(\'blue\')"  style="font-size:0px;" alt="Choisir le th&egrave;me Oc&eacute;an" title="Choisir le th&egrave;me Oc&eacute;an"><div style="float:left;width:12px;height:10px;margin:1px;background:#2344FF;font-size:0px;"></div></a><a href="javascript:setStyle(\'pink\')"  alt="Choisir le th&egrave;me Girly" title="Choisir le th&egrave;me Girly" style="font-size:0px;"><div style="float:left;width:12px;height:10px;margin:1px;background:#F04AFF;font-size:0px;"></div></a><a href="javascript:setStyle(\'zenconso\')" style="text-decoration:none;font-size:0px;" alt="Choisir le th&egrave;me Zen" title="Choisir le th&egrave;me Zen"><div style="float:left;width:12px;height:10px;margin:1px;background:#aaaaaa;font-size:0px;"></div></a></div>';

//Effect.Appear('focuslinkcontent',{delay:0.3, duration:0.7});
document.getElementById('loupeimg').src='images/loupe-off.gif'; 
}
function dispfocusout() { document.getElementById('loupeimg').src='images/loupe-off.gif';document.getElementById('focuslink').innerHTML=''}
function iframefocus(focusrsslnk) { document.getElementById('focuslink').innerHTML='Adresse du flux : <input type="text" name="_rsslink_" id="_rsslink_" style="border:1px solid;background:#6C1517;font-size:11px;color:white;" size="45" maxlength="200" value="'+focusrsslnk+'">&nbsp;<a href="#"  style="border:1px solid white;background:#B76868;color:white;font-size:11px;text-decoration:none;padding-top:1px;padding-bottom:1px;padding-left:3px;padding-right:3px;"  onclick="raisemailrss_askemail(document.getElementById(\'_rsslink_\').value);">Envoyer le lien</a>&nbsp;&nbsp;<a href="'+focusrsslnk+'" style="border:1px solid white;background:#B76868;color:white;font-size:11px;text-decoration:none;padding-top:1px;padding-bottom:1px;padding-left:3px;padding-right:3px;" target="new">Voir dans une fen&ecirc;tre</a></div>'; }
function dispformemail() { document.getElementById('focuslink').innerHTML='<div style="color:#FFD4D0;font-size:11px;" >Veuillez saisir l\'adresse <b>email</b> de votre ami(e) : <input type="text" name="_email_" id="_email_" style="border:1px solid;background:#3D2700;font-size:11px;color:white;" size="20" maxlength="60"><a href="#" style="margin:2px;padding:2px;text-decoration:none;font-size:11px;border:1px solid white;color:white;background:#FF8400;" onclick="raisemail(document.getElementById(\'_email_\').value);">OK</a></div>'; }
function raisemail(emailsite)  { if(emailsite!='') { location.href = 'mailto:'+emailsite+'?Subject=Viens%20decouvrir%20Consomonaute.fr&Body=Bonjour%2C%0A%0ASimplifiez%20vous%20l%27info%20en%20ligne%20%3A%20Actu%2C%20Eco%2C%20Techno%2C%20People%2C%20Blog%2C%20Tendances%2C%202.0%20avec%20Consomonaute.fr%2C%20le%20lecteur%20de%20flux%20rss%20en%20ligne.%0A%0ABonne%20journee.%0A---------------------------%0Ahttp%3A//www.consomonaute.fr%0A---------------------------';} }
function raisemailrss_askemail(rsslink) { document.getElementById('focuslink').innerHTML='<div style="color:#FFD4D0;font-size:11px;" >Veuillez saisir l\'adresse <b>email</b> de votre ami(e) : <input type="text" name="_email_" id="_email_" style="border:1px solid;background:#3D2700;font-size:11px;color:white;" size="20" maxlength="60"><a href="#" style="margin:2px;padding:2px;text-decoration:none;font-size:11px;border:1px solid white;color:white;background:#FF8400;" onclick="raisemailrss(document.getElementById(\'_email_\').value , \''+escape(rsslink)+'\' );">OK</a></div>'; }
function raisemailrss(emailsite,rsslink) { if(emailsite!='') { location.href = 'mailto:'+emailsite+'?Subject=Voici%20un%20lien%20trouve%20sur%20Consomonaute.fr&Body=Bonjour%2C%0A%0Avoici%20un%20lien%20interessant%20%3A%0A'+rsslink+'%0A%0ABonne%20journee.%0A---------------------------%0Ahttp%3A//www.consomonaute.fr%0A---------------------------'; } }

//------------------------------ pano function -------------------------------------//
function dispyesnoTHEMEpano(id,id2)
    {
    if ( (lastopenTHEME != 'null') & (lastopenTHEME != id) ) 
       { Effect.BlindUp(id2,{delay:0.1,duration:0.3});Effect.BlindUp(lastopenTHEME,{delay:0.4,duration:0.5}); }
    if (document.getElementById(id).style.display == 'none') { 
	Effect.BlindDown(id,{delay:0.7,duration:0.5});
	Effect.BlindDown(lastopenTITLE,{delay:0.7,duration:0.3});
	lastopenTHEME=id;lastopenTITLE=id2;
	}
    if (loadfavitem=='show') {
       Effect.SlideUp('favoitem',{duration:0.3});
       document.getElementById('favoitem').style.display='none';
       displayIDloading('favoitem');loadfavitem='hide';}
    if  (lastopen != 'null')
        { document.getElementById(lastopen).style.display='none';displayIDloading(lastopen); }
    }


function dispyesnopano(id,rssdata)
    {
    Effect.Fade('focusvisit',{delay:0.1,duration:0.3});
      document.getElementById('homebuttonover').src='images/homebutton.gif';
    if  ( (lastopen != 'null') & (lastopen != id) ) 
	{ 
	Effect.SlideUp(lastopen,{duration:0.3});
	document.getElementById(lastopen).style.display='none';
	displayIDloading(lastopen);
	}
   if   (loadfavitem=='show')
	{
	Effect.SlideUp('favoitem',{duration:0.3});
	document.getElementById('favoitem').style.display='none';
	displayIDloading('favoitem');
	loadfavitem='hide';
	}
    if  (document.getElementById(id).style.display=='none') 
	{ 
	Effect.SlideDown(id,{duration:0.3});
	document.getElementById(id).style.display='block';
	lastopen=id;
	}
    new Ajax.Updater(id, 'librss/onerss.php?data='+rssdata, {asynchronous:true});
    document.getElementById('focusvisit').innerHTML='';
    }

function dispmoveto(id)  {
			 var mozoffset = 0;
			 if (tt_flagOpa==4) mozoffset = 133; // browser value from wz_tooltip.js 
			 document.getElementById('mainpano2').scrollTop = document.getElementById(id).offsetTop-mozoffset;
			 }
		      
