$jQuery(document).ready(function(){if($jQuery("#message").html()!=""){$jQuery("#message").dialog({title:"Info",resizable:true,modal:true});$jQuery("#message").dialog("option","width",420);$jQuery("#message").dialog("option","height",140);$jQuery("#message").dialog("option","buttons",{"Fermer":function(){$jQuery(this).dialog("close");}});}
if($jQuery("#question").html()!=""){$jQuery("#question").dialog({title:"Question",resizable:true,modal:true});$jQuery("#question").dialog("option","width",420);$jQuery("#question").dialog("option","height",140);$jQuery("#question").dialog("option","buttons",{"Non":function(){$jQuery(this).dialog("close");},"Oui":function(){window[$jQuery("#question").attr("rel")]();$jQuery(this).dialog("close");}});}
if($jQuery("input[type=submit]").html()){$jQuery("input[type=submit]").button({icons:{primary:'ui-icon-gear',secondary:'ui-icon-triangle-1-s'}});}
if($jQuery("div.share_openlike").html()){$jQuery("div.share_openlike").mouseenter(function(){$jQuery("#share_openlike").show(500);});$jQuery("div.share_openlike").mouseleave(function(){$jQuery("#share_openlike").hide(500);});}
loadMeteor();});function answerYes(){window.location="./?IAgree=true"
$jQuery.post("./",{'IAgree':"true"});}
function habillage_sondage(){$jQuery("body").append("<div id=\"sondage\" style=\"position:relative;width:304px;height:204px;\"><span class=\"messageToHide\"></span><object style=\"padding:2px;position:absolute;overflow:hidden;clip:rect(2px 302px 202px 2px);\" data=\"http://www.easy-sondage.fr/sondages/index.php?num=b91b1facf3b3a7890177f02ac188f14c\" type=\"text/html\" width=\"304\" height=\"204\"><a href=\"http://www.blog-poll.com/p/Web/b91b1facf3b3a7890177f02ac188f14c.html\">Cliquez-ici pour accéder au sondage.</a></object></div>");$jQuery("#sondage").dialog({title:"Veuillez patienter pendant le chargement...",width:340,height:240,open:function(event,ui){$jQuery("#message").dialog("option","sondage","Sondage Public-Storm");}});}
function validerEmail(email){$jQuery.get(BASE_URL+"/utilisateurs/valideremail.php?email="+email,function(data){if(data){$jQuery("#emailError").show();$jQuery("#emailValid").hide();}else{$jQuery("#emailError").hide();$jQuery("#emailValid").show();}});}
function validerIdentifiant(login){$jQuery.get(BASE_URL+"/utilisateurs/valideridentifiant.php?login="
+login,function(data){if(data){$jQuery("#identifiantError").show();$jQuery("#identifiantValid").hide();}else{$jQuery("#identifiantError").hide();$jQuery("#identifiantValid").show();}});}
function permaname(s){s=no_accent(no_spacer(s));return s;}
function alea(m){var alea="";for(n=0;n<m;n++){alea+=Math.floor(Math.random()*5);}
return alea;}
function no_accent(str){str=str.replace(/[ÀÂÄàâä]/g,"a");str=str.replace(/[ÈÉÊËèéêë]/g,"e");str=str.replace(/[ÎÏîï]/g,"i");str=str.replace(/[ÔÓÖôóö]/g,"o");str=str.replace(/[ÙÛùûü]/g,"u");str=str.replace(/[Çç]/g,"c");str=str.replace(/[°€]/g,"c");return str;}
function ucfirst(str){str+='';var f=str.charAt(0).toUpperCase();return f+str.substr(1);}
function no_spacer(str){str=str.replace(/[ ?!:;\.,]/g,"-");return str;}
function tab(name,id,folder,subpage){if(subpage!==null){name=name+"/"+subpage;}
var url=BASE_URL+"/"+folder+"/gettab/"+name+"/";$jQuery.get(url,function(data){if(data){$jQuery("#content").html(data);}else{$jQuery("#content").html("ERREUR !!");}
$jQuery("#menu ul li a").each(function(i){$jQuery(this).removeClass('tab-hightlight');});$jQuery("#menu ul li a span#"+id).parent().addClass('tab-hightlight');$jQuery("#menu ul li a span#"+id).parent().removeClass('tab');});}
;function add_suggestion(base_url){var formulaire=document.getElementById("suggestionForm");var suggestions=$jQuery("#suggestion").val();var reg=new RegExp("[/\|~:;,]+","");var suggs=suggestions.split(reg);$jQuery.each(suggs,function(i){var s=suggs[i];var storm_id=$jQuery("#storm_id").val();var exists=suggestion_exists(permaname(s));if(exists==false){var id='elt_'+alea(5);var username=$jQuery("#username").html()?$jQuery("#username").html():"Anonymous";var e=$jQuery('<li class="size_10 hidden bulle" id="'+id+'">'+'<blockquote title=""><a href="'+base_url+'/storm/'+permaname(s)+'/'+ucfirst(escape(s))+'/">'+ucfirst(s)+'</a>'+' <span class="size" id="total_'+permaname(s)+'">(1)</span>'+' <span id="suggestions_'+permaname(s)+'" class="hidden" style="vertical-align:top;" />'+' <input type="hidden" name="suggestion" value="'+permaname(s)+'">'+'</blockquote>'+' <cite>'+'  Suggérée par '+username+' </cite>'+'</li>');}
if($jQuery("#storm_"+storm_id+" li.no_suggestion")){$jQuery("#storm_"+storm_id+" li.no_suggestion").hide();}
_gaq.push(['_trackPageview','/add_suggestion/'+$jQuery('#storm_permaname').val()+'/'+permaname(s)]);$jQuery.post(formulaire.action,{suggestion:s,storm_id:storm_id},function(data){if(e){$jQuery('#storm_'+storm_id).append(e);$jQuery('#'+id).fadeIn("slow");}},"text");if(Meteor){$jQuery.post(BASE_URL+'/meteor/meteor.php',{command:"addSuggestion",user:'',channel:getChannelName(),message:s},function(data){setSubscribers(data);},"json");}
display_new_suggestion('storm_'+storm_id,'+1',permaname(s));});$jQuery("#suggestion").val("");}
function suggest_too(suggestion,base_url)
{$jQuery("#suggestion").val(suggestion);add_suggestion(base_url);return false;}
function suggestion_exists(suggestion)
{if($jQuery('#total_'+permaname(suggestion)).length)
{return true;}
else
{return false;}}
function add_storm(base_url,span)
{if(!$jQuery('#add_this_storm_form').html())
{$jQuery.get(base_url+"/storm/add_storm.php",function(data)
{$jQuery('body').append("<div id='add_this_storm_form' style='display:none;'>"+data+"</div>");display_my_add_form();});}
else
{display_my_add_form();}}
function display_my_add_form(){$jQuery('#add_this_storm_form').dialog({title:$jQuery('#add_this_storm h2').html(),width:350,height:90,resizable:false,modal:true,buttons:{"Ajouter":function(){$jQuery("button").button("option","disabled",true);$jQuery('#add_this_storm form').submit();}}});$jQuery('#add_this_storm_form').width(350);$jQuery('#add_this_storm_form').height(90);}
function add_this_storm(form,base_url)
{document.location.href=form.action+permaname(form.storm.value)+'/'+encodeURI(form.storm.value)+'/';}
function display_new_suggestion(id,inhtml,elt){$jQuery('#'+id+' li input[name=suggestion]').each(function(index,element){var v=$jQuery(element).val();if(v==elt){$jQuery("#suggestions_"+v).text(inhtml);$jQuery("#suggestions_"+v).fadeIn('fast');$jQuery("#suggestions_"+v).css('font-size','0em');$jQuery("#suggestions_"+v).css('display','inline');$jQuery("#suggestions_"+v).animate({opacity:1,fontSize:"2.4em",},1500);$jQuery("#suggestions_"+v).fadeOut('slow');var totalText=$jQuery("#total_"+v).text();var totalInt=totalText.substring(1,totalText.length-1);var total=eval(totalInt+"+"+1);$jQuery("#total_"+v).text("("+total+")");return true;}});}
;if(!window.OPENLIKE){window.OPENLIKE={assetHost:'http://openlike.org',util:{update:function(){var obj=arguments[0],i=1,len=arguments.length,attr;for(;i<len;i++){for(attr in arguments[i]){obj[attr]=arguments[i][attr];}}
return obj;},escape:function(s){return((s==null)?'':s).toString().replace(/[<>"&\\]/g,function(s){switch(s){case'<':return'&lt;';case'>':return'&gt;';case'"':return'\"';case'&':return'&amp;';case'\\':return'\\\\';default:return s;}});},notundef:function(a,b){return typeof(a)=='undefined'?b:a;}}};}
if(!OPENLIKE.Widget){OPENLIKE.Widget=function(cfg){var defaults={s:['facebook','hunch','digg','reddit','stumbleupon'],url:window.location.href,title:document.title,header:'Like this:',css:'',category:''},i,len,wrapper,title,list,li,a,source,css;cfg=OPENLIKE.util.update(defaults,cfg);if(!OPENLIKE.Widget._initialized){OPENLIKE.Widget._initialized=true;if(cfg.css){css=document.createElement('LINK');css.rel='stylesheet';css.type='text/css';css.href=cfg.css;(document.getElementsByTagName('HEAD')[0]||document.body).appendChild(css);}}
var script=document.getElementsByTagName('SCRIPT');script=script[script.length-1];wrapper=document.createElement('DIV');wrapper.className='openlike';if(cfg.header){title=document.createElement('P');title.innerHTML=OPENLIKE.util.escape(cfg.header);wrapper.appendChild(title);}
list=document.createElement('UL');for(i=0,len=cfg.s.length;i<len;i++){if(source=OPENLIKE.Sources[cfg.s[i]]){source=OPENLIKE.prepSource(cfg.s[i],source);li=document.createElement('LI');if(source.html){a=source.html(cfg);}else{a=document.createElement('A');a.className=source.klass;a.href='#';a.innerHTML=OPENLIKE.util.escape(source.name);if(source.title)a.title=source.title;if(source.like)a.onclick=source.like(cfg);if(source.basicLink){a.href=source.basicLink(a,cfg);if(source.popup){a.onclick=function(url,target,attrs){return function(){window.open(url,target,attrs);return false;};}(a.href,source.popup.target,source.popup.attrs);}
a.target=source.target;}}
li.appendChild(a);list.appendChild(li);}}
wrapper.appendChild(list);script.parentNode.insertBefore(wrapper,script);wrapper=title=list=li=script=source=null;};OPENLIKE.prepSource=function(name,source){source=OPENLIKE.util.update({},source);source.name=name;source.target=OPENLIKE.util.notundef(source.target,'_blank');source.klass='openlike-'+OPENLIKE.util.escape(name);if(source.popup){if(typeof(source.popup)!='object')source.popup={};source.popup.target=OPENLIKE.util.notundef(source.popup.target,'_blank');source.popup.attrs=OPENLIKE.util.notundef(source.popup.attrs,'width=360,height=360');}
return source;};OPENLIKE.Sources={digg:{url:'http://digg.com/',basicLink:function(a,cfg){var url=encodeURIComponent(cfg.url),title=encodeURIComponent(cfg.title);return'http://digg.com/submit?phase=2&url='+url+'&title='+title;},title:'Digg'},facebook:{html:function(cfg){var elt=document.createElement('IFRAME'),width=220;elt.src='http://www.facebook.com/plugins/like.php?href='+encodeURIComponent(cfg.url)+'&amp;layout=button_count&amp;show_faces=false&amp;width='+width+'&amp;action=like&amp;colorscheme=light';OPENLIKE.util.update(elt,{scrolling:'no',frameBorder:'0',allowTransparency:'true'});OPENLIKE.util.update(elt.style,{border:'none',overflow:'hidden',width:width+'px',height:'80px',padding:'1px 0 0 0'});return elt;},url:'http://facebook.com',basicLink:function(a,cfg){var url=encodeURIComponent(cfg.url),title=encodeURIComponent(cfg.title);return'http://www.facebook.com/sharer.php?u='+url+'&t='+title;},title:'Facebook'},google:{url:'http://google.com',basicLink:function(a,cfg){var url=encodeURIComponent(cfg.url),msg=encodeURIComponent('I like this... '+cfg.title);return'http://www.google.com/buzz/post?message='+msg+'&url='+url;},title:'Google Buzz'},hunch:{url:'http://hunch.com',basicLink:function(a,cfg){var url=encodeURIComponent(cfg.url),title=encodeURIComponent(cfg.title),category=cfg.type?'&category='+encodeURIComponent(cfg.type):'';return'http://hunch.com/openlike/?url='+url+'&title='+title+category;},popup:{target:'_blank',attrs:'width=610,height=600'},title:'Hunch'},identica:{url:'http://identi.ca',basicLink:function(a,cfg){var msg=encodeURIComponent('I like this: '+cfg.url+' #publicstorm');return'http://identi.ca/index.php?action=newnotice&status_textarea='+msg;},title:'Identi.ca'},reddit:{url:'http://reddit.com/',basicLink:function(a,cfg){var url=encodeURIComponent(cfg.url),title=encodeURIComponent(cfg.title);return'http://www.reddit.com/submit?url='+url+'&title='+title;},title:'Reddit'},stumbleupon:{url:'http://www.stumbleupon.com/',basicLink:function(a,cfg){var url=encodeURIComponent(cfg.url);return'http://www.stumbleupon.com/submit?url='+url;},title:'StumbleUpon'},twitter:{url:'http://twitter.com',basicLink:function(a,cfg){var msg=encodeURIComponent('I like this: '+cfg.url+' #publicstorm');return'http://twitter.com/home?status='+msg;},title:'Twitter'}};}
;Meteor={callbacks:{process:function(){},reset:function(){},eof:function(){},statuschanged:function(){},changemode:function(){}},channelcount:0,channels:{},debugmode:false,frameref:null,host:null,hostid:null,maxpollfreq:60000,minpollfreq:2000,mode:"stream",pingtimeout:20000,pingtimer:null,pollfreq:3000,port:80,polltimeout:30000,recvtimes:[],status:0,updatepollfreqtimer:null,register:function(ifr){ifr.p=Meteor.process;ifr.r=Meteor.reset;ifr.eof=Meteor.eof;ifr.ch=Meteor.channelInfo;clearTimeout(Meteor.frameloadtimer);Meteor.setstatus(4);Meteor.log("Frame registered");},joinChannel:function(channelname,backtrack){if(typeof(Meteor.channels[channelname])!="undefined")throw"Cannot join channel "+channelname+": already subscribed";Meteor.channels[channelname]={backtrack:backtrack,lastmsgreceived:0};Meteor.log("Joined channel "+channelname);Meteor.channelcount++;if(Meteor.status!=0)Meteor.connect();},leaveChannel:function(channelname){if(typeof(Meteor.channels[channelname])=="undefined")throw"Cannot leave channel "+channelname+": not subscribed";delete Meteor.channels[channelname];Meteor.log("Left channel "+channelname);if(Meteor.status!=0)Meteor.connect();Meteor.channelcount--;},connect:function(){Meteor.log("Connecting");if(!Meteor.host)throw"Meteor host not specified";if(isNaN(Meteor.port))throw"Meteor port not specified";if(!Meteor.channelcount)throw"No channels specified";if(Meteor.status)Meteor.disconnect();Meteor.setstatus(1);var now=new Date();var t=now.getTime();if(!Meteor.hostid)Meteor.hostid=t+""+Math.floor(Math.random()*1000000)
document.domain=Meteor.extract_xss_domain(document.domain);if(Meteor.mode=="stream")Meteor.mode=Meteor.selectStreamTransport();Meteor.log("Selected "+Meteor.mode+" transport");if(Meteor.mode=="xhrinteractive"||Meteor.mode=="iframe"||Meteor.mode=="serversent"){if(Meteor.mode=="iframe"){Meteor.loadFrame(Meteor.getSubsUrl());}else{Meteor.loadFrame("http://"+Meteor.host+((Meteor.port==80)?"":":"+Meteor.port)+"/stream.html");}
clearTimeout(Meteor.pingtimer);Meteor.pingtimer=setTimeout(Meteor.pollmode,Meteor.pingtimeout);}else{Meteor.loadFrame("http://"+Meteor.host+((Meteor.port==80)?"":":"+Meteor.port)+"/poll.html");Meteor.recvtimes[0]=t;if(Meteor.updatepollfreqtimer)clearTimeout(Meteor.updatepollfreqtimer);if(Meteor.mode=='smartpoll')Meteor.updatepollfreqtimer=setInterval(Meteor.updatepollfreq,2500);if(Meteor.mode=='longpoll')Meteor.pollfreq=Meteor.minpollfreq;}
Meteor.lastrequest=t;},disconnect:function(){if(Meteor.status){clearTimeout(Meteor.pingtimer);clearTimeout(Meteor.updatepollfreqtimer);clearTimeout(Meteor.frameloadtimer);if(typeof CollectGarbage=='function')CollectGarbage();if(Meteor.status!=6)Meteor.setstatus(0);Meteor.log("Disconnected");}},selectStreamTransport:function(){try{var test=ActiveXObject;return"iframe";}catch(e){}
if((typeof window.addEventStream)=="function")return"iframe";return"xhrinteractive";},getSubsUrl:function(){var surl="http://"+Meteor.host+((Meteor.port==80)?"":":"+Meteor.port)+"/push/"+Meteor.hostid+"/"+Meteor.mode;for(var c in Meteor.channels){surl+="/"+c;if(Meteor.channels[c].lastmsgreceived>0){surl+=".r"+(Meteor.channels[c].lastmsgreceived+1);}else if(Meteor.channels[c].backtrack>0){surl+=".b"+Meteor.channels[c].backtrack;}else if(Meteor.channels[c].backtrack<0||isNaN(Meteor.channels[c].backtrack)){surl+=".h";}}
var now=new Date();surl+="?nc="+now.getTime();return surl;},loadFrame:function(url){try{if(!Meteor.frameref){var transferDoc=new ActiveXObject("htmlfile");Meteor.frameref=transferDoc;}
Meteor.frameref.open();Meteor.frameref.write("<html><script>");Meteor.frameref.write("document.domain=\""+(document.domain)+"\";");Meteor.frameref.write("</"+"script></html>");Meteor.frameref.parentWindow.Meteor=Meteor;Meteor.frameref.close();var ifrDiv=Meteor.frameref.createElement("div");Meteor.frameref.appendChild(ifrDiv);ifrDiv.innerHTML="<iframe src=\""+url+"\"></iframe>";}catch(e){if(!Meteor.frameref){var ifr=document.createElement("IFRAME");ifr.style.width="10px";ifr.style.height="10px";ifr.style.border="none";ifr.style.position="absolute";ifr.style.top="-10px";ifr.style.marginTop="-10px";ifr.style.zIndex="-20";ifr.Meteor=Meteor;document.body.appendChild(ifr);Meteor.frameref=ifr;}
Meteor.frameref.setAttribute("src",url);}
Meteor.log("Loading URL '"+url+"' into frame...");Meteor.frameloadtimer=setTimeout(Meteor.frameloadtimeout,5000);},pollmode:function(){Meteor.log("Ping timeout");Meteor.mode="smartpoll";clearTimeout(Meteor.pingtimer);Meteor.callbacks["changemode"]("poll");Meteor.lastpingtime=false;Meteor.connect();},process:function(id,channel,data){if(id==-1){Meteor.log("Ping");Meteor.ping();}else if(typeof(Meteor.channels[channel])!="undefined"){Meteor.log("Message "+id+" received on channel "+channel+" (last id on channel: "+Meteor.channels[channel].lastmsgreceived+")\n"+data);Meteor.callbacks["process"](data);Meteor.channels[channel].lastmsgreceived=id;if(Meteor.mode=="smartpoll"){var now=new Date();Meteor.recvtimes[Meteor.recvtimes.length]=now.getTime();while(Meteor.recvtimes.length>5)Meteor.recvtimes.shift();}}
Meteor.setstatus(5);},ping:function(){if(Meteor.pingtimer){clearTimeout(Meteor.pingtimer);Meteor.pingtimer=setTimeout(Meteor.pollmode,Meteor.pingtimeout);var now=new Date();Meteor.lastpingtime=now.getTime();}
Meteor.setstatus(5);},reset:function(){if(Meteor.status!=6){Meteor.log("Stream reset");Meteor.ping();Meteor.callbacks["reset"]();var now=new Date();var t=now.getTime();var x=Meteor.pollfreq-(t-Meteor.lastrequest);if(x<10)x=10;setTimeout(Meteor.connect,x);}},eof:function(){Meteor.log("Received end of stream, will not reconnect");Meteor.callbacks["eof"]();Meteor.setstatus(6);Meteor.disconnect();},channelInfo:function(channel,id){Meteor.channels[channel].lastmsgreceived=id;Meteor.log("Received channel info for channel "+channel+": resume from "+id);},updatepollfreq:function(){var now=new Date();var t=now.getTime();var avg=0;for(var i=1;i<Meteor.recvtimes.length;i++){avg+=(Meteor.recvtimes[i]-Meteor.recvtimes[i-1]);}
avg+=(t-Meteor.recvtimes[Meteor.recvtimes.length-1]);avg/=Meteor.recvtimes.length;var target=avg/2;if(target<Meteor.pollfreq&&Meteor.pollfreq>Meteor.minpollfreq)Meteor.pollfreq=Math.ceil(Meteor.pollfreq*0.9);if(target>Meteor.pollfreq&&Meteor.pollfreq<Meteor.maxpollfreq)Meteor.pollfreq=Math.floor(Meteor.pollfreq*1.05);},registerEventCallback:function(evt,funcRef){Function.prototype.andThen=function(g){var f=this;var a=Meteor.arguments
return function(args){f(a);g(args);}};if(typeof Meteor.callbacks[evt]=="function"){Meteor.callbacks[evt]=(Meteor.callbacks[evt]).andThen(funcRef);}else{Meteor.callbacks[evt]=funcRef;}},frameloadtimeout:function(){Meteor.log("Frame load timeout");if(Meteor.frameloadtimer)clearTimeout(Meteor.frameloadtimer);Meteor.setstatus(3);Meteor.pollmode();},extract_xss_domain:function(old_domain){if(old_domain.match(/^(\d{1,3}\.){3}\d{1,3}$/))return old_domain;domain_pieces=old_domain.split('.');return domain_pieces.slice(-2,domain_pieces.length).join(".");},setstatus:function(newstatus){if(Meteor.status!=newstatus){Meteor.status=newstatus;Meteor.callbacks["statuschanged"](newstatus);}},log:function(logstr){if(Meteor.debugmode){if(window.console){window.console.log(logstr);}else if(document.getElementById("meteorlogoutput")){document.getElementById("meteorlogoutput").innerHTML+=logstr+"<br/>";}}}}
var oldonunload=window.onunload;if(typeof window.onunload!='function'){window.onunload=Meteor.disconnect;}else{window.onunload=function(){if(oldonunload)oldonunload();Meteor.disconnect();}}
function loadMeteor()
{Meteor.hostid=alea(15);Meteor.host="meteor.internetcollaboratif.info";Meteor.registerEventCallback("process",processing);Meteor.registerEventCallback("statuschanged",statusHasChanged);var channel=getChannelName();if(channel)
{Meteor.joinChannel(channel,0);Meteor.mode='xhrinteractive';Meteor.connect();getSubscribers();}
else
{}}
function getChannelName()
{if($jQuery('#storm_permaname').length!=0)
{return permaname($jQuery('#storm_permaname').val().toLowerCase());}
else
{return false;}}
function processing(data){eval("var data = "+data+";");if(data.call=="newSuggestion")
{if(data.user==" "){data.user="Anonyme";}
var storm_id=$jQuery("#storm_id").val();display_new_suggestion('storm_'+storm_id,'+1',permaname(data.suggestion));}}
function sendCmd(cmd)
{$jQuery.post('meteor.php',{command:cmd,channel:getChannelName()});}
function getSubscribers()
{$jQuery.post(BASE_URL+'/meteor/meteor.php',{command:"getSubscribers",channel:getChannelName()},function(data){setSubscribers(data);},"json");}
function setSubscribers(data)
{$jQuery("#countSubscribers").html(data['nombre']);}
var status=0;function meteorStartStop()
{if(document.status>0)
{Meteor.disconnect();$jQuery('#meteorStatusPause a').html('Start');}
else
{Meteor.connect();$jQuery('#meteorStatusPause a').html('Stop');}}
function statusHasChanged(status)
{var msg="";document.status=status;switch(status)
{case 0:msg="Meteor : Uninitialised";break;case 1:msg="Meteor : Loading stream";break;case 2:msg="Meteor : Loading controller frame";break;case 3:msg="Meteor : Controller frame timeout, retrying";break;case 4:msg="Meteor : Controller frame loaded and ready";break;case 5:msg="Meteor : Receiving data";break;case 6:msg="Meteor : End of stream, will not reconnect";break;}
$jQuery('#meteorStatus').html("");var e='<span class="status status_'+status+'" title="'+msg+' '+status+'">&nbsp;</span>';$jQuery('#meteorStatus').append(e);}
(function($){$jQuery.fn.dump=function(){return $jQuery.dump(this);}
$jQuery.dump=function(object){var recursion=function(obj,level){if(!level)level=0;var dump='',p='';for(i=0;i<level;i++)p+="\t";t=type(obj);switch(t){case"string":return'"'+obj+'"';break;case"number":return obj.toString();break;case"boolean":return obj?'true':'false';case"date":return"Date: "+obj.toLocaleString();case"array":dump+='Array ( \n';$jQuery.each(obj,function(k,v){dump+=p+'\t'+k+' => '+recursion(v,level+1)+'\n';});dump+=p+')';break;case"object":dump+='Object { \n';$jQuery.each(obj,function(k,v){dump+=p+'\t'+k+': '+recursion(v,level+1)+'\n';});dump+=p+'}';break;case"jquery":dump+='jQuery Object { \n';$jQuery.each(obj,function(k,v){dump+=p+'\t'+k+' = '+recursion(v,level+1)+'\n';});dump+=p+'}';break;case"regexp":return"RegExp: "+obj.toString();case"error":return obj.toString();case"document":case"domelement":dump+='DOMElement [ \n'
+p+'\tnodeName: '+obj.nodeName+'\n'
+p+'\tnodeValue: '+obj.nodeValue+'\n'
+p+'\tinnerHTML: [ \n';$jQuery.each(obj.childNodes,function(k,v){if(k<1)var r=0;if(type(v)=="string"){if(v.textContent.match(/[^\s]/)){dump+=p+'\t\t'+(k-(r||0))+' = String: '+trim(v.textContent)+'\n';}else{r--;}}else{dump+=p+'\t\t'+(k-(r||0))+' = '+recursion(v,level+2)+'\n';}});dump+=p+'\t]\n'
+p+']';break;case"function":var match=obj.toString().match(/^(.*)\(([^\)]*)\)/im);match[1]=trim(match[1].replace(new RegExp("[\\s]+","g")," "));match[2]=trim(match[2].replace(new RegExp("[\\s]+","g")," "));return match[1]+"("+match[2]+")";case"window":default:dump+='N/A: '+t;break;}
return dump;}
var type=function(obj){var type=typeof(obj);if(type!="object"){return type;}
switch(obj){case null:return'null';case window:return'window';case document:return'document';case window.event:return'event';default:break;}
if(obj.jquery){return'jquery';}
switch(obj.constructor){case Array:return'array';case Boolean:return'boolean';case Date:return'date';case Object:return'object';case RegExp:return'regexp';case ReferenceError:case Error:return'error';case null:default:break;}
switch(obj.nodeType){case 1:return'domelement';case 3:return'string';case null:default:break;}
return'Unknown';}
return recursion(object);}
function trim(str){return ltrim(rtrim(str));}
function ltrim(str){return str.replace(new RegExp("^[\\s]+","g"),"");}
function rtrim(str){return str.replace(new RegExp("[\\s]+$","g"),"");}})(jQuery);
;$jQuery(document).ready(function(){$jQuery("a span.sendToAFriend").parent().click(function(){window.open($jQuery(this).attr("href"),'sendToAFriend','width=500,height=500');return false;});});function openSendToAFriend(activeTab){$jQuery("#accordion").accordion({collapsible:false,fillSpace:true,autoHeight:false,active:activeTab});}
function populateFriends(json){var liste="";for(i=0;i<json.contacts.count;i++){var email=json.contacts.contact[i].fields[0].value;var givenName="";var familyName="";if(json.contacts.contact[i].fields[2]){givenName=json.contacts.contact[i].fields[2].value.givenName;}
if(json.contacts.contact[i].fields[2]){familyName=json.contacts.contact[i].fields[2].value.familyName;}
liste+='<li><input type="checkbox" name="friends[]" value="'+email+'" id="friend'+i+'" /><label for="friend'+i+'">'+givenName+' '+familyName+' ('+email+')</label></li>\n';}
$jQuery("#friends").html("");$jQuery("#friends").append(liste);}
