
		
		
			function vote(id, note, noteid)
			{	
					$(document).ready(function () { 		
        			$.post("vote.php",{postid: id, notevalue: note, idnote: noteid},
        			
        			function success(data){      
								$("#"+data.noteid).fadeOut("fast",function(){
											var lienote = "<span class='infovote'>"+data.message+"</span>";   										
   										document.getElementById(data.noteid).innerHTML = lienote + "&nbsp;&nbsp;<a href='javascript:void(0)' title='Voter pour ce Clash' onclick=\"vote('+data.id+', '+ data.note+', '+data.noteid+');\" >"+data.note+"</a>"  ;
   								
   										$("#"+data.noteid).fadeIn("fast");
   										
   							
   										
   										
 								});   						
					}, "json");
				});

			}
			
			

			
			
			
$(document).ready(function() {
	
	$('#reporter').click(function () {		
			document.getElementById('captcha').value = "xpdfrlk34J";
		
		
		//var typeTexte1 = $('input[name=type1]');
		///var typeTexte2 = $('input[name=type2]');
		
		
		
		
		if(document.formreporter.type1[0].checked) {
			var contenu1 = $('textarea[name=contenu1_texte]');
			var typeContenu1 = "texte";
		}
		
		if(document.formreporter.type1[1].checked) {
				var contenu1 = $('input[name=contenu1_video]');
				var typeContenu1 = "video";
		}
		
	
		if(document.formreporter.type2[0].checked) 	{
			var contenu2 = $('textarea[name=contenu2_texte]');
			var typeContenu2 = "texte";
		}
		
		if(document.formreporter.type2[1].checked) 	{
			var contenu2 = $('input[name=contenu2_video]');
			var typeContenu2 = "video";
		}
			
	
		var captcha = $('input[name=captcha]');
		
		
		var pseudo = $('input[name=pseudo]');
		var choixcat = $('select[name=choixcat]');
		var auteur1 = $('input[name=auteur1]');
		var auteur2 = $('input[name=auteur2]');
		
		
		

		
		var source1 = $('input[name=source1]');
		var source2 = $('input[name=source2]');
		var titre = $('input[name=titre]');
		

		//Simple validation to make sure user entered something
		//If error found, add hightlight class to the text field
		if (pseudo.val()=='' || pseudo.val() == 'Votre Pseudo') {
			pseudo.addClass('hightlight');
			return false;
		} else pseudo.removeClass('hightlight');
		
		
		if (titre.val()==''  || titre.val() == 'Titre du Clash') {
			titre.addClass('hightlight');
			return false;
		} else titre.removeClass('hightlight');
		
		if (choixcat.val()=='') {
			choixcat.addClass('hightlight');
			return false;
		} else choixcat.removeClass('hightlight');
		
		if (auteur1.val()=='' || auteur1.val()=='Nom de l\'Auteur 1') {
			auteur1.addClass('hightlight');
			return false;
		} else auteur1.removeClass('hightlight');
		
		if (auteur2.val()=='' || auteur2.val()=='Nom de l\'Auteur 2') {
			auteur2.addClass('hightlight');
			return false;
		} else auteur2.removeClass('hightlight');
		
		if ( (typeContenu1 == "video" && contenu1.val()=='Collez ici le code du lecteur exportable') || (typeContenu1 == "texte" && contenu1.val() == 'Citation (max. 255 caracteres)' )) {
			contenu1.addClass('hightlight');
			return false;
		} else contenu1.removeClass('hightlight');
		
		if ( (typeContenu2 == "video" && contenu2.val()=='Collez ici le code du lecteur exportable') || (typeContenu2 == "texte" && contenu2.val() == 'Citation (max. 255 caracteres)' )) {
			contenu2.addClass('hightlight');
			return false;
		} else contenu2.removeClass('hightlight');
		
		if (typeContenu1 == "texte" && (source1.val() == 'Adresse Internet de la Source 1' || source1.val() == '')) {
			source1.addClass('hightlight');
			return false;
		} else source1.removeClass('hightlight');
		
		if (typeContenu2 == "texte" && (source2.val() == 'Adresse Internet de la Source 2' || source2.val() == '')) {
			source2.addClass('hightlight');
			return false;
		} else source2.removeClass('hightlight');
		
				
		
		
		var data = 'captcha=' + captcha.val() + '&pseudo=' + pseudo.val() + '&choixcat='  + choixcat.val() + '&auteur1='  + auteur1.val() + '&auteur2='  + auteur2.val() + '&contenu1='  + encodeURIComponent(contenu1.val()) + '&contenu2='  + encodeURIComponent(contenu2.val()) + '&source1='  + source1.val() + '&source2='  + source2.val()  + '&titre=' + titre.val();
		
		//disabled all the text fields
		//$('.required').attr('disabled','true');
		
		//show the loading sign
		$('.loading').show();
		
		//start the ajax
		$.ajax({
			//this is the php file that processes the data and send mail
			url: "submit.php",	
			
			//GET method is used
			type: "GET",

			//pass the data			
			data: data,		
			
			//Do not cache the page
			cache: false,
			
						
			
		  //success  
             success: function (html) {                
                 //if process.php returned 1/true (send mail success)  
                 if (html==1) {           
                       
                     $('#explaination').fadeOut('fast');            
                       
                     //show the success message  
                     $('.done').fadeIn('slow');  
                     
                     window.setTimeout(function () {
										 $('.done').fadeOut('fast');  
										 $('#explaination').fadeIn('fast');    										 
  										 $('#block_reportez').fadeOut('slow');  
                    			
								},6000);
                     
                    
                 
                 } else 
                 {
                 		 $('#explaination').fadeOut('fast');            
                       
                     //show the success message  
                     $('.failed').fadeIn('slow');  
                     
                     window.setTimeout(function () {
											$('.failed').fadeOut('fast');  
										 $('#explaination').fadeIn('fast');    										 
  										 $('#block_reportez').fadeOut('slow');  
                    			
								},6000);
                 	}                 
             }         
         });  
		
		//cancel the submit button default behaviours
		return false;
	});	
	
	
	$('#commenter').click(function () {		
	
			document.getElementById('captcha_comment').value = "fgh76kjR";
			
			var captcha_comment = $('input[name=captcha_comment]');
		
		var pseudo_comment = $('input[name=pseudo_comment]');
		var email_comment = $('input[name=email_comment]');
		var commentaire = $('textarea[name=commentaire]');
		var contributionid = $('input[name=contributionid]');


		
		//Simple validation to make sure user entered something
		//If error found, add hightlight class to the text field
		if (pseudo_comment.val()=='' || pseudo_comment.val() == 'Votre Pseudo') {
			pseudo_comment.addClass('hightlight');
			return false;
		} else pseudo_comment.removeClass('hightlight');
		
		
		if (email_comment.val()==''  || email_comment.val() == 'Votre Email') {
			email_comment.addClass('hightlight');
			return false;
		} else email_comment.removeClass('hightlight');
		
		if ( commentaire.val() == '' || commentaire.val() == 'Votre Message' ) {
			commentaire.addClass('hightlight');
			return false;
		} else commentaire.removeClass('hightlight');
		
		var data = 'captcha=' + captcha_comment.val() +'&pseudo=' + pseudo_comment.val() + '&email='  + email_comment.val() + '&commentaire='  + encodeURIComponent(commentaire.val()) + '&contributionid=' + contributionid.val() ;
		
		//disabled all the text fields
		//$('.required').attr('disabled','true');
		
		//show the loading sign
		$('.loading').show();
		
		//start the ajax
		$.ajax({
			//this is the php file that processes the data and send mail
			url: "submit_commentaire.php",	
			
			//GET method is used
			type: "GET",

			//pass the data			
			data: data,		
			
			//Do not cache the page
			cache: false,
			
		  //success  
             success: function (html) {                
                 //if process.php returned 1/true (send mail success)  
                 if (html==1) {           
                 
                      $('#titrecomment').hide();      
                     $('#messagecontact').hide();      
                      $('#formcomment').fadeOut('fast');            
                       
                     //show the success message  
                     $('.done_comment').fadeIn('slow');  
                     
                     window.setTimeout(function () {
										 $('#titrecomment').show();      
                     $('#messagecontact').show();      
                     $('.done_comment').fadeOut('fast');  
										
                    			  										 
  										 $('#formcomment').fadeIn('slow');  
  										 
  										
  										document.getElementById('commentaire').value="";
                    			
								},8000);
                       
                 
                 } else 
                 {
							                 		 
                 		  $('#titrecomment').hide();      
                     $('#messagecontact').hide();      
                     $('#formcomment').fadeOut('fast');            
                       
                     //show the success message  
                     $('.failed_comment').fadeIn('slow');  
                     
                     window.setTimeout(function () {
										 $('#titrecomment').show();      
                     $('#messagecontact').show();      
                     $('.failed_comment').fadeOut('fast');  
                    			  										 
  										 $('#formcomment').fadeIn('slow');  
                    			
								},8000);
                 	}                 
             }         
         });  
		
		//cancel the submit button default behaviours
		return false;
	});	
	
	
	$('#contacter').click(function () {		
	
			document.getElementById('captcha_contact').value = "jkY4LKoP";
			
			var captcha_contact = $('input[name=captcha_contact]');
		
		var email_contact = $('input[name=email_contact]');
		var sujet_contact = $('input[name=sujet_contact]');
		var message = $('textarea[name=message]');
	

		
		//Simple validation to make sure user entered something
		//If error found, add hightlight class to the text field
		if (sujet_contact.val()=='' || sujet_contact.val() == 'Objet du message') {
			sujet_contact.addClass('hightlight');
			return false;
		} else sujet_contact.removeClass('hightlight');
		
		
		if (email_contact.val()==''  || email_contact.val() == 'Votre Email') {
			email_contact.addClass('hightlight');
			return false;
		} else email_contact.removeClass('hightlight');
		
		if ( message.val() == '' || message.val() == 'Votre Message' ) {
			message.addClass('hightlight');
			return false;
		} else message.removeClass('hightlight');
		
		var data = 'captcha=' + captcha_contact.val() +'&sujet=' + sujet_contact.val() + '&email='  + email_contact.val() + '&message='  + encodeURIComponent(message.val()) ;
		
		//disabled all the text fields
		//$('.required').attr('disabled','true');
		
		//show the loading sign
		$('.loading').show();
		
		//start the ajax
		$.ajax({
			//this is the php file that processes the data and send mail
			url: "submit_message.php",	
			
			//GET method is used
			type: "GET",

			//pass the data			
			data: data,		
			
			//Do not cache the page
			cache: false,
			
		  //success  
             success: function (html) {                
                 //if process.php returned 1/true (send mail success)  
                 if (html==1) {           
                 
                     $('#titrecomment').hide();      
                     $('#messagecontact').hide();      
                     $('#formcomment').fadeOut('fast');            
                       
                     //show the success message  
                     $('.done_comment').fadeIn('slow');  
                     
                     window.setTimeout(function () {
										$('#titrecomment').show();      
										$('#messagecontact').show();      
                    				$('.done_comment').fadeOut('fast');  
										
                    			  										 
  										 $('#formcomment').fadeIn('slow');  
  										 
  										
  										document.getElementById('message').value="";
                    			
								},8000);
                       
                 
                 } else 
                 {
							 $('#titrecomment').hide();      
                     $('#messagecontact').hide();      
                                     		 
                 		 $('#formcomment').fadeOut('fast');            
                       
                     //show the success message  
                     $('.failed_comment').fadeIn('slow');  
                     
                     window.setTimeout(function () {
										$('#titrecomment').show();      
										$('#messagecontact').show();      
                    														
										$('.failed_comment').fadeOut('fast');  
                    			  										 
  										 $('#formcomment').fadeIn('slow');  
                    			
								},8000);
                 	}                 
             }         
         });  
		
		//cancel the submit button default behaviours
		return false;
	});	
	
	
});	

 