function changeCat(a,b){if(a>0){var c=jQuery("#niveau").val();jQuery("#niveau").val(b);if(b<=c){var d=b+1;if(d==2){jQuery("#categorie2").html('<option value="0">--- Choisissez votre sous rubrique ---</option>');jQuery("#categorie3").html('<option value="0">--- Choisissez votre catégorie ---</option>')}else if(d==3){jQuery("#categorie3").html('<option value="0">--- Choisissez votre catégorie ---</option>')}}$.ajax({type:"POST",url:"/ajax/listCats",data:"idCat="+a,success:function(a){jQuery("#categorie"+(b+1)).html(a)}})}else{var d=b+1;if(d==2){jQuery("#categorie2").html('<option value="0">--- Choisissez votre sous rubrique ---</option>');jQuery("#categorie3").html('<option value="0">--- Choisissez votre catégorie ---</option>')}else if(d==3){jQuery("#categorie3").html('<option value="0">--- Choisissez votre catégorie ---</option>')}jQuery("#niveau").val(b)}}function verifFormAnnonce(){val=jQuery("#categorie3").val();if(val>0){$.ajax({type:"POST",url:"/ajax/verifCatAnnonce",data:"idCat="+id,success:function(a){return a}})}else{jQuery("#errorCat").html("Vous ne pouvez pas soumettre dans cette catégorie");return false}}function bbcode(a,b){var c=window.document.formulaire.Message;c.focus();if(typeof document.selection!="undefined"){var d=document.selection.createRange();var e=d.text;d.text=a+e+b;d=document.selection.createRange();if(e.length==0){d.move("character",-b.length)}else{d.moveStart("character",a.length+e.length+b.length)}d.select()}else if(typeof c.selectionStart!="undefined"){var f=c.selectionStart;var g=c.selectionEnd;var e=c.value.substring(f,g);c.value=c.value.substr(0,f)+a+e+b+c.value.substr(g);var h;if(e.length==0){h=f+a.length}else{h=f+a.length+e.length+b.length}c.selectionStart=h;c.selectionEnd=h}else{var h;var i=new RegExp("^[0-9]{0,3}$");while(!i.test(h)){h=prompt("insertion (0.."+c.value.length+"):","0")}if(h>c.value.length){h=c.value.length}var e=prompt("Veuillez taper le texte");c.value=c.value.substr(0,h)+a+e+b+c.value.substr(h)}}function supPhoto(a){jQuery("#"+a).remove();var b=$("input:file").length;if(b<7){jQuery("#addPhoto").show()}}function refreshThumb(a){jQuery.ajax({type:"POST",url:"/ajax/refreshThumb",data:"idImage="+a,success:function(a){if(a!=""){jQuery("#image").html(a);jQuery("#image").fadeIn("slow");$("a[rel*=lightbox]").lightBox()}}})}function redirection_connexion(){jQuery(location).attr("href","http://www.natuxo.com/connexion/")}(function(a){a.fn.extend({customStyle:function(b){if(!a.browser.msie||a.browser.msie&&a.browser.version>6){return this.each(function(){var b=a(this).find(":selected");a(this).after('<span class="customStyleSelectBox"><span class="customStyleSelectBoxInner">'+b.text()+"</span></span>").css({position:"absolute",opacity:0,fontSize:a(this).next().css("font-size")});var c=a(this).next();var d=parseInt(a(this).width())-parseInt(c.css("padding-left"))-parseInt(c.css("padding-right"));var e=c.find(":first-child");c.css({display:"inline-block"});e.css({width:d,display:"inline-block"});var f=parseInt(c.height())+parseInt(c.css("padding-top"))+parseInt(c.css("padding-bottom"));a(this).height(f).change(function(){e.text(a(this).find(":selected").text()).parent().addClass("changed")})})}}})})(jQuery);$(document).ready(function(){function b(){$(this).find(".sub").stop().fadeTo("fast",0,function(){$(this).hide()})}function a(){$(this).find(".sub").stop().fadeTo("fast",1).show();(function(a){jQuery.fn.calcSubWidth=function(){rowWidth=0;a(this).find("ul").each(function(){rowWidth+=a(this).width()})}})(jQuery);if($(this).find(".row").length>0){var a=0;$(this).find(".row").each(function(){$(this).calcSubWidth();if(rowWidth>a){a=rowWidth}});$(this).find(".sub").css({width:a});$(this).find(".row:last").css({margin:"0"})}else{$(this).calcSubWidth();$(this).find(".sub").css({width:rowWidth})}}$("select.styled").customStyle();$(".selectType").customStyle();$("#slider").nivoSlider({effect:"fade",pauseTime:3e3});var c={sensitivity:2,interval:0,over:a,timeout:0,out:b};$("ul#topnav li .sub").css({opacity:"0"});$("ul#topnav li").hoverIntent(c);$("ul#topnav li").click(function(){$("ul#topnav").find("li.current").removeClass().removeAttr("class");$(this).addClass("current")});$("li.liSub").hover(function(){$(this).find("span img").attr("src","http://www.natuxo.com/assets/images/arrow_hover.png")},function(){$(this).find("span img").attr("src","http://www.natuxo.com/assets/images/arrow.png")});$("ul#topnav .sub ul li:last-child a").css("border","none");$("a[rel*=lightbox]").lightBox();jQuery("#url_video").click(function(){jQuery("#url_video").val("")});jQuery("#addPhoto").click(function(){var a=parseInt(jQuery("#nbPhoto").val());var b=$("input:file").length;if(b<7){html='<div class="form-line" id="ligne'+(a+1)+'"><label class="form-label" for="userfile1">Photo <span  class="lienSup">(<a onclick="supPhoto(\'ligne'+(a+1)+'\');">Supprimer</a>)</span><em>Max : 2Mo ( jpg | jpeg | png | gif ) </em></label><input type="file" name="userfile'+(a+1)+'" class="form-text" /><div class="cb"></div></div>';jQuery("#photoSup").append(html);jQuery("#nbPhoto").val(a+1);if(b==6){jQuery("#addPhoto").hide()}}else{jQuery("#addPhoto").hide()}});jQuery("#ajoutAmi").click(function(){var a=jQuery("#idMembre").val();jQuery.ajax({type:"POST",url:"/ajax/ajoutAmi",data:"idAmi="+a,success:function(a){if(a=="OK"){jQuery("#lienAmi").css("display","none");jQuery("#lienAmi").css("font-weight","bold");jQuery("#lienAmi").html("Ami ajouté !");jQuery("#lienAmi").fadeIn("slow")}else if(a=="AMIOK"){jQuery(".title h1").jAlert("Vous avez déjà ce membre en ami","warning","warningboxid")}else{redirection_connexion()}}})});jQuery("#supprimerAmi").click(function(){var a=jQuery("#idMembre").val();jQuery.ajax({type:"POST",url:"/ajax/supprimerAmi",data:"idAmi="+a,success:function(a){if(a=="OK"){jQuery("#lienAmi").css("display","none");jQuery("#lienAmi").css("font-weight","bold");jQuery("#lienAmi").html("Ami supprimé !");jQuery("#lienAmi").fadeIn("slow")}}})});jQuery("#supprimerFavoris").click(function(){var a=jQuery("#idMedia").val();jQuery.ajax({type:"POST",url:"/ajax/supprimerFavoris",data:"idMedia="+a,success:function(a){if(a=="OK"){jQuery("#txtFav").css("display","none");jQuery("#txtFav").css("font-weight","bold");jQuery("#txtFav").html("Favoris supprimé !");jQuery("#txtFav").fadeIn("slow")}}})});jQuery("#ajoutFavoris").click(function(){var a=jQuery("#idMedia").val();jQuery.ajax({type:"POST",url:"/ajax/ajoutFavoris",data:"idMedia="+a,success:function(a){if(a=="OK"){jQuery("#txtFav").css("display","none");jQuery("#txtFav").css("font-weight","bold");jQuery("#txtFav").html("Favoris ajouté !");jQuery("#txtFav").fadeIn("slow")}else if(a=="FAVOK"){jQuery(".title h1").jAlert("Ce média a déjà été ajouté en favoris","warning","warningboxid")}else{redirection_connexion()}}})});jQuery("#ajoutFavorisAnnonce").click(function(){var a=jQuery("#idAnnonce").val();jQuery.ajax({type:"POST",url:"/ajax/ajoutFavorisAnnonce",data:"idAnnonce="+a,success:function(a){if(a=="OK"){jQuery("#txtFav").css("display","none");jQuery("#txtFav").css("font-weight","bold");jQuery("#txtFav").html("Favoris ajouté !");jQuery("#txtFav").fadeIn("slow")}else if(a=="FAVOK"){jQuery(".title h1").jAlert("Cette annonce a déjà été ajoutée en favoris","warning","warningboxid")}else{redirection_connexion()}}})});jQuery("#supprimerFavorisAnnonce").click(function(){var a=jQuery("#idAnnonce").val();jQuery.ajax({type:"POST",url:"/ajax/supprimerFavorisAnnonce",data:"idAnnonce="+a,success:function(a){if(a=="OK"){jQuery("#txtFav").css("display","none");jQuery("#txtFav").css("font-weight","bold");jQuery("#txtFav").html("Favoris supprimé !");jQuery("#txtFav").fadeIn("slow")}}})});jQuery("#btnAddCommentMedia").click(function(){var a=jQuery("#idMedia").val();var b=jQuery("#txtCommentaire").val();jQuery("#jalert_box_cont_errboxid").fadeOut(100);jQuery("#jalert_box_cont_errboxid").empty();jQuery("#jalert_box_cont_errboxid").remove();if(b!=""){jQuery("#btnAddCommentMedia").hide();jQuery.ajax({type:"POST",url:"/ajax/ajoutCommentaireMedia",data:"idMedia="+a+"&commentaire="+b,success:function(a){var b=a.substring(0,8);if(b!="Erreur !"){jQuery("#jalert_box_cont_errboxid").fadeOut(100);jQuery("#jalert_box_cont_errboxid").empty();jQuery("#jalert_box_cont_errboxid").remove();jQuery("#commentaires").css("display","none");jQuery("#commentaires").html(a);jQuery("#commentaires").fadeIn("slow");var c=parseInt(jQuery("#nb_c").val());c=c+1;jQuery("#txt_c").css("display","none");jQuery("#txt_c").html(c);jQuery("#txt_c").fadeIn("slow");jQuery("#txt_c2").css("display","none");jQuery("#txt_c2").html(c);jQuery("#txt_c2").fadeIn("slow")}else{jQuery("#commentaires").jAlert(a,"fatal","errboxid")}}});jQuery("#btnAddCommentMedia").show()}else{jQuery("#commentaires").jAlert("Erreur ! Votre commentaire est vide !","fatal","errboxid");$(".someElement").removeAttr("disabled")}});jQuery("#btnAddCommentActualite").click(function(){var a=jQuery("#idActu").val();var b=jQuery("#txtCommentaire").val();jQuery("#jalert_box_cont_errboxid").fadeOut(100);jQuery("#jalert_box_cont_errboxid").empty();jQuery("#jalert_box_cont_errboxid").remove();if(b!=""){jQuery.ajax({type:"POST",url:"/ajax/ajoutCommentaireActualite",data:"idActu="+a+"&commentaire="+b,success:function(a){var b=a.substring(0,8);if(b!="Erreur !"){jQuery("#jalert_box_cont_errboxid").fadeOut(100);jQuery("#jalert_box_cont_errboxid").empty();jQuery("#jalert_box_cont_errboxid").remove();jQuery("#commentaires").css("display","none");jQuery("#commentaires").html(a);jQuery("#commentaires").fadeIn("slow");var c=parseInt(jQuery("#nb_c").val());c=c+1;jQuery("#txt_c").css("display","none");jQuery("#txt_c").html(c);jQuery("#txt_c").fadeIn("slow");jQuery("#txt_c2").css("display","none");jQuery("#txt_c2").html(c);jQuery("#txt_c2").fadeIn("slow")}else{jQuery("#commentaires").jAlert(a,"fatal","errboxid")}}})}else{jQuery("#commentaires").jAlert("Erreur ! Votre commentaire est vide !","fatal","errboxid")}});jQuery("#btnAddCommentJeu").click(function(){var a=jQuery("#idJeu").val();var b=jQuery("#txtCommentaire").val();jQuery("#jalert_box_cont_errboxid").fadeOut(100);jQuery("#jalert_box_cont_errboxid").empty();jQuery("#jalert_box_cont_errboxid").remove();if(b!=""){jQuery.ajax({type:"POST",url:"/ajax/ajoutCommentaireJeu",data:"idJeu="+a+"&commentaire="+b,success:function(a){var b=a.substring(0,8);if(b!="Erreur !"){jQuery("#jalert_box_cont_errboxid").fadeOut(100);jQuery("#jalert_box_cont_errboxid").empty();jQuery("#jalert_box_cont_errboxid").remove();jQuery("#commentaires").css("display","none");jQuery("#commentaires").html(a);jQuery("#commentaires").fadeIn("slow");var c=parseInt(jQuery("#nb_c").val());c=c+1;jQuery("#txt_c").css("display","none");jQuery("#txt_c").html(c);jQuery("#txt_c").fadeIn("slow");jQuery("#txt_c2").css("display","none");jQuery("#txt_c2").html(c);jQuery("#txt_c2").fadeIn("slow")}else{jQuery("#commentaires").jAlert(a,"fatal","errboxid")}}})}else{jQuery("#commentaires").jAlert("Erreur ! Votre commentaire est vide !","fatal","errboxid")}});jQuery("#btnAddCommentAnnonce").click(function(){var a=jQuery("#idAnnonce").val();var b=jQuery("#txtCommentaire").val();jQuery("#jalert_box_cont_errboxid").fadeOut(100);jQuery("#jalert_box_cont_errboxid").empty();jQuery("#jalert_box_cont_errboxid").remove();if(b!=""){jQuery.ajax({type:"POST",url:"/ajax/ajoutCommentaireAnnonce",data:"idAnnonce="+a+"&commentaire="+b,success:function(a){var b=a.substring(0,8);if(b!="Erreur !"){jQuery("#jalert_box_cont_errboxid").fadeOut(100);jQuery("#jalert_box_cont_errboxid").empty();jQuery("#jalert_box_cont_errboxid").remove();jQuery("#commentaires").css("display","none");jQuery("#commentaires").html(a);jQuery("#commentaires").fadeIn("slow");var c=parseInt(jQuery("#nb_c").val());c=c+1;jQuery("#txt_c").css("display","none");jQuery("#txt_c").html(c);jQuery("#txt_c").fadeIn("slow");jQuery("#txt_c2").css("display","none");jQuery("#txt_c2").html(c);jQuery("#txt_c2").fadeIn("slow")}else{jQuery("#commentaires").jAlert(a,"fatal","errboxid")}}})}else{jQuery("#commentaires").jAlert("Erreur ! Votre commentaire est vide !","fatal","errboxid")}});jQuery("#btnAddCommentAnnuaire").click(function(){var a=jQuery("#idSite").val();var b=jQuery("#txtCommentaire").val();jQuery("#jalert_box_cont_errboxid").fadeOut(100);jQuery("#jalert_box_cont_errboxid").empty();jQuery("#jalert_box_cont_errboxid").remove();if(b!=""){jQuery.ajax({type:"POST",url:"/ajax/ajoutCommentaireAnnuaire",data:"idSite="+a+"&commentaire="+b,success:function(a){var b=a.substring(0,8);if(b!="Erreur !"){jQuery("#jalert_box_cont_errboxid").fadeOut(100);jQuery("#jalert_box_cont_errboxid").empty();jQuery("#jalert_box_cont_errboxid").remove();jQuery("#commentaires").css("display","none");jQuery("#commentaires").html(a);jQuery("#commentaires").fadeIn("slow");var c=parseInt(jQuery("#nb_c").val());c=c+1;jQuery("#txt_c").css("display","none");jQuery("#txt_c").html(c);jQuery("#txt_c").fadeIn("slow");jQuery("#txt_c2").css("display","none");jQuery("#txt_c2").html(c);jQuery("#txt_c2").fadeIn("slow")}else{jQuery("#commentaires").jAlert(a,"fatal","errboxid")}}})}else{jQuery("#commentaires").jAlert("Erreur ! Votre commentaire est vide !","fatal","errboxid")}});jQuery("#search").focus(function(){jQuery("#search").val("")})})
