/*
CSS Browser Selector v0.4.0 (Nov 02, 2010)
Rafael Lima (http://rafael.adm.br)
http://rafael.adm.br/css_browser_selector
License: http://creativecommons.org/licenses/by/2.5/
Contributors: http://rafael.adm.br/css_browser_selector#contributors
*/
function css_browser_selector(u){var ua=u.toLowerCase(),is=function(t){return ua.indexOf(t)>-1},g='gecko',w='webkit',s='safari',o='opera',m='mobile',h=document.documentElement,b=[(!(/opera|webtv/i.test(ua))&&/msie\s(\d)/.test(ua))?('ie ie'+RegExp.$1):is('firefox/2')?g+' ff2':is('firefox/3.5')?g+' ff3 ff3_5':is('firefox/3.6')?g+' ff3 ff3_6':is('firefox/3')?g+' ff3':is('gecko/')?g:is('opera')?o+(/version\/(\d+)/.test(ua)?' '+o+RegExp.$1:(/opera(\s|\/)(\d+)/.test(ua)?' '+o+RegExp.$2:'')):is('konqueror')?'konqueror':is('blackberry')?m+' blackberry':is('android')?m+' android':is('chrome')?w+' chrome':is('iron')?w+' iron':is('applewebkit/')?w+' '+s+(/version\/(\d+)/.test(ua)?' '+s+RegExp.$1:''):is('mozilla/')?g:'',is('j2me')?m+' j2me':is('iphone')?m+' iphone':is('ipod')?m+' ipod':is('ipad')?m+' ipad':is('mac')?'mac':is('darwin')?'mac':is('webtv')?'webtv':is('win')?'win'+(is('windows nt 6.0')?' vista':''):is('freebsd')?'freebsd':(is('x11')||is('linux'))?'linux':'','js']; c = b.join(' '); h.className += ' '+c; return c;}; css_browser_selector(navigator.userAgent);

/*
 * jQuery resize event - v1.1 - 3/14/2010
 * http://benalman.com/projects/jquery-resize-plugin/
 *
 * Copyright (c) 2010 "Cowboy" Ben Alman
 * Dual licensed under the MIT and GPL licenses.
 * http://benalman.com/about/license/
 */
(function($,h,c){var a=$([]),e=$.resize=$.extend($.resize,{}),i,k="setTimeout",j="resize",d=j+"-special-event",b="delay",f="throttleWindow";e[b]=250;e[f]=true;$.event.special[j]={setup:function(){if(!e[f]&&this[k]){return false}var l=$(this);a=a.add(l);$.data(this,d,{w:l.width(),h:l.height()});if(a.length===1){g()}},teardown:function(){if(!e[f]&&this[k]){return false}var l=$(this);a=a.not(l);l.removeData(d);if(!a.length){clearTimeout(i)}},add:function(l){if(!e[f]&&this[k]){return false}var n;function m(s,o,p){var q=$(this),r=$.data(this,d);r.w=o!==c?o:q.width();r.h=p!==c?p:q.height();n.apply(this,arguments)}if($.isFunction(l)){n=l;return m}else{n=l.handler;l.handler=m}}};function g(){i=h[k](function(){a.each(function(){var n=$(this),m=n.width(),l=n.height(),o=$.data(this,d);if(m!==o.w||l!==o.h){n.trigger(j,[o.w=m,o.h=l])}});g()},e[b])}})(jQuery,this);

/*!
 * jQuery UI @VERSION
 *
 * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT or GPL Version 2 licenses.
 * http://jquery.org/license
 *
 * http://docs.jquery.com/UI
 */
