var _=document;$(function(){cms.setupAjax();cms.initAdminControl();$.browser.safari&&$("body").addClass("safari");$.browser.opera&&$("body").addClass("opera");$.browser.mozilla&&$("body").addClass("mozilla")});
var cms={www_root:"/",langId:"ru",url:window.location.href.replace(/#.*$/,""),file:{},fileLoaded:[],loadStyles:function(a){a=$('<style type="text/css">'+a+"</style>");$("body").append(a)},loadFile:function(a,c){if(cms.fileLoaded[a])c(true);else{cms.fileLoaded[a]=1;$.ajax({url:a,cache:true,myRetHtml:true,dataType:"script",success:function(){c(false)}})}},clearLogs:function(a){$(a).parent().parent().hide();$.ajax({url:cms.www_root,data:"admin=clearLog",complete:function(){}});return false},siteErrorForm:function(){var a=
cms.www_root+"cms/error_form";if(cms.adminMode)a+="?mode=admin";$.modal({ajax:a,onLoad:function(){$(":submit","#siteError").bind("click",function(c){c.preventDefault();c=$(".t","#siteError");if(!c.attr("isChanged")){cms.langId=="en"?alert("Describe error first"):alert("\u0421\u043f\u0435\u0440\u0432\u0430 \u043e\u043f\u0438\u0448\u0438\u0442\u0435 \u043e\u0448\u0438\u0431\u043a\u0443");c.focus();return false}$.ajax({url:cms.url,myRetHtml:1,type:"POST",data:{siteErrorText:escape(c.val()),from:escape($("input[name=from]",
"#siteError").val()),hookEx:"true"},success:function(b){$("#siteError").html(b)}});$("#siteError").html("<div class=alert_g>"+cms.lang.loading+"</div>");return false})}});return false},initAdminControl:function(){var a=$("#adminCtrl");if(!a.length)return false;if(getCookie("fcmsACtrlPos")){var c=getCookie("fcmsACtrlPos").split(",");a.width(a.width());a.css("top",c[0]);a.css("left",c[1])}$(document).bind("keydown",function(b){var j="";if(!b.ctrlKey&&!b.shiftKey&&!b.altKey){b.keyCode==27&&$.modalClose();
if(b.keyCode==74)b.target&&(b.target.tagName=="INPUT"||b.target.tagName=="SELECT"||b.target.tagName=="TEXTAREA")||$("#adminCtrl a.jump").click()}if(!b.shiftKey&&b.altKey){if(b.keyCode==49)j=$("#adminCtrlInfo a[href*=admin=debugInfo]").attr("href");if(b.keyCode==50)j=$("#adminCtrlInfo a[href*=admin=debugJs]").trigger("click").attr("href");if(b.keyCode==51)j=$("#adminCtrl .edit").attr("href")}if(j){document.location=j;b.preventDefault()}});$(".clearCache",a).click(function(){$.ajax({url:cms.www_root+
"admin/content/",myRetHtml:1,data:"mode=clear_cache",success:function(b){$("noscript").length?$("noscript").after(b+"<br/>"):alert(b)}});return false});$(".jump",a).click(function(){$.modal({onShow:function(){var b="";$(".formCmsJump input[name=s]").autocomplete(cms.www_root+"search?cmsJump=1",{root:$(".formCmsJump"),width:"99%"}).result(function(j,f){$.modalClose();b||(b=$("span","<div>"+decodeURIComponent(f)+"</div>").attr("data"));b=window.eval("("+b+")");b=cms.adminMode?b.edit:b.view;setTimeout(function(){window.location.href=
b},200)}).requestDone(function(){$(".formCmsJump li i").click(function(){b=$(this).attr("data")})});setTimeout(function(){$(".formCmsJump input[name=s]").focus()},200)},ajax:$(this).attr("href")});return false});$(".adminCtrlResize",a).bind("drag",{distance:10,not:":input,a"},function(b){a.css({top:b.offsetY-a.height()+10,left:b.offsetX-a.width()+10})}).bind("dragstart",function(){a.width(a.width())}).bind("dragend",function(){setCookie("fcmsACtrlPos",a.css("top")+","+a.css("left"))}).dblclick(function(){setCookie("fcmsACtrlPos",
"");window.location.reload()})},ajaxProcessed:function(a){if(a){$("body").attr("done","false");setTimeout(function(){$.active&&$("body").css("cursor","wait")},2E3)}else $("body").css("cursor","").attr("done","true")},setupAjax:function(){$.ajaxSetup({cache:false,error:function(a,c){cms.ajaxProcessed();if(!(this.url.indexOf("admin/tips")>0))if(!(this.url.indexOf("cms/ping")>0))if(!(a.status==0&&a.readyState==4&&!a.responseText)){var b;try{b=a.responseText}catch(j){}alert("Ajax static error:\r\nxhr.responseText: "+
b+"\r\nxhr.status: "+a.status+"\r\nurl: "+this.url+"\r\nxhr.readyState: "+a.readyState+"\r\ntextStatus: "+c+"")}},complete:function(a,c){cms.ajaxProcessed();if(!cms.adminMode&&(a.status==200||a.status==304))return true;if(c!=="error"&&this.myRetHtml!=1&&a&&a.responseText!=""&&this.url.indexOf("search?cmsJump=1")<0&&a.responseText.indexOf("id='siteTree'><ul>")<0){if(a.responseText.indexOf("redirectTo=")==0)document.location="../content/?parentid="+a.responseText.substring(a.responseText.indexOf("=")+
1);else alert("Ajax error ("+c+"):\r\n"+a.responseText);return false}return true},success:function(){cms.ajaxProcessed()},beforeSend:function(){cms.ajaxProcessed(true)}})}};function getCookie(a){a=a+"=";var c=document.cookie,b="",j="";if(c.length>0){b=c.indexOf(a);if(b!=-1){b+=a.length;j=c.indexOf(";",b);if(j==-1)j=c.length;return unescape(c.substring(b,j))}}return""}
function setCookie(a,c,b){if(c==false)delCookie(a);else{var j=false;a=a+"="+escape(c);if(!b&&b!=-1)b=2592E6;if(b>0){j=new Date;j.setTime(j.getTime()+b);j=j.toUTCString()}if(j)a+="; expires="+j;document.cookie=a+"; path=/"}}function delCookie(a){document.cookie=a+"=; expires=Thu, 01-Jan-70 00:00:01 GMT; path=/"}
function getVar(a,c){if(!c)c=window.location.href;a=a.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");var b=c.substr(c.indexOf("&"+a)+1,c.length);if(b.indexOf("&"+a)>=0)c=b;a=(new RegExp("[\\?&]"+a+"=([^&#]*)")).exec(c);return a==null?"":a[1]}function getVarInt(a,c,b){b||(b=0);a=parseInt(getVar(a,c));if(isNaN(a))a=b;return a}
(function(a){a.extend({isHtml:function(c){return!!(typeof c==="string"&&/^[^<]*(<(.|\s)+>)[^>]*$|^#([\w-]+)$/.exec(c))},modal:function(c){var b=a('<div id="modalBox"/>').appendTo("body");b.options={};if(typeof c==="string")b.options.ajax=c;else if(c.addClass)b.options.dom=c;else b.options=c;var j=setInterval(function(){a(window).trigger("resize.mask")},200);this.overlayAPI=a(b).overlay({api:true,fixed:false,speed:0,closeSpeed:0,top:"10%",mask:{color:"#565656",loadSpeed:0,closeSpeed:0,opacity:0.9,
onLoad:function(){b.options.onShow&&b.options.onShow.call(b[0])}},onBeforeLoad:function(){if(b.options.dom)b.options.dom.appendTo(b).show();else b.options.ajax&&a.ajax({url:b.options.ajax,myRetHtml:true,async:false,success:function(f){b.html(f);b.find(".modalBoxClose").bind("click",function(){b.overlay().close()});b.options.onLoad&&b.options.onLoad.call(b[0])}})},onClose:function(){clearInterval(j);a("#exposeMask").remove();b.remove();this.getTrigger().data("overlay",false)}}).load();return false},
modalClose:function(){a("#modalBox").overlay(0).close&&a("#modalBox").overlay(0).close()}});a.fn.extend({myShow:function(c){return this.animate({opacity:"show"},"fast",c)},myHide:function(c){return this.animate({opacity:"hide"},"fast",c)},myToggle:function(c){return this.animate({height:"toggle",opacity:"toggle"},"fast",c)},form:function(){if(a(this).get(0)&&a(this).get(0).tagName=="FORM")return a(this);return a(this).parents("form:first")},autogrow:function(){this.each(function(){if(!this.autogrow){this.autogrow=
true;var c=a(this),b=c.height(),j=c.outerWidth()-c.width(),f=c.outerHeight()-c.height();j=c.width()-j;c.css("lineHeight","13px");var l=a("<div></div>").css({position:"absolute",top:-10000,left:-10000,fontSize:c.css("fontSize"),fontFamily:c.css("fontFamily"),lineHeight:c.css("lineHeight"),resize:"none"}).appendTo(document.body);j&&l.width(j);if(a.browser.msie)f+=15;else c.css("overflow","auto");j=function(h){var p=a(this),k=function(n,e){for(var q=0,s="";q<e;q++)s+=n;return s},d=this.value.replace(/</g,
"&lt;").replace(/>/g,"&gt;").replace(/&/g,"&amp;").replace(/\n$/,"<br/>&nbsp;").replace(/\n/g,"<br/>").replace(/ {2,}/g,function(n){return k("&nbsp;",n.length-1)+" "}).replace(/\t/g,"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");l.html(d);var g=parseInt(p[0].clientWidth);g&&l.width(g);p.css("height",Math.max(l.height()+f,b));if(typeof h=="boolean"&&d){(g=parseInt(p[0].clientWidth))&&l.width(g);p.css("height",Math.max(l.height()+f,b))}};c.change(j).keyup(j).keydown(j);j.apply(this,[true])}});
return this}})})(jQuery);
(function(a){a.fn.extend({autocomplete:function(c,b){var j=typeof c=="string";b=a.extend({},a.Autocompleter.defaults,{url:j?c:null,data:j?null:c,delay:j?a.Autocompleter.defaults.delay:100,max:b&&!b.scroll?20:150},b);b.highlight=b.highlight||function(f){return f};b.formatMatch=b.formatMatch||b.formatItem;return this.each(function(){if(!this.autocompleteInited){this.autocompleteInited=true;new a.Autocompleter(this,b)}})},result:function(c){return this.bind("result",c)},requestDone:function(c){return this.bind("requestDone",c)},
search:function(c){return this.trigger("search",[c])},flushCache:function(){return this.trigger("flushCache")},setOptions:function(c){return this.trigger("setOptions",[c])},unautocomplete:function(){return this.trigger("unautocomplete")}});a.Autocompleter=function(c,b){function j(){var i=x.selected();if(!i)return false;var r=i.result;u=r;if(b.multiple){var z=l(m.val());if(z.length>1)r=z.slice(0,z.length-1).join(b.multipleSeparator)+b.multipleSeparator+r;r+=b.multipleSeparator}m.val(r);d();m.trigger("result",
[i.data,i.value]);return true}function f(i,r){if(v==s.DEL)x.hide();else{i=m.val();if(!(!r&&i==u)){u=i;i=a.trim(h(i));if(i.length>=b.minChars){m.addClass(b.loadingClass);b.matchCase||(i=i.toLowerCase());n(i,g,d)}else{q();x.hide()}}}}function l(i){if(!i)return[""];i=i.split(b.multipleSeparator);var r=[];a.each(i,function(z,w){if(a.trim(w))r[z]=a.trim(w)});return r}function h(i){if(!b.multiple)return i;i=l(i);return i[i.length-1]}function p(i,r){if(b.autoFill&&h(m.val()).toLowerCase()==i.toLowerCase()&&
v!=s.BACKSPACE){m.val(m.val()+r.substring(h(u).length));a.Autocompleter.Selection(c,u.length,u.length+r.length)}}function k(){clearTimeout(y);y=setTimeout(d,200)}function d(){x.hide();clearTimeout(y);q();b.mustMatch&&m.search(function(i){if(!i)if(b.multiple){i=l(m.val()).slice(0,-1);m.val(i.join(b.multipleSeparator)+(i.length?b.multipleSeparator:""))}else{m.val("");m.trigger("result",null)}})}function g(i,r){if(r&&r.length&&o){q();x.display(r,i);p(i,r[0].value);x.show();m.trigger("requestDone")}else d()}
function n(i,r,z){b.matchCase||(i=i.toLowerCase());var w=t.load(i);if(w&&w.length)r(i,w);else if(typeof b.url=="string"&&b.url.length>0){var C={timestamp:+new Date};a.each(b.extraParams,function(B,D){C[B]=typeof D=="function"?D():D});a.ajax({url:b.url,data:a.extend({s:escape(h(i)),ac:1},C),success:function(B){B=b.parse&&b.parse(B)||e(B);t.add(i,B);r(i,B)}})}else{x.emptyList();z(i)}}function e(i){var r=[];i=i.split("\n");for(var z=0;z<i.length;z++){var w=a.trim(i[z]);if(w){w=w.split("|");r[r.length]=
{data:w,value:w[0],result:b.formatResult&&b.formatResult(w,w[0])||w[0]}}}return r}function q(){m.removeClass(b.loadingClass)}var s={UP:38,DOWN:40,DEL:46,TAB:9,RETURN:13,ESC:27,COMMA:188,PAGEUP:33,PAGEDOWN:34,BACKSPACE:8},m=a(c).attr("autocomplete","off").addClass(b.inputClass),y,u="",t=a.Autocompleter.Cache(b),o=0,v,A={mouseDownOnSelect:false},x=a.Autocompleter.Select(b,c,j,A),E;a.browser.opera&&a(c.form).bind("submit.autocomplete",function(){if(E)return E=false});m.bind((a.browser.opera?"keypress":
"keydown")+".autocomplete",function(i){v=i.keyCode;switch(i.keyCode){case s.UP:i.preventDefault();x.visible()?x.prev():f(0,true);break;case s.DOWN:i.preventDefault();x.visible()?x.next():f(0,true);break;case s.PAGEUP:i.preventDefault();x.visible()?x.pageUp():f(0,true);break;case s.PAGEDOWN:i.preventDefault();x.visible()?x.pageDown():f(0,true);break;case b.multiple&&a.trim(b.multipleSeparator)==","&&s.COMMA:case s.TAB:case s.RETURN:if(j()){i.preventDefault();E=true;return false}break;case s.ESC:x?
x.hide():a.modalClose();break;default:clearTimeout(y);y=setTimeout(f,b.delay);break}}).focus(function(){o++}).blur(function(){o=0;A.mouseDownOnSelect||k()}).click(function(){o++>1&&!x.visible()&&f(0,true)}).bind("search",function(){function i(z,w){var C;if(w&&w.length)for(var B=0;B<w.length;B++)if(w[B].result.toLowerCase()==z.toLowerCase()){C=w[B];break}typeof r=="function"?r(C):m.trigger("result",C&&[C.data,C.value])}var r=arguments.length>1?arguments[1]:null;a.each(l(m.val()),function(z,w){n(w,
i,i)})}).bind("flushCache",function(){t.flush()}).bind("setOptions",function(i,r){a.extend(b,r);"data"in r&&t.populate()}).bind("unautocomplete",function(){x.unbind();m.unbind();a(c.form).unbind(".autocomplete")})};a.Autocompleter.defaults={inputClass:"ac_input",resultsClass:"ac_results",loadingClass:"ac_loading",root:0,minChars:1,delay:400,matchCase:false,matchSubset:false,matchContains:false,cacheLength:10,max:100,mustMatch:false,extraParams:{},selectFirst:false,formatItem:function(c){return c[0]},
formatMatch:null,autoFill:false,width:0,multiple:false,multipleSeparator:", ",highlight:function(c,b){return c.replace(new RegExp("(?![^&;]+;)(?!<[^<>]*)("+b.replace(/([\^\$\(\)\[\]\{\}\*\.\+\?\|\\])/gi,"\\$1")+")(?![^<>]*>)(?![^&;]+;)","gi"),"<strong>$1</strong>")},scroll:true,scrollHeight:350};a.Autocompleter.Cache=function(c){function b(k,d){c.matchCase||(k=k.toLowerCase());k=k.indexOf(d);if(k==-1)return false;return k==0||c.matchContains}function j(k,d){p>c.cacheLength&&l();h[k]||p++;h[k]=d}function f(){if(!c.data)return false;
var k={},d=0;if(!c.url)c.cacheLength=1;k[""]=[];for(var g=0,n=c.data.length;g<n;g++){var e=c.data[g];e=typeof e=="string"?[e]:e;var q=c.formatMatch(e,g+1,c.data.length);if(q!==false){var s=q.charAt(0).toLowerCase();k[s]||(k[s]=[]);e={value:q,data:e,result:c.formatResult&&c.formatResult(e)||q};k[s].push(e);d++<c.max&&k[""].push(e)}}a.each(k,function(m,y){c.cacheLength++;j(m,y)})}function l(){h={};p=0}var h={},p=0;setTimeout(f,25);return{flush:l,add:j,data:h,populate:f,load:function(k){if(!c.cacheLength||
!p)return null;if(!c.url&&c.matchContains){var d=[];for(var g in h)if(g.length>0){var n=h[g];a.each(n,function(e,q){b(q.value,k)&&d.push(q)})}return d}else if(h[k])return h[k];else if(c.matchSubset)for(g=k.length-1;g>=c.minChars;g--)if(n=h[k.substr(0,g)]){d=[];a.each(n,function(e,q){if(b(q.value,k))d[d.length]=q});return d}return null}}};a.Autocompleter.Select=function(c,b,j,f){function l(){if(y){if(!c.root)c.root=document.body;u=a("<div/>").hide().addClass(c.resultsClass).appendTo(c.root);t=a("<ul/>").appendTo(u).mouseover(function(o){if(h(o).nodeName&&
h(o).nodeName.toUpperCase()=="LI"){q=a("li",t).removeClass(n.ACTIVE).index(h(o));a(h(o)).addClass(n.ACTIVE)}}).click(function(o){a(h(o)).addClass(n.ACTIVE);j();a(b).is(":visible")&&b.focus();return false}).mousedown(function(){f.mouseDownOnSelect=true}).mouseup(function(){f.mouseDownOnSelect=false});c.width>0&&u.css("width",c.width);y=false}}function h(o){for(o=o.target;o&&o.tagName!="LI";)o=o.parentNode;if(!o)return[];return o}function p(o){e.slice(q,q+1).removeClass(n.ACTIVE);k(o);o=e.slice(q,q+
1).addClass(n.ACTIVE);if(c.scroll){var v=0;e.slice(0,q).each(function(){v+=this.offsetHeight});if(v+o[0].offsetHeight-t.scrollTop()>t[0].clientHeight)t.scrollTop(v+o[0].offsetHeight-t.innerHeight());else v<t.scrollTop()&&t.scrollTop(v)}}function k(o){q+=o;if(q<0)q=e.size()-1;else if(q>=e.size())q=0}function d(o){return c.max&&c.max<o?c.max:o}function g(){t.empty();for(var o=d(s.length),v=0;v<o;v++)if(s[v]){var A=c.formatItem(s[v].data,v+1,o,s[v].value,m);if(A!==false){A=a("<li/>").html(c.highlight(A,
m)).appendTo(t)[0];a.data(A,"ac_data",s[v])}}e=t.find("li");if(c.selectFirst){e.slice(0,1).addClass(n.ACTIVE);q=0}}var n={ACTIVE:"ac_over"},e,q=-1,s,m="",y=true,u,t;return{display:function(o,v){l();s=o;m=v;g()},next:function(){p(1)},prev:function(){p(-1)},pageUp:function(){q!=0&&q-8<0?p(-q):p(-8)},pageDown:function(){q!=e.size()-1&&q+8>e.size()?p(e.size()-1-q):p(8)},hide:function(){u&&u.hide();e&&e.removeClass(n.ACTIVE);q=-1},visible:function(){return u&&u.is(":visible")},current:function(){return this.visible()&&
(e.filter("."+n.ACTIVE)[0]||c.selectFirst&&e[0])},show:function(){var o=a(b).offset();u.css({width:typeof c.width=="string"||c.width>0?c.width:a(b).outerWidth()-4,top:o.top+b.offsetHeight,left:o.left}).show();if(c.scroll){t.scrollTop(0);t.css({maxHeight:c.scrollHeight,overflow:"auto"});if(a.browser.msie&&typeof document.body.style.maxHeight==="undefined"){var v=0;e.each(function(){v+=this.offsetHeight});o=v>c.scrollHeight;t.css("height",o?c.scrollHeight:v);o||e.width(t.width()-parseInt(e.css("padding-left"))-
parseInt(e.css("padding-right")))}}},selected:function(){var o=e&&e.filter("."+n.ACTIVE).removeClass(n.ACTIVE);return o&&o.length&&a.data(o[0],"ac_data")},emptyList:function(){t&&t.empty()},unbind:function(){u&&u.remove()}}};a.Autocompleter.Selection=function(c,b,j){if(c.createTextRange){var f=c.createTextRange();f.collapse(true);f.moveStart("character",b);f.moveEnd("character",j);f.select()}else if(c.setSelectionRange)c.setSelectionRange(b,j);else if(c.selectionStart){c.selectionStart=b;c.selectionEnd=
j}c.focus()}})(jQuery);
(function(a){function c(d){var g=this,n,e=d.data||{};if(e.elem){g=d.dragTarget=e.elem;d.dragProxy=k.proxy||g;d.cursorOffsetX=e.pageX-e.left;d.cursorOffsetY=e.pageY-e.top;d.offsetX=d.pageX-d.cursorOffsetX;d.offsetY=d.pageY-d.cursorOffsetY}else if(k.dragging||e.which>0&&d.which!=e.which||a(d.target).is(e.not))return;switch(d.type){case "mousedown":a.extend(e,a(g).offset(),{elem:g,target:d.target,pageX:d.pageX,pageY:d.pageY});h.add(document,"mousemove mouseup",c,e);l(g,false);k.dragging=null;return false;
case !k.dragging&&"mousemove":if(j(d.pageX-e.pageX)+j(d.pageY-e.pageY)<e.distance)break;d.target=e.target;n=b(d,"dragstart",g);if(n!==false){k.dragging=g;k.proxy=d.dragProxy=a(n||g)[0]}case "mousemove":if(k.dragging){n=b(d,"drag",g);if(p.drop){p.drop.allowed=n!==false;p.drop.handler(d)}if(n!==false)break;d.type="mouseup"}case "mouseup":h.remove(document,"mousemove mouseup",c);if(k.dragging){p.drop&&p.drop.handler(d);b(d,"dragend",g)}l(g,true);k.dragging=k.proxy=e.elem=false;break}return true}function b(d,
g,n){d.type=g;g=a.event.handle.call(n,d);return g===false?false:g||d.result}function j(d){return Math.pow(d,2)}function f(){return k.dragging===false}function l(d,g){if(d){d.unselectable=g?"off":"on";d.onselectstart=function(){return g};if(d.style)d.style.MozUserSelect=g?"":"none"}}a.fn.drag=function(d,g,n){g&&this.bind("dragstart",d);n&&this.bind("dragend",n);return!d?this.trigger("drag"):this.bind("drag",g?g:d)};var h=a.event,p=h.special,k=p.drag={not:":input",distance:0,which:1,dragging:false,
setup:function(d){d=a.extend({distance:k.distance,which:k.which,not:k.not},d||{});d.distance=j(d.distance);h.add(this,"mousedown",c,d);this.attachEvent&&this.attachEvent("ondragstart",f)},teardown:function(){h.remove(this,"mousedown",c);if(this===k.dragging)k.dragging=k.proxy=false;l(this,true);this.detachEvent&&this.detachEvent("ondragstart",f)}};p.dragstart=p.dragend={setup:function(){},teardown:function(){}}})(jQuery);
(function(a){function c(f,l){var h=this,p=f.add(h),k=a(window),d,g,n,e=a.tools.expose&&(l.mask||l.expose),q=Math.random().toString().slice(10);if(e){if(typeof e=="string")e={color:e};e.closeOnClick=e.closeOnEsc=false}var s=l.target||f.attr("rel");g=s?a(s):f;if(!g.length)throw"Could not find Overlay: "+s;f&&f.index(g)==-1&&f.click(function(m){h.load(m);return m.preventDefault()});a.extend(h,{load:function(m){if(h.isOpened())return h;var y=j[l.effect];if(!y)throw'Overlay: cannot find effect : "'+l.effect+
'"';l.oneInstance&&a.each(b,function(){this.close(m)});m=m||a.Event();m.type="onBeforeLoad";p.trigger(m);if(m.isDefaultPrevented())return h;n=true;e&&a(g).expose(e);var u=l.top,t=l.left,o=g.outerWidth({margin:true}),v=g.outerHeight({margin:true});if(typeof u=="string")u=u=="center"?Math.max((k.height()-v)/2,0):parseInt(u,10)/100*k.height();if(t=="center")t=Math.max((k.width()-o)/2,0);y[0].call(h,{top:u,left:t},function(){if(n){m.type="onLoad";p.trigger(m)}});e&&l.closeOnClick&&a.mask.getMask().one("click",
h.close);l.closeOnClick&&a(document).bind("click."+q,function(A){a(A.target).parents(g).length||h.close(A)});l.closeOnEsc&&a(document).bind("keydown."+q,function(A){A.keyCode==27&&h.close(A)});return h},close:function(m){if(!h.isOpened())return h;m=m||a.Event();m.type="onBeforeClose";p.trigger(m);if(!m.isDefaultPrevented()){n=false;j[l.effect][1].call(h,function(){m.type="onClose";p.trigger(m)});a(document).unbind("click."+q).unbind("keydown."+q);e&&a.mask.close();return h}},getOverlay:function(){return g},
getTrigger:function(){return f},getClosers:function(){return d},isOpened:function(){return n},getConf:function(){return l}});a.each("onBeforeLoad,onStart,onLoad,onBeforeClose,onClose".split(","),function(m,y){a.isFunction(l[y])&&a(h).bind(y,l[y]);h[y]=function(u){a(h).bind(y,u);return h}});d=g.find(l.close||".close");if(!d.length&&!l.close){d=a('<div class="close"></div>');g.prepend(d)}d.click(function(m){h.close(m)});l.load&&h.load()}a.tools=a.tools||{version:"1.2.0"};a.tools.overlay={addEffect:function(f,
l,h){j[f]=[l,h]},conf:{close:null,closeOnClick:true,closeOnEsc:true,closeSpeed:"fast",effect:"default",fixed:!a.browser.msie||a.browser.version>6,left:"center",load:false,mask:null,oneInstance:true,speed:"normal",target:null,top:"10%"}};var b=[],j={};a.tools.overlay.addEffect("default",function(f,l){var h=this.getConf(),p=a(window);if(!h.fixed){f.top+=p.scrollTop();f.left+=p.scrollLeft()}f.position=h.fixed?"fixed":"absolute";this.getOverlay().css(f).fadeIn(h.speed,l)},function(f){this.getOverlay().fadeOut(this.getConf().closeSpeed,
f)});a.fn.overlay=function(f){var l=this.data("overlay");if(l)return l;if(a.isFunction(f))f={onBeforeLoad:f};f=a.extend(true,{},a.tools.overlay.conf,f);this.each(function(){l=new c(a(this),f);b.push(l);a(this).data("overlay",l)});return f.api?l:this}})(jQuery);
(function(a){function c(){if(a.browser.msie){var d=a(document).height(),g=a(window).height();return[window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth,d-g<20?g:d]}return[a(window).width(),a(document).height()]}function b(d){if(d)return d.call(a.mask)}a.tools=a.tools||{version:"1.2.0"};var j;j=a.tools.expose={conf:{maskId:"exposeMask",loadSpeed:"slow",closeSpeed:"fast",closeOnClick:true,closeOnEsc:true,zIndex:9998,opacity:0.8,startOpacity:0,color:"#fff",onLoad:null,
onClose:null}};var f,l,h,p,k;a.mask={load:function(d,g){if(h)return this;if(typeof d=="string")d={color:d};d=d||p;p=d=a.extend(a.extend({},j.conf),d);f=a("#"+d.maskId);if(!f.length){f=a("<div/>").attr("id",d.maskId);a("body").append(f)}var n=c();f.css({position:"absolute",top:0,left:0,width:n[0],height:n[1],display:"none",opacity:d.startOpacity,zIndex:d.zIndex});n=f.css("backgroundColor");if(!n||n=="transparent"||n=="rgba(0, 0, 0, 0)")f.css("backgroundColor",d.color);if(b(d.onBeforeLoad)===false)return this;
d.closeOnEsc&&a(document).bind("keydown.mask",function(e){e.keyCode==27&&a.mask.close(e)});d.closeOnClick&&f.bind("click.mask",function(e){a.mask.close(e)});a(window).bind("resize.mask",function(){a.mask.fit()});if(g&&g.length){k=g.eq(0).css("zIndex");a.each(g,function(){var e=a(this);/relative|absolute|fixed/i.test(e.css("position"))||e.css("position","relative")});l=g.css({zIndex:Math.max(d.zIndex+1,k=="auto"?0:k)})}f.css({display:"block"}).fadeTo(d.loadSpeed,d.opacity,function(){a.mask.fit();b(d.onLoad)});
h=true;return this},close:function(){if(h){if(b(p.onBeforeClose)===false)return this;f.fadeOut(p.closeSpeed,function(){b(p.onClose);l&&l.css({zIndex:k})});a(document).unbind("keydown.mask");f.unbind("click.mask");a(window).unbind("resize.mask");h=false}return this},fit:function(){if(h){var d=c();f.css({width:d[0],height:d[1]})}},getMask:function(){return f},isLoaded:function(){return h},getConf:function(){return p},getExposed:function(){return l}};a.fn.mask=function(d){a.mask.load(d);return this};
a.fn.expose=function(d){a.mask.load(d,this);return this}})(jQuery);

