function DID(a){return document.getElementById(a)}var Util={version:"1.0",extend:function(a,c){for(var d in c){a[d]=c[d]}return a},NoCache:function(){var a=new Date();return a.getFullYear()+""+(a.getMonth()>8?(a.getMonth()+1):"0"+(a.getMonth()+1))+""+(a.getDate()>9?a.getDate():"0"+a.getDate())+"-"+(a.getHours()>9?a.getHours():"0"+a.getHours())+""+(a.getMinutes()>9?a.getMinutes():"0"+a.getMinutes())+""+(a.getSeconds()>9?a.getSeconds():"0"+a.getSeconds())},ToCenter:function(d){var a=jQuery(window).width();var c=jQuery.browser.opera?window.innerHeight:jQuery(window).height();a=parseInt((a-jQuery("#"+d).width())/2);c=parseInt((c-jQuery("#"+d).height())/2);c+=jQuery(window).scrollTop();jQuery("#"+d).css({left:a,top:c});return false},WindowHeight:function(){return jQuery.browser.opera?window.innerHeight:jQuery(window).height()},ChangeTown:function(a){jQuery.post(CLAjaxPreffix+"/my/change_town","",function(c){if(c.result==true){jQuery.msgbox().show("Выберите ваш город",c.html+'<div style="display:none;">'+c.subhtml+'</div><div class="lpbdiv"><span class="lpbutton" onclick="Util.SubmitChangeTown(\''+a+'\');"><span>Выбрать</span></span> &nbsp; <span class="lpbutton" onclick="jQuery.msgbox().close();"><span>Отмена</span></span></div><script>Util.SelectCountry();<\/script>')}},"json");return false},SelectCountry:function(){var a=$("#selcontr :selected").val();jQuery("#seltown").html(jQuery("#citys_"+a).html())},SelectNoCountry:function(){if(jQuery("input#notown").attr("checked")?1:0){$("#selcontr").attr("disabled","disabled");$("#seltown").attr("disabled","disabled")}else{$("#selcontr").removeAttr("disabled");$("#seltown").removeAttr("disabled")}},SubmitChangeTown:function(c){var d=$("#seltown :selected").val();var a=$("#selcontr :selected").val();if(jQuery("input#notown").attr("checked")?1:0){d="0"}jQuery.cookie("TkTownID",d,{expires:365,path:"/",domain:CL_WWW_DOMAIN,secure:false});if((c==undefined)||(c=="undefined")){window.location.href=window.location.href}else{if(d==0){$(c+' option[value="0"]').attr("selected","selected")}else{jQuery.post(CLAjaxPreffix+"/my/list_towns","",function(e){$(c).html(e.html);$(c+' option[value="'+d+'"]').attr("selected","selected");if($(c+' option[value="'+a+","+d+'"]').size()>0){$(c+' option[value="'+a+","+d+'"]').attr("selected","selected")}},"json")}jQuery.msgbox().close()}return false},modify_value:function(c,a){a=a!=undefined?a:1;b=jQuery(c);b.text(parseInt(b.text())+a);return b},format:function(d,c,a){a=a!=undefined?a:"0";for(i=0;i<c-d.length;i++){d+=a}return d.substr(0,c-1)+""},panel:{start:function(){},collapse:function(d,c){var a=jQuery("#"+d);var c=c==undefined?true:false;if(a.css("display")!="block"){if(c!=undefined&&c==true){a.slideDown(100,function(){jQuery(this).animate({opacity:1},150);jQuery.cookie(d,"0",{path:"/",domain:TK_PUBLIC_DOMAIN})})}else{jQuery.cookie(d,"0",{path:"/",domain:TK_PUBLIC_DOMAIN});a.show()}this.change_image(a,0)}else{if(c!=undefined&&c==true){a.animate({opacity:0},100,function(){jQuery(this).slideUp(150);jQuery.cookie(d,"1",{path:"/",domain:TK_PUBLIC_DOMAIN})})}else{jQuery.cookie(d,"1",{path:"/",domain:TK_PUBLIC_DOMAIN});a.hide()}this.change_image(a,1)}},change_image:function(c,d){var a=c.parents(".panel").find(".collapse_btn");if(d!=undefined&&d==true){a.attr("src",CL_STAT_DOMAIN+"/my/user_page/collapse_panel_show.png")}else{a.attr("src",CL_STAT_DOMAIN+"/my/user_page/collapse_panel.png")}}}};function bigbeansearch(a){jQuery(".bigbeansearch li").removeClass("active");jQuery("#"+a).addClass("active");jQuery(".divin").hide();jQuery("#div"+a).show();jQuery("#div"+a+" form .bbsinput input").focus();return false}function bigbeansub(c){var a=jQuery(".bbss");if(jQuery(".bbss:eq(0)").css("display")=="none"){a.show();jQuery(".bbssubmit a").addClass("active")}}var notclosepopup=false;jQuery(document).ready(function(){jQuery("#ac_ajax_loading").ajaxStart(function(){$(this).show()});jQuery("#ac_ajax_loading").ajaxComplete(function(){$(this).hide()});jQuery("a").click(function(){jQuery(this).blur()});window.setInterval(function(){jQuery.get(CLAjaxPreffix+"/noop/?"+Util.NoCache())},270000);if(jQuery(".popupmenu").size()>0){jQuery(".popupmenu").mousemove(function(){popupmenu(jQuery(this).attr("name"));return false}).click(function(){popupmenu(jQuery(this).attr("name"));return false});jQuery(".popupmenudiv").mousemove(function(){notclosepopup=true}).mouseleave(function(){closepopups()});jQuery("body").click(function(){jQuery(".popupmenudiv").fadeOut("fast")})}});function popupmenu(f){var c=jQuery("#"+f);jQuery(".popupmenudiv:not(#"+f+")").hide();notclosepopup=true;var a=0;var e=0;var d=jQuery('a[name="'+f+'"]').position();e=d.top;a=d.left-c.width()+20;c.css({left:a,top:e}).show()}function seotoolsme(){jQuery.msgbox().show("SEO парамметры текущей страницы",'<form id="seochanger" action="" method="post" style="width:400px" onsubmit="return saveseotags(jQuery(this));">Титул:<br /><input type="text" name="title" value=""  style="width:400px"/><br />Ключевые слова:<br /><textarea name="keywords" style="width:400px" rows="10"></textarea><br />Описание:<br /><textarea name="description"  style="width:400px" rows="10"></textarea><br /><input type="submit" name="submit" value="Сохранить SEO" /></form>',{},function(){jQuery('#seochanger input[name="title"]').val(jQuery("head title").html());jQuery('#seochanger textarea[name="keywords"]').val(jQuery('head meta[name="keywords"]').attr("content"));jQuery('#seochanger textarea[name="description"]').val(jQuery('head meta[name="description"]').attr("content"))})}function saveseotags(a){jQuery.post(CLAjaxPreffix+"/common/saveseotags",a.serializeArray(),function(c){jQuery.msgbox().close()},"html");return false};