(function(b,h){function i(a,c){var d=a.nodeName.toLowerCase();if("area"===d){var d=a.parentNode,e=d.name;if(!a.href||!e||d.nodeName.toLowerCase()!=="map")return!1;d=b("img[usemap=#"+e+"]")[0];return!!d&&j(d)}return(/input|select|textarea|button|object/.test(d)?!a.disabled:"a"==d?a.href||c:c)&&j(a)}function j(a){return!b(a).parents().andSelf().filter(function(){return b.curCSS(this,"visibility")==="hidden"||b.expr.filters.hidden(this)}).length}b.ui=b.ui||{};b.ui.version||(b.extend(b.ui,{version:"@VERSION",
keyCode:{ALT:18,BACKSPACE:8,CAPS_LOCK:20,COMMA:188,COMMAND:91,COMMAND_LEFT:91,COMMAND_RIGHT:93,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,MENU:93,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SHIFT:16,SPACE:32,TAB:9,UP:38,WINDOWS:91}}),b.fn.extend({_focus:b.fn.focus,focus:function(a,c){return typeof a==="number"?this.each(function(){var d=this;setTimeout(function(){b(d).focus();
c&&c.call(d)},a)}):this._focus.apply(this,arguments)},scrollParent:function(){var a;a=b.browser.msie&&/(static|relative)/.test(this.css("position"))||/absolute/.test(this.css("position"))?this.parents().filter(function(){return/(relative|absolute|fixed)/.test(b.curCSS(this,"position",1))&&/(auto|scroll)/.test(b.curCSS(this,"overflow",1)+b.curCSS(this,"overflow-y",1)+b.curCSS(this,"overflow-x",1))}).eq(0):this.parents().filter(function(){return/(auto|scroll)/.test(b.curCSS(this,"overflow",1)+b.curCSS(this,
"overflow-y",1)+b.curCSS(this,"overflow-x",1))}).eq(0);return/fixed/.test(this.css("position"))||!a.length?b(document):a},zIndex:function(a){if(a!==h)return this.css("zIndex",a);if(this.length)for(var a=b(this[0]),c;a.length&&a[0]!==document;){c=a.css("position");if(c==="absolute"||c==="relative"||c==="fixed")if(c=parseInt(a.css("zIndex"),10),!isNaN(c)&&c!==0)return c;a=a.parent()}return 0},disableSelection:function(){return this.bind((b.support.selectstart?"selectstart":"mousedown")+".ui-disableSelection",
function(a){a.preventDefault()})},enableSelection:function(){return this.unbind(".ui-disableSelection")}}),b.each(["Width","Height"],function(a,c){function d(a,c,d,f){b.each(e,function(){c-=parseFloat(b.curCSS(a,"padding"+this,!0))||0;d&&(c-=parseFloat(b.curCSS(a,"border"+this+"Width",!0))||0);f&&(c-=parseFloat(b.curCSS(a,"margin"+this,!0))||0)});return c}var e=c==="Width"?["Left","Right"]:["Top","Bottom"],f=c.toLowerCase(),g={innerWidth:b.fn.innerWidth,innerHeight:b.fn.innerHeight,outerWidth:b.fn.outerWidth,
outerHeight:b.fn.outerHeight};b.fn["inner"+c]=function(a){if(a===h)return g["inner"+c].call(this);return this.each(function(){b(this).css(f,d(this,a)+"px")})};b.fn["outer"+c]=function(a,e){if(typeof a!=="number")return g["outer"+c].call(this,a);return this.each(function(){b(this).css(f,d(this,a,!0,e)+"px")})}}),b.extend(b.expr[":"],{data:function(a,c,d){return!!b.data(a,d[3])},focusable:function(a){return i(a,!isNaN(b.attr(a,"tabindex")))},tabbable:function(a){var c=b.attr(a,"tabindex"),d=isNaN(c);
return(d||c>=0)&&i(a,!d)}}),b(function(){var a=document.body,c=a.appendChild(c=document.createElement("div"));b.extend(c.style,{minHeight:"100px",height:"auto",padding:0,borderWidth:0});b.support.minHeight=c.offsetHeight===100;b.support.selectstart="onselectstart"in c;a.removeChild(c).style.display="none"}),b.extend(b.ui,{plugin:{add:function(a,c,d){var a=b.ui[a].prototype,e;for(e in d)a.plugins[e]=a.plugins[e]||[],a.plugins[e].push([c,d[e]])},call:function(a,b,d){if((b=a.plugins[b])&&a.element[0].parentNode)for(var e=
0;e<b.length;e++)a.options[b[e][0]]&&b[e][1].apply(a.element,d)}},contains:b.contains,hasScroll:function(a,c){if(b(a).css("overflow")==="hidden")return!1;var d=c&&c==="left"?"scrollLeft":"scrollTop",e=!1;if(a[d]>0)return!0;a[d]=1;e=a[d]>0;a[d]=0;return e},isOverAxis:function(a,b,d){return a>b&&a<b+d},isOver:function(a,c,d,e,f,g){return b.ui.isOverAxis(a,d,f)&&b.ui.isOverAxis(c,e,g)}}))})(jQuery);

/*!
 * jQuery UI Widget @VERSION
 *
 * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT or GPL Version 2 licenses.
 * http://jquery.org/license
 *
 * http://docs.jquery.com/UI/Widget
 */
