$(document).ready(function($){$('.clean_text2').each(function(e){$(this).html(wbr2($(this).html(),25));});$('#user_labels input[type=button]').click(function(){labelcreate();});$('#user_labels input.labelname').keydown(function(e){});$('#que_faites_vous').elastic();$.fn.fancyzoom.defaultsOptions.imgDir='/images/ressources/';$('a.tozoom').fancyzoom({Speed:1000});$('a#click-action-informer').click(function(){$('body').attr('class','mozilla firefox win color-informer');});$('a#click-action-agir').click(function(){$('body').attr('class','mozilla firefox win color-agir');});$('a.click-action-donner').click(function(){$('body').attr('class','mozilla firefox win color-donner');});$('a#click-action-rencontrer').click(function(){$('body').attr('class','mozilla firefox win color-rencontrer');});$('a#click-action-home').click(function(){$('body').attr('class','mozilla firefox win color-home');});$(".datagrid tr").mouseover(function(){$(this).addClass("handon");}).mouseout(function(){$(this).removeClass("handon");});setTimeout("$('#alert').hide()",5000);$('#comment_textarea').keypress(function(){$("#char_title_left").html(500-(this.value.length+1)+" caractères <br /> restant");ismaxlength(this);});$('#SettingUserDonFirst').change(function(){if($('#SettingUserDonFirst').val()==1)$("#UserUserDonText").html("Insérer le lien de votre formulaire de don");if($('#SettingUserDonFirst').val()==2)$("#UserUserDonText").html("Insérer l’ adresse mail utilisée pour créer votre compte Paypal");if($('#SettingUserDonFirst').val()==3)$("#UserUserDonText").html("Insérer une adresse postale");});$('#SettingUserDonFirst').change(function(){if($('#SettingUserDonFirst').val()==1)$("#SettingUserDon").html("Insérer le lien de votre formulaire de don");if($('#SettingUserDonFirst').val()==2)$("#SettingUserDon").html("Insérer l’ adresse mail utilisée pour créer votre compte Paypal");if($('#SettingUserDonFirst').val()==3)$("#SettingUserDon").html("Insérer une adresse postale");});$(".various1").fancybox({'titlePosition':'inside','transitionIn':'none','transitionOut':'none','transitionOut':false});$('.projet_parrainer').change(function(){$.ajax({type:'post',url:'/participers/getprojectsajax',spinner:'Chargement en cours...',cache:false,dataType:'json',data:{'data[theme]':$('#theme_parrainer').val(),'data[localisation]':$('#localisation_parrainer').val()},async:true,beforeSend:function(){},success:function(data){$('#spinner_ajax').hide();$('#loaddiv').html(data.outhtml);}});});$('a.transmettre_proposition').click(function(){var id_produit=$(this).attr('id');$.ajax({type:'post',url:'/ajax/transmettre_proposition',spinner:'Chargement en cours...',cache:false,dataType:'json',data:{'data[id]':id_produit},async:true,beforeSend:function(){$('#div_'+id_produit).html("Votre proposition a été transmise");},success:function(data){}});});$('a.cancel_ok').click(function(){var id_interesse=$(this).attr('id');$.ajax({type:'post',url:'/produit/annuler_acceptation/',spinner:'Chargement en cours...',cache:false,dataType:'json',data:{'data[id]':id_interesse},async:true,beforeSend:function(){$('#div_actions_'+id_interesse).html("<b>Acceptation annulée</b>");},success:function(data){}});});$('a.cancel_demande_ok').click(function(){var id_interesse=$(this).attr('id');$.ajax({type:'post',url:'/produitdonners/annuler_acceptation/',spinner:'Chargement en cours...',cache:false,dataType:'json',data:{'data[id]':id_interesse},async:true,beforeSend:function(){$('#div_actions_'+id_interesse).html("<b>Acceptation annulée</b>");},success:function(data){}});});$('a.transmettre_proposition_troc').click(function(){var id_produit=$(this).attr('id');$.ajax({type:'post',url:'/ajax/transmettre_proposition_troc',spinner:'Chargement en cours...',cache:false,dataType:'json',data:{'data[id]':id_produit},async:true,beforeSend:function(){$('#div_troc_'+id_produit).html("Votre proposition a été transmise");},success:function(data){}});});$('a.transmettre_proposition_vide').click(function(){var id_user=$(this).attr('id');$.ajax({type:'post',url:'/ajax/transmettre_proposition_vide',spinner:'Chargement en cours...',cache:false,dataType:'json',data:{'data[id]':id_user},async:true,beforeSend:function(){$('#profile-send-message').html("Votre proposition a été transmise");},success:function(data){}});});$('#home_actions_principale').click(function(){$('#ajax_spinner').show();$('#goto_recentes').show();$('#goto_principales').hide();$.ajax({type:'post',url:'/home/home_actions_principale',spinner:'Chargement en cours...',cache:false,dataType:'json',data:{'data[id]':$('#home_actions_principale').val()},async:true,beforeSend:function(){},success:function(data){$('#ajax_spinner').hide();$('#flux_home').html(data.outhtml);}});});$('#home_actions_recente').click(function(){$('#ajax_spinner').show();$('#goto_recentes').hide();$('#goto_principales').show();$.ajax({type:'post',url:'/home/home_actions_recente',spinner:'Chargement en cours...',cache:false,dataType:'json',data:{'data[id]':$('#home_actions_recente').val()},async:true,beforeSend:function(){},success:function(data){$('#ajax_spinner').hide();$('#flux_home').html(data.outhtml);}});});$('.lire_suite').toggle(function(){var my_id=$(this).attr('id').split('_')[3];$("#cut_to_show_"+my_id).hide();$("#text_to_show_"+my_id).show();$("#id_to_show_"+my_id).html("Réduire");},function(){var my_id=$(this).attr('id').split('_')[3];$("#text_to_show_"+my_id).hide();$("#cut_to_show_"+my_id).show();$("#id_to_show_"+my_id).html("Lire la suite");});$('.lire_suite_desc').toggle(function(){$("#cut_to_show").hide();$("#text_to_show").show();$("#id_to_show").html("Réduire");},function(){$("#text_to_show").hide();$("#cut_to_show").show();$("#id_to_show").html("Lire la suite");});$('.lien_afficher_all_com_plus').toggle(function(){var my_id=$(this).attr('id');$("#last_3_pluscomments_"+my_id).hide();$("#all_plus_comments_"+my_id).show();$("a.lien_afficher_all_com_plus").html("Les 3 derniers commentaires");},function(){var my_id=$(this).attr('id');$("#all_plus_comments_"+my_id).hide();$("#last_3_pluscomments_"+my_id).show();$("a.lien_afficher_all_com_plus").html("Afficher tout les commentaires");});$('#comment_textarea').focus(function(){$('#upload_file').slideDown();return false;});$('#upload_file').hide();$('#comment_textarea').elastic();$('#close_flash').click(function(){$('#alert').fadeOut(500);return false;});$('#objet').keypress(function(){$("#char_title_left").html(71-(this.value.length+1)+" caractères restant");});$('a#parrainer_prod_link').click(function(){$('#parrainer_prod').toggle(400);return false;});$('a#clic_modif_donnees').click(function(){$('#modif_coordonnees').toggle(400);return false;});$('a#link_infos_personnelles').click(function(){$('#infos_personnelles').toggle();$('#infos_generales').hide();return false;});$('a#link_infos_generales').click(function(){$('#infos_generales').toggle();$('#infos_personnelles').hide();return false;});$('a#clic_envoyer_proprietaire').click(function(){$('#text_area_message').toggle(400);return false;});$('a#click-upload').click(function(){$('#upload-photo').toggle(400);return false;});$('a#autre_lieu').click(function(){$('#div_autre_lieu').toggle(400);return false;});$('a#add_files').click(function(){$('#div_video').hide();$('.div_file').show();$('#cancel_join').show();$('#confirm_join').hide();$('#valider_join').hide();return false;});$('a#add_files_demander').click(function(){$('#upload_demander').toggle();return false;});$('a.add_comment_product').click(function(){var com_id=$(this).attr('id').split('_')[2];$('#commentaire_'+com_id).toggle();return false;});$('a.add_comment_repondre').click(function(){var com_id=$(this).attr('id').split('_')[2];$('#commentaire_'+com_id).toggle();});$('a#add_videos').click(function(){$('#div_video').show();$('#div_file').hide();$('#cancel_join').show();$('#valider_join').show();$('#add_files_on').show();return false;});$('a#cancel_join').click(function(){var url=$('#input_video').val();var urlRegxp=/^(http:\/\/www.|https:\/\/www.|ftp:\/\/www.|www.){1}([\w]+)(.[\w]+){1,2}$/;if(url.indexOf("youtube")==-1){$('#input_video').val("Insérer le lien d'une vidéo Youtube");}
$('#div_video').hide();$('#div_file').hide();$('#cancel_join').hide();$('#valider_join').hide();return false;});$('a#valider_join').click(function(){var url=$('#input_video').val();var urlRegxp=/^(http:\/\/www.|https:\/\/www.|ftp:\/\/www.|www.){1}([\w]+)(.[\w]+){1,2}$/;if(url.indexOf("youtube")==-1){alert("Lien youtube non valide");return false;}else{$('#confirm_join').show();$('#div_video').hide();$('#div_file').hide();$('#cancel_join').hide();$('#valider_join').hide();$('#add_videos_on').hide();return false;}});$('#input_file').click(function(){$('#add_files_on').hide();});$('a#click_lien_cacher_photo').click(function(){$('#lien_cacher_photo').hide();$('.photo_obj').hide();$('.avtar_users').hide();$('.action-show').show();$('.action-hide').hide();$(".block-cliquable").addClass("block-cliquable-widhout-image");$(".block-cliquable-widhout-image").removeClass("block-cliquable");$('#lien_afficher_photo').show();return false;});$('a#click_lien_afficher_photo').click(function(){$('#lien_afficher_photo').hide();$('.photo_obj').show();$('.avtar_users').show();$('.action-show').hide();$('.action-hide').show();$(".block-cliquable-widhout-image").addClass("block-cliquable");$(".block-cliquable").removeClass("block-cliquable-widhout-image");$('#lien_cacher_photo').show();return false;});$('a#click_associations_uniquement').click(function(){$('.particulier').hide();$('#lien_associations_uniquement').hide();$('#lien_tout_type_associations').show();return false;});$('a#click_entreprises_uniquement').click(function(){$('.particulier').hide();$('.association').hide();$('#lien_entreprises_uniquement').hide();$('#lien_tout_type_entreprises').show();return false;});$('a#click_entreprises_uniquement').click(function(){$('.particulier').hide();$('.association').hide();$('#lien_entreprises_uniquement').hide();$('#lien_tout_type_entreprises').show();return false;});$('a#click_lien_tout_type_associations').click(function(){$('.particulier').show();$('.entreprise').show();$('.association').show();$('#lien_associations_uniquement').show();$('#lien_tout_type_associations').hide();return false;});$('#mot_tag').click(function(){$('.particulier').show();$('.entreprise').show();$('.association').show();$('#lien_entreprises_uniquement').show();$('#lien_tout_type_entreprises').hide();return false;});$(function(){$('.bloc-handle').click(function(ev,el){var $link=$(this),$bloc=$link.parents('.bloc');if($bloc.hasClass('closed')){$bloc.removeClass('closed');$link.attr('title','Réduire le bloc').text('-');}else{$link.attr('title','Agrandir le bloc').text('+');$bloc.addClass('closed');}
return false;});});$('.description').focus(function(){if($('.description').val()=="Description complète"){this.value='';}});$(".nom_produit").keyup(function(e){$('#tags_aider').show();var name;var not_int=new Array("le","la","est","les","dans","je","tu","il","elle","vous","nous","ils","un","une","donne","cherche","l'","on","ou","où","de","des","leur");var val_tag_aider=$('.nom_produit').val();var mot1=val_tag_aider.split(' ');var mot_final='';var tags='|';for(i=0;i<mot1.length;i++){if(inArray(not_int,mot1[i])==false&&mot1[i].length>3){mot_final=mot_final+'<li><a href="#"> '+mot1[i]+' </a> ';tags=tags+'|'+mot1[i];$(".particulier").show();}}
$("#input_tags").val(tags);$('#tags_aider').html(mot_final+'<li class="add-tag"><a href="#" onClick="alert_ok(1)">+</a></li>');return false;});$(".nom_produitdonner").keyup(function(e){$('#tags_etre_aider').show();var name;var not_int=new Array("le","la","est","les","dans","je","tu","il","elle","vous","nous","ils","un","une","donne","cherche","l'","on","ou","où","de","des","leur");var val_tag_aider=$('.nom_produitdonner').val();var mot1=val_tag_aider.split(' ');var mot_final='';var tags='|';for(i=0;i<mot1.length;i++){if(inArray(not_int,mot1[i])==false&&mot1[i].length>3){mot_final=mot_final+'<li><a href="#"> '+mot1[i]+' </a> ';tags=tags+'|'+mot1[i];$(".particulier").show();}}
$("#input_tags_etre_aider").val(tags);$('#tags_etre_aider').html(mot_final+'<li class="add-tag"><a href="#" onClick="alert_ok(2)">+</a></li>');return false;});function inArray(array,p_val){var l=array.length;for(var i=0;i<l;i++){if(array[i]==p_val){return true;}}
return false;}
function dump(arr,level){var dumped_text="";if(!level)level=0;var level_padding="";for(var j=0;j<level+1;j++)level_padding+="    ";if(typeof(arr)=='object'){for(var item in arr){var value=arr[item];if(typeof(value)=='object'){dumped_text+=level_padding+"'"+item+"' ...\n";dumped_text+=dump(value,level+1);}else{dumped_text+=level_padding+"'"+item+"' => \""+value+"\"\n";}}}else{dumped_text="===>"+arr+"<===("+typeof(arr)+")";}
return dumped_text;}
$('.reset_champ').each(function(){var default_value=this.value;$(this).focus(function(){if(this.value==default_value){this.value='';$(this).addClass('actived');}});$(this).blur(function(){if(this.value==''){this.value=default_value;$(this).removeClass('actived');}});});$('.contraintes').click(function(){$('#if_contraintes').toggle(400);return true;});$('.if_lieu').click(function(){$('#if_lieu').toggle(400);return true;});$('.in-edit').mouseover(function(){});$("#slide").mouseover(function(){$("#right").addClass("etiquette");});$("#slide").mouseout(function(){$("#right").removeClass("etiquette");});$('.valider_produit_donner').click(function(){var classtab=$(this).attr('class').split(' ');offre_produit(this.id,'produitdonners');document.getElementById("tout_le_div").innerHTML="Vous avez validé cette offre";var user=$(this).attr('name');$(this).remove();});$('.valider_produit_donner').confirm({msg:'Etes-vous sûr de valider ce membre?',wrapper:'<div></div>',timeout:10000});$('.valider_service_donner').click(function(){var classtab=$(this).attr('class').split(' ');offre_produit(this.id,'servicedonners');document.getElementById("tout_le_div").innerHTML="Vous avez validé cette offre";var user=$(this).attr('name');$(this).remove();});$('.valider_service_donner').confirm({msg:'Etes-vous sûr de valider cette offre?',timeout:10000});$("#objet").keyup(function(e){$("#find_photo").html('<a target="_blank" href="http://images.google.com/images?hl=en&q='+$("#objet").val()+' '+'">Trouver une photo sur '+$("#objet").val()+' </a>');});$("a#text_add_photo").click(function(e){$("#add_picture").show();return false;});$("a.add_photo_link").click(function(e){$("#add_picture").show();return false;});$('.ex').click(function(){var classtab=$(this).attr('class').split(' ');valider_membre(this.id,'produits');document.getElementById("tout_le_div").innerHTML="Vous avez validé ce don";var user=$(this).attr('name');$(this).remove();});$('.ex').confirm({msg:'Etes-vous sûr de valider ce membre?',timeout:10000});$('.valider_troc').click(function(){var classtab=$(this).attr('class').split(' ');valider_membre(this.id,'trocs');var user=$(this).attr('name');$(this).remove();window.setTimeout(' location.reload(true); ',3000);});$('.valider_troc').confirm({msg:'Etes-vous sûr de valider cette proposition?',timeout:10000});$('.valider_service').click(function(){var classtab=$(this).attr('class').split(' ');offre_service(this.id,'services');document.getElementById("tout_le_div").innerHTML="Vous avez validé ce service";var user=$(this).attr('name');$(this).remove();});$('.valider_service').confirm({msg:'Etes-vous sûr de valider ce membre?',timeout:10000});$('.valider_offre_service').click(function(){var classtab=$(this).attr('class').split(' ');offre_service(this.id,'services');document.getElementById("offre_choisi").innerHTML="Vous avez validé cette offre";var user=$(this).attr('name');$(this).remove();});$('.valider_offre_service').confirm({msg:'Etes-vous sûr d\'accepter cette offre?',timeout:10000});$('.valider_offre_produit').click(function(){var classtab=$(this).attr('class').split(' ');valider_offre(this.id,'produitdonners');document.getElementById("tout_le_div").innerHTML="Vous avez validé cette offre";var user=$(this).attr('name');$(this).remove();window.setTimeout(' location.reload(true); ',3000);});$('.valider_offre_produit').confirm({msg:'Etes-vous sûr d\'accepter cette offre?',timeout:10000});$('div.retirer_demande').click(function(){var classtab=$(this).attr('class').split(' ');retirer_demande(classtab[1]);$(this).remove();window.setTimeout(' location.reload(true); ',3000);});$('.retirer_demande').confirm({msg:'Etes-vous sûr de retirer votre demande?',timeout:10000});$('div.retirer_proposition').click(function(){var classtab=$(this).attr('class').split(' ');retirer_demande(classtab[1]);$(this).remove();window.setTimeout(' location.reload(true); ',3000);});$('.retirer_proposition').confirm({msg:'Etes-vous sûr de retirer votre proposition?',timeout:10000});$('a[id^=show_more_]').click(function(){var com_id=$(this).attr('id').split('_')[2];var inp_order=$('#inp_order').val();var inp_filtre=$('#inp_filtre').val();$.ajax({type:'post',url:'/home/showmore',cache:false,data:{'data[com_id]':com_id,'data[inp_order]':inp_order,'data[inp_filtre]':inp_filtre},dataType:'json',async:true,beforeSend:function(){$('#page_showmore').hide();$('#div_loading').show();return true;},success:function(data){$('#div_loading').hide();if(data.nomore==0){$('#allcomments').append(data.outhtml);$('#show_more_'+com_id).attr('id','show_more_'+data.lastid);$('#page_showmore').show();}
else{$('#allcomments').append(data.outhtml);$('#no_show_more').show();}
$.fn.fancyzoom.defaultsOptions.imgDir='/images/ressources/';$('a.tozoom').fancyzoom({Speed:1000});}});});});function cacher_message(){$('#flashmessage').hide(50);}
function addFormField(){var id=document.getElementById("id").value;$("#divTxt").append("<p id='row"+id+"'><label for='txt"+id+"'>Membre "+id+"&nbsp;&nbsp;<input type='text' size='20' name='txt[]' id='txt"+id+"'>&nbsp;&nbsp<a href='#' class='font_marron' style='text-decoration:none' onClick='removeFormField(\"#row"+id+"\"); return false;'><img src=\"/images/delete.png\"> supprimer</a><p>");$('#row'+id).highlightFade({speed:1000});id=(id-1)+2;document.getElementById("id").value=id;}
function removeFormField(id){$(id).remove();}
function labelcreate(){var newlabel=$('#user_labels input.labelname').val();$.post('/labels/create',{data:newlabel},function success(data){insertLabel(data);});return false;}
function send_email_facebook(){var getdate=new Date();if(xmlhttp){xmlhttp.open("POST","/users/send_email_facebook",true);xmlhttp.onreadystatechange=update_facebook_send;xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');xmlhttp.send("user_email="+"ok");}
document.location="/inscription-3-groupes";}
var doIframe=function(){$('#jqibox').addClass('recycler-popin');var iFrames=$(".autoHeight");function iResize(){for(var i=0,j=iFrames.length;i<j;i++){iFrames[i].style.height=(parseInt(iFrames[i].contentWindow.document.body.offsetHeight)+20)+'px';}}
if($.browser.safari||$.browser.opera){$('iframe').load(function(){setTimeout(iResize,0);$(this.contentWindow.document.body).bind('resize',iResize);$(this).focus();});for(var i=0,j=iFrames.length;i<j;i++){var iSource=iFrames[i].src;iFrames[i].src='';iFrames[i].src=iSource;}}
else{$('iframe').load(function(){iResize();setTimeout(iResize,250);$(this.contentWindow.document.body).bind('resize',iResize);$(this).focus();});}}
function mycallbackform(){}
function je_prends(id,type){var txt='<iframe class="autoHeight"  src="/'+type+'/prendre/'+id+'/" width="600" scrolling="no" frameborder="no" align="center"><br/>';$.prompt(txt,{callback:mycallbackform,loaded:doIframe,buttons:{Hey:'Hello',Bye:'Good Bye'}});return false;}
function je_troc(id){var txt='<iframe class="autoHeight"  src="/trocs/prendre/'+id+'/" width="600" scrolling="no" frameborder="no" align="center"><br/>';$.prompt(txt,{callback:mycallbackform,loaded:doIframe,buttons:{Hey:'Hello',Bye:'Good Bye'}});return false;}
function poster_recycler(id,type){var txt='<iframe class="autoHeight"  src="/produits/question/'+id+'/'+type+'" width="600" scrolling="no" frameborder="no" align="center"><br/>';$.prompt(txt,{callback:mycallbackform,loaded:doIframe,buttons:{Hey:'Hello',Bye:'Good Bye'}});return false;}
function ajouter_recycler(type){if(type==1)link='/ajouter-un-produit/';if(type==2)link='/chercher-un-produit/';if(type==5)link='/ajouter-un-troc/';var txt='<iframe class="autoHeight"  src="'+link+'" width="625" scrolling="no" frameborder="no" align="center"><br/>';$.prompt(txt,{callback:mycallbackform,loaded:doIframe,buttons:{Hey:'Hello',Bye:'Good Bye'},top:'2%'});return false;}
function faire_promotion(id,type){var txt='<iframe class="autoHeight"  src="/promotion-recycler/'+type+'/'+id+'/" width="650" scrolling="auto" frameborder="no" align="center"><br/>';$.prompt(txt,{callback:mycallbackform,loaded:doIframe,buttons:{Hey:'Hello',Bye:'Good Bye'},top:'2%'});return false;}
function edit_recycler(id,type){var txt='<iframe class="autoHeight"  src="/'+type+'/edit/'+id+'/" width="650" scrolling="no" frameborder="no" align="center"><br/>';$.prompt(txt,{callback:mycallbackform,loaded:doIframe,buttons:{Hey:'Hello',Bye:'Good Bye'},top:'2%'});return false;}
function poster_troc(){var txt='<iframe class="autoHeight"  src="/ajouter-un-troc" width="625" scrolling="no" frameborder="no" align="center"><br/>';$.prompt(txt,{callback:mycallbackform,loaded:doIframe,buttons:{Hey:'Hello',Bye:'Good Bye'},top:'2%'});return false;}
function poster_meme(id,type){if(type==1)link='/ajouter-un-produit/'+id;if(type==2)link='/chercher-un-produit/'+id;if(type==5)link='/ajouter-un-troc/'+id;var txt='<iframe class="autoHeight"  src="'+link+'" width="625" scrolling="no" frameborder="no" align="center"><br/>';$.prompt(txt,{callback:mycallbackform,loaded:doIframe,buttons:{Hey:'Hello',Bye:'Good Bye'},top:'2%'});return false;}
function signup_temp_entreprise(id,type){var txt='<iframe class="autoHeight"  src="/users/signup_temp_entreprise" width="600" scrolling="no" frameborder="no" align="center"><br/>';$.prompt(txt,{callback:mycallbackform,loaded:doIframe,buttons:{Hey:'Hello',Bye:'Good Bye'}});}
function facebook_connect(){var txt='<iframe class="autoHeight"  src="/pagefacebook" width="650" scrolling="no" frameborder="no" align="center"><br/>';$.prompt(txt,{callback:mycallbackform,loaded:doIframe,buttons:{Hey:'Hello',Bye:'Good Bye'}});}
function poster_article(type,id){var txt='<iframe class="autoHeight"  src="/participer/poster/'+id+'/" width="600" scrolling="no" frameborder="no" align="center"><br/>';$.prompt(txt,{callback:mycallbackform,loaded:doIframe,buttons:{Hey:' ',Bye:' '}});}
function closePopUp(){$.prompt.close();}
function alert_ok(type){name=prompt("Veuillez insérer votre tag","");if(name!=""&&type=="1"){$("#input_tags").val($("#input_tags").val()+"|"+name);$('#tags_aider').html($('#tags_aider').html()+'<li><a href="#" class="'+name+'"> '+name+' </a> <SUP class="croix_'+name+'" onClick="hide_tag(\''+name+'\')" style="color:red">X</SUP> </li>');}
if(name!=""&&type=="2"){$("#input_tags_etre_aider").val($("#input_tags_etre_aider").val()+"|"+name);$('#tags_etre_aider').html($('#tags_etre_aider').html()+'<li><a href="#" class="'+name+'"> '+name+' </a> <SUP class="croix_'+name+'" onClick="hide_tag(\''+name+'\')" style="color:red">X</SUP> </li>');}}
function hide_tag(name){$("."+name).remove();$(".croix_"+name).remove();var value_tags=$("#input_tags").val();$("#input_tags").val(value_tags.replace("|"+name,""));}
function close_fancybox(){$.fancybox.close();}
function feedback(){var txt='<iframe class="autoHeight"  src="/feedback" width="500" scrolling="no" frameborder="no" align="center"><br/>';$.prompt(txt,{callback:mycallbackform,loaded:doIframe,buttons:{Hey:'Hello',Bye:'Good Bye'}});}
function je_negocie(id,type){var txt='<iframe class="autoHeight"  src="/'+type+'/negocier/'+id+'/" width="600" scrolling="no" frameborder="no" align="center"><br/>';$.prompt(txt,{callback:mycallbackform,loaded:doIframe,buttons:{Hey:'Hello',Bye:'Good Bye'}});}
function received(id,type){var txt='<iframe class="autoHeight"  src="/'+type+'/received/'+id+'" width="650" scrolling="no" frameborder="no" align="center"><br/>';$.prompt(txt,{callback:mycallbackform,loaded:doIframe,buttons:{Hey:'Hello',Bye:'Good Bye'}});}
function not_received(id,type){var txt='<div style="width:600px;"><iframe class="autoHeight"  src="/'+type+'/not_received/'+id+'" width="500" scrolling="no" frameborder="no" align="center"></div><br/>';$.prompt(txt,{callback:mycallbackform,loaded:doIframe,buttons:{Hey:'Hello',Bye:'Good Bye'}});}
function repondre_question(id,type){var txt='<div style="width:500px; "><iframe class="autoHeight"  src="/'+type+'/repondre/'+id+'/" width="500" scrolling="no" frameborder="no" align="center"></div><br/>';$.prompt(txt,{callback:mycallbackform,loaded:doIframe,buttons:{Hey:'Hello',Bye:'Good Bye'}});}
function repondre_offre(id,type){var txt='<div style="width:500px;"><iframe class="autoHeight"  src="/'+type+'/repondre_offre/'+id+'/" width="500" scrolling="no" frameborder="no" align="center"></div><br/>';$.prompt(txt,{callback:mycallbackform,loaded:doIframe,buttons:{Hey:'Hello',Bye:'Good Bye'}});}
function faire_don(id){var txt='<div style="width:600px;"><iframe class="autoHeight"  src="/users/faire_don/'+id+'" width="600" scrolling="no" frameborder="no" align="center"></div><br/>';$.prompt(txt,{callback:mycallbackform,loaded:doIframe,buttons:{Hey:'Hello',Bye:'Good Bye'}});}
function open_window(url){var txt='<div style="width:600px;"><iframe class="autoHeight"  src="'+url+'" width="600" scrolling="no" frameborder="no" align="center"></div><br/>';$.prompt(txt,{callback:mycallbackform,loaded:doIframe,buttons:{Hey:' ',Bye:' '}});}
function recevoir_don(){var txt='<div style="width:600px;"><iframe class="autoHeight"  src="/users/recevoir_don1" width="600" scrolling="no" frameborder="no" align="center"></div><br/>';$.prompt(txt,{callback:mycallbackform,loaded:doIframe,buttons:{Hey:'Hello',Bye:'Good Bye'}});}
function insertLabel(data){var thespan='<span class="white"><img class="handle" border="0" alt="" src="/img/move.png"/><input type="checkbox"/></span>';var thehtml='<li>'+thespan+data+'</li>';$('#user_labels .next_label').before(thehtml);$('#newLabel').hide();$('#user_labels .next_label img').show();return false;}
var time_variable;function getXMLObject()
{var xmlHttp=null;try{xmlHttp=new XMLHttpRequest();}
catch(e){try{xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");}
catch(e){xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");}}
return xmlHttp;}
var xmlhttp=new getXMLObject();function handleServerResponse(){if(xmlhttp.readyState==4){if(xmlhttp.status==200){document.getElementById("message").innerHTML=xmlhttp.responseText;document.getElementById("sous_categorie").innerHTML=xmlhttp.responseText;}}}
function voir_interesses(id){$('#div_interesses_'+id).show();}
function update_sous_categorie(){if(xmlhttp.readyState==4){if(xmlhttp.status==200){document.getElementById("sous_categorie").innerHTML=xmlhttp.responseText;}}}
function update_facebook_send(){if(xmlhttp.readyState==4){if(xmlhttp.status==200){document.getElementById("user_email").innerHTML=xmlhttp.responseText;}}}
function update_sous_categoriecequejeveux(){if(xmlhttp.readyState==4){if(xmlhttp.status==200){document.getElementById("sous_categorie_cequejeveux").innerHTML=xmlhttp.responseText;}}}
function update_sous_categoriecequejepeux(){if(xmlhttp.readyState==4){if(xmlhttp.status==200){document.getElementById("sous_categorie_cequejepeux").innerHTML=xmlhttp.responseText;}}}
function update_departement(){if(xmlhttp.readyState==4){if(xmlhttp.status==200){document.getElementById("departement").innerHTML=xmlhttp.responseText;}}}
function updatePoints(){if(xmlhttp.readyState==4){if(xmlhttp.status==200){document.getElementById("nb_points").innerHTML=xmlhttp.responseText;}}}
function profil_set_points(){var getdate=new Date();if(xmlhttp){var user_nom=document.getElementById("user_nom");var user_prenom=document.getElementById("user_prenom");var user_date_naissance=document.getElementById("datepicker");var user_telephone=document.getElementById("user_telephone");var user_site=document.getElementById("user_site");var user_presentation=document.getElementById("user_presentation");var user_adresse=document.getElementById("user_adresse");var user_region=document.getElementById("user_region");var user_code_postale=document.getElementById("user_code_postale");var user_ville=document.getElementById("user_ville");var user_avatar=document.getElementById("user_avatar");xmlhttp.open("POST","/users/printpoint",true);xmlhttp.onreadystatechange=updatePoints;xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');xmlhttp.send("user_nom="+user_nom.value+"&user_prenom="+user_prenom.value+"&user_date_naissance="+user_date_naissance.value+"&user_telephone="+user_telephone.value+"&user_site="+user_site.value+"&user_presentation="+user_presentation.value+"&user_adresse="+user_adresse.value+"&user_region="+user_region.value+"&user_code_postale="+user_code_postale.value+"&user_ville="+user_ville.value+"&user_prenom="+user_prenom.value+"&user_avatar="+user_avatar.value);}}
function set_code_postal(){if(xmlhttp.readyState==4){if(xmlhttp.status==200){document.getElementById("user_cp").innerHTML=xmlhttp.responseText;}}}
function ge_code_postal(){if(xmlhttp){var user_ville=document.getElementById("cities");xmlhttp.open("POST","/users/get_code_postal",true);xmlhttp.onreadystatechange=set_code_postal;xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');xmlhttp.send("user_ville="+user_ville.value);}}
function profil_set_points_insc(){var getdate=new Date();if(xmlhttp){var user_nom=document.getElementById("UserUserNom");var user_ville=document.getElementById("CityLocal");var user_state=document.getElementById("UserFkCountrieId");var user_date_naissance=document.getElementById("datepicker");xmlhttp.open("POST","/users/printpointinsc",true);xmlhttp.onreadystatechange=updatePoints;xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');xmlhttp.send("user_nom="+user_nom.value+"&user_ville="+user_ville.value+"&user_date_naissance="+user_date_naissance.value+"&user_state="+user_state.value);}}
function getSubCategories(){var getdate=new Date();if(xmlhttp){var categorie=document.getElementById("categorie");xmlhttp.open("POST","/produits/getsubcategories",true);xmlhttp.onreadystatechange=update_sous_categorie;xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');xmlhttp.send("categorie="+categorie.value);}}
function getSubCategories_troc(){var getdate=new Date();if(xmlhttp){var categorie=document.getElementById("categorie");xmlhttp.open("POST","/trocs/getsubcategories",true);xmlhttp.onreadystatechange=update_sous_categorie;xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');xmlhttp.send("categorie="+categorie.value);}}
function getSubCategories_service(){var getdate=new Date();if(xmlhttp){var categorie=document.getElementById("categorie");xmlhttp.open("POST","/services/getsubcategories",true);xmlhttp.onreadystatechange=update_sous_categorie;xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');xmlhttp.send("categorie="+categorie.value);}}
function getSubCategories_cequejeveux(){var getdate=new Date();if(xmlhttp){var categorie_cequejeveux=document.getElementById("categoriecequejeveux");xmlhttp.open("POST","/services/getsubcategories",true);xmlhttp.onreadystatechange=update_sous_categoriecequejeveux;xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');xmlhttp.send("categorie="+categorie_cequejeveux.value);}}
function getSubCategories_cequejepeux(){var getdate=new Date();if(xmlhttp){var categorie_cequejepeux=document.getElementById("categoriecequejepeux");xmlhttp.open("POST","/services/getsubcategories",true);xmlhttp.onreadystatechange=update_sous_categoriecequejepeux;xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');xmlhttp.send("categorie="+categorie_cequejepeux.value);}}
function getSubCategories_donner(){var getdate=new Date();if(xmlhttp){var categorie=document.getElementById("categorie");xmlhttp.open("POST","/produitdonners/getsubcategories",true);xmlhttp.onreadystatechange=update_sous_categorie;xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');xmlhttp.send("categorie="+categorie.value);}}
function getSubCategories_service_donner(){var getdate=new Date();if(xmlhttp){var categorie=document.getElementById("categorie");xmlhttp.open("POST","/servicedonners/getsubcategories",true);xmlhttp.onreadystatechange=update_sous_categorie;xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');xmlhttp.send("categorie="+categorie.value);}}
function getDepartements(){var getdate=new Date();if(xmlhttp){var r=document.getElementById("r");xmlhttp.open("POST","/recevoir-produit/departements",true);xmlhttp.onreadystatechange=update_departement;xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');xmlhttp.send("r="+r.value);}}
function no_high_price(){document.getElementById("no_high_price").innerHTML="Attention! Vous ne pouvez pas augmenter le prix";}
function valider_membre(id_interesses,type){$.ajax({type:'post',url:"/"+type+"/validerajax",spinner:'Chargement en cours...',cache:false,dataType:'json',data:{'user_id':id_interesses},async:true,beforeSend:function(){if(type=="produits"){$('#div_actions_'+id_interesses).html("<b>Demande acceptée</b>");}
if(type="produitdonners"){$('#div_actions_'+id_interesses).html("<b>Proposition acceptée</b>");}},success:function(data){}});$.fancybox.close();}
function prendre_ajax(id){$.ajax({type:'post',url:'/produits/prendre_ajax',spinner:'Chargement en cours...',cache:false,dataType:'json',data:{'data[id]':id},async:true,beforeSend:function(){$('.lien_aider_'+id).html("<b><span style='color:red;text-decoration:none'>Annuler ma demande</span></b>");},success:function(data){}});$.fancybox.close();}
function action_home(id,type){$('#div_prendre_'+id).toggle(300);$('#div_prendre_'+id).html('<div id="tweet-bar" class="tweet-bar-condensed"><div id="tweet-bar-form"><div id="tweet-bar-content"><div id="tweet-bar-content-3" style="width:485px" class="tweet-bar-content"><form method="post" action="/produits/prendre_home/'+id+'"><fieldset style="display:none;"><input type="hidden" value="POST" name="_method"></fieldset><div class="top-message-textarea"><textarea name="data[Produit][message]" id="comment_textarea" style="margin-left:10px;width:450px;color: black; overflow-x: hidden; overflow-y: hidden; " class="bordure textfield reset_champ">Je suis intéressé par ce don</textarea></div><div style="float: right; margin-top:10px"><div class="submit"><input type="submit" class="button" value="Je demande"></div></div><div style="clear: both;"> </div></form></div></div></div></div>');}
function action_home_accepter(id,type){$('#div_demander_'+id).toggle(300);$('#div_demander_'+id).html('<div id="tweet-bar" class="tweet-bar-condensed"><div id="tweet-bar-form"><div id="tweet-bar-content"><div id="tweet-bar-content-2" style="width:485px" class="tweet-bar-content"><form method="post" action="/produitdonners/demander_home/'+id+'"><fieldset style="display:none;"><input type="hidden" value="POST" name="_method"></fieldset><div class="top-message-textarea"><textarea name="data[Produitdonner][message]" id="comment_textarea" style="margin-left:10px;width:450px;color: black; overflow-x: hidden; overflow-y: hidden; " class="bordure textfield reset_champ">Je suis intéressé</textarea></div><div style="float: right; margin-top:10px"><div class="submit"><input type="submit" class="button" value="Je donne"></div></div><div style="clear: both;"> </div></form></div></div></div></div>');}
function offre_service(id,type){var getdate=new Date();if(xmlhttp){var id_service=document.getElementById("id_service");xmlhttp.open("POST","/"+type+"/validerajax",true);xmlhttp.onreadystatechange=handleServerResponse;xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');xmlhttp.send("user_id="+id);}}
function offre_produit(id,type){var getdate=new Date();if(xmlhttp){var id_produit=document.getElementById("id_produit");xmlhttp.open("POST","/"+type+"/validerajax",true);xmlhttp.onreadystatechange=handleServerResponse;xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');xmlhttp.send("user_id="+id);}}
function retirer_demande(type){var getdate=new Date();if(xmlhttp){var id_interesses=document.getElementById("id_interesses");xmlhttp.open("POST","/"+type+"/retirer_demande",true);xmlhttp.onreadystatechange=handleServerResponse;xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');xmlhttp.send("id_interesses="+id_interesses.value);}}
function retirer_demande_id(id,type){var action="demande";if(type=="produitdonners")action="proposition";if(confirm("Voulez-vous vraiment annuler votre "+action+" ?")){if(type=="produits")
$('.retirer_demande_'+id).html("<b>Votre demande a été retirée</b>");else
$('.retirer_demande_'+id).html("<b>Votre proposition a été retirée</b>");if(xmlhttp){xmlhttp.open("POST","/"+type+"/retirer_demande_id",true);xmlhttp.onreadystatechange=handleServerResponse;xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');xmlhttp.send("id_interesses="+id);}}}
function value_reset(e,o){if(o.firstTime){return;}
o.firstTime=true;o.value="";}
function surligner(val){var tr=document.getElementById(val);tr.style.background="#E6E6E6";}
function desurligner(val){var tr=document.getElementById(val);tr.style.background="#FFFFFF";}
function wbr2(str,num){var debut=false;v=str.replace(/;/g,"; ");s=v.replace(/,/g,", ");return s.replace(RegExp("(\\w{"+num+"})(\\w)","g"),function(all,text,char){if(text.indexOf("<")!=-1)debut=true;if(text.indexOf(">")!=-1)debut=false;if(debut)return text+char;return text+"<wbr>\n"+char;});}
function add_files(){return false;}
function ismaxlength(obj){var mlength=obj.getAttribute?parseInt(obj.getAttribute("maxlength")):"";if(obj.getAttribute&&obj.value.length>mlength)obj.value=obj.value.substring(0,mlength);}
function add_files_exprimez(){$('.add_files_exprimez').show();}
function display_description(type){if(type==1)$('#description_donner').show();if(type==2)$('#description_demander').show();}
function add_points(){$(document).ready(function(){$("#nb_points").load("/users/getpoint_");});}
function lookup(inputString){if(inputString.length==0){$('#suggestions').fadeOut();}else{$.post("/seek/searchit",{queryString:""+inputString+""},function(data){$('#suggestions').fadeIn();$('#suggestions').html(data);});}}
