;(function(d){var k=d.scrollTo=function(a,i,e){d(window).scrollTo(a,i,e)};k.defaults={axis:'xy',duration:parseFloat(d.fn.jquery)>=1.3?0:1};k.window=function(a){return d(window)._scrollable()};d.fn._scrollable=function(){return this.map(function(){var a=this,i=!a.nodeName||d.inArray(a.nodeName.toLowerCase(),['iframe','#document','html','body'])!=-1;if(!i)return a;var e=(a.contentWindow||a).document||a.ownerDocument||a;return d.browser.safari||e.compatMode=='BackCompat'?e.body:e.documentElement})};d.fn.scrollTo=function(n,j,b){if(typeof j=='object'){b=j;j=0}if(typeof b=='function')b={onAfter:b};if(n=='max')n=9e9;b=d.extend({},k.defaults,b);j=j||b.speed||b.duration;b.queue=b.queue&&b.axis.length>1;if(b.queue)j/=2;b.offset=p(b.offset);b.over=p(b.over);return this._scrollable().each(function(){var q=this,r=d(q),f=n,s,g={},u=r.is('html,body');switch(typeof f){case'number':case'string':if(/^([+-]=)?\d+(\.\d+)?(px|%)?$/.test(f)){f=p(f);break}f=d(f,this);case'object':if(f.is||f.style)s=(f=d(f)).offset()}d.each(b.axis.split(''),function(a,i){var e=i=='x'?'Left':'Top',h=e.toLowerCase(),c='scroll'+e,l=q[c],m=k.max(q,i);if(s){g[c]=s[h]+(u?0:l-r.offset()[h]);if(b.margin){g[c]-=parseInt(f.css('margin'+e))||0;g[c]-=parseInt(f.css('border'+e+'Width'))||0}g[c]+=b.offset[h]||0;if(b.over[h])g[c]+=f[i=='x'?'width':'height']()*b.over[h]}else{var o=f[h];g[c]=o.slice&&o.slice(-1)=='%'?parseFloat(o)/100*m:o}if(/^\d+$/.test(g[c]))g[c]=g[c]<=0?0:Math.min(g[c],m);if(!a&&b.queue){if(l!=g[c])t(b.onAfterFirst);delete g[c]}});t(b.onAfter);function t(a){r.animate(g,j,b.easing,a&&function(){a.call(this,n,b)})}}).end()};k.max=function(a,i){var e=i=='x'?'Width':'Height',h='scroll'+e;if(!d(a).is('html,body'))return a[h]-d(a)[e.toLowerCase()]();var c='client'+e,l=a.ownerDocument.documentElement,m=a.ownerDocument.body;return Math.max(l[h],m[h])-Math.min(l[c],m[c])};function p(a){return typeof a=='object'?a:{top:a,left:a}}})(jQuery);jQuery(document).ready(function(){$("#hidePanel").click(function(){$("#panel").animate({marginLeft:"-175px"},500);$("#colleft").animate({width:"0px",opacity:0},400);$("#showPanel").show("normal").animate({width:"28px",opacity:1},200);$("#colright").animate({marginLeft:"50px"},500);});$("#showPanel").click(function(){$("#colright").animate({marginLeft:"200px"},200);$("#panel").animate({marginLeft:"0px"},400);$("#colleft").animate({width:"175px",opacity:1},400);$("#showPanel").animate({width:"0px",opacity:0},600).hide("slow");});});function WaitingEffect(){}
function afficheNotification(msg){$.gritter.add({title:'Alerte | Conseils-Avocats.com',text:msg});}
function closeEffect(){$("#mask").fadeOut();$(".window").fadeOut();$("#dialog2").fadeOut();$("#dialog3").fadeOut();$("#dialog2").html("");$("#waiting").fadeOut()}
function getLogged(){$("html, body").animate({scrollTop:0},"slow");Waiting();$.get("/users/getlogged",{noLayout:true},function(a){rPosition("#dialog3",425,187);$("#dialog3").html(a)})}
function Waiting(){$("#dialog3").html("");var id="#dialog3";var maskHeight=$(document).height();var maskWidth=$(window).width();$('#mask').css({'width':maskWidth,'height':maskHeight});$('#mask').fadeIn(0);$('#mask').fadeTo("fast",0.4);var winH=$(window).height();var winW=$(window).width();$(id).css('top',winH/2-$(id).height()/2);$(id).css('left',winW/2-$(id).width()/2);$(id).fadeIn(2000);document.onkeydown=function(e){if(e==null){keycode=event.keyCode;}else{keycode=e.which;}
if(keycode==27){closeEffect();}}}
function closeAdvanced(){closeAdvancedOut();}
function rechercheav(){
	$("html, body").animate({scrollTop:0},"slow");
	Waiting();
	$.get("/articles/rechercheav",{noLayout:true},function(a){
		rPosition("#dialog3",425,187);
		$("#dialog3").html(a)
	})
}
function addFriend(id) {
	$.post('/conseilschat/addfriend', {friend:id}, function(data) {
		if(data == "ok") {
			afficheNotification("Le membre e été ajouté avec succès à votre liste d'amis");
		} else if(data == "no") {
			afficheNotification('Ce membre n\'existe pas');
		} else if(data == "already") {
			afficheNotification("Ce membre appartient déjâ à votre liste d'amis !!");
		} else if(data == "me") {
			afficheNotification("Ajout impossible, <br /> Code d'erreur : #001 !!");
		}
	});
}

