function getFlashVersion(){try{try{var a=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");try{a.AllowScriptAccess="always"}catch(b){return"6,0,0"}}catch(b){}return(new ActiveXObject("ShockwaveFlash.ShockwaveFlash")).GetVariable("$version").replace(/\D+/g,",").match(/^,?(.+),?$/)[1]}catch(b){try{if(navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin){return(navigator.plugins["Shockwave Flash 2.0"]||navigator.plugins["Shockwave Flash"]).description.replace(/\D+/g,",").match(/^,?(.+),?$/)[1]}}catch(b){}}return"0,0,0"}function validateRow(a,b){a.each(function(a){var c=$(this).get(0).tagName;if($(this).val()=="0"&&c=="SELECT"||$(this).val()==""&&c=="INPUT"||$(this).val()==""&&c=="TEXTAREA"){$(this).parent().addClass("errors");b=false;if(c=="SELECT"){$(this).change(function(){$(this).parent().removeClass("errors")})}else{$(this).focus(function(){$(this).parent().removeClass("errors")})}}});return b}function confirmSubmit(a){var b=confirm(a);if(b){return true}else{return false}}function uploader(){function c(a,b){if(b=="success"){if(a.get=="1"){spanDel='<span class="deleter" id="deleter_'+a.id+'">usuń</span>';var c=$("<div></div>").append($("<img/>").attr({src:a.src,alt:""}),spanDel).addClass("pic").attr({id:"pic_"+a.id});if(a.end<1){$("#form-upload").hide()}$("#pictures").append(c);if(a.aid=="0"){$("#deleter_"+a.id).click(function(){deleter(a.id,a.file,"","",a.date)})}else{$("#deleter_"+a.id).click(function(){deleter(a.id,a.file,a.aid,a.editcode)})}}else if(a.get=="2"){$("#pic-err").html('<span class="error">Niepoprawne rozszerzenie zdjęcia (dozwolone tylko jpg/gif/png)</span>')}else if(a.get=="3"){$("#pic-err").html('<span class="error">Rozmiar zdjęcia jest za duży (max '+a.maxsize+"MB)</span>")}else if(a.get=="4"){alert("Dodałeś już max. ilość zdjęć");$("#form-upload").hide()}else{$("#pic-err").html('<span class="error">Błąd wczytywania zdjęcia. Spróbuj ponownie.</span>')}}else{$("#pic-err").html('<span class="error">Błąd wczytywania zdjęcia. Spróbuj ponownie.</span>')}$("#file").html('<input type="file" name="pic" size="42" class="file"  onchange="uploader()"/>');$("#loader").hide();$("#frmPost").unbind("ajaxStart ajaxStop")}function b(a,b,c){$("#frmPost").append($('<input type="hidden" name="upload" value="1" />'));return true}$("#pic-err").html("");$("#loader").show();var a={beforeSubmit:b,dataType:"json",success:c,url:"index.php?response"};$("#frmPost").ajaxSubmit(a);return false}function deleter(a,b,c,d,e){$("#pic-err").html("");if(c){var f="did="+a+"&deleditpic="+b+"&aid="+c+"&editcode="+d}else{var f="picdate="+e+"&picdel="+b}$.ajax({type:"POST",url:"index.php?response",data:f,dataType:"json",success:function(b){if(b.get==2){$("#pic-err").html('<span class="error">Błąd usuwania zdjęcia. Spróbuj ponownie. </span>')}else{$("#pic_"+a).remove();$("#progressstatus").hide();$(".uploadactive").show()}}})}function validate_form(thisform){var add=true;$("div.messbox.error").hide();with(thisform){if(thisform.adtitle){if(adtitle.value==null||adtitle.value==""){$("#adtitle-form").addClass("errors");add=false;$("#adtitle-form input").focus(function(){$("#adtitle-form").removeClass("errors")})}else{$("#adtitle-form").removeClass("errors")}}if($("#desc-form textarea").val()==""){$("#desc-form").addClass("errors");add=false;$("#desc-form textarea").focus(function(){$("#desc-form").removeClass("errors")})}else{$("#desc-form").removeClass("errors")}if(thisform.email){if(email.value==null||email.value==""){$("#email-form").addClass("errors");$("#email-form span.text_1").show();$("#email-form span.text_2").hide();add=false;$("#email-form input").focus(function(){$("#email-form").removeClass("errors")})}else{var reg=/^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;if(reg.test($.trim(email.value))==false){$("#email-form").addClass("errors");$("#email-form span.text_1").hide();$("#email-form span.text_2").show();add=false;$("#email-form input").focus(function(){$("#email-form").removeClass("errors")})}else{$("#email-form").removeClass("errors")}}}if(thisform.captcha){if(captcha.value==null||captcha.value==""){$("#captcha-form").addClass("errors");$("#captcha-form span.hint").addClass("error");add=false;$("#captcha-form input").focus(function(){$("#captcha-form").removeClass("errors");$("#captcha-form span.hint").removeClass("error")})}else{$("#captcha-form").removeClass("errors");$("#captcha-form span.hint").removeClass("error")}}if(thisform.agree){if($("input#agree").is(":checked")==false){$("#agree-form span").addClass("error");$("span#agree-check").addClass("error-border\t");$("input#agree").focus(function(){$("#agree-form span").removeClass("error");$("span#agree-check").removeClass("error-border\t")});add=false}else{$("#agree-form span").removeClass("error");$("span#agree-check").removeClass("error-border\t")}}if(thisform.countryid){if(countryid.value==null||countryid.value==""){$("#select-countryid").addClass("error");$("#select-countryid").change(function(){$("#select-countryid").removeClass("error")})}else{$("#select-countryid").removeClass("error")}}if(thisform.cityid){if(cityid.value==null||cityid.value==""){$("#select-cityid").addClass("error");$("#loc-form label").addClass("error");$("#loc-form span").css("display","inline");add=false;$("#select-cityid").change(function(){$("#select-cityid").removeClass("error")})}else{$("#select-cityid").removeClass("error");$("#loc-form label").removeClass("error");$("#loc-form span").css("display","none")}}if(thisform.areaid){if(areaid.value==null||areaid.value==""){$("#select-areaid").addClass("error");$("#loc-form label").addClass("error");$("#loc-form span").css("display","inline");add=false;$("#select-areaid").focus(function(){$("#select-areaid").removeClass("error");$("#loc-form label").removeClass("error");$("#loc-form span").css("display","none")})}else{$("#select-areaid").removeClass("error");$("#loc-form label").removeClass("error");$("#loc-form span").css("display","none")}}if(thisform.subcatid){if(subcatid.value==null||subcatid.value==0||subcatid.value==""){$("#cat-form").addClass("errors");add=false;$("#select-subcatid").change(function(){$("#cat-form").removeClass("errors")})}else{$("#cat-form").removeClass("errors");if($("input:radio[name=type]:checked").val()==2){var elem=$("div.seek .mand.atrr_"+subcatid.value)}else{var elem=$("div.atrr .mand.atrr_"+subcatid.value)}add=validateRow(elem,add)}}}if(add==false){scroll(0,120);alert("Uzupełnij brakujące pola w formularzu!")}return add}function selectedsubcatid(){var a=$("#select-subcatid").val();if(a==38||a==39||a==11||a==12||a==22||a==23||a==24||a==25||a==26){$("#type-form").hide()}else{$("#type-form").show()}if(a==42||a==43){$("#animalinfo").show()}else{$("#animalinfo").hide()}$("div.atrr").hide();if($("input:radio[name=type]:checked").val()==2){$("div.seek.atrr_"+a).show()}else{$("div.atrr_"+a).show()}}function updateatrr(a,b,c){if(c){var d=c}else{var d=$("#select-subcatid").val()}if(a&&b&&d){el=$("select#atrr_"+d+"_"+b);el.parent().removeClass("errors");$.ajax({type:"GET",url:"index.php",data:"response&updateatrr="+a+"&select="+b+"&subid="+d,dataType:"json",success:function(a){if(a.type=="html"){el.addClass("atrr").removeAttr("disabled").html(a.content);el.parent().show().addClass("atrr")}if(a.type=="disabled"){el.attr("disabled","disabled").html(a.content);el.parent().show().addClass("atrr")}if(a.type=="hidden"){el.attr("disabled","disabled").html(a.content);el.parent().hide().removeClass("atrr")}}})}}function updatecity(a,b){document.getElementById("frmPost").cityid.value=a;if(b>0){getareaid="&actareaid="+b}else{getareaid=""}$.ajax({type:"GET",url:"index.php",data:"response&getarealist="+a+getareaid,success:function(a){$("#select-areaid").html(a)}})}function updatecountry(a,b){if(b==1){$("#select-areaid").html('<option value="0">- - - - - - - - - - - - - - - - - -</option>')}citieslist.options.length=0;for(i=0;i<cities[a].length;i++)citieslist.options[citieslist.options.length]=new Option(cities[a][i].split("|")[0],cities[a][i].split("|")[1])}$(function(){$("select#select-cityid").change(function(){if($(this).val()>0){$.ajax({type:"GET",url:"index.php",data:"response&getarealist="+$(this).val(),success:function(a){$("#select-areaid").html(a)}})}});$("input:radio[name=type]").change(function(){if($(this).parent().hasClass("edit")){var a=$("div.atrr")}else{var a=$("div.atrr_"+$("#select-subcatid").val())}if($("input:radio[name=type]:checked").val()==1){a.show()}else{a.each(function(a){if(!$(this).hasClass("seek")){$(this).hide()}})}});$("#edit-save").click(function(){var a=true;$("div.messbox").hide();if($("input:radio[name=type]:checked").val()==2){a=validateRow($("div.seek .mand"),a)}else{a=validateRow($("div.atrr .mand"),a)}a=validateRow($(".tovalidate"),a);if(a==false){scroll(0,120);alert("Uzupełnij brakujące pola w formularzu!")}return a});$("input.int").keyup(function(){this.value=this.value.replace(/[^0-9]/g,"")});$("#price").keyup(function(){this.value=this.value.replace(/[^0-9,\ ]/g,"")});$("#phone").keyup(function(){this.value=this.value.replace(/[^0-9- ]/g,"")});$(".t1").mouseover(function(){$(".t1").addClass("highlight");$(".t2, .t3 ,.t4").removeClass("highlight")});$(".t2").mouseover(function(){$(".t2").addClass("highlight");$(".t1, .t3 ,.t4").removeClass("highlight")});$(".t3").mouseover(function(){$(".t3").addClass("highlight");$(".t1, .t2 ,.t4").removeClass("highlight")});$(".t4").mouseover(function(){$(".t4").addClass("highlight");$(".t1, .t2 ,.t3").removeClass("highlight")})})