(function(b,i){var j=Array.prototype.slice,k=b.cleanData;b.cleanData=function(a){for(var c=0,d;(d=a[c])!=null;c++)b(d).triggerHandler("remove");k(a)};b.widget=function(a,c,d){var e=a.split(".")[0],f,a=a.split(".")[1];f=e+"-"+a;if(!d)d=c,c=b.Widget;b.expr[":"][f]=function(c){return!!b.data(c,a)};b[e]=b[e]||{};b[e][a]=b.extend(function(c,d){if(!this._createWidget)return new b[e][a](c,d);arguments.length&&this._createWidget(c,d)},b[e][a]);var g=new c;g.options=b.widget.extend({},g.options);b.each(d,
function(a,e){b.isFunction(e)&&(d[a]=function(){var a=function(a){return c.prototype[a].apply(this,j.call(arguments,1))},b=function(a,b){return c.prototype[a].apply(this,b)};return function(){var c=this._super,d=this._superApply,f;this._super=a;this._superApply=b;f=e.apply(this,arguments);this._super=c;this._superApply=d;return f}}())});b[e][a].prototype=b.widget.extend(g,{namespace:e,widgetName:a,widgetEventPrefix:a,widgetBaseClass:f},d);b.widget.bridge(a,b[e][a])};b.widget.extend=function(a){for(var c=
j.call(arguments,1),d=0,e=c.length,f,g;d<e;d++)for(f in c[d])g=c[d][f],c[d].hasOwnProperty(f)&&g!==i&&(a[f]=b.isPlainObject(g)?b.widget.extend({},a[f],g):g);return a};b.widget.bridge=function(a,c){b.fn[a]=function(d){var e=typeof d==="string",f=j.call(arguments,1),g=this,d=!e&&f.length?b.widget.extend.apply(null,[d].concat(f)):d;e?this.each(function(){var c=b.data(this,a);if(!c)return b.error("cannot call methods on "+a+" prior to initialization; attempted to call method '"+d+"'");if(!b.isFunction(c[d])||
d.charAt(0)==="_")return b.error("no such method '"+d+"' for "+a+" widget instance");var e=c[d].apply(c,f);if(e!==c&&e!==i)return g=e.jquery?g.pushStack(e.get()):e,!1}):this.each(function(){var e=b.data(this,a);e?e.option(d||{})._init():c(d,this)});return g}};b.Widget=function(a,c){if(!this._createWidget)return new b[namespace][name](a,c);arguments.length&&this._createWidget(a,c)};b.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",defaultElement:"<div>",options:{disabled:!1,create:null},
_createWidget:function(a,c){c=b(c||this.defaultElement||this)[0];this.element=b(c);this.options=b.widget.extend({},this.options,this._getCreateOptions(),a);this.bindings=b();this.hoverable=b();this.focusable=b();c!==this&&(b.data(c,this.widgetName,this),this._bind({remove:"destroy"}));this._create();this._trigger("create");this._init()},_getCreateOptions:b.noop,_create:b.noop,_init:b.noop,destroy:function(){this._destroy();this.element.unbind("."+this.widgetName).removeData(this.widgetName);this.widget().unbind("."+
this.widgetName).removeAttr("aria-disabled").removeClass(this.widgetBaseClass+"-disabled ui-state-disabled");this.bindings.unbind("."+this.widgetName);this.hoverable.removeClass("ui-state-hover");this.focusable.removeClass("ui-state-focus")},_destroy:b.noop,widget:function(){return this.element},option:function(a,c){var d=a,e,f,g;if(arguments.length===0)return b.widget.extend({},this.options);if(typeof a==="string"){if(c===i)return this.options[a];d={};e=a.split(".");a=e.shift();if(e.length){f=d[a]=
b.widget.extend({},this.options[a]);for(g=0;g<e.length-1;g++)f[e[g]]=f[e[g]]||{},f=f[e[g]];f[e.pop()]=c}else d[a]=c}this._setOptions(d);return this},_setOptions:function(a){var c=this;b.each(a,function(a,b){c._setOption(a,b)});return this},_setOption:function(a,b){this.options[a]=b;a==="disabled"&&(this.widget().toggleClass(this.widgetBaseClass+"-disabled ui-state-disabled",!!b).attr("aria-disabled",b),this.hoverable.removeClass("ui-state-hover"),this.focusable.removeClass("ui-state-focus"));return this},
enable:function(){return this._setOption("disabled",!1)},disable:function(){return this._setOption("disabled",!0)},_bind:function(a,c){c?(a=b(a),this.bindings=this.bindings.add(a)):(c=a,a=this.element);var d=this;b.each(c,function(c,f){a.bind(c+"."+d.widgetName,function(){if(!(d.options.disabled===!0||b(this).hasClass("ui-state-disabled")))return(typeof f==="string"?d[f]:f).apply(d,arguments)})})},_hoverable:function(a){this.hoverable=this.hoverable.add(a);this._bind(a,{mouseenter:function(a){b(a.currentTarget).addClass("ui-state-hover")},
mouseleave:function(a){b(a.currentTarget).removeClass("ui-state-hover")}})},_focusable:function(a){this.focusable=this.focusable.add(a);this._bind(a,{focusin:function(a){b(a.currentTarget).addClass("ui-state-focus")},focusout:function(a){b(a.currentTarget).removeClass("ui-state-focus")}})},_trigger:function(a,c,d){var e=this.options[a],c=b.Event(c);c.type=(a===this.widgetEventPrefix?a:this.widgetEventPrefix+a).toLowerCase();d=d||{};if(c.originalEvent)for(var a=b.event.props.length,f;a;)f=b.event.props[--a],
c[f]=c.originalEvent[f];this.element.trigger(c,d);d=b.isArray(d)?[c].concat(d):[c,d];return!(b.isFunction(e)&&e.apply(this.element[0],d)===!1||c.isDefaultPrevented())}};b.each({show:"fadeIn",hide:"fadeOut"},function(a,c){b.Widget.prototype["_"+a]=function(d,e,f){var e=e||{},g=!b.isEmptyObject(e),h=e.effect||c;e.complete=f;e.delay&&d.delay(e.delay);if(g&&b.effects&&(b.effects.effect[h]||b.uiBackCompat!==!1&&b.effects[h]))d[a](e);else if(h!==a&&d[h])d[h](e.duration,e.easing,f);else d.queue(function(){b(this)[a]();
f&&f.call(d[0])})}});if(b.uiBackCompat!==!1)b.Widget.prototype._getCreateOptions=function(){return b.metadata&&b.metadata.get(this.element[0])[this.widgetName]}})(jQuery);

