var nbmails=0;var mailnum=0;var page=1;var deleting=false;var cptfocus=false;var IE6=false;var gHi;var gHm;var TSel;var sp=true;
function Gelt(n){return document.getElementById(n);}
function GeltInbox(n){return window.frames['ifinbox'].document.getElementById(n);}
function GeltMail(n){return window.frames['ifmail'].document.getElementById(n);}
function GeltW(w,n){if(w=='') return Gelt(n);else if (w=='ifinbox') return GeltInbox(n);else if (w=='ifmail') return GeltInbox(n);}
function v(w,n,b){if(b)GeltW(w,n).style.display='';else GeltW(w,n).style.display='none';}
function rmails(){try{GHeights();window.Gelt('nbmail').innerHTML='';v('','winbox',true);SHeights();}catch(ex){}}
function gch(){try{var wch=''; if(window.frames['ifmail'].document.location.href) wch=window.frames['ifmail'].document.location.href;}catch(ex){}return wch;}
function GHeights(){try{if(Goh(Gelt('ifinbox')))gHi=Goh(Gelt('ifinbox'));if(Goh(Gelt('ifmail')))gHm=Goh(Gelt('ifmail'));}catch(ex){}}
function SHeights(){try{if(!Goh(Gelt('ifinbox'))) {sOH(Gelt('ifinbox'), gHi);sOH(Gelt('ifmail'), gHm);}}catch(ex){}}
function sOH(elm, h){try{with(elm.style){height=h+'px';if(elm.offsetHeight == h) return;height=h-(elm.offsetHeight-h)+'px';}}catch(ex){}}
function Goh(o){try{if(o.offsetHeight) return o.offsetHeight;return null;}catch(ex){}}
function finrmail(nbmtot,nbmaff,n,rep,p){try{page=p;nbmails=nbmaff;var ch=gch();var s='';GHeights();v('','winbox',false);if(nbmtot>1)s='s';if(nbmaff==0 || n==0)v('','butmail',false);window.Gelt('nbmail').innerHTML=nbmtot+' mail'+s+'&nbsp;';deleting=false;SHeights();if(n!=0){cm(n,rep);if(window.frames['ifmail'].document)if(ch.indexOf('m'+gmid(n),0)<0){window.frames['ifmail'].document.location.replace('mail.php?id=m'+gmid(n));}}else if(window.frames['ifmail'].document && ch.indexOf('?',0)>0) window.frames['ifmail'].document.location.replace('/mail.htm');if(nbmtot==0){var ch=ch+'_';if(window.frames['ifmail'].document && ch.indexOf('mail.php',0)<0)window.frames['ifmail'].document.location.replace('mail.php');}}catch(ex){}}
function affm(t){try{mcach();window.frames['ifmail'].document.location.href='mail.php?id='+t+gmid(mailnum);}catch(ex){}}
function affmenc(e){mcach();window.frames['ifmail'].document.location.href='mail.php?id=m'+gmid(mailnum)+'&c='+e;}
function cm(n,rep){try{if(rep==0){v('','repmail',false);v('','repmail2',false);}else{ v('','repmail',true);v('','repmail2',true);}mailnum=n;v('','butmail',true);for(i=1;i<=nbmails;i++){if(n==i){EnvSet(i,2);GeltInbox('m'+i).style.backgroundColor='#e8edf2';}else{EnvSet(i,TSel[i]);if(GeltInbox('m'+i)) GeltInbox('m'+i).style.backgroundColor='';}}}catch(ex){}}
function cEnv(o){try{n=o.id.substring(1,10);EnvSet(n, (TSel[n] + 1) % 2);msgi('');}catch(ex){}}
function EnvSet(n,e){try{o=GeltInbox('e'+n);if(o){if(n>0)u=GeltInbox('m'+n).firstChild;o.style.backgroundPosition=ebp(n,e);if(!IE6){if(e==0 && n>0)u.style.backgroundImage="";if(e==1 && n>0)u.style.backgroundImage="url(/style/pic/inbox.png)";}if(e!=2){TSel[n]=e;if(n>0 && e==0) EnvSet(0,0);if(n>0 && e==1){e0=1;for(var i=1;i<=nbmails;i++) if(TSel[i]!=1 && GeltInbox('e'+i)) {e0=0;break;}EnvSet(0,e0);}}}}catch(ex){}}
function ebp(n,e){try{if(e==2){if(TSel[n]==0)return"-21px -11px"; else return"-21px -25px";}if(e==0) if(n>0){ if(n==mailnum) return"-21px -11px"; else return"-21px 0px"; } else return"-21px 4px";if(e==1) if(n>0) return"-21px -25px"; else return"-21px -21px";}catch(ex){}}
function EnvAll(){try{msgi('');var e=0;for(var i=1;i<=nbmails;i++) if(TSel[i]!=1 && GeltInbox('e'+i)) {e=1;break;}for(var i=1;i<=nbmails;i++) EnvSet(i,e);}catch(ex){}}
function lrep(act){try{mid=gmid(mailnum);if(mid=='') msgi('No mail selected');else window.frames['ifmail'].document.location.href='send-mail.php?act='+act+'&login='+compte+'&mailid='+mid;}catch(ex){}}var timeout;var gmnu;function menuvoir(mnu){try{clearTimeout(timeout);GeltMenu(mnu).style.visibility='visible';GeltMenu(mnu).style.display='';}catch(ex){}}
function menucacher(mnu){try{gmnu=mnu;timeout = setTimeout('mcach()',300);}catch(ex){}}
function mcach(){try{GeltMenu(gmnu).style.visibility='hidden';GeltMenu(gmnu).style.display='none';}catch(ex){}}
function GeltMenu(mnu){if(mnu=='delmenu') return GeltInbox(mnu);else if (mnu=='menu') return Gelt(mnu);else return Gelt(mnu);}function suppr(){try{for(i=1;i<=nbmails;i++)if(TSel[i]==1){ suppr_sel();return;}suppr_mail();}catch(ex){}}