function closeAdvancedOut(){$('#mask').fadeOut();$('.window').fadeOut();$('#dialog3').html('');}
function votecomment(a){$.get("/articles/votecomment",{id:a},function(b){if(b!="false")
if(b=="already")
afficheNotification("Vous avez d\u00e9ja vot\u00e9");else if(b=="yours")
afficheNotification("Vous ne pouvez pas voter sur l'un de vos commentaires");else{$(".buzz_result1-"+a).html(parseInt($(".buzz_result1-"+a).html())+1);$("#buttonup1-"+a).html('<img border="0" src="/images/voteupdesactive.png"/>')}else
getLogged()})}
function editComment(id){$.post('/comments/edit/'+id,null,function(data){if(data!=''){$("#content-comment"+id).html(data);}
closeAjax();});}
function rPosition(a,b,c){var d=$(document).height();d=$(window).width();d=$(window).height();var e=$(window).width();$(a).css("top",d/2-c/2);$(a).css("left",e/2-b/2)}
function WaitingAjax(){$("#dialog2").html("");var a=$(document).height(),b=$(window).width();$("#mask").css({width:b,height:a}).fadeIn(0).fadeTo("fast",0.4);a=$(window).height();b=$(window).width();$("#dialog2").css("top",a/2-$("#dialog2").height()/2).css("left",b/2-$("#dialog2").width()/2).fadeIn(2E3);}
function signalercomment(id){$.post('/comments/signaler',{id:id},function(data){if(data=="ok"){afficheNotification('Message envoyé au webmaster !!');}});return false;}
function afficherReponse(a,b,c){if(this.i==1){$("#com-rep-"+c).html('<div style="text-align:center"><img src="/images/spinner.gif"/></div>');$.post("/comments/showreponse",{id:a},function(d){$("#com-rep-"+c).html(d).slideDown("slow").fadeIn("slow");});this.i=0}else{this.i=1;$("#com-rep-"+c).slideUp("slow").fadeOut("slow");}}
function repondre(a,b,c){if(b==0)
this.j=1;if(this.j==1||this.idd!=a){$("#reponse-comm-"+a).fadeIn("slow");$("#reponse-comm-"+a).html('<div style="text-align:center"><img src="/images/spinner.gif"/></div>');if(c!=undefined){type="sondage";}else{type="article";}
if($("#typecomment").val()!=""&&$("#typecomment").val()!=undefined)
type=$("#typecomment").val();$.get("/comments/addreponse",{id:a,type:type},function(c){$(".comment-repondre").html("");$("#reponse-comm-"+a).html(c);$("#reponse-comm-"+a).slideDown("slow")});this.j=1;this.idd=a;}else{this.j=0;$("#reponse-comm-"+a).slideUp("slow");$("#reponse-comm-"+a).fadeOut("slow");this.idd=0;}}

