/* post.js */

var POSTFORM=new Object();var CHECKS=new Object();var post_debug=function(A){if(window.console){console.log("DEBUG::POSTING::",A);}};CHECKS={status:false,checks:true,old_messages:{},messages:{"normalString":"The field must contain atleast #{min}, and no more than #{max} characters.","noempty":"This field cannot be empty.","number":"This field must contain a numeric value.","disclaimer":"You must accept the terms and/or conditions to continue."},function_validate:false,function_checked:[],email:function(B,A){if(/^[\d\w\/+!=#|$?%{^&}*`'~-][\d\w\/\.+!=#|$?%{^&}*`'~-]*@[A-Z0-9][A-Z0-9.-]{1,61}\.[A-Z]{2,6}$/i.test(B.value)){return true;
}else{POSTFORM.trackerErrors.push("specialization");CHECKS.showMessage(B,{},"invalid_email",true);return CHECKS.showError(B.up(1),true,null,null,B);}},normalString:function(C,B,A){A=(typeof (A)=="undefined")?1:A;B=B[0];return this._lengthCheck(C,B,A,"normalString");},description:function(B,A){val=(B.getBody&&B.getBody().innerHTML)||B.value;val=val.strip();A=A[0];if(val&&A.min<=val.length&&A.max>=val.length){this.showError($("description_row"),false,null,null,$("detail"));return true;}else{POSTFORM.trackerErrors.push("specialization");
this.showError($("description_row"),true,null,null,$("detail"));return false;}},number:function(C,B,A){A=(typeof (A)=="undefined")?1:A;val=$F(C);B=B[0];req_keys=Object.keys(B);C.value=C.value.replace(/\s/g,"");if(true==isNaN(C.value)||0<=C.value.indexOf(".")||0<=C.value.indexOf(",")){POSTFORM.trackerErrors.push("specialization");this.showMessage(C,{},"number",true);this.showError(C.up(1),true,null,null,C);return false;}return this._lengthCheck(C,B,A,"number");},decimal:function(C,B,A){A=(typeof (A)=="undefined")?1:A;
val=$F(C);B=B[0];req_keys=Object.keys(B);C.value=val.gsub(new RegExp("/[^\\d"+this._localeConv.mon_decimal_point+"]+/"),"");t=C.value.replace(",",".");if(isNaN(t)){POSTFORM.trackerErrors.push("specialization");this.showMessage(C,{},"decimal",true);return this.showError(C.up(A),true,null,null,C);}return this._lengthCheck(C,B,A,"decimal");},noempty:function(B,A){A=(typeof (A)=="undefined")?1:A;type=B.type.toLowerCase();B.value=B.value.strip();if((type=="radio"||type=="checkbox")){A=(type=="checkbox")?5:A;
radio_error=true;if(this.function_checked.indexOf(B.name)==-1){$$('input[name^="'+B.name.toLowerCase().gsub(/[\[\]]/,"")+'"]').each(function(C){if(C.checked){radio_error=false;}});this.function_checked[B.name]=radio_error;}else{radio_error=this.function_checked[B.name];}if(!this.function_validate){this.function_checked[B.name]=null;}if(radio_error){this.checks=false;POSTFORM.trackerErrors.push("specialization");this.showMessage(B,{},"noempty",true);return this.showError(B.up(A),true,null,null,B);
}}else{if(""==$F(B).strip()){POSTFORM.trackerErrors.push("specialization");this.checks=false;this.showMessage(B,{},"noempty",true);return this.showError(B.up(A),true,null,null,B);}}this.showMessage(B,{},"noempty",false);return this.showError(B.up(A),false,null,null,B);},captcha:function(B,A){A=(typeof (A)=="undefined")?1:A;type=B.type.toLowerCase();if(""==$F(B)){POSTFORM.trackerErrors.push("captcha");this.checks=false;this.showMessage(B,{},"noempty",true);return this.showError(B.up(A),true,true,null,B);
}this.showMessage(B,{},"noempty",false);return this.showError(B.up(A),false,true,null,B);},showError:function(F,B,E,D,A){if(true==B){Element.addClassName(F,"errorField");if(A&&POSTFORM.error_fields.indexOf(A.readAttribute("name"))==-1){POSTFORM.error_fields[POSTFORM.error_fields.length]=A.readAttribute("name");POSTFORM.errors++;}}else{Element.removeClassName(F,"errorField");if(A&&POSTFORM.errors>0&&POSTFORM.error_fields.indexOf(A.readAttribute("name"))>-1){POSTFORM.error_fields.splice(POSTFORM.error_fields.indexOf(A.readAttribute("name")),1);
POSTFORM.errors--;}}var C=$(F.getElementsByTagName("td")[2]);if(C&&C.className.indexOf("caption")!=-1&&C.innerHTML.replace(/<\/?div[^>]*>/ig,"").length<7){C.addClassName("nobg");C.innerHTML="<div>&nbsp;</div>";}if(!D){submit_form=submit_form&&!B;}return !B;},_lengthCheck:function(D,C,A,B){req_keys=Object.keys(C);val=$F(D).strip();if(req_keys.indexOf("eq")!=-1){if(C.eq!=val.length){POSTFORM.trackerErrors.push("specialization");this.showMessage(D,C,B,true);return this.showError(D.up(A),true,null,null,D);
}else{this.showMessage(D,C,B,false);return this.showError(D.up(A),false,null,null,D);}}else{if(req_keys.indexOf("min")!=-1&&req_keys.indexOf("max")!=-1&&C.min!=0&&val.length==0){this.showMessage(D,C,B,true);return this.showError(D.up(A),true,null,null,D);}else{if(req_keys.indexOf("min")!=-1&&req_keys.indexOf("max")!=-1&&val.length>0){if(C.min<=val.length&&C.max>=val.length){this.showMessage(D,C,B,false);return this.showError(D.up(A),false,null,null,D);}else{POSTFORM.trackerErrors.push("specialization");
this.showMessage(D,C,B,true);return this.showError(D.up(A),true,null,null,D);}}else{return true;}}}},getMessage:function(C,B){try{var A=(typeof (C)=="object")?C:new Template(C);return A.evaluate(B);}catch(D){if(window.console){console.log(D);}return null;}},showMessage:function(F,E,C,A){var E=E||{};var A=typeof (A)=="undefined"?true:A;var F=$(F);var B=false;if(F.type&&F.readAttribute("id")=="italy_terms_yes"){B=$("posting_terms_caption");}else{if(F.type&&F.readAttribute("id")=="italy_terms_yes2"){B=$("posting_terms_caption2");
}else{if(F.type&&(F.readAttribute("id")!=="street_posting"&&F.readAttribute("id")!=="number_posting")){if(!!F.next(".caption-error")){B=F.next(".caption-error");}else{B=F.up(["checkbox","radio"].indexOf(F.type.toLowerCase())!=-1?5:1).getElementsBySelector(".caption")[0];}}else{if(F.up(".middle",0).next(".caption",0)){B=F.up(".middle",0).next(".caption",0);}else{B=F.up(".middle").down(".address");}}}}if(B.hasClassName("nobg")){B.removeClassName("nobg");}if(!this.old_messages[F.name]){this.old_messages[F.name]={};
}if(CHECKS.messages[C]&&A){if((F.up(5).readAttribute("id")=="step_four"&&B.readAttribute("id")!=="phone_caption")&&(C!="forgot_password_failed"&&C!="incorrect_password"&&C!="invalid_email")){var D="<div>"+this.getMessage(this.messages[F.readAttribute("id")],E)+"</div>";}else{if(B.readAttribute("id")=="phone_caption"){var D="<div>"+this.getMessage(this.messages[B.readAttribute("id")],E)+"</div>";}else{var D="<div>"+this.getMessage(this.messages[C],E)+"</div>";}}this.old_messages[F.name][C]=B.innerHTML.length==D.length?null:B.innerHTML;
B.innerHTML=D;}else{if(!A){if(B.innerHTML!=this.old_messages[F.name][C]&&typeof (this.old_messages[F.name][C])!="undefined"&&this.old_messages[F.name][C]!=null){B.innerHTML=this.old_messages[F.name][C];this.old_messages[F.name][C]=null;}}else{if(B.hasClassName("address")){B.innerHTML=this.getMessage(this.messages[B.readAttribute("id")],E);}}}if(B.innerHTML.replace(/<\/?div[^>]*>/ig,"").length<7){B.addClassName("nobg");B.innerHTML="<div>&nbsp;</div>";}},setCaptionEvents:function(){$$("img.caption-info").each(function(B){var C=B.up();
var D=C.getElementsBySelector("div.caption-text")[0];var A=C.getElementsBySelector("input");B.onmouseover=function(){UTILS.showCaption(D,B,0,0);};if(A.length){A[0].onmousemove=function(E){UTILS.moveCaption(D,E);};A[0].onmouseout=function(){UTILS.hideCaption(D);};}B.onmouseout=function(){UTILS.hideCaption(D);};});}};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:""},disclaimer_active:false,disclaimer_agreed:false,sold_out_spec:"",sold_out_spec_onchange:null,init:function(){if(validate==true){this.form_validated=true;
this.cur_cat=previous_cat;this.cur_subcat=previous_subcat;if(agree_disclamer==true){this.disclaimer_agreed=true;$("disclamer_yes").checked="checked";if($("postal_posting")&&$F("postal_posting")!=""){this.checkZipcode();}}this.cur_province=previous_prov;this.cur_region=previous_city;}this.addEvents();if(this.cur_subcat!=0){var A=document.forms.postform.elements.postingsubcategory;var B=0;$A(A.options).each(function(C){if(C.value==POSTFORM.cur_subcat){C.selected="selected";B=C.index;}});A.selectedIndex=B;
this.updateSubCat();if($(A).hasClassName("vs-featured-ad")){$("postingsubcategory_alt").value=$F(A);$(A).disable();}}if(agree_disclamer==true){}agree_disclamer=false;POSTFORM.lbOnLoadAllow=true;},addEvents:function(){$("postingsubcategory").onchange=function(){POSTFORM.updateSubCat();document.body.focus();};$("disclamer_yes").onclick=function(){POSTFORM.agreeDisclamer();};$("disclamer_no").onchange=function(){window.location=location;};if($("detail").readAttribute("title")===$F("detail")){$("detail").setStyle({color:"#888888"});
$("detail").onclick=function(){$("detail").innerHTML="";$("detail").setStyle({color:"#000000"});$("detail").onclick=function(){};};}},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;$(A).show();$("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_disclamer!=true){$("disclamer_no").checked="checked";}Element.hide("step_beware");
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;$(A).up(1).show();Element.show(A);},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(Element.hasClassName(this.getSubCat(true)[this.getSubCat(true).selectedIndex],"vs-cat-xml")){if(disclamers[this.cur_subcat]||disclamers[this.cur_cat]){if(agree_disclamer!=true){$("disclamer_no").checked="checked";
}this.showDisclaimer();this.resetSpecFields();}else{Element.hide("step_beware");this.getSpecFields(agree_disclamer==true?"&disclaimer=agreed":"");$("vs-element-disclaimer").innerHTML="";$("vs-element-disclaimer").style.display="none";}}else{Element.hide("step_beware");this.resetSpecFields();}},showTransport:function(A){var A=("yes"==A);$("transport_posting_abroad").up(1)[A?"show":"hide"]();if(A){$("transport_posting_abroad").setAttribute("onchange","CHECKS.noempty(this);");}else{$("transport_posting_abroad").setAttribute("onchange","");
}},abroadOnly:function(A){if(""==A){return ;}if("block"==A){POSTFORM.abroadOnly("no");$("abroad_posting").up(1).hide();return ;}else{var B=("yes"==A);}$("abroad_posting").checked=B;POSTFORM.setAbroad(B);$("abroad_posting").up(1)[B?"hide":"show"]();$("transport_posting_geo")[B?"hide":"show"]();$("transport_posting_abroad")[B?"show":"hide"]();if(B){$("transport_posting").setAttribute("onchange","CHECKS.noempty(this);");}else{$("transport_posting").setAttribute("onchange","");}},setAbroad:function(C,A){var C=C;
var A="undefined"==typeof (A)?true:A;if(!this.enabledPostingGeos){this.enabledPostingGeos=[];}if(!SEARCH.freeText){for(var D=1;D<=POSTFORM.maxDepth;D++){var B=$("postingGeo_"+D);if(false==B.disabled){this.enabledPostingGeos.push(B.id);}B.up(1)[true===C?"hide":"show"]();B[false===C&&-1!==this.enabledPostingGeos.indexOf(B.id)?"enable":"disable"]();}}else{var B=$("searchGeo_text");B.up(1)[true===C?"hide":"show"]();B[false===C?"enable":"disable"]();if(true===C){POSTFORM.tempSelectedGeo=$F("selectedGeo");
$("selectedGeo").value=0;}else{$("selectedGeo").value=POSTFORM.tempSelectedGeo;}if(0!=$F("featuredAd")){B.disable();}}$("foreignCountry")[true===C?"hide":"show"]();$("foreignCountry").up(1)[false===C?"hide":"show"]();if(true===C){this.loadedForeignSelect=true;$("foreignCountry-loading").show();$("foreignCountry-caption").hide();setTimeout(function(){$("foreignCountry-loading").hide();$("foreignCountry").show();$("foreignCountry-caption").show();},1500);}$("foreignCountry")[true===C?"enable":"disable"]();
POSTFORM.loadFeaturedPlans();if(!A||!C){delete (this.enabledPostingGeos);}},selectGeo:function(C,B){var A=$("postingGeo_"+B);if(null!=A){A.childElements().each(function(D){if(D.value==C){D.selected=true;}else{D.selected=false;}});}},resetGeo:function(){$("searchGeo_text").value="";$("selectedGeo").value=0;$("postingGeo_1").selectedIndex=0;POSTFORM.loadFeaturedPlans();return false;},setPostingGeo:function(A,D){$("selectedGeo").value=A;POSTFORM.tempSelectedGeo=A;if(SEARCH.freeText){var C="postingGeo_1";
if(parseInt(D)>1){SEARCH.getGeoTree(A,function(E){try{$("searchGeo_text").value=E[E.length-1].label;var F=$$("#"+C+" option[value="+E[0].id+"]");if(F[0]){$(C).selectedIndex=F[0].index;}POSTFORM.loadFeaturedPlans();}catch(G){if(window.console){console.log(G);}}});}else{var B=$$("#"+C+" option[value="+A+"]");if(B[0]){$(C).selectedIndex=B[0].index;}$("searchGeo_text").value=B[0].text;}}},initGeo:function(A,E,F){var A=parseInt(A||1);var E=parseInt(E||0);var F=typeof (F)=="undefined"?true:F;$("selectedGeo").value=E;
POSTFORM.tempSelectedGeo=E;if(!SEARCH.geoValues[A]){return ;}var H=(A==1?SEARCH.geoValues[A]:SEARCH.geoValues[A][E]);var B=(POSTFORM.geoValue&&POSTFORM.geoValue[A]||0);var I=(true==F)?mess["select_first_option"]:CHECKS.messages["no_options"];SEARCH.loadSelectValues(("postingGeo_"+A),H,{"first_value":"","first_option":I},{"value":B,"fromPost":true});if(F){var G=$("postingGeo_"+A);if(!SEARCH.freeText){G.up(1).show();if(0==$F("featuredAd")){G.enable();}else{G.disable();}}if(SEARCH.freeText){if(B>0){for(var C=(POSTFORM.geoValue.length-1);
C>=0;C--){if(0<POSTFORM.geoValue[C]){this.setPostingGeo(POSTFORM.geoValue[C],C);Event.observe($("searchGeo_text"),"click",function(){POSTFORM.resetGeo();});break;}}}if(0!=$F("featuredAd")){$("searchGeo_text").disable();}return ;}Event.observe(G,"change",(function(Q,M){try{var L=M[M.selectedIndex].value;for(var J=(Q+1);J<=5;J++){var O=$("postingGeo_"+J);if(O){SEARCH.emptySelect(O);var K=document.createElement("OPTION");K.label=K.text=CHECKS.messages["select_previous"];O.appendChild(K);O.disable();
}}var N=false;if(Q==1){N=true;}else{N=(SEARCH.geoValues[(Q)][$F("postingGeo_"+(Q-1))][L][3]);}document.body.focus();SEARCH.getGeoFromServer(L,(Q+1),POSTFORM.initGeo.bind(POSTFORM,Q+1,L,N));}catch(P){if(window.console){console.log(P);}}}).bind(POSTFORM,A,G));if(B>0&&Event.observers.length){try{for(var C=(Event.observers.length-1);C>=0;C--){if(Event.observers[C][0].id==G.id){Event.observers[C][2]();break;}}}catch(D){for(var C=(POSTFORM.geoValue.length-1);C>=0;C--){if(0<POSTFORM.geoValue[C]){$("selectedGeo").value=POSTFORM.geoValue[C];
POSTFORM.tempSelectedGeo=E;break;}}}}}else{POSTFORM.loadFeaturedPlans();}},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;Element.show(A);},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(){POSTFORM.selectSectionSelections={};$$(".subSectionSelect").each(function(B){POSTFORM.selectSectionSelections[B.name]=B.selectedIndex;POSTFORM.selectSectionClones[B.name]=B.cloneNode(true);B.style.display="inline";while(B.options.length){B.remove(0);
}B.enable();var A=document.createElement("OPTION");A.label=A.text=CHECKS.messages["select_previous"];B.appendChild(A);B.disable();});},showSection:function(G,A){var B=UTILS.removeSymbols($F(G));var F=['select[name="'+A+'"]',"section_"+B.toLowerCase().gsub(/([\/\ \/\'])/,"-").gsub(/(-{1,})/,"-").gsub(/([^\S+])/,"-")];if(window.console){console.log(F);}var E=$$(F[0]);var D=POSTFORM.selectSectionClones[A].getElementsByClassName(F[1])||{length:0};var C=$$('select[name="'+A+'"]')[0];var H=$(C).up(1);if(0===D.length){C.selectedIndex=0;
C[0].label=C[0].text=""==$F(G)?CHECKS.messages["select_previous"]:CHECKS.messages["no_options"];C.disable();return ;}else{H.show();C.selectedIndex=0;CHECKS.showMessage(C,null,"select_previous",false);C.style.display="inline";C.enable();}while(C.options.length){C.remove(0);}$A(POSTFORM.selectSectionClones[A].getElementsByClassName(F[1])).each(function(I){var J=I.cloneNode(true);C.appendChild(J);if(POSTFORM.selectSectionClones[A][POSTFORM.selectSectionSelections[A]].value==J.value){C.selectedIndex=C.options.length-1;
}});},showDisclamer:function(){content_disclamer="post.php?disclamer&cat=";if(disclamers[this.cur_subcat]){content_disclamer=content_disclamer+this.cur_subcat;}else{if(disclamers[this.cur_cat]){content_disclamer=content_disclamer+this.cur_cat;}}$("idisclamer").src=content_disclamer;Element.show("step_beware");},agreeDisclamer:function(){if($("disclamer_yes").checked){this.disclaimer_agreed=true;this.showSpecFields();}else{this.resetSpecFields();}},changePlan:function(A){if($("steps_error_row").hasClassName("errorField")){CHECKS.showError(A.up(5),false,false,null,A);
}if(0==A.value){$("publish_button").show();$("preview_button").removeClassName("vs-input-button-green").addClassName("vs-input-button-dark").value=mess["post_preview"];}else{if(0<A.value){$("publish_button").hide();$("preview_button").removeClassName("vs-input-button-dark").addClassName("vs-input-button-green").value=mess["post_payment"];}}},loadFeaturedPlans:function(){var A=false;if(this.sold_out_spec&&(!$(this.sold_out_spec)||""===$F(this.sold_out_spec))){A=true;}if(true===A||(true===this.disclaimer_active&&false===this.disclaimer_agreed)||(true===$("foreignCountry").disabled&&(!this.cur_subcat||0==this.cur_subcat||!$F("selectedGeo")||0==$F("selectedGeo")||$("step_featured").hasClassName("vs-featured-ad")))){Element.hide("step_featured");
Element.hide("step_featured_plans");return ;}if(this.cur_subcat&&0<$F("selectedGeo")){Element.show("step_featured_plans");}var B=new Ajax.Updater("step_featured_plans",this.server,{method:"post",parameters:"xmlhttprequest=1&a=getPlans&geo="+$F("selectedGeo")+"&cat="+this.cur_subcat+"&specialization="+(this.sold_out_spec?$F(this.sold_out_spec):"")+"&modify="+("undefined"!==typeof (window.query)&&("undefined"!==typeof (window.query.repost)||"undefined"!==typeof window.query.modify)?"1":"0")+"&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<$F("featuredPlan"))?window.query.featured_modify:""),evalScripts:true});
},soldOutSpec:function(A){if(A&&typeof A=="string"){this.sold_out_spec=$(document.getElementsByName(A)[0]);if(this.sold_out_spec&&null==this.sold_out_spec_onchange){var B=$("postingsubcategory");if(B.hasClassName("vs-featured-ad")){this.sold_out_spec.disable();}else{this.sold_out_spec_onchange=POSTFORM.loadFeaturedPlans.bind(this);this.sold_out_spec.observe("change",this.sold_out_spec_onchange);}}}},getSpecFields:function(A){paramv=(paramvalues)?$H(paramvalues).toQueryString():"";var B=new Ajax.Updater("spec",this.server,{method:"post",parameters:"xmlhttprequest=1&a=getSpec&cat="+this.cur_subcat+((A)?"&"+A:"")+"&"+paramv,evalScripts:true,onLoading:POSTFORM.toggleSubCatLoader,onComplete:function(){POSTFORM.toggleSubCatLoader();
}});},toggleSubCatLoader:function(){$("postingForm-loading").toggle();if(""!=POSTFORM.user_data["company_name"]){POSTFORM.setProPosting();}POSTFORM.checkProFields();},showDisclaimer:function(A,B){$("idisclamer").update($(A).innerHTML);Element.show("step_beware");this.disclaimer_active=true;this.disclaimer_agreed=(B)?true:false;$("disclamer_buttons").style.display="block";$("disclamer_no").checked=false;$("disclamer_yes").checked=(B)?true:false;Element.hide("step_two");Element.hide("step_three");Element.hide("step_four");
Element.hide("step_captcha");this.toggleStepOneCaption(false);this.toggleStepTwoCategory(false);},showMessage:function(B,A){if(true==A){$("premium_disclaimer").update($(B).innerHTML).style.display="block";Element.show("step_beware");}else{$("premium_disclaimer").update("").style.display="none";}},showSpecFields:function(A){Element.show("step_two");Element.show("step_three");Element.show("step_four");Element.show("step_captcha");POSTFORM.applyAuthLayer("login",false);this.toggleStepOneCaption(true);
this.initSectionSelects();CHECKS.setCaptionEvents();if($("postingsubcategory").value=="job_seekers"){$("posting_resume_step").style.display="";$("posting_photos_step").style.display="none";$("posting_logo_step").style.display="none";}else{if($("postingsubcategory").value=="job_offers"){$("posting_resume_step").style.display="none";$("posting_photos_step").style.display="none";$("posting_logo_step").style.display="";}else{if($("postingsubcategory").value=="internships"){$("posting_resume_step").style.display="none";
$("posting_photos_step").style.display="none";$("posting_logo_step").style.display="";}else{if($("postingsubcategory").value=="insurance"){$("posting_resume_step").style.display="none";$("posting_photos_step").style.display="none";$("posting_logo_step").style.display="";}else{if($("postingsubcategory").value=="mlm_commission"){$("posting_resume_step").style.display="none";$("posting_photos_step").style.display="none";$("posting_logo_step").style.display="";}else{$("posting_resume_step").style.display="none";
$("posting_photos_step").style.display="";$("posting_logo_step").style.display="none";}}}}}if(0<$F("selectedGeo")&&(false===this.disclaimer_active||(true===this.disclaimer_active&&true===this.disclaimer_agreed))){POSTFORM.loadFeaturedPlans();}},resetSpecFields:function(){Element.hide("step_two");Element.hide("step_three");Element.hide("step_four");Element.hide("step_captcha");$("spec").innerHTML="";},setSpecFields:function(A){},toggleStepOneCaption:function(A){if(A){$("vs-step-one-caption").hide();
$("vs-step-one-caption2").show();}else{$("vs-step-one-caption2").hide();$("vs-step-one-caption").show();}},toggleStepTwoCategory:function(A,B){if(B){this.cur_subcat_label=B;}if(A){$("vs-step-two-category").update(this.cur_subcat_label);$("vs-step-two-category").show();}else{$("vs-step-two-category").update("");$("vs-step-two-category").hide();}},checkZipcode:function(){if(this.cur_zipcode!=$F("postal_posting")&&$F("postal_posting").length>1){var A=new Ajax.Request(this.server,{method:"post",parameters:"xmlhttprequest=1&a=checkZipCode&zip="+$F("postal_posting")+"&previous="+previous_location,onSuccess:POSTFORM.showCities,onFailure:function(){alert("Service not available yet, please try again in a few secondes ;)");
}});}},renderAltrows:function(B){if(!B){var A=$$("#spec tr.vs_altrows","#spec_values tr.vs_altrows");}else{if(typeof (B)=="object"){var A=B;}else{var A=$$("#"+B+" tr");}}j=0;A.each(function(C){if(C.visible()){if(C.hasClassName("posting_grey")){C.removeClassName("posting_grey");}if(++j%2==0||C.hasClassName("copy_security_code")){C.addClassName("posting_grey");}}});$$(".posting input.smalltext").each(function(C){C.onclick=C.onfocus=function(){if(this.value&&this.value==this.readAttribute("value")){POSTFORM.temp_values[this.name]=this.value;
this.value="";}};C.onblur=function(){if(this.value==""){this.value=POSTFORM.temp_values[this.name]||"";}};});},showCities:function(A){if(A.responseText=="ERROR"){$("citiesList").innerHTML=mess["error_zipcode"];}else{$("citiesList").innerHTML=A.responseText;}Element.show("pcities");this.updateZipcode();},updateZipcode:function(){zipcode=$F("geo_location").split("|");$("postal_posting").value=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(skip.indexOf(C.key)==-1){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=$(B);var A=$(A||B.elements["mail_posting"]);if(!CHECKS.noempty(A)){return false;}$("password_image").style.display="inline";VIVASTREET.forgotPassword(A.value,function(C){if(C.code=="error"){CHECKS.showError(A.up(1),true);
CHECKS.showMessage(A,{},"forgot_password_failed",true);}else{$("forgot_password_link").innerHTML='<div id="forgot_password_message">'+C.message+"<br /></div>"+$("forgot_password_link").innerHTML;$("pass_posting").value="";POSTFORM.setCredentials("register");}$("password_image").style.display="none";});},italyPolicies:function(A){var A=$(A);CHECKS.showMessage(A,{},"disclaimer",false);CHECKS.showError(A.up(1),false,null,null,A);A.up(1).down(".caption").innerHTML="";},hideDisclaimers:function(A){if("IT"==VIVASTREET._country_geo[1]){if(A==true){$("italy_terms_yes").checked=true;
$("italy_terms_no").checked=false;$("italy_terms_yes2").checked=true;$("italy_terms_no2").checked=false;$$("#step_captcha .vs-posting-it-disclaimer").each(function(B){B.hide();});}else{$("italy_terms_yes").checked=false;$("italy_terms_no").checked=false;$("italy_terms_yes2").checked=false;$("italy_terms_no2").checked=false;$$("#step_captcha .vs-posting-it-disclaimer").each(function(B){B.show();});}}},validatePost:function(B,J,D){if("undefined"==typeof (J)){J=false;}if("undefined"==typeof (D)){Lightbox.showLogger();
Lightbox.addLogMessage(__("postform_validate"),"loading");setTimeout(POSTFORM.validatePost.bind(POSTFORM,B,J,true),2000);return ;}POSTFORM.skip_validate_error=false;POSTFORM.skip_validate_geo_error=false;validate_geo_error=undefined;CHECKS.function_validate=true;validated=true;submit_form=true;$("postform").getElements().each(function(N){var L=N.tagName.toLowerCase();var M=N.type.toLowerCase();try{var O=$(N).readAttribute("onchange");if(($(N).readAttribute("type")!="hidden"||N.hasClassName("vs-date-type"))&&null!=O&&O.indexOf("CHECKS")!=-1&&!N.disabled&&N.readAttribute("id")!="italy_terms_yes"&&N.readAttribute("id")!="italy_terms_yes2"){if(L=="select"){if($(N).readAttribute("id")&&(-1==$(N).readAttribute("id").indexOf("_civility_posting")||(VIVASTREET.isLogged()==true&&-1!=$(N).readAttribute("id").indexOf("_civility_posting")))){if(!CHECKS.noempty(N)){if(N.readAttribute("id")=="postingGeo_1"||N.readAttribute("id")=="postingGeo_2"){if(!POSTFORM.skip_validate_geo_error){validate_geo_error=N.readAttribute("id");
validated=false;POSTFORM.skip_validate_geo_error=true;}}else{if(!POSTFORM.skip_validate_error){validated=false;POSTFORM.skip_validate_error=true;}}}}}else{if(N.readAttribute("name")=="geo_address"){if(N.value==__("form_post_geo_address_default")){N.value="";}}N.onchange();}}else{if(($(N).readAttribute("id")=="italy_terms_yes"||$(N).readAttribute("id")=="italy_terms_yes2")&&$("auth_action").value!="modify"){if($(N).checked==false){validated=false;CHECKS.checks=false;CHECKS.showMessage($(N),{},"disclaimer",true);
CHECKS.showError($(N).up(1),true,null,null,N);}}}}catch(K){if(window.console){console.log(K);}}});if($$("input[name=plan_id]").length>1){var A=false;$$("input[name=plan_id]").each(function(K){if(K.checked==true){A=true;$break;}});if(false==A){var C=$($$("input[name=plan_id]")[0]);validated=false;CHECKS.showMessage(C,{},"noempty",true);CHECKS.showError(C.up(5),true,null,null,C);}}if($("from_partners_yes")&&$("from_partners_no")){var G=false;var E=$("from_partners_yes").checked;var I=$("from_partners_no").checked;
if(false==E&&false==I){var H=$("from_partners_yes");CHECKS.checks=false;CHECKS.showMessage(H,{},"noempty",true);CHECKS.showError(H.up(1),true,null,null,H);}}var F=$("abroad_posting");if(SEARCH.freeText&&(!F||(F&&!F.checked))){if(!$F("selectedGeo")||0==$F("selectedGeo")){POSTFORM.trackerErrors.push("geo");var H=$("searchGeo_text");if(!J){CHECKS.checks=false;CHECKS.showMessage(H,{},"noempty",true);CHECKS.showError(H.up(1),true,null,null,H);}}}if("none"!==$("transport_posting_abroad").style.display){var H=$("transport_posting");
console.log(H.value);if(""===H.value){CHECKS.checks=false;CHECKS.showMessage(H,{},"noempty",true);CHECKS.showError(H.up(1),true,null,null,H);}else{CHECKS.showError(H.up(1),false,null,null,H);CHECKS.checks=true;}}if(true===J){Lightbox.hideLogger();}CHECKS.function_validate=false;if(!J){if($("auth_action").value=="logged"||$("auth_action").value=="modify"){POSTFORM.validateLoggedIn(B);}else{POSTFORM.validateRegister(B);}}},validateLoggedIn:function(A){submit_form=submit_form&&true;POSTFORM.sendPost(A);
},validateRegister:function(D){var A=true;if($("italy_terms_yes")&&$("italy_terms_yes2")){var C=$("italy_terms_yes");var B=$("italy_terms_yes2");if(!(C.checked&&B.checked)){if(window.console){console.log("Disclaimer check failed!");}POSTFORM.trackerErrors.push("disclaimer");CHECKS.showMessage($(C),{},"disclaimer",true);CHECKS.showError($(C).up(1),true,null,null,C);A=false;}}D.elements["incorrect_username"].value="0";["pass_posting","pseudo_posting","mail_posting","captcha"].each(function(F){var E="captcha"==F?F:POSTFORM.elPrefix+F;
if(D.elements[E]&&F=="pseudo_posting"||F=="mail_posting"){D.elements[E].value=D.elements[E].value.strip();}if(D.elements[E]&&D.elements[E].value.length<4){if(F!="pseudo_posting"||F=="pseudo_posting"&&D.elements[E].value.strip().length<2){POSTFORM.trackerErrors.push("registration");CHECKS.showError(D.elements[E].up(1),true,null,null,D.elements[E]);CHECKS.showMessage(D.elements[E],{},"noempty",true);A=false;}}else{if(D.elements[E]&&D.elements[E].value.length>15&&F=="pseudo_posting"){POSTFORM.trackerErrors.push("registration");
CHECKS.showError(D.elements[E].up(1),true,null,null,D.elements[E]);CHECKS.showMessage(D.elements[E],{},"noempty",true);A=false;}}}.bind(A));if("login"!==POSTFORM.authType&&"no_account"!==POSTFORM.authType&&D.elements["mail_posting"].value!==D.elements["mail_posting_confirm"].value){POSTFORM.trackerErrors.push("registration");CHECKS.showError(D.elements["mail_posting"].up(1),true,null,null,D.elements["mail_posting"]);CHECKS.showError(D.elements["mail_posting_confirm"].up(1),true,null,null,D.elements["mail_posting_confirm"]);
CHECKS.showMessage(D.elements["mail_posting"],{},"mail_posting_confirm",true);A=false;}if(A){VIVASTREET.authorize({action:POSTFORM.authType?"force-"+POSTFORM.authType:"register",email:D.elements[POSTFORM.elPrefix+"mail_posting"].value,password:"no_account-"!==POSTFORM.elPrefix?D.elements[POSTFORM.elPrefix+"pass_posting"].value:"",username:D.elements["pseudo_posting"]&&D.elements["pseudo_posting"].value,phone:D.elements["phone_posting"].value,captcha:D.elements["captcha"].value,partners_optin:D.elements["from_partners"]&&D.elements["from_partners"].checked?"yes":"no",country:VIVASTREET.country_geo["code"].toLowerCase(),checkDupe:true,fromPostform:true,onComplete:function(E){POSTFORM.registerResponseHandler(E,D);
}.bind(D)});}else{submit_form=submit_form&&false;POSTFORM.sendPost(D);}},registerResponseHandler:function(F,D){POSTFORM.dontRaiseCaptcha=false;var B=F.responseText.evalJSON();var E="";for(i=0;i<B.length;i++){E=B[i];switch(E.code){case"blocked_user":case"disabled_user":POSTFORM.trackerErrors.push("login");submit_form=submit_form&&false;POSTFORM.sendPost(D);break;case"incorrect_email_password":POSTFORM.trackerErrors.push("registration");POSTFORM.dontRaiseCaptcha=true;CHECKS.showError(D.elements[POSTFORM.elPrefix+"mail_posting"].up(1),true,null,null,D.elements[POSTFORM.elPrefix+"mail_posting"]);
CHECKS.showError(D.elements[POSTFORM.elPrefix+"pass_posting"].up(1),true,null,null,D.elements[POSTFORM.elPrefix+"pass_posting"]);CHECKS.showMessage(D.elements[POSTFORM.elPrefix+"mail_posting"],{},"incorrect_password",true);CHECKS.showMessage(D.elements[POSTFORM.elPrefix+"pass_posting"],{},"incorrect_password",false);submit_form=submit_form&&false;POSTFORM.sendPost(D);break;case"invalid_email":POSTFORM.trackerErrors.push("registration");CHECKS.showError(D.elements[POSTFORM.elPrefix+"mail_posting"].up(1),true,null,null,D.elements[POSTFORM.elPrefix+"mail_posting"]);
submit_form=submit_form&&false;POSTFORM.sendPost(D);break;case"duplicate_email":POSTFORM.trackerErrors.push("registration");$("posting_auth_login").click();POSTFORM.dontRaiseCaptcha=true;if("no_account"===POSTFORM.authType){CHECKS.showError(D.elements[POSTFORM.elPrefix+"mail_posting"].up(1),true,null,null,D.elements[POSTFORM.elPrefix+"mail_posting"]);CHECKS.showError(D.elements[POSTFORM.elPrefix+"pass_posting"].up(1),true,null,null,D.elements[POSTFORM.elPrefix+"pass_posting"]);CHECKS.showMessage(D.elements[POSTFORM.elPrefix+"mail_posting"],{},"duplicate_email",true);
CHECKS.showMessage(D.elements[POSTFORM.elPrefix+"pass_posting"],{},"duplicate_email",false);}else{CHECKS.showError(D.elements[POSTFORM.elPrefix+"mail_posting"].up(1),true,null,null,D.elements[POSTFORM.elPrefix+"mail_posting"]);CHECKS.showError(D.elements[POSTFORM.elPrefix+"pass_posting"].up(1),true,null,null,D.elements[POSTFORM.elPrefix+"pass_posting"]);CHECKS.showMessage(D.elements[POSTFORM.elPrefix+"mail_posting"],{},"duplicate_email",true);CHECKS.showMessage(D.elements[POSTFORM.elPrefix+"pass_posting"],{},"duplicate_email",false);
}submit_form=submit_form&&false;POSTFORM.sendPost(D);break;case"register_failed":case"invalid_captcha":if(true!=POSTFORM.dontRaiseCaptcha){POSTFORM.trackerErrors.push("registration");}CHECKS.showError(D.elements["captcha"].up(1),true,null,null,D.elements["captcha"]);submit_form=submit_form&&false;POSTFORM.sendPost(D);break;case"incorrect_username":POSTFORM.trackerErrors.push("registration");D.elements["incorrect_username"].value="1";break;case"no_account_succesful":submit_form=submit_form&&true;POSTFORM.sendPost(D,true);
break;case"login_successful":$("authorize_method").setAttribute("value",E.via);Cookie.set(VIVASTREET._cookie_name,F.responseText.gsub(/\s+/,""),30,VIVASTREET._gpc_domain);submit_form=submit_form&&true;if(($("logged_in_civility_posting")&&$("logged_in_year_posting"))||($("register_civility_posting")&&$("register_year_posting"))){var C=$("logged_in_civility_posting");var A=$("logged_in_year_posting");var G=true;if(!C||C.disabled){C=$("register_civility_posting");}if(!A||A.disabled){A=$("register_year_posting");
}if(!C||C.disabled){G=false;}if(true==G&&C.value==""){if(typeof (E.civility)=="undefined"||E.civility==""){CHECKS.showMessage($('logged_in_civility_posting'),{},"noempty",true);CHECKS.showError($('logged_in_civility_posting').up(1),true,null,null,$('logged_in_civility_posting'));POSTFORM.trackerErrors.push("civility");submit_form=submit_form&&false;
$('category_step_four').getElementsBySelector('.posting-auth-row-register input, .posting-auth-row-register select').each(Form.Element.disable); 
$('category_step_four').getElementsBySelector('.vs-posting-auth-message input, .vs-posting-auth-message select').each(Form.Element.enable); 

}else{C.value=E.civility;}}if(A.value==""){if(E.year_born>0){A.value=E.year_born;}}}VIVASTREET.login();POSTFORM.setLoggedIn();VIVASTREET.loginRefresh();POSTFORM.sendPost(D,true);break;}}},sendPost:function(F,A,C){if(A){if(validated&&submit_form){if("undefined"==typeof (C)){Lightbox.updateLogMessage(__("postform_validate")+" "+__("postform_success"),"success");
Lightbox.addLogMessage(__("postform_uploading"),"loading");setTimeout(POSTFORM.sendPost.bind(POSTFORM,F,A,true),2000);return ;}if(typeof (endSendTimeTracker)!="undefined"){endSendTimeTracker();}setTimeout("$('postform').submit()",750);}else{if("undefined"==typeof (C)){Lightbox.updateLogMessage(__("postform_validate")+" "+__("postform_errors_found"),"error");Lightbox.addLogMessage(__("postform_validate_error").replace("#errors#",POSTFORM.errors),"error");setTimeout(POSTFORM.sendPost.bind(POSTFORM,F,A,true),2000);
return ;}POSTFORM.resetCaptcha($("auth_action").value);$$(".captcha_error").each(function(G){$(G).addClassName("errorField");});$$(".highlightField").each(function(G){$(G).removeClassName("highlightField");});if("undefined"!=typeof (subdomainTracker)){if(POSTFORM.trackerErrors.length>0){var E=[];for(var B=0;B<POSTFORM.trackerErrors.length;B++){if(E.indexOf(POSTFORM.trackerErrors[B])<0){E.push(POSTFORM.trackerErrors[B]);}}var D=E.join("/");if(window.console){console.log("Processing error tracking: "+D);
}if(subdomainTracker){subdomainTracker._trackPageview("/click/light-box/error/"+D);}POSTFORM.trackerErrors=[];E=[];}}setTimeout(function(){Lightbox.hideLogger();POSTFORM.scrollToFirstError();},2000);}}else{if($("auth_action").value=="logged"||$("auth_action").value=="modify"){new Ajax.Request(location.href.sub("#",""),{method:"post",parameters:"xmlhttprequest=1&a=validateCaptcha&captcha="+F.elements["captcha"].value,onSuccess:function(G){setTimeout(POSTFORM.evalCaptchaResponse.bind(POSTFORM,G,F),10);
}});}else{POSTFORM.sendPost(F,true);}}},evalCaptchaResponse:function(resp,form){try{var data=resp.responseText;data=eval("("+data+")");if(data&&data.code=="error"){CHECKS.showError($("captcha").up(1),true,null,null,$("captcha"));POSTFORM.resetCaptcha($("auth_action").value);console.log("evalcaptcha before error: "+submit_form);submit_form=submit_form&&false;console.log("evalcaptcha after error: "+submit_form);POSTFORM.trackerErrors.push("captcha");POSTFORM.sendPost(form,true);}else{CHECKS.showError($("captcha").up(1),false,null,null,$("captcha"));
console.log("evalcaptcha before else: "+submit_form);submit_form=submit_form&&true;console.log("evalcaptcha after else: "+submit_form);POSTFORM.sendPost(form,true);}}catch(e){console.log("evalCaptchaResponse try hit exception");submit_form=false;CHECKS.showError($("captcha").up(1),true,null,null,$("captcha"));POSTFORM.resetCaptcha($("auth_action").value);POSTFORM.sendPost(form,true);}},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";}$("captcha").value="";$("captcha_image").src=VIVASTREET.captcha(B,"small",A);},changeAuthForm:function(A,C){if(A==this.authType){return ;}var B="";if($(this.elPrefix+"mail_posting")){B=$F(this.elPrefix+"mail_posting");}this.authType=A;this.elPrefix=((this.authType&&"register"!==this.authType)?this.authType+"-":"");if(0<B.length&&$(this.elPrefix+"mail_posting")){if(0===$F(this.elPrefix+"mail_posting").length){$(this.elPrefix+"mail_posting").value=B;}}},applyAuthLayer:function(B,E){return ;
var E="undefined"==typeof (E)?true:E;var D=("login"==B?"register":"login");var A=POSTFORM[B+"Layer"];var C=POSTFORM[D+"Layer"];C.style.display="none";A.style.display="block";Position.clone($$("#vs-auth-"+B+" table")[0],A);A.style.top="auto";A.style.marginTop="-"+A.offsetHeight+"px";if(POSTFORM.registerLayer.style.height){A.style.height=POSTFORM.registerLayer.style.height;}A.style.width="350px";if(E&&$("step_four").visible()){Form.getElements("vs-auth-"+D)[0].focus();}},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"){}}}}$("auth_action").value=A;if(A=="modify"){A="logged";}POSTFORM.resetCaptcha(A,skip_session_id);$("reset_captcha_link").onclick=function(){POSTFORM.resetCaptcha(A,skip_session_id);return false;};},hideDisclaimers:function(A){if("IT"==VIVASTREET._country_geo[1]){if(A==true){$("italy_terms_yes").checked=true;
$("italy_terms_yes2").checked=true;$$("#step_captcha .vs-posting-it-disclaimer").each(function(B){B.hide();});}else{$("italy_terms_yes").checked=false;$("italy_terms_yes2").checked=false;$$("#step_captcha .vs-posting-it-disclaimer").each(function(B){B.show();});}}},changeAuthType:function(C,B,A){if(C&&false==C.checked){return ;}if(!A){A=false;}var C=$(C);switch(B){case"no_account":POSTFORM.changeAuthForm("no_account");$$(".vs-posting-auth-table tr.posting-auth-row-register, .vs-posting-auth-table tr.posting-auth-row-login").each(function(D){D.hide();
D.style.backgroundColor="transparent";});$("category_step_four").getElementsBySelector(".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").each(Form.Element.disable);$$(".vs-posting-auth-table tr.posting-auth-row-no-account").each(function(D){D.show();D.style.backgroundColor="#F3F2F2";});$("category_step_four").getElementsBySelector(".posting-auth-row-no-account input, .posting-auth-row-no-account select").each(Form.Element.enable);
$$(".vs-posting-auth-table tr td.authTypeCheck").each(function(D){D.style.fontWeight="normal";D.up().style.backgroundColor="transparent";});C.up().style.fontWeight="bold";C.up().up().style.backgroundColor="#F3F2F2";if(true==A){$("no_account-mail_posting").disabled=true;}break;case"register":POSTFORM.changeAuthForm("register");$$(".vs-posting-auth-table tr.posting-auth-row-no-account, .vs-posting-auth-table tr.posting-auth-row-login").each(function(D){D.hide();D.style.backgroundColor="transparent";
});$("category_step_four").getElementsBySelector(".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").each(Form.Element.disable);$$(".vs-posting-auth-table tr.posting-auth-row-register").each(function(D){D.show();D.style.backgroundColor="#F3F2F2";});$("category_step_four").getElementsBySelector(".posting-auth-row-register input, .posting-auth-row-register select").each(Form.Element.enable);
$$(".vs-posting-auth-table tr td.authTypeCheck").each(function(D){D.style.fontWeight="normal";D.up().style.backgroundColor="transparent";});C.up().style.fontWeight="bold";C.up().up().style.backgroundColor="#F3F2F2";break;case"login":POSTFORM.changeAuthForm("login");$$(".vs-posting-auth-table tr.posting-auth-row-register, .vs-posting-auth-table tr.posting-auth-row-no-account").each(function(D){D.hide();D.style.backgroundColor="transparent";});$("category_step_four").getElementsBySelector(".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").each(Form.Element.disable);
$$(".vs-posting-auth-table tr.posting-auth-row-login").each(function(D){D.show();D.style.backgroundColor="#F3F2F2";});$("category_step_four").getElementsBySelector(".posting-auth-row-login input, .posting-auth-row-login select").each(Form.Element.enable);$$(".vs-posting-auth-table tr td.authTypeCheck").each(function(D){D.style.fontWeight="normal";D.up().style.backgroundColor="transparent";});C.up().style.fontWeight="bold";C.up().up().style.backgroundColor="#F3F2F2";break;}},setLoggedOut:function(A){$$("#category_step_four table.vs-posting-auth-table").first().show();
$$("#category_step_four table.vs-posting-auth-message").first().hide();$$("#vivastreet table.vs-posting-auth-table input[type=radio]").each(function(B){B.disabled=false;});POSTFORM.setCredentials("no_account",true);$("tr_logged_message").hide();},setLoggedIn:function(){POSTFORM.changeAuth("logged",POSTFORM.logged_msg+" "+VIVASTREET.username.bold());$$("#category_step_four table.vs-posting-auth-table").first().hide();$$("#category_step_four table.vs-posting-auth-message").first().show();$("posting_logged_in_username").update(VIVASTREET.username);
if("undefined"==typeof POSTFORM.authType||("login"!=POSTFORM.authType&&"register"!=POSTFORM.authType)){$("category_step_four").getElementsBySelector(".vs-posting-auth-message input, .vs-posting-auth-message select").each(Form.Element.enable);}},setModify:function(){POSTFORM.changeAuth("modify",POSTFORM.logged_msg+" "+VIVASTREET.username.bold());$$("#category_step_four table.vs-posting-auth-table").first().show();$$("#category_step_four table.vs-posting-auth-message").first().hide();},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($("posting_auth_"+(B||"no_account")),B||"no_account",C);}}else{if(true===C){POSTFORM.setModify();}else{POSTFORM.setLoggedIn();}$("category_step_four").getElementsBySelector(".posting-auth-row-register input, .posting-auth-row-no-account input, .posting-auth-row-register select, .posting-auth-row-no-account select").each(Form.Element.disable);
}},addPicture:function(A,D){var C=0;for(C;C<D;C++){this.pictures++;var B='<span class="step_three_ad_pic '+(this.pictures%2==0?"first_one_browse":"")+'"><input class="add_pic" type="file" name="picture[]" /></span>'+(this.pictures%2==1?"<br />":"");new Insertion.Bottom("picture_uploads",B);}if(this.pictures>A-1){$$(".more_pic_posting").each(function(E){E.innerHTML="&nbsp;";});return ;}return ;},removeUpload:function(A){try{A=$(A);if(A.up().hasClassName("pic-upload-resume")){var D="resume";}else{if(A.up().hasClassName("pic-upload-logo")){var D="logo";
}else{var D=A.previous().src.match(/([0-9]+)\.jpg/)[1];}}var B=new Ajax.Request(this.server,{method:"post",parameters:"xmlhttprequest=1&a=removeUpload&photo="+D,onSuccess:function(E){A.up().setStyle({"line-height":"66px"}).innerHTML=E.responseText;if(D=="resume"){var F=window.frames["upload_resume_frame"].document.createElement("input");F.type="file";F.id="Filedata";F.name="Filedata";F.onchange=window.frames["upload_resume_frame"].startUpload;window.frames["upload_resume_frame"].document.getElementById("upload").appendChild(F);
$("upload_id_resume").remove();$("posting_resume_attached").value=0;}else{if(D=="logo"){var F=window.frames["upload_logo_frame"].document.createElement("input");F.type="file";F.id="Filedata";F.name="Filedata";F.onchange=window.frames["upload_logo_frame"].startUpload;window.frames["upload_logo_frame"].document.getElementById("upload").appendChild(F);$("upload_id_logo").remove();$("posting_logo_attached").value=0;}}},onFailure:function(){alert("Service not available yet, please try again in a few secondes ;)");
}});}catch(C){}},gotoError:function(A){},scrollToFirstError:function(){var A=0;POSTFORM.error_element=false;$(document.getElementsByClassName("errorField")).each(function(C,B){if(B==0){POSTFORM.error_element=C;}});Element.scrollTo(POSTFORM.error_element);},scrollToBottom:function(){var A=0;POSTFORM.ie_element=false;document.getElementsByClassName("step_captcha").each(function(C,B){if(B==0){C.scrollIntoView(true);}B++;});},setPreview:function(A){$("publish").value=A?0:1;},unsetDefaultFields:function(){if(window.console){console.log("Starting with unsetDefaultFields()");
}var B=0;var A=document.getElementById("postform").elements;$A(A).each(function(F){F=$(F);try{var C=F.readAttribute("name");var D=F.readAttribute("type");var E=F.readAttribute("value");if((F.value==F.readAttribute("title"))&&(F.readAttribute("type")!="hidden")){F.value="";}}catch(F){if(window.console){console.log("Could not read values!");}}B++;});},highlightField:function(B){var A=($(B).up(".middle",0).next(".caption",0))?$(B).up(".middle",0).next(".caption",0):$(B).up(".middle",0).down(".caption",0);
if(VIVASTREET.isLogged()){if(null!==A.hasClassName("highlightField")){if(!$(B)){return false;}if(null!==$(B).readAttribute("onchange")&&null!==A){A.removeClassName("highlightField");CHECKS.showMessage(B,{},A.readAttribute("id"),true);}else{return false;}}}else{return false;}},checkPetType:function(B){var C=B;var A=document.getElementsByName("pet_type");if(1==A.length){var A=A[0];Event.observe(A,"change",function(){if("Chien"==A[A.selectedIndex].value){$("vs-element-disclaimer").innerHTML=C;$("vs-element-disclaimer").style.display="block";
}else{$("vs-element-disclaimer").innerHTML="";$("vs-element-disclaimer").style.display="none";}});}},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=$(B[D]);
if(C.value=="pro"){if(C.checked==true){POSTFORM.toggleProFields(C);$("pro_company_name_txt").value=POSTFORM.user_data["company_name"];$("pro_company_number_txt").value=POSTFORM.user_data["company_number"];if(window.console){console.log(POSTFORM.user_data["company_name"]+" 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=$(B[D]);if(C.value=="pro"){C.checked=true;POSTFORM.toggleProFields(C);}else{C.checked=false;}}},toggleProFields:function(B){B=$(B);elementTR=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.value){case"pro":case"individual_pro":if((!$("pro_company_name"))&&!$("pro_company_number")){new Insertion.After(elementTR,A);if(POSTFORM.user_data["company_name"]!=""){$("pro_company_name_txt").value=POSTFORM.user_data["company_name"];}if(POSTFORM.user_data["company_number"]!=""){$("pro_company_number_txt").value=POSTFORM.user_data["company_number"];}}break;case"individual":if($("pro_company_name_txt")&&""!=$("pro_company_name_txt").value){POSTFORM.user_data["company_name"]=$("pro_company_name_txt").value;
}if($("pro_company_number_txt")&&""!=$("pro_company_number_txt").value){POSTFORM.user_data["company_number"]=$("pro_company_number_txt").value;}if($("pro_company_name")){$("pro_company_name").remove();}if($("pro_company_number")){$("pro_company_number").remove();}break;}},setDescript:function(A){$("descript_caption").innerHTML=A;}};