function suppr_all(){try{if(!deleting){deleting=true;window.frames['ifmail'].document.body.innerHTML='';window.frames['ifinbox'].document.location.href='inbox.php?login='+compte+'&id=none&d=all'+'&ctrl='+gmid(mailnum)+'&spam='+sp;}}catch(ex){}}

function suppr_sel(){try{if(!deleting){deleting=true;ch='';for(i=1;i<=nbmails;i++){if(TSel[i]==1){ch=ch+gmid(i)+'|';changeOpac(0,'ifinbox','m'+i);}}if(ch!=''){window.frames['ifinbox'].document.location.href='inbox.php?login='+compte+'&id='+gmid(mailnum)+'&d='+ch.substring(0,ch.length-1)+'&p='+page+'&spam='+sp;}else{msgi('<span class="igif fleche">&nbsp;</span>No mail selected');deleting=false;}}}catch(ex){}}

function suppr_mail(){try{if(!deleting){deleting=true;nextmailid=gmid(Number(mailnum)+1);if(nextmailid=='') nextmailid='last';window.frames['ifmail'].document.body.innerHTML='';changeOpac(0,'ifinbox','m'+mailnum);window.frames['ifinbox'].document.location.href='inbox.php?login='+compte+'&d='+gmid(mailnum)+'&id='+nextmailid+'&scrl='+window.frames['ifinbox'].document.documentElement.scrollTop.toString()+'&p='+page+'&spam='+sp;}}catch(ex){}}


