function showtitle(what,i) {
$('#ctut').html('<img src="http://www.tayo.fr/images/icone/ajax-loader.gif"/><br>Chargement...<br/>');
dingdong("listarrach.php","indextshow=" + i);	
}
function sharefacebook() {
	//document.getElementById('facebooklien').href=document.getElementById('facebooklien').title;
	
		$('#twitterlien').click(function() {

										 
	window.open('https://twitter.com/tayofr','sharer','scrollbars=1,width=630,height=700');

										 });
	$('#facebooklien').click(function() {
									 	u=location.href;

			t=document.title;
window.open('http://www.facebook.com/sharer.php?u='+encodeURIComponent(u)+'&t='+encodeURIComponent(t),'sharer','toolbar=0,status=0,width=626,height=436');


return false;
});						 
									 
									 }

if ( (navigator.userAgent.match(/iPad/i)) || (navigator.userAgent.match(/iPod/i) ) || (navigator.userAgent.match(/iphone/i) )) { 
navigateurtablette=true;
}
function getScrollPosition()
{
	return Array((document.documentElement && document.documentElement.scrollLeft) || window.pageXOffset || self.pageXOffset || document.body.scrollLeft,(document.documentElement && document.documentElement.scrollTop) || window.pageYOffset || self.pageYOffset || document.body.scrollTop);
}
function avatarcommentselect(id) {
if (id > 0 ) { 
document.getElementById('avatarcomment').innerHTML="<img style='float:none;cursor:auto;' src='images/avatar/" + id+".jpg'/>"; 
document.getElementById('avatarcommentid').value=id; 


}
}
$(document).ready(function() {  
		var pubafter = document.getElementById("pubchargeapres");
				document.getElementById("pioubhaut").appendChild(pubafter);
				if (document.getElementById("menupublicite")) {
var pubafter = document.getElementById("pubchageapresmiddle");
				document.getElementById("menupublicite").appendChild(pubafter);
				new(zimg);
				}
				   
						   
$('#prisecontact').click(function() {
$('#basdepage').append('<iframe id="contactiframe" src="/contact.php" style="width:800px; height:600px; display:none;"></iframe>');
$('#contactiframe').fadeIn(2000);
return false;
});
$('#forummsg').focus(function() {
if ($(this).val() =='Votre commentaire forum') { $(this).val(''); }
								   });
$('#pseudopaslog').keyup(function() {
$('#previewpseudo').text( $('#pseudopaslog').val()) ;
});				   
  $('#forummsg').keyup(function() {
$('#previewtextfofo').html( $('#forummsg').val().replace('\n','<br/>')) ;
});
$('.imgshadowdlzzzzz').click(function() {
g = getScrollPosition() ;								
$('body').append("<div onclick='$(this).fadeOut(1000)' id='hidealldiv' style='width:100%;height:100%;min-height:2000px;min-width:2000px;position:absolute;display:none;filter : alpha(opacity=70);opacity:0.7;background:black;top:"+g[1]+"px;left:"+g[0]+"px;'><div style='opacity:1; margin-left:auto;margin-right:auto;z-index:1;vertical-align: middle;'><img src='"+$(this).attr('rel')+"'/></div></div>");
$('#hidealldiv').fadeIn(1000);
});

						   

sharefacebook();						 
if (document.getElementById('avatarlienchoisir')){
	
	$('#avatarlienchoisir').click(function() {
dingdong('aajax.php','loadavatar=y');

										   });
}
new zeslideshow('#newsslide');
new pretareduire('.titreboite');
}); 
var pretareduire = function(id) {
	var self = this;
			this.div = $(id);

$(id).find("img").each(function() {
$(this).attr('title',"Cliquer ici pour réduire");	
simple_tooltip($(this),"tooltip",'bis');

	$(this).click(function() {

$(this).closest('div').fadeOut(500);
$(this).closest('.boite').fadeOut(500);

});
});
}

				 var zeslideshow = function(id) {
	 
	
		 var self=this;
		  self.dimentotal = null ;
		 self.largeurdiv = $(id).width() ;
		this.div = $(id);
		
		 $(id).find('li').each(function(){
		 $(this).hover(function() {

$(this).find('span').stop(true,true).animate({ 
top:parseInt($(this).find('span').css('top')) -30,
height:parseInt($(this).find('span').css('height')) +30
},500);

$(this).find('em').stop(true, true).fadeIn(500);
		 },function() {
		  		$(this).find('em').stop(true, true).fadeOut(500);
		
		$(this).find('span').stop(true,true).animate({ 
top:parseInt($(this).find('span').css('top')) +30,
height:parseInt($(this).find('span').css('height')) -30
},500);
									
		 });
		 });

		this.dimentotal = -80 ;
		 this.deplacementde =parseInt(this.div.find('li').height()) + parseInt(this.div.find('li').css('margin-bottom')) + parseInt(this.div.find('li').css('margin-top'));

		this.div.find('li').each(function() {
			self.dimentotal+=$(this).height();
self.dimentotal+=parseInt($(this).css('margin-top'));
self.dimentotal+=parseInt($(this).css('margin-bottom'));
		 
	 });
  
 var zeslideauto = function(id) {
 if (window.zevisu) { setTimeout(zeslideauto,3000);
return ;
 }

 if(!self.deplacementgg) { self.deplacementgg = 0 ; }
if (self.dimentotal <  self.deplacementgg  ) {  self.div.animate({top:'0px'},200); self.deplacementgg = 0 ; }

 self.deplacementgg = self.deplacementgg+ self.deplacementde ;
 self.div.animate({top:-self.deplacementgg +'px'},2000); 
setTimeout(zeslideauto,5000);

 }
 var zeslidemouse = function(id) {
 
 
 }
setTimeout(zeslideauto,3000);
this.div.mouseover(function(self) { zevisu = true ;});
this.div.mouseout(function(self) { zevisu = null; });

}