/*
 * jQuery UI Position @VERSION
 *
 * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT or GPL Version 2 licenses.
 * http://jquery.org/license
 *
 * http://docs.jquery.com/UI/Position
 */
(function(f,t){f.ui=f.ui||{};var l=/left|center|right/,m=/top|center|bottom/,n=/[+-]\d+%?/,o=/^\w+/,p=/%$/,u=f.fn.position;f.fn.position=function(b){if(!b||!b.of)return u.apply(this,arguments);var b=f.extend({},b),a=f(b.of),c=a[0],d=(b.collision||"flip").split(" "),e={},h,j,k,i;c.nodeType===9?(j=a.width(),k=a.height(),i={top:0,left:0}):f.isWindow(c)?(j=a.width(),k=a.height(),i={top:a.scrollTop(),left:a.scrollLeft()}):c.preventDefault?(b.at="left top",j=k=0,i={top:b.of.pageY,left:b.of.pageX}):(j=a.outerWidth(),
k=a.outerHeight(),i=a.offset());f.each(["my","at"],function(){var a=(b[this]||"").split(" "),c,d;a.length===1&&(a=l.test(a[0])?a.concat(["center"]):m.test(a[0])?["center"].concat(a):["center","center"]);a[0]=l.test(a[0])?a[0]:"center";a[1]=m.test(a[1])?a[1]:"center";c=n.exec(a[0]);d=n.exec(a[1]);e[this]=[c?c[0]:0,d?d[0]:0];b[this]=[o.exec(a[0])[0],o.exec(a[1])[0]]});d.length===1&&(d[1]=d[0]);b.at[0]==="right"?i.left+=j:b.at[0]==="center"&&(i.left+=j/2);b.at[1]==="bottom"?i.top+=k:b.at[1]==="center"&&
(i.top+=k/2);h=[parseInt(e.at[0],10)*(p.test(e.at[0])?j/100:1),parseInt(e.at[1],10)*(p.test(e.at[1])?k/100:1)];i.left+=h[0];i.top+=h[1];return this.each(function(){var a=f(this),c=a.outerWidth(),q=a.outerHeight(),l=parseInt(f.curCSS(this,"marginLeft",!0))||0,m=parseInt(f.curCSS(this,"marginTop",!0))||0,n=c+l+(parseInt(f.curCSS(this,"marginRight",!0))||0),o=q+m+(parseInt(f.curCSS(this,"marginBottom",!0))||0),g=f.extend({},i),r=[parseInt(e.my[0],10)*(p.test(e.my[0])?a.outerWidth()/100:1),parseInt(e.my[1],
10)*(p.test(e.my[1])?a.outerHeight()/100:1)],s;b.my[0]==="right"?g.left-=c:b.my[0]==="center"&&(g.left-=c/2);b.my[1]==="bottom"?g.top-=q:b.my[1]==="center"&&(g.top-=q/2);g.left+=r[0];g.top+=r[1];g.left=Math.round(g.left);g.top=Math.round(g.top);s={left:g.left-l,top:g.top-m};f.each(["left","top"],function(a,e){if(f.ui.position[d[a]])f.ui.position[d[a]][e](g,{targetWidth:j,targetHeight:k,elemWidth:c,elemHeight:q,collisionPosition:s,collisionWidth:n,collisionHeight:o,offset:[h[0]+r[0],h[1]+r[1]],my:b.my,
at:b.at})});f.fn.bgiframe&&a.bgiframe();a.offset(f.extend(g,{using:b.using}))})};f.ui.position={fit:{left:function(b,a){var c=f(window),d=c.scrollLeft()-a.collisionPosition.left,e=a.collisionPosition.left+a.collisionWidth-c.width()-c.scrollLeft();a.collisionWidth>c.width()||d>0?b.left+=d:e>0?b.left-=e:b.left=Math.max(b.left-a.collisionPosition.left,b.left)},top:function(b,a){var c=f(window),d=c.scrollTop()-a.collisionPosition.top,e=a.collisionPosition.top+a.collisionHeight-c.height()-c.scrollTop();
a.collisionHeight>c.height()||d>0?b.top+=d:e>0?b.top-=e:b.top=Math.max(b.top-a.collisionPosition.top,b.top)}},flip:{left:function(b,a){if(a.at[0]!=="center"){var c=f(window),c=a.collisionPosition.left+a.collisionWidth-c.width()-c.scrollLeft(),d=a.my[0]==="left"?-a.elemWidth:a.my[0]==="right"?a.elemWidth:0,e=a.at[0]==="left"?a.targetWidth:-a.targetWidth,h=-2*a.offset[0];b.left+=a.collisionPosition.left<0?d+e+h:c>0?d+e+h:0}},top:function(b,a){if(a.at[1]!=="center"){var c=f(window),c=a.collisionPosition.top+
a.collisionHeight-c.height()-c.scrollTop(),d=a.my[1]==="top"?-a.elemHeight:a.my[1]==="bottom"?a.elemHeight:0,e=a.at[1]==="top"?a.targetHeight:-a.targetHeight,h=-2*a.offset[1];b.top+=a.collisionPosition.top<0?d+e+h:c>0?d+e+h:0}}}};f.uiBackCompat!==!1&&function(b){var a=b.fn.position;b.fn.position=function(c){if(!c||!("offset"in c))return a.call(this,c);var d=c.offset.split(" "),e=c.at.split(" ");d.length===1&&(d[1]=d[0]);/^\d/.test(d[0])&&(d[0]="+"+d[0]);/^\d/.test(d[1])&&(d[1]="+"+d[1]);e.length===
1&&(/left|center|right/.test(e[0])?e[1]="center":(e[1]=e[0],e[0]="center"));return a.call(this,b.extend(c,{at:e[0]+d[0]+" "+e[1]+d[1],offset:t}))}}(jQuery)})(jQuery);