function gmid(n){try{h=GeltInbox('m'+n).firstChild.firstChild.href;return h.substr(h.indexOf('id=',0)+4);}catch(ex){return ''}}
function kp(pEnvent){try{if(pEnvent.keyCode==46 && !cptfocus && nbmails>0)suppr();}catch(ex){}}
var tabo;
function opacity(w,id,opacStart,opacEnd,millisec){try{if(tabo){for(i=0;i<=tabo.length;i++){clearTimeout(tabo[i]);}}tabo=new Array(Math.abs(opacEnd-opacStart)+1);if(GeltW(w,id)){var speed = Math.round(millisec / 100);var timer=0;if(opacStart > opacEnd){for(i=opacStart;i>=opacEnd;i--){tabo[i+1]=setTimeout("changeOpac("+i +",'"+w+"','"+id+"')",(timer * speed));timer++;}tabo[i+1]=setTimeout("v('"+w+"','"+id+"',false)",(timer * speed));}else if(opacStart < opacEnd){v(w,id,true);for(i=opacStart;i<=opacEnd;i++){tabo[i]=setTimeout("changeOpac("+i+",'"+w+"','"+id+"')",(timer * speed));timer++;}}}}catch(ex){}} 
function changeOpac(opacity,w, id){try{if(GeltW(w,id)){var object = GeltW(w,id).style;object.opacity=(opacity / 100);object.MozOpacity=(opacity / 100);object.KhtmlOpacity=(opacity / 100);object.filter="alpha(opacity=" + opacity + ")";}}catch(ex){}} 
function msgi(m){ try{o=GeltInbox('msginbox');o.innerHTML=m;if(m.length>0) o.style.display=''; else o.style.display='none';}catch(ex){}}
function CptonKeyUp(){try{var c=Gelt('login').value;var a=Gelt('autocpt');if(c.indexOf('@')>0)c=c.substring(0,c.indexOf('@'));if(c.length==0){if(a.innerHTML.length!=0)opacity('','autocptobj', 100, 0, 500);a.innerHTML='';return;}if(a.innerHTML.length==0){ opacity('','autocptobj', 0, 100, 500);}var reg_login = /^[-a-zA-Z0-9@_.]{1,}$/; if(!(reg_login.test(c))){a.innerHTML="<b>Use only : a-z 0-9 . _ -</b>";return;}if(c.length > 25){a.innerHTML="<b>25 characters max !</b>";return;}a.innerHTML='<em>'+c+'</em>&#64;yopmail.com';}catch(ex){}}
function WCptonKeyUp(){try{var c=Gelt('login').value;var alt=Gelt('autoaltcpt');if(!alt || !c){alt.innerHTML='';return;}if(c.indexOf('@')>0)c=c.substring(0,c.indexOf('@'));if(c.length==0){alt.innerHTML='';return;}var reg_login = /^[-a-zA-Z0-9@_.]{1,}$/; if (!(reg_login.test(c))) {alt.innerHTML='<b>Error</b>';return;}if(c.length > 25){alt.innerHTML='<b>Error</b>';return;}httpg(c);}catch(ex){}}
var xhr_object = null; 
function httpg(c){try{if(window.XMLHttpRequest)xhr_object = new XMLHttpRequest();else if(window.ActiveXObject)xhr_object = new ActiveXObject("Microsoft.XMLHTTP");else{return;}xhr_object.open("GET", "get_alt.php?c="+c, true);xhr_object.onreadystatechange=function(){prq()};xhr_object.setRequestHeader("Content-type", "application/x-www-form-urlencoded");xhr_object.send("");}catch(ex){}}
prq=function(){try{if (xhr_object.readyState == 4){if(xhr_object.status == 200){Gelt('autoaltcpt').innerHTML='<em>'+xhr_object.responseText+'</em>@yopmail.com';}else{Gelt('autoaltcpt').innerHTML='error ' + xhr_object.status;}}}catch(ex){}}
function refr(){try{sd();if(Gelt('login').value!=compte)Gelt('f').submit();else{rmails();window.frames['ifinbox'].document.location.href='inbox.php?login='+compte+'&spam='+sp;}}catch(ex){}}
function spam(){sp=!sp;refr();}function setp(n,v){try{window.frames['ifcall'].document.location.href='setp.php?n='+n+'&v='+v;}catch(ex){}}
function printmail(){try{
window.frames['ifmail'].focus(); 
window.frames['ifmail'].print(); 
}catch(ex){}}