function simple_tooltip(target_items, name,bis){

 $(target_items).each(function(i){
if (bis) { i ='g'+i; }

$("body").append("<div class='"+name+"' id='"+name+i+"'><p>"+$(this).attr('title')+"</p></div>");
		var my_tooltip = $("#"+name+i);
		
		$(this).removeAttr("title").attr('alt','').mouseover(function(){

				my_tooltip.css({opacity:0.8, display:"none"}).fadeIn(400);
		}).mousemove(function(kmouse){
				my_tooltip.css({left:kmouse.pageX+15, top:kmouse.pageY+15});
		}).mouseout(function(){
				my_tooltip.fadeOut(400);				  
		});
	});
}

	function dingdong(page,data,c1,c2) {

   var xhr_object = null;
	
   if(window.XMLHttpRequest) // Firefox
      xhr_object = new XMLHttpRequest();
   else if(window.ActiveXObject) // Internet Explorer
      xhr_object = new ActiveXObject("Microsoft.XMLHTTP");
   else { // XMLHttpRequest non support par le navigateur
      alert("Votre navigateur ne supporte pas les objets XMLHTTPRequest...");
      return xhr_object; 

   }
 xhr_object.open("POST", page, true);
	
   xhr_object.onreadystatechange = function() {
      if(xhr_object.readyState == 4)
         eval(xhr_object.responseText);
   }

   xhr_object.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
   xhr_object.send(data);

}
	
	
$(document).ready(function(){
	 simple_tooltip(".tooltipjs","tooltip");
});

function avatarcommentselect(id) {
if (id > 0 ) { 
document.getElementById('avatarcomment').innerHTML="<img style='float:none;cursor:auto;' src='images/avatar/" + id+".jpg'/>"; 
document.getElementById('avatarcommentid').value=id; 


}
}
function envoyermessageforum(where) {
				 var i = document.getElementById('actuelsid').value ;
var forumisedit = document.getElementById('forumisedit').value ;
var datab = document.getElementById("forummsg").value ;

	var foruminfo = document.getElementById('foruminfo').value ;

			if (document.getElementById('pseudopaslog')) {
				var pseudopaslog = document.getElementById('pseudopaslog').value ;
				if (!pseudopaslog) { alert('Veuillez indiquer votre pseudo / nom ') ; return false; }
				var imageid = document.getElementById('imageid').value ;
				var imgcode = document.getElementById('imgcode').value ;
				var avatarcommentid = document.getElementById('avatarcommentid').value ;

		
			  var data = 'avatarcommentid=' + avatarcommentid + "&imageid=" + imageid + "&imgcode=" + imgcode + "&pseudopaslog="+pseudopaslog+"&foruminfo="+ foruminfo + "&forummsg="+datab; 	
			}
			else {
  var data = "forumuser="+i+"&foruminfo="+ foruminfo + "&forummsg="+datab; 
			}
			
 if (forumisedit > 0) { var data = "forumisedit="+forumisedit+"&forumuser="+i+"&foruminfo="+ foruminfo + "&forummsg="+datab ;}
if (where=='forum') { var pg = '/help.php' ; data =  "&ajax=oui&reply=oui&" + data; 



}
else { var pg = '/listarrach.php' ; }
 dingdong( pg,data);

  

}
function hidemenu2(i)
	{
    	if(document.getElementById(i).style.visibility == 'hidden') {
        	document.getElementById(i).style.visibility = 'visible';
			
					document.getElementById(i).style.height = '';
					}
	else {
	
	document.getElementById(i).style.visibility = 'hidden';
	document.getElementById(i).style.height = '4px';
	}
	
    	}
		function connectme(i,t) {
var imgl = "<br/><br/><img hspace='4' src='/images/icone/ajax-loader.gif' />" ;
lo =  document.getElementById('login').value ;
pa =  document.getElementById('pass').value;
if (lo.length > 2 && pa.length >2 ) {  }
else { alert("Veuillez indiquer vos identifiants de connection. Si vous n'en avez pas, inscrivez vous ! ;)"); return false;  }
document.getElementById('laa1').style.display="none";
document.getElementById('laa0').innerHTML = "Envoie de vos identifiants.." + imgl;
dingdong('/listarrach.php','logajax=' +document.getElementById('login').value + '&passajax=' +document.getElementById('pass').value);
}
function voteferme(x) {
	
	document.getElementById('writemessagehere').innerHTML ='';
	document.getElementById('tablemessage').style.visibility ='hidden';
	document.getElementById('tablemessageb').style.visibility ='hidden';
		document.getElementById('tablemessageb').style.position ='absolute';
document.getElementById('tablemessageb').style.top ='110%';
}
function vote(quoi,note) {

	  var data = "voteaction=add&reference="+quoi+"&note="+note;
 dingdong('/vote.php',data);
	
}
function connectme(i,t) {
var imgl = "<br/><br/><img src='/images/icone/ajax-loader.gif' />" ;
lo =  document.getElementById('login').value ;
pa =  document.getElementById('pass').value;
if (lo.length > 2 && pa.length >2 ) {  }
else { alert("Veuillez indiquer vos identifiants de connection. Si vous n'en avez pas, inscrivez vous ! ;)"); return false;  }
if (!$('#laa1').length) { $('#fi9').append('<div id="laa1"></div><div id="laa0"></div>');  }
	  
	 
document.getElementById('laa1').style.display="none";
document.getElementById('laa0').innerHTML = "Envoie de vos identifiants.." + imgl;
dingdong('/listarrach.php','logajax=' +document.getElementById('login').value + '&passajax=' +document.getElementById('pass').value);
}

