
$(document).ready(function()
{$('.contentNotification').fadeIn(1000,function(){});});function liveVote(poll_id)
{var choices=new Array();var choosen=0;var multiple_choices=parseInt($('input[name="poll'+poll_id+'_multiple_choices"]').val());choices[0]='';if(multiple_choices==1)
{var choosen_radio=parseInt($('input[name="poll'+poll_id+'_opt"]:checked').val());for(var i=0;i<=10;i++)
{if(i==choosen_radio)
{choices[choosen_radio]=1;choosen++}
else
choices[i]=0;}}
else
{for(var i=1;i<=10;i++)
{if($('input[name="poll'+poll_id+'_opt'+i+'"]').val())
{if($('input[name="poll'+poll_id+'_opt'+i+'"]:checked').val()=='on')
{choices[i]=1;choosen++;}
else
choices[i]=0;}}}
if(choosen>0&&choosen<=multiple_choices)
{$('#poll'+poll_id+' .notification').html('<img src="design/loading.gif" alt="En cours.."/> Vote en cours...');$('#poll'+poll_id+' .switch').fadeOut('fast',function(){});$.post('neko_engine/ajax/ajax_polls.php',{action:"vote",id:poll_id,choices:choices},function success(data)
{if(data=='ajax_polls_vote_ok')
{$('#poll'+poll_id).slideUp(300,function(){});$('#poll'+poll_id).html('');$.timer(300,function(timer)
{$.post('neko_engine/ajax/ajax_polls.php',{action:"displayResults",id:poll_id},function success(data)
{$('#poll'+poll_id).html(data);$('#poll'+poll_id).slideDown(300,function(){});});timer.stop();});}
else if(data=='ajax_polls_vote_already_voted')
{$('#poll'+poll_id+' .notification').html('Vous avez déja voté pour ce sondage.');}
else
{$('#poll'+poll_id+' .notification').html('<strong>Erreur...</strong>');}});}
else if(choosen==0)
{alert('Vous devez au moins choisir une option pour voter.');}
else
{alert('Désolé vous ne pouvez pas cocher plus de '+multiple_choices+' options!');}}
function liveComment(post_id)
{var autor=$('input[name="autor"]').val();var autor_email=$('input[name="autor_email"]').val();var autor_site=$('input[name="autor_site"]').val();var comment_content=$('#comment_content').val();if($('input[name="notif_new"]:checked').val())
var notif_new=1;else
var notif_new=0;var captcha=$('#captcha').val();var captcha_key=$('input[name="captcha_key"]').val();var spot=$('input[name="spot"]').val();if(!autor.match(/^ +$/)&&autor!=''&&autor_email.match(/[A-Za-z0-9.-_]+@[A-Za-z0-9.-_]+/)&&autor_email!=''&&comment_content!='')
{$('#commentForm .notification').html('<img src="design/loading.gif" alt="En cours.."/> Envoi en cours...');$('#commentForm .notification').fadeIn('fast',function(){});$('#sendComment').fadeOut('fast',function(){});$.post('neko_engine/ajax/ajax_comments.php',{action:"send",post_id:post_id,content:comment_content,autor:autor,autor_email:autor_email,autor_site:autor_site,notif_new:notif_new,captcha:captcha,captcha_key:captcha_key,spot:spot},function success(data)
{if(data=='ajax_comments_send_ok')
{$('#commentForm').slideUp(400,function(){});$('#commentForm').html('');$('#noComment').hide();$.timer(400,function(timer)
{$.post('neko_engine/ajax/ajax_comments.php',{action:"displayLastOne"},function success(data)
{var actual_comments=$('#comments').html();$('#comments').html(actual_comments+data);$('#comments #newComment').slideDown('slow',function(){});});timer.stop();});}
else if(data=='ajax_comments_send_captcha_fail')
{$('#commentForm .notification').html('<em>Le resultat du calcul n\'est pas bon ...</em>');$('#sendComment').fadeIn('fast',function(){});}
else if(data=='ajax_comments_send_flood')
{$('#commentForm .notification').html('<em>Oops, il semblerait que vous ayez déjà envoyé un commentaire similaire.</em>');$('#sendComment').fadeIn('fast',function(){});}
else
{$('#commentForm .notification').html('<strong>Erreur</strong>');}});}
else
{alert('Merci de remplir l\'ensemble des champs obligatoires pour commenter');}}
function liveContact()
{var autor=$('input[name="autor"]').val();var autor_email=$('input[name="autor_email"]').val();var autor_site=$('input[name="autor_site"]').val();var message_title=$('input[name="message_title"]').val();var message_content=$('#message_content').val();var message_sub_content=$('#message_sub_content').val();var captcha=$('#captcha').val();var captcha_key=$('input[name="captcha_key"]').val();var spot=$('input[name="spot"]').val();if(!autor.match(/^ +$/)&&autor!=''&&autor_email.match(/[A-Za-z0-9.-_]+@[A-Za-z0-9.-_]+/)&&autor_email!=''&&message_content!='')
{$('#commentForm .notification').html('<img src="design/loading.gif" alt="En cours.."/> Envoi en cours...');$('#commentForm .notification').fadeIn('fast',function(){});$('#sendComment').fadeOut('fast',function(){});$.post('neko_engine/ajax/ajax_contact.php',{action:"send",message_title:message_title,message_content:message_content,message_sub_content:message_sub_content,autor:autor,autor_email:autor_email,autor_site:autor_site,captcha:captcha,captcha_key:captcha_key,spot:spot},function success(data)
{if(data.substr(0,12)!="ajax_contact")
{$('#commentForm').slideUp(400,function(){});$('#commentForm').html('');$.timer(400,function(timer)
{$('#content').html(data);$('#content .entry').slideDown(400,function(){});timer.stop();});}
else if(data=='ajax_contact_send_captcha_fail')
{$('#commentForm .notification').html('<em>Le resultat du calcul n\'est pas bon ...</em>');$('#sendComment').fadeIn('fast',function(){});}
else
{$('#commentForm .notification').html('<strong>Erreur</strong>');}});}
else
{alert('Merci de remplir l\'ensemble des champs obligatoires pour commenter');}}
$(document).ready(function()
{$.timer(3000,function(timer)
{$.post('neko_engine/ajax/ajax_atom.php');timer.stop();});});