/* services/jscalendar/calendar-stripped.js */

Calendar=function(D,C,F,A){this.activeDiv=null;this.currentDateEl=null;this.getDateStatus=null;this.getDateToolTip=null;this.getDateText=null;this.timeout=null;this.onSelected=F||null;this.onClose=A||null;this.dragging=false;this.hidden=false;this.minYear=1970;this.maxYear=2050;this.dateFormat=Calendar._TT["DEF_DATE_FORMAT"];this.ttDateFormat=Calendar._TT["TT_DATE_FORMAT"];this.isPopup=true;this.weekNumbers=true;this.firstDayOfWeek=typeof D=="number"?D:Calendar._FD;this.showsOtherMonths=false;this.dateStr=C;
this.ar_days=null;this.showsTime=false;this.time24=true;this.yearStep=2;this.hiliteToday=true;this.multiple=null;this.table=null;this.element=null;this.tbody=null;this.firstdayname=null;this.monthsCombo=null;this.yearsCombo=null;this.hilitedMonth=null;this.activeMonth=null;this.hilitedYear=null;this.activeYear=null;this.dateClicked=false;if(typeof Calendar._SDN=="undefined"){if(typeof Calendar._SDN_len=="undefined"){Calendar._SDN_len=3;}var B=new Array();for(var E=8;E>0;){B[--E]=Calendar._DN[E].substr(0,Calendar._SDN_len);
}Calendar._SDN=B;if(typeof Calendar._SMN_len=="undefined"){Calendar._SMN_len=3;}B=new Array();for(var E=12;E>0;){B[--E]=Calendar._MN[E].substr(0,Calendar._SMN_len);}Calendar._SMN=B;}};Calendar._C=null;Calendar.is_ie=(/msie/i.test(navigator.userAgent)&&!/opera/i.test(navigator.userAgent));Calendar.is_ie5=(Calendar.is_ie&&/msie 5\.0/i.test(navigator.userAgent));Calendar.is_ie7=(Calendar.is_ie&&/msie 7\.0/i.test(navigator.userAgent));Calendar.is_opera=/opera/i.test(navigator.userAgent);Calendar.is_khtml=/Konqueror|Safari|KHTML/i.test(navigator.userAgent);
Calendar.getAbsolutePos=function(E){var A=0,D=0;var C=/^div$/i.test(E.tagName);if(C&&E.scrollLeft){A=E.scrollLeft;}if(C&&E.scrollTop){D=E.scrollTop;}var F={x:E.offsetLeft-A,y:E.offsetTop-D};if(E.offsetParent){var B=this.getAbsolutePos(E.offsetParent);F.x+=B.x;F.y+=B.y;}return F;};Calendar.isRelated=function(C,A){var D=A.relatedTarget;if(!D){var B=A.type;if(B=="mouseover"){D=A.fromElement;}else{if(B=="mouseout"){D=A.toElement;}}}while(D){if(D==C){return true;}D=D.parentNode;}return false;};Calendar.removeClass=function(E,D){if(!(E&&E.className)){return ;
}var A=E.className.split(" ");var B=new Array();for(var C=A.length;C>0;){if(A[--C]!=D){B[B.length]=A[C];}}E.className=B.join(" ");};Calendar.addClass=function(B,A){Calendar.removeClass(B,A);B.className+=" "+A;};Calendar.getElement=function(A){var B=Calendar.is_ie?window.event.srcElement:A.currentTarget;while(B.nodeType!=1||/^div$/i.test(B.tagName)){B=B.parentNode;}return B;};Calendar.getTargetElement=function(A){var B=Calendar.is_ie?window.event.srcElement:A.target;while(B.nodeType!=1){B=B.parentNode;
}return B;};Calendar.stopEvent=function(A){A||(A=window.event);if(Calendar.is_ie){A.cancelBubble=true;A.returnValue=false;}else{A.preventDefault();A.stopPropagation();}return false;};Calendar.addEvent=function(A,C,B){if(A.attachEvent){A.attachEvent("on"+C,B);}else{if(A.addEventListener){A.addEventListener(C,B,true);}else{A["on"+C]=B;}}};Calendar.removeEvent=function(A,C,B){if(A.detachEvent){A.detachEvent("on"+C,B);}else{if(A.removeEventListener){A.removeEventListener(C,B,true);}else{A["on"+C]=null;
}}};Calendar.createElement=function(C,B){var A=null;if(document.createElementNS){A=document.createElementNS("http://www.w3.org/1999/xhtml",C);}else{A=document.createElement(C);}if(typeof B!="undefined"){B.appendChild(A);}return A;};Calendar._add_evs=function(el){with(Calendar){addEvent(el,"mouseover",dayMouseOver);addEvent(el,"mousedown",dayMouseDown);addEvent(el,"mouseout",dayMouseOut);if(is_ie){addEvent(el,"dblclick",dayMouseDblClick);el.setAttribute("unselectable",true);}}};Calendar.findMonth=function(A){if(typeof A.month!="undefined"){return A;
}else{if(typeof A.parentNode.month!="undefined"){return A.parentNode;}}return null;};Calendar.findYear=function(A){if(typeof A.year!="undefined"){return A;}else{if(typeof A.parentNode.year!="undefined"){return A.parentNode;}}return null;};Calendar.showMonthsCombo=function(){var E=Calendar._C;if(!E){return false;}var E=E;var F=E.activeDiv;var D=E.monthsCombo;if(E.hilitedMonth){Calendar.removeClass(E.hilitedMonth,"hilite");}if(E.activeMonth){Calendar.removeClass(E.activeMonth,"active");}var C=E.monthsCombo.getElementsByTagName("div")[E.date.getMonth()];
Calendar.addClass(C,"active");E.activeMonth=C;var B=D.style;B.display="block";if(F.navtype<0){B.left=F.offsetLeft+"px";}else{var A=D.offsetWidth;if(typeof A=="undefined"){A=50;}B.left=(F.offsetLeft+F.offsetWidth-A)+"px";}B.top=(F.offsetTop+F.offsetHeight)+"px";};Calendar.showYearsCombo=function(D){var A=Calendar._C;if(!A){return false;}var A=A;var C=A.activeDiv;var F=A.yearsCombo;if(A.hilitedYear){Calendar.removeClass(A.hilitedYear,"hilite");}if(A.activeYear){Calendar.removeClass(A.activeYear,"active");
}A.activeYear=null;var B=A.date.getFullYear()+(D?1:-1);var I=F.firstChild;var H=false;for(var E=12;E>0;--E){if(B>=A.minYear&&B<=A.maxYear){I.innerHTML=B;I.year=B;I.style.display="block";H=true;}else{I.style.display="none";}I=I.nextSibling;B+=D?A.yearStep:-A.yearStep;}if(H){var J=F.style;J.display="block";if(C.navtype<0){J.left=C.offsetLeft+"px";}else{var G=F.offsetWidth;if(typeof G=="undefined"){G=50;}J.left=(C.offsetLeft+C.offsetWidth-G)+"px";}J.top=(C.offsetTop+C.offsetHeight)+"px";}};Calendar.tableMouseUp=function(ev){var cal=Calendar._C;
if(!cal){return false;}if(cal.timeout){clearTimeout(cal.timeout);}var el=cal.activeDiv;if(!el){return false;}var target=Calendar.getTargetElement(ev);ev||(ev=window.event);Calendar.removeClass(el,"active");if(target==el||target.parentNode==el){Calendar.cellClick(el,ev);}var mon=Calendar.findMonth(target);var date=null;if(mon){date=new Date(cal.date);if(mon.month!=date.getMonth()){date.setMonth(mon.month);cal.setDate(date);cal.dateClicked=false;cal.callHandler();}}else{var year=Calendar.findYear(target);
if(year){date=new Date(cal.date);if(year.year!=date.getFullYear()){date.setFullYear(year.year);cal.setDate(date);cal.dateClicked=false;cal.callHandler();}}}with(Calendar){removeEvent(document,"mouseup",tableMouseUp);removeEvent(document,"mouseover",tableMouseOver);removeEvent(document,"mousemove",tableMouseOver);cal._hideCombos();_C=null;return stopEvent(ev);}};Calendar.tableMouseOver=function(M){var A=Calendar._C;if(!A){return ;}var C=A.activeDiv;var I=Calendar.getTargetElement(M);if(I==C||I.parentNode==C){Calendar.addClass(C,"hilite active");
Calendar.addClass(C.parentNode,"rowhilite");}else{if(typeof C.navtype=="undefined"||(C.navtype!=50&&(C.navtype==0||Math.abs(C.navtype)>2))){Calendar.removeClass(C,"active");}Calendar.removeClass(C,"hilite");Calendar.removeClass(C.parentNode,"rowhilite");}M||(M=window.event);if(C.navtype==50&&I!=C){var L=Calendar.getAbsolutePos(C);var O=C.offsetWidth;var N=M.clientX;var P;var K=true;if(N>L.x+O){P=N-L.x-O;K=false;}else{P=L.x-N;}if(P<0){P=0;}var F=C._range;var H=C._current;var G=Math.floor(P/10)%F.length;
for(var E=F.length;--E>=0;){if(F[E]==H){break;}}while(G-->0){if(K){if(--E<0){E=F.length-1;}}else{if(++E>=F.length){E=0;}}}var B=F[E];C.innerHTML=B;A.onUpdateTime();}var D=Calendar.findMonth(I);if(D){if(D.month!=A.date.getMonth()){if(A.hilitedMonth){Calendar.removeClass(A.hilitedMonth,"hilite");}Calendar.addClass(D,"hilite");A.hilitedMonth=D;}else{if(A.hilitedMonth){Calendar.removeClass(A.hilitedMonth,"hilite");}}}else{if(A.hilitedMonth){Calendar.removeClass(A.hilitedMonth,"hilite");}var J=Calendar.findYear(I);
if(J){if(J.year!=A.date.getFullYear()){if(A.hilitedYear){Calendar.removeClass(A.hilitedYear,"hilite");}Calendar.addClass(J,"hilite");A.hilitedYear=J;}else{if(A.hilitedYear){Calendar.removeClass(A.hilitedYear,"hilite");}}}else{if(A.hilitedYear){Calendar.removeClass(A.hilitedYear,"hilite");}}}return Calendar.stopEvent(M);};Calendar.tableMouseDown=function(A){if(Calendar.getTargetElement(A)==Calendar.getElement(A)){return Calendar.stopEvent(A);}};Calendar.calDragIt=function(B){var C=Calendar._C;if(!(C&&C.dragging)){return false;
}var E;var D;if(Calendar.is_ie){D=window.event.clientY+document.body.scrollTop;E=window.event.clientX+document.body.scrollLeft;}else{E=B.pageX;D=B.pageY;}C.hideShowCovered();var A=C.element.style;A.left=(E-C.xOffs)+"px";A.top=(D-C.yOffs)+"px";return Calendar.stopEvent(B);};Calendar.calDragEnd=function(ev){var cal=Calendar._C;if(!cal){return false;}cal.dragging=false;with(Calendar){removeEvent(document,"mousemove",calDragIt);removeEvent(document,"mouseup",calDragEnd);tableMouseUp(ev);}cal.hideShowCovered();
};Calendar.dayMouseDown=function(ev){var el=Calendar.getElement(ev);if(el.disabled){return false;}var cal=el.calendar;cal.activeDiv=el;Calendar._C=cal;if(el.navtype!=300){with(Calendar){if(el.navtype==50){el._current=el.innerHTML;addEvent(document,"mousemove",tableMouseOver);}else{addEvent(document,Calendar.is_ie5?"mousemove":"mouseover",tableMouseOver);}addClass(el,"hilite active");addEvent(document,"mouseup",tableMouseUp);}}else{if(cal.isPopup){cal._dragStart(ev);}}if(el.navtype==-1||el.navtype==1){if(cal.timeout){clearTimeout(cal.timeout);
}cal.timeout=setTimeout("Calendar.showMonthsCombo()",250);}else{if(el.navtype==-2||el.navtype==2){if(cal.timeout){clearTimeout(cal.timeout);}cal.timeout=setTimeout((el.navtype>0)?"Calendar.showYearsCombo(true)":"Calendar.showYearsCombo(false)",250);}else{cal.timeout=null;}}return Calendar.stopEvent(ev);};Calendar.dayMouseDblClick=function(A){Calendar.cellClick(Calendar.getElement(A),A||window.event);if(Calendar.is_ie){document.selection.empty();}};Calendar.dayMouseOver=function(B){var A=Calendar.getElement(B);
if(Calendar.isRelated(A,B)||Calendar._C||A.disabled){return false;}if(A.ttip){if(A.ttip.substr(0,1)=="_"){A.ttip=A.caldate.print(A.calendar.ttDateFormat)+A.ttip.substr(1);}A.calendar.tooltips.innerHTML=A.ttip;}if(A.navtype!=300){Calendar.addClass(A,"hilite");if(A.caldate){Calendar.addClass(A.parentNode,"rowhilite");}}return Calendar.stopEvent(B);};Calendar.dayMouseOut=function(ev){with(Calendar){var el=getElement(ev);if(isRelated(el,ev)||_C||el.disabled){return false;}removeClass(el,"hilite");if(el.caldate){removeClass(el.parentNode,"rowhilite");
}if(el.calendar){el.calendar.tooltips.innerHTML=_TT["SEL_DATE"];}return stopEvent(ev);}};Calendar.cellClick=function(E,N){var C=E.calendar;var H=false;var K=false;var F=null;if(typeof E.navtype=="undefined"){if(C.currentDateEl){Calendar.removeClass(C.currentDateEl,"selected");Calendar.addClass(E,"selected");H=(C.currentDateEl==E);if(!H){C.currentDateEl=E;}}C.date.setDateOnly(E.caldate);F=C.date;var B=!(C.dateClicked=!E.otherMonth);if(!B&&!C.currentDateEl){C._toggleMultipleDate(new Date(F));}else{K=!E.disabled;
}if(B){C._init(C.firstDayOfWeek,F);}}else{if(E.navtype==200){Calendar.removeClass(E,"hilite");C.callCloseHandler();return ;}F=new Date(C.date);if(E.navtype==0){F.setDateOnly(new Date());}C.dateClicked=false;var M=F.getFullYear();var G=F.getMonth();function A(Q){var R=F.getDate();var P=F.getMonthDays(Q);if(R>P){F.setDate(P);}F.setMonth(Q);}switch(E.navtype){case 400:Calendar.removeClass(E,"hilite");var O=Calendar._TT["ABOUT"];if(typeof O!="undefined"){O+=C.showsTime?Calendar._TT["ABOUT_TIME"]:"";}else{O='Help and about box text is not translated into this language.\nIf you know this language and you feel generous please update\nthe corresponding file in "lang" subdir to match calendar-en.js\nand send it back to <mihai_bazon@yahoo.com> to get it into the distribution  ;-)\n\nThank you!\nhttp://dynarch.com/mishoo/calendar.epl\n';
}alert(O);return ;case -2:if(M>C.minYear){F.setFullYear(M-1);}break;case -1:if(G>0){A(G-1);}else{if(M-->C.minYear){F.setFullYear(M);A(11);}}break;case 1:if(G<11){A(G+1);}else{if(M<C.maxYear){F.setFullYear(M+1);A(0);}}break;case 2:if(M<C.maxYear){F.setFullYear(M+1);}break;case 100:C.setFirstDayOfWeek(E.fdow);return ;case 50:var J=E._range;var L=E.innerHTML;for(var I=J.length;--I>=0;){if(J[I]==L){break;}}if(N&&N.shiftKey){if(--I<0){I=J.length-1;}}else{if(++I>=J.length){I=0;}}var D=J[I];E.innerHTML=D;
C.onUpdateTime();return ;case 0:if((typeof C.getDateStatus=="function")&&C.getDateStatus(F,F.getFullYear(),F.getMonth(),F.getDate())){return false;}break;}if(!F.equalsTo(C.date)){C.setDate(F);K=true;}else{if(E.navtype==0){K=H=true;}}}if(K){N&&C.callHandler();}if(H){Calendar.removeClass(E,"hilite");N&&C.callCloseHandler();}};Calendar.prototype.create=function(L){var K=null;if(!L){K=document.getElementsByTagName("body")[0];this.isPopup=true;}else{K=L;this.isPopup=false;}this.date=this.dateStr?new Date(this.dateStr):new Date();
var O=Calendar.createElement("table");this.table=O;O.cellSpacing=0;O.cellPadding=0;O.calendar=this;Calendar.addEvent(O,"mousedown",Calendar.tableMouseDown);var A=Calendar.createElement("div");this.element=A;A.className="calendar";if(this.isPopup){A.style.position="absolute";A.style.display="none";}A.appendChild(O);var I=Calendar.createElement("thead",O);var M=null;var P=null;var B=this;var E=function(S,R,Q){M=Calendar.createElement("td",P);M.colSpan=R;M.className="button";if(Q!=0&&Math.abs(Q)<=2){M.className+=" nav";
}Calendar._add_evs(M);M.calendar=B;M.navtype=Q;M.innerHTML="<div unselectable='on'>"+S+"</div>";return M;};P=Calendar.createElement("tr",I);var C=6;(this.isPopup)&&--C;(this.weekNumbers)&&++C;E("?",1,400).ttip=Calendar._TT["INFO"];this.title=E("",C,300);this.title.className="title";if(this.isPopup){this.title.ttip=Calendar._TT["DRAG_TO_MOVE"];this.title.style.cursor="move";E("&#x00d7;",1,200).ttip=Calendar._TT["CLOSE"];}P=Calendar.createElement("tr",I);P.className="headrow";this._nav_py=E("&#x00ab;",1,-2);
this._nav_py.ttip=Calendar._TT["PREV_YEAR"];this._nav_pm=E("&#x2039;",1,-1);this._nav_pm.ttip=Calendar._TT["PREV_MONTH"];this._nav_now=E(Calendar._TT["TODAY"],this.weekNumbers?4:3,0);this._nav_now.ttip=Calendar._TT["GO_TODAY"];this._nav_nm=E("&#x203a;",1,1);this._nav_nm.ttip=Calendar._TT["NEXT_MONTH"];this._nav_ny=E("&#x00bb;",1,2);this._nav_ny.ttip=Calendar._TT["NEXT_YEAR"];P=Calendar.createElement("tr",I);P.className="daynames";if(this.weekNumbers){M=Calendar.createElement("td",P);M.className="name wn";
M.innerHTML=Calendar._TT["WK"];}for(var H=7;H>0;--H){M=Calendar.createElement("td",P);if(!H){M.navtype=100;M.calendar=this;Calendar._add_evs(M);}}this.firstdayname=(this.weekNumbers)?P.firstChild.nextSibling:P.firstChild;this._displayWeekdays();var G=Calendar.createElement("tbody",O);this.tbody=G;for(H=6;H>0;--H){P=Calendar.createElement("tr",G);if(this.weekNumbers){M=Calendar.createElement("td",P);}for(var F=7;F>0;--F){M=Calendar.createElement("td",P);M.calendar=this;Calendar._add_evs(M);}}if(this.showsTime){P=Calendar.createElement("tr",G);
P.className="time";M=Calendar.createElement("td",P);M.className="time";M.colSpan=2;M.innerHTML=Calendar._TT["TIME"]||"&nbsp;";M=Calendar.createElement("td",P);M.className="time";M.colSpan=this.weekNumbers?4:3;(function(){function T(c,e,d,f){var a=Calendar.createElement("span",M);a.className=c;a.innerHTML=e;a.calendar=B;a.ttip=Calendar._TT["TIME_PART"];a.navtype=50;a._range=[];if(typeof d!="number"){a._range=d;}else{for(var b=d;b<=f;++b){var Z;if(b<10&&f>=10){Z="0"+b;}else{Z=""+b;}a._range[a._range.length]=Z;
}}Calendar._add_evs(a);return a;}var X=B.date.getHours();var Q=B.date.getMinutes();var Y=!B.time24;var R=(X>12);if(Y&&R){X-=12;}var V=T("hour",X,Y?1:0,Y?12:23);var U=Calendar.createElement("span",M);U.innerHTML=":";U.className="colon";var S=T("minute",Q,0,59);var W=null;M=Calendar.createElement("td",P);M.className="time";M.colSpan=2;if(Y){W=T("ampm",R?"pm":"am",["am","pm"]);}else{M.innerHTML="&nbsp;";}B.onSetTime=function(){var a,Z=this.date.getHours(),b=this.date.getMinutes();if(Y){a=(Z>=12);if(a){Z-=12;
}if(Z==0){Z=12;}W.innerHTML=a?"pm":"am";}V.innerHTML=(Z<10)?("0"+Z):Z;S.innerHTML=(b<10)?("0"+b):b;};B.onUpdateTime=function(){var a=this.date;var b=parseInt(V.innerHTML,10);if(Y){if(/pm/i.test(W.innerHTML)&&b<12){b+=12;}else{if(/am/i.test(W.innerHTML)&&b==12){b=0;}}}var c=a.getDate();var Z=a.getMonth();var e=a.getFullYear();a.setHours(b);a.setMinutes(parseInt(S.innerHTML,10));a.setFullYear(e);a.setMonth(Z);a.setDate(c);this.dateClicked=false;this.callHandler();};})();}else{this.onSetTime=this.onUpdateTime=function(){};
}var J=Calendar.createElement("tfoot",O);P=Calendar.createElement("tr",J);P.className="footrow";M=E(Calendar._TT["SEL_DATE"],this.weekNumbers?8:7,300);M.className="ttip";if(this.isPopup){M.ttip=Calendar._TT["DRAG_TO_MOVE"];M.style.cursor="move";}this.tooltips=M;A=Calendar.createElement("div",this.element);this.monthsCombo=A;A.className="combo";for(H=0;H<Calendar._MN.length;++H){var D=Calendar.createElement("div");D.className=Calendar.is_ie?"label-IEfix":"label";D.month=H;D.innerHTML=Calendar._SMN[H];
A.appendChild(D);}A=Calendar.createElement("div",this.element);this.yearsCombo=A;A.className="combo";for(H=12;H>0;--H){var N=Calendar.createElement("div");N.className=Calendar.is_ie?"label-IEfix":"label";A.appendChild(N);}this._init(this.firstDayOfWeek,this.date);K.appendChild(this.element);};Calendar._keyEvent=function(L){var A=window._dynarch_popupCalendar;if(!A||A.multiple){return false;}(Calendar.is_ie)&&(L=window.event);var I=(Calendar.is_ie||L.type=="keypress"),M=L.keyCode;if(L.ctrlKey){switch(M){case 37:I&&Calendar.cellClick(A._nav_pm);
break;case 38:I&&Calendar.cellClick(A._nav_py);break;case 39:I&&Calendar.cellClick(A._nav_nm);break;case 40:I&&Calendar.cellClick(A._nav_ny);break;default:return false;}}else{switch(M){case 32:Calendar.cellClick(A._nav_now);break;case 27:I&&A.callCloseHandler();break;case 37:case 38:case 39:case 40:if(I){var E,N,J,G,C,D;E=M==37||M==38;D=(M==37||M==39)?1:7;function B(){C=A.currentDateEl;var K=C.pos;N=K&15;J=K>>4;G=A.ar_days[J][N];}B();function F(){var K=new Date(A.date);K.setDate(K.getDate()-D);A.setDate(K);
}function H(){var K=new Date(A.date);K.setDate(K.getDate()+D);A.setDate(K);}while(1){switch(M){case 37:if(--N>=0){G=A.ar_days[J][N];}else{N=6;M=38;continue;}break;case 38:if(--J>=0){G=A.ar_days[J][N];}else{F();B();}break;case 39:if(++N<7){G=A.ar_days[J][N];}else{N=0;M=40;continue;}break;case 40:if(++J<A.ar_days.length){G=A.ar_days[J][N];}else{H();B();}break;}break;}if(G){if(!G.disabled){Calendar.cellClick(G);}else{if(E){F();}else{H();}}}}break;case 13:if(I){Calendar.cellClick(A.currentDateEl,L);}break;
default:return false;}}return Calendar.stopEvent(L);};Calendar.prototype._init=function(L,V){var U=new Date(),P=U.getFullYear(),X=U.getMonth(),B=U.getDate();this.table.style.visibility="hidden";var H=V.getFullYear();if(H<this.minYear){H=this.minYear;V.setFullYear(H);}else{if(H>this.maxYear){H=this.maxYear;V.setFullYear(H);}}this.firstDayOfWeek=L;this.date=new Date(V);var W=V.getMonth();var Z=V.getDate();var Y=V.getMonthDays();V.setDate(1);var Q=(V.getDay()-this.firstDayOfWeek)%7;if(Q<0){Q+=7;}V.setDate(-Q);
V.setDate(V.getDate()+1);var E=this.tbody.firstChild;var J=Calendar._SMN[W];var N=this.ar_days=new Array();var M=Calendar._TT["WEEKEND"];var D=this.multiple?(this.datesCells={}):null;for(var S=0;S<6;++S,E=E.nextSibling){var A=E.firstChild;if(this.weekNumbers){A.className="day wn";A.innerHTML=V.getWeekNumber();A=A.nextSibling;}E.className="daysrow";var T=false,F,C=N[S]=[];for(var R=0;R<7;++R,A=A.nextSibling,V.setDate(F+1)){F=V.getDate();var G=V.getDay();A.className="day";A.pos=S<<4|R;C[R]=A;var K=(V.getMonth()==W);
if(!K){if(this.showsOtherMonths){A.className+=" othermonth";A.otherMonth=true;}else{A.className="emptycell";A.innerHTML="&nbsp;";A.disabled=true;continue;}}else{A.otherMonth=false;T=true;}A.disabled=false;A.innerHTML=this.getDateText?this.getDateText(V,F):F;if(D){D[V.print("%Y%m%d")]=A;}if(this.getDateStatus){var O=this.getDateStatus(V,H,W,F);if(this.getDateToolTip){var I=this.getDateToolTip(V,H,W,F);if(I){A.title=I;}}if(O===true){A.className+=" disabled";A.disabled=true;}else{if(/disabled/i.test(O)){A.disabled=true;
}A.className+=" "+O;}}if(!A.disabled){A.caldate=new Date(V);A.ttip="_";if(!this.multiple&&K&&F==Z&&this.hiliteToday){A.className+=" selected";this.currentDateEl=A;}if(V.getFullYear()==P&&V.getMonth()==X&&F==B){A.className+=" today";A.ttip+=Calendar._TT["PART_TODAY"];}if(M.indexOf(G.toString())!=-1){A.className+=A.otherMonth?" oweekend":" weekend";}}}if(!(T||this.showsOtherMonths)){E.className="emptyrow";}}this.title.innerHTML=Calendar._MN[W]+", "+H;this.onSetTime();this.table.style.visibility="visible";
this._initMultipleDates();};Calendar.prototype._initMultipleDates=function(){if(this.multiple){for(var B in this.multiple){var A=this.datesCells[B];var C=this.multiple[B];if(!C){continue;}if(A){A.className+=" selected";}}}};Calendar.prototype._toggleMultipleDate=function(B){if(this.multiple){var C=B.print("%Y%m%d");var A=this.datesCells[C];if(A){var D=this.multiple[C];if(!D){Calendar.addClass(A,"selected");this.multiple[C]=B;}else{Calendar.removeClass(A,"selected");delete this.multiple[C];}}}};Calendar.prototype.setDateToolTipHandler=function(A){this.getDateToolTip=A;
};Calendar.prototype.setDate=function(A){if(!A.equalsTo(this.date)){this._init(this.firstDayOfWeek,A);}};Calendar.prototype.refresh=function(){this._init(this.firstDayOfWeek,this.date);};Calendar.prototype.setFirstDayOfWeek=function(A){this._init(A,this.date);this._displayWeekdays();};Calendar.prototype.setDateStatusHandler=Calendar.prototype.setDisabledHandler=function(A){this.getDateStatus=A;};Calendar.prototype.setRange=function(A,B){this.minYear=A;this.maxYear=B;};Calendar.prototype.callHandler=function(){if(this.onSelected){this.onSelected(this,this.date.print(this.dateFormat));
}};Calendar.prototype.callCloseHandler=function(){if(this.onClose){this.onClose(this);}this.hideShowCovered();};Calendar.prototype.destroy=function(){var A=this.element.parentNode;A.removeChild(this.element);Calendar._C=null;window._dynarch_popupCalendar=null;};Calendar.prototype.reparent=function(B){var A=this.element;A.parentNode.removeChild(A);B.appendChild(A);};Calendar._checkCalendar=function(B){var C=window._dynarch_popupCalendar;if(!C){return false;}var A=Calendar.is_ie?Calendar.getElement(B):Calendar.getTargetElement(B);
for(;A!=null&&A!=C.element;A=A.parentNode){}if(A==null){window._dynarch_popupCalendar.callCloseHandler();return Calendar.stopEvent(B);}};Calendar.prototype.show=function(){var E=this.table.getElementsByTagName("tr");for(var D=E.length;D>0;){var F=E[--D];Calendar.removeClass(F,"rowhilite");var C=F.getElementsByTagName("td");for(var B=C.length;B>0;){var A=C[--B];Calendar.removeClass(A,"hilite");Calendar.removeClass(A,"active");}}this.element.style.display="block";this.hidden=false;if(this.isPopup){window._dynarch_popupCalendar=this;
Calendar.addEvent(document,"keydown",Calendar._keyEvent);Calendar.addEvent(document,"keypress",Calendar._keyEvent);Calendar.addEvent(document,"mousedown",Calendar._checkCalendar);}this.hideShowCovered();};Calendar.prototype.hide=function(){if(this.isPopup){Calendar.removeEvent(document,"keydown",Calendar._keyEvent);Calendar.removeEvent(document,"keypress",Calendar._keyEvent);Calendar.removeEvent(document,"mousedown",Calendar._checkCalendar);}this.element.style.display="none";this.hidden=true;this.hideShowCovered();
};Calendar.prototype.showAt=function(A,C){var B=this.element.style;B.left=A+"px";B.top=C+"px";this.show();};Calendar.prototype.showAtElement=function(C,D){var A=this;var E=Calendar.getAbsolutePos(C);if(!D||typeof D!="string"){this.showAt(E.x,E.y+C.offsetHeight);return true;}function B(I){if(I.x<0){I.x=0;}if(I.y<0){I.y=0;}var J=document.createElement("div");var H=J.style;H.position="absolute";H.right=H.bottom=H.width=H.height="0px";document.body.appendChild(J);var G=Calendar.getAbsolutePos(J);document.body.removeChild(J);
if(Calendar.is_ie&&!Calendar.is_ie7){G.y+=document.body.scrollTop;G.x+=document.body.scrollLeft;}else{G.y+=window.scrollY;G.x+=window.scrollX;}var F=I.x+I.width-G.x;if(F>0){I.x-=F;}F=I.y+I.height-G.y;if(F>0){I.y-=F;}}this.element.style.display="block";Calendar.continuation_for_the_fucking_khtml_browser=function(){var F=A.element.offsetWidth;var H=A.element.offsetHeight;A.element.style.display="none";var G=D.substr(0,1);var I="l";if(D.length>1){I=D.substr(1,1);}switch(G){case"T":E.y-=H;break;case"B":E.y+=C.offsetHeight;
break;case"C":E.y+=(C.offsetHeight-H)/2;break;case"t":E.y+=C.offsetHeight-H;break;case"b":break;}switch(I){case"L":E.x-=F;break;case"R":E.x+=C.offsetWidth;break;case"C":E.x+=(C.offsetWidth-F)/2;break;case"l":E.x+=C.offsetWidth-F;break;case"r":break;}E.width=F;E.height=H+40;A.monthsCombo.style.display="none";B(E);A.showAt(E.x,E.y);};if(Calendar.is_khtml){setTimeout("Calendar.continuation_for_the_fucking_khtml_browser()",10);}else{Calendar.continuation_for_the_fucking_khtml_browser();}};Calendar.prototype.setDateFormat=function(A){this.dateFormat=A;
};Calendar.prototype.setTtDateFormat=function(A){this.ttDateFormat=A;};Calendar.prototype.parseDate=function(B,A){if(!A){A=this.dateFormat;}this.setDate(Date.parseDate(B,A));};Calendar.prototype.hideShowCovered=function(){if(!Calendar.is_ie&&!Calendar.is_opera){return ;}function B(R){var Q=R.style.visibility;if(!Q){if(document.defaultView&&typeof (document.defaultView.getComputedStyle)=="function"){if(!Calendar.is_khtml){Q=document.defaultView.getComputedStyle(R,"").getPropertyValue("visibility");
}else{Q="";}}else{if(R.currentStyle){Q=R.currentStyle.visibility;}else{Q="";}}}return Q;}var P=new Array("applet","iframe","select");var C=this.element;var A=Calendar.getAbsolutePos(C);var F=A.x;var D=C.offsetWidth+F;var O=A.y;var N=C.offsetHeight+O;for(var H=P.length;H>0;){var G=document.getElementsByTagName(P[--H]);var E=null;for(var J=G.length;J>0;){E=G[--J];A=Calendar.getAbsolutePos(E);var M=A.x;var L=E.offsetWidth+M;var K=A.y;var I=E.offsetHeight+K;if(this.hidden||(M>D)||(L<F)||(K>N)||(I<O)){if(!E.__msh_save_visibility){E.__msh_save_visibility=B(E);
}E.style.visibility=E.__msh_save_visibility;}else{if(!E.__msh_save_visibility){E.__msh_save_visibility=B(E);}E.style.visibility="hidden";}}}};Calendar.prototype._displayWeekdays=function(){var B=this.firstDayOfWeek;var A=this.firstdayname;var D=Calendar._TT["WEEKEND"];for(var C=0;C<7;++C){A.className="day name";var E=(C+B)%7;if(C){A.ttip=Calendar._TT["DAY_FIRST"].replace("%s",Calendar._DN[E]);A.navtype=100;A.calendar=this;A.fdow=E;Calendar._add_evs(A);}if(D.indexOf(E.toString())!=-1){Calendar.addClass(A,"weekend");
}A.innerHTML=Calendar._SDN[(C+B)%7];A=A.nextSibling;}};Calendar.prototype._hideCombos=function(){this.monthsCombo.style.display="none";this.yearsCombo.style.display="none";};Calendar.prototype._dragStart=function(ev){if(this.dragging){return ;}this.dragging=true;var posX;var posY;if(Calendar.is_ie){posY=window.event.clientY+document.body.scrollTop;posX=window.event.clientX+document.body.scrollLeft;}else{posY=ev.clientY+window.scrollY;posX=ev.clientX+window.scrollX;}var st=this.element.style;this.xOffs=posX-parseInt(st.left);
this.yOffs=posY-parseInt(st.top);with(Calendar){addEvent(document,"mousemove",calDragIt);addEvent(document,"mouseup",calDragEnd);}};Date._MD=new Array(31,28,31,30,31,30,31,31,30,31,30,31);Date.SECOND=1000;Date.MINUTE=60*Date.SECOND;Date.HOUR=60*Date.MINUTE;Date.DAY=24*Date.HOUR;Date.WEEK=7*Date.DAY;Date.parseDate=function(G,A){var H=new Date();var I=0;var B=-1;var F=0;var K=G.split(/\W+/);var J=A.match(/%./g);var E=0,D=0;var L=0;var C=0;for(E=0;E<K.length;++E){if(!K[E]){continue;}switch(J[E]){case"%d":case"%e":F=parseInt(K[E],10);
break;case"%m":B=parseInt(K[E],10)-1;break;case"%Y":case"%y":I=parseInt(K[E],10);(I<100)&&(I+=(I>29)?1900:2000);break;case"%b":case"%B":for(D=0;D<12;++D){if(Calendar._MN[D].substr(0,K[E].length).toLowerCase()==K[E].toLowerCase()){B=D;break;}}break;case"%H":case"%I":case"%k":case"%l":L=parseInt(K[E],10);break;case"%P":case"%p":if(/pm/i.test(K[E])&&L<12){L+=12;}else{if(/am/i.test(K[E])&&L>=12){L-=12;}}break;case"%M":C=parseInt(K[E],10);break;}}if(isNaN(I)){I=H.getFullYear();}if(isNaN(B)){B=H.getMonth();
}if(isNaN(F)){F=H.getDate();}if(isNaN(L)){L=H.getHours();}if(isNaN(C)){C=H.getMinutes();}if(I!=0&&B!=-1&&F!=0){return new Date(I,B,F,L,C,0);}I=0;B=-1;F=0;for(E=0;E<K.length;++E){if(K[E].search(/[a-zA-Z]+/)!=-1){var M=-1;for(D=0;D<12;++D){if(Calendar._MN[D].substr(0,K[E].length).toLowerCase()==K[E].toLowerCase()){M=D;break;}}if(M!=-1){if(B!=-1){F=B+1;}B=M;}}else{if(parseInt(K[E],10)<=12&&B==-1){B=K[E]-1;}else{if(parseInt(K[E],10)>31&&I==0){I=parseInt(K[E],10);(I<100)&&(I+=(I>29)?1900:2000);}else{if(F==0){F=K[E];
}}}}}if(I==0){I=H.getFullYear();}if(B!=-1&&F!=0){return new Date(I,B,F,L,C,0);}return H;};Date.prototype.getMonthDays=function(B){var A=this.getFullYear();if(typeof B=="undefined"){B=this.getMonth();}if(((0==(A%4))&&((0!=(A%100))||(0==(A%400))))&&B==1){return 29;}else{return Date._MD[B];}};Date.prototype.getDayOfYear=function(){var A=new Date(this.getFullYear(),this.getMonth(),this.getDate(),0,0,0);var C=new Date(this.getFullYear(),0,0,0,0,0);var B=A-C;return Math.floor(B/Date.DAY);};Date.prototype.getWeekNumber=function(){var C=new Date(this.getFullYear(),this.getMonth(),this.getDate(),0,0,0);
var B=C.getDay();C.setDate(C.getDate()-(B+6)%7+3);var A=C.valueOf();C.setMonth(0);C.setDate(4);return Math.round((A-C.valueOf())/(7*86400000))+1;};Date.prototype.equalsTo=function(A){return((this.getFullYear()==A.getFullYear())&&(this.getMonth()==A.getMonth())&&(this.getDate()==A.getDate())&&(this.getHours()==A.getHours())&&(this.getMinutes()==A.getMinutes()));};Date.prototype.setDateOnly=function(A){var B=new Date(A);this.setDate(1);this.setFullYear(B.getFullYear());this.setMonth(B.getMonth());this.setDate(B.getDate());
};Date.prototype.print=function(I){var A=this.getMonth();var H=this.getDate();var J=this.getFullYear();var L=this.getWeekNumber();var M=this.getDay();var Q={};var N=this.getHours();var B=(N>=12);var F=(B)?(N-12):N;var P=this.getDayOfYear();if(F==0){F=12;}var C=this.getMinutes();var G=this.getSeconds();Q["%a"]=Calendar._SDN[M];Q["%A"]=Calendar._DN[M];Q["%b"]=Calendar._SMN[A];Q["%B"]=Calendar._MN[A];Q["%C"]=1+Math.floor(J/100);Q["%d"]=(H<10)?("0"+H):H;Q["%e"]=H;Q["%H"]=(N<10)?("0"+N):N;Q["%I"]=(F<10)?("0"+F):F;
Q["%j"]=(P<100)?((P<10)?("00"+P):("0"+P)):P;Q["%k"]=N;Q["%l"]=F;Q["%m"]=(A<9)?("0"+(1+A)):(1+A);Q["%M"]=(C<10)?("0"+C):C;Q["%n"]="\n";Q["%p"]=B?"PM":"AM";Q["%P"]=B?"pm":"am";Q["%s"]=Math.floor(this.getTime()/1000);Q["%S"]=(G<10)?("0"+G):G;Q["%t"]="\t";Q["%U"]=Q["%W"]=Q["%V"]=(L<10)?("0"+L):L;Q["%u"]=M+1;Q["%w"]=M;Q["%y"]=(""+J).substr(2,2);Q["%Y"]=J;Q["%%"]="%";var O=/%./g;if(!Calendar.is_ie5&&!Calendar.is_khtml){return I.replace(O,function(R){return Q[R]||R;});}var K=I.match(O);for(var E=0;E<K.length;
E++){var D=Q[K[E]];if(D){O=new RegExp(K[E],"g");I=I.replace(O,D);}}return I;};Date.prototype.__msh_oldSetFullYear=Date.prototype.setFullYear;Date.prototype.setFullYear=function(B){var A=new Date(this);A.__msh_oldSetFullYear(B);if(A.getMonth()!=this.getMonth()){this.setDate(28);}this.__msh_oldSetFullYear(B);};window._dynarch_popupCalendar=null;