/*
 * jQuery UI selectmenu
 *
 * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT (MIT-LICENSE.txt)
 * and GPL (GPL-LICENSE.txt) licenses.
 *
 * http://docs.jquery.com/UI
 */

(function(d){d.widget("ui.selectmenu",{getter:"value",version:"1.8",eventPrefix:"selectmenu",options:{transferClasses:!0,style:"popup",width:null,menuWidth:null,handleWidth:26,maxHeight:null,icons:null,format:null},_create:function(){var a=this,b=this.options,e=this.element.attr("id")||"ui-selectmenu-"+Math.random().toString(16).slice(2,10);this.ids=[e+"-button",e+"-menu"];this._safemouseup=!0;this.newelement=d('<a class="'+this.widgetBaseClass+' ui-widget ui-state-default ui-corner-all" id="'+this.ids[0]+
'" role="button" href="#" aria-haspopup="true" aria-owns="'+this.ids[1]+'"></a>').insertAfter(this.element);(e=this.element.attr("tabindex"))&&this.newelement.attr("tabindex",e);this.newelement.data("selectelement",this.element);this.selectmenuIcon=d('<span class="'+this.widgetBaseClass+'-icon ui-icon"></span>').prependTo(this.newelement).addClass(b.style=="popup"?"ui-icon-triangle-2-n-s":"ui-icon-triangle-1-s");d("label[for="+this.element.attr("id")+"]").attr("for",this.ids[0]).bind("click",function(){a.newelement[0].focus();
return!1});this.newelement.bind("mousedown",function(d){a._toggle(d);if(b.style=="popup")a._safemouseup=!1,setTimeout(function(){a._safemouseup=!0},300);return!1}).bind("click",function(){return!1}).keydown(function(b){var e=!0;switch(b.keyCode){case d.ui.keyCode.ENTER:e=!0;break;case d.ui.keyCode.SPACE:e=!1;a._toggle(b);break;case d.ui.keyCode.UP:case d.ui.keyCode.LEFT:e=!1;a._moveSelection(-1);break;case d.ui.keyCode.DOWN:case d.ui.keyCode.RIGHT:e=!1;a._moveSelection(1);break;case d.ui.keyCode.TAB:e=
!0;break;default:e=!1,a._typeAhead(b.keyCode,"mouseup")}return e}).bind("mouseover focus",function(){d(this).addClass(a.widgetBaseClass+"-focus ui-state-hover")}).bind("mouseout blur",function(){d(this).removeClass(a.widgetBaseClass+"-focus ui-state-hover")});d(document).mousedown(function(b){a.close(b)});this.element.click(function(){this._refreshValue()}).focus(function(){this.newelement&&this.newelement[0].focus()});this.list=d('<ul class="'+a.widgetBaseClass+"-menu ui-widget ui-widget-content"+
(b.style=="dropdown"?" ui-corner-bottom":" ui-corner-all")+'" aria-hidden="true" role="listbox" aria-labelledby="'+this.ids[0]+'" id="'+this.ids[1]+'"></ul>').appendTo("body");var f=[];this.element.find("option").each(function(){f.push({value:d(this).attr("value"),text:a._formatText(jQuery(this).text()),selected:d(this).attr("selected"),classes:d(this).attr("class"),parentOptGroup:d(this).parent("optgroup").attr("label")})});for(var g=a.options.style=="popup"?" ui-state-active":"",e=0;e<f.length;e++){var j=
d('<li role="presentation"><a href="#" tabindex="-1" role="option" aria-selected="false">'+f[e].text+"</a></li>").data("index",e).addClass(f[e].classes).data("optionClasses",f[e].classes||"").mouseup(function(b){if(a._safemouseup){var e=d(this).data("index")!=a._selectedIndex();a.value(d(this).data("index"));a.select(b);e&&a.change(b);a.close(b,!0)}return!1}).click(function(){return!1}).bind("mouseover focus",function(){a._selectedOptionLi().addClass(g);a._focusedOptionLi().removeClass(a.widgetBaseClass+
"-item-focus ui-state-hover");d(this).removeClass("ui-state-active").addClass(a.widgetBaseClass+"-item-focus ui-state-hover")}).bind("mouseout blur",function(){d(this).is(a._selectedOptionLi())&&d(this).addClass(g);d(this).removeClass(a.widgetBaseClass+"-item-focus ui-state-hover")});if(f[e].parentOptGroup){var h=a.widgetBaseClass+"-group-"+f[e].parentOptGroup.replace(/[^a-zA-Z0-9]/g,"");this.list.find("li."+h).size()?this.list.find("li."+h+":last ul").append(j):d('<li role="presentation" class="'+
a.widgetBaseClass+"-group "+h+'"><span class="'+a.widgetBaseClass+'-group-label">'+f[e].parentOptGroup+"</span><ul></ul></li>").appendTo(this.list).find("ul").append(j)}else j.appendTo(this.list);this.list.bind("mousedown mouseup",function(){return!1});if(b.icons)for(var i in b.icons)j.is(b.icons[i].find)&&(j.data("optionClasses",f[e].classes+" "+a.widgetBaseClass+"-hasIcon").addClass(a.widgetBaseClass+"-hasIcon"),h=b.icons[i].icon||"",j.find("a:eq(0)").prepend('<span class="'+a.widgetBaseClass+"-item-icon ui-icon "+
h+'"></span>'))}this.list.find("li:last").addClass("ui-corner-bottom");b.style=="popup"&&this.list.find("li:first").addClass("ui-corner-top");b.transferClasses&&(i=this.element.attr("class")||"",this.newelement.add(this.list).addClass(i));i=this.element.width();this.newelement.width(b.width?b.width:i);b.style=="dropdown"?this.list.width(b.menuWidth?b.menuWidth:b.width?b.width:i):this.list.width(b.menuWidth?b.menuWidth:b.width?b.width-b.handleWidth:i-b.handleWidth);b.maxHeight&&b.maxHeight<this.list.height()&&
this.list.height(b.maxHeight);this._optionLis=this.list.find("li:not(."+a.widgetBaseClass+"-group)");this.list.keydown(function(b){var e=!0;switch(b.keyCode){case d.ui.keyCode.HOME:e=!1;a._moveFocus(":first");break;case d.ui.keyCode.PAGE_UP:e=!1;a._scrollPage("up");break;case d.ui.keyCode.PAGE_DOWN:e=!1;a._scrollPage("down");break;case d.ui.keyCode.END:e=!1;a._moveFocus(":last");break;case d.ui.keyCode.ENTER:case d.ui.keyCode.SPACE:e=!1;a.close(b,!0);d(b.target).parents("li:eq(0)").trigger("mouseup");
break;case d.ui.keyCode.TAB:e=!0;a.close(b,!0);break;case d.ui.keyCode.ESCAPE:e=!1;a.close(b,!0);break;default:e=!1,a._typeAhead(b.keyCode,"focus")}return e});b.style=="dropdown"?(this.newelement.addClass(a.widgetBaseClass+"-dropdown"),this.list.addClass(a.widgetBaseClass+"-menu-dropdown")):(this.newelement.addClass(a.widgetBaseClass+"-popup"),this.list.addClass(a.widgetBaseClass+"-menu-popup"));this.newelement.prepend('<span class="'+a.widgetBaseClass+'-status">'+f[this._selectedIndex()].text+"</span>");
this.element.hide();this.element.attr("disabled")==!0&&this.disable();this.value(this._selectedIndex());d(window).resize(function(){a._refreshPosition()})},destroy:function(){this.element.removeData(this.widgetName).removeClass(this.widgetBaseClass+"-disabled "+this.namespace+"-state-disabled").removeAttr("aria-disabled").unbind("click");d("label[for="+this.newelement.attr("id")+"]").attr("for",this.element.attr("id")).unbind("click");this.newelement.remove();this.list.remove();this.element.show();
d.Widget.prototype.destroy.apply(this,arguments)},_typeAhead:function(a,b){var e=this;if(!e._prevChar)e._prevChar=["",0];var f=String.fromCharCode(a);c=f.toLowerCase();var g=!1;this.list.find("li a").each(function(a){if(!g){var h=d(this).text();if(h.indexOf(f)==0||h.indexOf(c)==0)e._prevChar[0]==f?e._prevChar[1]<a&&(g=!0,d(this).trigger(b),e._prevChar[1]=a):(g=!0,d(this).trigger(b),e._prevChar[1]=a)}});this._prevChar[0]=f},_uiHash:function(){var a=this.value();return{index:a,option:d("option",this.element).get(a),
value:this.element[0].value}},open:function(a){this.newelement.attr("aria-disabled")!="true"&&(this._refreshPosition(),this._closeOthers(a),this.newelement.addClass("ui-state-active"),this.list.appendTo("body").addClass(this.widgetBaseClass+"-open").attr("aria-hidden",!1).find("li:not(."+this.widgetBaseClass+"-group):eq("+this._selectedIndex()+") a")[0].focus(),this.options.style=="dropdown"&&this.newelement.removeClass("ui-corner-all").addClass("ui-corner-top"),this._refreshPosition(),this._trigger("open",
a,this._uiHash()))},close:function(a,b){this.newelement.is(".ui-state-active")&&(this.newelement.removeClass("ui-state-active"),this.list.attr("aria-hidden",!0).removeClass(this.widgetBaseClass+"-open"),this.options.style=="dropdown"&&this.newelement.removeClass("ui-corner-top").addClass("ui-corner-all"),b&&this.newelement[0].focus(),this._trigger("close",a,this._uiHash()))},change:function(a){this.element.trigger("change");this._trigger("change",a,this._uiHash())},select:function(a){this._trigger("select",
a,this._uiHash())},_closeOthers:function(a){d("."+this.widgetBaseClass+".ui-state-active").not(this.newelement).each(function(){d(this).data("selectelement").selectmenu("close",a)});d("."+this.widgetBaseClass+".ui-state-hover").trigger("mouseout")},_toggle:function(a,b){this.list.is("."+this.widgetBaseClass+"-open")?this.close(a,b):this.open(a)},_formatText:function(a){return this.options.format?this.options.format(a):a},_selectedIndex:function(){return this.element[0].selectedIndex},_selectedOptionLi:function(){return this._optionLis.eq(this._selectedIndex())},
_focusedOptionLi:function(){return this.list.find("."+this.widgetBaseClass+"-item-focus")},_moveSelection:function(a){return this._optionLis.eq(parseInt(this._selectedOptionLi().data("index"),10)+a).trigger("mouseup")},_moveFocus:function(a){a=isNaN(a)?parseInt(this._optionLis.filter(a).data("index"),10):parseInt(this._focusedOptionLi().data("index"),10)+a;a<0&&(a=0);a>this._optionLis.size()-1&&(a=this._optionLis.size()-1);var b=this.widgetBaseClass+"-item-"+Math.round(Math.random()*1E3);this._focusedOptionLi().find("a:eq(0)").attr("id",
"");this._optionLis.eq(a).find("a:eq(0)").attr("id",b)[0].focus();this.list.attr("aria-activedescendant",b)},_scrollPage:function(a){var b=Math.floor(this.list.outerHeight()/this.list.find("li:first").outerHeight());this._moveFocus(a=="up"?-b:b)},_setOption:function(a,b){this.options[a]=b;a=="disabled"&&(this.close(),this.element.add(this.newelement).add(this.list)[b?"addClass":"removeClass"](this.widgetBaseClass+"-disabled "+this.namespace+"-state-disabled").attr("aria-disabled",b))},value:function(a){if(arguments.length)this.element[0].selectedIndex=
a,this._refreshValue(),this._refreshPosition();return this.element[0].selectedIndex},_refreshValue:function(){var a=this.options.style=="popup"?" ui-state-active":"",b=this.widgetBaseClass+"-item-"+Math.round(Math.random()*1E3);this.list.find("."+this.widgetBaseClass+"-item-selected").removeClass(this.widgetBaseClass+"-item-selected"+a).find("a").attr("aria-selected","false").attr("id","");this._selectedOptionLi().addClass(this.widgetBaseClass+"-item-selected"+a).find("a").attr("aria-selected","true").attr("id",
b);var a=this.newelement.data("optionClasses")?this.newelement.data("optionClasses"):"",d=this._selectedOptionLi().data("optionClasses")?this._selectedOptionLi().data("optionClasses"):"";this.newelement.removeClass(a).data("optionClasses",d).addClass(d).find("."+this.widgetBaseClass+"-status").html(this._selectedOptionLi().find("a:eq(0)").html());this.list.attr("aria-activedescendant",b)},_refreshPosition:function(){var a=this._pageScroll(),b=this.newelement.offset().top,e=d(window).height(),f=d(this.list[0]).outerHeight();
if(b+f>e+a)b-=f;else if(this.newelement.is("."+this.widgetBaseClass+"-popup")){var g=this.list[0].scrollTop;this.list.find("li:lt("+this._selectedIndex()+")").each(function(){g-=d(this).outerHeight()});b+=g}else b+=this.newelement.height();this.list.css({top:b,left:this.newelement.offset().left})},_pageScroll:function(){var a;if(self.pageYOffset)a=self.pageYOffset;else if(document.documentElement&&document.documentElement.scrollTop)a=document.documentElement.scrollTop;else if(document.body)a=document.body.scrollTop;
return a}})})(jQuery);