function zimg() {
$('img').each(function() {
		if (!$(this).attr('rel')) { return;	}	
		$(this).css({'cursor':'pointer'});
		$(this).click(function () { 
$('body').append("<div id='znope1' style='width:100%;height:3000px; background:#333; opacity:0.7; position:fixed;z-index:1;top:0;left:0'></div><div id='znope2' style='position:fixed;left:50%;top:50%;z-index:2; float:left;  '><img id='znope3' style='display:none' onload='zcentreimg(this)' src='"+$(this).attr('rel') +"'/></div>").fadeIn(500);
new zimgferme();
} ); 
											 });	
					   
	 
}
function zimgferme() {
$('#znope1,#znope2,#znope3').click(function() { $('#znope1,#znope2,#znope3').fadeOut(500,function() { $('this').remove() ;});} );	
	
}

function zcentreimg(t) {
	
var w = $(t).width() ;
var h = $(t).height() ;
$(t).parent().css({'margin-left':-w / 2,"margin-top": -h / 2,"width":w,"height":h,"overflow":'hidden'});
$(t).attr('width',w*2) ;
$(t).attr('height',h*2) ;
$(t).css({'margin-left':-w /2,'margin-top':-h /2});

$(t).fadeIn(1000);
$(t).animate({'width':w,'height':h,'margin-left':0,'margin-top':0 },1500);
}
function gosqlcherche() {

var l1    = document.appercu.categorie ;
	var l2    = document.appercu.souscategorie; 

var index = l1.selectedIndex;
if(index < 1)

   l2.options.length = 0;
else {
  var data = "categorie="+l1.options[index].text+"&form=appercu&select=souscategorie";
 dingdong('/listarrach.php',data);
}


}
		
				function envoyermessageforum(where) {
					
				 var i = document.getElementById('actuelsid').value ;
var forumisedit = document.getElementById('forumisedit').value ;
var datab = document.getElementById("forummsg").value ;

	var foruminfo = document.getElementById('foruminfo').value ;

			if (document.getElementById('pseudopaslog')) {
				var pseudopaslog = document.getElementById('pseudopaslog').value ;
				if (!pseudopaslog) { alert('Veuillez indiquer votre pseudo / nom ') ; return false; }
				var imageid = document.getElementById('imageid').value ;
				var imgcode = document.getElementById('imgcode').value ;
			if (	document.getElementById('avatarcommentid')  )
			{ var avatarcommentid = document.getElementById('avatarcommentid').value ; }
			else { var avatarcommentid = 0 ; }

		
			  var data = 'avatarcommentid=' + avatarcommentid + "&imageid=" + imageid + "&imgcode=" + imgcode + "&pseudopaslog="+pseudopaslog+"&foruminfo="+ foruminfo + "&forummsg="+datab; 	
			}
			else {
  var data = "forumuser="+i+"&foruminfo="+ foruminfo + "&forummsg="+datab; 
			}
			
 if (forumisedit > 0) { var data = "forumisedit="+forumisedit+"&forumuser="+i+"&foruminfo="+ foruminfo + "&forummsg="+datab ;}
if (where=='forum') { var pg = '/help.php' ; data =  "&ajax=oui&reply=oui&" + data; 

document.getElementById('foload').innerHTML = "Traitement de votre message. Veuillez patienter.. <br/><br/><img src='/images/icone/loader.gif' alt='Chargement...' />" ;
document.getElementById('preply').style.display = "none" ;

}
else { var pg = '/listarrach.php' ; }
 dingdong( pg,data);

  

}