/* services/jscalendar/calendar-setup_stripped.js */

/*  Copyright Mihai Bazon, 2002, 2003  |  http://dynarch.com/mishoo/
 * ---------------------------------------------------------------------------
 *
 * The DHTML Calendar
 *
 * Details and latest version at:
 * http://dynarch.com/mishoo/calendar.epl
 *
 * This script is distributed under the GNU Lesser General Public License.
 * Read the entire license text here: http://www.gnu.org/licenses/lgpl.html
 *
 * This file defines helper functions for setting up the calendar.  They are
 * intended to help non-programmers get a working calendar on their site
 * quickly.  This script should not be seen as part of the calendar.  It just
 * shows you what one can do with the calendar, while in the same time
 * providing a quick and simple method for setting it up.  If you need
 * exhaustive customization of the calendar creation process feel free to
 * modify this code to suit your needs (this is recommended and much better
 * than modifying calendar.js itself).
 */
 Calendar.setup=function(params){function param_default(pname,def){if(typeof params[pname]=="undefined"){params[pname]=def;}};param_default("inputField",null);param_default("displayArea",null);param_default("button",null);param_default("eventName","click");param_default("ifFormat","%Y/%m/%d");param_default("daFormat","%Y/%m/%d");param_default("singleClick",true);param_default("disableFunc",null);param_default("dateStatusFunc",params["disableFunc"]);param_default("dateText",null);param_default("firstDay",null);param_default("align","Br");param_default("range",[1900,2999]);param_default("weekNumbers",true);param_default("flat",null);param_default("flatCallback",null);param_default("onSelect",null);param_default("onClose",null);param_default("onUpdate",null);param_default("date",null);param_default("showsTime",false);param_default("timeFormat","24");param_default("electric",true);param_default("step",2);param_default("position",null);param_default("cache",false);param_default("showOthers",false);param_default("multiple",null);var tmp=["inputField","displayArea","button"];for(var i in tmp){if(typeof params[tmp[i]]=="string"){params[tmp[i]]=document.getElementById(params[tmp[i]]);}}if(!(params.flat||params.multiple||params.inputField||params.displayArea||params.button)){alert("Calendar.setup:\n  Nothing to setup (no fields found).  Please check your code");return false;}function onSelect(cal){var p=cal.params;var update=(cal.dateClicked||p.electric);if(update&&p.inputField){p.inputField.value=cal.date.print(p.ifFormat);if(typeof p.inputField.onchange=="function")p.inputField.onchange();}if(update&&p.displayArea)p.displayArea.innerHTML=cal.date.print(p.daFormat);if(update&&typeof p.onUpdate=="function")p.onUpdate(cal);if(update&&p.flat){if(typeof p.flatCallback=="function")p.flatCallback(cal);}if(update&&p.singleClick&&cal.dateClicked)cal.callCloseHandler();};if(params.flat!=null){if(typeof params.flat=="string")params.flat=document.getElementById(params.flat);if(!params.flat){alert("Calendar.setup:\n  Flat specified but can't find parent.");return false;}var cal=new Calendar(params.firstDay,params.date,params.onSelect||onSelect);cal.showsOtherMonths=params.showOthers;cal.showsTime=params.showsTime;cal.time24=(params.timeFormat=="24");cal.params=params;cal.weekNumbers=params.weekNumbers;cal.setRange(params.range[0],params.range[1]);cal.setDateStatusHandler(params.dateStatusFunc);cal.getDateText=params.dateText;if(params.ifFormat){cal.setDateFormat(params.ifFormat);}if(params.inputField&&typeof params.inputField.value=="string"){cal.parseDate(params.inputField.value);}cal.create(params.flat);cal.show();return false;}var triggerEl=params.button||params.displayArea||params.inputField;triggerEl["on"+params.eventName]=function(){var dateEl=params.inputField||params.displayArea;var dateFmt=params.inputField?params.ifFormat:params.daFormat;var mustCreate=false;var cal=window.calendar;if(dateEl)params.date=Date.parseDate(dateEl.value||dateEl.innerHTML,dateFmt);if(!(cal&&params.cache)){window.calendar=cal=new Calendar(params.firstDay,params.date,params.onSelect||onSelect,params.onClose||function(cal){cal.hide();});cal.showsTime=params.showsTime;cal.time24=(params.timeFormat=="24");cal.weekNumbers=params.weekNumbers;mustCreate=true;}else{if(params.date)cal.setDate(params.date);cal.hide();}if(params.multiple){cal.multiple={};for(var i=params.multiple.length;--i>=0;){var d=params.multiple[i];var ds=d.print("%Y%m%d");cal.multiple[ds]=d;}}cal.showsOtherMonths=params.showOthers;cal.yearStep=params.step;cal.setRange(params.range[0],params.range[1]);cal.params=params;cal.setDateStatusHandler(params.dateStatusFunc);cal.getDateText=params.dateText;cal.setDateFormat(dateFmt);if(mustCreate)cal.create();cal.refresh();if(!params.position)cal.showAtElement(params.button||params.displayArea||params.inputField,params.align);else cal.showAt(params.position[0],params.position[1]);return false;};return cal;};

