var d=document,BASE=location.protocol+"//"+location.host+"/",submit,submit_txt,submit_waiting_txt="Ждите",defAjaxUrl=BASE+"ajax/ajax.php";
$(function(){$("input:checkbox","div[id$=_checkbox_group]").change(function(){var b=$(this).closest("div[id$=_checkbox_group]"),c=[];$(this).val()=="all"&&$("input:checkbox",b).not(this).attr("checked",$(this).is(":checked"));$("input:checkbox:checked",b).each(function(){$(this).val()!="all"&&c.push($(this).val())});c=c.join(",");$("input[type=hidden]",b).val(c)});$("input[type=hidden]","div[id$=_checkbox_group]").change(function(){var b=$(this).closest("div[id$=_checkbox_group]"),c=$(this).val();
if(c=="all"){$("input:checkbox",b).attr("checked",true);$("input:checkbox:first",b).change()}else{c=c.split(",");for(var e in c)$('input:checkbox[value="'+c[e]+'"]',b).attr("checked",true);$("input:checkbox:not(:checked)",b).length===0&&$("input:checkbox[value=all]",b).attr("checked",true)}}).change()});function styling(){$("tbody","table.striped").children("tr:visible:odd").addClass("odd")}function isset(b){return!(window[b]===undefined||window[b]===null)}
function empty(b){if(b===""||b===0||b==="0"||b===null||b===false||b===undefined)return true;if(typeof b=="object"){for(var c in b)return false;return true}return false}function print_r(b,c){var e=[],f;for(f in b)e.push(f+" = "+b[f]);c?$("body").append("<hr />"+e.join("<br />")):alert(e.join("\n"))}
function getFormData(b){var c={};$("input:text, input[type=hidden], input:password, input:checked, select, textarea",b).each(function(){var e=this.name||this.id;if(e){var f=$(this).val();if(f)c[e]=f}});return c}function clearForm(b){$("input,select,textarea",b).each(function(){var c=this.type,e=this.tagName.toLowerCase();if(c=="text"||c=="hidden"||c=="password"||e=="textarea")this.value="";else if(c=="checkbox"||c=="radio")this.checked=false;else if(e=="select")this.selectedIndex=-1})}
var wait={show:function(){$("#loading").center().show()},hide:function(){$("#loading").hide()}},overlay={show:function(){$("#overlay").length||$("body").append('<div id="overlay"></div>');$.browser.msie&&$("select").css("visibility","hidden");$("#overlay").removeClass("dis")},hide:function(){$.browser.msie&&$("select").css("visibility","visible");$("#overlay").addClass("dis")}},curBuildTechnology=0;
function buildTechnologyDepend(){$("#build_category_id").change(function(){var b=$(this).val();if(!(!b||curBuildTechnology==b)){curBuildTechnology=b;$.post(defAjaxUrl,{get_build_technology:b},function(c){var e=$("#build_technology_id").val();$("#build_technology_id").html($(c).html()).val(e)})}})}
function formatNumber(b,c,e){if(arguments.length==2)e=" ";if(arguments.length==1){e=" ";c="."}b=b.toString();a=b.split(c);x=a[0];y=a[1];z="";if(typeof x!="undefined"){for(i=x.length-1;i>=0;i--)z+=x.charAt(i);z=z.replace(/(\d{3})/g,"$1"+e);if(z.slice(-e.length)==e)z=z.slice(0,-e.length);x="";for(i=z.length-1;i>=0;i--)x+=z.charAt(i);if(typeof y!="undefined"&&y.length>0)x+=c+y}return x}
function formatDate(b){if(!b)return false;var c=function(e){return e<10?"0"+e:e};return[b.getFullYear(),c(b.getMonth()+1),c(b.getDate())].join("-")+" "+[c(b.getHours()),c(b.getMinutes()),c(b.getSeconds())].join(":")}function dateFromStr(b){if(b==="0000-00-00"||b==="0000-00-00 00:00:00")return false;var c=[],e=[0,0,0];b=b.split(" ");c=b[0].split("-");if(c.length!=3)return false;if(b.length>1){e=b[1].split(":");if(e.length!=3)return false}return new Date(c[0],c[1]-1,c[2],e[0],e[1],e[2])};

