
function getCookieVal(offset)
{var endstr=document.cookie.indexOf(";",offset);if(endstr==-1)endstr=document.cookie.length;return unescape(document.cookie.substring(offset,endstr));}
function LireCookie(nom)
{var arg=nom+"=";var alen=arg.length;var clen=document.cookie.length;var i=0;while(i<clen)
{var j=i+alen;if(document.cookie.substring(i,j)==arg)return getCookieVal(j);i=document.cookie.indexOf(" ",i)+1;if(i==0)break;}
return null;}
function Deconnecte()
{var exp=new Date();exp.setFullYear(exp.getFullYear()-1);document.cookie="moccltgol=infos;expires="+exp.toGMTString()+";domain=.toutlecine.com;path=/";var p=document.getElementById('id_compte');while(p.lastChild)
p.removeChild(p.lastChild);if(document.all)
{var lien=document.createElement('<a href="#GB_window" name="connect_a" rel="gb_page_center[550, 315]">');var liendeco=document.createElement('<a href="http://www.toutlecine.com/cgi-bin/mon_compte.cgi>');}
else
{var lien=document.createElement("a");lien.setAttribute("href","#GB_window");lien.setAttribute("name","#connect_a");lien.setAttribute("rel","gb_page_center[550, 315]");var liendeco=document.createElement("a");liendeco.setAttribute("href","http://www.toutlecine.com/cgi-bin/mon_compte.cgi");}
connect=document.createTextNode("Se connecter");sep=document.createTextNode(" | ");cree=document.createTextNode("Créer un compte");lien.appendChild(connect);p.appendChild(lien);p.appendChild(sep);liendeco.appendChild(cree);p.appendChild(liendeco);}
function get_pseudo(contenu)
{var tab_pseudo=contenu.split("login$058");var tab_pseudo2=tab_pseudo[1].split("$124");var pseudo=tab_pseudo2[0];var tabspec="";var pseudo2="";var special=false;sauvegarde_position=0;i=0;pseudo=pseudo.replace(/\$/gi,"#");position=pseudo.search("#");while(position!=-1)
{space=String.fromCharCode(pseudo.substr(position+1,3));tabspec+=pseudo.substring(sauvegarde_position,position)+space;i++;sauvegarde_position=position+4;if((pseudo.substr(sauvegarde_position).search("#"))!=-1)
position=sauvegarde_position+pseudo.substr(sauvegarde_position).search("#");else
position=-1;special=true;}
if(special)
{tabspec+=pseudo.substr(sauvegarde_position);pseudo=tabspec;}
return pseudo;}
function modifier_div(pseudo)
{var p=document.getElementById('id_compte');while(p.lastChild)
p.removeChild(p.lastChild);if(document.all)
{var lien=document.createElement('<a href="http://www.toutlecine.com/cgi-bin/mon_compte.cgi?state=1&login='+pseudo+'>');var lien_profil=document.createElement('<a href="http://www.toutlecine.com/cgi-bin/mon_profil.cgi?state=1&pseudo='+pseudo+'>');var strong=document.createElement('<strong />');var liendeco=document.createElement('<a href="#" onclick="javascript:Deconnecte();return false;">');}
else
{var lien_profil=document.createElement("a");lien_profil.setAttribute("href","http://www.toutlecine.com/cgi-bin/mon_profil.cgi?state=1&pseudo="+pseudo);var lien=document.createElement("a");lien.setAttribute("href","http://www.toutlecine.com/cgi-bin/mon_compte.cgi?state=1&login="+pseudo);var liendeco=document.createElement("a");liendeco.setAttribute("href","#");liendeco.setAttribute("onclick","javascript:Deconnecte();return false;");var strong=document.createElement('strong');}
var Cpseudo=document.createTextNode(pseudo);strong.appendChild(Cpseudo);bonjour=document.createTextNode("Bonjour ");modif=document.createTextNode("Modifier");sep1=document.createTextNode(" | ");sep=document.createTextNode(" | ");deco=document.createTextNode("Se déconnecter");p.appendChild(bonjour);lien_profil.appendChild(strong);p.appendChild(lien_profil);p.appendChild(sep1);lien.appendChild(modif);p.appendChild(lien);p.appendChild(sep);liendeco.appendChild(deco);p.appendChild(liendeco);}
function changer_aff_moncompte()
{var p=document.getElementById('id_compte');var contenu=LireCookie("moccltgol");if(contenu!=null)
{pseudo=get_pseudo(contenu);modifier_div(pseudo);}}
