/* post.js */

var validation_options={};var POST=(function(B,A){var C={details:{},current_cat:"",current_subcat:"",posting_url:"",disableGeoSearch:false,init:function(){B("#postingsubcategory").change(function(){if(this.value!=""){this.current_subcat=this.value;if(disclaimers[this.current_subcat]||disclaimers[this.current_cat]){if(agree_disclaimer!=true){B("#disclaimer_no").attr("checked","checked");}}else{B("#step_beware").hide();this.getSpecFields();B("#vs-element-disclaimer").html("");B("#vs-element-disclaimer").hide();
}}else{B("#step_beware").hide();B("#spec").hide();}});},getSpecFields:function(){B.post(this.posting_url,"xmlhttprequest=1&a=getSpec&modify="+(window.query["modify"]||"")+"&cat="+this.cur_subcat+(agree_disclaimer==true?"&disclaimer=agreed":"")+"&"+B.param(paramvalues),function(D,F,E){B("#spec").html(D);POST.showSpecFields();B("#postform").validate(validation_options);B("#postingForm-loading").hide();},"html");this.addTooltips();},showSpecFields:function(){B("#step_two").show();B("#step_three").show();
B("#step_four").show();B("#step_captcha").show();this.toggleStepOneCaption(true);this.initSectionSelects();if(B("#postingsubcategory").val()=="job_seekers"){}else{if(B("#postingsubcategory").val()=="job_offers"){}else{if(B("#postingsubcategory").val()=="internships"){}else{if(B("#postingsubcategory").val()=="insurance"){}else{if(B("#postingsubcategory").val()=="mlm_commission"){}else{if(0<B("#posting_resume_step").length){B("#posting_resume_step").hide();}}}}}}if(0<B("#selectedGeo").val()&&(false===this.disclaimer_active||(true===this.disclaimer_active&&true===this.disclaimer_agreed))){POSTFORM.loadFeaturedPlans();
}this.addTooltips();},validateCaptcha:function(E,D,G){if(window.console){console.log("Validating captcha...");}var D=D||function(H){LIGHTBOX.updateLogMessage(__("postform_validate"),"success");LIGHTBOX.hideLogger(3000);};var G=G||function(H){LIGHTBOX.updateLogMessage(__("postform_validate"),"error");LIGHTBOX.hideLogger(3000);};LIGHTBOX.updateLogMessage(__("postform_validate"),"loading");if(document.location.toString().indexOf("#")>0){var F=document.location.toString().substring(0,document.location.toString().indexOf("#"));
}else{var F=document.location.toString();}B.post(F,{xmlhttprequest:1,a:"validateCaptcha",captcha:E.elements["captcha"].value},function(H){if(H.code=="error"){B("#captcha").parent().parent().addClass("vs-posting-error");if(window.console){console.log("Captcha error",H);}G(H.code);POSTFORM.resetCaptcha(POST.getAuthType());}else{B("#captcha").parent().parent().removeClass("vs-posting-error");B("#captcha").parent().next().html("");D(H.code);if(window.console){console.log("Captcha response",H);}}},"json");
},getAuthType:function(){var D=false;if(A.isLogged()){D="logged";}else{if(B("#posting_auth_login").is(":checked")){D="login";}else{if(B("#posting_auth_register").is(":checked")){D="register";}else{if(B("#posting_auth_no_account").is(":checked")){D="no_account";}}}}return D;},authorize:function(E,D,F){if(window.console){console.log("Validating login...");}var D=D||function(I){LIGHTBOX.updateLogMessage(__("postform_validate"),"success");LIGHTBOX.hideLogger(3000);};var F=F||function(I){LIGHTBOX.updateLogMessage(__("postform_validate"),"error");
LIGHTBOX.hideLogger(3000);};LIGHTBOX.updateLogMessage(__("postform_validate"),"loading");var G="";if(B("#posting_auth_login").is(":checked")){G="login";}else{if(B("#posting_auth_register").is(":checked")){G="register";}else{if(B("#posting_auth_no_account").is(":checked")){G="no_account";}}}switch(G){case"login":var H={};H["action"]="login";H["email"]=E.elements["login_email"].value;H["password"]=E.elements["login_password"].value;H["phone"]=E.elements["login_phone_nbr"].value;H["captcha"]=E.elements["captcha"].value;
H["from_partners"]=(E.elements["from_partners"]&&E.elements["from_partners"].checked?"yes":"no");H["country"]=A.country_geo.code.toLowerCase();H["checkdupe"]=1;H["fromPostform"]=1;if(A._url_affiliate_info.code){H["affiliate_code"]=A._url_affiliate_info.code;}H["domain"]=A._gpc_domain;H["rand"]=Math.round(Math.random()*1000000000);B.post(A._ajax_dir+"authorize.php",H,function(I,J,K){if(I.length>0){I=I[0];if(window.console){console.log("Login requested",I,J);}switch(I.code){case"blocked_user":case"disabled_user":case"invalid_email":case"incorrect_email_password":case"incorrect_username":case"invalid_captcha":B("#login_email").parent().parent("tr").addClass("vs-posting-error");
B("#login_email").parent().next("td").html(__("postform_login_mail_posting"));login_validated=false;POSTFORM.resetCaptcha("login");F(I.code);break;case"login_successful":A.updateGFVivaCookie(B.toJSON([I]));B("#login_email").parent().parent("tr").removeClass("vs-posting-error");B("#login_email").parent().next("td").html("");B("#login_password").parent().parent("tr").removeClass("vs-posting-error");B("#login_password").parent().next("td").html("");login_validated=true;D(I.code);break;}}},"json");break;
case"no_account":var H={};H["action"]="force-no_account";H["email"]=E.elements["no_account_email"].value;H["password"]="";H["phone"]=E.elements["no_account_phone_nbr"].value;H["captcha"]=E.elements["captcha"].value;H["from_partners"]=(E.elements["from_partners"]&&E.elements["from_partners"].checked?"yes":"no");H["country"]=A.country_geo.code.toLowerCase();H["checkdupe"]=1;H["fromPostform"]=1;if(A._url_affiliate_info.code){H["affiliate_code"]=A._url_affiliate_info.code;}H["domain"]=A._gpc_domain;H["rand"]=Math.round(Math.random()*1000000000);
B.post(A._ajax_dir+"authorize.php",H,function(I,J,K){if(I.length>0){I=I[0];if(window.console){console.log("Registration requested",I,J);}switch(I.code){case"blocked_user":case"disabled_user":case"invalid_email":F(I.code);B("#no_account_email").parent().parent("tr").addClass("vs-posting-error").scrollTo();B("#no_account_email").parent().next("td").html(__("postform_register_mail_posting"));login_validated=false;POSTFORM.resetCaptcha("register");break;case"duplicate_email":F(I.code);B("#posting_auth_login").click().attr("checked","checked").scrollTo();
POSTFORM.changeAuthType(B("#login"),"login");B("#login_email").parent().parent("tr").addClass("vs-posting-error");B("#login_email").parent().next("td").html(__("postform_register_dupe_email"));B("#login_email").val(H["email"]);login_validated=false;POSTFORM.resetCaptcha("login");break;case"register_failed":F(I.code);B("#register_email").parent().parent("tr").addClass("vs-posting-error").scrollTo();B("#register_email").parent().next("td").html(__("postform_register_error"));login_validated=false;POSTFORM.resetCaptcha("register");
break;case"invalid_captcha":F(I.code);B("#captcha").parent().parent("tr").addClass("vs-posting-error");B("#captcha").parent().next("td").html(__("postform_register_captcha"));login_validated=false;POSTFORM.resetCaptcha("register");break;case"no_civility":case"no_year":F(I.code);if("no_civility"===I.code){B("#register_civility_posting").parent().parent("tr").addClass("vs-posting-error");}else{if("no_year"===I.code){B("#register_year_posting").parent().parent("tr").addClass("vs-posting-error");}}login_validated=false;
POSTFORM.resetCaptcha("register");break;case"login_successful":case"no_account_successful":D(I.code);B("#authorize_method").val(I.via);login_validated=true;break;}}},"json");break;case"register":var H={};H["action"]="register";H["email"]=E.elements["register_email"].value;H["password"]=E.elements["register_password"].value;H["username"]=E.elements["register_username"].value;if("undefined"!==typeof (E.elements["register_civility_posting"])){H["civility"]=E.elements["register_civility_posting"].value;
}if("undefined"!==typeof (E.elements["register_year_posting"])){H["year"]=E.elements["register_year_posting"].value;}H["phone"]=E.elements["register_phone_nbr"].value;H["captcha"]=E.elements["captcha"].value;H["from_partners"]=(E.elements["from_partners"]&&E.elements["from_partners"].checked?"yes":"no");H["country"]=A.country_geo.code.toLowerCase();H["checkdupe"]=1;H["fromPostform"]=1;if(A._url_affiliate_info.code){H["affiliate_code"]=A._url_affiliate_info.code;}H["domain"]=A._gpc_domain;H["rand"]=Math.round(Math.random()*1000000000);
B.post(A._ajax_dir+"authorize.php",H,function(I,J,K){if(I.length>0){I=I[0];if(window.console){console.log("Registration requested",I,J);}switch(I.code){case"blocked_user":case"disabled_user":case"invalid_email":B("#no_account_email").parent().parent("tr").addClass("vs-posting-error").scrollTo();B("#no_account_email").parent().next("td").html(__("postform_register_mail_posting"));login_validated=false;POSTFORM.resetCaptcha("register");F(I.code);break;case"duplicate_email":B("#posting_auth_login").click().attr("checked","checked").scrollTo();
POSTFORM.changeAuthType(B("#login"),"login");B("#login_email").parent().parent("tr").addClass("vs-posting-error");B("#login_email").parent().next("td").html(__("postform_register_dupe_email"));B("#login_email").val(H["email"]);login_validated=false;POSTFORM.resetCaptcha("login");F(I.code);break;case"register_failed":B("#register_email").parent().parent("tr").addClass("vs-posting-error").scrollTo();B("#register_email").parent().next("td").html(__("postform_register_error"));login_validated=false;POSTFORM.resetCaptcha("register");
F(I.code);break;case"invalid_captcha":B("#captcha").parent().parent("tr").addClass("vs-posting-error");B("#captcha").parent().next("td").html(__("postform_register_captcha"));login_validated=false;POSTFORM.resetCaptcha("register");F(I.code);break;case"no_civility":case"no_year":if("no_civility"===I.code){B("#register_civility_posting").parent().parent("tr").addClass("vs-posting-error");}else{if("no_year"===I.code){B("#register_year_posting").parent().parent("tr").addClass("vs-posting-error");}}login_validated=false;
POSTFORM.resetCaptcha("register");F(I.code);break;case"login_successful":case"no_account_successful":A.updateGFVivaCookie(B.toJSON([I]));D(I.code);B("#authorize_method").val(I.via);login_validated=true;break;}}},"json");}}};return C;})($J,VIVASTREET);$J(document).ready(function(){var A=VIVASTREET._ajax_path;var C=false;var E=false;var D=false;var B=false;$J.extend($J.validator.messages,{required:__("posting_noempty_error"),number:__("posting_number_error"),digits:__("posting_number_error"),email:__("posting_email_error")});
$J.validator.addMethod("title",function(G,F){return(G!=""&&G!=$J(F).attr("title"));},__("posting_noempty_error"));$J.validator.addMethod("register_email",function(G,F){return $J("#register_email").val()===$J("#register_email_confirm").val();},__("posting_email_error"));$J.validator.addMethod("valid_geo",function(G,F){return $J("#selectedGeo").val()>0;},__("posting_noempty_error"));validation_options={debug:true,ignore:"input[disabled=disabled], input:hidden, select:hidden",errorClass:"vs-posting-error",meta:"validate",messages:{captcha:{required:__("posting_captcha_invalid")},detail:{maxlength:__("add_comment_message_long")}},rules:{postingGeo_1:{required:function(){return GEOSEARCH.multiLevel;
}},postingGeo_2:{required:function(){return(GEOSEARCH.multiLevel&&1<$J("#postingGeo_2").children("option").length);}},postingGeo_3:{required:function(){return(GEOSEARCH.multiLevel&&1<$J("#postingGeo_3").children("option").length);}},title:{required:true,minlength:0,maxlength:60},offer_type:{required:true},individual_type:{required:true},from_partners:{required:true},detail:{required:true,minlength:15,maxlength:12000,title:true},transport_posting:{required:function(F){return $J("#abroad_posting:checked").length>0;
}},transport_posting_abroad:{required:function(F){return $J("#abroad_posting:checked").length>0;}},captcha:{required:true,minlength:5,maxlength:5},register_email:{required:function(F){return $J("#posting_auth_register:checked").length>0;},minlength:6,maxlength:255,email:true},register_email_confirm:{required:function(F){return $J("#posting_auth_register:checked").length>0;},minlength:6,maxlength:255,email:true,register_email:true},register_password:{required:function(F){return $J("#posting_auth_register:checked").length>0;
}},register_username:{required:function(F){return $J("#posting_auth_register:checked").length>0;}},register_phone_nbr:{required:false,minlength:0,maxlength:32},register_civility_posting:{required:function(){return(-1<$J.inArray(VIVASTREET._country_geo[1],["FR","AR","BR","CO","CL","MX","VE"]));}},login_email:{required:function(F){return $J("#posting_auth_login:checked").length>0;},minlength:6,maxlength:255,email:true},login_password:{required:function(F){return $J("#posting_auth_login:checked").length>0;
}},login_phone_nbr:{required:false,minlength:0,maxlength:32},no_account_email:{required:function(F){return $J("#posting_auth_no_account:checked").length>0;},minlength:6,maxlength:255,email:true},no_account_phone_nbr:{required:false,minlength:0,maxlength:32},plan_id:{required:function(F){return $J(".vs-posting-plans tr td.vs-plan-radio").length>0;}},repost_plan_id:{required:function(F){return $J("input[name=repost_plan]:checked").length>0;}}},errorPlacement:function(F,G){F.appendTo(G.parent().next("td"));
},highlight:function(H,F,G){if("checkbox"===$J(H).attr("type")&&$J(H).attr("id")!="italy_terms_yes"&&$J(H).attr("id")!="italy_terms_yes2"){$J(H).parent().parent().parent().parent().parent().parent("tr").addClass(F).removeClass(G);}else{if($J(H).parent().parent().parent().parent().hasClass("vs-posting-plans")){$J(H).parent().parent().parent().parent().parent().parent().addClass(F).removeClass(G);}else{$J(H).parent().parent("tr").addClass(F).removeClass(G);}}},unhighlight:function(H,F,G){if($J(H).parent().parent().parent().parent().hasClass("vs-posting-plans")){$J(H).parent().parent().parent().parent().parent().parent().addClass(G).removeClass(F);
}else{$J(H).parent().parent("tr").removeClass(F).addClass(G);}},submitHandler:function(F){if($J("#searchGeo_text").is(":visible")&&0>=$J("#selectedGeo").val()){$J("#searchGeo_text").focus().parent().parent("tr").addClass("vs-posting-error");$J("#searchGeo_text").parent().next("td").html(__("posting_noempty_error"));}else{$J("#searchGeo_text").parent().parent("tr").removeClass("vs-posting-error");$J("#searchGeo_text").parent().next("td").html("");LIGHTBOX.showLogger();if(false==VIVASTREET.isLogged()){POST.authorize(F,function(){POST.validateCaptcha(F,function(){LIGHTBOX.updateLogMessage(__("postform_validate"),"success");
LIGHTBOX.addLogMessage(__("postform_uploading"),"loading");setTimeout(function(){F.submit();},1000);});});}else{POST.validateCaptcha(F,function(){LIGHTBOX.updateLogMessage(__("postform_validate"),"success");LIGHTBOX.addLogMessage(__("postform_uploading"),"loading");setTimeout(function(){F.submit();},1000);});}return false;}}};});var POSTFORM=new Object();var CHECKS=new Object();var post_debug=function(A){if(window.console){console.log("DEBUG::POSTING::",A);}};POSTFORM={server:"post.php",cur_cat:0,cur_subcat:0,cur_subcat_label:0,spec_subcat:0,cur_province:0,cur_region:0,form_validated:false,cur_zipcode:0,pictures:1,temp_values:[],errors:0,error_fields:[],logged_msg:"",selectSectionClones:{},step_one_valid:false,step_two_valid:false,step_three_valid:false,step_four_valid:false,step_captcha_value:false,error_element:false,skip_validate_error:false,skip_validate_geo_error:false,lbOnLoadAllow:false,loadedForeignSelect:false,trackerErrors:[],dontRaiseCaptcha:false,tempSelectedGeo:0,user_data:{civility:"",year_born:0,company_name:"",company_number:"",display_company:""},disclaimer_active:false,disclaimer_agreed:false,sold_out_spec:"",sold_out_spec_onchange:null,_uploadImageCount:0,_uploadImageIndex:0,_uploadImageModified:false,_imageCountSet:false,init:function(){console.log("initing POSTFORM");
if(validate==true){this.form_validated=true;this.cur_cat=previous_cat;this.cur_subcat=previous_subcat;if(agree_disclaimer==true){this.disclaimer_agreed=true;$J("#disclaimer_yes").attr("checked",true);if($J("#postal_posting").length&&$J("#postal_posting").val()!=""){this.checkZipcode();}}this.cur_province=previous_prov;this.cur_region=previous_city;}this.addEvents();this.initSectionSelects();if(this.cur_subcat!=0){$J("#postingsubcategory").val(this.cur_subcat);this.updateSubCat();if($J("#postingsubcategory").hasClass("vs-featured-ad")||0<$J("#featuredPlan").val()){$J("#postingsubcategory_alt").val($J("#postingsubcategory").val());
$J("#postingsubcategory").disable();}}if(agree_disclaimer==true){$J("disclaimer_yes").attr("checked","checked");if(""!=$J("#postingsubcategory").val()){this.getSpecFields();}}agree_disclaimer=false;POSTFORM.lbOnLoadAllow=true;},addEvents:function(){$J("#postingsubcategory").change(function(){POSTFORM.updateSubCat();document.body.focus();});$J("#disclaimer_yes").click(function(){POSTFORM.agreedisclaimer();});$J("#disclaimer_no").change(function(){if(true==$J("#disclaimer_no").is(":checked")){$J("#postingsubcategory").val("");
POSTFORM.updateSubCat();}});if($J("#detail").attr("title")===$J("#detail").val()){$J("#detail").css({color:"#888888"});$J("#detail").click(function(){$J("#detail").html("");$J("#detail").css({color:"#000000"});$J("#detail").unbind("click");});}this.addTooltips();},addTooltips:function(){$J(".caption-info").tooltip({bodyHandler:function(){return $J(this).next().html();},showURL:false,track:true});},emptySelect:function(A){A.innerHTML="";},initCats:function(){oOption=document.createElement("OPTION");
oOption.value="";oOption.label=mess["select_first_option"];oOption.text=mess["select_first_option"];var A=document.forms.postform.elements.postingcategory;A.options[A.options.length]=oOption;var B=0;for(row in cats){if(typeof (cats[row])=="function"){continue;}oOption=document.createElement("OPTION");oOption.value=row;oOption.label=cats[row];oOption.text=cats[row];if(row==this.cur_cat){oOption.selected="selected";B=A.options.length;}A.options[A.options.length]=oOption;}A.selectedIndex=B;$J(A).show();
$J("#category_loading").hide();},getCat:function(){return document.forms.postform.elements.postingcategory.value;},setCat:function(){this.cur_cat=this.getCat();},updateCat:function(){this.setCat();if(!validate){this.cur_subcat=0;}if(agree_disclaimer!=true){$("#disclaimer_no").attr("checked","checked");}$J("#step_beware").hide();this.resetSpecFields();var A=document.forms.postform.elements.postingsubcategory;this.emptySelect(A);oOption=document.createElement("OPTION");oOption.value="";oOption.label=mess["select_first_option"];
oOption.text=mess["select_first_option"];A.options[A.options.length]=oOption;var B=0;for(row in subcats[this.cur_cat]){if(typeof (subcats[this.cur_cat][row])=="function"){continue;}if(ssubcats[row]){oGroup=document.createElement("OPTGROUP");oGroup.value="";oGroup.label=subcats[this.cur_cat][row];oGroup.text=subcats[this.cur_cat][row];try{A.appendChild(oGroup);}catch(C){A.options[A.options.length]=oGroup;}for(srow in ssubcats[row]){if(typeof (ssubcats[row][srow])=="function"){continue;}oOption=document.createElement("OPTION");
oOption.value=srow;oOption.label="- "+ssubcats[row][srow];oOption.text="- "+ssubcats[row][srow];if(srow==this.cur_subcat){oOption.selected="selected";B=A.options.length;}A.options[A.options.length]=oOption;}}else{oOption=document.createElement("OPTION");oOption.value=row;oOption.label=subcats[this.cur_cat][row];oOption.text=subcats[this.cur_cat][row];if(row==this.cur_subcat){oOption.selected="selected";B=A.options.length;}A.options[A.options.length]=oOption;}}A.selectedIndex=B;$J(A).up(1).show();
$J(A).show();},getSubCat:function(A){return !A?document.forms.postform.elements.postingsubcategory.value:document.forms.postform.elements.postingsubcategory;},setSubCat:function(){this.cur_subcat=this.getSubCat();},updateSubCat:function(){this.setSubCat();if($J(this.getSubCat(true)[this.getSubCat(true).selectedIndex]).hasClass("vs-cat-xml")){if(disclaimers[this.cur_subcat]||disclaimers[this.cur_cat]){if(agree_disclaimer!=true){$J("#disclaimer_no").attr("checked","checked");}this.showdisclaimer();
this.resetSpecFields();}else{$J("#step_beware").hide();this.getSpecFields(agree_disclaimer==true?"&disclaimer=agreed":"");$J("#vs-element-disclaimer").html("");$J("#vs-element-disclaimer").hide();}}else{$J("#step_beware").hide();this.resetSpecFields();}},showTransport:function(A){var A=("yes"==A);console.log("Calling showTransport: "+(A?"yes":"no"));$J("#transport_posting_abroad").parent().parent()[A?"show":"hide"]();$J("#transport_posting_abroad")[A?"show":"hide"]();if(A){$J("#transport_posting_abroad").attr("onchange","CHECKS.noempty(this);");
}else{$J("#transport_posting_abroad").attr("onchange","");$J("#transport_posting_abroad").attr("disabled","disabled");}},abroadOnly:function(A){console.log("POST.abroadOnly",A);if(""==A){return ;}if("block"==A){POSTFORM.abroadOnly("no");$J("#abroad_posting").parent().parent().hide();$J("#transport_posting").parent().parent().hide();return ;}else{var B=("yes"==A);}$J("abroad_posting").attr("checked",B);POSTFORM.setAbroad(B);$J("#abroad_posting").parent("tr")[B?"hide":"show"]();$J("#transport_posting_geo")[B?"hide":"show"]();
$J("#transport_posting_abroad")[B?"show":"hide"]();if(B){$J("#transport_posting").attr("onblur","CHECKS.noempty(this);");}else{$J("#transport_posting").attr("onblur","");}},setAbroad:function(C,A){console.log("POST.setAbroad");var C=C;var A="undefined"==typeof (A)?true:A;if(!this.enabledPostingGeos){this.enabledPostingGeos=[];}if(true==C){if(!GEOSEARCH.freeText){for(var D=1;D<=POSTFORM.maxDepth;D++){var B=$J("#postingGeo_"+D);if(false==B.attr("disabled")){this.enabledPostingGeos.push(B.attr("id"));
}B.up(1)[true===C?"hide":"show"]();B[(false===C&&-1!==$J.inArray(B.attr("id"),this.enabledPostingGeos))?"enable":"disable"]();}}else{var B=$J("#searchGeo_text");B.up(1)[true===C?"hide":"show"]();B[false===C?"enable":"disable"]();if(true===C){POSTFORM.tempSelectedGeo=$F("selectedGeo");$J("#selectedGeo").val(0);}else{$J("#selectedGeo").val(POSTFORM.tempSelectedGeo);}if(0<$J("#featuredAd").val()||0<$J("#featuredPlan").val()){B.disable();}}}$J("#foreignCountry")[true===C?"hide":"show"]();$J("#foreignCountry").up(1)[false===C?"hide":"show"]();
if(true===C){this.loadedForeignSelect=true;$J("#foreignCountry-loading").show();$J("#foreignCountry-caption").hide();$J("select[id^=postingGeo]").parent().parent().hide();setTimeout(function(){$J("#foreignCountry-loading").hide();$J("#foreignCountry").show();$J("#foreignCountry-caption").show();},1500);}else{if(false===POST.disableGeoSearch){if(true===GEOSEARCH.freeText){$J("#searchGeo_text").enable().show().parent().parent().show();}else{if(true===GEOSEARCH.multiLevel){$J("#postingGeo_1").enable().show().parent().parent().show();
}}}}if(!this.sold_out_spec||!this.sold_out_spec.val()||this.sold_out_spec.attr("name")!=="foreignCountry"){$J("#foreignCountry")[true===C?"enable":"disable"]();}if(true==$J("#foreignCountry").is(":enabled")||(this.sold_out_spec&&this.sold_out_spec.attr("name")=="foreignCountry")){POSTFORM.loadFeaturedPlans();}if(!A||!C){delete (this.enabledPostingGeos);}},selectGeo:function(C,B){var A=$J("#postingGeo_"+B);if(null!=A){A.children().each(function(D){if(D.value==C){D.selected=true;}else{D.selected=false;
}});}},resetGeo:function(){$J("#searchGeo_text").val("");$J("#selectedGeo").val(0);$J("#postingGeo_1").val(0);POSTFORM.loadFeaturedPlans();return false;},setPostingGeo:function(A,D){$J("#selectedGeo").val(A);POSTFORM.tempSelectedGeo=A;if(GEOSEARCH.freeText){var C="postingGeo_1";if(parseInt(D)>1){GEOSEARCH.getGeoTree(A,function(E){try{$J("#searchGeo_text").val(E[E.length-1].label);var F=$J("#"+C+" option[value="+E[0].id+"]").get(0);if(F){$J(C).selectedIndex=F.index;}POSTFORM.loadFeaturedPlans();}catch(G){if(window.console){console.log(G);
}}});}else{var B=$J("#"+C+" option[value="+A+"]").get(0);if(B){$J("#"+C).selectedIndex=B.index;}$J("#searchGeo_text").val(B.text);}}},initGeo:function(B){if(true==GEOSEARCH.freeText){$J("#searchGeo_text").autocomplete({minLength:2,source:"/ajax/autocomplete_geo.php?post=yes",select:function(C,D){$J("#selectedGeo").val(D.item.id);$J("#searchGeo_text").rules("add",{required:function(){return GEOSEARCH.freeText&&$J("#selectedGeo").val()==0;},valid_geo:function(){return $J("#searchGeo_text").is(":visible");
}});POSTFORM.loadFeaturedPlans();},change:function(C,D){if($J("#searchGeo_text").val().length<=1){$J("#selectedGeo").val("");}},close:function(C,D){if($J("#searchGeo_text").val().length>0&&POSTFORM._hasGeoResults==true&&($J("#selectedGeo").val().length<=0||$J("#selectedGeo").val()==0)){$J("#selectedGeo").val($J("ul.ui-autocomplete li:first a").attr("rel"));$J("#searchGeo_text").val($J("ul.ui-autocomplete li:first a").text());$J("#searchGeo_text").rules("add",{required:function(){return GEOSEARCH.freeText&&$J("#selectedGeo").val()==0;
},valid_geo:function(){return $J("#searchGeo_text").is(":visible");}});POSTFORM.loadFeaturedPlans();}}}).keyup(function(){if($J("#searchGeo_text").val().length<=1){$J("#selectedGeo").val("");}POSTFORM._hasGeoResults=false;}).data("autocomplete")._renderItem=function(C,D){POSTFORM._hasGeoResults=true;return $J("<li></li>").data("item.autocomplete",D).append('<a rel="'+D.id+'">'+D.label+"</a>").appendTo(C);};}else{if(true==GEOSEARCH.multiLevel){$J.ajax({url:"/ajax/regions.php",data:{level:1,parent_id:1},success:function(C){for(var E in C){var D=C[E];
$J("#postingGeo_1").append('<option value="'+E+'">'+D[0]+"</option>");}},async:false,dataType:"json"});if(false==POST.disableGeoSearch){$J("#postingGeo_1").removeAttr("disabled");}for(var A=1;A<=5;A++){$J("#postingGeo_"+A).change(function(){var D=$J(this);$J("#selectedGeo").val(D.val());var E=parseInt(D.attr("id").substring(D.attr("id").length-1));for(var C=(E+1);C<=5;C++){$J("#postingGeo_"+C).html('<option value=""></option>').hide();}if(5>E){$J.get("/ajax/regions.php",{level:(E+1),parent_id:D.val()},function(G){for(var I in G){var H=G[I];
if("undefined"!==typeof (H[0])){$J("#postingGeo_"+(E+1)).append('<option value="'+I+'">'+H[0]+"</option");}}if($J("#postingGeo_"+(E+1)).children("option").length>1){$J("#postingGeo_"+(E+1)).removeAttr("disabled").show().parent().parent().show();}else{POSTFORM.loadFeaturedPlans();for(var F=5;F>E;F--){$J("#postingGeo_"+F).attr("disabled","disabled").hide().parent().parent().hide();}}},"json");}});}}}if("undefined"!=typeof (B)){if(true==GEOSEARCH.freeText&&null!=B["text"]){$J("#searchGeo_text").val(B["text"]);
}else{if(true==GEOSEARCH.multiLevel&&null!=B["id"]){$J.get("/ajax/regions_tree.php",{geo_id:B["id"]},function(D){for(var C=0;C<D.length;C++){$J("#postingGeo_"+(C+1)).append('<option value="'+D[C]["id"]+'">'+D[C]["label"]+"</option>").show().val(D[C]["id"]).parent().parent().show();if(false==POST.disableGeoSearch){$J("#postingGeo_"+(C+1)).enable();}}},"json");}}if(null!=B["id"]){$J("#selectedGeo").val(B["id"]);}console.log("#selectedGeo set to "+B["id"]);}},initProvinces:function(){oOption=document.createElement("OPTION");
oOption.value="";oOption.label=mess["select_first_option"];oOption.text=mess["select_first_option"];var A=document.forms.postform.elements.postingprovince;A.options[A.options.length]=oOption;var B=0;for(row in regions){if(typeof (provinces[row])=="function"){continue;}oOption=document.createElement("OPTION");oOption.value=row;oOption.label=provinces[row];oOption.text=provinces[row];if(row==previous_prov){oOption.selected="selected";B=A.options.length;}A.options[A.options.length]=oOption;}A.selectedIndex=B;
if(previous_city){POSTFORM.cur_region=previous_city;POSTFORM.updateProvince();}},getProvince:function(){return document.forms.postform.elements.postingprovince.value;},setProvince:function(){this.cur_province=this.getProvince();},updateProvince:function(){this.setProvince();var A=document.forms.postform.elements.postingregion;this.emptySelect(A);oOption=document.createElement("OPTION");oOption.value="";oOption.label=mess["select_first_option"];oOption.text=mess["select_first_option"];var B=0;A.options[A.options.length]=oOption;
for(row in regions[this.cur_province]){if(typeof (regions[this.cur_province][row])=="function"){continue;}oOption=document.createElement("OPTION");oOption.value=row;oOption.label=regions[this.cur_province][row];oOption.text=regions[this.cur_province][row];if(row==this.cur_region){oOption.selected="selected";B=A.options.length;}A.options[A.options.length]=oOption;}A.selectedIndex=B;$J(A).show();},initRegions:function(){oOption=document.createElement("OPTION");oOption.value="";oOption.label=mess["select_first_option"];
oOption.text=mess["select_first_option"];var A=document.forms.postform.elements.postingregion;A.options[A.options.length]=oOption;for(row in regions){if(typeof (regions[row])=="function"){continue;}oOption=document.createElement("OPTION");oOption.value=row;oOption.label=regions[row];oOption.text=regions[row];if(row==this.cur_region){oOption.selected="selected";}A.options[A.options.length]=oOption;}},getRegion:function(){return document.forms.postform.elements.postingregion.value;},setRegion:function(){this.cur_region=this.getRegion();
},updateRegion:function(){this.setRegion();},initSectionSelects:function(){if(0<$J('select[onchange^="POSTFORM.showSection"]').length){$J("option[class^=section]").each(function(A,B){POSTFORM.selectSectionClones[$J(B).attr("value")]=$J(B).clone();});POSTFORM.selectSectionClones[""]=null;$J("option[class^=section]").parent().html("<option value=''>"+__("posting_select_previous")+"</option>").disable();if(""!==$J('select[onchange^="POSTFORM.showSection"]').val()){$J('select[onchange^="POSTFORM.showSection"]').change();
}}},showSection:function(E,A){var B=$J(E).val().toLowerCase();var D=$J("select[name="+A+"]").enable().html("<option value=''>"+__("form_post_select_option")+"</option>");for(var F in POSTFORM.selectSectionClones){var C=$J(POSTFORM.selectSectionClones[F]);if(""!==F&&C.attr("class")!="section_"+B.replace(/([\/\ \/\'])/,"-").replace(/(-{1,})/,"-").replace(/([^\S+])/,"-")){$J("option[value="+F+"]").remove();}else{D.append(C);}}if(D.children().length<2){D.parent().parent().hide();}else{D.parent().parent().show();
}},showdisclaimer:function(){if("undefined"==typeof (window.query["modify"])&&"undefined"==typeof (window.query["repost"])){content_disclaimer="post.php?disclaimer&cat=";if(disclaimers[this.cur_subcat]){content_disclaimer=content_disclaimer+this.cur_subcat;}else{if(disclaimers[this.cur_cat]){content_disclaimer=content_disclaimer+this.cur_cat;}}$J("#idisclaimer").load(content_disclaimer);$J("#step_beware").show();}},agreedisclaimer:function(){if($J("#disclaimer_yes").is(":checked")){this.disclaimer_agreed=true;
this.getSpecFields();}else{this.resetSpecFields();}},changePlan:function(B,A){var B=$J(B);if(0==B.val()||$J("input[name=plan_id]:last").val()==B.val()){this.paymentButton(this.planChecked());if("repost_plan_id"!==B.attr("name")){$J(":input",$J(".vs-posting-plans-secondary").fadeIn()).removeAttr("disabled");}}else{if(0<B.val()){this.paymentButton(true);if("repost_plan_id"!==B.attr("name")){$J(":input",$J(".vs-posting-plans-secondary").fadeOut()).attr("disabled","disabled");}}}if("undefined"!==typeof (A)){this.paymentButton(A);
}},planChecked:function(){return(0<$J("input[name=plan_id]:radio:checked").val()||0<$J("input[name=plan_id]:hidden").val()||0<$J(".vs-posting-plans-secondary input:checkbox:visible:checked").length);},paymentButton:function(A){if(true===A){$J("#publish_button").hide();$J("#preview_button").removeClass("vs-input-button-dark").addClass("vs-input-button-green").val(mess["post_payment"]);}else{$J("#publish_button").show();$J("#preview_button").removeClass("vs-input-button-green").addClass("vs-input-button-dark").val(mess["post_preview"]);
}return true;},loadFeaturedPlans:function(){var A=false;if(this.sold_out_spec&&""===this.sold_out_spec.val()){A=true;}if(true===A||(true===this.disclaimer_active&&false===this.disclaimer_agreed)||((!$J("#foreignCountry").is(":disabled")||(this.sold_out_spec&&this.sold_out_spec.attr("name")=="foreignCountry"))&&(!this.cur_subcat||0==this.cur_subcat||((!$J("#selectedGeo").val()||0==$J("#selectedGeo").val())&&!this.loadedForeignSelect)||$J("#step_featured").hasClass("vs-featured-ad")))){$J("#step_featured").hide();
$J("#step_featured_plans").hide();return ;}if(this.cur_subcat&&0<$J("#selectedGeo").val()){if(1<$J("#step_featured_plans input").length){$J("#step_featured_plans").show();}else{$J("#step_featured_plans").hide();}}var B=(this.sold_out_spec?this.sold_out_spec.val():"");if(this.sold_out_spec&&this.sold_out_spec.attr("name")=="foreignCountry"){B=this.sold_out_spec.children("option:selected").html();}$J.post(this.server,{xmlhttprequest:1,a:"getPlans",geo:$J("#selectedGeo").val(),cat:this.cur_subcat,specialization:B,modify:("undefined"!==typeof (window.query)&&("undefined"!==typeof (window.query.repost)||"undefined"!==typeof window.query.modify)?window.query.modify:"0"),mode:("undefined"!==typeof (window.query)&&("undefined"!==typeof window.query.mode)?window.query.mode:""),modify_reason:("undefined"!==typeof (window.query)&&"undefined"!==typeof window.query.modify_reason?window.query.modify_reason:""),featured_modify:(("undefined"!==typeof (window.query)&&("undefined"!==typeof window.query.featured_modify&&0<$J("#featuredPlan").val()))?window.query.featured_modify:""),inactive:("undefined"!==typeof (window.query)&&"undefined"!==typeof window.query.inactive?window.query.inactive:"")},function(C){$J("#step_featured_plans").html(C);
if(1<$J("#step_featured input").length){$J("#step_featured_plans").show().parent().show();}else{$J("#step_featured_plans").parent().hide();}},"html");},soldOutSpec:function(A){if(this.sold_out_spec){this.sold_out_spec=null;}if(A&&typeof A=="string"){this.sold_out_spec=$J($J("[name="+A+"]")[0]);if(this.sold_out_spec){var B=$J("#postingsubcategory");if(""!==this.sold_out_spec.val()){this.sold_out_spec.disable();}else{console.log(this.sold_out_spec);this.sold_out_spec.change(function(){POSTFORM.loadFeaturedPlans();
});}}}},getSpecFields:function(A){POSTFORM.toggleSubCatLoader();var C=(typeof (window.query)!="undefined"?window.query["modify"]:"");var B="xmlhttprequest=1&a=getSpec&modify="+C+"&cat="+this.cur_subcat+((A)?"&"+A:"")+"&"+$J.param(paramvalues);$J.post(this.server,B,function(D,F,E){$J("#spec").html(D);POSTFORM.showSpecFields(D);$J("#postform").validate(validation_options);$J("#postingForm-loading").hide();$J("input.vs-date-type").datepicker({dateFormat:"yy-mm-dd"});$J("#no_company_display").attr("checked",(POSTFORM.user_data["display_company"]=="no"));
},"html");},toggleSubCatLoader:function(){$J("#postingForm-loading").toggle();if(""!=POSTFORM.user_data["company_name"]){POSTFORM.setProPosting();}POSTFORM.checkProFields();},showDisclaimer:function(A,B){if("undefined"==typeof (window.query["modify"])&&"undefined"==typeof (window.query["repost"])){$J("#idisclaimer").html($J("#"+A).html());$J("#step_beware").show();$J("#step_beware").scrollTo();}this.disclaimer_active=true;if(A=="disclaimer_yes"){this.disclaimer_agreed=(B)?true:false;}$J("#disclaimer_buttons").css({display:"block"});
$J("#disclaimer_no").removeAttr("checked");if(A=="disclaimer_yes"){if(true==B){$J("#disclaimer_yes").attr("checked","checked");}else{$J("#disclaimer_yes").removeAttr("checked");}}$J("#step_two").add("#step_three").add("#step_four").add("#step_captcha").hide();this.toggleStepOneCaption(false);this.toggleStepTwoCategory(false);},showMessage:function(B,A){if(true==A){$J("#premium_disclaimer").html($J(B).html()).css({display:"block"});Element.show("step_beware");}else{$J("#premium_disclaimer").html("").css({display:"none"});
}},showSpecFields:function(A){console.log("Showing the steps....");$J("#step_two").show();$J("#step_three").show();$J("#step_four").show();$J("#step_captcha").show();console.log("Steps should be visible, but probably arent");POSTFORM.applyAuthLayer("login",false);this.toggleStepOneCaption(true);if(0<$J("#selectedGeo").val()&&(false===this.disclaimer_active||(true===this.disclaimer_active&&true===this.disclaimer_agreed))){POSTFORM.loadFeaturedPlans();}this.addTooltips();},resetSpecFields:function(){$J("#step_two").hide();
$J("#step_three").hide();$J("#step_four").hide();$J("#step_captcha").hide();$J("#step_featured").hide();$J("#spec").html("");},setSpecFields:function(A){},toggleStepOneCaption:function(A){if(A){$J("#vs-step-one-caption").hide();$J("#vs-step-one-caption2").show();}else{$J("#vs-step-one-caption2").hide();$J("#vs-step-one-caption").show();}},toggleStepTwoCategory:function(A,B){if(B){this.cur_subcat_label=B;}if(A){$J("#vs-step-two-category").html(this.cur_subcat_label);$J("#vs-step-two-category").show();
}else{$J("#vs-step-two-category").html("");$J("#vs-step-two-category").hide();}},checkZipcode:function(){if(this.cur_zipcode!=$J("#postal_posting").val()&&$J("#postal_posting").val().length>1){$J.post(this.server,{xmlhttprequest:1,a:"checkZipCode",zip:$J("#postal_posting").val(),previous:previous_location},POSTFORM.showCities);}},renderAltrows:function(B){if(!B){var A=$J("#spec tr.vs_altrows","#spec_values tr.vs_altrows");}else{if(typeof (B)=="object"){var A=B;}else{var A=$J("#"+B+" tr");}}j=0;A.each(function(C,D){D=$J(D);
if(D.is(":visible")){if(D.hasClass("posting_grey")){D.removeClass("posting_grey");}if(++j%2==0||D.hasClass("copy_security_code")){D.addClass("posting_grey");}}});$J(".posting input.smalltext").each(function(){var D=this;var C=$J(this);D.onclick=D.onfocus=function(){if(this.value&&this.value==C.attr("value")){POSTFORM.temp_values[this.name]=this.value;this.value="";}};D.onblur=function(){if(this.value==""){this.value=POSTFORM.temp_values[this.name]||"";}};});},showCities:function(A){if(A.responseText=="ERROR"){$J("#citiesList").html(mess["error_zipcode"]);
}else{$J("#citiesList").html(A.responseText);}$J("#pcities").show();this.updateZipcode();},updateZipcode:function(){zipcode=$J("#geo_location").val().split("|");$J("#postal_posting").val(zipcode[1]);this.cur_zipcode=zipcode[1];},setValues:function(E){skip=["postingsubcategory"];for(h_key in E){var C={key:h_key,value:E[h_key]};if(false==$J.inArray(C.key,skip)){e=document.getElementsByName(C.key);var D=e[0];if(!D){continue;}var A=D.tagName.toLowerCase();var B=D.type.toLowerCase();switch(A){case"select":if(D.onchange&&D.onchange.toString().indexOf("showSection")!=-1){D.onchange();
}break;}}}},requestPassword:function(B,A){var B=$J("#"+B);var A=$J("#"+A);if(""==A.val()){A.parent().parent().addClass("vs-posting-error");return false;}else{A.parent().parent().removeClass("vs-posting-error");}$J("#password_image").show();VIVASTREET.forgotPassword(A.val(),function(C){if(C.code=="error"){CHECKS.showError(A.up(1),true);CHECKS.showMessage(A,{},"forgot_password_failed",true);}else{$J("#forgot_password_link").html('<div id="forgot_password_message">'+C.message+"<br /></div>"+$J("#forgot_password_link").html());
$J("#pass_posting").val("");POSTFORM.setCredentials("register");if(C.code=="success"){$J("#forgot_password_link a").remove();}}$J("#password_image").hide();});},italyPolicies:function(A){var A=$J(A);A.up(1).children(".caption").html("");},resetCaptcha:function(B,A){if(!A||B!="register"&&B!="login"){A=false;}if(B=="register"||B=="login"){A=true;}if(B=="modify"){B="logged";}if(B=="no_account"){B="register";}$J("#captcha").val("");$J("#captcha_image").attr("src",VIVASTREET.captcha(B,"small",A));},changeAuthForm:function(A,C){if(A==this.authType){return ;
}POSTFORM.resetCaptcha(A);var B="";if($J("#"+this.elPrefix+"mail_posting").length){B=$J("#"+this.elPrefix+"mail_posting").val();}this.authType=A;this.elPrefix=((this.authType&&"register"!==this.authType)?this.authType+"-":"");if(0<B.length&&$J("#"+this.elPrefix+"mail_posting")){if(0===$J("#"+this.elPrefix+"mail_posting").val().length){$J("#"+this.elPrefix+"mail_posting").val(B);}}},applyAuthLayer:function(A,B){return ;},changeAuth:function(A,B){skip_session_id=false;if(A=="login"){skip_session_id=true;
}else{if(A=="register"){skip_session_id=true;this.hideDisclaimers(false);}else{if(A=="logged"){skip_session_id=true;this.hideDisclaimers(true);}else{if(A=="modify"){}}}}$J("#auth_action").val(A);if(A=="modify"){A="logged";}POSTFORM.resetCaptcha(A,skip_session_id);$J("#reset_captcha_link").click(function(){POSTFORM.resetCaptcha(A,skip_session_id);return false;});},hideDisclaimers:function(A){if("IT"==VIVASTREET._country_geo[1]){if(A==true){$J("#italy_terms_yes, #italy_terms_yes2").attr("checked",true);
$J("#step_captcha .vs-posting-it-disclaimer").hide();$J("#step_captcha .vs-posting-it-disclaimer input").attr("disabled","disabled");}else{$J("#italy_terms_yes, #italy_terms_yes2").attr("checked",false);$J("#step_captcha .vs-posting-it-disclaimer").show();$J("#step_captcha .vs-posting-it-disclaimer input").removeAttr("disabled");}}},changeAuthType:function(D,C,B){if(D&&false==D.checked){return ;}if(!B){B=false;}var A=$J(D);switch(C){case"no_account":POSTFORM.changeAuthForm("no_account");$J(".vs-posting-auth-table tr.posting-auth-row-register, .vs-posting-auth-table tr.posting-auth-row-login").hide().css({"background-color":"transparent"});
$J(".posting-auth-row-register input, .posting-auth-row-login input, .posting-auth-row-register select, .posting-auth-row-login select, .vs-posting-auth-message input, .vs-posting-auth-message select",$J("#category_step_four")).attr("disabled","disabled");$J(".vs-posting-auth-table tr.posting-auth-row-no-account").show().css({"background-color":"#FFFFFF"});$J(".posting-auth-row-no-account input, .posting-auth-row-no-account select",$J("#category_step_four")).removeAttr("disabled");$J(".vs-posting-auth-table tr td.authTypeCheck").css({"font-weight":"normal"}).parent().css({"background-color":"transparent"});
A.parent().css({"font-weight":"bold"}).parent().css({"background-color":"#FFFFFF"});if(true==B){$J("#no_account_email").attr("disabled",true);$J(".vs-posting-auth-option, .vs-posting-auth-row-option, #no_account_email, .vs-posting-show-no_account").hide();}break;case"register":POSTFORM.changeAuthForm("register");$J(".vs-posting-auth-table tr.posting-auth-row-no-account, .vs-posting-auth-table tr.posting-auth-row-login").hide().css({"background-color":"transparent"});$J(".posting-auth-row-no-account input, .posting-auth-row-login input, .posting-auth-row-no-account select, .posting-auth-row-login select, .vs-posting-auth-message input, .vs-posting-auth-message select",$J("#category_step_four")).disable();
$J(".vs-posting-auth-table tr.posting-auth-row-register").show().css({"background-color":"#FFFFFF"});$J(".posting-auth-row-register input, .posting-auth-row-register select",$J("#category_step_four")).enable();$J(".vs-posting-auth-table tr td.authTypeCheck").css({"font-weight":"normal"}).up().css({"background-color":"transparent"});A.up().css({"font-weight":"bold"}).up().css({"background-color":"#FFFFFF"});break;case"login":POSTFORM.changeAuthForm("login");$J(".vs-posting-auth-table tr.posting-auth-row-register, .vs-posting-auth-table tr.posting-auth-row-no-account").hide().css({"background-color":"transparent"});
$J(".posting-auth-row-register input, .posting-auth-row-no-account input, .posting-auth-row-register select, .posting-auth-row-no-account select, .vs-posting-auth-message input, .vs-posting-auth-message select",$J("#category_step_four")).disable();$J(".vs-posting-auth-table tr.posting-auth-row-login").show().css({"background-color":"#FFFFFF"});$J(".posting-auth-row-login input, .posting-auth-row-login select",$J("#category_step_four")).enable();$J(".vs-posting-auth-table tr td.authTypeCheck").css({"font-weight":"normal"}).up().css({"background-color":"transparent"});
A.up().css({"font-weight":"bold"}).up().css({"background-color":"#FFFFFF"});break;}},setLoggedOut:function(A){$J("#category_step_four table.vs-posting-auth-table:first").show();$J("#category_step_four table.vs-posting-auth-message:first").hide();$J("#vivastreet table.vs-posting-auth-table input[type=radio]").enable();POSTFORM.setCredentials("no_account",true);$J("#tr_logged_message").hide();},setLoggedIn:function(){console.log("WHAT WHAT IN SETLOGGEDIN");POSTFORM.changeAuth("logged",POSTFORM.logged_msg+" "+VIVASTREET.username.bold());
$J("#category_step_four table.vs-posting-auth-table:first").hide();console.log("Should be showing the link...");$J("#category_step_four table.vs-posting-auth-message:first, #change_user").show();$J("#posting_logged_in_username").html(VIVASTREET.username);if("undefined"==typeof POSTFORM.authType||("login"!=POSTFORM.authType&&"register"!=POSTFORM.authType)){$J(".vs-posting-auth-message input, .vs-posting-auth-message select",$J("#category_step_four")).enable();}},setModify:function(){POSTFORM.changeAuth("modify",POSTFORM.logged_msg+" "+VIVASTREET.username.bold());
$J("#category_step_four table.vs-posting-auth-table:first").show();$J("#category_step_four table.vs-posting-auth-message:first, #change_user").hide();$J("#posting_logged_in_username").html(VIVASTREET.username);},setCredentials:function(E,A,B){if(!E){E="no_account";}var D=location.toString();var C=(D.match("modify")!=null||D.match("repost")!=null);if(false==VIVASTREET.isLogged()){POSTFORM.changeAuth(E);if(A){POSTFORM.changeAuthType($J("#posting_auth_"+(B||"no_account")),B||"no_account",C);}}else{if(true===C){POSTFORM.setModify();
}else{POSTFORM.setLoggedIn();}$J(".posting-auth-row-register input, .posting-auth-row-no-account input, .posting-auth-row-register select, .posting-auth-row-no-account select",$J("#category_step_four")).disable();}},addPhotoUpload:function(B,A){var C='<div class="vs-photo-upload" id="vs_photo_upload_'+A+'"><img src="'+B+'" alt="'+__("form_post_remove_photos_label")+'"/><br/><a href="" onclick="POSTFORM.removePhotoUpload('+A+');return false;">'+__("form_post_remove_photos_label")+"</a></div>";$J("#vs_uploaded_pictures").html($J("#vs_uploaded_pictures").html()+C);
POSTFORM._uploadImageCount++;POSTFORM._uploadImageIndex++;POSTFORM._uploadImageModified=true;$J("#image_total").val(POSTFORM._uploadImageCount);$J("#image_modify").val(1);$J("#vs_upload_status").html(__("photo_upload_successful"));},removePhotoUpload:function(A){$J.post(VIVASTREET._ajax_dir+"script/upload.php",{"image_index":A,"action":"removePhoto"},function(B,C,D){$J("#vs_photo_upload_"+A).remove();$J("#vs_upload_status").html(__("photo_upload_removed"));POSTFORM._uploadImageCount--;POSTFORM._uploadImageModified=true;
$J("#image_total").val(POSTFORM._uploadImageCount);$J("#image_modify").val(1);},"json");},setPhotoUploading:function(A){$J("#vs_upload_status").html(__("posting_photo_uploading")+"...");},setPhotoLoading:function(){$J("#vs_upload_status").html(__("posting_photo_loading")+"...");},removeResumeUpload:function(){if($J("#posting_resume_attached").val()=="yes"){$J.post(VIVASTREET._ajax_dir+"script/upload.php",{action:"removeResume"},function(A){$J("#vs_resume_upload").remove();$J("#posting_resume_attached").val("no");
});}},addLogoUpload:function(A){var B='<div class="vs-photo-upload" id="vs_logo_upload"><img src="'+A+'"/><br/><a href="" onclick="POSTFORM.removeLogoUpload();return false;">'+__("form_post_remove_photos_label")+"</a></div>";$J("#vs_uploaded_logos").html(B);$J("#posting_logo_attached").val("yes");$J("#vs_logo_upload_status").html(__("posting_logo_upload_success"));},removeLogoUpload:function(){if($J("#posting_logo_attached").val()=="yes"){$J.post(VIVASTREET._ajax_dir+"script/upload.php",{action:"removeLogo"},function(A){$J("#posting_logo_attached").val("no");
$J("#vs_logo_upload").remove();});}},addResumeUpload:function(B,E,F,C){switch(F){case"doc":var A="resume_doc.gif";break;case"docx":var A="resume_docx.gif";break;case"odt":var A="resume_odt.gif";break;case"pdf":var A="resume_pdf.gif";break;case"rtf":var A="resume_rtf.gif";break;default:var A="resume_other.gif";break;}var D='<div class="vs-resume-upload" id="vs_resume_upload"><img align="left" src="'+C+"/posting/"+A+'"/><p>'+__("resume_filename")+": "+B+"<br/>"+__("resume_size")+": "+E+'<br/><strong><a href="" onclick="POSTFORM.removeResumeUpload();return false;">'+__("form_post_remove_photos_label")+"</a></strong></p></div>";
$J("#vs_uploaded_files").html(D);$J("#posting_resume_attached").val("yes");},gotoError:function(A){},scrollToFirstError:function(){var A=0;POSTFORM.error_element=false;$J(document.getElementsByClassName("vs-posting-error")).each(function(B,C){if(B=ajax=0){POSTFORM.error_element=C;}});$J(POSTFORM.error_element).scrollTo();},scrollToBottom:function(){var A=0;POSTFORM.ie_element=false;$J(document.getElementsByClassName("step_captcha")).each(function(B,C){if(A==0){$J(C).scrollTo(true);}A++;});},setPreview:function(A){$J("#publish").val(A?0:1);
},unsetDefaultFields:function(){if(window.console){console.log("Starting with unsetDefaultFields()");}var B=0;var A=document.getElementById("postform").elements;$J(A).each(function(D,G){$e=$J(G);try{var C=$e.attr("name");var E=$e.attr("type");var F=$e.attr("value");if((G.value==$e.attr("title"))&&($e.attr("type")!="hidden")){G.value="";}}catch(G){if(window.console){console.log("Could not read values!");}}D++;});this.trackerErrors=[];},highlightField:function(A){console.log("TODO: FIX highlighField()");
},checkPetType:function(B){var C=B;var A=$J("[name=pet_type]");if(1==A.length){var A=$J(A[0]);A.change(function(){if("Chien"==A.val()){$J("#vs-element-disclaimer").html(C);$J("#vs-element-disclaimer").css({display:"block"});}else{$J("#vs-element-disclaimer").html("");$J("#vs-element-disclaimer").hide();}});}},checkLinkedFields:function(){},checkProFields:function(){if(VIVASTREET._country_geo[1]!="FR"){return false;}var B=[];var E=document.getElementsByName("individual_type");var F=document.getElementsByName("individual_pro");
var A=document.getElementsByName("individual_agency");if(E.length>0){B=E;}else{if(F.length>0){B=F;}else{if(A.length>0){B=A;}else{return true;}}}for(var D=0;D<B.length;D++){var C=$J(B[D]);if(C.val()=="pro"){if(C.is(":checked")==true){POSTFORM.toggleProFields(C);$J("#pro_company_name_txt").val(POSTFORM.user_data["raison_sociale"]);$J("#pro_company_number_txt").val(POSTFORM.user_data["company_number"]);if(window.console){console.log(POSTFORM.user_data["raison_sociale"]+" is the company name");}}}}},setProPosting:function(){var B=[];
var E=document.getElementsByName("individual_type");var F=document.getElementsByName("individual_pro");var A=document.getElementsByName("individual_agency");if(E.length>0){B=E;}else{if(F.length>0){B=F;}else{if(A.length>0){B=A;}else{return true;}}}for(var D=0;D<B.length;D++){var C=$J(B[D]);if(C.val()=="pro"){C.attr("checked","checked");POSTFORM.toggleProFields(C);}else{C.removeAttr("checked");}}},toggleProFields:function(B){B=$J(B);var C=B.up(1);var A='<tr id="pro_company_name" class="vs_altrows"><td class="title"><strong>'+mess["company_name"]+'<span class="star_mendatory"> *</span></strong></td><td class="middle"><input id="pro_company_name_txt" type="text" name="company_name" size="40" onchange="CHECKS.noempty(this);CHECKS.normalString(this, [{min: 0, max: 60}]);"/>&nbsp;<input style="margin: 0pt; padding: 0pt;" name="no_company_display" value="do_not_display_company" type="checkbox">&nbsp;<label>'+mess["post_display_company"]+'</label></td><td class="caption nobg"><div></div></td></tr><tr id="pro_company_number" class="vs_altrows"><td class="title"><strong>'+mess["company_number"]+'<span class="star_mendatory"> *</span></strong></td><td class="middle"><input id="pro_company_number_txt" type="text" name="company_number" size="30" onchange="CHECKS.noempty(this);CHECKS.normalString(this, [{min: 0, max: 20}]);"/></td><td class="caption nobg"><div></div></td></tr>';
switch(B.val()){case"pro":case"individual_pro":if((!$J("pro_company_name"))&&!$J("pro_company_number")){C.append(A);if(POSTFORM.user_data["company_name"]!=""){$J("#pro_company_name_txt").val(POSTFORM.user_data["company_name"]);}if(POSTFORM.user_data["company_number"]!=""){$J("#pro_company_number_txt").val(POSTFORM.user_data["company_number"]);}}break;case"individual":if($J("#pro_company_name_txt")&&""!=$J("#pro_company_name_txt").val()){POSTFORM.user_data["company_name"]=$J("#pro_company_name_txt").val();
}if($J("#pro_company_number_txt")&&""!=$J("#pro_company_number_txt").val()){POSTFORM.user_data["company_number"]=$J("#pro_company_number_txt").val();}if($J("#pro_company_name")){$J("#pro_company_name").remove();}if($J("#pro_company_number")){$J("#pro_company_number").remove();}break;}},setDescript:function(A){$J("#descript_caption").html(A);}};

/* posting.js */

var choice="";function show_radiobutton(){if(choice=="yes"){choice="";document.getElementById("hide1").style.visibility="hidden";document.getElementById("hide2").style.visibility="hidden";document.getElementById("hide3").style.visibility="hidden";}else{choice="yes";document.getElementById("hide1").style.visibility="visible";document.getElementById("hide2").style.visibility="visible";document.getElementById("hide3").style.visibility="visible";}}function show_warning(){document.getElementById("step_beware").style.visibility="visible";
}function show_steps(){document.getElementById("step_beware").style.visibility="visible";document.getElementById("step_two").style.display="block";document.getElementById("step_three").style.display="block";document.getElementById("step_four").style.display="block";document.getElementById("step_continue").style.display="block";}function hide_steps(){document.getElementById("step_beware").style.visibility="hidden";document.getElementById("step_two").style.display="none";document.getElementById("step_three").style.display="none";
document.getElementById("step_four").style.display="none";document.getElementById("step_continue").style.display="none";document.getElementById("hide1").style.visibility="hidden";document.getElementById("hide2").style.visibility="hidden";document.getElementById("hide3").style.visibility="hidden";}function show_sendpost(){document.getElementById("click_here").style.display="none";document.getElementById("send_0").style.display="block";document.getElementById("send_1").style.display="block";document.getElementById("send_2").style.display="block";
}