(function($) {
$(function() {

	if($(".wrapper").hasClass("home_page")){
	if($("body").width() < 1030) {
			$("body").addClass("window1024");
			$("html").css("overflow-x", "hidden");
		}
		else {
			$("body").removeClass("window1024");
			$("html").css("overflow-x", "visible");
			}

	$("body").resize(function() {
		if($("body").width() < 1030) {
			$("body").addClass("window1024");
			$("html").css("overflow-x", "hidden");
		}
		else {
			$("body").removeClass("window1024");
			$("html").css("overflow-x", "visible");
			}
	});
	}

	var $_fixed_sidebar = $('#fixed-sidebar');
	if($_fixed_sidebar.length>0) {
		var max_to = $('.page-content').height()-$('.infoblocks').height()-$_fixed_sidebar.height();
		//console.log(max_to);
		$(window).scroll(function() {
			var scroll_pos = $(window).scrollTop();

			if(scroll_pos < 220) {
				var to = 110;
			}
			else {
				var to = 110+scroll_pos-200;
			}

			if(to>max_to)
				to = max_to

			$_fixed_sidebar.animate({top: to}, {queue: false, duration: 'fast'});
		});
	}


		// Форма контактов

		$(".contact-form .select").selectmenu({ // стилизация селекта
		  style:"dropdown",
		  width: 297
		});

		$(".ui-selectmenu-menu li").last().css({
			"borderBottom" : "none"
			}).end().first().hide();

		//Фильтр участинков

		$(".sbr-filter-form .select").selectmenu({ // стилизация селекта
		  style:"dropdown",
		  width: 235
		});


		 // end




});
})(jQuery);

function checkFocus(state, elem, mess) {
	if(state=='blur' && elem.value=='')
		elem.value=mess;
	else if(state=='focus' && elem.value==mess)
		elem.value='';
}

