
 /* jquery.js */ 
/*!
 * jQuery JavaScript Library v1.5.1
 * http://jquery.com/
 *
 * Copyright 2011, John Resig
 * Dual licensed under the MIT or GPL Version 2 licenses.
 * http://jquery.org/license
 *
 * Includes Sizzle.js
 * http://sizzlejs.com/
 * Copyright 2011, The Dojo Foundation
 * Released under the MIT, BSD, and GPL Licenses.
 *
 * Date: Wed Feb 23 13:55:29 2011 -0500
 */
(function(a,b){function cg(a){return d.isWindow(a)?a:a.nodeType===9?a.defaultView||a.parentWindow:!1}function cd(a){if(!bZ[a]){var b=d("<"+a+">").appendTo("body"),c=b.css("display");b.remove();if(c==="none"||c==="")c="block";bZ[a]=c}return bZ[a]}function cc(a,b){var c={};d.each(cb.concat.apply([],cb.slice(0,b)),function(){c[this]=a});return c}function bY(){try{return new a.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}}function bX(){try{return new a.XMLHttpRequest}catch(b){}}function bW(){d(a).unload(function(){for(var a in bU)bU[a](0,1)})}function bQ(a,c){a.dataFilter&&(c=a.dataFilter(c,a.dataType));var e=a.dataTypes,f={},g,h,i=e.length,j,k=e[0],l,m,n,o,p;for(g=1;g<i;g++){if(g===1)for(h in a.converters)typeof h==="string"&&(f[h.toLowerCase()]=a.converters[h]);l=k,k=e[g];if(k==="*")k=l;else if(l!=="*"&&l!==k){m=l+" "+k,n=f[m]||f["* "+k];if(!n){p=b;for(o in f){j=o.split(" ");if(j[0]===l||j[0]==="*"){p=f[j[1]+" "+k];if(p){o=f[o],o===!0?n=p:p===!0&&(n=o);break}}}}!n&&!p&&d.error("No conversion from "+m.replace(" "," to ")),n!==!0&&(c=n?n(c):p(o(c)))}}return c}function bP(a,c,d){var e=a.contents,f=a.dataTypes,g=a.responseFields,h,i,j,k;for(i in g)i in d&&(c[g[i]]=d[i]);while(f[0]==="*")f.shift(),h===b&&(h=a.mimeType||c.getResponseHeader("content-type"));if(h)for(i in e)if(e[i]&&e[i].test(h)){f.unshift(i);break}if(f[0]in d)j=f[0];else{for(i in d){if(!f[0]||a.converters[i+" "+f[0]]){j=i;break}k||(k=i)}j=j||k}if(j){j!==f[0]&&f.unshift(j);return d[j]}}function bO(a,b,c,e){if(d.isArray(b)&&b.length)d.each(b,function(b,f){c||bq.test(a)?e(a,f):bO(a+"["+(typeof f==="object"||d.isArray(f)?b:"")+"]",f,c,e)});else if(c||b==null||typeof b!=="object")e(a,b);else if(d.isArray(b)||d.isEmptyObject(b))e(a,"");else for(var f in b)bO(a+"["+f+"]",b[f],c,e)}function bN(a,c,d,e,f,g){f=f||c.dataTypes[0],g=g||{},g[f]=!0;var h=a[f],i=0,j=h?h.length:0,k=a===bH,l;for(;i<j&&(k||!l);i++)l=h[i](c,d,e),typeof l==="string"&&(!k||g[l]?l=b:(c.dataTypes.unshift(l),l=bN(a,c,d,e,l,g)));(k||!l)&&!g["*"]&&(l=bN(a,c,d,e,"*",g));return l}function bM(a){return function(b,c){typeof b!=="string"&&(c=b,b="*");if(d.isFunction(c)){var e=b.toLowerCase().split(bB),f=0,g=e.length,h,i,j;for(;f<g;f++)h=e[f],j=/^\+/.test(h),j&&(h=h.substr(1)||"*"),i=a[h]=a[h]||[],i[j?"unshift":"push"](c)}}}function bo(a,b,c){var e=b==="width"?bi:bj,f=b==="width"?a.offsetWidth:a.offsetHeight;if(c==="border")return f;d.each(e,function(){c||(f-=parseFloat(d.css(a,"padding"+this))||0),c==="margin"?f+=parseFloat(d.css(a,"margin"+this))||0:f-=parseFloat(d.css(a,"border"+this+"Width"))||0});return f}function ba(a,b){b.src?d.ajax({url:b.src,async:!1,dataType:"script"}):d.globalEval(b.text||b.textContent||b.innerHTML||""),b.parentNode&&b.parentNode.removeChild(b)}function _(a){return"getElementsByTagName"in a?a.getElementsByTagName("*"):"querySelectorAll"in a?a.querySelectorAll("*"):[]}function $(a,b){if(b.nodeType===1){var c=b.nodeName.toLowerCase();b.clearAttributes(),b.mergeAttributes(a);if(c==="object")b.outerHTML=a.outerHTML;else if(c!=="input"||a.type!=="checkbox"&&a.type!=="radio"){if(c==="option")b.selected=a.defaultSelected;else if(c==="input"||c==="textarea")b.defaultValue=a.defaultValue}else a.checked&&(b.defaultChecked=b.checked=a.checked),b.value!==a.value&&(b.value=a.value);b.removeAttribute(d.expando)}}function Z(a,b){if(b.nodeType===1&&d.hasData(a)){var c=d.expando,e=d.data(a),f=d.data(b,e);if(e=e[c]){var g=e.events;f=f[c]=d.extend({},e);if(g){delete f.handle,f.events={};for(var h in g)for(var i=0,j=g[h].length;i<j;i++)d.event.add(b,h+(g[h][i].namespace?".":"")+g[h][i].namespace,g[h][i],g[h][i].data)}}}}function Y(a,b){return d.nodeName(a,"table")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function O(a,b,c){if(d.isFunction(b))return d.grep(a,function(a,d){var e=!!b.call(a,d,a);return e===c});if(b.nodeType)return d.grep(a,function(a,d){return a===b===c});if(typeof b==="string"){var e=d.grep(a,function(a){return a.nodeType===1});if(J.test(b))return d.filter(b,e,!c);b=d.filter(b,e)}return d.grep(a,function(a,e){return d.inArray(a,b)>=0===c})}function N(a){return!a||!a.parentNode||a.parentNode.nodeType===11}function F(a,b){return(a&&a!=="*"?a+".":"")+b.replace(r,"`").replace(s,"&")}function E(a){var b,c,e,f,g,h,i,j,k,l,m,n,o,q=[],r=[],s=d._data(this,"events");if(a.liveFired!==this&&s&&s.live&&!a.target.disabled&&(!a.button||a.type!=="click")){a.namespace&&(n=new RegExp("(^|\\.)"+a.namespace.split(".").join("\\.(?:.*\\.)?")+"(\\.|$)")),a.liveFired=this;var t=s.live.slice(0);for(i=0;i<t.length;i++)g=t[i],g.origType.replace(p,"")===a.type?r.push(g.selector):t.splice(i--,1);f=d(a.target).closest(r,a.currentTarget);for(j=0,k=f.length;j<k;j++){m=f[j];for(i=0;i<t.length;i++){g=t[i];if(m.selector===g.selector&&(!n||n.test(g.namespace))&&!m.elem.disabled){h=m.elem,e=null;if(g.preType==="mouseenter"||g.preType==="mouseleave")a.type=g.preType,e=d(a.relatedTarget).closest(g.selector)[0];(!e||e!==h)&&q.push({elem:h,handleObj:g,level:m.level})}}}for(j=0,k=q.length;j<k;j++){f=q[j];if(c&&f.level>c)break;a.currentTarget=f.elem,a.data=f.handleObj.data,a.handleObj=f.handleObj,o=f.handleObj.origHandler.apply(f.elem,arguments);if(o===!1||a.isPropagationStopped()){c=f.level,o===!1&&(b=!1);if(a.isImmediatePropagationStopped())break}}return b}}function C(a,c,e){var f=d.extend({},e[0]);f.type=a,f.originalEvent={},f.liveFired=b,d.event.handle.call(c,f),f.isDefaultPrevented()&&e[0].preventDefault()}function w(){return!0}function v(){return!1}function g(a){for(var b in a)if(b!=="toJSON")return!1;return!0}function f(a,c,f){if(f===b&&a.nodeType===1){f=a.getAttribute("data-"+c);if(typeof f==="string"){try{f=f==="true"?!0:f==="false"?!1:f==="null"?null:d.isNaN(f)?e.test(f)?d.parseJSON(f):f:parseFloat(f)}catch(g){}d.data(a,c,f)}else f=b}return f}var c=a.document,d=function(){function I(){if(!d.isReady){try{c.documentElement.doScroll("left")}catch(a){setTimeout(I,1);return}d.ready()}}var d=function(a,b){return new d.fn.init(a,b,g)},e=a.jQuery,f=a.$,g,h=/^(?:[^<]*(<[\w\W]+>)[^>]*$|#([\w\-]+)$)/,i=/\S/,j=/^\s+/,k=/\s+$/,l=/\d/,m=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,n=/^[\],:{}\s]*$/,o=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,p=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,q=/(?:^|:|,)(?:\s*\[)+/g,r=/(webkit)[ \/]([\w.]+)/,s=/(opera)(?:.*version)?[ \/]([\w.]+)/,t=/(msie) ([\w.]+)/,u=/(mozilla)(?:.*? rv:([\w.]+))?/,v=navigator.userAgent,w,x=!1,y,z="then done fail isResolved isRejected promise".split(" "),A,B=Object.prototype.toString,C=Object.prototype.hasOwnProperty,D=Array.prototype.push,E=Array.prototype.slice,F=String.prototype.trim,G=Array.prototype.indexOf,H={};d.fn=d.prototype={constructor:d,init:function(a,e,f){var g,i,j,k;if(!a)return this;if(a.nodeType){this.context=this[0]=a,this.length=1;return this}if(a==="body"&&!e&&c.body){this.context=c,this[0]=c.body,this.selector="body",this.length=1;return this}if(typeof a==="string"){g=h.exec(a);if(!g||!g[1]&&e)return!e||e.jquery?(e||f).find(a):this.constructor(e).find(a);if(g[1]){e=e instanceof d?e[0]:e,k=e?e.ownerDocument||e:c,j=m.exec(a),j?d.isPlainObject(e)?(a=[c.createElement(j[1])],d.fn.attr.call(a,e,!0)):a=[k.createElement(j[1])]:(j=d.buildFragment([g[1]],[k]),a=(j.cacheable?d.clone(j.fragment):j.fragment).childNodes);return d.merge(this,a)}i=c.getElementById(g[2]);if(i&&i.parentNode){if(i.id!==g[2])return f.find(a);this.length=1,this[0]=i}this.context=c,this.selector=a;return this}if(d.isFunction(a))return f.ready(a);a.selector!==b&&(this.selector=a.selector,this.context=a.context);return d.makeArray(a,this)},selector:"",jquery:"1.5.1",length:0,size:function(){return this.length},toArray:function(){return E.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this[this.length+a]:this[a]},pushStack:function(a,b,c){var e=this.constructor();d.isArray(a)?D.apply(e,a):d.merge(e,a),e.prevObject=this,e.context=this.context,b==="find"?e.selector=this.selector+(this.selector?" ":"")+c:b&&(e.selector=this.selector+"."+b+"("+c+")");return e},each:function(a,b){return d.each(this,a,b)},ready:function(a){d.bindReady(),y.done(a);return this},eq:function(a){return a===-1?this.slice(a):this.slice(a,+a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(E.apply(this,arguments),"slice",E.call(arguments).join(","))},map:function(a){return this.pushStack(d.map(this,function(b,c){return a.call(b,c,b)}))},end:function(){return this.prevObject||this.constructor(null)},push:D,sort:[].sort,splice:[].splice},d.fn.init.prototype=d.fn,d.extend=d.fn.extend=function(){var a,c,e,f,g,h,i=arguments[0]||{},j=1,k=arguments.length,l=!1;typeof i==="boolean"&&(l=i,i=arguments[1]||{},j=2),typeof i!=="object"&&!d.isFunction(i)&&(i={}),k===j&&(i=this,--j);for(;j<k;j++)if((a=arguments[j])!=null)for(c in a){e=i[c],f=a[c];if(i===f)continue;l&&f&&(d.isPlainObject(f)||(g=d.isArray(f)))?(g?(g=!1,h=e&&d.isArray(e)?e:[]):h=e&&d.isPlainObject(e)?e:{},i[c]=d.extend(l,h,f)):f!==b&&(i[c]=f)}return i},d.extend({noConflict:function(b){a.$=f,b&&(a.jQuery=e);return d},isReady:!1,readyWait:1,ready:function(a){a===!0&&d.readyWait--;if(!d.readyWait||a!==!0&&!d.isReady){if(!c.body)return setTimeout(d.ready,1);d.isReady=!0;if(a!==!0&&--d.readyWait>0)return;y.resolveWith(c,[d]),d.fn.trigger&&d(c).trigger("ready").unbind("ready")}},bindReady:function(){if(!x){x=!0;if(c.readyState==="complete")return setTimeout(d.ready,1);if(c.addEventListener)c.addEventListener("DOMContentLoaded",A,!1),a.addEventListener("load",d.ready,!1);else if(c.attachEvent){c.attachEvent("onreadystatechange",A),a.attachEvent("onload",d.ready);var b=!1;try{b=a.frameElement==null}catch(e){}c.documentElement.doScroll&&b&&I()}}},isFunction:function(a){return d.type(a)==="function"},isArray:Array.isArray||function(a){return d.type(a)==="array"},isWindow:function(a){return a&&typeof a==="object"&&"setInterval"in a},isNaN:function(a){return a==null||!l.test(a)||isNaN(a)},type:function(a){return a==null?String(a):H[B.call(a)]||"object"},isPlainObject:function(a){if(!a||d.type(a)!=="object"||a.nodeType||d.isWindow(a))return!1;if(a.constructor&&!C.call(a,"constructor")&&!C.call(a.constructor.prototype,"isPrototypeOf"))return!1;var c;for(c in a){}return c===b||C.call(a,c)},isEmptyObject:function(a){for(var b in a)return!1;return!0},error:function(a){throw a},parseJSON:function(b){if(typeof b!=="string"||!b)return null;b=d.trim(b);if(n.test(b.replace(o,"@").replace(p,"]").replace(q,"")))return a.JSON&&a.JSON.parse?a.JSON.parse(b):(new Function("return "+b))();d.error("Invalid JSON: "+b)},parseXML:function(b,c,e){a.DOMParser?(e=new DOMParser,c=e.parseFromString(b,"text/xml")):(c=new ActiveXObject("Microsoft.XMLDOM"),c.async="false",c.loadXML(b)),e=c.documentElement,(!e||!e.nodeName||e.nodeName==="parsererror")&&d.error("Invalid XML: "+b);return c},noop:function(){},globalEval:function(a){if(a&&i.test(a)){var b=c.head||c.getElementsByTagName("head")[0]||c.documentElement,e=c.createElement("script");d.support.scriptEval()?e.appendChild(c.createTextNode(a)):e.text=a,b.insertBefore(e,b.firstChild),b.removeChild(e)}},nodeName:function(a,b){return a.nodeName&&a.nodeName.toUpperCase()===b.toUpperCase()},each:function(a,c,e){var f,g=0,h=a.length,i=h===b||d.isFunction(a);if(e){if(i){for(f in a)if(c.apply(a[f],e)===!1)break}else for(;g<h;)if(c.apply(a[g++],e)===!1)break}else if(i){for(f in a)if(c.call(a[f],f,a[f])===!1)break}else for(var j=a[0];g<h&&c.call(j,g,j)!==!1;j=a[++g]){}return a},trim:F?function(a){return a==null?"":F.call(a)}:function(a){return a==null?"":(a+"").replace(j,"").replace(k,"")},makeArray:function(a,b){var c=b||[];if(a!=null){var e=d.type(a);a.length==null||e==="string"||e==="function"||e==="regexp"||d.isWindow(a)?D.call(c,a):d.merge(c,a)}return c},inArray:function(a,b){if(b.indexOf)return b.indexOf(a);for(var c=0,d=b.length;c<d;c++)if(b[c]===a)return c;return-1},merge:function(a,c){var d=a.length,e=0;if(typeof c.length==="number")for(var f=c.length;e<f;e++)a[d++]=c[e];else while(c[e]!==b)a[d++]=c[e++];a.length=d;return a},grep:function(a,b,c){var d=[],e;c=!!c;for(var f=0,g=a.length;f<g;f++)e=!!b(a[f],f),c!==e&&d.push(a[f]);return d},map:function(a,b,c){var d=[],e;for(var f=0,g=a.length;f<g;f++)e=b(a[f],f,c),e!=null&&(d[d.length]=e);return d.concat.apply([],d)},guid:1,proxy:function(a,c,e){arguments.length===2&&(typeof c==="string"?(e=a,a=e[c],c=b):c&&!d.isFunction(c)&&(e=c,c=b)),!c&&a&&(c=function(){return a.apply(e||this,arguments)}),a&&(c.guid=a.guid=a.guid||c.guid||d.guid++);return c},access:function(a,c,e,f,g,h){var i=a.length;if(typeof c==="object"){for(var j in c)d.access(a,j,c[j],f,g,e);return a}if(e!==b){f=!h&&f&&d.isFunction(e);for(var k=0;k<i;k++)g(a[k],c,f?e.call(a[k],k,g(a[k],c)):e,h);return a}return i?g(a[0],c):b},now:function(){return(new Date).getTime()},_Deferred:function(){var a=[],b,c,e,f={done:function(){if(!e){var c=arguments,g,h,i,j,k;b&&(k=b,b=0);for(g=0,h=c.length;g<h;g++)i=c[g],j=d.type(i),j==="array"?f.done.apply(f,i):j==="function"&&a.push(i);k&&f.resolveWith(k[0],k[1])}return this},resolveWith:function(d,f){if(!e&&!b&&!c){c=1;try{while(a[0])a.shift().apply(d,f)}catch(g){throw g}finally{b=[d,f],c=0}}return this},resolve:function(){f.resolveWith(d.isFunction(this.promise)?this.promise():this,arguments);return this},isResolved:function(){return c||b},cancel:function(){e=1,a=[];return this}};return f},Deferred:function(a){var b=d._Deferred(),c=d._Deferred(),e;d.extend(b,{then:function(a,c){b.done(a).fail(c);return this},fail:c.done,rejectWith:c.resolveWith,reject:c.resolve,isRejected:c.isResolved,promise:function(a){if(a==null){if(e)return e;e=a={}}var c=z.length;while(c--)a[z[c]]=b[z[c]];return a}}),b.done(c.cancel).fail(b.cancel),delete b.cancel,a&&a.call(b,b);return b},when:function(a){var b=arguments.length,c=b<=1&&a&&d.isFunction(a.promise)?a:d.Deferred(),e=c.promise();if(b>1){var f=E.call(arguments,0),g=b,h=function(a){return function(b){f[a]=arguments.length>1?E.call(arguments,0):b,--g||c.resolveWith(e,f)}};while(b--)a=f[b],a&&d.isFunction(a.promise)?a.promise().then(h(b),c.reject):--g;g||c.resolveWith(e,f)}else c!==a&&c.resolve(a);return e},uaMatch:function(a){a=a.toLowerCase();var b=r.exec(a)||s.exec(a)||t.exec(a)||a.indexOf("compatible")<0&&u.exec(a)||[];return{browser:b[1]||"",version:b[2]||"0"}},sub:function(){function a(b,c){return new a.fn.init(b,c)}d.extend(!0,a,this),a.superclass=this,a.fn=a.prototype=this(),a.fn.constructor=a,a.subclass=this.subclass,a.fn.init=function b(b,c){c&&c instanceof d&&!(c instanceof a)&&(c=a(c));return d.fn.init.call(this,b,c,e)},a.fn.init.prototype=a.fn;var e=a(c);return a},browser:{}}),y=d._Deferred(),d.each("Boolean Number String Function Array Date RegExp Object".split(" "),function(a,b){H["[object "+b+"]"]=b.toLowerCase()}),w=d.uaMatch(v),w.browser&&(d.browser[w.browser]=!0,d.browser.version=w.version),d.browser.webkit&&(d.browser.safari=!0),G&&(d.inArray=function(a,b){return G.call(b,a)}),i.test(" ")&&(j=/^[\s\xA0]+/,k=/[\s\xA0]+$/),g=d(c),c.addEventListener?A=function(){c.removeEventListener("DOMContentLoaded",A,!1),d.ready()}:c.attachEvent&&(A=function(){c.readyState==="complete"&&(c.detachEvent("onreadystatechange",A),d.ready())});return d}();(function(){d.support={};var b=c.createElement("div");b.style.display="none",b.innerHTML="   <link/><table></table><a href='/a' style='color:red;float:left;opacity:.55;'>a</a><input type='checkbox'/>";var e=b.getElementsByTagName("*"),f=b.getElementsByTagName("a")[0],g=c.createElement("select"),h=g.appendChild(c.createElement("option")),i=b.getElementsByTagName("input")[0];if(e&&e.length&&f){d.support={leadingWhitespace:b.firstChild.nodeType===3,tbody:!b.getElementsByTagName("tbody").length,htmlSerialize:!!b.getElementsByTagName("link").length,style:/red/.test(f.getAttribute("style")),hrefNormalized:f.getAttribute("href")==="/a",opacity:/^0.55$/.test(f.style.opacity),cssFloat:!!f.style.cssFloat,checkOn:i.value==="on",optSelected:h.selected,deleteExpando:!0,optDisabled:!1,checkClone:!1,noCloneEvent:!0,noCloneChecked:!0,boxModel:null,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableHiddenOffsets:!0},i.checked=!0,d.support.noCloneChecked=i.cloneNode(!0).checked,g.disabled=!0,d.support.optDisabled=!h.disabled;var j=null;d.support.scriptEval=function(){if(j===null){var b=c.documentElement,e=c.createElement("script"),f="script"+d.now();try{e.appendChild(c.createTextNode("window."+f+"=1;"))}catch(g){}b.insertBefore(e,b.firstChild),a[f]?(j=!0,delete a[f]):j=!1,b.removeChild(e),b=e=f=null}return j};try{delete b.test}catch(k){d.support.deleteExpando=!1}!b.addEventListener&&b.attachEvent&&b.fireEvent&&(b.attachEvent("onclick",function l(){d.support.noCloneEvent=!1,b.detachEvent("onclick",l)}),b.cloneNode(!0).fireEvent("onclick")),b=c.createElement("div"),b.innerHTML="<input type='radio' name='radiotest' checked='checked'/>";var m=c.createDocumentFragment();m.appendChild(b.firstChild),d.support.checkClone=m.cloneNode(!0).cloneNode(!0).lastChild.checked,d(function(){var a=c.createElement("div"),b=c.getElementsByTagName("body")[0];if(b){a.style.width=a.style.paddingLeft="1px",b.appendChild(a),d.boxModel=d.support.boxModel=a.offsetWidth===2,"zoom"in a.style&&(a.style.display="inline",a.style.zoom=1,d.support.inlineBlockNeedsLayout=a.offsetWidth===2,a.style.display="",a.innerHTML="<div style='width:4px;'></div>",d.support.shrinkWrapBlocks=a.offsetWidth!==2),a.innerHTML="<table><tr><td style='padding:0;border:0;display:none'></td><td>t</td></tr></table>";var e=a.getElementsByTagName("td");d.support.reliableHiddenOffsets=e[0].offsetHeight===0,e[0].style.display="",e[1].style.display="none",d.support.reliableHiddenOffsets=d.support.reliableHiddenOffsets&&e[0].offsetHeight===0,a.innerHTML="",b.removeChild(a).style.display="none",a=e=null}});var n=function(a){var b=c.createElement("div");a="on"+a;if(!b.attachEvent)return!0;var d=a in b;d||(b.setAttribute(a,"return;"),d=typeof b[a]==="function"),b=null;return d};d.support.submitBubbles=n("submit"),d.support.changeBubbles=n("change"),b=e=f=null}})();var e=/^(?:\{.*\}|\[.*\])$/;d.extend({cache:{},uuid:0,expando:"jQuery"+(d.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(a){a=a.nodeType?d.cache[a[d.expando]]:a[d.expando];return!!a&&!g(a)},data:function(a,c,e,f){if(d.acceptData(a)){var g=d.expando,h=typeof c==="string",i,j=a.nodeType,k=j?d.cache:a,l=j?a[d.expando]:a[d.expando]&&d.expando;if((!l||f&&l&&!k[l][g])&&h&&e===b)return;l||(j?a[d.expando]=l=++d.uuid:l=d.expando),k[l]||(k[l]={},j||(k[l].toJSON=d.noop));if(typeof c==="object"||typeof c==="function")f?k[l][g]=d.extend(k[l][g],c):k[l]=d.extend(k[l],c);i=k[l],f&&(i[g]||(i[g]={}),i=i[g]),e!==b&&(i[c]=e);if(c==="events"&&!i[c])return i[g]&&i[g].events;return h?i[c]:i}},removeData:function(b,c,e){if(d.acceptData(b)){var f=d.expando,h=b.nodeType,i=h?d.cache:b,j=h?b[d.expando]:d.expando;if(!i[j])return;if(c){var k=e?i[j][f]:i[j];if(k){delete k[c];if(!g(k))return}}if(e){delete i[j][f];if(!g(i[j]))return}var l=i[j][f];d.support.deleteExpando||i!=a?delete i[j]:i[j]=null,l?(i[j]={},h||(i[j].toJSON=d.noop),i[j][f]=l):h&&(d.support.deleteExpando?delete b[d.expando]:b.removeAttribute?b.removeAttribute(d.expando):b[d.expando]=null)}},_data:function(a,b,c){return d.data(a,b,c,!0)},acceptData:function(a){if(a.nodeName){var b=d.noData[a.nodeName.toLowerCase()];if(b)return b!==!0&&a.getAttribute("classid")===b}return!0}}),d.fn.extend({data:function(a,c){var e=null;if(typeof a==="undefined"){if(this.length){e=d.data(this[0]);if(this[0].nodeType===1){var g=this[0].attributes,h;for(var i=0,j=g.length;i<j;i++)h=g[i].name,h.indexOf("data-")===0&&(h=h.substr(5),f(this[0],h,e[h]))}}return e}if(typeof a==="object")return this.each(function(){d.data(this,a)});var k=a.split(".");k[1]=k[1]?"."+k[1]:"";if(c===b){e=this.triggerHandler("getData"+k[1]+"!",[k[0]]),e===b&&this.length&&(e=d.data(this[0],a),e=f(this[0],a,e));return e===b&&k[1]?this.data(k[0]):e}return this.each(function(){var b=d(this),e=[k[0],c];b.triggerHandler("setData"+k[1]+"!",e),d.data(this,a,c),b.triggerHandler("changeData"+k[1]+"!",e)})},removeData:function(a){return this.each(function(){d.removeData(this,a)})}}),d.extend({queue:function(a,b,c){if(a){b=(b||"fx")+"queue";var e=d._data(a,b);if(!c)return e||[];!e||d.isArray(c)?e=d._data(a,b,d.makeArray(c)):e.push(c);return e}},dequeue:function(a,b){b=b||"fx";var c=d.queue(a,b),e=c.shift();e==="inprogress"&&(e=c.shift()),e&&(b==="fx"&&c.unshift("inprogress"),e.call(a,function(){d.dequeue(a,b)})),c.length||d.removeData(a,b+"queue",!0)}}),d.fn.extend({queue:function(a,c){typeof a!=="string"&&(c=a,a="fx");if(c===b)return d.queue(this[0],a);return this.each(function(b){var e=d.queue(this,a,c);a==="fx"&&e[0]!=="inprogress"&&d.dequeue(this,a)})},dequeue:function(a){return this.each(function(){d.dequeue(this,a)})},delay:function(a,b){a=d.fx?d.fx.speeds[a]||a:a,b=b||"fx";return this.queue(b,function(){var c=this;setTimeout(function(){d.dequeue(c,b)},a)})},clearQueue:function(a){return this.queue(a||"fx",[])}});var h=/[\n\t\r]/g,i=/\s+/,j=/\r/g,k=/^(?:href|src|style)$/,l=/^(?:button|input)$/i,m=/^(?:button|input|object|select|textarea)$/i,n=/^a(?:rea)?$/i,o=/^(?:radio|checkbox)$/i;d.props={"for":"htmlFor","class":"className",readonly:"readOnly",maxlength:"maxLength",cellspacing:"cellSpacing",rowspan:"rowSpan",colspan:"colSpan",tabindex:"tabIndex",usemap:"useMap",frameborder:"frameBorder"},d.fn.extend({attr:function(a,b){return d.access(this,a,b,!0,d.attr)},removeAttr:function(a,b){return this.each(function(){d.attr(this,a,""),this.nodeType===1&&this.removeAttribute(a)})},addClass:function(a){if(d.isFunction(a))return this.each(function(b){var c=d(this);c.addClass(a.call(this,b,c.attr("class")))});if(a&&typeof a==="string"){var b=(a||"").split(i);for(var c=0,e=this.length;c<e;c++){var f=this[c];if(f.nodeType===1)if(f.className){var g=" "+f.className+" ",h=f.className;for(var j=0,k=b.length;j<k;j++)g.indexOf(" "+b[j]+" ")<0&&(h+=" "+b[j]);f.className=d.trim(h)}else f.className=a}}return this},removeClass:function(a){if(d.isFunction(a))return this.each(function(b){var c=d(this);c.removeClass(a.call(this,b,c.attr("class")))});if(a&&typeof a==="string"||a===b){var c=(a||"").split(i);for(var e=0,f=this.length;e<f;e++){var g=this[e];if(g.nodeType===1&&g.className)if(a){var j=(" "+g.className+" ").replace(h," ");for(var k=0,l=c.length;k<l;k++)j=j.replace(" "+c[k]+" "," ");g.className=d.trim(j)}else g.className=""}}return this},toggleClass:function(a,b){var c=typeof a,e=typeof b==="boolean";if(d.isFunction(a))return this.each(function(c){var e=d(this);e.toggleClass(a.call(this,c,e.attr("class"),b),b)});return this.each(function(){if(c==="string"){var f,g=0,h=d(this),j=b,k=a.split(i);while(f=k[g++])j=e?j:!h.hasClass(f),h[j?"addClass":"removeClass"](f)}else if(c==="undefined"||c==="boolean")this.className&&d._data(this,"__className__",this.className),this.className=this.className||a===!1?"":d._data(this,"__className__")||""})},hasClass:function(a){var b=" "+a+" ";for(var c=0,d=this.length;c<d;c++)if((" "+this[c].className+" ").replace(h," ").indexOf(b)>-1)return!0;return!1},val:function(a){if(!arguments.length){var c=this[0];if(c){if(d.nodeName(c,"option")){var e=c.attributes.value;return!e||e.specified?c.value:c.text}if(d.nodeName(c,"select")){var f=c.selectedIndex,g=[],h=c.options,i=c.type==="select-one";if(f<0)return null;for(var k=i?f:0,l=i?f+1:h.length;k<l;k++){var m=h[k];if(m.selected&&(d.support.optDisabled?!m.disabled:m.getAttribute("disabled")===null)&&(!m.parentNode.disabled||!d.nodeName(m.parentNode,"optgroup"))){a=d(m).val();if(i)return a;g.push(a)}}if(i&&!g.length&&h.length)return d(h[f]).val();return g}if(o.test(c.type)&&!d.support.checkOn)return c.getAttribute("value")===null?"on":c.value;return(c.value||"").replace(j,"")}return b}var n=d.isFunction(a);return this.each(function(b){var c=d(this),e=a;if(this.nodeType===1){n&&(e=a.call(this,b,c.val())),e==null?e="":typeof e==="number"?e+="":d.isArray(e)&&(e=d.map(e,function(a){return a==null?"":a+""}));if(d.isArray(e)&&o.test(this.type))this.checked=d.inArray(c.val(),e)>=0;else if(d.nodeName(this,"select")){var f=d.makeArray(e);d("option",this).each(function(){this.selected=d.inArray(d(this).val(),f)>=0}),f.length||(this.selectedIndex=-1)}else this.value=e}})}}),d.extend({attrFn:{val:!0,css:!0,html:!0,text:!0,data:!0,width:!0,height:!0,offset:!0},attr:function(a,c,e,f){if(!a||a.nodeType===3||a.nodeType===8||a.nodeType===2)return b;if(f&&c in d.attrFn)return d(a)[c](e);var g=a.nodeType!==1||!d.isXMLDoc(a),h=e!==b;c=g&&d.props[c]||c;if(a.nodeType===1){var i=k.test(c);if(c==="selected"&&!d.support.optSelected){var j=a.parentNode;j&&(j.selectedIndex,j.parentNode&&j.parentNode.selectedIndex)}if((c in a||a[c]!==b)&&g&&!i){h&&(c==="type"&&l.test(a.nodeName)&&a.parentNode&&d.error("type property can't be changed"),e===null?a.nodeType===1&&a.removeAttribute(c):a[c]=e);if(d.nodeName(a,"form")&&a.getAttributeNode(c))return a.getAttributeNode(c).nodeValue;if(c==="tabIndex"){var o=a.getAttributeNode("tabIndex");return o&&o.specified?o.value:m.test(a.nodeName)||n.test(a.nodeName)&&a.href?0:b}return a[c]}if(!d.support.style&&g&&c==="style"){h&&(a.style.cssText=""+e);return a.style.cssText}h&&a.setAttribute(c,""+e);if(!a.attributes[c]&&(a.hasAttribute&&!a.hasAttribute(c)))return b;var p=!d.support.hrefNormalized&&g&&i?a.getAttribute(c,2):a.getAttribute(c);return p===null?b:p}h&&(a[c]=e);return a[c]}});var p=/\.(.*)$/,q=/^(?:textarea|input|select)$/i,r=/\./g,s=/ /g,t=/[^\w\s.|`]/g,u=function(a){return a.replace(t,"\\$&")};d.event={add:function(c,e,f,g){if(c.nodeType!==3&&c.nodeType!==8){try{d.isWindow(c)&&(c!==a&&!c.frameElement)&&(c=a)}catch(h){}if(f===!1)f=v;else if(!f)return;var i,j;f.handler&&(i=f,f=i.handler),f.guid||(f.guid=d.guid++);var k=d._data(c);if(!k)return;var l=k.events,m=k.handle;l||(k.events=l={}),m||(k.handle=m=function(){return typeof d!=="undefined"&&!d.event.triggered?d.event.handle.apply(m.elem,arguments):b}),m.elem=c,e=e.split(" ");var n,o=0,p;while(n=e[o++]){j=i?d.extend({},i):{handler:f,data:g},n.indexOf(".")>-1?(p=n.split("."),n=p.shift(),j.namespace=p.slice(0).sort().join(".")):(p=[],j.namespace=""),j.type=n,j.guid||(j.guid=f.guid);var q=l[n],r=d.event.special[n]||{};if(!q){q=l[n]=[];if(!r.setup||r.setup.call(c,g,p,m)===!1)c.addEventListener?c.addEventListener(n,m,!1):c.attachEvent&&c.attachEvent("on"+n,m)}r.add&&(r.add.call(c,j),j.handler.guid||(j.handler.guid=f.guid)),q.push(j),d.event.global[n]=!0}c=null}},global:{},remove:function(a,c,e,f){if(a.nodeType!==3&&a.nodeType!==8){e===!1&&(e=v);var g,h,i,j,k=0,l,m,n,o,p,q,r,s=d.hasData(a)&&d._data(a),t=s&&s.events;if(!s||!t)return;c&&c.type&&(e=c.handler,c=c.type);if(!c||typeof c==="string"&&c.charAt(0)==="."){c=c||"";for(h in t)d.event.remove(a,h+c);return}c=c.split(" ");while(h=c[k++]){r=h,q=null,l=h.indexOf(".")<0,m=[],l||(m=h.split("."),h=m.shift(),n=new RegExp("(^|\\.)"+d.map(m.slice(0).sort(),u).join("\\.(?:.*\\.)?")+"(\\.|$)")),p=t[h];if(!p)continue;if(!e){for(j=0;j<p.length;j++){q=p[j];if(l||n.test(q.namespace))d.event.remove(a,r,q.handler,j),p.splice(j--,1)}continue}o=d.event.special[h]||{};for(j=f||0;j<p.length;j++){q=p[j];if(e.guid===q.guid){if(l||n.test(q.namespace))f==null&&p.splice(j--,1),o.remove&&o.remove.call(a,q);if(f!=null)break}}if(p.length===0||f!=null&&p.length===1)(!o.teardown||o.teardown.call(a,m)===!1)&&d.removeEvent(a,h,s.handle),g=null,delete t[h]}if(d.isEmptyObject(t)){var w=s.handle;w&&(w.elem=null),delete s.events,delete s.handle,d.isEmptyObject(s)&&d.removeData(a,b,!0)}}},trigger:function(a,c,e){var f=a.type||a,g=arguments[3];if(!g){a=typeof a==="object"?a[d.expando]?a:d.extend(d.Event(f),a):d.Event(f),f.indexOf("!")>=0&&(a.type=f=f.slice(0,-1),a.exclusive=!0),e||(a.stopPropagation(),d.event.global[f]&&d.each(d.cache,function(){var b=d.expando,e=this[b];e&&e.events&&e.events[f]&&d.event.trigger(a,c,e.handle.elem)}));if(!e||e.nodeType===3||e.nodeType===8)return b;a.result=b,a.target=e,c=d.makeArray(c),c.unshift(a)}a.currentTarget=e;var h=d._data(e,"handle");h&&h.apply(e,c);var i=e.parentNode||e.ownerDocument;try{e&&e.nodeName&&d.noData[e.nodeName.toLowerCase()]||e["on"+f]&&e["on"+f].apply(e,c)===!1&&(a.result=!1,a.preventDefault())}catch(j){}if(!a.isPropagationStopped()&&i)d.event.trigger(a,c,i,!0);else if(!a.isDefaultPrevented()){var k,l=a.target,m=f.replace(p,""),n=d.nodeName(l,"a")&&m==="click",o=d.event.special[m]||{};if((!o._default||o._default.call(e,a)===!1)&&!n&&!(l&&l.nodeName&&d.noData[l.nodeName.toLowerCase()])){try{l[m]&&(k=l["on"+m],k&&(l["on"+m]=null),d.event.triggered=!0,l[m]())}catch(q){}k&&(l["on"+m]=k),d.event.triggered=!1}}},handle:function(c){var e,f,g,h,i,j=[],k=d.makeArray(arguments);c=k[0]=d.event.fix(c||a.event),c.currentTarget=this,e=c.type.indexOf(".")<0&&!c.exclusive,e||(g=c.type.split("."),c.type=g.shift(),j=g.slice(0).sort(),h=new RegExp("(^|\\.)"+j.join("\\.(?:.*\\.)?")+"(\\.|$)")),c.namespace=c.namespace||j.join("."),i=d._data(this,"events"),f=(i||{})[c.type];if(i&&f){f=f.slice(0);for(var l=0,m=f.length;l<m;l++){var n=f[l];if(e||h.test(n.namespace)){c.handler=n.handler,c.data=n.data,c.handleObj=n;var o=n.handler.apply(this,k);o!==b&&(c.result=o,o===!1&&(c.preventDefault(),c.stopPropagation()));if(c.isImmediatePropagationStopped())break}}}return c.result},props:"altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode layerX layerY metaKey newValue offsetX offsetY pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),fix:function(a){if(a[d.expando])return a;var e=a;a=d.Event(e);for(var f=this.props.length,g;f;)g=this.props[--f],a[g]=e[g];a.target||(a.target=a.srcElement||c),a.target.nodeType===3&&(a.target=a.target.parentNode),!a.relatedTarget&&a.fromElement&&(a.relatedTarget=a.fromElement===a.target?a.toElement:a.fromElement);if(a.pageX==null&&a.clientX!=null){var h=c.documentElement,i=c.body;a.pageX=a.clientX+(h&&h.scrollLeft||i&&i.scrollLeft||0)-(h&&h.clientLeft||i&&i.clientLeft||0),a.pageY=a.clientY+(h&&h.scrollTop||i&&i.scrollTop||0)-(h&&h.clientTop||i&&i.clientTop||0)}a.which==null&&(a.charCode!=null||a.keyCode!=null)&&(a.which=a.charCode!=null?a.charCode:a.keyCode),!a.metaKey&&a.ctrlKey&&(a.metaKey=a.ctrlKey),!a.which&&a.button!==b&&(a.which=a.button&1?1:a.button&2?3:a.button&4?2:0);return a},guid:1e8,proxy:d.proxy,special:{ready:{setup:d.bindReady,teardown:d.noop},live:{add:function(a){d.event.add(this,F(a.origType,a.selector),d.extend({},a,{handler:E,guid:a.handler.guid}))},remove:function(a){d.event.remove(this,F(a.origType,a.selector),a)}},beforeunload:{setup:function(a,b,c){d.isWindow(this)&&(this.onbeforeunload=c)},teardown:function(a,b){this.onbeforeunload===b&&(this.onbeforeunload=null)}}}},d.removeEvent=c.removeEventListener?function(a,b,c){a.removeEventListener&&a.removeEventListener(b,c,!1)}:function(a,b,c){a.detachEvent&&a.detachEvent("on"+b,c)},d.Event=function(a){if(!this.preventDefault)return new d.Event(a);a&&a.type?(this.originalEvent=a,this.type=a.type,this.isDefaultPrevented=a.defaultPrevented||a.returnValue===!1||a.getPreventDefault&&a.getPreventDefault()?w:v):this.type=a,this.timeStamp=d.now(),this[d.expando]=!0},d.Event.prototype={preventDefault:function(){this.isDefaultPrevented=w;var a=this.originalEvent;a&&(a.preventDefault?a.preventDefault():a.returnValue=!1)},stopPropagation:function(){this.isPropagationStopped=w;var a=this.originalEvent;a&&(a.stopPropagation&&a.stopPropagation(),a.cancelBubble=!0)},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=w,this.stopPropagation()},isDefaultPrevented:v,isPropagationStopped:v,isImmediatePropagationStopped:v};var x=function(a){var b=a.relatedTarget;try{if(b!==c&&!b.parentNode)return;while(b&&b!==this)b=b.parentNode;b!==this&&(a.type=a.data,d.event.handle.apply(this,arguments))}catch(e){}},y=function(a){a.type=a.data,d.event.handle.apply(this,arguments)};d.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(a,b){d.event.special[a]={setup:function(c){d.event.add(this,b,c&&c.selector?y:x,a)},teardown:function(a){d.event.remove(this,b,a&&a.selector?y:x)}}}),d.support.submitBubbles||(d.event.special.submit={setup:function(a,b){if(this.nodeName&&this.nodeName.toLowerCase()!=="form")d.event.add(this,"click.specialSubmit",function(a){var b=a.target,c=b.type;(c==="submit"||c==="image")&&d(b).closest("form").length&&C("submit",this,arguments)}),d.event.add(this,"keypress.specialSubmit",function(a){var b=a.target,c=b.type;(c==="text"||c==="password")&&d(b).closest("form").length&&a.keyCode===13&&C("submit",this,arguments)});else return!1},teardown:function(a){d.event.remove(this,".specialSubmit")}});if(!d.support.changeBubbles){var z,A=function(a){var b=a.type,c=a.value;b==="radio"||b==="checkbox"?c=a.checked:b==="select-multiple"?c=a.selectedIndex>-1?d.map(a.options,function(a){return a.selected}).join("-"):"":a.nodeName.toLowerCase()==="select"&&(c=a.selectedIndex);return c},B=function B(a){var c=a.target,e,f;if(q.test(c.nodeName)&&!c.readOnly){e=d._data(c,"_change_data"),f=A(c),(a.type!=="focusout"||c.type!=="radio")&&d._data(c,"_change_data",f);if(e===b||f===e)return;if(e!=null||f)a.type="change",a.liveFired=b,d.event.trigger(a,arguments[1],c)}};d.event.special.change={filters:{focusout:B,beforedeactivate:B,click:function(a){var b=a.target,c=b.type;(c==="radio"||c==="checkbox"||b.nodeName.toLowerCase()==="select")&&B.call(this,a)},keydown:function(a){var b=a.target,c=b.type;(a.keyCode===13&&b.nodeName.toLowerCase()!=="textarea"||a.keyCode===32&&(c==="checkbox"||c==="radio")||c==="select-multiple")&&B.call(this,a)},beforeactivate:function(a){var b=a.target;d._data(b,"_change_data",A(b))}},setup:function(a,b){if(this.type==="file")return!1;for(var c in z)d.event.add(this,c+".specialChange",z[c]);return q.test(this.nodeName)},teardown:function(a){d.event.remove(this,".specialChange");return q.test(this.nodeName)}},z=d.event.special.change.filters,z.focus=z.beforeactivate}c.addEventListener&&d.each({focus:"focusin",blur:"focusout"},function(a,b){function c(a){a=d.event.fix(a),a.type=b;return d.event.handle.call(this,a)}d.event.special[b]={setup:function(){this.addEventListener(a,c,!0)},teardown:function(){this.removeEventListener(a,c,!0)}}}),d.each(["bind","one"],function(a,c){d.fn[c]=function(a,e,f){if(typeof a==="object"){for(var g in a)this[c](g,e,a[g],f);return this}if(d.isFunction(e)||e===!1)f=e,e=b;var h=c==="one"?d.proxy(f,function(a){d(this).unbind(a,h);return f.apply(this,arguments)}):f;if(a==="unload"&&c!=="one")this.one(a,e,f);else for(var i=0,j=this.length;i<j;i++)d.event.add(this[i],a,h,e);return this}}),d.fn.extend({unbind:function(a,b){if(typeof a!=="object"||a.preventDefault)for(var e=0,f=this.length;e<f;e++)d.event.remove(this[e],a,b);else for(var c in a)this.unbind(c,a[c]);return this},delegate:function(a,b,c,d){return this.live(b,c,d,a)},undelegate:function(a,b,c){return arguments.length===0?this.unbind("live"):this.die(b,null,c,a)},trigger:function(a,b){return this.each(function(){d.event.trigger(a,b,this)})},triggerHandler:function(a,b){if(this[0]){var c=d.Event(a);c.preventDefault(),c.stopPropagation(),d.event.trigger(c,b,this[0]);return c.result}},toggle:function(a){var b=arguments,c=1;while(c<b.length)d.proxy(a,b[c++]);return this.click(d.proxy(a,function(e){var f=(d._data(this,"lastToggle"+a.guid)||0)%c;d._data(this,"lastToggle"+a.guid,f+1),e.preventDefault();return b[f].apply(this,arguments)||!1}))},hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)}});var D={focus:"focusin",blur:"focusout",mouseenter:"mouseover",mouseleave:"mouseout"};d.each(["live","die"],function(a,c){d.fn[c]=function(a,e,f,g){var h,i=0,j,k,l,m=g||this.selector,n=g?this:d(this.context);if(typeof a==="object"&&!a.preventDefault){for(var o in a)n[c](o,e,a[o],m);return this}d.isFunction(e)&&(f=e,e=b),a=(a||"").split(" ");while((h=a[i++])!=null){j=p.exec(h),k="",j&&(k=j[0],h=h.replace(p,""));if(h==="hover"){a.push("mouseenter"+k,"mouseleave"+k);continue}l=h,h==="focus"||h==="blur"?(a.push(D[h]+k),h=h+k):h=(D[h]||h)+k;if(c==="live")for(var q=0,r=n.length;q<r;q++)d.event.add(n[q],"live."+F(h,m),{data:e,selector:m,handler:f,origType:h,origHandler:f,preType:l});else n.unbind("live."+F(h,m),f)}return this}}),d.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error".split(" "),function(a,b){d.fn[b]=function(a,c){c==null&&(c=a,a=null);return arguments.length>0?this.bind(b,a,c):this.trigger(b)},d.attrFn&&(d.attrFn[b]=!0)}),function(){function u(a,b,c,d,e,f){for(var g=0,h=d.length;g<h;g++){var i=d[g];if(i){var j=!1;i=i[a];while(i){if(i.sizcache===c){j=d[i.sizset];break}if(i.nodeType===1){f||(i.sizcache=c,i.sizset=g);if(typeof b!=="string"){if(i===b){j=!0;break}}else if(k.filter(b,[i]).length>0){j=i;break}}i=i[a]}d[g]=j}}}function t(a,b,c,d,e,f){for(var g=0,h=d.length;g<h;g++){var i=d[g];if(i){var j=!1;i=i[a];while(i){if(i.sizcache===c){j=d[i.sizset];break}i.nodeType===1&&!f&&(i.sizcache=c,i.sizset=g);if(i.nodeName.toLowerCase()===b){j=i;break}i=i[a]}d[g]=j}}}var a=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,e=0,f=Object.prototype.toString,g=!1,h=!0,i=/\\/g,j=/\W/;[0,0].sort(function(){h=!1;return 0});var k=function(b,d,e,g){e=e||[],d=d||c;var h=d;if(d.nodeType!==1&&d.nodeType!==9)return[];if(!b||typeof b!=="string")return e;var i,j,n,o,q,r,s,t,u=!0,w=k.isXML(d),x=[],y=b;do{a.exec(""),i=a.exec(y);if(i){y=i[3],x.push(i[1]);if(i[2]){o=i[3];break}}}while(i);if(x.length>1&&m.exec(b))if(x.length===2&&l.relative[x[0]])j=v(x[0]+x[1],d);else{j=l.relative[x[0]]?[d]:k(x.shift(),d);while(x.length)b=x.shift(),l.relative[b]&&(b+=x.shift()),j=v(b,j)}else{!g&&x.length>1&&d.nodeType===9&&!w&&l.match.ID.test(x[0])&&!l.match.ID.test(x[x.length-1])&&(q=k.find(x.shift(),d,w),d=q.expr?k.filter(q.expr,q.set)[0]:q.set[0]);if(d){q=g?{expr:x.pop(),set:p(g)}:k.find(x.pop(),x.length===1&&(x[0]==="~"||x[0]==="+")&&d.parentNode?d.parentNode:d,w),j=q.expr?k.filter(q.expr,q.set):q.set,x.length>0?n=p(j):u=!1;while(x.length)r=x.pop(),s=r,l.relative[r]?s=x.pop():r="",s==null&&(s=d),l.relative[r](n,s,w)}else n=x=[]}n||(n=j),n||k.error(r||b);if(f.call(n)==="[object Array]")if(u)if(d&&d.nodeType===1)for(t=0;n[t]!=null;t++)n[t]&&(n[t]===!0||n[t].nodeType===1&&k.contains(d,n[t]))&&e.push(j[t]);else for(t=0;n[t]!=null;t++)n[t]&&n[t].nodeType===1&&e.push(j[t]);else e.push.apply(e,n);else p(n,e);o&&(k(o,h,e,g),k.uniqueSort(e));return e};k.uniqueSort=function(a){if(r){g=h,a.sort(r);if(g)for(var b=1;b<a.length;b++)a[b]===a[b-1]&&a.splice(b--,1)}return a},k.matches=function(a,b){return k(a,null,null,b)},k.matchesSelector=function(a,b){return k(b,null,null,[a]).length>0},k.find=function(a,b,c){var d;if(!a)return[];for(var e=0,f=l.order.length;e<f;e++){var g,h=l.order[e];if(g=l.leftMatch[h].exec(a)){var j=g[1];g.splice(1,1);if(j.substr(j.length-1)!=="\\"){g[1]=(g[1]||"").replace(i,""),d=l.find[h](g,b,c);if(d!=null){a=a.replace(l.match[h],"");break}}}}d||(d=typeof b.getElementsByTagName!=="undefined"?b.getElementsByTagName("*"):[]);return{set:d,expr:a}},k.filter=function(a,c,d,e){var f,g,h=a,i=[],j=c,m=c&&c[0]&&k.isXML(c[0]);while(a&&c.length){for(var n in l.filter)if((f=l.leftMatch[n].exec(a))!=null&&f[2]){var o,p,q=l.filter[n],r=f[1];g=!1,f.splice(1,1);if(r.substr(r.length-1)==="\\")continue;j===i&&(i=[]);if(l.preFilter[n]){f=l.preFilter[n](f,j,d,i,e,m);if(f){if(f===!0)continue}else g=o=!0}if(f)for(var s=0;(p=j[s])!=null;s++)if(p){o=q(p,f,s,j);var t=e^!!o;d&&o!=null?t?g=!0:j[s]=!1:t&&(i.push(p),g=!0)}if(o!==b){d||(j=i),a=a.replace(l.match[n],"");if(!g)return[];break}}if(a===h)if(g==null)k.error(a);else break;h=a}return j},k.error=function(a){throw"Syntax error, unrecognized expression: "+a};var l=k.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF\-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF\-]|\\.)+)\s*(?:(\S?=)\s*(?:(['"])(.*?)\3|(#?(?:[\w\u00c0-\uFFFF\-]|\\.)*)|)|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*\-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\(\s*(even|odd|(?:[+\-]?\d+|(?:[+\-]?\d*)?n\s*(?:[+\-]\s*\d+)?))\s*\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/},leftMatch:{},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(a){return a.getAttribute("href")},type:function(a){return a.getAttribute("type")}},relative:{"+":function(a,b){var c=typeof b==="string",d=c&&!j.test(b),e=c&&!d;d&&(b=b.toLowerCase());for(var f=0,g=a.length,h;f<g;f++)if(h=a[f]){while((h=h.previousSibling)&&h.nodeType!==1){}a[f]=e||h&&h.nodeName.toLowerCase()===b?h||!1:h===b}e&&k.filter(b,a,!0)},">":function(a,b){var c,d=typeof b==="string",e=0,f=a.length;if(d&&!j.test(b)){b=b.toLowerCase();for(;e<f;e++){c=a[e];if(c){var g=c.parentNode;a[e]=g.nodeName.toLowerCase()===b?g:!1}}}else{for(;e<f;e++)c=a[e],c&&(a[e]=d?c.parentNode:c.parentNode===b);d&&k.filter(b,a,!0)}},"":function(a,b,c){var d,f=e++,g=u;typeof b==="string"&&!j.test(b)&&(b=b.toLowerCase(),d=b,g=t),g("parentNode",b,f,a,d,c)},"~":function(a,b,c){var d,f=e++,g=u;typeof b==="string"&&!j.test(b)&&(b=b.toLowerCase(),d=b,g=t),g("previousSibling",b,f,a,d,c)}},find:{ID:function(a,b,c){if(typeof b.getElementById!=="undefined"&&!c){var d=b.getElementById(a[1]);return d&&d.parentNode?[d]:[]}},NAME:function(a,b){if(typeof b.getElementsByName!=="undefined"){var c=[],d=b.getElementsByName(a[1]);for(var e=0,f=d.length;e<f;e++)d[e].getAttribute("name")===a[1]&&c.push(d[e]);return c.length===0?null:c}},TAG:function(a,b){if(typeof b.getElementsByTagName!=="undefined")return b.getElementsByTagName(a[1])}},preFilter:{CLASS:function(a,b,c,d,e,f){a=" "+a[1].replace(i,"")+" ";if(f)return a;for(var g=0,h;(h=b[g])!=null;g++)h&&(e^(h.className&&(" "+h.className+" ").replace(/[\t\n\r]/g," ").indexOf(a)>=0)?c||d.push(h):c&&(b[g]=!1));return!1},ID:function(a){return a[1].replace(i,"")},TAG:function(a,b){return a[1].replace(i,"").toLowerCase()},CHILD:function(a){if(a[1]==="nth"){a[2]||k.error(a[0]),a[2]=a[2].replace(/^\+|\s*/g,"");var b=/(-?)(\d*)(?:n([+\-]?\d*))?/.exec(a[2]==="even"&&"2n"||a[2]==="odd"&&"2n+1"||!/\D/.test(a[2])&&"0n+"+a[2]||a[2]);a[2]=b[1]+(b[2]||1)-0,a[3]=b[3]-0}else a[2]&&k.error(a[0]);a[0]=e++;return a},ATTR:function(a,b,c,d,e,f){var g=a[1]=a[1].replace(i,"");!f&&l.attrMap[g]&&(a[1]=l.attrMap[g]),a[4]=(a[4]||a[5]||"").replace(i,""),a[2]==="~="&&(a[4]=" "+a[4]+" ");return a},PSEUDO:function(b,c,d,e,f){if(b[1]==="not")if((a.exec(b[3])||"").length>1||/^\w/.test(b[3]))b[3]=k(b[3],null,null,c);else{var g=k.filter(b[3],c,d,!0^f);d||e.push.apply(e,g);return!1}else if(l.match.POS.test(b[0])||l.match.CHILD.test(b[0]))return!0;return b},POS:function(a){a.unshift(!0);return a}},filters:{enabled:function(a){return a.disabled===!1&&a.type!=="hidden"},disabled:function(a){return a.disabled===!0},checked:function(a){return a.checked===!0},selected:function(a){a.parentNode&&a.parentNode.selectedIndex;return a.selected===!0},parent:function(a){return!!a.firstChild},empty:function(a){return!a.firstChild},has:function(a,b,c){return!!k(c[3],a).length},header:function(a){return/h\d/i.test(a.nodeName)},text:function(a){return"text"===a.getAttribute("type")},radio:function(a){return"radio"===a.type},checkbox:function(a){return"checkbox"===a.type},file:function(a){return"file"===a.type},password:function(a){return"password"===a.type},submit:function(a){return"submit"===a.type},image:function(a){return"image"===a.type},reset:function(a){return"reset"===a.type},button:function(a){return"button"===a.type||a.nodeName.toLowerCase()==="button"},input:function(a){return/input|select|textarea|button/i.test(a.nodeName)}},setFilters:{first:function(a,b){return b===0},last:function(a,b,c,d){return b===d.length-1},even:function(a,b){return b%2===0},odd:function(a,b){return b%2===1},lt:function(a,b,c){return b<c[3]-0},gt:function(a,b,c){return b>c[3]-0},nth:function(a,b,c){return c[3]-0===b},eq:function(a,b,c){return c[3]-0===b}},filter:{PSEUDO:function(a,b,c,d){var e=b[1],f=l.filters[e];if(f)return f(a,c,b,d);if(e==="contains")return(a.textContent||a.innerText||k.getText([a])||"").indexOf(b[3])>=0;if(e==="not"){var g=b[3];for(var h=0,i=g.length;h<i;h++)if(g[h]===a)return!1;return!0}k.error(e)},CHILD:function(a,b){var c=b[1],d=a;switch(c){case"only":case"first":while(d=d.previousSibling)if(d.nodeType===1)return!1;if(c==="first")return!0;d=a;case"last":while(d=d.nextSibling)if(d.nodeType===1)return!1;return!0;case"nth":var e=b[2],f=b[3];if(e===1&&f===0)return!0;var g=b[0],h=a.parentNode;if(h&&(h.sizcache!==g||!a.nodeIndex)){var i=0;for(d=h.firstChild;d;d=d.nextSibling)d.nodeType===1&&(d.nodeIndex=++i);h.sizcache=g}var j=a.nodeIndex-f;return e===0?j===0:j%e===0&&j/e>=0}},ID:function(a,b){return a.nodeType===1&&a.getAttribute("id")===b},TAG:function(a,b){return b==="*"&&a.nodeType===1||a.nodeName.toLowerCase()===b},CLASS:function(a,b){return(" "+(a.className||a.getAttribute("class"))+" ").indexOf(b)>-1},ATTR:function(a,b){var c=b[1],d=l.attrHandle[c]?l.attrHandle[c](a):a[c]!=null?a[c]:a.getAttribute(c),e=d+"",f=b[2],g=b[4];return d==null?f==="!=":f==="="?e===g:f==="*="?e.indexOf(g)>=0:f==="~="?(" "+e+" ").indexOf(g)>=0:g?f==="!="?e!==g:f==="^="?e.indexOf(g)===0:f==="$="?e.substr(e.length-g.length)===g:f==="|="?e===g||e.substr(0,g.length+1)===g+"-":!1:e&&d!==!1},POS:function(a,b,c,d){var e=b[2],f=l.setFilters[e];if(f)return f(a,c,b,d)}}},m=l.match.POS,n=function(a,b){return"\\"+(b-0+1)};for(var o in l.match)l.match[o]=new RegExp(l.match[o].source+/(?![^\[]*\])(?![^\(]*\))/.source),l.leftMatch[o]=new RegExp(/(^(?:.|\r|\n)*?)/.source+l.match[o].source.replace(/\\(\d+)/g,n));var p=function(a,b){a=Array.prototype.slice.call(a,0);if(b){b.push.apply(b,a);return b}return a};try{Array.prototype.slice.call(c.documentElement.childNodes,0)[0].nodeType}catch(q){p=function(a,b){var c=0,d=b||[];if(f.call(a)==="[object Array]")Array.prototype.push.apply(d,a);else if(typeof a.length==="number")for(var e=a.length;c<e;c++)d.push(a[c]);else for(;a[c];c++)d.push(a[c]);return d}}var r,s;c.documentElement.compareDocumentPosition?r=function(a,b){if(a===b){g=!0;return 0}if(!a.compareDocumentPosition||!b.compareDocumentPosition)return a.compareDocumentPosition?-1:1;return a.compareDocumentPosition(b)&4?-1:1}:(r=function(a,b){var c,d,e=[],f=[],h=a.parentNode,i=b.parentNode,j=h;if(a===b){g=!0;return 0}if(h===i)return s(a,b);if(!h)return-1;if(!i)return 1;while(j)e.unshift(j),j=j.parentNode;j=i;while(j)f.unshift(j),j=j.parentNode;c=e.length,d=f.length;for(var k=0;k<c&&k<d;k++)if(e[k]!==f[k])return s(e[k],f[k]);return k===c?s(a,f[k],-1):s(e[k],b,1)},s=function(a,b,c){if(a===b)return c;var d=a.nextSibling;while(d){if(d===b)return-1;d=d.nextSibling}return 1}),k.getText=function(a){var b="",c;for(var d=0;a[d];d++)c=a[d],c.nodeType===3||c.nodeType===4?b+=c.nodeValue:c.nodeType!==8&&(b+=k.getText(c.childNodes));return b},function(){var a=c.createElement("div"),d="script"+(new Date).getTime(),e=c.documentElement;a.innerHTML="<a name='"+d+"'/>",e.insertBefore(a,e.firstChild),c.getElementById(d)&&(l.find.ID=function(a,c,d){if(typeof c.getElementById!=="undefined"&&!d){var e=c.getElementById(a[1]);return e?e.id===a[1]||typeof e.getAttributeNode!=="undefined"&&e.getAttributeNode("id").nodeValue===a[1]?[e]:b:[]}},l.filter.ID=function(a,b){var c=typeof a.getAttributeNode!=="undefined"&&a.getAttributeNode("id");return a.nodeType===1&&c&&c.nodeValue===b}),e.removeChild(a),e=a=null}(),function(){var a=c.createElement("div");a.appendChild(c.createComment("")),a.getElementsByTagName("*").length>0&&(l.find.TAG=function(a,b){var c=b.getElementsByTagName(a[1]);if(a[1]==="*"){var d=[];for(var e=0;c[e];e++)c[e].nodeType===1&&d.push(c[e]);c=d}return c}),a.innerHTML="<a href='#'></a>",a.firstChild&&typeof a.firstChild.getAttribute!=="undefined"&&a.firstChild.getAttribute("href")!=="#"&&(l.attrHandle.href=function(a){return a.getAttribute("href",2)}),a=null}(),c.querySelectorAll&&function(){var a=k,b=c.createElement("div"),d="__sizzle__";b.innerHTML="<p class='TEST'></p>";if(!b.querySelectorAll||b.querySelectorAll(".TEST").length!==0){k=function(b,e,f,g){e=e||c;if(!g&&!k.isXML(e)){var h=/^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec(b);if(h&&(e.nodeType===1||e.nodeType===9)){if(h[1])return p(e.getElementsByTagName(b),f);if(h[2]&&l.find.CLASS&&e.getElementsByClassName)return p(e.getElementsByClassName(h[2]),f)}if(e.nodeType===9){if(b==="body"&&e.body)return p([e.body],f);if(h&&h[3]){var i=e.getElementById(h[3]);if(!i||!i.parentNode)return p([],f);if(i.id===h[3])return p([i],f)}try{return p(e.querySelectorAll(b),f)}catch(j){}}else if(e.nodeType===1&&e.nodeName.toLowerCase()!=="object"){var m=e,n=e.getAttribute("id"),o=n||d,q=e.parentNode,r=/^\s*[+~]/.test(b);n?o=o.replace(/'/g,"\\$&"):e.setAttribute("id",o),r&&q&&(e=e.parentNode);try{if(!r||q)return p(e.querySelectorAll("[id='"+o+"'] "+b),f)}catch(s){}finally{n||m.removeAttribute("id")}}}return a(b,e,f,g)};for(var e in a)k[e]=a[e];b=null}}(),function(){var a=c.documentElement,b=a.matchesSelector||a.mozMatchesSelector||a.webkitMatchesSelector||a.msMatchesSelector,d=!1;try{b.call(c.documentElement,"[test!='']:sizzle")}catch(e){d=!0}b&&(k.matchesSelector=function(a,c){c=c.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!k.isXML(a))try{if(d||!l.match.PSEUDO.test(c)&&!/!=/.test(c))return b.call(a,c)}catch(e){}return k(c,null,null,[a]).length>0})}(),function(){var a=c.createElement("div");a.innerHTML="<div class='test e'></div><div class='test'></div>";if(a.getElementsByClassName&&a.getElementsByClassName("e").length!==0){a.lastChild.className="e";if(a.getElementsByClassName("e").length===1)return;l.order.splice(1,0,"CLASS"),l.find.CLASS=function(a,b,c){if(typeof b.getElementsByClassName!=="undefined"&&!c)return b.getElementsByClassName(a[1])},a=null}}(),c.documentElement.contains?k.contains=function(a,b){return a!==b&&(a.contains?a.contains(b):!0)}:c.documentElement.compareDocumentPosition?k.contains=function(a,b){return!!(a.compareDocumentPosition(b)&16)}:k.contains=function(){return!1},k.isXML=function(a){var b=(a?a.ownerDocument||a:0).documentElement;return b?b.nodeName!=="HTML":!1};var v=function(a,b){var c,d=[],e="",f=b.nodeType?[b]:b;while(c=l.match.PSEUDO.exec(a))e+=c[0],a=a.replace(l.match.PSEUDO,"");a=l.relative[a]?a+"*":a;for(var g=0,h=f.length;g<h;g++)k(a,f[g],d);return k.filter(e,d)};d.find=k,d.expr=k.selectors,d.expr[":"]=d.expr.filters,d.unique=k.uniqueSort,d.text=k.getText,d.isXMLDoc=k.isXML,d.contains=k.contains}();var G=/Until$/,H=/^(?:parents|prevUntil|prevAll)/,I=/,/,J=/^.[^:#\[\.,]*$/,K=Array.prototype.slice,L=d.expr.match.POS,M={children:!0,contents:!0,next:!0,prev:!0};d.fn.extend({find:function(a){var b=this.pushStack("","find",a),c=0;for(var e=0,f=this.length;e<f;e++){c=b.length,d.find(a,this[e],b);if(e>0)for(var g=c;g<b.length;g++)for(var h=0;h<c;h++)if(b[h]===b[g]){b.splice(g--,1);break}}return b},has:function(a){var b=d(a);return this.filter(function(){for(var a=0,c=b.length;a<c;a++)if(d.contains(this,b[a]))return!0})},not:function(a){return this.pushStack(O(this,a,!1),"not",a)},filter:function(a){return this.pushStack(O(this,a,!0),"filter",a)},is:function(a){return!!a&&d.filter(a,this).length>0},closest:function(a,b){var c=[],e,f,g=this[0];if(d.isArray(a)){var h,i,j={},k=1;if(g&&a.length){for(e=0,f=a.length;e<f;e++)i=a[e],j[i]||(j[i]=d.expr.match.POS.test(i)?d(i,b||this.context):i);while(g&&g.ownerDocument&&g!==b){for(i in j)h=j[i],(h.jquery?h.index(g)>-1:d(g).is(h))&&c.push({selector:i,elem:g,level:k});g=g.parentNode,k++}}return c}var l=L.test(a)?d(a,b||this.context):null;for(e=0,f=this.length;e<f;e++){g=this[e];while(g){if(l?l.index(g)>-1:d.find.matchesSelector(g,a)){c.push(g);break}g=g.parentNode;if(!g||!g.ownerDocument||g===b)break}}c=c.length>1?d.unique(c):c;return this.pushStack(c,"closest",a)},index:function(a){if(!a||typeof a==="string")return d.inArray(this[0],a?d(a):this.parent().children());return d.inArray(a.jquery?a[0]:a,this)},add:function(a,b){var c=typeof a==="string"?d(a,b):d.makeArray(a),e=d.merge(this.get(),c);return this.pushStack(N(c[0])||N(e[0])?e:d.unique(e))},andSelf:function(){return this.add(this.prevObject)}}),d.each({parent:function(a){var b=a.parentNode;return b&&b.nodeType!==11?b:null},parents:function(a){return d.dir(a,"parentNode")},parentsUntil:function(a,b,c){return d.dir(a,"parentNode",c)},next:function(a){return d.nth(a,2,"nextSibling")},prev:function(a){return d.nth(a,2,"previousSibling")},nextAll:function(a){return d.dir(a,"nextSibling")},prevAll:function(a){return d.dir(a,"previousSibling")},nextUntil:function(a,b,c){return d.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return d.dir(a,"previousSibling",c)},siblings:function(a){return d.sibling(a.parentNode.firstChild,a)},children:function(a){return d.sibling(a.firstChild)},contents:function(a){return d.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:d.makeArray(a.childNodes)}},function(a,b){d.fn[a]=function(c,e){var f=d.map(this,b,c),g=K.call(arguments);G.test(a)||(e=c),e&&typeof e==="string"&&(f=d.filter(e,f)),f=this.length>1&&!M[a]?d.unique(f):f,(this.length>1||I.test(e))&&H.test(a)&&(f=f.reverse());return this.pushStack(f,a,g.join(","))}}),d.extend({filter:function(a,b,c){c&&(a=":not("+a+")");return b.length===1?d.find.matchesSelector(b[0],a)?[b[0]]:[]:d.find.matches(a,b)},dir:function(a,c,e){var f=[],g=a[c];while(g&&g.nodeType!==9&&(e===b||g.nodeType!==1||!d(g).is(e)))g.nodeType===1&&f.push(g),g=g[c];return f},nth:function(a,b,c,d){b=b||1;var e=0;for(;a;a=a[c])if(a.nodeType===1&&++e===b)break;return a},sibling:function(a,b){var c=[];for(;a;a=a.nextSibling)a.nodeType===1&&a!==b&&c.push(a);return c}});var P=/ jQuery\d+="(?:\d+|null)"/g,Q=/^\s+/,R=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,S=/<([\w:]+)/,T=/<tbody/i,U=/<|&#?\w+;/,V=/<(?:script|object|embed|option|style)/i,W=/checked\s*(?:[^=]|=\s*.checked.)/i,X={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],area:[1,"<map>","</map>"],_default:[0,"",""]};X.optgroup=X.option,X.tbody=X.tfoot=X.colgroup=X.caption=X.thead,X.th=X.td,d.support.htmlSerialize||(X._default=[1,"div<div>","</div>"]),d.fn.extend({text:function(a){if(d.isFunction(a))return this.each(function(b){var c=d(this);c.text(a.call(this,b,c.text()))});if(typeof a!=="object"&&a!==b)return this.empty().append((this[0]&&this[0].ownerDocument||c).createTextNode(a));return d.text(this)},wrapAll:function(a){if(d.isFunction(a))return this.each(function(b){d(this).wrapAll(a.call(this,b))});if(this[0]){var b=d(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstChild&&a.firstChild.nodeType===1)a=a.firstChild;return a}).append(this)}return this},wrapInner:function(a){if(d.isFunction(a))return this.each(function(b){d(this).wrapInner(a.call(this,b))});return this.each(function(){var b=d(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){return this.each(function(){d(this).wrapAll(a)})},unwrap:function(){return this.parent().each(function(){d.nodeName(this,"body")||d(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.appendChild(a)})},prepend:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this)});if(arguments.length){var a=d(arguments[0]);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this.nextSibling)});if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,d(arguments[0]).toArray());return a}},remove:function(a,b){for(var c=0,e;(e=this[c])!=null;c++)if(!a||d.filter(a,[e]).length)!b&&e.nodeType===1&&(d.cleanData(e.getElementsByTagName("*")),d.cleanData([e])),e.parentNode&&e.parentNode.removeChild(e);return this},empty:function(){for(var a=0,b;(b=this[a])!=null;a++){b.nodeType===1&&d.cleanData(b.getElementsByTagName("*"));while(b.firstChild)b.removeChild(b.firstChild)}return this},clone:function(a,b){a=a==null?!1:a,b=b==null?a:b;return this.map(function(){return d.clone(this,a,b)})},html:function(a){if(a===b)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(P,""):null;if(typeof a!=="string"||V.test(a)||!d.support.leadingWhitespace&&Q.test(a)||X[(S.exec(a)||["",""])[1].toLowerCase()])d.isFunction(a)?this.each(function(b){var c=d(this);c.html(a.call(this,b,c.html()))}):this.empty().append(a);else{a=a.replace(R,"<$1></$2>");try{for(var c=0,e=this.length;c<e;c++)this[c].nodeType===1&&(d.cleanData(this[c].getElementsByTagName("*")),this[c].innerHTML=a)}catch(f){this.empty().append(a)}}return this},replaceWith:function(a){if(this[0]&&this[0].parentNode){if(d.isFunction(a))return this.each(function(b){var c=d(this),e=c.html();c.replaceWith(a.call(this,b,e))});typeof a!=="string"&&(a=d(a).detach());return this.each(function(){var b=this.nextSibling,c=this.parentNode;d(this).remove(),b?d(b).before(a):d(c).append(a)})}return this.pushStack(d(d.isFunction(a)?a():a),"replaceWith",a)},detach:function(a){return this.remove(a,!0)},domManip:function(a,c,e){var f,g,h,i,j=a[0],k=[];if(!d.support.checkClone&&arguments.length===3&&typeof j==="string"&&W.test(j))return this.each(function(){d(this).domManip(a,c,e,!0)});if(d.isFunction(j))return this.each(function(f){var g=d(this);a[0]=j.call(this,f,c?g.html():b),g.domManip(a,c,e)});if(this[0]){i=j&&j.parentNode,d.support.parentNode&&i&&i.nodeType===11&&i.childNodes.length===this.length?f={fragment:i}:f=d.buildFragment(a,this,k),h=f.fragment,h.childNodes.length===1?g=h=h.firstChild:g=h.firstChild;if(g){c=c&&d.nodeName(g,"tr");for(var l=0,m=this.length,n=m-1;l<m;l++)e.call(c?Y(this[l],g):this[l],f.cacheable||m>1&&l<n?d.clone(h,!0,!0):h)}k.length&&d.each(k,ba)}return this}}),d.buildFragment=function(a,b,e){var f,g,h,i=b&&b[0]?b[0].ownerDocument||b[0]:c;a.length===1&&typeof a[0]==="string"&&a[0].length<512&&i===c&&a[0].charAt(0)==="<"&&!V.test(a[0])&&(d.support.checkClone||!W.test(a[0]))&&(g=!0,h=d.fragments[a[0]],h&&(h!==1&&(f=h))),f||(f=i.createDocumentFragment(),d.clean(a,i,f,e)),g&&(d.fragments[a[0]]=h?f:1);return{fragment:f,cacheable:g}},d.fragments={},d.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){d.fn[a]=function(c){var e=[],f=d(c),g=this.length===1&&this[0].parentNode;if(g&&g.nodeType===11&&g.childNodes.length===1&&f.length===1){f[b](this[0]);return this}for(var h=0,i=f.length;h<i;h++){var j=(h>0?this.clone(!0):this).get();d(f[h])[b](j),e=e.concat(j)}return this.pushStack(e,a,f.selector)}}),d.extend({clone:function(a,b,c){var e=a.cloneNode(!0),f,g,h;if((!d.support.noCloneEvent||!d.support.noCloneChecked)&&(a.nodeType===1||a.nodeType===11)&&!d.isXMLDoc(a)){$(a,e),f=_(a),g=_(e);for(h=0;f[h];++h)$(f[h],g[h])}if(b){Z(a,e);if(c){f=_(a),g=_(e);for(h=0;f[h];++h)Z(f[h],g[h])}}return e},clean:function(a,b,e,f){b=b||c,typeof b.createElement==="undefined"&&(b=b.ownerDocument||b[0]&&b[0].ownerDocument||c);var g=[];for(var h=0,i;(i=a[h])!=null;h++){typeof i==="number"&&(i+="");if(!i)continue;if(typeof i!=="string"||U.test(i)){if(typeof i==="string"){i=i.replace(R,"<$1></$2>");var j=(S.exec(i)||["",""])[1].toLowerCase(),k=X[j]||X._default,l=k[0],m=b.createElement("div");m.innerHTML=k[1]+i+k[2];while(l--)m=m.lastChild;if(!d.support.tbody){var n=T.test(i),o=j==="table"&&!n?m.firstChild&&m.firstChild.childNodes:k[1]==="<table>"&&!n?m.childNodes:[];for(var p=o.length-1;p>=0;--p)d.nodeName(o[p],"tbody")&&!o[p].childNodes.length&&o[p].parentNode.removeChild(o[p])}!d.support.leadingWhitespace&&Q.test(i)&&m.insertBefore(b.createTextNode(Q.exec(i)[0]),m.firstChild),i=m.childNodes}}else i=b.createTextNode(i);i.nodeType?g.push(i):g=d.merge(g,i)}if(e)for(h=0;g[h];h++)!f||!d.nodeName(g[h],"script")||g[h].type&&g[h].type.toLowerCase()!=="text/javascript"?(g[h].nodeType===1&&g.splice.apply(g,[h+1,0].concat(d.makeArray(g[h].getElementsByTagName("script")))),e.appendChild(g[h])):f.push(g[h].parentNode?g[h].parentNode.removeChild(g[h]):g[h]);return g},cleanData:function(a){var b,c,e=d.cache,f=d.expando,g=d.event.special,h=d.support.deleteExpando;for(var i=0,j;(j=a[i])!=null;i++){if(j.nodeName&&d.noData[j.nodeName.toLowerCase()])continue;c=j[d.expando];if(c){b=e[c]&&e[c][f];if(b&&b.events){for(var k in b.events)g[k]?d.event.remove(j,k):d.removeEvent(j,k,b.handle);b.handle&&(b.handle.elem=null)}h?delete j[d.expando]:j.removeAttribute&&j.removeAttribute(d.expando),delete e[c]}}}});var bb=/alpha\([^)]*\)/i,bc=/opacity=([^)]*)/,bd=/-([a-z])/ig,be=/([A-Z])/g,bf=/^-?\d+(?:px)?$/i,bg=/^-?\d/,bh={position:"absolute",visibility:"hidden",display:"block"},bi=["Left","Right"],bj=["Top","Bottom"],bk,bl,bm,bn=function(a,b){return b.toUpperCase()};d.fn.css=function(a,c){if(arguments.length===2&&c===b)return this;return d.access(this,a,c,!0,function(a,c,e){return e!==b?d.style(a,c,e):d.css(a,c)})},d.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=bk(a,"opacity","opacity");return c===""?"1":c}return a.style.opacity}}},cssNumber:{zIndex:!0,fontWeight:!0,opacity:!0,zoom:!0,lineHeight:!0},cssProps:{"float":d.support.cssFloat?"cssFloat":"styleFloat"},style:function(a,c,e,f){if(a&&a.nodeType!==3&&a.nodeType!==8&&a.style){var g,h=d.camelCase(c),i=a.style,j=d.cssHooks[h];c=d.cssProps[h]||h;if(e===b){if(j&&"get"in j&&(g=j.get(a,!1,f))!==b)return g;return i[c]}if(typeof e==="number"&&isNaN(e)||e==null)return;typeof e==="number"&&!d.cssNumber[h]&&(e+="px");if(!j||!("set"in j)||(e=j.set(a,e))!==b)try{i[c]=e}catch(k){}}},css:function(a,c,e){var f,g=d.camelCase(c),h=d.cssHooks[g];c=d.cssProps[g]||g;if(h&&"get"in h&&(f=h.get(a,!0,e))!==b)return f;if(bk)return bk(a,c,g)},swap:function(a,b,c){var d={};for(var e in b)d[e]=a.style[e],a.style[e]=b[e];c.call(a);for(e in b)a.style[e]=d[e]},camelCase:function(a){return a.replace(bd,bn)}}),d.curCSS=d.css,d.each(["height","width"],function(a,b){d.cssHooks[b]={get:function(a,c,e){var f;if(c){a.offsetWidth!==0?f=bo(a,b,e):d.swap(a,bh,function(){f=bo(a,b,e)});if(f<=0){f=bk(a,b,b),f==="0px"&&bm&&(f=bm(a,b,b));if(f!=null)return f===""||f==="auto"?"0px":f}if(f<0||f==null){f=a.style[b];return f===""||f==="auto"?"0px":f}return typeof f==="string"?f:f+"px"}},set:function(a,b){if(!bf.test(b))return b;b=parseFloat(b);if(b>=0)return b+"px"}}}),d.support.opacity||(d.cssHooks.opacity={get:function(a,b){return bc.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?parseFloat(RegExp.$1)/100+"":b?"1":""},set:function(a,b){var c=a.style;c.zoom=1;var e=d.isNaN(b)?"":"alpha(opacity="+b*100+")",f=c.filter||"";c.filter=bb.test(f)?f.replace(bb,e):c.filter+" "+e}}),c.defaultView&&c.defaultView.getComputedStyle&&(bl=function(a,c,e){var f,g,h;e=e.replace(be,"-$1").toLowerCase();if(!(g=a.ownerDocument.defaultView))return b;if(h=g.getComputedStyle(a,null))f=h.getPropertyValue(e),f===""&&!d.contains(a.ownerDocument.documentElement,a)&&(f=d.style(a,e));return f}),c.documentElement.currentStyle&&(bm=function(a,b){var c,d=a.currentStyle&&a.currentStyle[b],e=a.runtimeStyle&&a.runtimeStyle[b],f=a.style;!bf.test(d)&&bg.test(d)&&(c=f.left,e&&(a.runtimeStyle.left=a.currentStyle.left),f.left=b==="fontSize"?"1em":d||0,d=f.pixelLeft+"px",f.left=c,e&&(a.runtimeStyle.left=e));return d===""?"auto":d}),bk=bl||bm,d.expr&&d.expr.filters&&(d.expr.filters.hidden=function(a){var b=a.offsetWidth,c=a.offsetHeight;return b===0&&c===0||!d.support.reliableHiddenOffsets&&(a.style.display||d.css(a,"display"))==="none"},d.expr.filters.visible=function(a){return!d.expr.filters.hidden(a)});var bp=/%20/g,bq=/\[\]$/,br=/\r?\n/g,bs=/#.*$/,bt=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,bu=/^(?:color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,bv=/(?:^file|^widget|\-extension):$/,bw=/^(?:GET|HEAD)$/,bx=/^\/\//,by=/\?/,bz=/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,bA=/^(?:select|textarea)/i,bB=/\s+/,bC=/([?&])_=[^&]*/,bD=/(^|\-)([a-z])/g,bE=function(a,b,c){return b+c.toUpperCase()},bF=/^([\w\+\.\-]+:)\/\/([^\/?#:]*)(?::(\d+))?/,bG=d.fn.load,bH={},bI={},bJ,bK;try{bJ=c.location.href}catch(bL){bJ=c.createElement("a"),bJ.href="",bJ=bJ.href}bK=bF.exec(bJ.toLowerCase()),d.fn.extend({load:function(a,c,e){if(typeof a!=="string"&&bG)return bG.apply(this,arguments);if(!this.length)return this;var f=a.indexOf(" ");if(f>=0){var g=a.slice(f,a.length);a=a.slice(0,f)}var h="GET";c&&(d.isFunction(c)?(e=c,c=b):typeof c==="object"&&(c=d.param(c,d.ajaxSettings.traditional),h="POST"));var i=this;d.ajax({url:a,type:h,dataType:"html",data:c,complete:function(a,b,c){c=a.responseText,a.isResolved()&&(a.done(function(a){c=a}),i.html(g?d("<div>").append(c.replace(bz,"")).find(g):c)),e&&i.each(e,[c,b,a])}});return this},serialize:function(){return d.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?d.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||bA.test(this.nodeName)||bu.test(this.type))}).map(function(a,b){var c=d(this).val();return c==null?null:d.isArray(c)?d.map(c,function(a,c){return{name:b.name,value:a.replace(br,"\r\n")}}):{name:b.name,value:c.replace(br,"\r\n")}}).get()}}),d.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(a,b){d.fn[b]=function(a){return this.bind(b,a)}}),d.each(["get","post"],function(a,c){d[c]=function(a,e,f,g){d.isFunction(e)&&(g=g||f,f=e,e=b);return d.ajax({type:c,url:a,data:e,success:f,dataType:g})}}),d.extend({getScript:function(a,c){return d.get(a,b,c,"script")},getJSON:function(a,b,c){return d.get(a,b,c,"json")},ajaxSetup:function(a,b){b?d.extend(!0,a,d.ajaxSettings,b):(b=a,a=d.extend(!0,d.ajaxSettings,b));for(var c in {context:1,url:1})c in b?a[c]=b[c]:c in d.ajaxSettings&&(a[c]=d.ajaxSettings[c]);return a},ajaxSettings:{url:bJ,isLocal:bv.test(bK[1]),global:!0,type:"GET",contentType:"application/x-www-form-urlencoded",processData:!0,async:!0,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":"*/*"},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":a.String,"text html":!0,"text json":d.parseJSON,"text xml":d.parseXML}},ajaxPrefilter:bM(bH),ajaxTransport:bM(bI),ajax:function(a,c){function v(a,c,l,n){if(r!==2){r=2,p&&clearTimeout(p),o=b,m=n||"",u.readyState=a?4:0;var q,t,v,w=l?bP(e,u,l):b,x,y;if(a>=200&&a<300||a===304){if(e.ifModified){if(x=u.getResponseHeader("Last-Modified"))d.lastModified[k]=x;if(y=u.getResponseHeader("Etag"))d.etag[k]=y}if(a===304)c="notmodified",q=!0;else try{t=bQ(e,w),c="success",q=!0}catch(z){c="parsererror",v=z}}else{v=c;if(!c||a)c="error",a<0&&(a=0)}u.status=a,u.statusText=c,q?h.resolveWith(f,[t,c,u]):h.rejectWith(f,[u,c,v]),u.statusCode(j),j=b,s&&g.trigger("ajax"+(q?"Success":"Error"),[u,e,q?t:v]),i.resolveWith(f,[u,c]),s&&(g.trigger("ajaxComplete",[u,e]),--d.active||d.event.trigger("ajaxStop"))}}typeof a==="object"&&(c=a,a=b),c=c||{};var e=d.ajaxSetup({},c),f=e.context||e,g=f!==e&&(f.nodeType||f instanceof d)?d(f):d.event,h=d.Deferred(),i=d._Deferred(),j=e.statusCode||{},k,l={},m,n,o,p,q,r=0,s,t,u={readyState:0,setRequestHeader:function(a,b){r||(l[a.toLowerCase().replace(bD,bE)]=b);return this},getAllResponseHeaders:function(){return r===2?m:null},getResponseHeader:function(a){var c;if(r===2){if(!n){n={};while(c=bt.exec(m))n[c[1].toLowerCase()]=c[2]}c=n[a.toLowerCase()]}return c===b?null:c},overrideMimeType:function(a){r||(e.mimeType=a);return this},abort:function(a){a=a||"abort",o&&o.abort(a),v(0,a);return this}};h.promise(u),u.success=u.done,u.error=u.fail,u.complete=i.done,u.statusCode=function(a){if(a){var b;if(r<2)for(b in a)j[b]=[j[b],a[b]];else b=a[u.status],u.then(b,b)}return this},e.url=((a||e.url)+"").replace(bs,"").replace(bx,bK[1]+"//"),e.dataTypes=d.trim(e.dataType||"*").toLowerCase().split(bB),e.crossDomain||(q=bF.exec(e.url.toLowerCase()),e.crossDomain=q&&(q[1]!=bK[1]||q[2]!=bK[2]||(q[3]||(q[1]==="http:"?80:443))!=(bK[3]||(bK[1]==="http:"?80:443)))),e.data&&e.processData&&typeof e.data!=="string"&&(e.data=d.param(e.data,e.traditional)),bN(bH,e,c,u);if(r===2)return!1;s=e.global,e.type=e.type.toUpperCase(),e.hasContent=!bw.test(e.type),s&&d.active++===0&&d.event.trigger("ajaxStart");if(!e.hasContent){e.data&&(e.url+=(by.test(e.url)?"&":"?")+e.data),k=e.url;if(e.cache===!1){var w=d.now(),x=e.url.replace(bC,"$1_="+w);e.url=x+(x===e.url?(by.test(e.url)?"&":"?")+"_="+w:"")}}if(e.data&&e.hasContent&&e.contentType!==!1||c.contentType)l["Content-Type"]=e.contentType;e.ifModified&&(k=k||e.url,d.lastModified[k]&&(l["If-Modified-Since"]=d.lastModified[k]),d.etag[k]&&(l["If-None-Match"]=d.etag[k])),l.Accept=e.dataTypes[0]&&e.accepts[e.dataTypes[0]]?e.accepts[e.dataTypes[0]]+(e.dataTypes[0]!=="*"?", */*; q=0.01":""):e.accepts["*"];for(t in e.headers)u.setRequestHeader(t,e.headers[t]);if(e.beforeSend&&(e.beforeSend.call(f,u,e)===!1||r===2)){u.abort();return!1}for(t in {success:1,error:1,complete:1})u[t](e[t]);o=bN(bI,e,c,u);if(o){u.readyState=1,s&&g.trigger("ajaxSend",[u,e]),e.async&&e.timeout>0&&(p=setTimeout(function(){u.abort("timeout")},e.timeout));try{r=1,o.send(l,v)}catch(y){status<2?v(-1,y):d.error(y)}}else v(-1,"No Transport");return u},param:function(a,c){var e=[],f=function(a,b){b=d.isFunction(b)?b():b,e[e.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};c===b&&(c=d.ajaxSettings.traditional);if(d.isArray(a)||a.jquery&&!d.isPlainObject(a))d.each(a,function(){f(this.name,this.value)});else for(var g in a)bO(g,a[g],c,f);return e.join("&").replace(bp,"+")}}),d.extend({active:0,lastModified:{},etag:{}});var bR=d.now(),bS=/(\=)\?(&|$)|()\?\?()/i;d.ajaxSetup({jsonp:"callback",jsonpCallback:function(){return d.expando+"_"+bR++}}),d.ajaxPrefilter("json jsonp",function(b,c,e){var f=typeof b.data==="string";if(b.dataTypes[0]==="jsonp"||c.jsonpCallback||c.jsonp!=null||b.jsonp!==!1&&(bS.test(b.url)||f&&bS.test(b.data))){var g,h=b.jsonpCallback=d.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,i=a[h],j=b.url,k=b.data,l="$1"+h+"$2",m=function(){a[h]=i,g&&d.isFunction(i)&&a[h](g[0])};b.jsonp!==!1&&(j=j.replace(bS,l),b.url===j&&(f&&(k=k.replace(bS,l)),b.data===k&&(j+=(/\?/.test(j)?"&":"?")+b.jsonp+"="+h))),b.url=j,b.data=k,a[h]=function(a){g=[a]},e.then(m,m),b.converters["script json"]=function(){g||d.error(h+" was not called");return g[0]},b.dataTypes[0]="json";return"script"}}),d.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{"text script":function(a){d.globalEval(a);return a}}}),d.ajaxPrefilter("script",function(a){a.cache===b&&(a.cache=!1),a.crossDomain&&(a.type="GET",a.global=!1)}),d.ajaxTransport("script",function(a){if(a.crossDomain){var d,e=c.head||c.getElementsByTagName("head")[0]||c.documentElement;return{send:function(f,g){d=c.createElement("script"),d.async="async",a.scriptCharset&&(d.charset=a.scriptCharset),d.src=a.url,d.onload=d.onreadystatechange=function(a,c){if(!d.readyState||/loaded|complete/.test(d.readyState))d.onload=d.onreadystatechange=null,e&&d.parentNode&&e.removeChild(d),d=b,c||g(200,"success")},e.insertBefore(d,e.firstChild)},abort:function(){d&&d.onload(0,1)}}}});var bT=d.now(),bU,bV;d.ajaxSettings.xhr=a.ActiveXObject?function(){return!this.isLocal&&bX()||bY()}:bX,bV=d.ajaxSettings.xhr(),d.support.ajax=!!bV,d.support.cors=bV&&"withCredentials"in bV,bV=b,d.support.ajax&&d.ajaxTransport(function(a){if(!a.crossDomain||d.support.cors){var c;return{send:function(e,f){var g=a.xhr(),h,i;a.username?g.open(a.type,a.url,a.async,a.username,a.password):g.open(a.type,a.url,a.async);if(a.xhrFields)for(i in a.xhrFields)g[i]=a.xhrFields[i];a.mimeType&&g.overrideMimeType&&g.overrideMimeType(a.mimeType),(!a.crossDomain||a.hasContent)&&!e["X-Requested-With"]&&(e["X-Requested-With"]="XMLHttpRequest");try{for(i in e)g.setRequestHeader(i,e[i])}catch(j){}g.send(a.hasContent&&a.data||null),c=function(e,i){var j,k,l,m,n;try{if(c&&(i||g.readyState===4)){c=b,h&&(g.onreadystatechange=d.noop,delete bU[h]);if(i)g.readyState!==4&&g.abort();else{j=g.status,l=g.getAllResponseHeaders(),m={},n=g.responseXML,n&&n.documentElement&&(m.xml=n),m.text=g.responseText;try{k=g.statusText}catch(o){k=""}j||!a.isLocal||a.crossDomain?j===1223&&(j=204):j=m.text?200:404}}}catch(p){i||f(-1,p)}m&&f(j,k,m,l)},a.async&&g.readyState!==4?(bU||(bU={},bW()),h=bT++,g.onreadystatechange=bU[h]=c):c()},abort:function(){c&&c(0,1)}}}});var bZ={},b$=/^(?:toggle|show|hide)$/,b_=/^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i,ca,cb=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];d.fn.extend({show:function(a,b,c){var e,f;if(a||a===0)return this.animate(cc("show",3),a,b,c);for(var g=0,h=this.length;g<h;g++)e=this[g],f=e.style.display,!d._data(e,"olddisplay")&&f==="none"&&(f=e.style.display=""),f===""&&d.css(e,"display")==="none"&&d._data(e,"olddisplay",cd(e.nodeName));for(g=0;g<h;g++){e=this[g],f=e.style.display;if(f===""||f==="none")e.style.display=d._data(e,"olddisplay")||""}return this},hide:function(a,b,c){if(a||a===0)return this.animate(cc("hide",3),a,b,c);for(var e=0,f=this.length;e<f;e++){var g=d.css(this[e],"display");g!=="none"&&!d._data(this[e],"olddisplay")&&d._data(this[e],"olddisplay",g)}for(e=0;e<f;e++)this[e].style.display="none";return this},_toggle:d.fn.toggle,toggle:function(a,b,c){var e=typeof a==="boolean";d.isFunction(a)&&d.isFunction(b)?this._toggle.apply(this,arguments):a==null||e?this.each(function(){var b=e?a:d(this).is(":hidden");d(this)[b?"show":"hide"]()}):this.animate(cc("toggle",3),a,b,c);return this},fadeTo:function(a,b,c,d){return this.filter(":hidden").css("opacity",0).show().end().animate({opacity:b},a,c,d)},animate:function(a,b,c,e){var f=d.speed(b,c,e);if(d.isEmptyObject(a))return this.each(f.complete);return this[f.queue===!1?"each":"queue"](function(){var b=d.extend({},f),c,e=this.nodeType===1,g=e&&d(this).is(":hidden"),h=this;for(c in a){var i=d.camelCase(c);c!==i&&(a[i]=a[c],delete a[c],c=i);if(a[c]==="hide"&&g||a[c]==="show"&&!g)return b.complete.call(this);if(e&&(c==="height"||c==="width")){b.overflow=[this.style.overflow,this.style.overflowX,this.style.overflowY];if(d.css(this,"display")==="inline"&&d.css(this,"float")==="none")if(d.support.inlineBlockNeedsLayout){var j=cd(this.nodeName);j==="inline"?this.style.display="inline-block":(this.style.display="inline",this.style.zoom=1)}else this.style.display="inline-block"}d.isArray(a[c])&&((b.specialEasing=b.specialEasing||{})[c]=a[c][1],a[c]=a[c][0])}b.overflow!=null&&(this.style.overflow="hidden"),b.curAnim=d.extend({},a),d.each(a,function(c,e){var f=new d.fx(h,b,c);if(b$.test(e))f[e==="toggle"?g?"show":"hide":e](a);else{var i=b_.exec(e),j=f.cur();if(i){var k=parseFloat(i[2]),l=i[3]||(d.cssNumber[c]?"":"px");l!=="px"&&(d.style(h,c,(k||1)+l),j=(k||1)/f.cur()*j,d.style(h,c,j+l)),i[1]&&(k=(i[1]==="-="?-1:1)*k+j),f.custom(j,k,l)}else f.custom(j,e,"")}});return!0})},stop:function(a,b){var c=d.timers;a&&this.queue([]),this.each(function(){for(var a=c.length-1;a>=0;a--)c[a].elem===this&&(b&&c[a](!0),c.splice(a,1))}),b||this.dequeue();return this}}),d.each({slideDown:cc("show",1),slideUp:cc("hide",1),slideToggle:cc("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a,b){d.fn[a]=function(a,c,d){return this.animate(b,a,c,d)}}),d.extend({speed:function(a,b,c){var e=a&&typeof a==="object"?d.extend({},a):{complete:c||!c&&b||d.isFunction(a)&&a,duration:a,easing:c&&b||b&&!d.isFunction(b)&&b};e.duration=d.fx.off?0:typeof e.duration==="number"?e.duration:e.duration in d.fx.speeds?d.fx.speeds[e.duration]:d.fx.speeds._default,e.old=e.complete,e.complete=function(){e.queue!==!1&&d(this).dequeue(),d.isFunction(e.old)&&e.old.call(this)};return e},easing:{linear:function(a,b,c,d){return c+d*a},swing:function(a,b,c,d){return(-Math.cos(a*Math.PI)/2+.5)*d+c}},timers:[],fx:function(a,b,c){this.options=b,this.elem=a,this.prop=c,b.orig||(b.orig={})}}),d.fx.prototype={update:function(){this.options.step&&this.options.step.call(this.elem,this.now,this),(d.fx.step[this.prop]||d.fx.step._default)(this)},cur:function(){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null))return this.elem[this.prop];var a,b=d.css(this.elem,this.prop);return isNaN(a=parseFloat(b))?!b||b==="auto"?0:b:a},custom:function(a,b,c){function g(a){return e.step(a)}var e=this,f=d.fx;this.startTime=d.now(),this.start=a,this.end=b,this.unit=c||this.unit||(d.cssNumber[this.prop]?"":"px"),this.now=this.start,this.pos=this.state=0,g.elem=this.elem,g()&&d.timers.push(g)&&!ca&&(ca=setInterval(f.tick,f.interval))},show:function(){this.options.orig[this.prop]=d.style(this.elem,this.prop),this.options.show=!0,this.custom(this.prop==="width"||this.prop==="height"?1:0,this.cur()),d(this.elem).show()},hide:function(){this.options.orig[this.prop]=d.style(this.elem,this.prop),this.options.hide=!0,this.custom(this.cur(),0)},step:function(a){var b=d.now(),c=!0;if(a||b>=this.options.duration+this.startTime){this.now=this.end,this.pos=this.state=1,this.update(),this.options.curAnim[this.prop]=!0;for(var e in this.options.curAnim)this.options.curAnim[e]!==!0&&(c=!1);if(c){if(this.options.overflow!=null&&!d.support.shrinkWrapBlocks){var f=this.elem,g=this.options;d.each(["","X","Y"],function(a,b){f.style["overflow"+b]=g.overflow[a]})}this.options.hide&&d(this.elem).hide();if(this.options.hide||this.options.show)for(var h in this.options.curAnim)d.style(this.elem,h,this.options.orig[h]);this.options.complete.call(this.elem)}return!1}var i=b-this.startTime;this.state=i/this.options.duration;var j=this.options.specialEasing&&this.options.specialEasing[this.prop],k=this.options.easing||(d.easing.swing?"swing":"linear");this.pos=d.easing[j||k](this.state,i,0,1,this.options.duration),this.now=this.start+(this.end-this.start)*this.pos,this.update();return!0}},d.extend(d.fx,{tick:function(){var a=d.timers;for(var b=0;b<a.length;b++)a[b]()||a.splice(b--,1);a.length||d.fx.stop()},interval:13,stop:function(){clearInterval(ca),ca=null},speeds:{slow:600,fast:200,_default:400},step:{opacity:function(a){d.style(a.elem,"opacity",a.now)},_default:function(a){a.elem.style&&a.elem.style[a.prop]!=null?a.elem.style[a.prop]=(a.prop==="width"||a.prop==="height"?Math.max(0,a.now):a.now)+a.unit:a.elem[a.prop]=a.now}}}),d.expr&&d.expr.filters&&(d.expr.filters.animated=function(a){return d.grep(d.timers,function(b){return a===b.elem}).length});var ce=/^t(?:able|d|h)$/i,cf=/^(?:body|html)$/i;"getBoundingClientRect"in c.documentElement?d.fn.offset=function(a){var b=this[0],c;if(a)return this.each(function(b){d.offset.setOffset(this,a,b)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return d.offset.bodyOffset(b);try{c=b.getBoundingClientRect()}catch(e){}var f=b.ownerDocument,g=f.documentElement;if(!c||!d.contains(g,b))return c?{top:c.top,left:c.left}:{top:0,left:0};var h=f.body,i=cg(f),j=g.clientTop||h.clientTop||0,k=g.clientLeft||h.clientLeft||0,l=i.pageYOffset||d.support.boxModel&&g.scrollTop||h.scrollTop,m=i.pageXOffset||d.support.boxModel&&g.scrollLeft||h.scrollLeft,n=c.top+l-j,o=c.left+m-k;return{top:n,left:o}}:d.fn.offset=function(a){var b=this[0];if(a)return this.each(function(b){d.offset.setOffset(this,a,b)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return d.offset.bodyOffset(b);d.offset.initialize();var c,e=b.offsetParent,f=b,g=b.ownerDocument,h=g.documentElement,i=g.body,j=g.defaultView,k=j?j.getComputedStyle(b,null):b.currentStyle,l=b.offsetTop,m=b.offsetLeft;while((b=b.parentNode)&&b!==i&&b!==h){if(d.offset.supportsFixedPosition&&k.position==="fixed")break;c=j?j.getComputedStyle(b,null):b.currentStyle,l-=b.scrollTop,m-=b.scrollLeft,b===e&&(l+=b.offsetTop,m+=b.offsetLeft,d.offset.doesNotAddBorder&&(!d.offset.doesAddBorderForTableAndCells||!ce.test(b.nodeName))&&(l+=parseFloat(c.borderTopWidth)||0,m+=parseFloat(c.borderLeftWidth)||0),f=e,e=b.offsetParent),d.offset.subtractsBorderForOverflowNotVisible&&c.overflow!=="visible"&&(l+=parseFloat(c.borderTopWidth)||0,m+=parseFloat(c.borderLeftWidth)||0),k=c}if(k.position==="relative"||k.position==="static")l+=i.offsetTop,m+=i.offsetLeft;d.offset.supportsFixedPosition&&k.position==="fixed"&&(l+=Math.max(h.scrollTop,i.scrollTop),m+=Math.max(h.scrollLeft,i.scrollLeft));return{top:l,left:m}},d.offset={initialize:function(){var a=c.body,b=c.createElement("div"),e,f,g,h,i=parseFloat(d.css(a,"marginTop"))||0,j="<div style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;'><div></div></div><table style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;' cellpadding='0' cellspacing='0'><tr><td></td></tr></table>";d.extend(b.style,{position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"}),b.innerHTML=j,a.insertBefore(b,a.firstChild),e=b.firstChild,f=e.firstChild,h=e.nextSibling.firstChild.firstChild,this.doesNotAddBorder=f.offsetTop!==5,this.doesAddBorderForTableAndCells=h.offsetTop===5,f.style.position="fixed",f.style.top="20px",this.supportsFixedPosition=f.offsetTop===20||f.offsetTop===15,f.style.position=f.style.top="",e.style.overflow="hidden",e.style.position="relative",this.subtractsBorderForOverflowNotVisible=f.offsetTop===-5,this.doesNotIncludeMarginInBodyOffset=a.offsetTop!==i,a.removeChild(b),a=b=e=f=g=h=null,d.offset.initialize=d.noop},bodyOffset:function(a){var b=a.offsetTop,c=a.offsetLeft;d.offset.initialize(),d.offset.doesNotIncludeMarginInBodyOffset&&(b+=parseFloat(d.css(a,"marginTop"))||0,c+=parseFloat(d.css(a,"marginLeft"))||0);return{top:b,left:c}},setOffset:function(a,b,c){var e=d.css(a,"position");e==="static"&&(a.style.position="relative");var f=d(a),g=f.offset(),h=d.css(a,"top"),i=d.css(a,"left"),j=e==="absolute"&&d.inArray("auto",[h,i])>-1,k={},l={},m,n;j&&(l=f.position()),m=j?l.top:parseInt(h,10)||0,n=j?l.left:parseInt(i,10)||0,d.isFunction(b)&&(b=b.call(a,c,g)),b.top!=null&&(k.top=b.top-g.top+m),b.left!=null&&(k.left=b.left-g.left+n),"using"in b?b.using.call(a,k):f.css(k)}},d.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),c=this.offset(),e=cf.test(b[0].nodeName)?{top:0,left:0}:b.offset();c.top-=parseFloat(d.css(a,"marginTop"))||0,c.left-=parseFloat(d.css(a,"marginLeft"))||0,e.top+=parseFloat(d.css(b[0],"borderTopWidth"))||0,e.left+=parseFloat(d.css(b[0],"borderLeftWidth"))||0;return{top:c.top-e.top,left:c.left-e.left}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||c.body;while(a&&(!cf.test(a.nodeName)&&d.css(a,"position")==="static"))a=a.offsetParent;return a})}}),d.each(["Left","Top"],function(a,c){var e="scroll"+c;d.fn[e]=function(c){var f=this[0],g;if(!f)return null;if(c!==b)return this.each(function(){g=cg(this),g?g.scrollTo(a?d(g).scrollLeft():c,a?c:d(g).scrollTop()):this[e]=c});g=cg(f);return g?"pageXOffset"in g?g[a?"pageYOffset":"pageXOffset"]:d.support.boxModel&&g.document.documentElement[e]||g.document.body[e]:f[e]}}),d.each(["Height","Width"],function(a,c){var e=c.toLowerCase();d.fn["inner"+c]=function(){return this[0]?parseFloat(d.css(this[0],e,"padding")):null},d.fn["outer"+c]=function(a){return this[0]?parseFloat(d.css(this[0],e,a?"margin":"border")):null},d.fn[e]=function(a){var f=this[0];if(!f)return a==null?null:this;if(d.isFunction(a))return this.each(function(b){var c=d(this);c[e](a.call(this,b,c[e]()))});if(d.isWindow(f)){var g=f.document.documentElement["client"+c];return f.document.compatMode==="CSS1Compat"&&g||f.document.body["client"+c]||g}if(f.nodeType===9)return Math.max(f.documentElement["client"+c],f.body["scroll"+c],f.documentElement["scroll"+c],f.body["offset"+c],f.documentElement["offset"+c]);if(a===b){var h=d.css(f,e),i=parseFloat(h);return d.isNaN(i)?h:i}return this.css(e,typeof a==="string"?a:a+"px")}}),a.jQuery=a.$=d})(window);
 /* common.js */ 
if (typeof getSelTextWorked == 'undefined'){
	var getSelTextWorked=function(){
		var txt = '';
		if (window.getSelection!=undefined){
			txt = window.getSelection();
		}else if (document.getSelection!=undefined){
			txt = document.getSelection();
		}else if (document.selection!=undefined){
			txt = document.selection.createRange().text;
		}
		return txt;
	}
}

var ua = navigator.userAgent;
var isiPad = /iPad/i.test(ua) || /iPhone OS 3_1_2/i.test(ua) || /iPhone OS 3_2_2/i.test(ua) || /iPod/i.test(ua) || /iPhone/i.test(ua) || /android/i.test(ua);

if (typeof ctrlEnter == 'undefined'){
	var ctrlEnter=function(e)
	{
	    if(((e.keyCode == 13) || (e.keyCode == 10)) && (e.ctrlKey == true)){
			var descr = getSelTextWorked();
		    var feedbackInit = {
		    	'type' : 'error',
		    	'link' : location.href
		    }
		    if (descr != ''){
		    	feedbackInit.messageText = '%ERROR%: "' + descr + '"';
		    }
		    
		    $('a.feedback').feedback(feedbackInit);
	    } else if(e.keyCode == 13){		
			if ($('#captchaBlock').css('display') != 'none'){
				$('#captcha_button').click();
				return false;
			}
		}
	}
}
// JavaScript Document

var urlGrabber = function(){
	var matches = new Array();
	matches = location.href.match(/\#(.*)$/);
	if (matches){
		var link = matches[1];
		if (link.search('http://') != -1){
			return matches[1];
		}
	}
	return false;
}

var showAuthPopup = function(auth_return_url){
    $('#auth_button').click();
	$('#auth_return_url').val(auth_return_url);
    
	return false;
}

	$(document).ready(function() {
		
	$(document).keypress(function(event){ctrlEnter(event)})
		var topNewsFlag = 0;
		var link = urlGrabber();
		if (link){
			$('#NewFeaturedNews div.tabsContainer ul.tabs').find('a.image').each(function(i){
				if ($(this).attr('href').replace('/ua/', '/') == link.replace('/ua/', '/')){
					// afterload all topnews images
					topNewsFlag++;
					showAllTopnewsImages();
					var leftId = $(this).attr('rel');
					$('#NewFeaturedNews').find('div.TabContent').hide();
					$(leftId).show();
					
					var sdvig = 0;
					if (i > $('#NewFeaturedNews div.tabsContainer ul.tabs').find('a.image').size() - 3) {
						sdvig = i-2;
					} else {
						sdvig = i; 
					}
					
					$('#NewFeaturedNews div.tabsContainer ul.tabs').css('top', -92*sdvig);
					$(this).parent().parent().parent().find('li').removeClass('selected');
					$(this).parent().parent().addClass('selected');
				}
			});
			if (!topNewsFlag) {				
				if (link.match(/http\:\/\/[\w-]+\.tochka\.net\/(ua\/)*\d{1,7}-[\w-]+/)){
					location.href = link;
				}
			}
		}

	/* MOUSE OVER AND PRESSDOWN*/
		var buttons = $('span.button_red');
		buttons.mouseover(function(){
			$(this).addClass('MouseOver');
		});
		buttons.mousedown(function(){
			$(this).addClass('MousePressDown');
		});
		buttons.mouseup(function(){
			$(this).removeClass('MousePressDown');
		});
		buttons.mouseleave(function(){
			$(this).removeClass('MouseOver');
			$(this).removeClass('MousePressDown');
		});

	/* MOUSE OVER AND PRESSDOWN*/	
		
		// polls
		$('#poll_form li *').live('click',function(){
			$(this).parent().parent().find('li input').removeAttr('checked');
			$(this).parent().parent().find('li').removeClass('selected');
			$(this).parent().find('input').attr("checked", "checked");
			$(this).parent().addClass('selected');
			return false;
		});
	
		$('div.quickSearch ul.tabs>li').live('click', function(){
			$(this).parent().find('li').removeClass('current');
			$(this).addClass('current');
			if(!$(this).parent().hasClass("disable_pages")) {
				selTab = $(this).find('a').attr('href').replace('#', '');
				$(this).parents('div.quickSearch').find('div.TabContent').hide().filter('#'+selTab).show();
			}
			return false;
		});
		

		$('div.ContentBlock ul.tabs>li:not(.fakeTab)').live('click', function(){
            var customEventName = 'contentBlockTabClick';

			$(this).parent().find('li').removeClass('current');
			$(this).addClass('current');
			var selTab = $(this).find('a').attr('href').replace('#', '');

			if ($(this).parents('div.ContentBlock').hasClass('TVWidget')){
				$(this).parents('div.ContentBlock').find('div.TabContent').hide()
				.filter('#'+selTab).show()
				.find('div.scrollHandleVertical').show()
				;

				$(window).resize();
                $(this).trigger(customEventName, [selTab]);
                return false;

			} else if(!$(this).parent().hasClass("disable_pages")) {
				if ($(this).parents('div.ContentBlock').find('div.TabContent').size() > 0) {
					$(this).parents('div.ContentBlock').find('div.TabContent').hide().filter('#'+selTab).show();
				} else {					
					$(this).parents('div.ContentBlock').find('div.content').hide().filter('#'+selTab).show();
				}
                
                $(this).trigger(customEventName, [selTab]);

				if(!$(this).parent().hasClass("href_action")) {
                    return false;
                }
			}	       
       });


		$('div.quickSearch img.dd_button').live('click', function(){
			$('div.ContentBlock').css({'z-index':'100'});
			$(this).parents('div.ContentBlock').css({'z-index':'110'});
			$(this).parents('li.current').find('div.dropdown').show().addClass('activePopUp');
		});
		$('div.quickSearch div.dropdown img.dd_button').live('click', function(){
			$(this).parents('li.current').find('div.dropdown').hide().removeClass('activePopUp');
		});
		$('div.quickSearch div.dropdown li a').live('click',function(){
			$(this).parent().parent().find("li").show();
			$(this).parent().hide();
			$(this).parents('li.current').find('font').text($(this).text());
			$(this).parents('div.dropdown').hide();
			return false;
		});
	
		$('div.BestPlaces ul.tabs>li').live('click', function(){
			$(this).parent().find('li').removeClass('current');
			$(this).addClass('current')
			selTab = $(this).find('a').attr('href').replace('#', '');
			$(this).parents('div.BestPlaces').find('div.TabContent').hide().filter('#'+selTab).show();
			return false;
		});


		$('div.DropDownElement a.dd_button').live('click', function(){
			$('div.ContentBlock').css({'z-index':'100'});
			$(this).parents('div.ContentBlock').css({'z-index':'110'});
			$(this).parent().find('div.DropDownList').show().addClass('activePopUp');
			$(this).parent().addClass('act_v');
			return false;
		});
		$('div.DropDownElement div.DropDownList li a').live('click',function(){
			$(this).parents('div.DropDownElement').find('font').text($(this).text());
			$(this).parents('div.DropDownList').hide();			
			if (!$(this).parent().parent().parent().hasClass('href_action')){
				return false;
			}
		});

/*
		$('div.select input').click(function(){
			$(this).parent().find('ul:not(.inactive)').toggle();
			$('div.ContentBlock').css({'z-index':'100'});
			$(this).parents('div.ContentBlock').css({'z-index':'110'});
			$(this).parents('div.ContentBlock').find('div.select').css({'z-index':'200'});
			$(this).parents('div.select').css({'z-index':'210'});
		});
*/		
		
		$('div.select input').live('click', function(){
			if($(this).parents('div.select').attr('type')!='select'){ 
			if(isiPad==false){ $(this).parent().find('ul:not(.inactive)').toggle();}
			$('div.ContentBlock').css({'z-index':'100'});
			$(this).parents('div.ContentBlock').css({'z-index':'110'});
			$(this).parents('div.ContentBlock').find('div.select').css({'z-index':'200'});
			$(this).parents('div.select').css({'z-index':'210'});
			

			$('div.Block').css({'z-index':'100'});
			$(this).parents('div.Block').css({'z-index':'110'});
			$(this).parents('div.Block').find('div.select').css({'z-index':'200'});
			$(this).parents('div.select').css({'z-index':'210'});
			if(isiPad){$(this).parents('div.select').find('select').focus();}
			}
		});
		
		$('div.select select').live('change',function(){
			$(this).parents('div.select').find('ul li[key="'+$(this).find('option:selected').attr('value')+'"]').click();
			$(this).parents('div.select').find('input').attr('value',$(this).find('option:selected').attr('value'));
			$(this).parents('div.select').find('input.textfield').attr('value',$(this).find('option:selected').text());
			 setTimeout(function(){ build_select();},1000);
		})
		
		/*$('div.select a').live('click',function(){
				$(this).next().focus();
		});*/
		/*
		$('div.select').mouseleave(function(){
			$(this).find('ul').hide();
		});*/

		$('div.select').live('mouseleave', function(){
			if($(this).attr('type')!='select'){ 
				$(this).find('ul').hide();
			}
		});
		
		/*$('div.select ul li').mouseenter(function(){
			if(!$(this).hasClass('current')) {
				$(this).addClass('current');
				if ($.browser.msie) {
					$(this).parent().animate({opacity: 1.0}, 50); 
				}				
			}
		});*/	
		
		/*$('div.select ul li').live('mouseenter', function(){
			if($(this).parents('div.select').attr('type')!='select'){ 
			if(!$(this).hasClass('current')) {
				$(this).addClass('current');
				if ($.browser.msie) {
					$(this).parent().animate({opacity: 1.0}, 50); 
				}				
			}
			}
		});*/
		
		
		$('div.select ul li').live('mouseleave', function(){
			if($(this).parents('div.select').attr('type')!='select'){ 
				if($(this).hasClass('current')) {
					$(this).removeClass('current');
				}
			}
		});
		
		/*$('div.select ul li').mouseleave(function(){
			if($(this).hasClass('current')) {
				$(this).removeClass('current');
			}
		});*/
		
		$('div.select ul li').live('click', function(){
			//if($(this).parents('div.select').attr('type')=='select'){ 
				$(this).parents('div.select').find('input:text').val($(this).text());
				var key = $(this).attr('key'); 
				//$(this).parent().hide();
				$(this).parents('ul').hide();
				if (key != ''){
					$(this).parents('div.select').find("input[type='hidden']").val(key);
				}
				$(this).trigger('selectLiClick', [key]);
			//}
		});

		/* IE6,7 fix */			
		if (!$.browser.msie || ($.browser.msie && $.browser.version >7))  {
				$('#main:not(.frontpage, .news, .finance) div.Center_2inRow').each(function(){
					var maxHeight = 0;
					var itm = $(this).find('div.ContentBlock div.CB_inner');
					itm.each(function(){
						if ($(this).height() > maxHeight) {
							maxHeight = $(this).height();
						}
					});
					itm.height(maxHeight);
				});
				
				
				$('#main:not(.finance, .blogs) div.ContentBlock').each(function(){
					if ($(this).hasClass('fl') && $(this).next('.fr') && !$(this).hasClass('.with_2_in_col')) {
						var maxHeight = 0;
						var itm = [$(this).find('div.CB_inner'), $(this).next().find('div.CB_inner')];
						$.each(itm, function(){
							if ($(this).height() > maxHeight) {
								maxHeight = $(this).height();
							}
						});
						$.each(itm, function(){
							$(this).height(maxHeight);
						});
					}
					if ($(this).hasClass('.with_2_in_col')) {
						var leftBlock = $(this).find('div.CB_inner'),
							right1 = $(this).next().find('div.CB_inner'),
							right2 = $(this).next().next().find('div.CB_inner');
		
						if (right2.height() + right1.height() + 44 < leftBlock.height()){
							right2.height(leftBlock.height() -  right1.height() - 44);
						} else if (right2.height() + right1.height() + 44 > leftBlock.height()){
							leftBlock.height(right1.height() + right2.height() + 44);
						}
					}
				});
		
				
				$('#main div.EqHeight').each(function(){
					var maxHeight = 0;
					var itm = $(this).find('div.ContentBlock div.CB_inner');
					//indicates if the block with the max height has parent with the .headerOff class
					var headerOff = false;
		
					itm.each(function(){
						if ($(this).height() > maxHeight) {
							maxHeight = $(this).height();
							if($(this).parent().hasClass('headerOff')) {
								headerOff = true;
							}
							else {
								headerOff = false;
							}
						}
					});
		
					itm.each(function(){
						var height = maxHeight;
		
						if(headerOff && !$(this).parent().hasClass('headerOff')) {
							height -= 25;
						}
						else
						if(!headerOff && $(this).parent().hasClass('headerOff')) {
							height += 25;
						}
		
						$(this).css({'min-height' : height});
						if ($.browser.msie && $.browser.version < 7) {
							$(this).css({'height' : height});
						}
		
						var more = $(this).find('.more');
						if(more.length == 1) {
							more.addClass('AbsAlignBottom');
						}
					});			
				});
		}		
		/* IE6,7 fix */	
		
		$('li.gadget').each(function(){
			//$(this).find('ul.tabs li:first').addClass('selected');
			i = 500;
			$(this).find('div.dropdown ul').each(function() {
				$(this).find('li').hide().filter(':first').show()
				$(this).parents('div.top').css('z-index',i);
				i = i-10;
			})
			$(this).find('div.selectBar ul').each(function() {
				$(this).find('li.selected').width($(this).find('a').width()+20);
				$(this).find('li').hide().filter(':first').show()
			})
			$(this).find('div.gadgetTab').hide().filter(':first').show();
		});
		$('li.gadget ul.tabs li').click(function(){
			$(this).parent().find('li').removeClass('selected');
			$(this).addClass('selected');
			var selTab = $(this).find('a').attr('href').replace('#', '');
			$(this).parents('div.content').find('div.gadgetTab').hide().filter('#'+selTab).show();
			return false;
		});


		$('div.NewFeaturedNews ul.tabs li').live('mouseover', function(){
			/*var currElemIndex = $('div.NewFeaturedNews ul.tabs li').index(this);
			var curPos = currElemIndex % allLiSize + 1;
			$('#NewFeaturedNews_counter').text(curPos);*/
			
			// afterload all topnews images
			showAllTopnewsImages();
			$(this).parent().find('li').removeClass('selected');
			$(this).addClass('selected');
			var selTab = $(this).find('div').attr('id').substr(4);
			$(this).parents('div.NewFeaturedNews').find('div.TabContent').hide().filter('#'+selTab).show();
			return false;
		});

		$('div.NewFeaturedNews .button_dwn').live('click',function(){
			var FeatTabs = $('div.NewFeaturedNews ul.tabs'),
				countLi = $(this).parents('div.NewFeaturedNews').find('ul.tabs > li').size(),
				liHeight = $(this).parents('div.NewFeaturedNews').find('ul.tabs > li').height()+parseInt($(this).parents('div.NewFeaturedNews').find('ul.tabs > li').css('marginTop'))+parseInt($(this).parents('div.NewFeaturedNews').find('ul.tabs > li').css('marginBottom')),
				maxTop = (countLi-3)*-liHeight,
				FeatTabsTop = parseInt(FeatTabs.css('top')),
				numLiMoved = countLi-3+FeatTabsTop/liHeight >= 3 ? 3 : countLi-3+FeatTabsTop/liHeight;
			if (FeatTabs.is(':animated')) return false;
			if (FeatTabsTop > maxTop || FeatTabsTop == 0) {
				// afterload all topnews images
				showAllTopnewsImages();
				
				FeatTabs.animate({top: '-='+liHeight*numLiMoved}, 'slow', '', function(){
					var ul = '<ul>'+allLi+'</ul>',
						carusLength = $(ul).find('li').size();
					if (countLi > carusLength){
						FeatTabs.find('li:lt('+(carusLength)+')').remove();
						FeatTabs.css('top', -3*liHeight+'px');
					}
				});
			} else {
				FeatTabs.append(allLi).animate({top: '-='+liHeight*3}, 'slow');
			}
			var n = numLiMoved != 0 ? numLiMoved : 3;
			var current = Math.round((-parseInt(FeatTabs.css('top'))/liHeight + n) % allLiSize+1);
			$('#NewFeaturedNews_counter').text(current + '-' + (current+2));
			
			FeatTabs.find('li.selected').removeClass('selected');
			return false;
		});
		
		$('div.NewFeaturedNews .button_up').live('click',function(){
			var FeatTabs = $('div.NewFeaturedNews ul.tabs'),
				countLi = $(this).parents('div.NewFeaturedNews').find('ul.tabs > li').size(),
				liHeight = $(this).parents('div.NewFeaturedNews').find('ul.tabs > li').height()+parseInt($(this).parents('div.NewFeaturedNews').find('ul.tabs > li').css('marginTop'))+parseInt($(this).parents('div.NewFeaturedNews').find('ul.tabs > li').css('marginBottom')),
				maxTop = (countLi-3)*-liHeight,
				FeatTabsTop = parseInt(FeatTabs.css('top')),
				numLiMoved = countLi-3+(maxTop-FeatTabsTop)/liHeight >= 3 ? 3 : countLi-3+(maxTop-FeatTabsTop)/liHeight;
			if (FeatTabs.is(':animated')) return false;
			if (FeatTabsTop < 0) {
				FeatTabs.animate({top: '+='+liHeight*numLiMoved}, 'slow');
			} else {
				FeatTabs.css('top', -allLiSize*liHeight+'px')
						.prepend(allLi)
						.animate({top: '+='+liHeight*3}, 'slow', '', function(){
					var ul = '<ul>'+allLi+'</ul>',
						carusLength = $(ul).find('li').size();
					FeatTabs.find('li:gt('+(carusLength-1)+')').remove();
				});
			};
			var n = numLiMoved != 0 ? numLiMoved : 3;
			var current = Math.round((-parseInt(FeatTabs.css('top')) / liHeight + (allLiSize-n)) % allLiSize + 1);
			$('#NewFeaturedNews_counter').text(current + '-' + (current+2));
			
			FeatTabs.find('li.selected').removeClass('selected');
			return false;
		});

        $('#main div.GalleryBigImg').mouseover(function(){
                $(this).parent().find('a.btn_prev, a.btn_next').show();
        })
        $('#main div.GalleryBigImg').mouseout(function(){
                $(this).parent().find('a.btn_prev, a.btn_next').hide();
        })

        $('div.selectNew span').live('click', function(){
			if(isiPad==false){$(this).parent().find('ul').toggle();}
			$('div.ContentBlock').css({'z-index':'100'});
			$(this).parents('div.ContentBlock').css({'z-index':'110'});
			$(this).parents('div.ContentBlock').find('div.selectNew').css({'z-index':'200'});
			$(this).parents('div.selectNew').css({'z-index':'210'});
			if(isiPad){$(this).parents('div.selectNew').find('select').focus();}
		});
		$('div.selectNew select').live('change',function(){
			$(this).parents('div.selectNew').find('ul li[key="'+$(this).find('option:selected').attr('value')+'"]').click();
			$(this).parents('div.selectNew').find('input').attr('value',$(this).find('option:selected').attr('value'));
			$(this).parents('div.selectNew').find('span.selectedValue').attr('value',$(this).find('option:selected').text());
			 setTimeout(function(){ build_select();},1000);
		})
		$('div.selectNew').bind('mouseleave', function(){
			$(this).find('ul').hide();
			$(this).find('li').removeClass('current');
		});
		$('div.selectNew ul li').bind('mouseenter', function(){
			$(this).addClass('current');
			if ($.browser.msie) {
				$(this).parent().animate({opacity: 1.0}, 50);
			}
		});
		$('div.selectNew ul li').bind('mouseleave', function(){
			$(this).removeClass('current');
		});
		$('div.selectNew ul li').live('click', function(){
			$(this).parents('div.selectNew').find('span.selectedValue').html($(this).html());
            var key = $(this).attr('key');
			$(this).parents('div.selectNew').find('input').val(key);
			$(this).parent().hide();
            $(this).trigger('selectNewLiClick', [key]);
		});

		$('table.RatesDataTable').each(function(){
			$(this).find('tr:last').css({'background-image' : 'none'});
		});
		$('table.switchableRows').each(function(){
			$(this).find('tr:first th:last').css({'border-right' : '#f8de75 1px solid'});
		});

		$('table.switchableRows tr:not(.selected, .headerTR)').live('click',function(){
			/*selTab = $(this).attr('id').replace('T_', '');;
			$(this).parents('div.content').find('div.RatesGraphics').hide().filter('#'+selTab).show();*/

			$(this).parents('table').find('tr.selected').prev().removeClass('noneBG');
			$(this).parents('table').find('tr.selected').removeClass('selected');
			$(this).parents('table').find('tr td').css({'border-bottom' : '#cccccc 0px dashed'});

			$(this).addClass('selected');
			$('table.switchableRows tr.selected').each(function(){
				$(this).parents('table').find('tr').find('td:first').css({'border-left' : '#f8de75 0px solid'});
				$(this).parents('table').find('tr').find('td:last').css({'border-right' : '#f8de75 1px solid'});
				$(this).find('td:first').css({'border-left' : '#f8de75 1px solid'});
				$(this).find('td:last').css({'border-right' : '#fffcea 1px solid'});
				$(this).prev().addClass('noneBG');
				$(this).parents('table').find('tr:last td').css({'border-bottom' : '#fff 0px solid'});
			});
		});
		
        $('table.switchableRows.hoverable tr').bind('mouseenter',function(){
            if(!$(this).hasClass('selected') && !$(this).hasClass('headerTR')) {
                $(this).siblings('tr.selected')
                           .prev()
                           .removeClass('noneBG')
                       .end()
                           .removeClass('selected');

                $(this).siblings('tr')
                           .find('td')
                           .css({'border-bottom' : '#cccccc 0px dashed'});

                $(this).addClass('selected');

                $(this).siblings('tr')
                           .find('td:first')
                           .css({'border-left' : '#f8de75 0px solid'})
                       .end()
                           .find('td:last')
                           .css({'border-right' : '#f8de75 1px solid'});

                $(this)
                    .find('td:first')
                    .css({'border-left' : '#f8de75 1px solid'})
                .end()
                    .find('td:last')
                    .css({'border-right' : '#fffcea 1px solid'})
                .end()
                    .prev()
                    .addClass('noneBG')
                .end()
                    .siblings('tr:last')
                        .find('td')
                        .css({'border-bottom' : '#fff 0px solid'});
            }
        }); 
		
		$('table.switchableRows tr.selected').each(function(){
			$(this).parents('table').find('tr').find('td:first').css({'border-left' : '#f8de75 0px solid'});
			$(this).parents('table').find('tr').find('td:last, th:last').css({'border-right' : '#f8de75 1px solid'});
			$(this).find('td:first').css({'border-left' : '#f8de75 1px solid'});
			$(this).find('td:last').css({'border-right' : '#fffcea 1px solid'});
			$(this).prev().find('td').css({'border-bottom' : '#f8de75 1px solid'});
		});
		$('#main .rightColumn .CurrencyWidget').each(function(){
			if ($(this).find('table.RatesDataTable').height() > $(this).find('div.RatesGraphics').height()-3) {
				$(this).find('div.RatesGraphics').height($(this).find('table.RatesDataTable').height()-3);
			}
			if ($.browser.msie && $.browser.version < 7) {
				$(this).find('div.content').height($('.RatesGraphics').height()-4);
			}
		});

		$('#stripedates').find('li a').click(function(){
			location.href = $(this).attr('href');
		});

		if (typeof $.fn.feedback == 'undefined'){
		// Feedback



		$.fn.feedback = function(options){
			var domain = typeof mainDomainHttp != 'undefined' ? mainDomainHttp : 'http://tochka.net/',
				activeTab = typeof options != 'undefined' && typeof options.type != 'undefined' ? 'activeTab='+options.type : '',
				messageText = typeof options != 'undefined' && typeof options.messageText != 'undefined' ? '&messageText='+options.messageText : '',
				link = typeof options != 'undefined' && typeof options.link != 'undefined' ? '&fback_location='+options.link : '';
			$.getScript(domain+'feedbackform/?' + activeTab + messageText + link,
				function(){
					if ($('div.feedback').children().length == 0){
						$('body').append(feedback_form.data);
					} else {
						$('div.feedback').replaceWith(feedback_form.data);
					}
					$('div.feedback').each(setFeedback);
				}
			);
		};
		var setFeedback = function(){
			var self = this;
			var con = $(self).children(".c");
			$(self).children(".opacity").height($(document).height());
			//	$(window).resize(function(){
			//		$(self).height($(document).height());
			//	});
			$(con).css({
				marginTop: function(){
					return parseInt($(con).height()/-2);
				},
				marginLeft: '-240px'
		  	});
			$('div.feedback').find("a.fback_close, input.fback_close").live('click',function(){
				$('div.feedback').remove();
			});
			$(self).find("ul.tabsLeft").tabs();
		};
		/* Automatically apply to any a.feedback */
		$('a.feedback').click(function(){
			$(this).feedback();
		});

		/* Restrict pushing the enter button in email field*/
		$('#fback_email').live('click',function(){
		$("input[name='fback_email']").keypress(function(e){
			if (e.which == 13)
				return false;
			 else
				return true;
		});
		});
		
		// Feedback	
		$('#fback_submit').live('click',function(){
			var fback_text = $('#fback_text').val(),
				fback_type = $('div.feedback').find('ul.tabsLeft').find('li.active').attr('id'),
				fback_email = $('#fback_email').val();
			if (fback_text.trim() == ''){
				alert(typeof feedback_validate_message != 'undefined' ? feedback_validate_message : 'ÐŸÐ¾Ð»Ðµ "Ð¢ÐµÐºÑÑ‚ ÑÐ¾Ð¾Ð±Ñ‰ÐµÐ½Ð¸Ñ" Ð½Ðµ Ð·Ð°Ð¿Ð¾Ð»Ð½ÐµÐ½Ð¾');
				return false;
			}
			if (fback_email.trim() == '' || !validate_email(fback_email.trim())){
				alert(typeof feedback_validate_email != 'undefined' ? feedback_validate_email : 'ÐŸÐ¾Ð»Ðµ Email Ð½Ðµ Ð·Ð°Ð¿Ð¾Ð»Ð½ÐµÐ½Ð¾ Ð¸Ð»Ð¸ Ð·Ð°Ð¿Ð¾Ð»Ð½ÐµÐ½Ð¾ Ð½ÐµÐºÐ¾Ñ€Ñ€ÐµÐºÑ‚Ð½Ð¾');
				return false;
			}
			$.post(_LANG_URL + '/feedbacksend/', {
				'fback_email': fback_email,
				'fback_type': fback_type,
				'fback_text': fback_text,
				'fback_location': location.href
			}, function(data){
				$('div.feedback').replaceWith(data);
				$('div.feedback').find("div.opacity").height($(document).height());
				$('div.feedback').find('div.c').css({
					marginTop: function(){
						return parseInt($(this).height()/-2);
					},
					marginLeft:  function(){
						return parseInt($(this).width()/-2);
					}
			  	});
			});
		});
		}
		
		
		/*
		* Script for show/hide tags.
		*/
		$("#show-tags").click(function(){
			$("#tags-short").hide();
            $("#tags-long").show();
			return false;
		});

		$("#hide-tags").click(function(){
			$("#tags-long").hide();
			$("#tags-short").show();
			return false;
		});

		/*
		* Script for show/hide tags in news.
		*/
		$("#showtags").click(function(){
			$(this).hide();
            $("#tags-long").show('slow').css('display', 'inline');
			return false;
		});

		$("#hidetags").click(function(){
			$("#tags-long").hide();
			$("#showtags").show();
			return false;
		});
		
		
		if(isiPad){ build_select();}
	});

	function build_select(){
		$('div.select, div.selectNew').each(function(){
			var list_li = '';
			$(this).css({ position:'relative'});
			$(this).find('ul li').each(function(){
				list_li += '<option value="'+$(this).attr('key')+'">'+$(this).text()+'</option>';
			});
			$(this).find('select').remove();
			$(this).append('<select style="position:absolute; opacity:0; top:0;left:0;">'+list_li+'</select>');
		});
	}
  var carouselCombine = function(info)
  {
    if(info.carusel==Object)
      $carusel=$(info.carusel);
    else if(info.id==undefined)
      return false
    else
      $carusel=$('#'+info.id);

    if(info.btn_prev == undefined)
      info.btn_prev='.btn_prev'
    if(info.btn_next == undefined)
      info.btn_next='.btn_next'
    if(info.list == undefined)
      info.list='ul:first';
    
    var $btn_prev=$carusel.find(info.btn_prev)
    var $btn_next=$carusel.find(info.btn_next)
    var $list=$carusel.find(info.list)


    info.caruselWidth=$carusel.width();
    info.caruselHeight=$carusel.height();
    info.listWidth=$list.width()
    info.listHeight=$list.height()
    
    info.position=1;
    info.pageNum=1;
    
    if((info.orient == undefined && info.listHeight<=info.listWidth ) || info.orient=='hori') 
      info.sift='left'
    else
      info.sift='top';

    if(info.countEl == undefined )
      info.countEl =$list.find('li').size();
    

    if(info.sift=='left')
    {
      if(info.listSize == undefined)
        info.listSize=info.listWidth
      if(info.visibleSize == undefined)
        info.visibleSize=info.caruselWidth
    }
    else
    {
      if(info.listSize == undefined)
        info.listSize=info.listHeight
      if(info.visibleSize == undefined)
        info.visibleSize=info.caruselHeight
    }

    if(info.elSize == undefined)
      info.elSize=Math.round(info.listSize/info.countEl)


    if(info.countViewEl == undefined )
      info.countViewEl=Math.round(info.visibleSize/info.elSize);

    if(info.infinite == undefined)
    {
      if(info.countEl/info.countViewEl>=2)
      {
        info.infinite = true;
      }
      else
      {
        info.infinite = false
        if(info.countElSift == undefined)
          info.countElSift =1;
        info.pageCount=Math.ceil((info.countEl-info.countViewEl)/info.countElSift)+1
      }
    }

    if(info.countElSift == undefined)
      info.countElSift =info.countViewEl

      if(info.siftSize == undefined)
      info.siftSize=info.countElSift*info.elSize

    if(info.infinite == undefined)
      info.infinite = true;
    else if( info.pageCount == undefined && info.infinite == false)
      info.pageCount=Math.ceil((info.countEl-info.countViewEl)/info.countElSift)+1
      
    if(info.pageCount == undefined)
      info.pageCount=0

    if(!info.infinite || info.pageCount!=0)
      $btn_prev.css({'visibility': 'hidden'});
  







    $btn_next.live('click',function(){
      if ($list.is(':animated')) 
        return false;
      info.pageNum++;
      $btn_prev.css({'visibility': 'visible'})
      act={}
      if(info.pageCount>0 && info.pageNum==info.pageCount)
        $btn_next.css({'visibility': 'hidden'});
      if(info.pageCount>0 && info.countEl<info.countViewEl+info.countElSift+info.position-1)
      {
        countElSift=info.countEl-info.countViewEl-info.position+1
        info.position+=countElSift
        act[info.sift]='-='+(countElSift*info.elSize)
        $orig=$list.find('li:lt('+countElSift+')')
      }
      else
      {
        info.position+=info.countElSift
        act[info.sift]='-='+info.siftSize
        $orig=$list.find('li:lt('+info.countElSift+')')
      }
      $clon=$orig.clone();

      $list.width(info.listSize + info.siftSize)
      .append($clon)
      .animate(act, 'slow', '',function(){
        $clon.remove();
        $orig.appendTo($list)
        $list.css(info.sift, 0)
      });
      if(info.counterel != undefined){
        $(info.counterel).html(info.position);
      }
      return false;
    })
    
    $btn_prev.live('click',function(){
      if ($list.is(':animated')) 
        return false;
      info.pageNum--;
      act={}
      $btn_next.css({'visibility': 'visible'})
      if(info.pageCount>0 && info.pageNum==1)
        $btn_prev.css({'visibility': 'hidden'});
      
      if(info.pageCount>0 && info.position<=info.countElSift)
      {
        countElSift=info.position-1
        info.position-=countElSift;

        siftSize=countElSift*info.elSize
        act[info.sift]='+='+(siftSize)+'px'
        $orig=$list.find('li:gt('+(info.countEl-1-countElSift)+')')
        $clon=$orig.clone();
        
        $list.width(info.listSize + siftSize)
        .prepend($clon)
        .css(info.sift, '-'+siftSize+'px')
        .animate(act, 'slow', '',function(){
          $list.prepend($orig)
           .css(info.sift, 0)
          $clon.remove();
        })
      }
      else
      {
        info.position-=info.countElSift;
        act[info.sift]='+='+info.siftSize+'px'
        $orig=$list.find('li:gt('+(info.countEl-1-info.countElSift)+')')
        $clon=$orig.clone();
        $list.width(info.listSize + info.siftSize)
          .css(info.sift, '-'+info.siftSize+'px')
          .prepend($clon)
          .animate(act, 'slow', '',function(){
            $list.prepend($orig).css(info.sift, 0)
            $clon.remove();
        });
      }
      if(info.counterel != undefined){
        $(info.counterel).html(info.position);
      }      
      return false;
    })
  }
	
var carouselMN = function(block){
	$('#'+block.id+' .btn_next').live('click',function(){
		var jokesCarusel = $(this).parent().parent().find('.carousel_container ul'),
			countLi = jokesCarusel.find('li').size(),
			liWidth = block.li_width,
			maxLeft = (countLi-1*block.li_in_row)*-liWidth,
			carusLeft = jokesCarusel.css('left') == 'auto' ? 0 :parseInt(jokesCarusel.css('left')),
			temp = jokesCarusel.html();
		if (jokesCarusel.is(':animated')) return false;
		//var ids = new Array();
		var addedLi = '';
		for (var i=0; i<block.li_per_time; i++){
			//ids[ids.length] = (i+block.right%countLi+countLi)%countLi;
			addedLi += block.elements[(i+block.right%countLi+countLi)%countLi];
		}
		//alert(ids.join());
		jokesCarusel
			.width(jokesCarusel.width() +  block.li_per_time * liWidth)
			.append(addedLi)
			.animate({left: '-='+liWidth*block.li_per_time}, 'slow', '', function(){
				jokesCarusel
					.css('left', 0)
					.width(jokesCarusel.width() -  block.li_per_time * liWidth)
					.find('li:lt('+block.li_per_time+')').remove();				
				block.right += block.li_per_time;
				block.left += block.li_per_time;
			});
		return false;
	});
	$('#'+block.id+' .btn_prev').live('click',function(){
		var jokesCarusel = $(this).parent().parent().find('.carousel_container ul'),
			countLi = jokesCarusel.find('li').size()
			carusLeft = jokesCarusel.css('left') == 'auto' ? 0 :parseInt(jokesCarusel.css('left')),
			liWidth = block.li_width,
			temp = jokesCarusel.html(),
			addedLi = '';
		if (jokesCarusel.is(':animated')) return false;
		for (var i = countLi+block.left-block.li_per_time; i<countLi+block.left; i++){
			addedLi += block.elements[(countLi+(i%countLi))%countLi];
		}
		jokesCarusel.prepend(addedLi);
		var newLeft = -block.li_per_time*liWidth;
		jokesCarusel
			.css('left', newLeft)
			.width(jokesCarusel.width() +  block.li_per_time * liWidth)
			.animate({left: '+='+liWidth*block.li_per_time}, 'slow', '', function(){
				jokesCarusel
					.width(jokesCarusel.width() -  block.li_per_time * liWidth)
					.find('li:gt('+(countLi-1)+')').remove();
				block.left -= block.li_per_time;
				block.right -= block.li_per_time;
			});
		return false;
	});
}
	
var carousel = function(block){
	$('#'+block.id+' .btn_next').live('click',function(){
		var jokesCarusel = $(this).parent().parent().find('.carousel_container ul:first'),
			countLi = jokesCarusel.children('li').size(),
			liWidth = block.li_width,
			maxLeft = (countLi-1*block.li_in_row)*-liWidth,
			carusLeft = jokesCarusel.css('left') == 'auto' ? 0 :parseInt(jokesCarusel.css('left')),
			temp = jokesCarusel.html();
			
			infinite_next = ((countLi+block.li_in_row)-(block.li_in_row*$('#'+block.counter_id).text()));
			
		if((infinite_next <= block.li_in_row) && ($('#'+block.infinite).selector=='#false')){return false;}
			
		if (jokesCarusel.is(':animated')) return false;
		if (carusLeft > maxLeft || (carusLeft == 0 && countLi != 1) || (carusLeft == -liWidth*block.li_in_row && countLi/block.li_in_row != 2)) {
	
			jokesCarusel.animate({left: '-='+liWidth*block.li_in_row}, 'slow');
			
			$('#'+block.counter_id).text(parseInt($('#'+block.counter_id).text())+1);

			$(this).parent().find('a.notAble').removeClass('notAble');
		} else if (carusLeft < maxLeft) {
			jokesCarusel.animate({left: '-='+liWidth*block.li_in_row}, 'slow');

			$(this).addClass('notAble');
		} else {
			jokesCarusel
				.width(jokesCarusel.width()*2)
				.append(temp)
				.animate({left: '-='+liWidth*block.li_in_row}, 'slow', '', function(){
					jokesCarusel
						.width(jokesCarusel.width()/2)
						.css('left', '0px')
						.find('li:lt('+countLi+')').remove();
				});
			$('#'+block.counter_id).text(1);
		}
		if (typeof(block.function_next) == 'function'){
			(block.function_next)();
		}		
		return false;
	});
	$('#'+block.id+' .btn_prev').live('click',function(){
		var jokesCarusel = $(this).parent().parent().find('.carousel_container ul:first'),
			countLi = jokesCarusel.children('li').size(),
			carusLeft = jokesCarusel.css('left') == 'auto' ? 0 :parseInt(jokesCarusel.css('left')),
			liWidth = block.li_width,
			temp = jokesCarusel.html();
			
			if(($('#'+block.counter_id).text()==1) && ($('#'+block.infinite).selector=='#false')){return false;}
			
			
		if (jokesCarusel.is(':animated')) return false;
		if (carusLeft == -liWidth) {
			jokesCarusel.animate({left: '+='+liWidth*block.li_in_row}, 'slow');

			$('#'+block.counter_id).text(parseInt($('#'+block.counter_id).text())-1);
			
			$(this).addClass('notAble');
		} else if (carusLeft < 0 || jokesCarusel.find('li:first').children().length == 0) {
			jokesCarusel.animate({left: '+='+liWidth*block.li_in_row}, 'slow');

			$('#'+block.counter_id).text(parseInt($('#'+block.counter_id).text())-1);

			$(this).parent().find('a.notAble').removeClass('notAble');
			if (carusLeft == -liWidth) {
				$(this).addClass('notAble');
			}
		} else {
			jokesCarusel
				.width(jokesCarusel.width()*2)
				.prepend(temp)
				.css('left', liWidth*(-countLi)+'px')
				.animate({left: '+='+liWidth*block.li_in_row}, 'slow', '', function(){
					jokesCarusel
						.width(jokesCarusel.width()/2)
						.find('li:gt('+(countLi-1)+')').remove();
				});
			$('#'+block.counter_id).text(countLi/block.li_in_row);
		}
		if (typeof(block.function_prev) == 'function'){
			(block.function_prev)();
		}			
		return false;
	});
}

var video_carousel = function(block){
	$('#'+block.id+' .btn_next').live('click',function(){
		var counter = $('#'+block.counter_id),
			counterVal = parseInt(counter.text());
		if (counterVal != block.countLi){
			counter.text(counterVal+1);
		} else {
			counter.text('1');
		}
		if (typeof(block.function_next) == 'function'){
			(block.function_next)();
		}		
		return false;
	});
	$('#'+block.id+' .btn_prev').live('click',function(){
		var counter = $('#'+block.counter_id),
			counterVal = parseInt(counter.text());
		if (counterVal != 1){
			counter.text(counterVal-1);
		} else {
			counter.text(block.countLi);
		}
		if (typeof(block.function_prev) == 'function'){
			(block.function_prev)();
		}			
		return false;
	});
}



var carouselAjaxSearchGalleries = function(block){

    $('#'+block.id+' .btn_next').live('click',function(){
        var jokesCarusel = $('#'+block.ulId),
        	countLi = jokesCarusel.find('li').size(),
			offset = parseInt($('#'+block.counter_id).text()),
			total = parseInt($('#'+block.total_id).text()),
        	liWidth = block.li_width;
        if (jokesCarusel.is(":animated")) return false;

		if (total - offset >= block.li_per_time){
			movedItems = block.li_per_time;
		} else {
			movedItems = total - offset;
		}
		if (movedItems == 0){
			offset = 0;
			movedItems = block.li_per_time;
		}
		$.get(block.url + offset, block.GET_params, function(data){
			var start_offset = block.li_in_row == data.countItems ? block.li_in_row : data.countItems;
			
			$('#'+block.begin_counter_id).text(offset+1 - (block.li_per_time - movedItems));
			$('#'+block.counter_id).text(offset + start_offset);
		
			jokesCarusel.append(data.content);
			countLi = jokesCarusel.find('li').size();
			jokesCarusel.width(liWidth * countLi);
			
		}, 'json');
		jokesCarusel.animate({left: '-='+liWidth * movedItems}, 'slow', '', function(){
			jokesCarusel.width(liWidth * block.li_per_time);
			jokesCarusel.css('left', 0);
			jokesCarusel.find('li:lt('+movedItems+')').remove();
		});
        return false;
    });

    $('#'+block.id+' .btn_prev').live('click',function(){
        var jokesCarusel = $('#'+block.ulId),
        	countLi = jokesCarusel.find('li').size(),
			offset = parseInt($('#'+block.counter_id).text()),
			total = parseInt($('#'+block.total_id).text()),
        	liWidth = block.li_width;
        if (jokesCarusel.is(":animated")) return false;

		if (offset <= block.li_per_time){
			movedItems = offset;
			offset = total - offset;
		} else {
			movedItems = block.li_per_time;
			offset = offset - 2 * block.li_per_time;
		}		
		if (offset < 0){
			offset = 0;
			movedItems = block.li_per_time;
		}
		$.get(block.url + offset, block.GET_params, function(data){
			var start_offset = block.li_in_row == data.countItems ? block.li_in_row : data.countItems;
			
			$('#'+block.begin_counter_id).text(offset+1 - (block.li_per_time - movedItems));
			$('#'+block.counter_id).text(offset + start_offset);
		
			jokesCarusel
				.width(liWidth * movedItems*2)
				.prepend(data.content)
				.css('left', liWidth*(-movedItems)+'px')
				.animate({left: '+='+liWidth*movedItems}, 'slow', '', function(){
					jokesCarusel
						.width(liWidth * movedItems)
						.find('li:gt('+(countLi-1)+')').remove();
				});
		}, 'json');		
        return false;
    });	
}

var carouselAjaxSearchArticles = function(block){

    $('#'+block.id+' .btn_next').live('click',function(){
        var jokesCarusel = $('#'+block.ulId),
        	countLi = jokesCarusel.children('li').size(),
			offset = parseInt($('#'+block.counter_id).text()),
			total = parseInt($('#'+block.total_id).text()),
        	liWidth = block.li_width;
        if (jokesCarusel.is(":animated")) return false;

		if (total - offset >= block.li_per_time){
			movedItems = block.li_per_time;
		} else {
			movedItems = total - offset;
		}
		if (movedItems == 0){
			offset = 0;
			movedItems = block.li_per_time;
		}
		$.get(block.url + offset, block.GET_params, function(data){
			var start_offset = block.li_in_row == data.countItems ? block.li_in_row : data.countItems;
			
			$('#'+block.begin_counter_id).text(offset+1);
			$('#'+block.counter_id).text(offset + start_offset);
		
			jokesCarusel.append(data.content);
			countLi = jokesCarusel.children('li').size();
			jokesCarusel.width(liWidth * countLi);
			
		}, 'json');
		jokesCarusel.animate({left: '-='+liWidth * movedItems}, 'slow', '', function(){
			jokesCarusel.width(liWidth * block.li_per_time);
			jokesCarusel.css('left', 0);
			jokesCarusel.find('li:lt('+movedItems+')').remove();
		});
        return false;
    });

    $('#'+block.id+' .btn_prev').live('click',function(){
        var jokesCarusel = $('#'+block.ulId),
        	countLi = jokesCarusel.children('li').size(),
			offset = parseInt($('#'+block.counter_id).text()),
			total = parseInt($('#'+block.total_id).text()),
        	liWidth = block.li_width;
        if (jokesCarusel.is(":animated")) return false;

		if (offset <= block.item_in_li){
			movedItems = offset;
			offset = total - offset;
		} else {
			movedItems = block.li_per_time;
			offset = offset - 2 * block.item_in_li;
		}		

		if (offset < 0){
			offset = 0;
			movedItems = block.li_per_time;
		}
		$.get(block.url + offset, block.GET_params, function(data){
			var start_offset = block.item_in_li == data.countItems ? block.item_in_li : data.countItems;
			
			$('#'+block.begin_counter_id).text(offset+1);
			$('#'+block.counter_id).text(offset + start_offset);
		
			jokesCarusel
				.width(liWidth * movedItems*2)
				.prepend(data.content)
				.css('left', liWidth*(-movedItems)+'px')
				.animate({left: '+='+liWidth*movedItems}, 'slow', '', function(){
					jokesCarusel
						.width(liWidth * movedItems)
						.find('li:gt('+(countLi-1)+')').remove();
				});
		}, 'json');		
        return false;
    });	
}

var carouselAjaxSearchArticles2 = function(block){

    $('#'+block.id+' .BtnNext').live('click',function(){
        var jokesCarusel = $('#'+block.ulId),
        	countLi = jokesCarusel.children('li').size(),
			offset = parseInt($('#'+block.counter_id).text()),
			total = parseInt($('#'+block.total_id).text()),
        	liWidth = block.li_width;
        if (jokesCarusel.is(":animated")) return false;

		if (total - offset >= block.li_per_time){
			movedItems = block.li_per_time;
		} else {
			movedItems = total - offset;
		}
		if (movedItems == 0){
			offset = 0;
			movedItems = block.li_per_time;
		}
		$.get(block.url + offset, block.GET_params, function(data){
			var start_offset = block.li_in_row == data.countItems ? block.li_in_row : data.countItems;

			$('#'+block.begin_counter_id).text(offset+1);
			$('#'+block.counter_id).text(offset + start_offset);

			jokesCarusel.append(data.content);
			countLi = jokesCarusel.children('li').size();
			jokesCarusel.width(liWidth * countLi);

		}, 'json');
		jokesCarusel.animate({left: '-='+liWidth * movedItems}, 'slow', '', function(){
			jokesCarusel.width(liWidth * block.li_per_time);
			jokesCarusel.css('left', 0);
			jokesCarusel.find('li:lt('+movedItems+')').remove();
		});
        return false;
    });

    $('#'+block.id+' .BtnPrev').live('click',function(){
        var jokesCarusel = $('#'+block.ulId),
        	countLi = jokesCarusel.children('li').size(),
			offset = parseInt($('#'+block.counter_id).text()),
			total = parseInt($('#'+block.total_id).text()),
        	liWidth = block.li_width;
        if (jokesCarusel.is(":animated")) return false;

		if (offset <= block.item_in_li){
			movedItems = offset;
			offset = total - offset;
		} else {
			movedItems = block.li_per_time;
			offset = offset - 2 * block.item_in_li;
		}

		if (offset < 0){
			offset = 0;
			movedItems = block.li_per_time;
		}
		$.get(block.url + offset, block.GET_params, function(data){
			var start_offset = block.item_in_li == data.countItems ? block.item_in_li : data.countItems;

			$('#'+block.begin_counter_id).text(offset+1);
			$('#'+block.counter_id).text(offset + start_offset);

			jokesCarusel
				.width(liWidth * movedItems*2)
				.prepend(data.content)
				.css('left', liWidth*(-movedItems)+'px')
				.animate({left: '+='+liWidth*movedItems}, 'slow', '', function(){
					jokesCarusel
						.width(liWidth * movedItems)
						.find('li:gt('+(countLi-1)+')').remove();
				});
		}, 'json');
        return false;
    });
}


/*
 * Same as carousel(), but this version takes into consideration only the ul
 * elements that are children of .carousel_container; same with li elements,
 * so the carousel won't break when its elements in turn contain lists of
 * elements. It'll also return false early if the list has only one li element
 * (that is, nothing will happen when btn_next, btn_prev are clicked).
 */
var carouselV2 = function(block){
	$('#'+block.id+' .btn_next').live('click',function(){
		var carousel = $(this).parent().parent().find('.carousel_container > ul'),
			countLi = (typeof(block.count_li) == 'undefined')?carousel.children('li').length:block.count_li,
			liWidth = block.li_width,
			maxLeft = (countLi-1*block.li_in_row)*-liWidth,
			carusLeft = carousel.css('left') == 'auto' ? 0 : parseInt(carousel.css('left'));

		if (countLi == 1 || carousel.is(':animated')) return false;
		if (carusLeft > maxLeft || (carusLeft == 0 && countLi != 1) || (carusLeft == -liWidth*block.li_in_row && countLi != 2)) {
			carousel.animate({left: '-='+liWidth*block.li_in_row}, 'slow');

			if(block.counter_id) {
                $('#'+block.counter_id).text(parseInt($('#'+block.counter_id).text())+1);
            }

            if(block.notCyclic) {
            	if ((carusLeft - block.li_in_row*liWidth) == maxLeft){
                  $(this).hide();
            	}
                $(this).parent().find('.btn_prev').show();
            }

		} else if (carusLeft < maxLeft) {
			carousel.animate({left: '-='+liWidth*block.li_in_row}, 'slow');

			$(this).addClass('notAble');
		} else if(!block.notCyclic) {
            var temp = carousel.html();

			carousel
				.width(carousel.width()*2)
				.append(temp)
				.animate({left: '-='+liWidth*block.li_in_row}, 'slow', '', function(){
					carousel
						.width(carousel.width()/2)
						.css('left', '0px')
						.children('li:lt('+countLi+')').remove();
				});
                
            if(block.counter_id) {
                $('#'+block.counter_id).text(1);
            }
		}
		if (typeof(block.function_next) == 'function'){
			(block.function_next)();
		}
		return false;
	});
	$('#'+block.id+' .btn_prev').live('click',function(){
		var carousel = $(this).parent().parent().find('.carousel_container > ul'),
		    countLi = (typeof(block.count_li) == 'undefined')?carousel.children('li').length:block.count_li,
			carusLeft = carousel.css('left') == 'auto' ? 0 :parseInt(carousel.css('left')),
			liWidth = block.li_width;
            
		if (countLi == 1 || carousel.is(':animated')) return false;
		if (carusLeft == -liWidth*block.li_in_row) {
			carousel.animate({left: '+='+liWidth*block.li_in_row}, 'slow');

			if(block.counter_id) {
                $('#'+block.counter_id).text(parseInt($('#'+block.counter_id).text())-1);
            }

            if(block.notCyclic) {
                $(this).hide();
                $(this).parent().find('.btn_next').show();
            }

			$(this).addClass('notAble');
		} else if (carusLeft < 0 || carousel.find('li:first').children().length == 0) {
			carousel.animate({left: '+='+liWidth*block.li_in_row}, 'slow');

            if(block.counter_id) {
                $('#'+block.counter_id).text(parseInt($('#'+block.counter_id).text())-1);
            }

            $(this).parent().find('.btn_next').show();
			if (carusLeft == -liWidth) {
				$(this).addClass('notAble');
			}
		} else if(!block.notCyclic) {
            var temp = carousel.html();

			carousel
				.width(carousel.width()*2)
				.prepend(temp)
				.css('left', liWidth*(-countLi)+'px')
				.animate({left: '+='+liWidth*block.li_in_row}, 'slow', '', function(){
					carousel
						.width(carousel.width()/2)
						.children('li:gt('+(countLi-1)+')').remove();
				});
			$('#'+block.counter_id).text(countLi/block.li_in_row);
		}
		if (typeof(block.function_prev) == 'function'){
			(block.function_prev)();
		}
		return false;
	});
}

var carouselAJAX = function(block){
    $('#'+block.id+' .btn_next').live('click',function(){
        var jokesCarusel = $(this).parent().parent().find('.carousel_container ul'),
        	countLi = jokesCarusel.find('li').size(),
        	liWidth = block.li_width,
        	maxLeft = (countLi-1*block.li_in_row)*-liWidth,
        	carusLeft = jokesCarusel.css('left') == 'auto' ? 0 :parseInt(jokesCarusel.css('left'));
        if (jokesCarusel.is(":animated")) return false;
        $(this).parent().find('a.btn_prev').show();
        if (carusLeft > maxLeft-liWidth || carusLeft == 0  || carusLeft == -liWidth) {
            if (jokesCarusel.find('li:last').children().length == 0) {
                $.post(_LANG_URL + block.url + (countLi - 1) + '/', {}, function(data){
                    jokesCarusel.find('li:last').replaceWith(data);
                    countLi = jokesCarusel.find('li').size();
                    jokesCarusel.width(liWidth*countLi);
                    if (carusLeft == maxLeft) {
                        $(this).hide();
                    }
                });
            }
            jokesCarusel.animate({left: '-='+liWidth*block.li_per_time}, 'slow');
        } else if (maxLeft - carusLeft == 2*liWidth) {
            jokesCarusel.animate({left: '-='+liWidth}, 'slow');
            $(this).hide();
        };
        return false;
    });

    $('#'+block.id+' .btn_prev').live('click',function(){
        var jokesCarusel = $(this).parent().parent().find('.carousel_container ul');
			carusLeft = parseInt(jokesCarusel.css('left'));
        	liWidth = block.li_width;
        if (jokesCarusel.is(":animated")) return false;
		$(this).parent().find('a.btn_next').show();
        if (carusLeft == -liWidth) {
            jokesCarusel.animate({left: '+='+liWidth}, 'slow');
			$(this).hide();
        } else if (carusLeft < 0 || jokesCarusel.find('li:first').children().length == 0) {
            jokesCarusel.animate({left: '+='+liWidth*block.li_per_time}, 'slow');
            if (carusLeft == -liWidth*block.li_per_time) {
                $(this).hide();
            }
        };
        return false;
    });	
}

var showAllTopnewsImages = function(){
	var block = $('div.NewFeaturedNews');
	if (block.find('div.TabContent:eq(1)').find('a img').attr('src') == ''){
		block.find('div.TabContent').each(function(i){
			$(this).find('a img').attr('src', topnewsImages[i]);
		});	
	}
}

var cssFix = function(){

  var u = navigator.userAgent.toLowerCase(),

  is = function(t){return (u.indexOf(t)!=-1)};

  $("html").addClass([

    (!(/opera|webtv/i.test(u))&&/msie (\d)/.test(u))?('ie ie'+RegExp.$1)

      :is('firefox/2')?'gecko ff2'

      :is('firefox/3')?'gecko ff3'

      :is('gecko/')?'gecko'

      :is('opera/9')?'opera opera9':/opera (\d)/.test(u)?'opera opera'+RegExp.$1

      :is('konqueror')?'konqueror'

      :is('applewebkit/')?'webkit safari'

      :is('mozilla/')?'gecko':'',

    (is('x11')||is('linux'))?' linux'

      :is('mac')?' mac'

      :is('win')?' win':''

  ].join(''));

}();

function dump(event)
{
    var newResult = '{ ';
    for (var prop in event )
    newResult += prop + ': ' + event[prop] + ', ';
    newResult = newResult.substr(0, newResult.length - 2) + ' }';

    alert(newResult);
}

String.prototype.trim = function() {
	return this.replace(/^\s+|\s+$/g, '');
}

function validate_email(str){
	var email_regular = new RegExp(/^([a-z0-9_\-\.]+)@[a-z0-9\-]+(\.[a-z0-9\-]+)*(\.[a-z]{2,3})$/i);
	return email_regular.test(str);
}

function validate_tel(str){
	var tel_regular = new RegExp(/^(\+?[0-9]{10,})$/i);
	return tel_regular.test(str);
}

var ProfileAuthtorizeOpenWindows = 0;

/* this is content from jquery.popupwin.js. it needed for popup login */
(function($){
	$.fn.popupWin = function(options){
		
		var $self=$(this);
		var def = {
				'title'		:	"Popup",
				'close'		:	"X",
				'content'	:	"Hello",
				'type'		:	"",
				'opacity'	:	"true",
				'plugins'	:	""
			};
		var opt=$.extend(def,options);
		$(this).click(function(){
			opt.isMail = false;
			if ($(this).hasClass('mail')) {
				opt.returnUrl = $(this).attr('href');
				opt.isMail = true;
			}
			
			$(this).buildPopup(opt);
			return false;
		});
	};
	$.fn.extend({
		buildPopup:	function(opt){
			if (0 < ProfileAuthtorizeOpenWindows) return false;
			if (opt.test == 1) return false;
			
			var cl = opt.opacity == "true" ? "popupWin" : "popupWin smallWin";
			var $p = $("<div class="+cl+">&nbsp;</div>").appendTo("body");
			if (opt.opacity == "true") {
				$('<div class="o">&nbsp;</div>').css("height", $(document).height()).prependTo($p);
			}
			var $c = $('<div class="c">&nbsp;</div>').html('<h3 class="title">'+opt.title+'</h3>'+ (opt.type == 'message' ? '<div class="content"><div class="message">' + opt.content + '</div></div>' : '<div class="content">'+opt.content+'</div>')).appendTo($p);
			$('<a href="#" class="close">&nbsp;</a>').html(opt.close).appendTo($p.children().children("h3")).click(function(){
				$p.remove();
				ProfileAuthtorizeOpenWindows = 0;
				return false;
			});
			$p.find(".f .close").click(function(){
				$p.remove();
				ProfileAuthtorizeOpenWindows = 0;
				return false;
			});
			$('div.popupWin form input[name=nick]').focus();
			opt.returnUrlPreviousState = $('div.popupWin form input[name=return_url]').val();
			
			if (opt.isMail) {
				$('div.popupWin form input[name=return_url]').val(opt.returnUrl);
			} else {
				if (typeof(globalReturnUrl) != 'undefined'){
					$('div.popupWin form input[name=return_url]').val(globalReturnUrl);
				} else {
				  $('div.popupWin form input[name=return_url]').val(opt.returnUrlPreviousState);
				}				
			}
			
			if (opt.plugins) eval(opt.plugins);
			ProfileAuthtorizeOpenWindows++;
		}
	});
})(jQuery);

/*
* Function to increase count of video-views.
* DO NOT DELETE !
*/
function playsStarted(vid, video_title, category_name) {
	jQuery.get ('http://video.tochka.net/ajax/watched/'+vid+'/', {},
		function(data, status) {}, 
		'html'
	);
    if(vid == 219390) {
        jQuery.get ('http://ad.adriver.ru/cgi-bin/click.cgi?sid=1&ad=256631&bt=21&pid=529293&bid=993040&bn=993040&rnd=1153585711');
    }
	return false;
}

jQuery(document).ready(function() {
<!--
// -----------------------------------------------------------------------------
// Globals
// Major version of Flash required
var requiredMajorVersion = 8;
// Minor version of Flash required
var requiredMinorVersion = 0;
// Minor version of Flash required
var requiredRevision = 0;
// -----------------------------------------------------------------------------
// -->
//if(!document.getElementById('html5-player')){
    var hasReqestedVersion = DetectFlashVer(requiredMajorVersion, requiredMinorVersion, requiredRevision);
    var hasReqestedVersion_express_install = DetectFlashVer(10, 1, 0);
    if(!hasReqestedVersion) {
    	jQuery("#html5-player").show();
        jQuery("#html5-player").next('embed').hide();
        jQuery("#html5-player").next('object').hide();
    }else{
        if(!hasReqestedVersion_express_install){
            jQuery("#plr #single").hide();
            jQuery("#expr_install_obj").show();
        }
    }
//}

});

/*
 * Same as carousel(), but this version takes into consideration only the ul
 * elements that are children of .carousel_container; same with li elements,
 * so the carousel won't break when its elements in turn contain lists of
 * elements. It'll also return false early if the list has only one li element
 * (that is, nothing will happen when btn_next, btn_prev are clicked).
 */
var carouselV2 = function(block){
	$('#'+block.id+' .btn_next').live('click',function(){
		var carousel = $(this).parent().parent().find('.carousel_container > ul'),
			countLi = carousel.children('li').length,
			liWidth = block.li_width,
			maxLeft = (countLi-1*block.li_in_row)*-liWidth,
			carusLeft = carousel.css('left') == 'auto' ? 0 : parseInt(carousel.css('left'));

		if (countLi == 1 || carousel.is(':animated')) return false;
		if (carusLeft > maxLeft || (carusLeft == 0 && countLi != 1) || (carusLeft == -liWidth*block.li_in_row && countLi != 2)) {
			carousel.animate({left: '-='+liWidth*block.li_in_row}, 'slow');

			if(block.counter_id) {
                $('#'+block.counter_id).text(parseInt($('#'+block.counter_id).text())+1);
            }

            if(block.notCyclic) {
                $(this).hide();
                $(this).parent().find('.btn_prev').show();
            }

			$(this).parent().find('a.notAble').removeClass('notAble');
		} else if (carusLeft < maxLeft) {
			carousel.animate({left: '-='+liWidth*block.li_in_row}, 'slow');

			$(this).addClass('notAble');
		} else if(!block.notCyclic) {
            var temp = carousel.html();

			carousel
				.width(carousel.width()*2)
				.append(temp)
				.animate({left: '-='+liWidth*block.li_in_row}, 'slow', '', function(){
					carousel
						.width(carousel.width()/2)
						.css('left', '0px')
						.children('li:lt('+countLi+')').remove();
				});
                
            if(block.counter_id) {
                $('#'+block.counter_id).text(1);
            }
		}
		if (typeof(block.function_next) == 'function'){
			(block.function_next)();
		}
		return false;
	});
	$('#'+block.id+' .btn_prev').live('click',function(){
		var carousel = $(this).parent().parent().find('.carousel_container > ul'),
			countLi = carousel.children('li').length,
			carusLeft = carousel.css('left') == 'auto' ? 0 :parseInt(carousel.css('left')),
			liWidth = block.li_width;
            
		if (countLi == 1 || carousel.is(':animated')) return false;
		if (carusLeft == -liWidth*block.li_in_row) {
			carousel.animate({left: '+='+liWidth*block.li_in_row}, 'slow');

			if(block.counter_id) {
                $('#'+block.counter_id).text(parseInt($('#'+block.counter_id).text())-1);
            }

            if(block.notCyclic) {
                $(this).hide();
                $(this).parent().find('.btn_next').show();
            }

			$(this).addClass('notAble');
		} else if (carusLeft < 0 || carousel.find('li:first').children().length == 0) {
			carousel.animate({left: '+='+liWidth*block.li_in_row}, 'slow');

            if(block.counter_id) {
                $('#'+block.counter_id).text(parseInt($('#'+block.counter_id).text())-1);
            }

			$(this).parent().find('a.notAble').removeClass('notAble');
			if (carusLeft == -liWidth) {
				$(this).addClass('notAble');
			}
		} else if(!block.notCyclic) {
            var temp = carousel.html();

			carousel
				.width(carousel.width()*2)
				.prepend(temp)
				.css('left', liWidth*(-countLi)+'px')
				.animate({left: '+='+liWidth*block.li_in_row}, 'slow', '', function(){
					carousel
						.width(carousel.width()/2)
						.children('li:gt('+(countLi-1)+')').remove();
				});
			$('#'+block.counter_id).text(countLi/block.li_in_row);
		}
		if (typeof(block.function_prev) == 'function'){
			(block.function_prev)();
		}
		return false;
	});
};

/* 
 * Calculating links count in soc-networks
 *      callback = function (url, result) {}
 *         result = {vk: 0, fb: 0, tw: 0, sum: 0}
 *      callbackStep = function (url, soc, count) {}
 *         soc = vk | fb | tw 
 */
var socLinkData = {};
function calculateSocLinkTotal(linkUrl, callback, callbackStep) {
    if (socLinkData[linkUrl] != undefined)
        return false;
    socLinkData[linkUrl] = {vk: null, fb: null, tw: null, sum: 0, callback: callback, callbackStep: callbackStep};
    calculateLinkVk(linkUrl);
    calculateLinkFb(linkUrl);
    calculateLinkTw(linkUrl);
}
function calculateSocLinkCallback(linkUrl) {
    if ((socLinkData[linkUrl].vk != null) && (socLinkData[linkUrl].fb != null) && (socLinkData[linkUrl].tw != null)) {
        socLinkData[linkUrl].sum = socLinkData[linkUrl].vk + socLinkData[linkUrl].fb + socLinkData[linkUrl].tw;
        delete socLinkData[linkUrl].callbackStep;
        var callback = socLinkData[linkUrl].callback;
        delete socLinkData[linkUrl].callback;
        var result = socLinkData[linkUrl];
        delete socLinkData[linkUrl];
        callback(linkUrl, result);
    }
}
var vkIndexRefUrl = [];
function calculateLinkVk(linkUrl) {
    if (typeof(VK) == 'undefined')
        VK = {}
    vkIndexRefUrl.push(linkUrl);
    VK.Share = {}
    VK.Share.count = function(index, count) {
        socLinkData[vkIndexRefUrl[index - 1]].vk = parseInt(count);
        if (socLinkData[vkIndexRefUrl[index - 1]].callbackStep != null)
            socLinkData[vkIndexRefUrl[index - 1]].callbackStep(vkIndexRefUrl[index - 1], 'vk', socLinkData[vkIndexRefUrl[index - 1]].vk);
        calculateSocLinkCallback(vkIndexRefUrl[index - 1]);
    }
    $.getJSON('http://vkontakte.ru/share.php?act=count&index=' + vkIndexRefUrl.length + '&url=' + linkUrl + '&format=json&callback=?');
}
function calculateLinkFb(linkUrl) {
    $.getJSON('https://api.facebook.com/method/fql.query?query=select total_count, url from link_stat where url="' +linkUrl  + '"&format=json&callback=?',
        function(data) {
            socLinkData[data[0].url].fb = parseInt(data[0]['total_count']);
            if (socLinkData[data[0].url].callbackStep != null)
                socLinkData[data[0].url].callbackStep(data[0].url, 'fb', socLinkData[data[0].url].fb);
            calculateSocLinkCallback(data[0].url);
        }
    );
}
function calculateLinkTw(linkUrl) {
    $.getJSON('http://urls.api.twitter.com/1/urls/count.json?url=' + linkUrl + '&callback=?',
        function(data) {
            socLinkData[data.url].tw = parseInt(data.count);
            if (socLinkData[data.url].callbackStep != null)
                socLinkData[data.url].callbackStep(data.url, 'tw', socLinkData[data.url].tw);
            calculateSocLinkCallback(data.url);
        }
    );
}
/*
 * End calculating soc-links
 */

 /* common_tochka.js */ 
//hello Kitty
if (typeof getSelTextWorked == 'undefined'){
	var getSelTextWorked=function(){
		var txt = '';
		if (window.getSelection!=undefined){
			txt = window.getSelection();
		}else if (document.getSelection!=undefined){
			txt = document.getSelection();
		}else if (document.selection!=undefined){
			txt = document.selection.createRange().text;
		}
		return txt;
	}
}

if (typeof ctrlEnter == 'undefined'){
	var ctrlEnter=function(e)
	{
	    if(((e.keyCode == 13) || (e.keyCode == 10)) && (e.ctrlKey == true)){
			var descr = getSelTextWorked();
		    var feedbackInit = {
		    	'type' : 'error',
		    	'link' : location.href
		    }
		    if (descr != ''){
		    	feedbackInit.messageText = '%ERROR%: "' + descr + '"';
		    }
		    
		    $('a.feedback').feedback(feedbackInit);
	    }
	}
}

function validate_email(str){
	var email_regular = new RegExp(/^([a-z0-9_\-\.]+)@[a-z0-9\-]+(\.[a-z0-9\-]+)*(\.[a-z]{2,3})$/i);
	return email_regular.test(str);
}

$(document).ready(function() {
    //$(document).keypress(function(event){ctrlEnter(event)});
	$('#headerDropdown').click(function(){
		$(this).find('ul').show();
		$(this).addClass('active');
	});
	$('#headerDropdown').mouseleave(function(){
		$(this).find('ul').hide();
		$(this).removeClass('active');
	});

	$('#tochka_header .navigationBar .barMenu').mouseenter(function(){
		$('#portal_sections').show().addClass('activePopUp');
	});
	$('#tochka_header .navigationBar .barMenu').mouseleave(function(){
		$('#portal_sections').hide().removeClass('activePopUp'); 
	});

	/* MOUSE OVER AND PRESSDOWN
	$('input.submitButton,div.dropdown,input.button,a.red,a.button,div.button span,span.button,a.minimizeButton,a.refresh,a.otherCityDropDown,span.dropdownMenuItem img').mouseover(function(){
		$(this).addClass('MouseOver');
	});
	$('input.submitButton,div.dropdown,input.button,a.red,a.button,div.button span,span.button,a.minimizeButton,a.refresh,a.otherCityDropDown,span.dropdownMenuItem img').mousedown(function(){
		$(this).addClass('MousePressDown');
	});
	$('input.submitButton,div.dropdown,input.button,a.red,a.button,div.button span,span.button,a.minimizeButton,a.refresh,a.otherCityDropDown,span.dropdownMenuItem img').mouseup(function(){
		$(this).removeClass('MousePressDown');
	});
	$('input.submitButton,div.dropdown,input.button,a.red,a.button,div.button span,span.button,a.minimizeButton,a.refresh,a.otherCityDropDown,span.dropdownMenuItem img').mouseleave(function(){
		$(this).removeClass('MouseOver');
		$(this).removeClass('MousePressDown');
	});
	*/

	/*$('div.select').find('input').click(function(){
		$(this).parent().find('ul').show();
	});*/

		$('#QuickSearchGadget div.dropdown ul').click(function(){
			if($(this).hasClass("disable_old_events")) {
				return true;
			}
			$(this).toggleClass('active');
			$(this).find('li').toggle().filter(':first').show();
			$(this).parents('li.gadget').css('z-index','310');
			$(this).parents('li.gadget').next().css('z-index','300');
			return false;
		});
		
		$('#QuickSearchGadget div.dropdown ul').mouseleave(function(){
			if(!$(this).parent().hasClass("links")) {  
				$(this).removeClass('active');
				$(this).find('li').hide();
				if(!$(this).hasClass("disable_old_events")) {
					$(this).find('li').filter(':first').show();
				} else {
					$(this).find('li').filter('.selected').show();
				}
			}
		});
		if (typeof $.fn.feedback == 'undefined'){
		// Feedback


		$.fn.feedback = function(options){
			var domain = typeof mainDomainHttp != 'undefined' ? mainDomainHttp : 'http://tochka.net/',
				activeTab = typeof options != 'undefined' && typeof options.type != 'undefined' ? 'activeTab='+options.type : '',
				messageText = typeof options != 'undefined' && typeof options.messageText != 'undefined' ? 'messageText='+options.messageText : '',
				link = typeof options != 'undefined' && typeof options.link != 'undefined' ? 'fback_location='+options.link : '';
			$.getScript(domain+'feedbackform/?' + activeTab + '&' + messageText + '&' + link,
				function(){
					if ($('div.feedback').children().length == 0){
						$('body').append(feedback_form.data);
					} else {
						$('div.feedback').replaceWith(feedback_form.data);
					}
					$('div.feedback').each(setFeedback);
				}
			);
		};
		var setFeedback = function(){
			var self = this;
			var con = $(self).children(".c");
			$(self).children(".opacity").height($(document).height());
			//	$(window).resize(function(){
			//		$(self).height($(document).height());
			//	});
			$(con).css({
				marginTop: function(){
					return parseInt($(con).height()/-2);
				},
				marginLeft: '-240px'
		  	});
			$('div.feedback').find("a.fback_close, input.fback_close").live('click',function(){
				$('div.feedback').remove();
			});
			$(self).find("ul.tabsLeft").tabs();
		};
		/* Automatically apply to any a.feedback */
		$('a.feedback').click(function(){
			$(this).feedback();
		});
		
		// Feedback		
			$('#fback_submit').live('click',function(){
				var fback_text = $('#fback_text').val(),
					fback_type = $('div.feedback').find('ul.tabsLeft').find('li.active').attr('id'),
					fback_email = $('#fback_email').val();
				if (fback_text.trim() == ''){
					alert(typeof feedback_validate_message != 'undefined' ? feedback_validate_message : 'ÐŸÐ¾Ð»Ðµ "Ð¢ÐµÐºÑÑ‚ ÑÐ¾Ð¾Ð±Ñ‰ÐµÐ½Ð¸Ñ" Ð½Ðµ Ð·Ð°Ð¿Ð¾Ð»Ð½ÐµÐ½Ð¾');
					return false;
				}
				if (fback_email.trim() == '' || !validate_email(fback_email.trim())){
					alert(typeof feedback_validate_email != 'undefined' ? feedback_validate_email : 'ÐŸÐ¾Ð»Ðµ Email Ð½Ðµ Ð·Ð°Ð¿Ð¾Ð»Ð½ÐµÐ½Ð¾ Ð¸Ð»Ð¸ Ð·Ð°Ð¿Ð¾Ð»Ð½ÐµÐ½Ð¾ Ð½ÐµÐºÐ¾Ñ€Ñ€ÐµÐºÑ‚Ð½Ð¾');
					return false;
				}
				$.post('/feedbacksend', {
					'fback_email': fback_email,
					'fback_type': fback_type,
					'fback_text': fback_text,
					'fback_location': location.href
				}, function(data){
					$('div.feedback').replaceWith(data);
					$('div.feedback').find('div.c').css({
						marginTop: function(){
							return parseInt($(this).height()/-2);
						},
						marginLeft:  function(){
							return parseInt($(this).width()/-2);
						}
				  	});
				});
			});
		
		}
		

});

 /* global.js */ 
//what browser
	var cssFix = function(){
	$('html').removeClass('opera9');
	var u = navigator.userAgent.toLowerCase(),
	is = function(t){return (u.indexOf(t)!=-1)};
	$("html").addClass([
	  (!(/opera|webtv/i.test(u))&&/msie (\d)/.test(u))?('ie ie'+RegExp.$1)
		:is('firefox/2')?'gecko ff2'
		:is('firefox/3')?'gecko ff3'
		:is('gecko/')?'gecko'
		:is('opera/')?'opera'+Math.floor(window.opera.version())
		:is('konqueror')?'konqueror'
		:is('applewebkit/')?'webkit safari'
		:is('mozilla/')?'gecko':'',
	  (is('x11')||is('linux'))?' linux'
		:is('mac')?' mac'
		:is('win')?' win':''
	].join(''));
  }();
//end what browser

$(document).ready(function(){

//Tabs
	$('.Tabs').each(function(){
	  $(this).find('li:first').addClass('active TabsFirstActiveLi');
	  $(this).find('li:last').addClass('TabsLastLi');
	  $(this).find('li:first').removeClass('TabsLastLi');
	 });
	 
		$('.Tabs li').click(function() {
			$(this).parent().find('li').removeClass('active TabsPrevLi TabsLastLi TabsLastActiveLi TabsFirstLi TabsFirstActiveLi');
			$(this).addClass('active');
			$(this).prev().addClass('TabsPrevLi');
			
			//for last li
			var size_li = $(this).parent().find('li').size()-1;		
			if ($(this).parent().find('li').index(this)==size_li) {
				$(this).parent().find('li:last').addClass('TabsLastActiveLi');
			}
			else
				$(this).parent().find('li:last').addClass('TabsLastLi');
			
			//for first li
			if ($(this).parent().find('li').index(this)==0) {
				$(this).parent().find('li:first').addClass('TabsFirstActiveLi');
			}
			else
				$(this).parent().find('li:first').addClass('TabsFirstLi');	

			// custom action for tab click
			if ($(this).hasClass('fakeTab')){
				var selTab = $(this).find('a').attr('href').replace('#', '');
				contentBlockTabClick(selTab);
			}
				
		});

	$('ul.Tabs>li').live('click', function(){
		$(this).parent().find('li').removeClass('current');
		$(this).addClass('current');
		if(!$(this).parent().hasClass("disable_pages")) {
			selTab = $(this).find('a').attr('href').replace('#', '');
			$(this).parents('.Block').find('.TabContent').hide().filter('#'+selTab).show();
		}
		return false;
	});		
		
//TabsInner
	$('.TabsInner').each(function(){
		$(this).find('li:first').addClass('active TabsFirstActiveLi');
		$(this).find('li:last').addClass('TabsLastLi');
	});
		$('.TabsInner li').click(function() {
			$(this).parent().find('li').removeClass('active TabsPrevLi TabsLastLi TabsLastActiveLi TabsFirstLi TabsFirstActiveLi');
			$(this).addClass('active');
			$(this).prev().addClass('TabsPrevLi');
			
			//for last li
			var size_li = $(this).parent().find('li').size()-1;		
			if ($(this).parent().find('li').index(this)==size_li) {
				$(this).parent().find('li:last').addClass('TabsLastActiveLi');
				}
			else
				$(this).parent().find('li:last').addClass('TabsLastLi');
			
			//for first li
			if ($(this).parent().find('li').index(this)==0) {
				$(this).parent().find('li:first').addClass('TabsFirstActiveLi');
				}
			else
				$(this).parent().find('li:first').addClass('TabsFirstLi');				
		});

	$('ul.TabsInner>li').live('click', function(){
		$(this).parent().find('li').removeClass('current');
		$(this).addClass('current');
		if(!$(this).parent().hasClass("disable_pages")) {
			selTab = $(this).find('a').attr('href').replace('#', '');
			$(this).parents('.Block').find('.TabContent').hide().filter('#'+selTab).show();
		}
		return false;
	});
	
//Popup
	$('.Popup').each(function(index){ 
		if($(this).hasClass('noMiddle')==false){  
		var m_l = Math.round(((-1)*$(this).width())/2);
		var m_t = Math.round(((-1)*$(this).height())/2);
		$(this).css({ marginLeft: m_l+'px', marginTop: m_t+'px' });
		}
	});
	$('.Popup .ic_close').live('click',function(){
		$(this).parents('.Popup').removeClass('db').css('visibility','hidden');
		$(this).parents('body').find('.PopupOverlay').removeClass('db');
		return false;
	});
	
//DropDownBlock
	$('.DD_Button').click(function(){	
		if ($(this).next().css('display')=='block') {
			$(this).next().hide();
		}
		else {
			$(this).next().show();
		}
		return false;
	});	
	
	$('.DD_List li').click(function(){
		$(this).parent('ul').prev().text($(this).text());
		$(this).parent('ul').hide();
	});

//Other
	
});	



/* carousel_framework temp version */
var carousel_framework = function(block){
    $('#'+block.id+' .BtnNext').live('click',function(){
        var jokesCarusel = $('#'+block.id).find('.Carusel ul:first'),
            countLi = jokesCarusel.children('.LiCol').size(),
            liWidth = block.li_width,
            maxLeft = ((Math.ceil(countLi/block.li_in_row)-1)*block.li_in_row)*-liWidth,
            carusLeft = jokesCarusel.css('left') == 'auto' ? 0 :parseInt(jokesCarusel.css('left')),
            temp = jokesCarusel.html(),
            infinite_next = ((countLi+block.li_in_row)-(block.li_in_row*$('#'+block.counter_id).text()));

        if((infinite_next <= block.li_in_row) && ($('#'+block.infinite).selector=='#false'))
            return false;
        if (jokesCarusel.is(':animated'))
            return false;
        if (carusLeft > maxLeft || (carusLeft == 0 && (countLi > block.li_in_row)) || (carusLeft == -liWidth*block.li_in_row && Math.ceil(countLi/block.li_in_row) != 2)) {
            jokesCarusel.animate({left: '-='+liWidth*block.li_in_row}, 'slow');
            $('#'+block.counter_id).text(parseInt($('#'+block.counter_id).text())+1);
            $(this).parent().find('a.notAble').removeClass('notAble');
        } else if (carusLeft < maxLeft) {
            jokesCarusel.animate({left: '-='+liWidth*block.li_in_row}, 'slow');
            $('#'+block.counter_id).text(parseInt($('#'+block.counter_id).text())+1);
            $(this).addClass('notAble');
        } else {
            jokesCarusel
                .width(jokesCarusel.width()*2)
                .append(temp)
                .animate({left: '-='+liWidth*block.li_in_row}, 'slow', '', function(){
                        jokesCarusel
                                .width(jokesCarusel.width()/2)
                                .css('left', '0px')
                                .find('.LiCol:lt('+countLi+')').remove();
                    }
                );
            $('#'+block.counter_id).text(1);
        }
        if (typeof(block.function_next) == 'function'){
            (block.function_next)();
        }
        return false;
    });
    $('#'+block.id+' .BtnPrev').live('click',function(){
        var jokesCarusel = $('#'+block.id).find('.Carusel ul:first'),
            countLi = jokesCarusel.children('.LiCol').size(),
            carusLeft = jokesCarusel.css('left') == 'auto' ? 0 :parseInt(jokesCarusel.css('left')),
            liWidth = block.li_width,
            temp = jokesCarusel.html();

        if(($('#'+block.counter_id).text()==1) && ($('#'+block.infinite).selector=='#false'))
            return false;
        if (jokesCarusel.is(':animated'))
            return false;
        if (carusLeft == -liWidth) {
            jokesCarusel.animate({left: '+='+liWidth*block.li_in_row}, 'slow');
            $('#'+block.counter_id).text(parseInt($('#'+block.counter_id).text())-1);
            $(this).addClass('notAble');
        } else if (carusLeft < 0 || jokesCarusel.find('li:first').children().length == 0) {
            jokesCarusel.animate({left: '+='+liWidth*block.li_in_row}, 'slow');
            $('#'+block.counter_id).text(parseInt($('#'+block.counter_id).text())-1);
            $(this).parent().find('a.notAble').removeClass('notAble');
            if (carusLeft == -liWidth) {
                $(this).addClass('notAble');
            }
        } else {
            jokesCarusel
                .width(jokesCarusel.width()*2)
                .prepend(temp)
                .css('left', liWidth*(-countLi)+'px')
                .animate({left: '+='+liWidth*(countLi % block.li_in_row == 0 ? block.li_in_row : countLi % block.li_in_row)}, 'slow', '', function(){
                        jokesCarusel
                                .width(jokesCarusel.width()/2)
                                .find('.LiCol:gt('+(countLi-1)+')').remove();
                });
            $('#'+block.counter_id).text(Math.ceil(countLi/block.li_in_row));
        }
        if (typeof(block.function_prev) == 'function'){
                (block.function_prev)();
        }			
        return false;
    });
}
/* end carousel_framework temp version */



/* carousel_framework temp version */
var carousel_framework_gallery = function(block){
	$('#'+block.id+' .BtnForward').live('click',function(){
		var jokesCarusel = $(this).parent().parent().find('.Carusel ul:first'),
			countLi = jokesCarusel.children('li').size(),
			liWidth = block.li_width,
			maxLeft = (countLi-1*block.li_in_row)*-liWidth,
			carusLeft = jokesCarusel.css('left') == 'auto' ? 0 :parseInt(jokesCarusel.css('left')),
			temp = jokesCarusel.html();
		if (jokesCarusel.is(':animated')) return false;
		if (carusLeft > maxLeft || (carusLeft == 0 && countLi != 1) || (carusLeft == -liWidth*block.li_in_row && countLi/block.li_in_row != 2)) {
	
			jokesCarusel.animate({left: '-='+liWidth*block.li_in_row}, 'slow');
			
			$('#'+block.counter_id).text(parseInt($('#'+block.counter_id).text())+1);

			$(this).parent().find('a.notAble').removeClass('notAble');
		} else if (carusLeft < maxLeft) {
			jokesCarusel.animate({left: '-='+liWidth*block.li_in_row}, 'slow');

			$(this).addClass('notAble');
		} else {
			jokesCarusel
				.width(jokesCarusel.width()*2)
				.append(temp)
				.animate({left: '-='+liWidth*block.li_in_row}, 'slow', '', function(){
					jokesCarusel
						.width(jokesCarusel.width()/2)
						.css('left', '0px')
						.find('li:lt('+countLi+')').remove();
				});
			$('#'+block.counter_id).text(1);
		}
		if (typeof(block.function_next) == 'function'){
			(block.function_next)();
		}		
		return false;
	});
	$('#'+block.id+' .BtnBack').live('click',function(){
		var jokesCarusel = $(this).parent().parent().find('.Carusel ul:first'),
			countLi = jokesCarusel.children('li').size(),
			carusLeft = jokesCarusel.css('left') == 'auto' ? 0 :parseInt(jokesCarusel.css('left')),
			liWidth = block.li_width,
			temp = jokesCarusel.html();

		if (jokesCarusel.is(':animated')) return false;
		if (carusLeft == -liWidth) {
			jokesCarusel.animate({left: '+='+liWidth*block.li_in_row}, 'slow');

			$('#'+block.counter_id).text(parseInt($('#'+block.counter_id).text())-1);
			
			$(this).addClass('notAble');
		} else if (carusLeft < 0 || jokesCarusel.find('li:first').children().length == 0) {
			jokesCarusel.animate({left: '+='+liWidth*block.li_in_row}, 'slow');

			$('#'+block.counter_id).text(parseInt($('#'+block.counter_id).text())-1);

			$(this).parent().find('a.notAble').removeClass('notAble');
			if (carusLeft == -liWidth) {
				$(this).addClass('notAble');
			}
		} else {
			jokesCarusel
				.width(jokesCarusel.width()*2)
				.prepend(temp)
				.css('left', liWidth*(-countLi)+'px')
				.animate({left: '+='+liWidth*block.li_in_row}, 'slow', '', function(){
					jokesCarusel
						.width(jokesCarusel.width()/2)
						.find('li:gt('+(countLi-1)+')').remove();
				});
			$('#'+block.counter_id).text(countLi/block.li_in_row);
		}
		if (typeof(block.function_prev) == 'function'){
			(block.function_prev)();
		}			
		return false;
	});
};
/* end carousel_framework temp version */

/* Comments */
$('#Comments .DropdownBox').live('mouseover', function(){
	w=$(this).width()-2;
	h=$(this).height()-1;
	$(this).find(".dropdown").show();
	$(this).find(".Btn").addClass("hover");
	$(this).find(".dropdown").css({width:+w+"px", top:+h+"px"} );
});

$('#Comments .DropdownBox').live('mouseleave', function(){
	$(this).find(".Btn").removeClass("hover");
	$(this).find(".dropdown").hide();
});

$('#Comments .DropdownBox').live('click', function(){
	$(this).find(".Btn").removeClass("hover");
	$(this).find(".dropdown").toggle();
});
/* end Comments */
 /* global_temp.js */ 
//progressBar function, pb_step - Ð¾Ð±Ñ‰ÐµÐµ ÐºÐ¾Ð»-Ð²Ð¾ ÑÐ»ÐµÐ¼ÐµÐ½Ñ‚Ð¾Ð², pb_id - id Ð¿Ñ€Ð¾Ð³Ñ€ÐµÑÑ-Ð±Ð°Ñ€Ð°, pb_prog - ÐºÐ¾Ð»-Ð²Ð¾ Ð°ÐºÑ‚Ð¸Ð²Ð½Ñ‹Ñ… ÑÐ»ÐµÐ¼ÐµÐ½Ñ‚Ð¾Ð²
function progressBar(pb_step, pb_id, pb_prog){
	var pb_w = $('#'+pb_id+'').width();
	var el_w = pb_w/pb_step;
	if(pb_step==0){$('#'+pb_id+'').css({display : 'none'});}
	$('#'+pb_id+'').empty();
	var i=1;
	while (i<=pb_step) {

		switch (i){
			case 1:
			$('#'+pb_id+'').append('<span class="BarEl first"><em class="first_em"></em></span>');
			break;
			case pb_step:
			$('#'+pb_id+'').append('<span class="BarEl last"><em class="last_em"></em></span>');
			break;
			default:
			$('#'+pb_id+'').append('<span class="BarEl "><em></em></span>');
			}													
		i++;
		continue;
	};		
	var i=0;
	$('#'+pb_id+'').children('.BarEl').css({width : ''+el_w-1+'px'});						
	
	$('#'+pb_id+'').children('.BarEl').each(function(){
		if(pb_prog != i){
			$('#'+pb_id+'').children('.BarEl').eq(''+i+'').addClass('result');
		}else{
			return false;
		}
		i++;
	});		
}
//progressBar

//progressBar function, pb_step - Ð¾Ð±Ñ‰ÐµÐµ ÐºÐ¾Ð»-Ð²Ð¾ ÑÐ»ÐµÐ¼ÐµÐ½Ñ‚Ð¾Ð², pb_id - id Ð¿Ñ€Ð¾Ð³Ñ€ÐµÑÑ-Ð±Ð°Ñ€Ð°, pb_prog - ÐºÐ¾Ð»-Ð²Ð¾ Ð°ÐºÑ‚Ð¸Ð²Ð½Ñ‹Ñ… ÑÐ»ÐµÐ¼ÐµÐ½Ñ‚Ð¾Ð²
function progressBarPopUp(pb_step, pb_id, pb_prog){			
	var pb_w = $('#Popup .ProgressBar').width();
	var el_w = pb_w/pb_step;
    if(pb_step==0){$('#'+pb_id+'').css({display : 'none'});}
	$('#Popup .ProgressBar').empty();
    	var i=1;
	while (i<=pb_step) {

		switch (i){
		  case 1:
			$('#Popup .ProgressBar').append('<span class="BarEl first"><em class="first_em"></em></span>');
            break;
			case pb_step:
			$('#Popup .ProgressBar').append('<span class="BarEl last"><em class="last_em"></em></span>');
			break;
            default:
			$('#Popup .ProgressBar').append('<span class="BarEl "><em></em></span>');
            }
		i++;
		continue;
        };
	var i=0;
	$('#Popup .ProgressBar').children('.BarEl').css({width : ''+el_w-1+'px'});

	$('#Popup .ProgressBar').children('.BarEl').each(function(){
	  if(pb_prog != i){
			$('#Popup .ProgressBar').children('.BarEl').eq(''+i+'').addClass('result');
		}else{
		  return false;
		}
		i++;
      });
}
//progressBar

//POPUP function

function opened(id, timeout){
	setTimeout(function() {$('#'+id+'').css({visibility:'visible'}); $('#'+id+'').show();}, timeout);
	}
function closed(id, timeout){
	setTimeout(function() {$('#'+id+'').css({visibility:'hidden'})}, timeout);
	}

$('#pp_close').live('click',function(){
	closed('Popup', 1);
	$(this).parent().parent().prev('.PopupOverlay').hide();
	//obj.parents().find('object').css({visibility : 'visible'});
	//obj.parents().find('embed').css({visibility : 'visible'});
	});

function popUp(pp_setup){

    // delete html struct by pp_setup.pp_id if isset
    $('#'+pp_setup.pp_id+'').remove();

    //add html struct whith pp_setup.pp_id
    $('body').append('<div id="'+pp_setup.pp_id+'" class="Popup"><div class="P_header"><a id="pp_close" class="ic_close fr" href=""></a><div class="clear10"></div></div><div class="P_inner"><div class="clear"></div>/</div></div>');
    obj=$('#'+pp_setup.pp_id+'');

	switch (pp_setup.pp_event){
		case '1':
			obj.removeClass();
			obj.addClass('Popup Authorization '+pp_setup.pp_class+'');
			obj.children('.P_header').empty();
			obj.children('.P_header').prepend('<a id="pp_close" class="ic_close fr" href=""></a><div class="clear10"></div>');
			obj.children('.P_header').prepend(pp_setup.pp_header);
			obj.children('.P_inner').empty();
			obj.children('.P_inner').prepend('<div class="clear"></div>');
			obj.children('.P_inner').prepend(pp_setup.pp_content);
			//obj.parents().find('object').css({visibility : 'hidden'});
			//obj.parents().find('embed').css({visibility : 'hidden'});
			opened(pp_setup.pp_id, pp_setup.pp_param);
			    $('div[type], a[type]').formsTochka();
                $('.PopupOverlay').remove();
				obj.each(function(index){
					var m_l = Math.round(((-1)*$(this).width())/2);
					var m_t = Math.round(((-1)*$(this).height())/2);
					$(this).css({ marginLeft: m_l+'px', marginTop: m_t+'px' });
				});
				$('#'+pp_setup.pp_id+' .or').each(function(index){
					var m_l = Math.round(((-1)*$(this).width())/2);
					$(this).css({ marginLeft: m_l+'px'});
				});

			setTimeout(function(){
				progressBarPopUp(4, 'psword_status', 0);
				$('#Popup input[type="checkbox"]').CheckRadio({'display':'list'});

				if(pp_setup.pp_modal == true && obj.prev().attr('class')!='PopupOverlay db'){
					obj.before('<div class="PopupOverlay"></div>');
					obj.prev('.PopupOverlay').show();
					}
				}, pp_setup.pp_param);

			break;

		case '2':
			setTimeout(function(){closed(pp_setup.pp_id, pp_setup.pp_param)}, pp_setup.pp_param);

            // delete html struct by pp_setup.pp_id
            $('#'+pp_setup.pp_id).prev('.PopupOverlay').remove(); 
            $('#'+pp_setup.pp_id).remove();
			break;
		}


    }
//end POPUP function
//POPUP suggests label
function oneHeight(el, clb){
    try{
        var _el = $('#'+el);
        var _clb = $('.'+clb);
        var h = _clb.height();
        _el.height(h);
    }catch(e) {
        return false;
    }
};
$(document).ready(function(){oneHeight('brandingMainHref', 'Main');});

$("#suggests label").live("mouseover",function(){
    $(this).addClass("checked");
});
$("#suggests label").live("mouseout",function(){
  $(this).removeClass("checked");
});

// UI Tabs Ð”Ð¾Ð±Ð°Ð²Ð»ÐµÐ½Ð¸Ðµ Ð°Ð»ÑŒÑ‚ÐµÑ€Ð½Ð°Ñ‚Ð¸Ð²Ð½Ð¾Ð³Ð¾ Ð°Ñ‚Ñ€Ð¸Ð±ÑƒÑ‚Ð° (container) Ð´Ð»Ñ ÑƒÐºÐ°Ð·Ð°Ð½Ð¸Ñ ÐºÐ¾Ð½Ñ‚ÐµÐ¹Ð½ÐµÑ€Ð° (Ð²Ð¼ÐµÑÐ½Ð¾ title)
$(function() {
    if ($.ui != undefined){
        $.ui.tabs.prototype._oldTabId = $.ui.tabs.prototype._tabId;
        $.ui.tabs.prototype._tabId = function(a) {
            return $(a).attr('container') && $(a).attr('container').replace( /\s/g, "_" ).replace( /[^\w\u00c0-\uFFFF-]/g, "" ) ||
                    $.ui.tabs.prototype._oldTabId(a);
        }
    }    
});

 /* gBtn.js */ 
$(document).ready(function(){
	$('.Btn.noactive, .Btn.active').live('click', function(event){ event.preventDefault(); return false; });					   
});
 /* forms.standart.js */ 
/*
24.06.11 | 13:54
Kazakov Aleksey
*/

/*inisialization*/ 
$(document).ready(function(){ $('div[type], a[type], *[formstandart]').formsTochka(); });

;(function($) {
	
	/*events*/
	$("div[type], div[type] .element_event, div[type] .element_event .info_text, div[type] ul li").live('mouseover mouseout', function(event){ form_event(this,event); });
	$("div[type] .element_edit").live('focus blur', function(event){ form_event(this,event); });
	$("div[type] ul li, body, *").live('mousedown', function(event){ form_event(this,event); });
	$("div[type] .btn_normal_green, div[type], div[type] .but_select, a[type='submit'], a[condition-id], div[type] ul").live('click', function(event){ form_event(this,event);});
	$("div[type] .element_edit").live('keydown keyup', function(event){ form_event(this,event); });
	$("div[type] ul li").live('mouseover mouseout', function(event){ form_event(this,event); });
	
	
	
	/*palgin*/
	$.fn.extend({
    	formsTochka: function(options) {
		   options = $.extend({
             height_min: 60,
			 height_max: 'auto',
			 input_textarea_img:true
           }, options);
		   
		   return this.each(function(index) { 
				new $.Setup(this, options);
			});
    	},
		hasAttr: function(name) {  
		   return this.attr(name) !== undefined && this.attr(name) !== null;
		}
	});
	
	$.Setup = function(element, options){  
		   var placeholder,default_text,val_text,type_e,limit,name,condition_id,condition;
		   var arr_autocomplete = '';
		   
		   var attr = { 
		   	   type_e: $(element).attr('type'),
			   val_text: $(element).hasAttr('value')?$(element).attr('value'):'',
			   placeholder: $(element).hasAttr('placeholder')?$(element).attr('placeholder'):'',
			   name_e: $(element).hasAttr('name')?$(element).attr('name'):'',
			   default_text: $(element).hasAttr('default-text')?$(element).attr('default-text'):'',
			   this_init: $(element).hasAttr('formstandart')?$(element).attr('formstandart'):'',
			   condition: $(element).hasAttr('condition')?$(element).attr('condition'):'',
			   condition_id: $(element).hasAttr('condition-id')?$(element).attr('condition-id'):''
		   };
		   
		   switch(element.nodeName){
			   case 'INPUT':
			   case 'A':
			   case 'DIV':
			   if(element.nodeName=='DIV' || element.nodeName=='A'){
			   		$(element).addClass(attr.type_e);
			   }

				switch(attr.type_e){
					case 'text':
					case 'password':
						if(attr.this_init=='true'){  
							$.TextPassword(element,options,attr);
						}else{
							$.InputPassword(element,options,attr);
						}
						break;
					case 'input':
						$.InputPassword(element,options,attr);
						break;
					case 'submit': 
						$(element).append('<input type="'+attr.type_e+'" />');
						
						break;
					case 'input_textarea':
						var e_text = $('<div></div>');
					   	var e_input = $('<input />');
					   
					   	if(options['input_textarea_img']==true){
						   var img_e = $('<img />');
						   var img = $(element).attr('img');
						   $(element).attr('imgstatus','true');
						   
						   if(img==null){
								img = 'images/anonymous_user_icon.jpg';
						   }
						   img_e.attr('src',img).attr('class','img_ava');
						   $(element).prepend(img_e);
					   	}
					   
					   	e_input.attr('type','hidden').attr('name',attr.name_e);
					   	e_text.attr('contentEditable','false').addClass('element_edit').html('&nbsp;');
					   
					   	var height = height_init(element);
					   	if(height[0]==null || height[0]=='' || height[0]=='undefined'){
							$(element).attr('min-height',options['height_min']); 
					   	}
					   
					   	var span_val = $('<span></span>');
					   	if(attr.val_text!=null){
						   span_val.addClass('span_val').text(attr.val_text);
					   	}else{
						  span_val.addClass('span_val').text('');
						}
					   	if(attr.placeholder!=null){
							span_val.addClass('span_val').text(attr.placeholder);
						}
					   
					   	$(element).append(span_val); 
					   	$(element).append(e_text).append(e_input);
					   
						break;
					
					case 'textarea':  
						$.Textarea(element,options,attr);
						break;
					
					case 'select': 
						$.Select(element,options,attr);
						break;
			   } 
		   		break;
				case 'SELECT': 
					$.SelectHtml(element,options,attr);
				break;
				case 'TEXTAREA': 
					$.TextareaHtml(element,options,attr);
				break;
		   }
	};
	
	
	$.TextPassword = function(element, options, attr){ 
		var att_style = '',
			att_conditionid = '',
			att_autocomplete = '',
			el_list = '',
			class_autocomplete = '',
			limit = '',
			classes = '',
			readonly = '',
			value = '',
			style_opacity = '',
			type = attr.type_e,
			placeholder = '';
		
		if($(element).attr('class')!=false){ classes = $(element).attr('class');}
		if($(element).attr('style')!=null){ att_style = ' style="'+$(element).attr('style')+'"'; }
		if($(element).attr('condition-id')!=null){ att_conditionid = ' condition-id="'+$(element).attr('condition-id')+'"';}
		if($(element).attr('limit')!=null){ limit = 'limit = "'+$(element).attr('limit')+'"';}
		if($(element).attr('readonly')==true){ readonly = 'readonly';}
		if($(element).attr('placeholder')==true){ placeholder = $(element).attr('placeholder');}
		if($(element).attr('value')){
			value = $(element).attr('value'); 
			style_opacity = ' opacity: 1;';
		}
		if($(element).attr('autocomplete')=='on'&&attr.type_e=='text'){ 
			att_autocomplete = ' autocomplete="on" autocomplete-url="'+$(element).attr('autocomplete-url')+'"';
			el_list = '<ul class="ac_results"></ul><input type="hidden" name="'+$(element).attr('name')+'_id">';
			class_autocomplete = 'autocomplete';
		}
		if(attr.type_e=='text'){ type = 'input';}
	  
		$(element).after('<div type="'+type+'" '+att_style+' formstandart="true" placeholder="'+placeholder+'" name="'+$(element).attr('name')+'" default-text="'+value+'" '+att_conditionid+' '+att_autocomplete+' class=" '+type+' '+class_autocomplete+' '+classes+' '+readonly+'" '+readonly+' id="'+$(element).attr('id')+'" '+limit+'><div class="shadow"></div><div class="element_edit" contenteditable="false" style="'+style_opacity+'"><input type="'+attr.type_e+'" '+readonly+' name="'+$(element).attr('name')+'" value="'+value+'"></div><span class="span_val">'+$(element).attr('placeholder')+'</span>'+el_list+'</div>'); 
		$(element).remove();
		$('input[name="'+$(element).attr('name')+'"]').autocompleteForm($(element).attr('autocomplete-url'));
		if($(element).attr('limit')!=null){ limit_count($('div[limit="'+$(element).attr('limit')+'"] .element_edit'),false);}

		
	};
	
	$.InputPassword = function(element, options, attr){  
		var e_text = $('<div></div>');
		var shadow = $('<div></div>');
		var e_hidden = $('<div></div>');
		var e_input = $('<input />');
		var e_event = '';
		var e_itext = '';
		var e_ul = $('<ul></ul>');
		var span_val = $('<span></span>');
		if(attr.val_text!=null){
			span_val.addClass('span_val').text(attr.val_text);
		}
		if(attr.placeholder!=null){
			span_val.addClass('span_val').text(attr.placeholder);
		}
		if(attr.default_text!=null){ 
			e_input.attr('value',attr.default_text);
			e_text.html(attr.default_text);
			e_text.css({ filter: 'progid:DXImageTransform.Microsoft.Alpha(opacity=1)', opacity: 1 });
		}
		if(attr.type_e=="input"){ 
			e_input.attr('type', 'text').attr('name', attr.name_e);
		}
		if(attr.type_e=="password"){
			e_input.attr('type', 'password').attr('name', attr.name_e);
		}
		if($(element).attr('readonly')!=null){ 
			e_input.attr('readonly',true);
			$(element).addClass('readonly');
		}
		e_text.addClass('element_edit');
		shadow.addClass('shadow');
		e_text.html(e_input);
		
		if($(element).attr('info') && $(element).attr('condition-id')==null){
			var e_event = $('<a></a>');
			var e_itext = $('<span></span>');
			var info = $(element).attr('info');
			var info_text = $(element).find('.info_text').html();
			$(element).addClass(info).css({ overflow:'visible'});
			
			e_itext.html(info_text).addClass('info_text').addClass(info);
			e_event.attr('href','#').addClass('element_event').html(e_itext);
			e_text = e_hidden.css({ overflow:'hidden', marginLeft:'-10px', paddingLeft:'10px' }).append(e_text).append(span_val);
		}
		$(element).html(e_text).prepend(shadow).append(e_event);
		if($(element).attr('info')==null){ $(element).append(span_val); }
		if($(element).attr('limit')){ limit_count(e_text,false); }
		
		if($(element).attr('autocomplete')=='on'&&$(element).hasClass('input')){
			$(element).append(e_ul.addClass('ac_results').css('display','none')).append('<input type="hidden" name="'+attr.name_e+'_id" />');
			$(element).addClass('autocomplete');
			$(element).find('input[type="text"]').autocompleteForm($(element).attr('autocomplete-url')); 
		}
	};
	
	$.Textarea = function(element, options, attr){ 
		if($(element).hasClass('no_bo')==false){
		var e_text = $('<div></div>');
		var e_input = $('<input />');
		 
		var height = height_init(element);
		if(height[0]==null || height[0]=='' || height[0]=='undefined'){
			$(element).attr('min-height',options['height_min']);
			$(element).css({ height: options['height_min']+"px"}); 
			e_text.css({ height: options['height_min']-7+"px"});   
		}else if(height[0]!=null && height[0]!=''){
			$(element).css({ height: height[0]+"px"}); 
			e_text.css({ height: height[0]-7+"px"}); 
		}
		e_input.attr('type','hidden').attr('name',attr.name_e);
		e_text.attr('contentEditable','false').addClass('element_edit').html('');
		var span_val = $('<span></span>');
		if(attr.val_text!=null){
			span_val.addClass('span_val').text(attr.val_text);
		}
		if(attr.placeholder!=null){
			span_val.addClass('span_val').text(attr.placeholder);
		}
		if(attr.default_text!=null){ 
			e_input.attr('value',attr.default_text);
			e_text.html(attr.default_text);
			e_text.css({ filter: 'progid:DXImageTransform.Microsoft.Alpha(opacity=1)', opacity: 1 });
		}
		$(element).html(e_text).prepend(span_val).append(e_input);
		if($(element).attr('limit')){ limit_count(e_text,false); }
		}
	};
	
	$.TextareaHtml = function(element,options,attr){
		var limit = '';
		var max_height = '';
		var min_height = options['height_min'];
		var height = options['height_min']-7+'px';
		var heightedit = options['height_min']+'px';
		var value = '';
		var opacity = '';
		var classes = '';
		
		if($(element).attr('class')!=null){ classes = $(element).attr('class');}
		if($(element).attr('limit')!=null){ limit = $(element).attr('limit');}
		if($(element).attr('max-height')!=null){ max_height = $(element).attr('max-height');}
		if($(element).attr('min-height')!=null){ 
			min_height = $(element).attr('min-height'); 
			heightedit = $(element).attr('min-height')-7+'px';
			height = $(element).attr('min-height')+'px';
		}
		if($(element).html()!=false){
			value = $(element).html();
			opacity = 'opacity: 1;';
		} 
		$(element).replaceWith('<div type="textarea" condition-id="'+attr.condition_id+'" max-height="'+max_height+'" min-height="'+min_height+'" name="'+$(element).attr('name')+'" placeholder="'+attr.placeholder+'" limit="'+limit+'" class="textarea no_bo '+classes+'" style="height: '+height+'; "><span class="span_val">'+attr.placeholder+'</span><div style=" height: '+height+';'+opacity+' " contenteditable="false" class="element_edit">&nbsp;'+value+'</div><input type="hidden" name="'+$(element).attr('name')+'" value="'+value+'"></div>');
		if($(element).attr('limit')!=null){ limit_count($('div[limit="'+$(element).attr('limit')+'"] .element_edit'),false);}
	};
	
	$.Select = function(element, options, attr){
		if($(element).hasClass('no_bo')==false){
		var e_text = $('<div></div>');
		var shadow = $('<div></div>');
		var e_hidden = $('<div></div>');
		var but_select = $('<a></a>');
		var e_ul = $('<ul></ul>');
		var e_input = $('<input />');
		var e_span = $('<span></span>');
		var list_select = '';
		var e_event = '';
		var newListSelect = '';
		var listOpt = '';
		var listArr = [];
		
		$(element).find('ul li').each(function(index){
		  var href = '';
		  var val = '';
		  
		  if($(this).attr('value')){
			val = $(this).attr('value');
		  }else{

			val = $(this).text();
		  }
		  
		  if($(this).attr('href')){
			href = 'href="'+$(this).attr('href')+'"';
		  }

		  list_select += '<li key="'+val+'" '+href+'>'+$(this).text()+'</li>';
		  listOpt = $(this).text()+"|"+val+"|"+$(this).attr('href')+"\n";
		  listArr[index] = listOpt;
		});
		
		e_input.attr('type','hidden').attr('name',attr.name_e);
		e_ul.html(list_select);
		e_text.addClass('element_edit');
		shadow.addClass('shadow');
		but_select.addClass('but_select');
		if($(element).attr('value')){ value = $(element).attr('value'); }
		if($(element).attr('placeholder')){ value = $(element).attr('placeholder'); }

		e_text.text(value);
		
		if($(element).attr('condition')=='off'){ $(element).addClass('condition_off'); }
		
		if($(element).attr('autocomplete')=='on'){
			$(element).addClass('autocomplete');
			e_text.attr('contentEditable','false').html('&nbsp;');
			if(value!=null){
				e_span.text(value).addClass('val');
			}
			if(attr.placeholder!=null){
				e_span.text(attr.placeholder);
			}
			if(attr.default_text!=null){ 
				e_input.attr('value',attr.default_text);
				e_text.html(attr.default_text);
				e_text.css({ zIndex: 200 });
			}
			$(element).css({ overflow:'visible'});
			e_text = e_hidden.css({ overflow:'hidden', marginLeft:'-10px', paddingLeft:'10px' }).append(e_text).append(e_span);
		}

		$(element).html(e_text).prepend(shadow).append(e_input).append(e_event).append(e_ul).append(but_select);
		$(element).find('ul li:odd').addClass('odd');
		if($(element).attr('autocomplete')=='on'){
			//alert(listArr);
			$(element).find('input').autocompleteForm(listArr, {
				formatItem: liFormat,
				delay:10,
				minChars:2,
				matchSubset:1,
				autoFill:true,
				matchContains:1,
				cacheLength:10,
				selectFirst:true,
				maxItemsToShow:10
			});
			function liFormat(row, i, num){
					return  row[1];
				}
		}
		}
	};
	
	$.SelectHtml = function(element,options,attr){
		var list_select = '';
		var listArr = [];
		var val_hidden = '';
		var add_style = '';
		var class_condition = "";
		
		$(element).find('option').each(function(index){
		  var href = '';
		  var val = '';
		  if($(this).attr('key')){
			key = $(this).attr('key');
		  }else{
			key = $(this).text();
		  }
		  if($(this).attr('href')){
			href = 'href="'+$(this).attr('href')+'"';
		  }
		  if($(this).attr("selected")){
			attr.placeholder = $(this).text();
			val_hidden = $(this).attr('value');
		  }
		   if($(element).attr("style")){
			add_style = $(element).attr('style');
		  }
		  if(attr.condition=='off'){
			class_condition = 'condition_off'; 
		  }

		  list_select += '<li key="'+key+'" '+href+'>'+$(this).text()+'</li>';

		});
		$(element).replaceWith('<div type="select" value="'+attr.placeholder+'" condition="'+attr.condition+'" condition-id="'+attr.condition_id+'" name="'+$(element).attr('name')+'" style=" '+add_style+'" class="select no_bo '+$(element).attr('class')+' '+class_condition+'" id="'+$(element).attr('id')+'"><div class="shadow"></div><div class="element_edit">'+attr.placeholder+'</div><input type="hidden" name="'+$(element).attr('name')+'" value="'+val_hidden+'"><ul>'+list_select+'</ul><a class="but_select"></a></div>');
		$('div[name="'+$(element).attr('name')+'"] ul li:odd').addClass('odd');
	};
	
})(jQuery);

function height_init(obj){
	var min_height = $(obj).attr('min-height');
	var max_height = $(obj).attr('max-height');
	return([min_height,max_height]);
}

var key, last_ms = 0, last_counter;
function form_event(obj,e){
	e = e || window.event;
	/*mouseover*/
	if(e.type=='mouseover'){
		/*element_event*/
		if($(obj).hasClass('element_event')){ 
			var info_position = $(obj).offset().left+$(obj).width()+$(obj).find('.info_text').width();
			var body_width = $('body').width();
			if(info_position<=body_width){ $(obj).find('.info_text').addClass('left_itext'); }
			
			$(obj).find('.info_text').fadeIn(500);
			$(obj).parent().css({zIndex: '999'});
		}
		if($(obj).parent().parent().attr('type')=="select"){ 
			$('.select.focus li').removeClass('ac_over');
			$(obj).addClass('ac_over');

		}
		if($(obj).hasClass('ac_even')||$(obj).hasClass('ac_odd')){ 
			$('.input li').removeClass('ac_over');
			$(obj).addClass('ac_over');
		}
	}
	/*mouseout*/
	if(e.type=='mouseout'){
		/*element_event*/
		if($(obj).hasClass('info_text')){ 
			$(obj).stop(true, true).fadeOut(500); 
			$(obj).parent().parent().css({zIndex: '100'});
		}
	}

	/*keyUp*/

	if(e.type=='keyup'){  
		
		if(e.which==9){
			if($(obj).parents('div[type]')){
				$('div[type]').removeClass('focus');
			}
			setTimeout(function(){
			$(obj).parents('.input').addClass('focus');
			$(obj).parents('.password').addClass('focus');
			},200);
		}
		var str = $(obj).html();
		if($(obj).parents('.select').hasClass('focus') || $(obj).parents('.input').hasClass('focus')){ 
			if($(obj).find('div').hasClass('element_edit')){
				var str = $(obj).find('.element_edit').text(); 
			}else{
				var str = $(obj).text();
			}
			str = str.replace(/\s*/g,'');
			setTimeout(function(){$(obj).find('input').focus().keydown().click();},100);
		} 
		$(obj).next('input').attr('value',str);
		$(obj).stop(true, true);
		 var nosettime;
		 function tim(now_ms){
			 now_ms = now_ms - 1000;
			 if(now_ms == 0 && e.witch!=9 || e.which==46 || e.which==110 ||  e.which==8){
				$(obj).stop(true,true);
				clearTimeout(nosettime);
				clearTimeout(last_counter);
				$(obj).parent().removeClass('error').removeClass('okey').removeClass('okey_focusout');
				if($(obj).find('input').val()!=false){ 
					last_counter=setTimeout(function(){ open_condition(obj,false); }, 1100); 
				}
			 }else{
				nosettime = setTimeout(function(){ tim(now_ms) },1000);	
			}
		 }
		 var now_ms = 3000; 
		 tim(now_ms);
		 
		/*var now_ms = parseInt(new Date().getTime());
        if(now_ms - last_ms <= 1000 && e.witch!=9 || e.which==46 || e.which==110 ||  e.which==8){
			$(obj).stop(true,true);
			clearTimeout(last_counter);
			$(obj).parent().removeClass('error').removeClass('okey').removeClass('okey_focusout');
			if($(obj).find('input').val()!=false){ 
            	last_counter=setTimeout(function(){ open_condition(obj,false); }, 1100); 
			}
        }
        last_ms = now_ms;*/
	}
	/*keydown*/
	if(e.type=='keydown'){
		if(e.which==9 || e.which==46 || e.which==110){
			$(obj).stop(true,true);
            clearTimeout(last_counter); 
			$(obj).parent().removeClass('error').removeClass('okey').removeClass('okey_focusout');
			if($(obj).find('input').val()!=false){ 
           		last_counter=setTimeout(function(){ open_condition(obj,true); }, 0);
			}
        }
		
		/*if(e.which==13&&$(obj).parents('.input').hasClass('focus')||e.which==13&&$(obj).parents('.password').hasClass('focus')){
			$(obj).parents('form').submit();
		} 
		if(e.which==13&&e.ctrlKey&&$(obj).parents('.textarea').hasClass('focus')||e.which==13&&e.ctrlKey&&$(obj).parents('.input_textarea').find('.element_edit.focus')){
			$(obj).parents('form').submit();
		}*/
		if($('.select').hasClass('focus')){
			var ul = $('.select.focus').find('ul');
			var size = $('.select.focus').find('ul li').size()-1;
				
			if(e.which==38 && ul.find('li').hasClass('hover') && ul.find('li:first').attr('class')!='hover'){
			 	ul.find('li.hover').removeClass('hover').prev().addClass('hover');
				var select_scroll = Math.floor(((ul.offset().top-ul.find('li.hover').offset().top)*10)/10);
				if(26*size-select_scroll<=443){
					$('.select.focus ul').animate({scrollTop: '-='+26+'px'}, 0);
				}
				e.preventDefault();
			}else if(e.which==40 && ul.find('li').hasClass('hover')){
				ul.find('li.hover').removeClass('hover').next().addClass('hover');
				var select_scroll = Math.floor(((ul.offset().top-ul.find('li.hover').offset().top)*10)/10);
				if(26*size-select_scroll>=599){
					$('.select.focus ul').animate({scrollTop: '+='+26+'px'}, 0);
				}
				e.preventDefault();
			}
		}
		/*input_textarea keydown*/
		if($(obj).parent().attr('type')=='input_textarea'){
			 /*msie6*/
			 if($.browser.msie && $.browser.version=='6.0'){
				 var height = height_init($(obj).parent());
				 if(height[1]!=null && height[1]!='' && height[1]!="undefined"){
					if($(obj).height()>=height[1]){ 
						$(obj).css({ height: height[1]+"px", overflow:'auto' }); 
					}
				 }
			 }
		}
		if($(obj).parent().hasClass('input')){
			if($(obj).parent('.input.focus').attr('limit')){ limit(obj,e);}
		}
		/*textarea keydown*/
		if($(obj).parent().hasClass('textarea')){
			if($(obj).parent('.textarea.focus').attr('limit')){ limit(obj,e);}
			
			 var height = height_init($(obj).parent());
			 setTimeout(function(){
				 if(height[0]<=$(obj).height()){
					if(height[1]<$(obj).height()){
						$(obj).parent().css({ height: height[1]+'px', overflow:'auto' });
					}else{
						$(obj).parent().css({ height: 'auto' });
					}
				 }else{
					$(obj).parent().css({ height: height[0]+'px', overflow:'hidden' });
				 }
			 },0);	 
		}
	}
	/*elements event mousedown*/
	if(e.type=='mousedown'){
		
		if($(obj).parent().hasClass('textarea') || $(obj).parent().hasClass('input_textarea')){ 
			$(obj).parent().find('.element_edit').attr('contentEditable','true').focus(); 	
		}
		if($(obj).parent().attr('type')=='input' || $(obj).parent().attr('type')=='password'){ 
			$(obj).parent().addClass('focus');
			if($(obj).parent().attr('value')==$(obj).html()) {  setTimeout(function(){ $(obj).focus().click();},1000);}
		}
		if($(obj).parent().parent().attr('type')=='input' || $(obj).parent().parent().attr('type')=='password'){
			$(obj).parent().parent().addClass('focus');
			if($(obj).parent().parent().attr('value')==$(obj).html()) {  setTimeout(function(){ $(obj).focus().click();},1000);}
		}
		if($(obj).parent().hasClass('ac_results')){ 
			$(obj).parents('div[type]').find('input[type="text"]').val($(obj).text());
			$(obj).parents('div[type]').find('input[type="hidden"]').val($(obj).attr('key'));
		}
		if($(obj).find('.element_edit ul')||$(obj).find('.element_edit input[type="text"]')){ 
			/*setTimeout(function(){ $(obj).parents('.input').addClass('focus'); },100);
			$(obj).parent('.element_edit').css('z-index',900);*/
		}
		if(e.target.nodeName!='UL'){ 
			//$('.input.focus').removeClass('focus').find('ul').hide();
		}
		
		/*select*/
		if($(obj).attr('type')=='select' && $(obj).hasClass('focus')==false){
			
			$('.but_select').prev().removeAttr('style');
			$('.but_select').removeClass('active');
			
		}
		if($(obj).parent('.select').hasClass('autocomplete')){
			$(obj).find('.element_edit').attr('contentEditable','true');
			setTimeout(function(){
			if($('.select.autocomplete.focus .element_edit').html()!=null || $('.select.autocomplete.focus .element_edit').html()!='<br>' || $('.select.autocomplete.focus .element_edit').html()!='&nbsp;'){ 
				$(obj).parent().addClass('focus');
				$('.select.autocomplete .element_edit').css('z-index','200').focus();
			}
			},10);
		}
		if($(obj).parent().parent('.select').hasClass('focus')){ 
			var li_href = $(obj).attr('href');
			if(li_href!=null){ location.href = li_href; }
			
			var text_li = $(obj).text();
			var val_li = $(obj).attr('key');
			$('.but_select').removeClass('active');
			if(val_li==null || val_li==0){ val_li = text_li; }
			
			if($(obj).parent().parent('.select').attr('autocomplete')=='on'){
				$(obj).parent('ul').prev().attr('value',val_li).prev().find('.element_edit').text(text_li);
			}else{
				$(obj).parent('ul').prev().attr('value',val_li).prev('.element_edit').text(text_li);
			}
			if($(obj).hasClass('element_edit')!=true){
				$(obj).parent().parent('.select').removeClass('focus').removeClass('okey_focusout').addClass('okey');	
				setTimeout(function(){ $(obj).parent().parent('.select').removeClass('okey').addClass('okey_focusout'); },1000);
				setTimeout(function(){ $('.select.autocomplete .element_edit').removeAttr('style');},1);
			}
		}
		if($(obj).parent().attr('type')!='select'&&e.target.nodeName!='UL'){
			$('.select.focus').find('.but_select').removeClass('active');
			$('.select.focus').removeClass('focus').find('ul').removeAttr('style');
		}
		
		
	}
	
	/*elements event click*/
	if(e.type=='click'){
		/*button condition*/
		if($(obj).attr('condition-id') && $(obj).attr('type')=='submit'){ 
			condition($(obj).attr('condition-id'),obj);
		}
		/*button submit*/
		if($(obj).attr('type')=='submit'){ 
			$(obj).parents('form').submit();
		}
		
		/*select*/ 
		if($(obj).hasClass('but_select')){
			if($(obj).prev().css('display')=='none'){
				$('.but_select').prev('ul').attr('style','');
				$(obj).addClass('active').prev().css('display','block');
				/* setTimeout(function(){
				if($('.select.autocomplete.focus .element_edit').html()!=null && $('.select.autocomplete.focus .element_edit').html()!='<br>' && $('.select.autocomplete.focus .element_edit').html()!='&nbsp;'){
					//+
					
					$('.select.autocomplete.focus .element_edit').css('z-index','200');
				}else{
					$('.select.autocomplete.focus .element_edit').removeAttr('style');
				} 
				},1);*/
			}else{
				$(obj).removeClass('active').prev().css('display','none');	
				$('.select.autocomplete.focus .element_edit').removeAttr('style');
			}
		}
		if($(obj).attr('type')=='select'||$(obj).attr('type')=='input'){
			
			$('div[type="select"],div[type="input"]').removeClass('focus');
			var add_width = 53;
			if($(obj).attr('condition')=='off'||$(obj).attr('type')=='input'){ add_width = 20; }
			$(obj).addClass('focus').find('ul').css({ minWidth:$(obj).width()+add_width+"px"});
			var obj_height_ul = $(obj).find('ul').height();
			if(obj_height_ul>156){
				$(obj).find('ul').css({height:156+'px'});
			}
		} 
		
		
		
	}
	/*elements event focusin*/
	if(e.type=='focusin'){ 
		/*select*/
		/*if($(obj).parent().parent('.select').attr('type')=='select' && $(obj).parent().parent('.select').attr('autocomplete')=='on'){
			$(obj).parent().parent('.select').addClass('focus');
			if($(obj).html()=='&nbsp;'+$(obj).parent().parent('.select').attr('value') || $(obj).html()==$(obj).parent().parent('.select').attr('value')){ $(obj).text('');   }
		}*/
		/*if($(obj).parents('.input').hasClass('autocomplete')&&$(obj).find('input[type="text"]').attr('value')==false){
			$(obj).find('ul').hide();
		}*/
		/*input_textarea*/
		if($(obj).parent().attr('type')=='input_textarea'){
			reset_form(obj);
			var height = height_init($(obj).parent());
			var img = $(obj).parent().attr('img');
			
			height[1] = height[1]+'px';
			if(height[1]==null || height[1]=='' || height[1]=='undefined'){ height[1] = 'auto';}
			$(obj).css({ minHeight: height[0]+'px', height: 'auto', maxHeight:height[1], background:'#fff'}).addClass('focus');
			
			var but_span = $('<span></span>');
			var but_em = $('<em></em>');
			var but_text = $(obj).parent().attr('but-text');
			var div_clear5 = $('<div></div>');
			var div_clear = $('<div></div>');
			var but_e = $('<a></a>');
			
			but_e.addClass('Btn').addClass('NormalGreen').addClass('fr');
			but_e.html(but_span.append(but_em).append(but_text));
			
			div_clear5.addClass('clear5');
			div_clear.addClass('clear');
			$(obj).parent().append(div_clear5).append(but_e).append(div_clear);
			
			if($(obj).parent().attr('imgstatus')=='true'){

				var img_e_width = $(obj).prev().prev().width()+5;
				$(obj).css({ marginLeft:img_e_width+'px', marginTop:'-'+height[0]-7+'px' }).prev().css({ marginLeft:img_e_width+'px', height: height[0]+'px' }).prev().css({ visibility:'visible' });
				
			}
			/*msie6*/
			if($.browser.msie && $.browser.version=='6.0'){
				$(obj).css({ height: height[0]+'px', overflow: 'visible', background:'#fff', marginBottom:'-1px'});
			}
		}
		/*textarea*/
		if($(obj).parent().attr('type')=='textarea'){ 
			var height = height_init($(obj).parent());
			$(obj).css({ minHeight:height[0]-7+'px', height:'auto' }).parent().addClass('focus');
		}else if($(obj).attr('type')=='textarea'){

			$(obj).addClass('focus').find('.element_edit').css({ minHeight:height[0]-7+'px', height:'auto' });	
		}
		
	} 
	/*elements event blur or focusout*/
	if(e.type=='focusout'){ 
		
		if($(obj).hasClass('element_edit')){
			$(obj).attr('contentEditable','false'); 
			$(obj).parents('.input, .password').removeClass('focus');
		}
		if($(obj).parent().attr('type')!='select' && $(obj).parent().parent().attr('type')!='select' && $(obj).parents('.input').hasClass('autocomplete')==false){
			$(obj).removeClass('focus').parent().removeClass('focus').parent().removeClass('focus');
			if($(obj).parent().hasClass('okey')){ $(obj).parent().removeClass('okey').addClass('okey_focusout'); }
			$(obj).css({ color:"#272727" });
		}

		if($(obj).html()=='' || $(obj).html()=='<br>' || $(obj).html()=='&nbsp;' || $(obj).html()=='<P>&nbsp;</P>'){ 
			$(obj).find('input').attr('value','');
		/*input_textarea*/
			if($(obj).parent().attr('type')=='input_textarea'){
				reset_form(obj);
			}
		/*textarea*/
			if($(obj).parents('.textarea').attr('type')=='textarea'){
				var height = height_init($(obj).parent());
				$(obj).css({ height:height[0]-7+'px' });
				$(obj).css({ filter: '', opacity: '' });
			}
		}else{ 
			if($(obj).parents('.textarea').attr('type')=='textarea' || $(obj).parents('.input').attr('type')=='input' || $(obj).parents('.password').attr('type')=='password'){
				$(obj).css({ filter: 'progid:DXImageTransform.Microsoft.Alpha(opacity=1)', opacity: 1 }); 
			}
		}
		
		if($(obj).find('input[type="text"]').attr('value')==''){ 
			
		/*input*/
			if($(obj).parents('.input').attr('type')=='input'){ 
				$(obj).parents('.input').removeClass('okey').removeClass('okey_focusout').removeClass('error');
				$(obj).css({ color:"" });
				$(obj).css({ filter: '', opacity: '' });
			}
		/*select*/
			if($(obj).parent().parent('.select').attr('type')=='select' && $(obj).parent().parent('.select').attr('autocomplete')=='on'){
				var val_text = $(obj).parent().parent('.select').attr('value'); 
				if(val_text==null){ val_text = ''; }
				$(obj).parent().parent('.select').removeClass('okey').removeClass('okey_focusout').removeClass('error');
				$(obj).css({ color:"" });
				$('.but_select').prev().attr('style','');
				$('.select.autocomplete .element_edit').removeAttr('style');
			}
		/*password*/
			if($(obj).parents('.password').attr('type')=='password'){ 
				$(obj).parents('.password').removeClass('okey').removeClass('okey_focusout').removeClass('error');	
				$(obj).css({ color:"", filter: '', opacity: '' });
			}
		}else{
			if($(obj).parents('.password').attr('type')=='password'){
				$(obj).css({ filter: 'progid:DXImageTransform.Microsoft.Alpha(opacity=1)', opacity: 1 });
			}
		}
	}
	
}
function limit(obj,e){
	if($(obj).parent().attr('limit')){
		var arr_limit = $(obj).parent().attr('limit').split(',');
		if($(obj).parents('div[type]').hasClass('textarea')){
			var limit_raz = arr_limit[0] - $(obj).text().length; 
			var text = $(obj).html();
		}
		if($(obj).parents('div[type]').hasClass('input')){ 
			var limit_raz = arr_limit[0] - $(obj).find('input').attr('value').length; 
			var text = $(obj).find('input').attr('value');
		}
		if(window.event){ key = window.event.keyCode; }else{ key = e.which;}
		if(0>=limit_raz){
			limit_raz = 0;
			if(e.ctrlKey && key == 86){
				$(obj).html(text.substring(0,arr_limit[0]));
				if ($.browser.mozilla) { window.getSelection().removeAllRanges();} 
			}
			if(key != 65 && e.ctrlKey || key != 86 && e.ctrlKey || key != 67 && e.ctrlKey || key != 82 && e.ctrlKey){
				e.preventBubble=true; e.doNotPreventDefault=true;
			}
			else if(key>47 && key<91 || key>95 && key<112 || key>185 && key<223 || key==32 || key==13 || e.ctrlKey && key == 86){
				e.stopPropagation(); e.preventDefault(); $(obj).find('input').blur();
				e.preventCapture(); 
			}
			else{ 
				e.preventBubble=true; e.doNotPreventDefault=true;
			}
		}
		setTimeout(function(){ limit_count($(obj),e); },10);
	}
}
function open_condition(obj,wichn){

		if($(obj).parent().attr('condition-id')){ 
			$(obj).parent().removeClass('error').removeClass('okey').removeClass('okey_focusout').addClass('load');
			

			if($(obj).parents('div[type]').attr('condition-timeout')!=null){ 
				var conditionTimeout = $(obj).parents('div[type]').attr('condition-timeout'); 
			}else var conditionTimeout = 1000;
			
			if(wichn==true){ conditionTimeout = 0;}

			if(condition($(obj).parent().attr('condition-id'),obj)==true){ 
				setTimeout(function(){ $(obj).parent().removeClass('error').removeClass('load').addClass('okey'); },conditionTimeout);
				return false;
			}else{
				setTimeout(function(){ $(obj).parent().removeClass('okey').removeClass('load').addClass('error'); },conditionTimeout);
				return true;
			}
		}
}
function limit_count(obj,e){ 
	var arr_limit = $(obj).parent().attr('limit').split(',');
	if($(obj).parents().hasClass('textarea')){ 
		if($(obj).html().substring(0,6)=='&nbsp;'){ 
			var limit_raz = arr_limit[0] - $(obj).text().length+1;
		}else{
			var limit_raz = arr_limit[0] - $(obj).text().length;
		}
		
	}
	if($(obj).parents('div[type]').hasClass('input')){ 
		var limit_raz = arr_limit[0] - $(obj).find('input').attr('value').length; 
	}
	$('*[limit-id="'+arr_limit[1]+'"]').html(limit_raz);
}

function clear_enter(obj,e){
	if(window.event){ key = window.event.keyCode; }else{ key = e.which;}
	if(key == 13){
	  e.stopPropagation();
	  e.preventDefault();
	  return false;
	}
}
function preg_tag(obj,e){
	e = e || window.event;
	if(window.event){ key = window.event.keyCode; }else{ key = e.which;}
	if(key == 86 && e.ctrlKey){ 
		if($(obj).hasClass('element_edit')&&$(obj).attr('type')!='text'&&$(obj).attr('type')!='password'){
			setTimeout(function(){$(obj).text($(obj).text());},1);
		}
		/*if($(obj).attr('type[password]')){
			setTimeout(function(){$(obj).attr('value',$(obj).text());},1);
		}*/
	 }
}
function reset_form(obj){
		$(obj).removeAttr('style').prev().removeAttr('style').prev().css({visibility:'hidden'});
		$(obj).parent().removeClass('okey').removeClass('error').removeClass('okey_focusout');
		$(obj).next().next().remove();
		$(obj).next().next().remove();
		$(obj).next().next().remove();
		$(obj).css({ color:"" });
}
function focuson(id){
	$('#'+id+' .element_edit').attr('contenteditable','true').focus();
}

 /* forms.standart_v2.js */ 
/*
29.11.11 | 11:45
Kazakov Aleksey
a.kazakov@digital-ventures.net
*/

/*inisialization*/ 
$(document).ready(function(){ $('*[formst=""]').formTochka(); });

;(function($) {
	var last_counter;
	
	$.fn.extend({
		formTochka: function(options){
			options = $.extend({}, $.setupForm.defaults, {}, options); 

			return this.each(function(){
				new $.setupForm(this,options); 
			});
		},
		formOptions: function(options){ 
			return this.each(function(){ 
				$(this).trigger('formOptions', [options]);
			});
		}
	});	
	
	$.globalBuild = function($element,options){
		var div_formst = $('<div></div>');
		var div_icn = $('<div></div>');
		
		div_formst.addClass('formst');
		$element.wrap(div_formst);
	};
	
	$.inputBuild = function($element,options){

		/*BuildElement*/
		if($element.is(':checkbox')&&$element.is(':checked')||$element.is(':radio')&&$element.is(':checked')){ $element.parent().addClass('active');}
		$element.parent().addClass($element.attr('type')+'Form');
		
		/*fix IE*/
		if($.browser.msie&&$.browser.version<9){
			if($element.is(':radio')){ $element.parent().addClass('msie');}
		}
		
		/*EventElement*/
		$element.change(function(event){
			if($(this).is(':checkbox')&&$(this).is(':checked')){ $(this).parent().addClass('active'); }else{ $(this).parent().removeClass('active'); }
			if($(this).is(':radio')){ $('input[name="'+$(this).attr('name')+'"]').parent().removeClass('active'); $(this).parent().addClass('active'); }
		});
		$('label[for]').mouseover(function(){
			$('input#'+$(this).attr('for')).parent().addClass('hover');
		}).mouseout(function(){
			$('input#'+$(this).attr('for')).parent().removeClass('hover');
		});
		
		
	};
	
	$.textareaBuild = function($element,options){
		/*BuildElement*/
		$element.css({ minHeight:options['minheight']+'px', maxHeight:options['maxheight']+'px'});
		$element.parent().addClass('textareaForm');
	};
	
	$.selectBuild = function($element,options){
		/*BuildElement*/
		var $list = $selected = maxSizeList = '';
		$element.find('option').each(function(index){
			$list += '<li>'+$(this).text()+'</li>';
			if(index>6){ maxSizeList = 'height: 150px; overflow:auto;'}
		});
		$element.before('<input type="text" readonly value="'+$element.find('option:selected').text()+'"><div class="btn_select"></div><div class="ac_results"><ul style="'+maxSizeList+'">'+$list+'</ul></div>');
		$element.parent().addClass('selectForm').find('li:odd').addClass('ac_odd');
		
		/*EventsElement*/
		$element.parent().find('li').bind('mouseover', function(){
			$element.parent().find('li').removeClass('ac_over');
			$(this).addClass('ac_over');
		}).click(function(){
			$(this).parents('.formst').find('select option').removeAttr('selected').eq($(this).index()).attr('selected','selected');
			$(this).parents('.formst').find('input[type="text"]').val($(this).text());
			$element.parent().find('.ac_results').hide();
		}).parents('.formst').find('input[type="text"], .btn_select').click(function(){
			$element.parent().find('.ac_results').css('width', $element.parent().width()+'px').toggle().find('ul li').eq($element.parent().find('select option:selected').index()).addClass('ac_over');
		});
		
		$element.parents('.formst').mouseleave(function(){
				$(this).removeAttr('live');
		}).mouseenter(function(){
				$(this).attr('live','true');
		});
		$('*').click(function(){
			$('.formst').each(function(){
				if($(this).attr('live')!='true'){ 
					$(this).find('.ac_results').hide();
				}
			});
		});
	};
	
	$.setupForm = function(element, options){
		$element = $(element);
		
		$element.focus(function(event){  
			switch(this.nodeName){
				case "INPUT": 
					if($(this).is('[type="text"]')||$(this).is('[type="password"]')){ $(this).parent().addClass('focus');  }
					break;
				case "TEXTAREA":
					$(this).parent().addClass('focus');
					break;
			}
		}).blur(function(event){
			$(this).parent().removeClass('focus');
		}).bind('formOptions', function(){ 
			$.setupForm.addOptions(this, arguments[1]);
			$.extend(options, arguments[1]); 
		});
		
		$.globalBuild($element,options);

		switch(element.nodeName){
			case "INPUT": 
				$.inputBuild($element,options); 
				break;
			case "TEXTAREA": 
				$.textareaBuild($element,options);
				break;
			case "SELECT": 
				$.selectBuild($element,options);
				break;
		}
		
	};
	
	$.setupForm.addOptions = function(element, options){
		var size = 0, key;

		$(element).bind('click',function(){
			//alert(options['validate']);
		});
		
		$.each(options,function(key, val){
			return eval('$.option(element, val).'+key+'()');
		});
	};
	
	$.option = function(element,val){
		$element = $(element);
		$element_name = $element.attr('name');
		return {
			validate: function(){
				if($element.parent().hasClass('textareaForm')==false){
				$element.parent().find('.icn_condition').remove();
				$element.after('<div class="icn_condition"></div>');
				}
				$('*[name="'+$element_name+'"]').bind('keyup', function(event){
																		
					clearTimeout(last_counter);
					if(event.which!=9&&event.which!=16&&event.which!=17&&event.which!=18&&event.which!=33&&event.which!=34&&event.which!=35&&event.which!=36&&event.which!=37&&event.which!=38&&event.which!=39&&event.which!=40&&event.which!=91&&event.which!=92&&event.which!=93&&event.which!=45) $('#'+$(this).attr('id')).validForm(val);
					
					if($(this).scrollTop()>0){ right_co = 20; }
					else right_co = 5;
					$(this).parent().find('.icn_condition').css({right:right_co+'px'});
					
				}).bind('keydown', function(event){
					if(event.which==9) {  
						clearTimeout(last_counter);
						$('*[name="'+$(this).attr('name')+'"]').validForm([val[0],true,val[2]]); 
					}
					
				});
			},
			placeholder: function(){
				$('*[name="'+$element_name+'"]').attr('placeholder',val);
				if($.browser.msie){
					if($element.val()==''){ $element.val(val).css('color','#999'); }
					$element.bind('focus',function(){
						if($(this).val()==val){ $(this).val('').css('color',''); }
					}).bind('blur',function(){
						if($(this).val()==''){ $(this).val(val).css('color','#999'); }
					});
				}
			},
			value: function(){
				$('*[name="'+$element_name+'"]').attr('value',val);
			},
			help: function(){
			},
			info: function(){
			},
			limit: function(){
				countlimit($element,val);
				$element.bind('keydown', function(event){
					substrlimit($(this),val);
				}).bind('keyup', function(){
					substrlimit($(this),val);
					countlimit($(this),val);
				});
			},
			minheight: function(){
				$element.css('min-height',val+'px')
			},
			maxheight: function(){
				$element.css('max-height',val+'px')
			},
			outattr: function(){
				$.each(val,function(index,value){
					if(index!='class'){
						$element.parent().attr(index,value);
					}else{
						$element.parent().addClass(value);
					}
				});
			},
			autoscroll: function(){ 
				if(val==true&&element.nodeName=='TEXTAREA'){
					var height_textarea = $element.height();
					$element.after('<div class="autoscroll" style="width:'+$element.width()+'px"></div>');
					$element.bind('keydown, keyup', function(){ height_update($(this),height_textarea); });
				}
			},
			selected: function(){
				if(val!==false){
					$element.find('option').eq(val).attr('selected','selected'); 
					$element.parent().find('input').val($element.find('option').eq(val).text());
					$element.parent().find('ul li:eq('+val+')').addClass('ac_over');
				}
			}
		}
		
		function height_update($this,height_textarea){ 
			var value_autoscroll = $this.val().split('\n').join('<br>');
			$this.parent().find('.autoscroll').html(value_autoscroll);
			var height_autoscroll = $this.parent().find('.autoscroll').height()+25;
			if(height_textarea<=height_autoscroll){
				$this.css({ height: height_autoscroll+'px' });
			}else 
				$this.css({ height: 'auto' });
		}
		
		function substrlimit($this,val){
			if($this.val().length>=val[0]) { $this.val($this.val().substring(0,val[0]));}
		}
		
		function countlimit($this,val){
			$('#'+val[1]).text(val[0]-$this.val().length);
		}
	};
	$.fn.extend({
		validForm: function(val){  

			return this.each(function(){
				$this = $(this);
				$this_name = $this.attr('name');
				$this_id = $this.attr('id');
				if($this.parent().hasClass('textareaForm')==false){
				$this.parent().find('.icn_condition').remove();
				$this.after('<div class="icn_condition"></div>');
				}
				//if($this.parent().hasClass('textareaForm')){ $this.css('width',$this.parent().width()-33+'px'); }
				function valid(){ 
					if(condition(val[0],$('#'+$this_id))==true){
						$('#'+$this_id).parent().removeClass('loader').removeClass('error').addClass('success');
					}else{
						$('#'+$this_id).parent().removeClass('loader').removeClass('success').addClass('error');
						$('#'+val[2]).css('display','block');
					}
				}
				if($('#'+$this_id).val().length!=0||val[1]==false){ 
					$('#'+val[2]).css('display','none'); 
					if(val[1]==undefined){ val[1] = 1000; }
					if(val[1]==false||$.browser.msie){ valid();  }
					else{ 
						clearTimeout(last_counter);
						$('#'+$this_id).parent().removeClass('error').removeClass('success').addClass('loader');
						last_counter = setTimeout(valid,val[1]);  
					}
					
				} else { $('#'+$this_id).parent().removeClass('error').removeClass('success').removeClass('loader'); $('#'+val[2]).css('display','none'); $this.css('width','');} 
			});
		}
	});
	
	$.setupForm.defaults = {
		validate: false,
		placeholder: false,
		value: false,
		help: false,
		info: false,
		limit: false,
		minheight: 100,
		maxheight: "auto",
		outattr: {},
		autoscroll: false,
		selected: false
	};
	
})(jQuery);
 /* forms.autocomplete.js */ 
/*
 * Autocomplete - jQuery plugin 1.1pre
 *
 *
 * Dual licensed under the MIT and GPL licenses:
 *   http://www.opensource.org/licenses/mit-license.php
 *   http://www.gnu.org/licenses/gpl.html
 *
 * Revision: $Id: forms.autocomplete.js 45399 2011-07-04 10:17:36Z a.gindyuk $
 *
 */

;(function($) {
	
$.fn.extend({
	autocompleteForm: function(urlOrData, options) { 
		var isUrl = typeof urlOrData == "string";
		options = $.extend({}, $.Autocompleter.defaults, {
			url: isUrl ? urlOrData : null,
			data: isUrl ? null : urlOrData,
			delay: isUrl ? $.Autocompleter.defaults.delay : 10,
			max: options && !options.scroll ? 10 : 150
		}, options);
		
		// if highlight is set to false, replace it with a do-nothing function
		options.highlight = options.highlight || function(value) { return value; };
		
		// if the formatMatch option is not specified, then use formatItem for backwards compatibility
		options.formatMatch = options.formatMatch || options.formatItem;
		
		return this.each(function() {
			new $.Autocompleter(this, options);
		});
	},
	result: function(handler) {
		return this.bind("result", handler);
	},
	search: function(handler) {
		return this.trigger("search", [handler]);
	},
	flushCache: function() {
		return this.trigger("flushCache");
	},
	setOptions: function(options){
		return this.trigger("setOptions", [options]);
	},
	unautocomplete: function() {
		return this.trigger("unautocomplete");
	}
});

$.Autocompleter = function(input, options) {

	var KEY = {
		UP: 38,
		DOWN: 40,
		DEL: 46,
		TAB: 9,
		RETURN: 13,
		ESC: 27,
		COMMA: 188,
		PAGEUP: 33,
		PAGEDOWN: 34,
		BACKSPACE: 8
	};

	// Create $ object for input element
	var $input = $(input).attr("autocomplete", "off").addClass(options.inputClass);

	var timeout;
	var previousValue = "";
	var cache = $.Autocompleter.Cache(options);
	var hasFocus = 0;
	var lastKeyPressCode;
	var config = {
		mouseDownOnSelect: false
	};
	var select = $.Autocompleter.Select(options, input, selectCurrent, config);
	
	var blockSubmit;
	
	// prevent form submit in opera when selecting with return key
	$.browser.opera && $(input.form).bind("submit.autocomplete", function() {
		if (blockSubmit) {
			blockSubmit = false;
			return false;
		}
	});
	 
	// only opera doesn't trigger keydown multiple times while pressed, others don't work with keypress at all
	$input.bind(($.browser.opera ? "keypress" : "keydown") + ".autocomplete", function(event) {
		// track last key pressed
		lastKeyPressCode = event.keyCode;
		switch(event.keyCode) {
		
			case KEY.UP:
				event.preventDefault();
				if ( select.visible() ) {
					select.prev();
				} else {
					onChange(0, true);
				}
				break;
				
			case KEY.DOWN:
				event.preventDefault();
				if ( select.visible() ) {
					select.next();
				} else {
					onChange(0, true);
				}
				break;
				
			case KEY.PAGEUP:
				event.preventDefault();
				if ( select.visible() ) {
					select.pageUp();
				} else {
					onChange(0, true);
				}
				break;
				
			case KEY.PAGEDOWN:
				event.preventDefault();
				if ( select.visible() ) {
					select.pageDown();
				} else {
					onChange(0, true);
				}
				break;
			
			// matches also semicolon
			case options.multiple && $.trim(options.multipleSeparator) == "," && KEY.COMMA:
			case KEY.TAB:
			case KEY.RETURN:
				$(this).val($(this).parents('div[type]').find('ul li.ac_over').text());
				$(this).parents('div[type]').find('input[type="hidden"]').val($(this).parents('div[type]').find('ul li.ac_over').attr('key'))
				if( selectCurrent() ) {
					// stop default to prevent a form submit, Opera needs special handling
					event.preventDefault();
					blockSubmit = true;
					return false;
				}
				break;
				
			case KEY.ESC:
				select.hide();
				break;
				
			default:
				clearTimeout(timeout);
				timeout = setTimeout(onChange, options.delay);
				break;
		}
	}).focus(function(){
		// track whether the field has focus, we shouldn't process any
		// results if the field no longer has focus
		hasFocus++;
	}).blur(function() {
		hasFocus = 0;
		if (!config.mouseDownOnSelect) {
			hideResults();
		}
	}).click(function() {  
		// show select when clicking in a focused field
		if ( hasFocus++ > 1 && !select.visible() ) {
			onChange(0, true);
		}
	}).bind("search", function() { 
		// TODO why not just specifying both arguments?
		var fn = (arguments.length > 1) ? arguments[1] : null;
		function findValueCallback(q, data) {
			var result;
			if( data && data.length ) {
				for (var i=0; i < data.length; i++) {
					if( data[i].result.toLowerCase() == q.toLowerCase() ) {
						result = data[i];
						break;
					}
				}
			}
			if( typeof fn == "function" ) fn(result);
			else $input.trigger("result", result && [result.data, result.value]);
		}
		$.each(trimWords($input.val()), function(i, value) {
			request(value, findValueCallback, findValueCallback);
		});
	}).bind("flushCache", function() {
		cache.flush();
	}).bind("setOptions", function() {
		$.extend(options, arguments[1]);
		// if we've updated the data, repopulate
		if ( "data" in arguments[1] )
			cache.populate();
	}).bind("unautocomplete", function() {
		select.unbind();
		$input.unbind();
		$(input.form).unbind(".autocomplete");
	});
	
	
	function selectCurrent() {
		var selected = select.selected();
		if( !selected )
			return false;
		
		var v = selected.result;
		previousValue = v;
		
		if ( options.multiple ) {
			var words = trimWords($input.val());
			if ( words.length > 1 ) {
				v = words.slice(0, words.length - 1).join( options.multipleSeparator ) + options.multipleSeparator + v;
			}
			v += options.multipleSeparator;
		}
		
		$input.val(v);
		hideResultsNow();
		$input.trigger("result", [selected.data, selected.value]);
		return true;
	}
	
	function onChange(crap, skipPrevCheck) {
		if( lastKeyPressCode == KEY.DEL ) {
			select.hide();
			return;
		}
		
		var currentValue = $input.val();
		
		if ( !skipPrevCheck && currentValue == previousValue )
			return;
		
		previousValue = currentValue;
		
		currentValue = lastWord(currentValue);
		if ( currentValue.length >= options.minChars) {
			$input.addClass(options.loadingClass);
			if (!options.matchCase)
				currentValue = currentValue.toLowerCase();
			request(currentValue, receiveData, hideResultsNow);
		} else {
			stopLoading();
			select.hide();
		}
	};
	
	function trimWords(value) {
		if ( !value ) {
			return [""];
		}
		var words = value.split( options.multipleSeparator );
		var result = [];
		$.each(words, function(i, value) {
			if ( $.trim(value) )
				result[i] = $.trim(value);
		});
		return result;
	}
	
	function lastWord(value) {
		if ( !options.multiple )
			return value;
		var words = trimWords(value);
		return words[words.length - 1];
	}
	
	// fills in the input box w/the first match (assumed to be the best match)
	// q: the term entered
	// sValue: the first matching result
	function autoFill(q, sValue){
		// autofill in the complete box w/the first match as long as the user hasn't entered in more data
		// if the last user key pressed was backspace, don't autofill
		if( options.autoFill && (lastWord($input.val()).toLowerCase() == q.toLowerCase()) && lastKeyPressCode != KEY.BACKSPACE ) {
			// fill in the value (keep the case the user has typed)
			$input.val($input.val() + sValue.substring(lastWord(previousValue).length));
			// select the portion of the value not typed by the user (so the next character will erase)
			$.Autocompleter.Selection(input, previousValue.length, previousValue.length + sValue.length);
		}
	};

	function hideResults() {
		clearTimeout(timeout);
		timeout = setTimeout(hideResultsNow, 200);
	};

	function hideResultsNow() {
		var wasVisible = select.visible();
		select.hide();
		clearTimeout(timeout);
		stopLoading();
		if (options.mustMatch) {
			// call search and run callback
			$input.search(
				function (result){
					// if no value found, clear the input box
					if( !result ) {
						if (options.multiple) {
							var words = trimWords($input.val()).slice(0, -1);
							$input.val( words.join(options.multipleSeparator) + (words.length ? options.multipleSeparator : "") );
						}
						else
							$input.val( "" );
					}
				}
			);
		}
		if (wasVisible)
			// position cursor at end of input field
			$.Autocompleter.Selection(input, input.value.length, input.value.length);
	};

	function receiveData(q, data) {
		if ( data && data.length && hasFocus ) {
			stopLoading();
			select.display(data, q);
			autoFill(q, data[0].value);
			select.show();
		} else {
			hideResultsNow();
		}
	};

	function request(term, success, failure) {
		if (!options.matchCase)
			term = term.toLowerCase();
		var data = cache.load(term);
		// recieve the cached data
		/*if (data && data.length) {
			success(term, data);
		// if an AJAX url has been supplied, try loading the data now
		} else */
		if( (typeof options.url == "string") && (options.url.length > 0) ){
			
			var extraParams = {
				timestamp: +new Date()
			};
			$.each(options.extraParams, function(key, param) {
				extraParams[key] = typeof param == "function" ? param() : param;
			});
			$(input).parent().addClass('load');
			$.ajax({
				// try to leverage ajaxQueue plugin to abort previous requests
				mode: "abort",
				// limit abortion to this input
				port: "autocomplete" + input.name,
				dataType: options.dataType,
				url: options.url,
				data: $.extend({
					q: lastWord(term),
					limit: options.max
				}, extraParams),
				success: function(data) {
					var parsed = options.parse && options.parse(data) || parse(data);
					cache.add(term, parsed);
					success(term, parsed);
					$(input).parent().removeClass('load');
				},
				error: function(e,msg){ 
					$(input).parent().addClass('error');
				}
			});
		} else {
			// if we have a failure, we need to empty the list -- this prevents the the [TAB] key from selecting the last successful match
			select.emptyList();
			failure(term);
		}
	};
	
	function parse(data) { 
		var parsed = [];
		var rows = data.split("\n");
		for (var i=0; i < rows.length; i++) {
			var row = $.trim(rows[i]);
			if (row) {
				row = row.split("|");
				parsed[parsed.length] = {
					data: row,
					value: row[0],
					result: options.formatResult && options.formatResult(row, row[0]) || row[0]
				};
			}
		}
		return parsed;
	};

	function stopLoading() {
		$input.removeClass(options.loadingClass);
	};

};

$.Autocompleter.defaults = {
	inputClass: "ac_input",
	resultsClass: "ac_results",
	loadingClass: "ac_loading",
	minChars: 1,
	delay: 400,
	matchCase: false,
	matchSubset: true,
	matchContains: false,
	cacheLength: 10,
	max: 100,
	mustMatch: false,
	extraParams: {},
	selectFirst: true,
	formatItem: function(row) { return row[0]; },
	formatMatch: null,
	autoFill: false,
	width: 0,
	multiple: false,
	multipleSeparator: ", ",
	highlight: function(value, term) {
		return value.replace(new RegExp("(?![^&;]+;)(?!<[^<>]*)(" + term.replace(/([\^\$\(\)\[\]\{\}\*\.\+\?\|\\])/gi, "\\$1") + ")(?![^<>]*>)(?![^&;]+;)", "gi"), "<strong>$1</strong>");
	},
    scroll: true,
    scrollHeight: 156
};

$.Autocompleter.Cache = function(options) {

	var data = {};
	var length = 0;
	
	function matchSubset(s, sub) {
		if (!options.matchCase) 
			s = s.toLowerCase();
		var i = s.indexOf(sub);
		if (options.matchContains == "word"){
			i = s.toLowerCase().search("\\b" + sub.toLowerCase());
		}
		if (i == -1) return false;
		return i == 0 || options.matchContains;
	};
	
	function add(q, value) {
		if (length > options.cacheLength){
			flush();
		}
		if (!data[q]){ 
			length++;
		}
		data[q] = value;
	}
	
	function populate(){
		if( !options.data ) return false;
		// track the matches
		var stMatchSets = {},
			nullData = 0;

		// no url was specified, we need to adjust the cache length to make sure it fits the local data store
		if( !options.url ) options.cacheLength = 1;
		
		// track all options for minChars = 0
		stMatchSets[""] = [];
		
		// loop through the array and create a lookup structure
		for ( var i = 0, ol = options.data.length; i < ol; i++ ) {
			var rawValue = options.data[i];
			// if rawValue is a string, make an array otherwise just reference the array
			rawValue = (typeof rawValue == "string") ? [rawValue] : rawValue;
			
			var value = options.formatMatch(rawValue, i+1, options.data.length);
			if ( value === false )
				continue;
				
			var firstChar = value.charAt(0).toLowerCase();
			// if no lookup array for this character exists, look it up now
			if( !stMatchSets[firstChar] ) 
				stMatchSets[firstChar] = [];

			// if the match is a string
			var row = {
				value: value,
				data: rawValue,
				result: options.formatResult && options.formatResult(rawValue) || value
			};
			
			// push the current match into the set list
			stMatchSets[firstChar].push(row);

			// keep track of minChars zero items
			if ( nullData++ < options.max ) {
				stMatchSets[""].push(row);
			}
		};

		// add the data items to the cache
		$.each(stMatchSets, function(i, value) {
			// increase the cache size
			options.cacheLength++;
			// add to the cache
			add(i, value);
		});
	}
	
	// populate any existing data
	setTimeout(populate, 25);
	
	function flush(){
		data = {};
		length = 0;
	}
	
	return {
		flush: flush,
		add: add,
		populate: populate,
		load: function(q) {
			if (!options.cacheLength || !length)
				return null;
			/* 
			 * if dealing w/local data and matchContains than we must make sure
			 * to loop through all the data collections looking for matches
			 */
			if( !options.url && options.matchContains ){
				// track all matches
				var csub = [];
				// loop through all the data grids for matches
				for( var k in data ){
					// don't search through the stMatchSets[""] (minChars: 0) cache
					// this prevents duplicates
					if( k.length > 0 ){
						var c = data[k];
						$.each(c, function(i, x) {
							// if we've got a match, add it to the array
							if (matchSubset(x.value, q)) {
								csub.push(x);
							}
						});
					}
				}				
				return csub;
			} else 
			// if the exact item exists, use it
			if (data[q]){
				return data[q];
			} else
			if (options.matchSubset) {
				for (var i = q.length - 1; i >= options.minChars; i--) {
					var c = data[q.substr(0, i)];
					if (c) {
						var csub = [];
						$.each(c, function(i, x) {
							if (matchSubset(x.value, q)) {
								csub[csub.length] = x;
							}
						});
						return csub;
					}
				}
			}
			return null;
		}
	};
};

$.Autocompleter.Select = function (options, input, select, config) { 
	var CLASSES = {
		ACTIVE: "ac_over"
	};
	
	var listItems,
		active = -1,
		data,
		term = "",
		needsInit = true,
		element,
		list;
	
	// Create results
	function init() { 
		if (!needsInit)
			return;
		element = $(input).parents('div[type]').find('ul')
		.hide()
		.addClass(options.resultsClass);
		//.css("position", "absolute");
		//.appendTo(document.body);
		
		list = $(element).mouseover( function(event) { 
			if(target(event).nodeName && target(event).nodeName.toUpperCase() == 'LI') { 
	            active = $("li", list).removeClass(CLASSES.ACTIVE).index(target(event));
			    $(target(event)).addClass(CLASSES.ACTIVE); 
	        } 
		}).click(function(event) {   

			$(target(event)).addClass(CLASSES.ACTIVE);
			select();
			// TODO provide option to avoid setting focus again after selection? useful for cleanup-on-focus
			input.focus();
			return false;
		}).mousedown(function() { 
			$(this).next().val($(input).next().find('li:eq('+active+')').attr('key'));
	
			config.mouseDownOnSelect = true; 
		}).mouseup(function() {
			config.mouseDownOnSelect = false;
		});
		
		if( options.width > 0 )
			element.css("width", options.width);
			
		needsInit = false;
	} 
	
	function target(event) {
		var element = event.target;

		while(element && element.tagName != "LI")
			element = element.parentNode;
		// more fun with IE, sometimes event.target is empty, just ignore it then
		if(!element)
			return [];
		return element;
	}

	function moveSelect(step) {  
		listItems.slice(active, active + 1).removeClass(CLASSES.ACTIVE);
		movePosition(step);
        var activeItem = listItems.slice(active, active + 1).addClass(CLASSES.ACTIVE);
        if(options.scroll) {
            var offset = 0;
            listItems.slice(0, active).each(function() {
				offset += this.offsetHeight;
			});
            if((offset + activeItem[0].offsetHeight - list.scrollTop()) > list[0].clientHeight) {
                list.scrollTop(offset + activeItem[0].offsetHeight - list.innerHeight());
            } else if(offset < list.scrollTop()) {
                list.scrollTop(offset);
            }
        }
	};
	
	function movePosition(step) {
		active += step;
		if (active < 0) {
			active = listItems.size() - 1;
		} else if (active >= listItems.size()) {
			active = 0;
		}
	}
	
	function limitNumberOfItems(available) {
		return options.max && options.max < available
			? options.max
			: available;
	}

	function fillList() {
		list.empty();
		var max = limitNumberOfItems(data.length);
		for (var i=0; i < max; i++) {
			if (!data[i])
				continue;
			var formatted = options.formatItem(data[i].data, i+1, max, data[i].value, term);
			if ( formatted === false )
				continue;
			var d_i = data[i].data[1];
			var li = $("<li/>").html( options.highlight(formatted, term) ).attr('key',d_i).addClass(i%2 == 0 ? "ac_even" : "ac_odd").appendTo(list)[0];
			$.data(li, "ac_data", data[i]);
		}
		listItems = list.find("li");
		//$(input).next().css('display','block');
		if ( options.selectFirst ) {
			listItems.slice(0, 1).addClass(CLASSES.ACTIVE);
			active = 0;
		}
		// apply bgiframe if available
		if ( $.fn.bgiframe )
			list.bgiframe();
	}
	
	return {
		display: function(d, q) {
			init();
			data = d;
			term = q;
			fillList();
		},
		next: function() {
			moveSelect(1);
		},
		prev: function() {
			moveSelect(-1);
		},
		pageUp: function() {
			if (active != 0 && active - 8 < 0) {
				moveSelect( -active );
			} else {
				moveSelect(-8);
			}
		},
		pageDown: function() {
			if (active != listItems.size() - 1 && active + 8 > listItems.size()) {
				moveSelect( listItems.size() - 1 - active );
			} else {
				moveSelect(8);
			}
		},
		hide: function() {
			$(element).parents('div[type]').css({ zIndex:'auto'});
			element && element.hide();
			listItems && listItems.removeClass(CLASSES.ACTIVE);
			active = -1;
		},
		visible : function() {
			return element && element.is(":visible");
		},
		current: function() {
			return this.visible() && (listItems.filter("." + CLASSES.ACTIVE)[0] || options.selectFirst && listItems[0]);
		},
		show: function() {
			var offset = $(input).parent().offset();
			if($(listItems).size()<6){
				element.css({ height: 'auto' });
			}
			$(element).parents('div[type]').css({ zIndex:999 });
			element.css({
				width: typeof options.width == "string" || options.width > 0 ? options.width : $(input).parent().width()+53,
				/*top: offset.top + $(input).parent().height()+4,
				left: offset.left,*/
				zIndex: 900
			}).show();
            if(options.scroll) {
                list.scrollTop(0);
                list.css({
					maxHeight: options.scrollHeight,
					overflow: 'auto'
				});
				
                if($.browser.msie && typeof document.body.style.maxHeight === "undefined") {
					var listHeight = 0;
					listItems.each(function() {
						listHeight += this.offsetHeight;
					});
					var scrollbarsVisible = listHeight > options.scrollHeight;
                    list.css('height', scrollbarsVisible ? options.scrollHeight : listHeight );
					if (!scrollbarsVisible) {
						// IE doesn't recalculate width when scrollbar disappears
						listItems.width( list.width() - parseInt(listItems.css("padding-left")) - parseInt(listItems.css("padding-right")) );
					}
                }
                
            }
		},
		selected: function() {  
			var selected = listItems && listItems.filter("." + CLASSES.ACTIVE).removeClass(CLASSES.ACTIVE);
			return selected && selected.length && $.data(selected[0], "ac_data"); 
		},
		emptyList: function (){
			list && list.empty();
		},
		unbind: function() {
			element && element.remove();
		}
	};
};

$.Autocompleter.Selection = function(field, start, end) { 
	if( field.createvalRange ){
		var selRange = field.createTextRange();
		selRange.collapse(true);
		selRange.moveStart("character", start);
		selRange.moveEnd("character", end);
		selRange.select();
	} else if( field.setSelectionRange ){
		field.setSelectionRange(start, end);
	} else {
		if( field.selectionStart ){
			field.selectionStart = start;
			field.selectionEnd = end;
		}
	}
	field.focus(); 
};

})(jQuery);

 /* forms.condition.js */ 
var backup_hints = {};

function condition(id,obj){
    if(id==1){ 
        if($(obj).text().length+1>=10){
            return true;	
        }
        return false;
    }
	
    if(id==2){ //check Login	
        var true_match_string = 'qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM1234567890._-';
        var input=$(obj).find('input')
        var log_str = input.val();
        var length = input.val().length;
        if(length<4){
            return false;
        }
        var status= -1;
        for( var i=0; i < length; i++ ) {			
            status = true_match_string.lastIndexOf(log_str.charAt(i));
            if( status == -1 ) {
                error=1;
                return false;
                break;
            }
        }
		
		
    }
	
    if(id==3){  //check Password
	
        var psw_ln=$(obj).find('input').val().length;
		
        $('#psword_status').children('.BarEl').removeClass('result');
        $('#psword_status').children('.BarEl').children('em').text('');			
										
        if (psw_ln>=6){
            $('#psword_status').children('.BarEl:first').addClass('result');
            $('#psword_status').children('.result').prev().children('em').text('');
            $('#psword_status').children('.BarEl:first').children('em').css({
                'background-position': '0 0'
            });
            $('#psword_status').children('.BarEl:first').children('em').text('ÑÐ»Ð°Ð±Ñ‹Ð¹');				
        }
        if (psw_ln<6){
            return false;
        }			
			
        if (psw_ln>10){
            $('#psword_status').children('.result').next().addClass('result'); 
            $('#psword_status').children('.result').prev().children('em').text('');
            $('#psword_status').children('.result').children('em').css({
                'background-position': '0 -17px'
            });
            $('#psword_status').children('.result').eq(1).children('em').text('Ð½Ð¾Ñ€Ð¼Ð°Ð»ÑŒÐ½Ñ‹Ð¹');
        }
			
        if (psw_ln>15){
            $('#psword_status').children('.result').next().addClass('result');
            $('#psword_status').children('.result').prev().children('em').text('');
            $('#psword_status').children('.result').children('em').css({
                'background-position': '0 -34px'
            });
            $('#psword_status').children('.result').eq(2).children('em').text('ÑÐ¸Ð»ÑŒÐ½Ñ‹Ð¹');
        }
			
        if (psw_ln>20){
            $('#psword_status').children('.result').next().addClass('result');
            $('#psword_status').children('.result').prev().children('em').text('');
            $('#psword_status').children('.result').children('em').css({
                'background-position': '0 -51px'
            });	
            $('#psword_status').children('.result').eq(3).children('em').text('ÑÐ¸Ð»ÑŒÐ½ÐµÐ¹ÑˆÐ¸Ð¹');
        }	
    }
				
    if(id==4){//check Email						
        var str = $(obj).find('input').val();		
        var regexp = /([a-zA-Z0-9_\.\-])+\@([a-zA-Z0-9_\.\-])+\.([a-zA-Z0-9]{2,4})/gi;
        var matches = str.match(regexp);
        if(matches!=null){
            return true;
        }
        return false; 
    }

    if(id==5){//check Login	with ajax
        var login = $(obj).find('input').val();
        var form = $(obj).parents('form');

        if(backup_hints.hint_nick == undefined)
            backup_hints.hint_nick = $(form).find('.hint_nick').text();

        var success = false;
        $.ajax({
            url: _LANG_URL+'/ajax-profile/checkNick/',
            async: false,
            data: {
                'nick':login
            },
            dataType: "json",
            success: function(data){
                success = !!data.success;
                var suggests = $('.suggests');
                if(data.msg != undefined && data.msg.length){
                    $(form).find('.hint_nick').addClass('error_info').text(data.msg);
                }else{
                    $(form).find('.hint_nick').removeClass('error_info').text(backup_hints.hint_nick);
                    $(suggests).children('*').not(':first').remove();
                    $(suggests).parent().hide();
                }
				
                if(data.suggest != undefined){
                    $(suggests).children('*').not(':first').remove();
                    $(suggests).parent().hide();
                    var i = 0;
                    for(login in data.suggest){
                        var element_id = "pp_radio" + i++;
                        var new_login = $(suggests).children(':first').clone().children('label').append(data.suggest[login]);
                        $(new_login).find('input').val(data.suggest[login]).attr("id", element_id);
                        $(new_login).attr("for", element_id);
                        $(suggests).append('<BR />').append($(new_login).show());
                    }
                    $(form).find('input[type=radio]').CheckRadio({
                        'display':'list'
                    });
                    $(suggests).parent().show();
                }
            }
        });
        return success;
    }

    if(id==6){//check Email
        var email = $(obj).find('input').val();
        var form = $(obj).parents('form');



        if(backup_hints.hint_email == undefined)
            backup_hints.hint_email = $(form).find('.hint_email').text();

        var success = false;
        $.ajax({
            url: _LANG_URL+'/ajax-profile/checkEmail/',
            async: false,
            data: {
                'email':email
            },
            dataType: "json",
            success: function(data){
                success = !!data.success;
                if(data.msg != undefined && data.msg.length){
                    $(form).find('.hint_email').addClass('error_info').text(data.msg);
                }else{
                    $(form).find('.hint_email').removeClass('error_info').text(backup_hints.hint_email);
                }
            }
        });
        return success;
    }

    if(id==7){ //check Password
        if(backup_hints.hint_password == undefined)
            backup_hints.hint_password = $('#dashboard_registration_popup').find('#hint_password').text();
			
        var form = $(obj).parents('form');	
        var psw=$(obj).find('input').val();
        var psw_ln=$(obj).find('input').val().length;	
		
        var x = PasswordStrengthMeter.passwordStrength(psw, $('#nick').find('input').val());
	
        if(psw_ln<6){
            $(form).find('#hint_password').addClass('error_info')
            $('#Popup .ProgressBar').children('.BarEl').removeClass('result');
            $('#Popup .ProgressBar').children('.BarEl').children('em').text('');
        }else{
            $(form).find('#hint_password').removeClass('error_info')
        }


        if(x == PasswordStrengthMeter.shortPass){
			
			
			
            $('#Popup .ProgressBar').children('.BarEl').removeClass('result');			
            $('#Popup .ProgressBar').children('.BarEl').children('em').text('');	
			
            $('#Popup .ProgressBar').children('.BarEl:first').addClass('result');
            $('#Popup .ProgressBar').children('.BarEl:first').children('em').css({
                'background-position': '0 0'
            });
            $('#Popup .ProgressBar').children('.BarEl:first').children('em').text('ÑÐ»Ð°Ð±Ñ‹Ð¹');				
        }
		
        if(x == PasswordStrengthMeter.badPass){						
            $('#Popup .ProgressBar').children('.BarEl').removeClass('result');			
            $('#Popup .ProgressBar').children('.BarEl').children('em').text('');	
			
            $('#Popup .ProgressBar').children('.BarEl:first').addClass('result');
            $('#Popup .ProgressBar').children('.BarEl').eq(1).addClass('result');			
            $('#Popup .ProgressBar').children('.result').children('em').css({
                'background-position': '0 -17px'
            });
            $('#Popup .ProgressBar').children('.result').eq(1).children('em').text('Ð½Ð¾Ñ€Ð¼Ð°Ð»ÑŒÐ½Ñ‹Ð¹');				
        }
			
        if(x == PasswordStrengthMeter.goodPass){						
            $('#Popup .ProgressBar').children('.BarEl').removeClass('result');			
            $('#Popup .ProgressBar').children('.BarEl').children('em').text('');	
			
            $('#Popup .ProgressBar').children('.BarEl:first').addClass('result');
            $('#Popup .ProgressBar').children('.BarEl').eq(1).addClass('result');
            $('#Popup .ProgressBar').children('.BarEl').eq(2).addClass('result');			
            $('#Popup .ProgressBar').children('.result').children('em').css({
                'background-position': '0 -34px'
            });
            $('#Popup .ProgressBar').children('.result').eq(2).children('em').text('ÑÐ¸Ð»ÑŒÐ½Ñ‹Ð¹');				
        }
			
        if(x == PasswordStrengthMeter.strongPass){						
            $('#Popup .ProgressBar').children('.BarEl').removeClass('result');			
            $('#Popup .ProgressBar').children('.BarEl').children('em').text('');	
			
            $('#Popup .ProgressBar').children('.BarEl').addClass('result');
            $('#Popup .ProgressBar').children('.result').children('em').css({
                'background-position': '0 -51px'
            });
            $('#Popup .ProgressBar').children('.result:last').children('em').text('ÑÐ¸Ð»ÑŒÐ½ÐµÐ¹ÑˆÐ¸Ð¹');				
        }	
						
        if(psw_ln == 0){
            $('#Popup .ProgressBar').children('.BarEl').removeClass('result');			
            $('#Popup .ProgressBar').children('.BarEl').children('em').text('');
        }
				
        if(psw_ln < 6){
            return false;
        }else{
            $('#dashboard_registration_popup').find('#hint_password').removeClass('error_info').text(backup_hints.hint_password);
            return true;
        }
    }
	
	if(id==12){//check Email						
		var str = $(obj).val().trim();
		var regexp = /([a-zA-Z0-9_\.\-])+\@([a-zA-Z0-9_\.\-])+\.([a-zA-Z0-9]{2,4})/gi;
		var matches = str.match(regexp);
		if(matches!=null && str.length > 0){
			return true;
		}
		 return false; 
	}
	if(id==13){
		if($(obj).val().length==0) return false;
	}

	if ( id == 8 ) { // check for input's values emptiness b.chechin
		if ($(obj).val().trim().length == 0) {
			return false
		}
	}
	if ( id == 9 ) { // check for input's values emptiness b.chechin
		if ($(obj).val().trim().length == 0 || $(obj).val().trim().length > 500) {
			return false
		}
	}
	if(id==10){//check Email						
		var str = $(obj).val();		
		var regexp = /([a-zA-Z0-9_\.\-])+\@([a-zA-Z0-9_\.\-])+\.([a-zA-Z0-9]{2,4})/gi;
		var matches = str.match(regexp);
		if(matches!=null){return true;} return false; 
	}



	
    // Ñ€Ð°Ð·Ñ€ÐµÑˆÐ°ÐµÑ‚ Ð²Ð²Ð¾Ð´Ð¸Ñ‚ÑŒ Ñ‚Ð¾Ð»ÑŒÐºÐ¾ Ð»Ð°Ñ‚Ð¸Ð½ÑÐºÐ¸ Ð±ÑƒÐºÐ²Ñ‹
    // Ð½ÐµÐ¾Ð±Ñ…Ð¾Ð´Ð¸Ð¼Ð¾ Ð´Ð»Ñ Ð·Ð°Ð¿Ð¾Ð»Ð½ÐµÐ½Ð¸Ñ Ð¿Ð°ÑÐ¿Ð¾Ñ€Ñ‚Ð½Ñ‹Ñ… Ð´Ð°Ð½Ð½Ñ‹Ñ… Ð² Ñ€Ð°Ð·Ð´ÐµÐ»Ðµ travel (b.chechin)
    if ( id == 'name' ) {
        var str = $(obj).val();
        var regexp = /^[a-zA-Z\-\s]+$/gi;
        var matches = str.match(regexp);
        if(matches!=null && str.length > 1 && str.length < 41){
            return true;
        }
        return false; 
    }
		
    if ( id == 'passport_seria' ) {
        var str = $(obj).val().trim();
        var regexp = /^[a-zA-Z]+$/gi;
        var matches = str.match(regexp);
        if(matches!=null && str.length == 2){
            return true;
        }
        return false; 
    }
		
    if ( id == 'passport_number' ) {
        var str = $(obj).val();
        var regexp = /^[0-9]+$/gi;
        var matches = str.match(regexp);
        if(matches != null && str.length == 6){
            return true;
        } 
        return false; 
    }
        
    if ( id == 'alphanumeric' ) {
        var str = $(obj).val();
        var regexp = /^[0-9a-zA-Z]+$/gi;
        var matches = str.match(regexp);
        if(matches!=null){
            return true;
        }
        return false; 
    }
        
    if ( id == 'numeric' ) {
        var str = $(obj).val();
        var regexp = /^[0-9]+$/gi;
        var matches = str.match(regexp);
        if(matches!=null){
            return true;
        }
        return false; 
    }
		
    if ( id == 'email' ) {
        var str = $(obj).val();
        var regexp = /([a-zA-Z0-9_\.\-])+\@([a-zA-Z0-9_\.\-])+\.([a-zA-Z0-9]{2,4})/gi;
        var matches = str.match(regexp);
        if(matches!=null){
            return true;
        }
        return false; 
    }
		
    if ( id == 'phone' ) {
        var str = $(obj).val().trim();
        var regexp = /^[0-9]+$/gi;
        var matches = str.match(regexp);
        if(matches!=null && str.length == 10){
            return true;
        } 	
        return false; 
    }
	
    if ( id == 'fio' ) {
        var str = $(obj).val().trim();
        var regexp = /^[a-zA-ZÐ°-ÑÐ-Ð¯Ñ‘ÐÑ–Ð†\s]+$/gi;
        var matches = str.match(regexp);
        if(matches!=null){
            return true;
        } 	
        return false; 
    }
		
    
    return true;
}

 /* carousel.standart_old.min.js */ 
/*
02.06.11 | 16:44
Kazakov Aleksey
tcarousel - TochkaCarousel ÑÑ‚Ð½Ð´Ð°Ñ€Ñ‚ ÐºÐ°Ñ€ÑƒÑÐµÐ»Ð¸ Ð´Ð»Ñ Ð¿Ð¾ÑˆÐ°Ð³Ð¾Ð²Ð¾Ð¹ Ð¿Ñ€Ð¾ÐºÑ€ÑƒÑ‚ÐºÐ¸ ÐºÐ¾Ð½Ñ‚ÐµÐ½Ñ‚Ð° Ð² Ð±Ð»Ð¾ÐºÐµ.
*/
(function($) { 
	$.carouselTochkaOld = function(options) { 

		var defaults = {
			step_li: 1, /*ÑˆÐ°Ð³ Ð¿Ñ€Ð¾ÐºÑ€ÑƒÑ‚ÐºÐ¸*/
			speed: 100, /*ÑÐºÐ¾Ñ€Ð¾ÑÑ‚ÑŒ Ð°Ð½Ð¸Ð¼Ð°Ñ†Ð¸Ð¸*/
			indent: 12, /*Ð¾Ñ‚ÑÑ‚ÑƒÐ¿Ñ‹ Ñ Ð»ÐµÐ²Ð° Ð¸Ð»Ð¸ ÑÐ¿Ñ€Ð°Ð²Ð° ÐµÑÐ»Ð¸ ÐµÑÑ‚ÑŒ*/
			img: false /* ÐµÑÐ»Ð¸ ÐµÑÑ‚ÑŒ ÐºÐ°Ñ€Ñ‚Ð¸Ð½ÐºÐ¸ - true	*/
		};
		
		var opts = $.extend(defaults, options);
		
		$.each(opts['lists'], function(index, value){   
			$.carouselSetupOld(opts,value);
		});
		
		
		   
	};
		$.carouselSetupOld = function(opts,value){
			var object = $('#'+value);
			var block = object.parents('.ContentBlock');
			var btn = block.find('.navButtons a');
			var tab = block.find('.tabs li');
			var width_li = object.find('>li').width(); 
			var size_li = object.find('>li').size();
			var step = (width_li+opts['indent'])*opts['step_li'];
			var width_ul = (width_li+opts['indent'])*size_li;
			var size_step = Math.ceil(size_li/opts['step_li']);
			var size_tab = tab.size();
			var size_img = '';
			var position = 1;
			var i_siz = 2;
			var arr_counter;
			var index;
			
			if(opts.img==true){ 
				buildImg(opts['step_li']);
			}
			counter(position, size_step);
			count_position(position,size_step)
			
			tab.click(function(){
				setTimeout(function(){
					if(object.parents('.TabContent')&&object.parents('.TabContent').css('display')=='none'){ return false;}
					arr_counter = object.attr('count').split(','); 
					counter(arr_counter[0], arr_counter[1]);
				},100);
			});
			btn.click(function(){
				var ul_left = object.offset().left - block.offset().left - (opts['indent']/2)-1;
	
				if($(this).hasClass('btn_next')){
					if(size_step<=position){ position = 0;}
					if(object.parents('.TabContent')&&object.parents('.TabContent').css('display')=='none'){ return false; }
					counter(1+position++, size_step);
					count_position(position, size_step);
					if(opts.img==true){
						buildImg(opts['step_li']*i_siz++);
					}
					if(ul_left<=(0-width_ul)+(step*2)){  
						object.css({left:0});
						return false;
					}
					var next_prev = '-=';
					
				}
				if($(this).hasClass('btn_prev')){
					if(position<=1){ position = size_step+1;}
					if(object.parents('.TabContent')&&object.parents('.TabContent').css('display')=='none'){ return false; }
					counter((position--)-1, size_step);
					count_position(position, size_step);
					if(opts.img==true){
						buildImg(size_li);
					} 
					if(ul_left>=0||ul_left==-6){  
						object.css({left:(0-width_ul)+step+'px'});
						return false;
					}
					if(ul_left>=0-step){
						object.css({left:0+'px'});
						return false;	
					}
					var next_prev = '+=';
				}
				if(object.parents('.TabContent')&&object.parents('.TabContent').css('display')=='none'){ return false;}
				object.animate({ left: next_prev+step+'px' },opts['speed']);
				return false;
			});
			
			function buildImg(size_img){  
				object.find('>li').each(function(index){
					if(index==size_img){ return false; }  
					
					if($(this).find('span[attr]')){  
					$(this).find('span[attr]').each(function(i){  
						var attr = $(this).attr('attr');
						var img = $('<img>');
						var arr = attr.split(',');
						
						for(i=0;i<arr.length;i++){
							var attr_name = arr[i].match(/\'(.*)\':\'(.*)\'/);
							img.load().attr(attr_name[1],attr_name[2]);
						}
						$(this).replaceWith(img);
					});
					}
				});
			}
			function counter(position, size_step){  
				setTimeout(function(){
					if(object.parents('.TabContent')&&object.parents('.TabContent').css('display')=='none'){ return false; } 
					block.find('.navButtons .Num').text(position);
					block.find('.navButtons .OfNums').text(size_step);
				},100);
			}
			function count_position(position,size_step){
				if(size_tab>0){ object.attr('count',position+','+size_step);}
			}
		
		};
		
		

		

})(jQuery);

 /* carousel.standart.min.js */ 
/*
19.01.12 | 13:45
Kazakov Aleksey
tcarousel - TochkaCarousel ??????? ???????? ??? ????????? ????????? ???????? ? ?????.
*/
(function($) {
	$.extend({
		carouselTochka: function(options){ 
			options = $.extend({}, $.carouselSetup.defaults, {}, options); 
			return $.each(options['lists'],function(index,value){ 
				new $.carouselSetup(options,value); 
			});
		},
		carouselOptions: function(options){ 
			return $.each(options['lists'],function(index,value){ 
				$('#'+value).trigger('carouselOptions', [options]);
			});
		}
	});	
		$.carouselSetup = function(options,value){
			if(options['counter']==false){
				var nav = '.NavButtons';
			}else{
				var nav = '#'+options['counter'];
			}
			var object = $('#'+value);
			var block = object.parents('.Block, .Popup');
			var btn = block.find(nav+' a');
			var tab = block.find('.Tabs li');
			var width_li = object.find('li.LiCol:eq(1)').width(); 
			var size_li = object.find('li.LiCol').size();			
			var step = (width_li+options['indent'])*options['step_li'];
			var width_ul = (width_li+options['indent'])*size_li;
			var size_step = Math.ceil(size_li/options['step_li']);
			var size_tab = tab.size();
			var size_img = '';
			var position = 1;
			var i_siz = 2;
			var arr_counter;
			var index;
			var n = size_li;
			var s = 0;
			//var indent_li = options['indent_li']/width_li;
			
			if(options.img==true){
				buildImg((options['index_show']+options['step_li'])-(options['step_li']*1),(options['index_show']+options['step_li'])-(options['step_li']*1)+options['step_li']);
			}
			object.css('width',width_ul+'px');
			counter(position, size_step);
			count_position(position,size_step);
			if(options['index_show']!=0){
				animation('',0-((options['index_show'])*(width_li+options['indent'])));
				counter((size_step-Math.ceil((size_li-options['index_show'])/options['step_li']))+1, size_step);
				position = (size_step-Math.ceil((size_li-options['index_show'])/options['step_li']))+1;

                (0-((options['index_show'])*(width_li+options['indent']))) - step ? block.find(nav+' a.BtnNext').addClass('disable') :
                    btn.removeClass('disable');

			}
			
			object.bind('carouselOptions',function(){ 
				n = size_li;
				s = 0;
				$.extend(options, arguments[1]);
				animation('',0-((options['index_show'])*(width_li+options['indent'])));
				buildImg(options['index_show'],options['index_show']+1);
			});
			tab.click(function(){
				setTimeout(function(){
					if(object.parents('.TabContent')&&object.parents('.TabContent').css('display')=='none'){ return false;}
					arr_counter = object.attr('count').split(','); 
					counter(arr_counter[0], arr_counter[1]);
					s = n = first_n =  0;
					n = size_li;
				},100);
			});
			btn.mousedown(function(){
				object.stop(true,true);
			});
			btn.click(function(){
				var ul_left = object.offset().left - object.parent().offset().left - (options['indent']/2)-1;
				
				if($(this).hasClass('BtnNext')){
					if(size_step<=position){ position = 0;}
					if(object.parents('.TabContent')&&object.parents('.TabContent').css('display')=='none'){ return false; }
					counter(1+position++, size_step);
					count_position(position, size_step);
					s = s+=options['step_li'];
					n = n+options['step_li'];
					var residue = (size_li - options['index_show'])-s;
					var first_n = size_li - residue;
					
					if(residue<=0){
						residue = size_li;
						options['index_show'] = s = first_n = 0;
						n = size_li;
					}
					var last_n = first_n+options['step_li'];
					if(options.img==true){
						buildImg(first_n,last_n);
					}

                    if(!options['circle']){
                        ul_left-step*2 <= (0-width_ul) ? $(this).addClass('disable') : btn.removeClass('disable');
                        if(ul_left-step <= (0-width_ul)){return false};
                    }

					if(ul_left<=(0-width_ul+step)){
						object.css({left:0});
						return false;
					}
					var next_prev = '-=';
					
				}
				if($(this).hasClass('BtnPrev')){

                    if(!options['circle']){
                        ul_left>=(0-step) ? $(this).addClass('disable') : btn.removeClass('disable');
                        if(ul_left>=(0-step)) {
                            animation('',0);
                            return false;}

                    }

					if(position<=1){ position = size_step+1;}



					if(object.parents('.TabContent')&&object.parents('.TabContent').css('display')=='none'){ return false; }
					counter((position--)-1, size_step);
					count_position(position, size_step);
					n = n-=options['step_li'];
					s = s-options['step_li'];

					var first_n = n - (size_li - options['index_show']);
					if(first_n<options['step_li']&&first_n>(0-options['step_li'])){ 
						first_n = 0;
					}
					if(first_n<0){
						s = n = first_n = 0;
						n = options['index_show'] = size_li;
						n = n - options['step_li'];
						first_n = size_li-options['step_li'];
					}
					
					var last_n = first_n+options['step_li'];
					if(first_n<options['step_li']&&first_n>(0-options['step_li'])){ 
						last_n = first_n+(options['step_li']*2);
					}
					if(options.img==true){
						buildImg(first_n,last_n);
					}  
					if(ul_left>=0||ul_left==-6||ul_left==-2){  
						object.css({left:(0-width_ul)+step+'px'});
						return false;
					}
					if(ul_left>=(0-width_li)){
						object.css({left:(0-width_ul)+step+'px'});
						return false;	
					}
					if(ul_left>=(0-step)){ 
						animation('',0);
						return false;	
					}
					var next_prev = '+=';
				}
				if(object.parents('.TabContent')&&object.parents('.TabContent').css('display')=='none'){ return false;}
				animation(next_prev,step);
				return false;
			});
			function animation(next_prev,step){
				object.animate({ left: next_prev+step+'px' },options['speed']);
			}
			
			function buildImg(first_n,last_n){
				var li = object.find('li.LiCol');
				
				for(index=first_n;index<last_n;index++){
					if(li.eq(index).find('span[attr]')){  
					li.eq(index).find('span[attr]').each(function(i){  
						var attr = $(this).attr('attr');
						var img = $('<img>');
						var arr = attr.split(',');
						
						for(i=0;i<arr.length;i++){
							var attr_name = arr[i].match(/\'(.*)\':\'(.*)?\'/);
							img.load();							
							if(typeof(attr_name)!='undefined' && attr_name != null) {
								if(typeof(attr_name[2])!='undefined'){
									img.attr(attr_name[1],attr_name[2]);
								}
							}
						}
						$(this).replaceWith(img);
					});
					}
				}
			}
			function counter(position, size_step){  
				setTimeout(function(){
					if(object.parents('.TabContent')&&object.parents('.TabContent').css('display')=='none'){ return false; } 
					block.find(nav+' .Num').text(position);
					block.find(nav+' .OfNums').text(size_step);
				},100);
			}
			function count_position(position,size_step){
				if(size_tab>0){ object.attr('count',position+','+size_step);}
			}
		
		};
		$.carouselSetup.defaults = {
			index_show: 0,
			step_li: 1,
			speed: 100,
			indent: 12,
			indent_li: false,
			img: false,
			counter: false,
            circle: true

		}

})(jQuery);
 /* gArticle.js */ 
$(function(){	
    if ($('#ArticleRefreshable').size() > 0){
        ajaxRefreshContent();
    }	
	
	addSourceLineToImage();
});

function ajaxRefreshContent(){
    setTimeout(function(){
        $.get(_LANG_URL + '/ajaxGetContent/', {'id': $('#article_id').attr('value')}, function(data){

			// Íàõîäèì ìåòêó ïåðåä ïåðâûì âèäåî íà ñòðàíèöå
			var video_id = $('#ArticleRefreshable .content_video_id:first').attr('id');
			if (video_id != ""){ // åñëè ó íàñ íà ñòðàíèöå åñòü âèäåî
				video_span = '<span id="'+video_id+'" class="content_video_id"></span>';
				var arData = data.split(video_span); // âûäåëÿåì èç ïðèøåäøåãî êîíòåíòà òîëüêî òî, ÷òî âûøå ïåðâîãî âèäåî
				if (arData[0] != data){
					// óäàëÿåì ñî ñòðàíèöû âñ¸, ÷òî âûøå âèäåî
					$('#ArticleRefreshable .content_video_id:first').parent().prevAll().remove(); 
					// âñòàâëÿåì ñâåðõó îáíîâë¸ííûé êóñîê
					$('#ArticleRefreshable').prepend(arData[0]);
				} else {
					// åñëè âèäåî áûëî óäàëåíî - ìåíÿåì âåñü êîíòåíò
					$('#ArticleRefreshable').html(data);
				}
			} else { // åñëè íåò âèäåî - ìåíÿåì âåñü êîíòåíò
				$('#ArticleRefreshable').html(data);
			}
			
			// Åñëè áûëè îòêðûòû ñêðûòûå áîëêè ïîä êíîïêàìè "÷èòàòü äàëüøå", òî îòêðûâàåì èõ çàíîâî.
			for (var i = 0; i < countReadMoreClicks; i++){
				$('.hidden_text:first').removeClass('hidden_text').show();
				if ($('.hidden_text').size() == 0){
					$('#ReadMore').remove();
				}
			}
			
			// äîáàâëÿåì ïîäïèñè ê îòêðûâøèìñÿ ôîòîãðàôèÿì
			addSourceLineToImage();
			
            ajaxRefreshContent();
        }, 'json');
    }, 30000);
}

var wrapNum = 1;
function addSourceLineToImage(){
	var width;
	var sSpan;
	var arSpan;
	var bFlag;
	var bWrapped;
	$('.imgInsideArticle:not(.hidden_text .imgInsideArticle)').each(function(){
		bWrapped = $(this).hasClass('wrapped');
		if (!bWrapped){
			width = this.offsetWidth;
			sSpan = $(this).next().html();
			if (sSpan != null){
				arSpan = sSpan.split('===');
				bFlag = true;
				if (typeof(arSpan[1]) != 'undefined' && arSpan[1] != '') {
					sSpan = arSpan[0] + ': ' + arSpan[1];
				} else if (typeof(arSpan[1]) != 'undefined' && arSpan[3] != '') {
					sSpan = arSpan[2] + ': ' + arSpan[3];
				} else {
					bFlag = false;
				}
				if (bFlag) {
					$(this).addClass('wrapable_' + wrapNum);
					$(this).addClass('wrapped');
					$(this).next().html(sSpan).addClass('wrapable_' + wrapNum).show();
					$('.wrapable_' + wrapNum).wrapAll('<span class="CopyrightOfPhoto" style="width:'+width+'px" />');
					wrapNum++;
				}
			}
		}
	});
}

var countReadMoreClicks = 0;
$('#ReadMoreLink').live('click', function(){
	$('.hidden_text:first').fadeIn(2000).removeClass('hidden_text').show();
	if ($('.hidden_text').size() == 0){
		$('#ReadMore').remove();
	}
	countReadMoreClicks++;
	addSourceLineToImage();
	return false;
});

$(document).ready(function(){
	
	$('ul.Condition>li').live('click', function(){
		if(!$(this).parent().hasClass('DisableScript')) {
            switchTab($(this));
            return false;
		}
	});
	
	$('.BlockTable').find('tr:odd').addClass('even');
	
});
function switchTab(obj){
    obj.parent().find('li').removeClass('active');
    obj.addClass('active');
    if(!obj.parent().hasClass("disable_pages")) {
            selTab = obj.find('a').attr('href').replace('#', '');
            obj.parents('.Block').find('.ConditionContent').hide().filter('#'+selTab).show();
			var count_li = obj.parents('.Block').find('.ConditionContent').filter('#'+selTab).find('li').size();
			buildImg(0,count_li, obj.parents('.Block').find('.ConditionContent').filter('#'+selTab));
    }
    return false;
}
/* kazakov */	
function buildImg(first_n,last_n,object) {
	var li = object.find('li');
	var dd;
	for(index=first_n;index<last_n;index++){
		if(li.eq(index).find('span[attr]')){  
		li.eq(index).find('span[attr]').each(function(i){  
			var attr = $(this).attr('attr');
			var img = $('<img>');
			var arr = attr.split(',');
			
			for(i=0;i<arr.length;i++){
				var attr_name = arr[i].match(/\'(.*)\':\'(.*)?\'/);
				img.load();
				if(typeof(attr_name)!='undefined' && attr_name != null) {
					if(typeof(attr_name[2])!='undefined'){
						img.attr(attr_name[1],attr_name[2]);
					}
				}
			}
			$(this).replaceWith(img);
		});
		}
	}
}
/* end kazakov */
 /* gGallery.js */ 
var gCarusel = function (block) {
    this.pub = 'asdfdsaf';
    /*
     * block is an associative array
     * we need to set
     *  - id                id of the carousel container
     *  - current           element we start with
     *  - itemsVisible      quantity of items will be displayed in block
     *  - slide             quantity of items we slide through
     *  - rollover          do we need to roll to the beginning of the list when reaching its end and vice versa
     */
    
    var picList = $('#'+block.id+' ul');
    var itemsCount = picList.children().length;	
    var itemWidth = picList.children()[0].clientWidth+parseInt($('#'+block.id+' ul li').css('marginRight')); //this is dirty hack. i don't found how to get actual width WITH marins for thy element
	
    //Count of All Pages 
    var allpages = (itemsCount - (itemsCount % block.slide)) / block.slide;
    if (itemsCount % block.slide > 0) allpages++;
    
    //Current Page
    var pageWidth = itemWidth * block.slide;
    var currDistance =  block.current * itemWidth;
    var currPage = (currDistance - (currDistance % pageWidth)) / pageWidth;
    if (currDistance % pageWidth > 0) currPage++;     
     
    //Last Item Pos
    var lastItem = (currPage) * block.slide;
    if ((allpages == currPage) && (itemsCount % block.slide > 0)) {
      lastItem = (currPage - 1) * block.slide + (itemsCount % block.slide);
    }  
    if (lastItem > itemsCount) lastItem = itemsCount; 
    
    //First Item Pos
    var firstItem = lastItem - block.slide + 1;
    if (firstItem < 1) firstItem = 1;
      
    var container = $('#' + block.id).find('.carousel_container ul:first');
    var slideWidth;
    var slideStep;
	  var nowSliding = false; 
    
    //public function to set current position	  
	  this.setCurrent = function (index){
	     currDistance =  index * itemWidth;
	     currPage = (currDistance - (currDistance % pageWidth)) / pageWidth;
	     if (currDistance % pageWidth > 0) currPage++; 
	     
       //Last Item Pos
       lastItem = (currPage) * block.slide;
       if ((allpages == currPage) && (itemsCount % block.slide > 0)) {
          lastItem = (currPage - 1) * block.slide + (itemsCount % block.slide);
       }  
       if (lastItem > itemsCount) lastItem = itemsCount; 
        
       //First Item Pos
       firstItem = lastItem - block.slide + 1;
       if (firstItem < 1) firstItem = 1;
    }
    
    if (itemsCount > block.slide) { // do we actually need a slider?     
        $('#'+block.id+' .gGallery_BtnNext').live('click', function() {
      			if (nowSliding) return false;
      			nowSliding = true;
    		
            //determining if we can slide normally
            if (lastItem + block.slide <= itemsCount) { // yes. sliding by block.slide value
                slideWidth = (block.slide) * itemWidth;
                firstItem = firstItem + block.slide;
                lastItem = firstItem + block.slide - 1;
                container.animate({left: '-='+slideWidth}, 'slow', function(){nowSliding = false;});                    
            } else if (lastItem == itemsCount) { // no and we reach end of the list. going to the beginning of our list
                //creating temp elements at the end of the list
                for (i = 0;i < block.slide; i ++) {
                    container.children().last().after($(container.children()[i]).clone());
                }
                slideWidth = (block.slide) * itemWidth;
                firstItem = firstItem + block.slide;
                lastItem = firstItem + block.slide - 1;
                container.animate({left: '-='+slideWidth}, 'slow',function () {
                    container.css('left','0px');
                    firstItem = 1;
                    lastItem = block.slide;
                    var newItemsCount = container.children().length;
                    
                    //Deleting temp elements at the end of list
                    for (i = newItemsCount; i >= itemsCount; i--) {
                        $(container.children()[i]).remove();
                    }    
          					nowSliding = false;
                });
            } else {   //no but we still have items to slide. sliding to the end of the list
                slideStep = itemsCount - lastItem; //here we define how much pics we need to slide
                slideWidth = (slideStep) * itemWidth;
                firstItem = firstItem + slideStep;
                lastItem = itemsCount;
                container.animate({left: '-='+slideWidth}, 'slow', function(){nowSliding = false;});
            }
            if (typeof(block.function_next) == 'function'){
                (block.function_next)();
            }
            return false;
    
        });
    
        $('#'+block.id+' .gGallery_BtnPrev').live('click', function() {
		
      			if (nowSliding) return false;
      			nowSliding = true;
		
            //determining if we can slide normally
            if (firstItem - block.slide >= 1) { // yes. sliding by block.slide value
                slideWidth = block.slide * itemWidth;
                firstItem = firstItem - block.slide;
                lastItem = firstItem + block.slide - 1;
                container.animate({left: '+=' + slideWidth}, 'slow', function(){nowSliding = false;});
            } else if (firstItem == 1) { // no and we reach beginning of the list. going to the end of our list
                container.css('width',(container.width() + itemsCount*itemWidth +20 - 0)+'px');
                container.children().first().before(container.children().clone());
                container.css('left','-'+(itemsCount*itemWidth - 0)+'px');
                slideWidth = block.slide * itemWidth;

                container.animate({left: '+=' + slideWidth}, 'slow',function () {
                    firstItem = itemsCount - block.slide + 1;
                    lastItem = firstItem + block.slide - 1;
                    for (i = 0; i < itemsCount; i++) {
                        container.children().first().remove();
                    }
                    nowSliding = false;  
                });
            } else {   //no but we still have items to slide. sliding to the beginning of the list
                slideWidth = (firstItem - 1) * itemWidth;//here we define how much pics we need to slide
                firstItem = 1;
                lastItem = block.slide;
                container.animate({left: '+='+slideWidth}, 'slow', function(){nowSliding = false;});
            }
            if (typeof(block.function_prev) == 'function'){
                (block.function_prev)();
            }
            return false;   
        });
    }
};

 /* profile_common.js */ 

var sendVerifyCode = function() {
    $.getScript('http://profile'+MAIN_DOMAIN+'activation-email/?XMLHttpRequest=1', function(){});
    return false;
};

var newReturnUrl = null;

var sendVerifyCodeCallback = function(requestResult) {
    requestResult = requestResult || {};
    if (requestResult.success) {
        popUp({
            pp_id: 'Popup',
            pp_event: '1',
            pp_param: 10,
            pp_header: requestResult.title,
            pp_content: requestResult.message,
            pp_class: 'EnterSite6'
        });
    }
};

function callRegisterForm() {
    location.replace($('#dashboard_a_register').attr('href'));
}

function getReturnUrl() {
    if(typeof(return_url)=='undefined'){
        if($('#StaticForm').length==1){
            returnUrl=$('#StaticForm input[name="return_url"]').attr('value');
        }else{
            returnUrl=$('.PopupLogin input[name="return_url"]').attr('value');
        }
    }else if(typeof(return_url)=='object'){
        returnUrl=$(return_url).attr('value');
    }else{
        returnUrl=return_url;
    }
    if(newReturnUrl){
        return newReturnUrl;
    }else{
        return returnUrl;
    }
}
function setReturnUrl(e){
    newReturnUrl = e;
}

function not_me(network) {
    if(!network)
        network=$('#dashboard_soc_registration_popup>input[name="adapter"]').attr('value');
    socialNetwork.init(network);
    socialNetwork.logoutPopup();
}

function socRegOnSubmit(e,t)
{
    e.preventDefault();
    var form = $(t);
    var preloader_box = $(form).find('.preloader_box');

    $(preloader_box).addClass('loader_on');

    $.ajax({
        url:_LANG_URL+'/ajax-profile/register/',
        type: 'post',
        async: false,
        data: $(form).serialize(),
        dataType: "json",
        success: function(data){
            if(data.successfull != undefined && data.successfull.length){
                $('body').append(data.successfull);
            } else {
                $(form).find('div[condition-id]').each(function(){
                    open_condition($(this).find('.element_edit'));
                });
            }
            setTimeout(function() {$(preloader_box).removeClass('loader_on');}, 2000);

        }
    });
    return false;
}
$(document).ready(function(){

    $('.sendVerifyCode a').attr('href','javascript:void(0);').click(sendVerifyCode);

    $("#dashboard_a_register, a.register").live('click', function(e){
        e.preventDefault();
        popUp(pp_setup4);
        hideTwitter();
        hideFacebook();
    });

    $('#dashboard_a_register input[type=checkbox]').CheckRadio({
        'display':'list'
    });

    $('.Popup .or').each(function(){
        var m_l = Math.round(((-1)*$(this).width())/2);
        $(this).css({marginLeft: m_l+'px'});
    });

    $('div[type], a[type]').formsTochka();

    $("input[name=suggest_item]").live('click', function(){
        $("div[name=nick]").attr('default-text', $(this).val()).formsTochka();
        $('.suggests').parent().hide();
        open_condition($('div[condition-id=5]').find('.element_edit'));
    });

    $('#dashboard_registration_popup, form.SocRegPopupForm').live('submit', function(event){
        socRegOnSubmit(event,this);
    });

    $('#dashboard_registration_popup, form.PopupLogin').live('submit', function(){
        var $form=$('#Popup form.PopupLogin');
        if($form.length==0)
            $form=$('#dashboard_registration_popup');
		var preloader_box=$form.find('.preloader_box');
		$(preloader_box).addClass('loader_on');


        if (typeof $form.find('input[name=adapter]').val() != 'undefined' && typeof $form.find('input[name=token]').val() != 'undefined') {
            return true;
        }
        var data=$form.serializeArray();
        var err=false;
        if(data[1].value.length<4)
        {
            $form.find('div.input[name=nick]').addClass('error');
            err = true;
        }
        else
            $form.find('div.input[name=nick]').removeClass('error');
        if(data[2].value.length<4)
        {
            $form.find('div.password[name=password]').addClass('error');
            err = true;
        }
        else
            $form.find('div.input[name=nick]').removeClass('error');

        if(err)
        {
            setTimeout(function() {$(preloader_box).removeClass('loader_on');}, 2000);
            return false;
        }
        setTimeout(function() {$(preloader_box).removeClass('loader_on');}, 2000);
        return true;
    });

    $('a.authorize').live('click', function(event){
        event.preventDefault();
        $.getScript('http://connect.facebook.net/en_US/all.js');
        popUp(LoginPopup);
    });

    $('.mail_redirect').click(function(event){
        event.preventDefault();
        var url=$(this).attr('href');
        $.ajax({
            type:'POST',
            url:_LANG_URL+'/ajax-profile/is_activate/',
            dataType: "json",
            success : function(data) {
                if (!data.hasIdentity) {
                    $.getScript('http://connect.facebook.net/en_US/all.js');
                    popUp(LoginPopup);
                    $('.PopupLogin input[name="return_url"]').attr('value',url);
                } else {
                    if (data['active']) {
                        window.location.href=url;
                    } else {
                        popUp(data['popup']);
                    }
                }
            }
        });
    });
});

function hideTwitter(el) {
}
function hideFacebook(el){
}
function hideVkontakte(el){
}

function authOverlayPopup(){
    popUp({
        pp_id: 'Popup',
        pp_event: '1',
        pp_param: 10,
        pp_header: '<h3>ÐÐ²Ñ‚Ð¾Ñ€Ð¸Ð·Ð°Ñ†Ð¸Ñ...</h3><div class="clear"></div>',
        pp_content: '<img src="http://i0.tchkcdn.com/images/framework/ic_loader_24x24.gif" alt="">',
        pp_class: 'authOverlay'
    });
}


var socialNetwork = {
    provider: undefined,
    callback: undefined,
    logoutCallback: undefined,
    otherData: undefined,
    winPopupClosedCheker: undefined,
    init: function(provider, callback, logoutCallback){
        if(provider != undefined){
            this.provider = provider; 
        }
        if(callback != undefined){
            this.callback = callback;
        }
        if(logoutCallback != undefined){
            this.logoutCallback = logoutCallback;
        }
    },
    authPopup: function(){
        if(this.provider != undefined){
            var popup = window.open(_LANG_URL+'/ajax-profile/socAuthRequest/'+this.provider+'/','','width=800,height=480,resizable=1,scrollbars=1');
            if(!popup.opener){
                popup.opener = self;
            }
            this.winPopupClosedCheker = setInterval(function() {
                if(popup.closed) {
                    clearInterval(socialNetwork.winPopupClosedCheker);
                    popUp({pp_id: 'Popup',pp_event: '2'});
                }
            }, 1000);
        }
    },

    logoutPopup: function(){
        if(this.provider != undefined) {
            var popup = window.open(_LANG_URL+'/ajax-profile/socLogoutRequest/'+this.provider+'/','','width=800,height=480,resizable=1,scrollbars=1');
            if(!popup.opener){
                popup.opener = self;
            }
        }
    },

    authCallback: function(data){
        clearInterval(socialNetwork.winPopupClosedCheker);
        authOverlayPopup();
        if(data){
            if(this.callback != undefined){
                var provider = this.provider;
                setTimeout(function(){
                    socialNetwork.callback(provider,data);
                    socialNetwork.callback = undefined;
                },0);
            }
        }else{
            //OAuth error
        }
    },
    
    logoutCallback: function(data) {
        console.log(data);
        if (data) {
            if(this.logoutCallback != undefined) {
                var provider = this.provider;
                setTimeout(function() {
                    socialNetwork.logoutCallback(provider, data);
                    socialNetwork.logoutCallback = undefined;
                }, 0);
            }
        }
    },
    
    getAuthForm: function(data,provider,return_url) {
        var loginForm = $('<form></form>')
                .attr({'action':'http://profile'+MAIN_DOMAIN+'login/','method':'post'})
                .css({'display':'none'})
                .append($('<input>').attr({'type':'hidden','name':'adapter','value':provider}))
                .append($('<input>').attr({'type':'hidden','name':'return_url','value':return_url}))
                .append($('<input>').attr({'type':'hidden','name':'id','value':data.profile.id}))
                .append($('<input>').attr({'type':'hidden','name':'key','value':data.profile.key}));
        $('body').append(loginForm);
        return loginForm;
    }
}

var socialAutorizeCallback = function(provider,data){
    authOverlayPopup();
    if(data){
        $.ajax({
            url:      _LANG_URL+'/ajax-profile/getAuthorize/'+provider+'/',
            type:     'GET',
            dataType: 'json',
            success : function(data) {
                if(data.success){
                    clearInterval(socialNetwork.winPopupClosedCheker);
                    var returnurl = getReturnUrl();
                    if(data.registred){
                        var loginform = socialNetwork.getAuthForm(data,provider,returnurl);
                        $(loginform).submit();
                    }else{
                        var email = '';
                        var avatar = '';
                        if(data.profile.email)
                            email = data.profile.email;
                        if(data.profile.avatar)
                            avatar = data.profile.avatar;

                        var clon = $('#SocRegPopup>.P_inner').clone();
                        var clon2 = $('#SocRegPopup>.P_header>*').clone();
                        var form = $(clon).find('form');
                        form.append($('<input>').attr({'type':'hidden','name':'adapter','value':provider}))
                            .append($('<input>').attr({'type':'hidden','name':'return_url','value':returnurl}))
                            .append($('<input>').attr({'type':'hidden','name':'id','value':data.profile.id}))
                            .append($('<input>').attr({'type':'hidden','name':'key','value':data.profile.key}));
                        $(clon2).find('span.name').text(data.profile.display_name);
                        $(clon).find('div.login').attr('default-text',data.profile.nickname);
                        $(clon).find('div.email').attr('default-text',email);
                        $(clon2).find('div.avatar').html('<img src="'+avatar+'" alt="" />');
                        $(clon).find('span.holderWrap').remove();

                        SocRegPopup4 = {
                            pp_id: 'Popup',
                            pp_event: '1',
                            pp_param: 10,
                            pp_header: $(clon2),
                            pp_content: $(clon).children(),
                            pp_class: 'EnterSite3'
                        };
                        popUp(SocRegPopup4);                            
                    }
                }
            }
        });
    }
}
 /* TochkaHeaderV3.js */ 
$(document).ready(function(){

/* barMenu */
		$('.barMenu').mouseover(function(){
			$('#portal_sections').show().addClass('activePopUp');
		});
		$('.barMenu').mouseleave(function(){
			$('#portal_sections').hide().removeClass('activePopUp');
		});
		$('.startpage').mouseover(function(){
			$('#startpage_menu').show().addClass('activePopUp');
		});
		$('.startpage').mouseleave(function(){
			$('#startpage_menu').hide().removeClass('activePopUp');
		});

/* LogoSearch */
	var currentSection = $('div.LogoSearch_select').find('span:first').text();

	$(".LogoSearch_select span").live('click',function(){
		$(this).parent(".LogoSearch_select").toggleClass("open_LogoSearch_select");
		$('#parts_selector ul').find('li').show();
		$('#parts_selector ul').find('li').each(function(){
			if ($(this).find('a').text() == currentSection){
				$(this).hide();
			}
		});
		if($(this).next().css('display')=='block'){
			$(this).next().addClass('activePopUp').css('display','none');
		}else{
			$(this).next().removeClass('activePopUp').slideDown(500);
		}
		return false;
	});

	$(".LogoSearch_select_drop_down a").live('click',function(){
            
                if($(this).text() == 'Google') {
                    $(".main_search_block").hide();
                    $("#google_search").show();
                    $('#header-search-box').attr('action', $(this).attr('rel'));
                    $('.LogoSearch_select').find('span').text($(this).text());
                    currentSection = $(this).text();
                } else {
                    $(".main_search_block").show();
                    $("#google_search").hide();
                    $('#header-search-box').attr('action', $(this).attr('rel'))
                    $('.LogoSearch_select').find('span').text($(this).text());
                    currentSection = $(this).text();
                }
				$(this).parents('.LogoSearch_select_drop_down').hide();
		return false;
	});
        

	var ActivePopUp = false;
	$('.open_LogoSearch_select, div.dropdown, div.DropDownList').live('mousemove',function(){
		ActivePopUp = true;
	});
	$(document).click(function(){
		if (ActivePopUp == true) {
			$('div.dropdown, div.DropDownList').filter('.activePopUp').hide().removeClass('activePopUp');
			$(".LogoSearch_select").removeClass("open_LogoSearch_select");
			ActivePopUp = false;
		}
	});

/* menu */
	$(".submenu").hover(
		function () {
			$(this).addClass('hover-bg');
			$(this).find(".SubDrop").show();
		}
	);
	$(".submenu").mouseleave(
		function () {
			$(this).removeClass('hover-bg');
			$(this).find(".SubDrop").hide();
		}
	);

/* TopMenu */
	$('div.TopMenu .level_2 .container ul li:last').find('a').css({'border-right' : "none"});

	/* $('div.TopMenu .level_1 .container .submenu .SubDrop').children('a:odd').css({'background-color' : "red"});*/
	$('div.TopMenu .level_1 .container .submenu .SubDrop').children('a:not(:odd)').css({'background-color' : "#eef9ff"});

});
 /* captcha.js */ 
var Captcha = function(obj){
    var captcha_error = "Captcha error";
    var captchaMultiSendBlocker = 0;
    var isCaptchaInitialized = false;

    // The function which knows a difference between dev and prod
    var getDomain = function(){
        var domain = '';
        var url = location.href;
        if (url.search('tochka.net') != -1){
            domain = '.tochka.net';
        } else if (url.search('tchktest.com') != -1) {
			domain = '.tchktest.com';
		} else {
            domain = '.portal.dvdev.org.ua';
        }
        return domain;
    }

    var getUserDomain = function(){
        var domain = '';
        /*var url = location.href;
        if (url.search('tochka.net') != -1){
            domain = '.tochka.net';
        } else {
			user = url.match(/\.portal\.([a-z0-9_]*)\.dvdev\.org\.ua/);			
            domain = '.portal.' + user[1] + '.dvdev.org.ua';
        }*/
        domain = location.hostname;
        if (domain.search('tochka') != 0){
        	domain = domain.substr(domain.indexOf('.'));
        } else {
			domain = '.' + domain;
		}
		domain = domain + '/' + LANG_URL;
        return domain;
    }	
	
    // user defined properties/methods
    this.imageId = typeof obj.imageId != 'undefined' ? obj.imageId : 'captcha_image';
    this.captchaTextId = typeof obj.captchaTextId != 'undefined' ? obj.captchaTextId : 'captchaText';
    this.captchaButtonId = typeof obj.captchaButtonId != 'undefined' ? obj.captchaButtonId : 'captcha_button';
    this.success = obj.successAction;

    // Render captcha popup
    this.init = function(){
        if (!isCaptchaInitialized){
            captchaMultiSendBlocker = 0;
            var c = this;
			c.showCaptchaPopup();			
			c.reload();
            isCaptchaInitialized = true;
        }
    }

    // Reload captcha image
    this.reload = function(){
        var c = this;
        $.getScript("http://captcha" + getUserDomain() + "captcha/reload/?DM=0", function(){
            var domain = getDomain();
            $("#" + c.imageId).attr("src", "http://s0" + domain + "/captcha/" + captcha_src);
            c.cleanInputField();
            $("#" + c.imageId).load(function() {
            	$('#' + c.captchaButtonId).click(function(){
            		c.validate();
                        return false;
            	});
            });
        });
    }

    // Validate captcha value
    this.validate = function(){
        var c = this;
        if (captchaMultiSendBlocker == 0){
            $.post(_LANG_URL + '/captcha_checker/', {'captcha': $('#' + c.captchaTextId).val()}, function(data){
                if ($.trim(data).length > 0) {
                    c.notify(captcha_error);
                    c.reload();
                    captchaMultiSendBlocker = 0;
                    c.cleanInputField();
                } else {
                    c.success();
                    return true;
                }
            });
            captchaMultiSendBlocker++;
        }
    }

    // Close (remove) captcha popup
    this.close = function(){
		var c = this;
		$('#'+c.imageId).attr('src', '');
        $('div.popup_overlay').hide();
        $('#captchaBlock').hide();
        captchaMultiSendBlocker = 0;
        isCaptchaInitialized = false;
    }

    // Alert any message
    this.notify = function(mes){
        alert(mes);
    }

    this.cleanInputField = function(){
        var c = this;
        $('#'+c.captchaTextId).val('').focus();
    }
	
    if (typeof(this.showCaptchaPopup) == 'undefined'){
	  this.showCaptchaPopup = function(){
		$('div.popup_overlay').show();
		$('#captchaBlock').show();
	  }
    }
};

 /* search.js */ 

$(document).ready(function(){
    
		$(".search_select ul li:nth-child(even)").addClass('even');
		$(".search_select ul li:nth-child(odd)").addClass('odd');
		$(".search_select ul li").hover(
		  function () {
			$(this).addClass('hover');
		  }, 
		  function () {
			$(this).removeClass('hover');
		  }
		);


/* page search - form search */

        var ActiveDropdown = false;
        
        $(document).click(function(){
            if (ActiveDropdown == true) {
                 $(".search_select").removeClass("open_search_select");
                 $(".search_select_drop_down").hide(); 
                 ActiveDropdown = false;
            }
        });
                
         $(".search_select span").click(function(){
            if (ActiveDropdown == true) {
                 $(".search_select").removeClass("open_search_select");
                 $(".search_select_drop_down").hide(); 
                 ActiveDropdown = false;
            } else {
                $(".search_select").addClass("open_search_select");
                $(".search_select_drop_down").show(); 
                ActiveDropdown = true;
            }
                
          
            return false;
        }); 
          
        

        $('#search_category_list a').click(function(){
            $('#search_form').attr('action', $(this).attr('rel'));
        });
        
        
        $(".search_select ul li").bind('click',function(){
            var search_form = $(this).find('b').attr('class');
            var text_selected = $(this).find('a').text();

            if(search_form == 'google_ic') {   
                
               $('#searchInGoogle').show();
               $('#searchInTochka').hide();        
               //$('#cse-search-box').attr('action', $(this).find('a').attr('rel'));
            } else {
               $('#searchInGoogle').hide();
               $('#searchInTochka').show();
               $('#search_form').attr('action', $(this).find('a').attr('rel'));
            }
            setTimeout(function(){
                $(".search_select").removeClass("open_search_select");
                $('.dropdown_default_item').text(text_selected);
                $(".search_select_drop_down").hide();
                $('#search_category_list').hide();        
            }, 100)
            ActiveDropdown = false;
            return false;
            
        });

        
    
        

});

    function searchInGoogle(query) {
        $('#cse-search-box input.LogoSearch_inp').attr('value',query);
        $('#cse-search-box').submit();
    }
             


/* page search - form search */




 /* radiocheck_V2.js */ 


	jQuery.fn.CheckRadio = function(settings) {
		settings = jQuery.extend({
					checkboxWidth: 17,
					checkboxHeight: 17,
					className : 'CheckRadio',
					display: 'inline'
				}, settings);

		$(this).each(function(){
			// Find the label
			$label = $('label[for="'+$(this).attr('id')+'"]');

			// Add the checkbox holder to the label
			$label.prepend("<span class='holderWrap'><span class='holder'></span></span>");

			// If the checkbox is checked, display it as checked
			if($(this).is(':checked')) { $label.addClass('checked'); };

			// Assign the class on the label
			$label.addClass(settings.className).addClass($(this).attr('type')).addClass(settings.display);

			// Assign the dimensions to the checkbox display
			$label.find('span.holderWrap').width(settings.checkboxWidth).height(settings.checkboxHeight);
			$label.find('span.holder').width(settings.checkboxWidth);

			// Hide the checkbox
			$(this).addClass('hiddenCheckbox');

			// Associate the click event
			$label.bind('click',function(){
				$('input#' + $(this).attr('for')).triggerHandler('click');
				
				if($('input#' + $(this).attr('for')).is(':checkbox')){
					$(this).toggleClass('checked');
					$('input#' + $(this).attr('for')).checked = true;
					
					$(this).find('span.holder').css('top',0);
				}else{
					$toCheck = $('input#' + $(this).attr('for'));

					// Uncheck all radio
					$('input[name="'+$toCheck.attr('name')+'"]').each(function(){
						$('label[for="' + $(this).attr('id')+'"]').removeClass('checked');	
					});

					$(this).addClass('checked');
					$toCheck.checked = true;
				};
			});
			
			$('input#' + $label.attr('for')).bind('keypress',function(e){
				if(e.keyCode == 32){
					if($.browser.msie){
						$('label[for="'+$(this).attr('id')+'"]').toggleClass("checked");
					}else{
						$(this).trigger('click');
					}
					return false;
				};
			});
		});
	};
	
	checkAllCheckRadio = function(caller, container){
		if($(caller).is(':checked')){
			// Find the label corresponding to each checkbox and click it
			$(container).find('input[type=checkbox]:not(:checked)').each(function(){
				$('label[for="'+$(this).attr('id')+'"]').trigger('click');
				if($.browser.msie){
					$(this).attr('checked','checked');
				}else{
					$(this).trigger('click');
				};
			});
		}else{
			$(container).find('input[type=checkbox]:checked').each(function(){
				$('label[for="'+$(this).attr('id')+'"]').trigger('click');
				if($.browser.msie){
					$(this).attr('checked','');
				}else{
					$(this).trigger('click');
				};
			});
		};
	};
 /* textlimiter.js */ 
jQuery.fn.textlimit=function(thelimit, counter_el , speed) {
     var charDelSpeed = speed || 15;
     var toggleCharDel = speed != -1;
     var toggleTrim = true;

     var that = this[0];
     updateCounter();

     function updateCounter(){
         if(counter_el)
             jQuery(counter_el).text(thelimit - that.value.length);
     };

     this.keypress (function(e){ if( this.value.length >= thelimit && e.charCode != '0' ) e.preventDefault() })
     .keyup (function(e){
         updateCounter();
         if( this.value.length >= thelimit && toggleTrim ){
             if(toggleCharDel){
                 // first, trim the text a bit so the char trimming won't take forever
                 that.value = that.value.substr(0,thelimit+100);
                 var init = setInterval
                     (
                         function(){
                             if( that.value.length <= thelimit) {
                             	init = clearInterval(init); updateCounter()
                             }
                             else {

                             	that.value = that.value.substring(0,that.value.length-1);
                             	if(counter_el)
                             		jQuery(counter_el).text(''+(thelimit - that.value.length));
                             };
                         } ,charDelSpeed
                     );
             }
             else this.value = that.value.substr(0,thelimit);
         }
     });
 };
 /* AC_OETags.js */ 
// Flash Player Version Detection - Rev 1.6
// Detect Client Browser type
// Copyright(c) 2005-2006 Adobe Macromedia Software, LLC. All rights reserved.
var isIE  = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;
var isWin = (navigator.appVersion.toLowerCase().indexOf("win") != -1) ? true : false;
var isOpera = (navigator.userAgent.indexOf("Opera") != -1) ? true : false;

function ControlVersion()
{
	var version;
	var axo;
	var e;

	// NOTE : new ActiveXObject(strFoo) throws an exception if strFoo isn't in the registry

	try {
		// version will be set for 7.X or greater players
		axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");
		version = axo.GetVariable("$version");
	} catch (e) {
	}

	if (!version)
	{
		try {
			// version will be set for 6.X players only
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");
			
			// installed player is some revision of 6.0
			// GetVariable("$version") crashes for versions 6.0.22 through 6.0.29,
			// so we have to be careful. 
			
			// default to the first public version
			version = "WIN 6,0,21,0";

			// throws if AllowScripAccess does not exist (introduced in 6.0r47)		
			axo.AllowScriptAccess = "always";

			// safe to call for 6.0r47 or greater
			version = axo.GetVariable("$version");

		} catch (e) {
		}
	}

	if (!version)
	{
		try {
			// version will be set for 4.X or 5.X player
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");
			version = axo.GetVariable("$version");
		} catch (e) {
		}
	}

	if (!version)
	{
		try {
			// version will be set for 3.X player
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");
			version = "WIN 3,0,18,0";
		} catch (e) {
		}
	}

	if (!version)
	{
		try {
			// version will be set for 2.X player
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
			version = "WIN 2,0,0,11";
		} catch (e) {
			version = -1;
		}
	}
	
	return version;
}

// JavaScript helper required to detect Flash Player PlugIn version information
function GetSwfVer(){
	// NS/Opera version >= 3 check for Flash plugin in plugin array
	var flashVer = -1;
	
	if (navigator.plugins != null && navigator.plugins.length > 0) {
		if (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]) {
			var swVer2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : "";
			var flashDescription = navigator.plugins["Shockwave Flash" + swVer2].description;
			var descArray = flashDescription.split(" ");
			var tempArrayMajor = descArray[2].split(".");			
			var versionMajor = tempArrayMajor[0];
			var versionMinor = tempArrayMajor[1];
			var versionRevision = descArray[3];
			if (versionRevision == "") {
				versionRevision = descArray[4];
			}
			if (versionRevision[0] == "d") {
				versionRevision = versionRevision.substring(1);
			} else if (versionRevision[0] == "r") {
				versionRevision = versionRevision.substring(1);
				if (versionRevision.indexOf("d") > 0) {
					versionRevision = versionRevision.substring(0, versionRevision.indexOf("d"));
				}
			}
			var flashVer = versionMajor + "." + versionMinor + "." + versionRevision;
			//alert("flashVer="+flashVer);
		}
	}
	// MSN/WebTV 2.6 supports Flash 4
	else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.6") != -1) flashVer = 4;
	// WebTV 2.5 supports Flash 3
	else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.5") != -1) flashVer = 3;
	// older WebTV supports Flash 2
	else if (navigator.userAgent.toLowerCase().indexOf("webtv") != -1) flashVer = 2;
	else if ( isIE && isWin && !isOpera ) {
		flashVer = ControlVersion();
	}	
	return flashVer;
}

// When called with reqMajorVer, reqMinorVer, reqRevision returns true if that version or greater is available
function DetectFlashVer(reqMajorVer, reqMinorVer, reqRevision)
{
	versionStr = GetSwfVer();

	if (versionStr == -1 ) {
		return false;
	} else if (versionStr != 0) {
		if(isIE && isWin && !isOpera) {
			// Given "WIN 2,0,0,11"
			tempArray         = versionStr.split(" "); 	// ["WIN", "2,0,0,11"]
			tempString        = tempArray[1];			// "2,0,0,11"
			versionArray      = tempString.split(",");	// ['2', '0', '0', '11']
		} else {
			versionArray      = versionStr.split(".");
		}
		var versionMajor      = versionArray[0];
		var versionMinor      = versionArray[1];
		var versionRevision   = versionArray[2];

        	// is the major.revision >= requested major.revision AND the minor version >= requested minor
		if (versionMajor > parseFloat(reqMajorVer)) {
			return true;
		} else if (versionMajor == parseFloat(reqMajorVer)) {
			if (versionMinor > parseFloat(reqMinorVer))
				return true;
			else if (versionMinor == parseFloat(reqMinorVer)) {
				if (versionRevision >= parseFloat(reqRevision))
					return true;
			}
		}
		return false;
	}
}

function AC_AddExtension(src, ext)
{
  if (src.indexOf('?') != -1)
    return src.replace(/\?/, ext+'?'); 
  else
    return src + ext;
}

function AC_Generateobj(objAttrs, params, embedAttrs) 
{ 
    var str = '';
    if (isIE && isWin && !isOpera)
    {
  		str += '<object ';
  		for (var i in objAttrs)
  			str += i + '="' + objAttrs[i] + '" ';
  		for (var i in params)
  			str += '><param name="' + i + '" value="' + params[i] + '" /> ';
  		str += '></object>';
    } else {
  		str += '<embed ';
  		for (var i in embedAttrs)
  			str += i + '="' + embedAttrs[i] + '" ';
  		str += '> </embed>';
    }

    document.write(str);
}

function AC_FL_RunContent(){
  var ret = 
    AC_GetArgs
    (  arguments, ".swf", "movie", "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
     , "application/x-shockwave-flash"
    );
  AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs);
}

function AC_GetArgs(args, ext, srcParamName, classid, mimeType){
  var ret = new Object();
  ret.embedAttrs = new Object();
  ret.params = new Object();
  ret.objAttrs = new Object();
  for (var i=0; i < args.length; i=i+2){
    var currArg = args[i].toLowerCase();    

    switch (currArg){	
      case "classid":
        break;
      case "pluginspage":
        ret.embedAttrs[args[i]] = args[i+1];
        break;
      case "src":
      case "movie":	
        args[i+1] = AC_AddExtension(args[i+1], ext);
        ret.embedAttrs["src"] = args[i+1];
        ret.params[srcParamName] = args[i+1];
        break;
      case "onafterupdate":
      case "onbeforeupdate":
      case "onblur":
      case "oncellchange":
      case "onclick":
      case "ondblClick":
      case "ondrag":
      case "ondragend":
      case "ondragenter":
      case "ondragleave":
      case "ondragover":
      case "ondrop":
      case "onfinish":
      case "onfocus":
      case "onhelp":
      case "onmousedown":
      case "onmouseup":
      case "onmouseover":
      case "onmousemove":
      case "onmouseout":
      case "onkeypress":
      case "onkeydown":
      case "onkeyup":
      case "onload":
      case "onlosecapture":
      case "onpropertychange":
      case "onreadystatechange":
      case "onrowsdelete":
      case "onrowenter":
      case "onrowexit":
      case "onrowsinserted":
      case "onstart":
      case "onscroll":
      case "onbeforeeditfocus":
      case "onactivate":
      case "onbeforedeactivate":
      case "ondeactivate":
      case "type":
      case "codebase":
        ret.objAttrs[args[i]] = args[i+1];
        break;
      case "id":
      case "width":
      case "height":
      case "align":
      case "vspace": 
      case "hspace":
      case "class":
      case "title":
      case "accesskey":
      case "name":
      case "tabindex":
        ret.embedAttrs[args[i]] = ret.objAttrs[args[i]] = args[i+1];
        break;
      default:
        ret.embedAttrs[args[i]] = ret.params[args[i]] = args[i+1];
    }
  }
  ret.objAttrs["classid"] = classid;
  if (mimeType) ret.embedAttrs["type"] = mimeType;
  return ret;
}



 /* swfobject.js */ 
/*	SWFObject v2.2 <http://code.google.com/p/swfobject/> 
	is released under the MIT License <http://www.opensource.org/licenses/mit-license.php> 
*/
var swfobject=function(){var D="undefined",r="object",S="Shockwave Flash",W="ShockwaveFlash.ShockwaveFlash",q="application/x-shockwave-flash",R="SWFObjectExprInst",x="onreadystatechange",O=window,j=document,t=navigator,T=false,U=[h],o=[],N=[],I=[],l,Q,E,B,J=false,a=false,n,G,m=true,M=function(){var aa=typeof j.getElementById!=D&&typeof j.getElementsByTagName!=D&&typeof j.createElement!=D,ah=t.userAgent.toLowerCase(),Y=t.platform.toLowerCase(),ae=Y?/win/.test(Y):/win/.test(ah),ac=Y?/mac/.test(Y):/mac/.test(ah),af=/webkit/.test(ah)?parseFloat(ah.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,"$1")):false,X=!+"\v1",ag=[0,0,0],ab=null;if(typeof t.plugins!=D&&typeof t.plugins[S]==r){ab=t.plugins[S].description;if(ab&&!(typeof t.mimeTypes!=D&&t.mimeTypes[q]&&!t.mimeTypes[q].enabledPlugin)){T=true;X=false;ab=ab.replace(/^.*\s+(\S+\s+\S+$)/,"$1");ag[0]=parseInt(ab.replace(/^(.*)\..*$/,"$1"),10);ag[1]=parseInt(ab.replace(/^.*\.(.*)\s.*$/,"$1"),10);ag[2]=/[a-zA-Z]/.test(ab)?parseInt(ab.replace(/^.*[a-zA-Z]+(.*)$/,"$1"),10):0}}else{if(typeof O.ActiveXObject!=D){try{var ad=new ActiveXObject(W);if(ad){ab=ad.GetVariable("$version");if(ab){X=true;ab=ab.split(" ")[1].split(",");ag=[parseInt(ab[0],10),parseInt(ab[1],10),parseInt(ab[2],10)]}}}catch(Z){}}}return{w3:aa,pv:ag,wk:af,ie:X,win:ae,mac:ac}}(),k=function(){if(!M.w3){return}if((typeof j.readyState!=D&&j.readyState=="complete")||(typeof j.readyState==D&&(j.getElementsByTagName("body")[0]||j.body))){f()}if(!J){if(typeof j.addEventListener!=D){j.addEventListener("DOMContentLoaded",f,false)}if(M.ie&&M.win){j.attachEvent(x,function(){if(j.readyState=="complete"){j.detachEvent(x,arguments.callee);f()}});if(O==top){(function(){if(J){return}try{j.documentElement.doScroll("left")}catch(X){setTimeout(arguments.callee,0);return}f()})()}}if(M.wk){(function(){if(J){return}if(!/loaded|complete/.test(j.readyState)){setTimeout(arguments.callee,0);return}f()})()}s(f)}}();function f(){if(J){return}try{var Z=j.getElementsByTagName("body")[0].appendChild(C("span"));Z.parentNode.removeChild(Z)}catch(aa){return}J=true;var X=U.length;for(var Y=0;Y<X;Y++){U[Y]()}}function K(X){if(J){X()}else{U[U.length]=X}}function s(Y){if(typeof O.addEventListener!=D){O.addEventListener("load",Y,false)}else{if(typeof j.addEventListener!=D){j.addEventListener("load",Y,false)}else{if(typeof O.attachEvent!=D){i(O,"onload",Y)}else{if(typeof O.onload=="function"){var X=O.onload;O.onload=function(){X();Y()}}else{O.onload=Y}}}}}function h(){if(T){V()}else{H()}}function V(){var X=j.getElementsByTagName("body")[0];var aa=C(r);aa.setAttribute("type",q);var Z=X.appendChild(aa);if(Z){var Y=0;(function(){if(typeof Z.GetVariable!=D){var ab=Z.GetVariable("$version");if(ab){ab=ab.split(" ")[1].split(",");M.pv=[parseInt(ab[0],10),parseInt(ab[1],10),parseInt(ab[2],10)]}}else{if(Y<10){Y++;setTimeout(arguments.callee,10);return}}X.removeChild(aa);Z=null;H()})()}else{H()}}function H(){var ag=o.length;if(ag>0){for(var af=0;af<ag;af++){var Y=o[af].id;var ab=o[af].callbackFn;var aa={success:false,id:Y};if(M.pv[0]>0){var ae=c(Y);if(ae){if(F(o[af].swfVersion)&&!(M.wk&&M.wk<312)){w(Y,true);if(ab){aa.success=true;aa.ref=z(Y);ab(aa)}}else{if(o[af].expressInstall&&A()){var ai={};ai.data=o[af].expressInstall;ai.width=ae.getAttribute("width")||"0";ai.height=ae.getAttribute("height")||"0";if(ae.getAttribute("class")){ai.styleclass=ae.getAttribute("class")}if(ae.getAttribute("align")){ai.align=ae.getAttribute("align")}var ah={};var X=ae.getElementsByTagName("param");var ac=X.length;for(var ad=0;ad<ac;ad++){if(X[ad].getAttribute("name").toLowerCase()!="movie"){ah[X[ad].getAttribute("name")]=X[ad].getAttribute("value")}}P(ai,ah,Y,ab)}else{p(ae);if(ab){ab(aa)}}}}}else{w(Y,true);if(ab){var Z=z(Y);if(Z&&typeof Z.SetVariable!=D){aa.success=true;aa.ref=Z}ab(aa)}}}}}function z(aa){var X=null;var Y=c(aa);if(Y&&Y.nodeName=="OBJECT"){if(typeof Y.SetVariable!=D){X=Y}else{var Z=Y.getElementsByTagName(r)[0];if(Z){X=Z}}}return X}function A(){return !a&&F("6.0.65")&&(M.win||M.mac)&&!(M.wk&&M.wk<312)}function P(aa,ab,X,Z){a=true;E=Z||null;B={success:false,id:X};var ae=c(X);if(ae){if(ae.nodeName=="OBJECT"){l=g(ae);Q=null}else{l=ae;Q=X}aa.id=R;if(typeof aa.width==D||(!/%$/.test(aa.width)&&parseInt(aa.width,10)<310)){aa.width="310"}if(typeof aa.height==D||(!/%$/.test(aa.height)&&parseInt(aa.height,10)<137)){aa.height="137"}j.title=j.title.slice(0,47)+" - Flash Player Installation";var ad=M.ie&&M.win?"ActiveX":"PlugIn",ac="MMredirectURL="+O.location.toString().replace(/&/g,"%26")+"&MMplayerType="+ad+"&MMdoctitle="+j.title;if(typeof ab.flashvars!=D){ab.flashvars+="&"+ac}else{ab.flashvars=ac}if(M.ie&&M.win&&ae.readyState!=4){var Y=C("div");X+="SWFObjectNew";Y.setAttribute("id",X);ae.parentNode.insertBefore(Y,ae);ae.style.display="none";(function(){if(ae.readyState==4){ae.parentNode.removeChild(ae)}else{setTimeout(arguments.callee,10)}})()}u(aa,ab,X)}}function p(Y){if(M.ie&&M.win&&Y.readyState!=4){var X=C("div");Y.parentNode.insertBefore(X,Y);X.parentNode.replaceChild(g(Y),X);Y.style.display="none";(function(){if(Y.readyState==4){Y.parentNode.removeChild(Y)}else{setTimeout(arguments.callee,10)}})()}else{Y.parentNode.replaceChild(g(Y),Y)}}function g(ab){var aa=C("div");if(M.win&&M.ie){aa.innerHTML=ab.innerHTML}else{var Y=ab.getElementsByTagName(r)[0];if(Y){var ad=Y.childNodes;if(ad){var X=ad.length;for(var Z=0;Z<X;Z++){if(!(ad[Z].nodeType==1&&ad[Z].nodeName=="PARAM")&&!(ad[Z].nodeType==8)){aa.appendChild(ad[Z].cloneNode(true))}}}}}return aa}function u(ai,ag,Y){var X,aa=c(Y);if(M.wk&&M.wk<312){return X}if(aa){if(typeof ai.id==D){ai.id=Y}if(M.ie&&M.win){var ah="";for(var ae in ai){if(ai[ae]!=Object.prototype[ae]){if(ae.toLowerCase()=="data"){ag.movie=ai[ae]}else{if(ae.toLowerCase()=="styleclass"){ah+=' class="'+ai[ae]+'"'}else{if(ae.toLowerCase()!="classid"){ah+=" "+ae+'="'+ai[ae]+'"'}}}}}var af="";for(var ad in ag){if(ag[ad]!=Object.prototype[ad]){af+='<param name="'+ad+'" value="'+ag[ad]+'" />'}}aa.outerHTML='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'+ah+">"+af+"</object>";N[N.length]=ai.id;X=c(ai.id)}else{var Z=C(r);Z.setAttribute("type",q);for(var ac in ai){if(ai[ac]!=Object.prototype[ac]){if(ac.toLowerCase()=="styleclass"){Z.setAttribute("class",ai[ac])}else{if(ac.toLowerCase()!="classid"){Z.setAttribute(ac,ai[ac])}}}}for(var ab in ag){if(ag[ab]!=Object.prototype[ab]&&ab.toLowerCase()!="movie"){e(Z,ab,ag[ab])}}aa.parentNode.replaceChild(Z,aa);X=Z}}return X}function e(Z,X,Y){var aa=C("param");aa.setAttribute("name",X);aa.setAttribute("value",Y);Z.appendChild(aa)}function y(Y){var X=c(Y);if(X&&X.nodeName=="OBJECT"){if(M.ie&&M.win){X.style.display="none";(function(){if(X.readyState==4){b(Y)}else{setTimeout(arguments.callee,10)}})()}else{X.parentNode.removeChild(X)}}}function b(Z){var Y=c(Z);if(Y){for(var X in Y){if(typeof Y[X]=="function"){Y[X]=null}}Y.parentNode.removeChild(Y)}}function c(Z){var X=null;try{X=j.getElementById(Z)}catch(Y){}return X}function C(X){return j.createElement(X)}function i(Z,X,Y){Z.attachEvent(X,Y);I[I.length]=[Z,X,Y]}function F(Z){var Y=M.pv,X=Z.split(".");X[0]=parseInt(X[0],10);X[1]=parseInt(X[1],10)||0;X[2]=parseInt(X[2],10)||0;return(Y[0]>X[0]||(Y[0]==X[0]&&Y[1]>X[1])||(Y[0]==X[0]&&Y[1]==X[1]&&Y[2]>=X[2]))?true:false}function v(ac,Y,ad,ab){if(M.ie&&M.mac){return}var aa=j.getElementsByTagName("head")[0];if(!aa){return}var X=(ad&&typeof ad=="string")?ad:"screen";if(ab){n=null;G=null}if(!n||G!=X){var Z=C("style");Z.setAttribute("type","text/css");Z.setAttribute("media",X);n=aa.appendChild(Z);if(M.ie&&M.win&&typeof j.styleSheets!=D&&j.styleSheets.length>0){n=j.styleSheets[j.styleSheets.length-1]}G=X}if(M.ie&&M.win){if(n&&typeof n.addRule==r){n.addRule(ac,Y)}}else{if(n&&typeof j.createTextNode!=D){n.appendChild(j.createTextNode(ac+" {"+Y+"}"))}}}function w(Z,X){if(!m){return}var Y=X?"visible":"hidden";if(J&&c(Z)){c(Z).style.visibility=Y}else{v("#"+Z,"visibility:"+Y)}}function L(Y){var Z=/[\\\"<>\.;]/;var X=Z.exec(Y)!=null;return X&&typeof encodeURIComponent!=D?encodeURIComponent(Y):Y}var d=function(){if(M.ie&&M.win){window.attachEvent("onunload",function(){var ac=I.length;for(var ab=0;ab<ac;ab++){I[ab][0].detachEvent(I[ab][1],I[ab][2])}var Z=N.length;for(var aa=0;aa<Z;aa++){y(N[aa])}for(var Y in M){M[Y]=null}M=null;for(var X in swfobject){swfobject[X]=null}swfobject=null})}}();return{registerObject:function(ab,X,aa,Z){if(M.w3&&ab&&X){var Y={};Y.id=ab;Y.swfVersion=X;Y.expressInstall=aa;Y.callbackFn=Z;o[o.length]=Y;w(ab,false)}else{if(Z){Z({success:false,id:ab})}}},getObjectById:function(X){if(M.w3){return z(X)}},embedSWF:function(ab,ah,ae,ag,Y,aa,Z,ad,af,ac){var X={success:false,id:ah};if(M.w3&&!(M.wk&&M.wk<312)&&ab&&ah&&ae&&ag&&Y){w(ah,false);K(function(){ae+="";ag+="";var aj={};if(af&&typeof af===r){for(var al in af){aj[al]=af[al]}}aj.data=ab;aj.width=ae;aj.height=ag;var am={};if(ad&&typeof ad===r){for(var ak in ad){am[ak]=ad[ak]}}if(Z&&typeof Z===r){for(var ai in Z){if(typeof am.flashvars!=D){am.flashvars+="&"+ai+"="+Z[ai]}else{am.flashvars=ai+"="+Z[ai]}}}if(F(Y)){var an=u(aj,am,ah);if(aj.id==ah){w(ah,true)}X.success=true;X.ref=an}else{if(aa&&A()){aj.data=aa;P(aj,am,ah,ac);return}else{w(ah,true)}}if(ac){ac(X)}})}else{if(ac){ac(X)}}},switchOffAutoHideShow:function(){m=false},ua:M,getFlashPlayerVersion:function(){return{major:M.pv[0],minor:M.pv[1],release:M.pv[2]}},hasFlashPlayerVersion:F,createSWF:function(Z,Y,X){if(M.w3){return u(Z,Y,X)}else{return undefined}},showExpressInstall:function(Z,aa,X,Y){if(M.w3&&A()){P(Z,aa,X,Y)}},removeSWF:function(X){if(M.w3){y(X)}},createCSS:function(aa,Z,Y,X){if(M.w3){v(aa,Z,Y,X)}},addDomLoadEvent:K,addLoadEvent:s,getQueryParamValue:function(aa){var Z=j.location.search||j.location.hash;if(Z){if(/\?/.test(Z)){Z=Z.split("?")[1]}if(aa==null){return L(Z)}var Y=Z.split("&");for(var X=0;X<Y.length;X++){if(Y[X].substring(0,Y[X].indexOf("="))==aa){return L(Y[X].substring((Y[X].indexOf("=")+1)))}}}return""},expressInstallCallback:function(){if(a){var X=c(R);if(X&&l){X.parentNode.replaceChild(l,X);if(Q){w(Q,true);if(M.ie&&M.win){l.style.display="block"}}if(E){E(B)}}a=false}}}}();
 /* jquery.cookie.js */ 
/**
 * Cookie plugin
 *
 * Copyright (c) 2006 Klaus Hartl (stilbuero.de)
 * Dual licensed under the MIT and GPL licenses:
 * http://www.opensource.org/licenses/mit-license.php
 * http://www.gnu.org/licenses/gpl.html
 *
 */

/**
 * Create a cookie with the given name and value and other optional parameters.
 *
 * @example $.cookie('the_cookie', 'the_value');
 * @desc Set the value of a cookie.
 * @example $.cookie('the_cookie', 'the_value', { expires: 7, path: '/', domain: 'jquery.com', secure: true });
 * @desc Create a cookie with all available options.
 * @example $.cookie('the_cookie', 'the_value');
 * @desc Create a session cookie.
 * @example $.cookie('the_cookie', null);
 * @desc Delete a cookie by passing null as value. Keep in mind that you have to use the same path and domain
 *       used when the cookie was set.
 *
 * @param String name The name of the cookie.
 * @param String value The value of the cookie.
 * @param Object options An object literal containing key/value pairs to provide optional cookie attributes.
 * @option Number|Date expires Either an integer specifying the expiration date from now on in days or a Date object.
 *                             If a negative value is specified (e.g. a date in the past), the cookie will be deleted.
 *                             If set to null or omitted, the cookie will be a session cookie and will not be retained
 *                             when the the browser exits.
 * @option String path The value of the path atribute of the cookie (default: path of page that created the cookie).
 * @option String domain The value of the domain attribute of the cookie (default: domain of page that created the cookie).
 * @option Boolean secure If true, the secure attribute of the cookie will be set and the cookie transmission will
 *                        require a secure protocol (like HTTPS).
 * @type undefined
 *
 * @name $.cookie
 * @cat Plugins/Cookie
 * @author Klaus Hartl/klaus.hartl@stilbuero.de
 */

/**
 * Get the value of a cookie with the given name.
 *
 * @example $.cookie('the_cookie');
 * @desc Get the value of a cookie.
 *
 * @param String name The name of the cookie.
 * @return The value of the cookie.
 * @type String
 *
 * @name $.cookie
 * @cat Plugins/Cookie
 * @author Klaus Hartl/klaus.hartl@stilbuero.de
 */
jQuery.cookie = function(name, value, options) {
    if (typeof value != 'undefined') { // name and value given, set cookie
        options = options || {};
        if (value === null) {
            value = '';
            options.expires = -1;
        }
        var expires = '';
        if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) {
            var date;
            if (typeof options.expires == 'number') {
                date = new Date();
                date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000));
            } else {
                date = options.expires;
            }
            expires = '; expires=' + date.toUTCString(); // use expires attribute, max-age is not supported by IE
        }
        // CAUTION: Needed to parenthesize options.path and options.domain
        // in the following expressions, otherwise they evaluate to undefined
        // in the packed version for some reason...
        var path = options.path ? '; path=' + (options.path) : '';
        var domain = options.domain ? '; domain=' + (options.domain) : '';
        var secure = options.secure ? '; secure' : '';
        document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join('');
    } else { // only name given, get cookie
        var cookieValue = null;
        if (document.cookie && document.cookie != '') {
            var cookies = document.cookie.split(';');
            for (var i = 0; i < cookies.length; i++) {
                var cookie = jQuery.trim(cookies[i]);
                // Does this cookie string begin with the name we want?
                if (cookie.substring(0, name.length + 1) == (name + '=')) {
                    cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
                    break;
                }
            }
        }
        return cookieValue;
    }
};
 /* jquery-ui-personalized-1.6rc6.min.js */ 
/*!
 * jQuery UI 1.8.11
 *
 * 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(c,j){function k(a){return!c(a).parents().andSelf().filter(function(){return c.curCSS(this,"visibility")==="hidden"||c.expr.filters.hidden(this)}).length}c.ui=c.ui||{};if(!c.ui.version){c.extend(c.ui,{version:"1.8.11",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}});c.fn.extend({_focus:c.fn.focus,focus:function(a,b){return typeof a==="number"?this.each(function(){var d=this;setTimeout(function(){c(d).focus();b&&b.call(d)},a)}):this._focus.apply(this,arguments)},scrollParent:function(){var a;a=c.browser.msie&&/(static|relative)/.test(this.css("position"))||/absolute/.test(this.css("position"))?this.parents().filter(function(){return/(relative|absolute|fixed)/.test(c.curCSS(this,
"position",1))&&/(auto|scroll)/.test(c.curCSS(this,"overflow",1)+c.curCSS(this,"overflow-y",1)+c.curCSS(this,"overflow-x",1))}).eq(0):this.parents().filter(function(){return/(auto|scroll)/.test(c.curCSS(this,"overflow",1)+c.curCSS(this,"overflow-y",1)+c.curCSS(this,"overflow-x",1))}).eq(0);return/fixed/.test(this.css("position"))||!a.length?c(document):a},zIndex:function(a){if(a!==j)return this.css("zIndex",a);if(this.length){a=c(this[0]);for(var b;a.length&&a[0]!==document;){b=a.css("position");
if(b==="absolute"||b==="relative"||b==="fixed"){b=parseInt(a.css("zIndex"),10);if(!isNaN(b)&&b!==0)return b}a=a.parent()}}return 0},disableSelection:function(){return this.bind((c.support.selectstart?"selectstart":"mousedown")+".ui-disableSelection",function(a){a.preventDefault()})},enableSelection:function(){return this.unbind(".ui-disableSelection")}});c.each(["Width","Height"],function(a,b){function d(f,g,l,m){c.each(e,function(){g-=parseFloat(c.curCSS(f,"padding"+this,true))||0;if(l)g-=parseFloat(c.curCSS(f,
"border"+this+"Width",true))||0;if(m)g-=parseFloat(c.curCSS(f,"margin"+this,true))||0});return g}var e=b==="Width"?["Left","Right"]:["Top","Bottom"],h=b.toLowerCase(),i={innerWidth:c.fn.innerWidth,innerHeight:c.fn.innerHeight,outerWidth:c.fn.outerWidth,outerHeight:c.fn.outerHeight};c.fn["inner"+b]=function(f){if(f===j)return i["inner"+b].call(this);return this.each(function(){c(this).css(h,d(this,f)+"px")})};c.fn["outer"+b]=function(f,g){if(typeof f!=="number")return i["outer"+b].call(this,f);return this.each(function(){c(this).css(h,
d(this,f,true,g)+"px")})}});c.extend(c.expr[":"],{data:function(a,b,d){return!!c.data(a,d[3])},focusable:function(a){var b=a.nodeName.toLowerCase(),d=c.attr(a,"tabindex");if("area"===b){b=a.parentNode;d=b.name;if(!a.href||!d||b.nodeName.toLowerCase()!=="map")return false;a=c("img[usemap=#"+d+"]")[0];return!!a&&k(a)}return(/input|select|textarea|button|object/.test(b)?!a.disabled:"a"==b?a.href||!isNaN(d):!isNaN(d))&&k(a)},tabbable:function(a){var b=c.attr(a,"tabindex");return(isNaN(b)||b>=0)&&c(a).is(":focusable")}});
c(function(){var a=document.body,b=a.appendChild(b=document.createElement("div"));c.extend(b.style,{minHeight:"100px",height:"auto",padding:0,borderWidth:0});c.support.minHeight=b.offsetHeight===100;c.support.selectstart="onselectstart"in b;a.removeChild(b).style.display="none"});c.extend(c.ui,{plugin:{add:function(a,b,d){a=c.ui[a].prototype;for(var e in d){a.plugins[e]=a.plugins[e]||[];a.plugins[e].push([b,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:function(a,b){return document.compareDocumentPosition?a.compareDocumentPosition(b)&16:a!==b&&a.contains(b)},hasScroll:function(a,b){if(c(a).css("overflow")==="hidden")return false;b=b&&b==="left"?"scrollLeft":"scrollTop";var d=false;if(a[b]>0)return true;a[b]=1;d=a[b]>0;a[b]=0;return d},isOverAxis:function(a,b,d){return a>b&&a<b+d},isOver:function(a,b,d,e,h,i){return c.ui.isOverAxis(a,d,h)&&c.ui.isOverAxis(b,e,i)}})}})(jQuery);
;/*!
 * jQuery UI Widget 1.8.11
 *
 * 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,j){if(b.cleanData){var k=b.cleanData;b.cleanData=function(a){for(var c=0,d;(d=a[c])!=null;c++)b(d).triggerHandler("remove");k(a)}}else{var l=b.fn.remove;b.fn.remove=function(a,c){return this.each(function(){if(!c)if(!a||b.filter(a,[this]).length)b("*",this).add([this]).each(function(){b(this).triggerHandler("remove")});return l.call(b(this),a,c)})}}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(h){return!!b.data(h,
a)};b[e]=b[e]||{};b[e][a]=function(h,g){arguments.length&&this._createWidget(h,g)};c=new c;c.options=b.extend(true,{},c.options);b[e][a].prototype=b.extend(true,c,{namespace:e,widgetName:a,widgetEventPrefix:b[e][a].prototype.widgetEventPrefix||a,widgetBaseClass:f},d);b.widget.bridge(a,b[e][a])};b.widget.bridge=function(a,c){b.fn[a]=function(d){var e=typeof d==="string",f=Array.prototype.slice.call(arguments,1),h=this;d=!e&&f.length?b.extend.apply(null,[true,d].concat(f)):d;if(e&&d.charAt(0)==="_")return h;
e?this.each(function(){var g=b.data(this,a),i=g&&b.isFunction(g[d])?g[d].apply(g,f):g;if(i!==g&&i!==j){h=i;return false}}):this.each(function(){var g=b.data(this,a);g?g.option(d||{})._init():b.data(this,a,new c(d,this))});return h}};b.Widget=function(a,c){arguments.length&&this._createWidget(a,c)};b.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",options:{disabled:false},_createWidget:function(a,c){b.data(c,this.widgetName,this);this.element=b(c);this.options=b.extend(true,{},this.options,
this._getCreateOptions(),a);var d=this;this.element.bind("remove."+this.widgetName,function(){d.destroy()});this._create();this._trigger("create");this._init()},_getCreateOptions:function(){return b.metadata&&b.metadata.get(this.element[0])[this.widgetName]},_create:function(){},_init:function(){},destroy:function(){this.element.unbind("."+this.widgetName).removeData(this.widgetName);this.widget().unbind("."+this.widgetName).removeAttr("aria-disabled").removeClass(this.widgetBaseClass+"-disabled ui-state-disabled")},
widget:function(){return this.element},option:function(a,c){var d=a;if(arguments.length===0)return b.extend({},this.options);if(typeof a==="string"){if(c===j)return this.options[a];d={};d[a]=c}this._setOptions(d);return this},_setOptions:function(a){var c=this;b.each(a,function(d,e){c._setOption(d,e)});return this},_setOption:function(a,c){this.options[a]=c;if(a==="disabled")this.widget()[c?"addClass":"removeClass"](this.widgetBaseClass+"-disabled ui-state-disabled").attr("aria-disabled",c);return this},
enable:function(){return this._setOption("disabled",false)},disable:function(){return this._setOption("disabled",true)},_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){a=b.event.props.length;for(var f;a;){f=b.event.props[--a];c[f]=c.originalEvent[f]}}this.element.trigger(c,d);return!(b.isFunction(e)&&e.call(this.element[0],c,d)===false||c.isDefaultPrevented())}}})(jQuery);
;/*!
 * jQuery UI Mouse 1.8.11
 *
 * 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/Mouse
 *
 * Depends:
 *	jquery.ui.widget.js
 */
(function(b){b.widget("ui.mouse",{options:{cancel:":input,option",distance:1,delay:0},_mouseInit:function(){var a=this;this.element.bind("mousedown."+this.widgetName,function(c){return a._mouseDown(c)}).bind("click."+this.widgetName,function(c){if(true===b.data(c.target,a.widgetName+".preventClickEvent")){b.removeData(c.target,a.widgetName+".preventClickEvent");c.stopImmediatePropagation();return false}});this.started=false},_mouseDestroy:function(){this.element.unbind("."+this.widgetName)},_mouseDown:function(a){a.originalEvent=
a.originalEvent||{};if(!a.originalEvent.mouseHandled){this._mouseStarted&&this._mouseUp(a);this._mouseDownEvent=a;var c=this,e=a.which==1,f=typeof this.options.cancel=="string"?b(a.target).parents().add(a.target).filter(this.options.cancel).length:false;if(!e||f||!this._mouseCapture(a))return true;this.mouseDelayMet=!this.options.delay;if(!this.mouseDelayMet)this._mouseDelayTimer=setTimeout(function(){c.mouseDelayMet=true},this.options.delay);if(this._mouseDistanceMet(a)&&this._mouseDelayMet(a)){this._mouseStarted=
this._mouseStart(a)!==false;if(!this._mouseStarted){a.preventDefault();return true}}true===b.data(a.target,this.widgetName+".preventClickEvent")&&b.removeData(a.target,this.widgetName+".preventClickEvent");this._mouseMoveDelegate=function(d){return c._mouseMove(d)};this._mouseUpDelegate=function(d){return c._mouseUp(d)};b(document).bind("mousemove."+this.widgetName,this._mouseMoveDelegate).bind("mouseup."+this.widgetName,this._mouseUpDelegate);a.preventDefault();return a.originalEvent.mouseHandled=
true}},_mouseMove:function(a){if(b.browser.msie&&!(document.documentMode>=9)&&!a.button)return this._mouseUp(a);if(this._mouseStarted){this._mouseDrag(a);return a.preventDefault()}if(this._mouseDistanceMet(a)&&this._mouseDelayMet(a))(this._mouseStarted=this._mouseStart(this._mouseDownEvent,a)!==false)?this._mouseDrag(a):this._mouseUp(a);return!this._mouseStarted},_mouseUp:function(a){b(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate);
if(this._mouseStarted){this._mouseStarted=false;a.target==this._mouseDownEvent.target&&b.data(a.target,this.widgetName+".preventClickEvent",true);this._mouseStop(a)}return false},_mouseDistanceMet:function(a){return Math.max(Math.abs(this._mouseDownEvent.pageX-a.pageX),Math.abs(this._mouseDownEvent.pageY-a.pageY))>=this.options.distance},_mouseDelayMet:function(){return this.mouseDelayMet},_mouseStart:function(){},_mouseDrag:function(){},_mouseStop:function(){},_mouseCapture:function(){return true}})})(jQuery);
;/*
 * jQuery UI Position 1.8.11
 *
 * 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(c){c.ui=c.ui||{};var n=/left|center|right/,o=/top|center|bottom/,t=c.fn.position,u=c.fn.offset;c.fn.position=function(b){if(!b||!b.of)return t.apply(this,arguments);b=c.extend({},b);var a=c(b.of),d=a[0],g=(b.collision||"flip").split(" "),e=b.offset?b.offset.split(" "):[0,0],h,k,j;if(d.nodeType===9){h=a.width();k=a.height();j={top:0,left:0}}else if(d.setTimeout){h=a.width();k=a.height();j={top:a.scrollTop(),left:a.scrollLeft()}}else if(d.preventDefault){b.at="left top";h=k=0;j={top:b.of.pageY,
left:b.of.pageX}}else{h=a.outerWidth();k=a.outerHeight();j=a.offset()}c.each(["my","at"],function(){var f=(b[this]||"").split(" ");if(f.length===1)f=n.test(f[0])?f.concat(["center"]):o.test(f[0])?["center"].concat(f):["center","center"];f[0]=n.test(f[0])?f[0]:"center";f[1]=o.test(f[1])?f[1]:"center";b[this]=f});if(g.length===1)g[1]=g[0];e[0]=parseInt(e[0],10)||0;if(e.length===1)e[1]=e[0];e[1]=parseInt(e[1],10)||0;if(b.at[0]==="right")j.left+=h;else if(b.at[0]==="center")j.left+=h/2;if(b.at[1]==="bottom")j.top+=
k;else if(b.at[1]==="center")j.top+=k/2;j.left+=e[0];j.top+=e[1];return this.each(function(){var f=c(this),l=f.outerWidth(),m=f.outerHeight(),p=parseInt(c.curCSS(this,"marginLeft",true))||0,q=parseInt(c.curCSS(this,"marginTop",true))||0,v=l+p+(parseInt(c.curCSS(this,"marginRight",true))||0),w=m+q+(parseInt(c.curCSS(this,"marginBottom",true))||0),i=c.extend({},j),r;if(b.my[0]==="right")i.left-=l;else if(b.my[0]==="center")i.left-=l/2;if(b.my[1]==="bottom")i.top-=m;else if(b.my[1]==="center")i.top-=
m/2;i.left=Math.round(i.left);i.top=Math.round(i.top);r={left:i.left-p,top:i.top-q};c.each(["left","top"],function(s,x){c.ui.position[g[s]]&&c.ui.position[g[s]][x](i,{targetWidth:h,targetHeight:k,elemWidth:l,elemHeight:m,collisionPosition:r,collisionWidth:v,collisionHeight:w,offset:e,my:b.my,at:b.at})});c.fn.bgiframe&&f.bgiframe();f.offset(c.extend(i,{using:b.using}))})};c.ui.position={fit:{left:function(b,a){var d=c(window);d=a.collisionPosition.left+a.collisionWidth-d.width()-d.scrollLeft();b.left=
d>0?b.left-d:Math.max(b.left-a.collisionPosition.left,b.left)},top:function(b,a){var d=c(window);d=a.collisionPosition.top+a.collisionHeight-d.height()-d.scrollTop();b.top=d>0?b.top-d:Math.max(b.top-a.collisionPosition.top,b.top)}},flip:{left:function(b,a){if(a.at[0]!=="center"){var d=c(window);d=a.collisionPosition.left+a.collisionWidth-d.width()-d.scrollLeft();var g=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?g+e+h:d>0?g+e+h:0}},top:function(b,a){if(a.at[1]!=="center"){var d=c(window);d=a.collisionPosition.top+a.collisionHeight-d.height()-d.scrollTop();var g=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?g+e+h:d>0?g+e+h:0}}}};if(!c.offset.setOffset){c.offset.setOffset=function(b,a){if(/static/.test(c.curCSS(b,"position")))b.style.position="relative";var d=c(b),
g=d.offset(),e=parseInt(c.curCSS(b,"top",true),10)||0,h=parseInt(c.curCSS(b,"left",true),10)||0;g={top:a.top-g.top+e,left:a.left-g.left+h};"using"in a?a.using.call(b,g):d.css(g)};c.fn.offset=function(b){var a=this[0];if(!a||!a.ownerDocument)return null;if(b)return this.each(function(){c.offset.setOffset(this,b)});return u.call(this)}}})(jQuery);
;/*
 * jQuery UI Draggable 1.8.11
 *
 * 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/Draggables
 *
 * Depends:
 *	jquery.ui.core.js
 *	jquery.ui.mouse.js
 *	jquery.ui.widget.js
 */
(function(d){d.widget("ui.draggable",d.ui.mouse,{widgetEventPrefix:"drag",options:{addClasses:true,appendTo:"parent",axis:false,connectToSortable:false,containment:false,cursor:"auto",cursorAt:false,grid:false,handle:false,helper:"original",iframeFix:false,opacity:false,refreshPositions:false,revert:false,revertDuration:500,scope:"default",scroll:true,scrollSensitivity:20,scrollSpeed:20,snap:false,snapMode:"both",snapTolerance:20,stack:false,zIndex:false},_create:function(){if(this.options.helper==
"original"&&!/^(?:r|a|f)/.test(this.element.css("position")))this.element[0].style.position="relative";this.options.addClasses&&this.element.addClass("ui-draggable");this.options.disabled&&this.element.addClass("ui-draggable-disabled");this._mouseInit()},destroy:function(){if(this.element.data("draggable")){this.element.removeData("draggable").unbind(".draggable").removeClass("ui-draggable ui-draggable-dragging ui-draggable-disabled");this._mouseDestroy();return this}},_mouseCapture:function(a){var b=
this.options;if(this.helper||b.disabled||d(a.target).is(".ui-resizable-handle"))return false;this.handle=this._getHandle(a);if(!this.handle)return false;return true},_mouseStart:function(a){var b=this.options;this.helper=this._createHelper(a);this._cacheHelperProportions();if(d.ui.ddmanager)d.ui.ddmanager.current=this;this._cacheMargins();this.cssPosition=this.helper.css("position");this.scrollParent=this.helper.scrollParent();this.offset=this.positionAbs=this.element.offset();this.offset={top:this.offset.top-
this.margins.top,left:this.offset.left-this.margins.left};d.extend(this.offset,{click:{left:a.pageX-this.offset.left,top:a.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()});this.originalPosition=this.position=this._generatePosition(a);this.originalPageX=a.pageX;this.originalPageY=a.pageY;b.cursorAt&&this._adjustOffsetFromHelper(b.cursorAt);b.containment&&this._setContainment();if(this._trigger("start",a)===false){this._clear();return false}this._cacheHelperProportions();
d.ui.ddmanager&&!b.dropBehaviour&&d.ui.ddmanager.prepareOffsets(this,a);this.helper.addClass("ui-draggable-dragging");this._mouseDrag(a,true);return true},_mouseDrag:function(a,b){this.position=this._generatePosition(a);this.positionAbs=this._convertPositionTo("absolute");if(!b){b=this._uiHash();if(this._trigger("drag",a,b)===false){this._mouseUp({});return false}this.position=b.position}if(!this.options.axis||this.options.axis!="y")this.helper[0].style.left=this.position.left+"px";if(!this.options.axis||
this.options.axis!="x")this.helper[0].style.top=this.position.top+"px";d.ui.ddmanager&&d.ui.ddmanager.drag(this,a);return false},_mouseStop:function(a){var b=false;if(d.ui.ddmanager&&!this.options.dropBehaviour)b=d.ui.ddmanager.drop(this,a);if(this.dropped){b=this.dropped;this.dropped=false}if((!this.element[0]||!this.element[0].parentNode)&&this.options.helper=="original")return false;if(this.options.revert=="invalid"&&!b||this.options.revert=="valid"&&b||this.options.revert===true||d.isFunction(this.options.revert)&&
this.options.revert.call(this.element,b)){var c=this;d(this.helper).animate(this.originalPosition,parseInt(this.options.revertDuration,10),function(){c._trigger("stop",a)!==false&&c._clear()})}else this._trigger("stop",a)!==false&&this._clear();return false},cancel:function(){this.helper.is(".ui-draggable-dragging")?this._mouseUp({}):this._clear();return this},_getHandle:function(a){var b=!this.options.handle||!d(this.options.handle,this.element).length?true:false;d(this.options.handle,this.element).find("*").andSelf().each(function(){if(this==
a.target)b=true});return b},_createHelper:function(a){var b=this.options;a=d.isFunction(b.helper)?d(b.helper.apply(this.element[0],[a])):b.helper=="clone"?this.element.clone():this.element;a.parents("body").length||a.appendTo(b.appendTo=="parent"?this.element[0].parentNode:b.appendTo);a[0]!=this.element[0]&&!/(fixed|absolute)/.test(a.css("position"))&&a.css("position","absolute");return a},_adjustOffsetFromHelper:function(a){if(typeof a=="string")a=a.split(" ");if(d.isArray(a))a={left:+a[0],top:+a[1]||
0};if("left"in a)this.offset.click.left=a.left+this.margins.left;if("right"in a)this.offset.click.left=this.helperProportions.width-a.right+this.margins.left;if("top"in a)this.offset.click.top=a.top+this.margins.top;if("bottom"in a)this.offset.click.top=this.helperProportions.height-a.bottom+this.margins.top},_getParentOffset:function(){this.offsetParent=this.helper.offsetParent();var a=this.offsetParent.offset();if(this.cssPosition=="absolute"&&this.scrollParent[0]!=document&&d.ui.contains(this.scrollParent[0],
this.offsetParent[0])){a.left+=this.scrollParent.scrollLeft();a.top+=this.scrollParent.scrollTop()}if(this.offsetParent[0]==document.body||this.offsetParent[0].tagName&&this.offsetParent[0].tagName.toLowerCase()=="html"&&d.browser.msie)a={top:0,left:0};return{top:a.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:a.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if(this.cssPosition=="relative"){var a=this.element.position();return{top:a.top-
(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:a.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}}else return{top:0,left:0}},_cacheMargins:function(){this.margins={left:parseInt(this.element.css("marginLeft"),10)||0,top:parseInt(this.element.css("marginTop"),10)||0,right:parseInt(this.element.css("marginRight"),10)||0,bottom:parseInt(this.element.css("marginBottom"),10)||0}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),
height:this.helper.outerHeight()}},_setContainment:function(){var a=this.options;if(a.containment=="parent")a.containment=this.helper[0].parentNode;if(a.containment=="document"||a.containment=="window")this.containment=[(a.containment=="document"?0:d(window).scrollLeft())-this.offset.relative.left-this.offset.parent.left,(a.containment=="document"?0:d(window).scrollTop())-this.offset.relative.top-this.offset.parent.top,(a.containment=="document"?0:d(window).scrollLeft())+d(a.containment=="document"?
document:window).width()-this.helperProportions.width-this.margins.left,(a.containment=="document"?0:d(window).scrollTop())+(d(a.containment=="document"?document:window).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top];if(!/^(document|window|parent)$/.test(a.containment)&&a.containment.constructor!=Array){var b=d(a.containment)[0];if(b){a=d(a.containment).offset();var c=d(b).css("overflow")!="hidden";this.containment=[a.left+(parseInt(d(b).css("borderLeftWidth"),
10)||0)+(parseInt(d(b).css("paddingLeft"),10)||0),a.top+(parseInt(d(b).css("borderTopWidth"),10)||0)+(parseInt(d(b).css("paddingTop"),10)||0),a.left+(c?Math.max(b.scrollWidth,b.offsetWidth):b.offsetWidth)-(parseInt(d(b).css("borderLeftWidth"),10)||0)-(parseInt(d(b).css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left-this.margins.right,a.top+(c?Math.max(b.scrollHeight,b.offsetHeight):b.offsetHeight)-(parseInt(d(b).css("borderTopWidth"),10)||0)-(parseInt(d(b).css("paddingBottom"),
10)||0)-this.helperProportions.height-this.margins.top-this.margins.bottom]}}else if(a.containment.constructor==Array)this.containment=a.containment},_convertPositionTo:function(a,b){if(!b)b=this.position;a=a=="absolute"?1:-1;var c=this.cssPosition=="absolute"&&!(this.scrollParent[0]!=document&&d.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,f=/(html|body)/i.test(c[0].tagName);return{top:b.top+this.offset.relative.top*a+this.offset.parent.top*a-(d.browser.safari&&
d.browser.version<526&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollTop():f?0:c.scrollTop())*a),left:b.left+this.offset.relative.left*a+this.offset.parent.left*a-(d.browser.safari&&d.browser.version<526&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollLeft():f?0:c.scrollLeft())*a)}},_generatePosition:function(a){var b=this.options,c=this.cssPosition=="absolute"&&!(this.scrollParent[0]!=document&&d.ui.contains(this.scrollParent[0],
this.offsetParent[0]))?this.offsetParent:this.scrollParent,f=/(html|body)/i.test(c[0].tagName),e=a.pageX,g=a.pageY;if(this.originalPosition){if(this.containment){if(a.pageX-this.offset.click.left<this.containment[0])e=this.containment[0]+this.offset.click.left;if(a.pageY-this.offset.click.top<this.containment[1])g=this.containment[1]+this.offset.click.top;if(a.pageX-this.offset.click.left>this.containment[2])e=this.containment[2]+this.offset.click.left;if(a.pageY-this.offset.click.top>this.containment[3])g=
this.containment[3]+this.offset.click.top}if(b.grid){g=this.originalPageY+Math.round((g-this.originalPageY)/b.grid[1])*b.grid[1];g=this.containment?!(g-this.offset.click.top<this.containment[1]||g-this.offset.click.top>this.containment[3])?g:!(g-this.offset.click.top<this.containment[1])?g-b.grid[1]:g+b.grid[1]:g;e=this.originalPageX+Math.round((e-this.originalPageX)/b.grid[0])*b.grid[0];e=this.containment?!(e-this.offset.click.left<this.containment[0]||e-this.offset.click.left>this.containment[2])?
e:!(e-this.offset.click.left<this.containment[0])?e-b.grid[0]:e+b.grid[0]:e}}return{top:g-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+(d.browser.safari&&d.browser.version<526&&this.cssPosition=="fixed"?0:this.cssPosition=="fixed"?-this.scrollParent.scrollTop():f?0:c.scrollTop()),left:e-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+(d.browser.safari&&d.browser.version<526&&this.cssPosition=="fixed"?0:this.cssPosition=="fixed"?-this.scrollParent.scrollLeft():
f?0:c.scrollLeft())}},_clear:function(){this.helper.removeClass("ui-draggable-dragging");this.helper[0]!=this.element[0]&&!this.cancelHelperRemoval&&this.helper.remove();this.helper=null;this.cancelHelperRemoval=false},_trigger:function(a,b,c){c=c||this._uiHash();d.ui.plugin.call(this,a,[b,c]);if(a=="drag")this.positionAbs=this._convertPositionTo("absolute");return d.Widget.prototype._trigger.call(this,a,b,c)},plugins:{},_uiHash:function(){return{helper:this.helper,position:this.position,originalPosition:this.originalPosition,
offset:this.positionAbs}}});d.extend(d.ui.draggable,{version:"1.8.11"});d.ui.plugin.add("draggable","connectToSortable",{start:function(a,b){var c=d(this).data("draggable"),f=c.options,e=d.extend({},b,{item:c.element});c.sortables=[];d(f.connectToSortable).each(function(){var g=d.data(this,"sortable");if(g&&!g.options.disabled){c.sortables.push({instance:g,shouldRevert:g.options.revert});g.refreshPositions();g._trigger("activate",a,e)}})},stop:function(a,b){var c=d(this).data("draggable"),f=d.extend({},
b,{item:c.element});d.each(c.sortables,function(){if(this.instance.isOver){this.instance.isOver=0;c.cancelHelperRemoval=true;this.instance.cancelHelperRemoval=false;if(this.shouldRevert)this.instance.options.revert=true;this.instance._mouseStop(a);this.instance.options.helper=this.instance.options._helper;c.options.helper=="original"&&this.instance.currentItem.css({top:"auto",left:"auto"})}else{this.instance.cancelHelperRemoval=false;this.instance._trigger("deactivate",a,f)}})},drag:function(a,b){var c=
d(this).data("draggable"),f=this;d.each(c.sortables,function(){this.instance.positionAbs=c.positionAbs;this.instance.helperProportions=c.helperProportions;this.instance.offset.click=c.offset.click;if(this.instance._intersectsWith(this.instance.containerCache)){if(!this.instance.isOver){this.instance.isOver=1;this.instance.currentItem=d(f).clone().appendTo(this.instance.element).data("sortable-item",true);this.instance.options._helper=this.instance.options.helper;this.instance.options.helper=function(){return b.helper[0]};
a.target=this.instance.currentItem[0];this.instance._mouseCapture(a,true);this.instance._mouseStart(a,true,true);this.instance.offset.click.top=c.offset.click.top;this.instance.offset.click.left=c.offset.click.left;this.instance.offset.parent.left-=c.offset.parent.left-this.instance.offset.parent.left;this.instance.offset.parent.top-=c.offset.parent.top-this.instance.offset.parent.top;c._trigger("toSortable",a);c.dropped=this.instance.element;c.currentItem=c.element;this.instance.fromOutside=c}this.instance.currentItem&&
this.instance._mouseDrag(a)}else if(this.instance.isOver){this.instance.isOver=0;this.instance.cancelHelperRemoval=true;this.instance.options.revert=false;this.instance._trigger("out",a,this.instance._uiHash(this.instance));this.instance._mouseStop(a,true);this.instance.options.helper=this.instance.options._helper;this.instance.currentItem.remove();this.instance.placeholder&&this.instance.placeholder.remove();c._trigger("fromSortable",a);c.dropped=false}})}});d.ui.plugin.add("draggable","cursor",
{start:function(){var a=d("body"),b=d(this).data("draggable").options;if(a.css("cursor"))b._cursor=a.css("cursor");a.css("cursor",b.cursor)},stop:function(){var a=d(this).data("draggable").options;a._cursor&&d("body").css("cursor",a._cursor)}});d.ui.plugin.add("draggable","iframeFix",{start:function(){var a=d(this).data("draggable").options;d(a.iframeFix===true?"iframe":a.iframeFix).each(function(){d('<div class="ui-draggable-iframeFix" style="background: #fff;"></div>').css({width:this.offsetWidth+
"px",height:this.offsetHeight+"px",position:"absolute",opacity:"0.001",zIndex:1E3}).css(d(this).offset()).appendTo("body")})},stop:function(){d("div.ui-draggable-iframeFix").each(function(){this.parentNode.removeChild(this)})}});d.ui.plugin.add("draggable","opacity",{start:function(a,b){a=d(b.helper);b=d(this).data("draggable").options;if(a.css("opacity"))b._opacity=a.css("opacity");a.css("opacity",b.opacity)},stop:function(a,b){a=d(this).data("draggable").options;a._opacity&&d(b.helper).css("opacity",
a._opacity)}});d.ui.plugin.add("draggable","scroll",{start:function(){var a=d(this).data("draggable");if(a.scrollParent[0]!=document&&a.scrollParent[0].tagName!="HTML")a.overflowOffset=a.scrollParent.offset()},drag:function(a){var b=d(this).data("draggable"),c=b.options,f=false;if(b.scrollParent[0]!=document&&b.scrollParent[0].tagName!="HTML"){if(!c.axis||c.axis!="x")if(b.overflowOffset.top+b.scrollParent[0].offsetHeight-a.pageY<c.scrollSensitivity)b.scrollParent[0].scrollTop=f=b.scrollParent[0].scrollTop+
c.scrollSpeed;else if(a.pageY-b.overflowOffset.top<c.scrollSensitivity)b.scrollParent[0].scrollTop=f=b.scrollParent[0].scrollTop-c.scrollSpeed;if(!c.axis||c.axis!="y")if(b.overflowOffset.left+b.scrollParent[0].offsetWidth-a.pageX<c.scrollSensitivity)b.scrollParent[0].scrollLeft=f=b.scrollParent[0].scrollLeft+c.scrollSpeed;else if(a.pageX-b.overflowOffset.left<c.scrollSensitivity)b.scrollParent[0].scrollLeft=f=b.scrollParent[0].scrollLeft-c.scrollSpeed}else{if(!c.axis||c.axis!="x")if(a.pageY-d(document).scrollTop()<
c.scrollSensitivity)f=d(document).scrollTop(d(document).scrollTop()-c.scrollSpeed);else if(d(window).height()-(a.pageY-d(document).scrollTop())<c.scrollSensitivity)f=d(document).scrollTop(d(document).scrollTop()+c.scrollSpeed);if(!c.axis||c.axis!="y")if(a.pageX-d(document).scrollLeft()<c.scrollSensitivity)f=d(document).scrollLeft(d(document).scrollLeft()-c.scrollSpeed);else if(d(window).width()-(a.pageX-d(document).scrollLeft())<c.scrollSensitivity)f=d(document).scrollLeft(d(document).scrollLeft()+
c.scrollSpeed)}f!==false&&d.ui.ddmanager&&!c.dropBehaviour&&d.ui.ddmanager.prepareOffsets(b,a)}});d.ui.plugin.add("draggable","snap",{start:function(){var a=d(this).data("draggable"),b=a.options;a.snapElements=[];d(b.snap.constructor!=String?b.snap.items||":data(draggable)":b.snap).each(function(){var c=d(this),f=c.offset();this!=a.element[0]&&a.snapElements.push({item:this,width:c.outerWidth(),height:c.outerHeight(),top:f.top,left:f.left})})},drag:function(a,b){for(var c=d(this).data("draggable"),
f=c.options,e=f.snapTolerance,g=b.offset.left,n=g+c.helperProportions.width,m=b.offset.top,o=m+c.helperProportions.height,h=c.snapElements.length-1;h>=0;h--){var i=c.snapElements[h].left,k=i+c.snapElements[h].width,j=c.snapElements[h].top,l=j+c.snapElements[h].height;if(i-e<g&&g<k+e&&j-e<m&&m<l+e||i-e<g&&g<k+e&&j-e<o&&o<l+e||i-e<n&&n<k+e&&j-e<m&&m<l+e||i-e<n&&n<k+e&&j-e<o&&o<l+e){if(f.snapMode!="inner"){var p=Math.abs(j-o)<=e,q=Math.abs(l-m)<=e,r=Math.abs(i-n)<=e,s=Math.abs(k-g)<=e;if(p)b.position.top=
c._convertPositionTo("relative",{top:j-c.helperProportions.height,left:0}).top-c.margins.top;if(q)b.position.top=c._convertPositionTo("relative",{top:l,left:0}).top-c.margins.top;if(r)b.position.left=c._convertPositionTo("relative",{top:0,left:i-c.helperProportions.width}).left-c.margins.left;if(s)b.position.left=c._convertPositionTo("relative",{top:0,left:k}).left-c.margins.left}var t=p||q||r||s;if(f.snapMode!="outer"){p=Math.abs(j-m)<=e;q=Math.abs(l-o)<=e;r=Math.abs(i-g)<=e;s=Math.abs(k-n)<=e;if(p)b.position.top=
c._convertPositionTo("relative",{top:j,left:0}).top-c.margins.top;if(q)b.position.top=c._convertPositionTo("relative",{top:l-c.helperProportions.height,left:0}).top-c.margins.top;if(r)b.position.left=c._convertPositionTo("relative",{top:0,left:i}).left-c.margins.left;if(s)b.position.left=c._convertPositionTo("relative",{top:0,left:k-c.helperProportions.width}).left-c.margins.left}if(!c.snapElements[h].snapping&&(p||q||r||s||t))c.options.snap.snap&&c.options.snap.snap.call(c.element,a,d.extend(c._uiHash(),
{snapItem:c.snapElements[h].item}));c.snapElements[h].snapping=p||q||r||s||t}else{c.snapElements[h].snapping&&c.options.snap.release&&c.options.snap.release.call(c.element,a,d.extend(c._uiHash(),{snapItem:c.snapElements[h].item}));c.snapElements[h].snapping=false}}}});d.ui.plugin.add("draggable","stack",{start:function(){var a=d(this).data("draggable").options;a=d.makeArray(d(a.stack)).sort(function(c,f){return(parseInt(d(c).css("zIndex"),10)||0)-(parseInt(d(f).css("zIndex"),10)||0)});if(a.length){var b=
parseInt(a[0].style.zIndex)||0;d(a).each(function(c){this.style.zIndex=b+c});this[0].style.zIndex=b+a.length}}});d.ui.plugin.add("draggable","zIndex",{start:function(a,b){a=d(b.helper);b=d(this).data("draggable").options;if(a.css("zIndex"))b._zIndex=a.css("zIndex");a.css("zIndex",b.zIndex)},stop:function(a,b){a=d(this).data("draggable").options;a._zIndex&&d(b.helper).css("zIndex",a._zIndex)}})})(jQuery);
;/*
 * jQuery UI Droppable 1.8.11
 *
 * 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/Droppables
 *
 * Depends:
 *	jquery.ui.core.js
 *	jquery.ui.widget.js
 *	jquery.ui.mouse.js
 *	jquery.ui.draggable.js
 */
(function(d){d.widget("ui.droppable",{widgetEventPrefix:"drop",options:{accept:"*",activeClass:false,addClasses:true,greedy:false,hoverClass:false,scope:"default",tolerance:"intersect"},_create:function(){var a=this.options,b=a.accept;this.isover=0;this.isout=1;this.accept=d.isFunction(b)?b:function(c){return c.is(b)};this.proportions={width:this.element[0].offsetWidth,height:this.element[0].offsetHeight};d.ui.ddmanager.droppables[a.scope]=d.ui.ddmanager.droppables[a.scope]||[];d.ui.ddmanager.droppables[a.scope].push(this);
a.addClasses&&this.element.addClass("ui-droppable")},destroy:function(){for(var a=d.ui.ddmanager.droppables[this.options.scope],b=0;b<a.length;b++)a[b]==this&&a.splice(b,1);this.element.removeClass("ui-droppable ui-droppable-disabled").removeData("droppable").unbind(".droppable");return this},_setOption:function(a,b){if(a=="accept")this.accept=d.isFunction(b)?b:function(c){return c.is(b)};d.Widget.prototype._setOption.apply(this,arguments)},_activate:function(a){var b=d.ui.ddmanager.current;this.options.activeClass&&
this.element.addClass(this.options.activeClass);b&&this._trigger("activate",a,this.ui(b))},_deactivate:function(a){var b=d.ui.ddmanager.current;this.options.activeClass&&this.element.removeClass(this.options.activeClass);b&&this._trigger("deactivate",a,this.ui(b))},_over:function(a){var b=d.ui.ddmanager.current;if(!(!b||(b.currentItem||b.element)[0]==this.element[0]))if(this.accept.call(this.element[0],b.currentItem||b.element)){this.options.hoverClass&&this.element.addClass(this.options.hoverClass);
this._trigger("over",a,this.ui(b))}},_out:function(a){var b=d.ui.ddmanager.current;if(!(!b||(b.currentItem||b.element)[0]==this.element[0]))if(this.accept.call(this.element[0],b.currentItem||b.element)){this.options.hoverClass&&this.element.removeClass(this.options.hoverClass);this._trigger("out",a,this.ui(b))}},_drop:function(a,b){var c=b||d.ui.ddmanager.current;if(!c||(c.currentItem||c.element)[0]==this.element[0])return false;var e=false;this.element.find(":data(droppable)").not(".ui-draggable-dragging").each(function(){var g=
d.data(this,"droppable");if(g.options.greedy&&!g.options.disabled&&g.options.scope==c.options.scope&&g.accept.call(g.element[0],c.currentItem||c.element)&&d.ui.intersect(c,d.extend(g,{offset:g.element.offset()}),g.options.tolerance)){e=true;return false}});if(e)return false;if(this.accept.call(this.element[0],c.currentItem||c.element)){this.options.activeClass&&this.element.removeClass(this.options.activeClass);this.options.hoverClass&&this.element.removeClass(this.options.hoverClass);this._trigger("drop",
a,this.ui(c));return this.element}return false},ui:function(a){return{draggable:a.currentItem||a.element,helper:a.helper,position:a.position,offset:a.positionAbs}}});d.extend(d.ui.droppable,{version:"1.8.11"});d.ui.intersect=function(a,b,c){if(!b.offset)return false;var e=(a.positionAbs||a.position.absolute).left,g=e+a.helperProportions.width,f=(a.positionAbs||a.position.absolute).top,h=f+a.helperProportions.height,i=b.offset.left,k=i+b.proportions.width,j=b.offset.top,l=j+b.proportions.height;
switch(c){case "fit":return i<=e&&g<=k&&j<=f&&h<=l;case "intersect":return i<e+a.helperProportions.width/2&&g-a.helperProportions.width/2<k&&j<f+a.helperProportions.height/2&&h-a.helperProportions.height/2<l;case "pointer":return d.ui.isOver((a.positionAbs||a.position.absolute).top+(a.clickOffset||a.offset.click).top,(a.positionAbs||a.position.absolute).left+(a.clickOffset||a.offset.click).left,j,i,b.proportions.height,b.proportions.width);case "touch":return(f>=j&&f<=l||h>=j&&h<=l||f<j&&h>l)&&(e>=
i&&e<=k||g>=i&&g<=k||e<i&&g>k);default:return false}};d.ui.ddmanager={current:null,droppables:{"default":[]},prepareOffsets:function(a,b){var c=d.ui.ddmanager.droppables[a.options.scope]||[],e=b?b.type:null,g=(a.currentItem||a.element).find(":data(droppable)").andSelf(),f=0;a:for(;f<c.length;f++)if(!(c[f].options.disabled||a&&!c[f].accept.call(c[f].element[0],a.currentItem||a.element))){for(var h=0;h<g.length;h++)if(g[h]==c[f].element[0]){c[f].proportions.height=0;continue a}c[f].visible=c[f].element.css("display")!=
"none";if(c[f].visible){e=="mousedown"&&c[f]._activate.call(c[f],b);c[f].offset=c[f].element.offset();c[f].proportions={width:c[f].element[0].offsetWidth,height:c[f].element[0].offsetHeight}}}},drop:function(a,b){var c=false;d.each(d.ui.ddmanager.droppables[a.options.scope]||[],function(){if(this.options){if(!this.options.disabled&&this.visible&&d.ui.intersect(a,this,this.options.tolerance))c=c||this._drop.call(this,b);if(!this.options.disabled&&this.visible&&this.accept.call(this.element[0],a.currentItem||
a.element)){this.isout=1;this.isover=0;this._deactivate.call(this,b)}}});return c},drag:function(a,b){a.options.refreshPositions&&d.ui.ddmanager.prepareOffsets(a,b);d.each(d.ui.ddmanager.droppables[a.options.scope]||[],function(){if(!(this.options.disabled||this.greedyChild||!this.visible)){var c=d.ui.intersect(a,this,this.options.tolerance);if(c=!c&&this.isover==1?"isout":c&&this.isover==0?"isover":null){var e;if(this.options.greedy){var g=this.element.parents(":data(droppable):eq(0)");if(g.length){e=
d.data(g[0],"droppable");e.greedyChild=c=="isover"?1:0}}if(e&&c=="isover"){e.isover=0;e.isout=1;e._out.call(e,b)}this[c]=1;this[c=="isout"?"isover":"isout"]=0;this[c=="isover"?"_over":"_out"].call(this,b);if(e&&c=="isout"){e.isout=0;e.isover=1;e._over.call(e,b)}}}})}}})(jQuery);
;/*
 * jQuery UI Resizable 1.8.11
 *
 * 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/Resizables
 *
 * Depends:
 *	jquery.ui.core.js
 *	jquery.ui.mouse.js
 *	jquery.ui.widget.js
 */
(function(e){e.widget("ui.resizable",e.ui.mouse,{widgetEventPrefix:"resize",options:{alsoResize:false,animate:false,animateDuration:"slow",animateEasing:"swing",aspectRatio:false,autoHide:false,containment:false,ghost:false,grid:false,handles:"e,s,se",helper:false,maxHeight:null,maxWidth:null,minHeight:10,minWidth:10,zIndex:1E3},_create:function(){var b=this,a=this.options;this.element.addClass("ui-resizable");e.extend(this,{_aspectRatio:!!a.aspectRatio,aspectRatio:a.aspectRatio,originalElement:this.element,
_proportionallyResizeElements:[],_helper:a.helper||a.ghost||a.animate?a.helper||"ui-resizable-helper":null});if(this.element[0].nodeName.match(/canvas|textarea|input|select|button|img/i)){/relative/.test(this.element.css("position"))&&e.browser.opera&&this.element.css({position:"relative",top:"auto",left:"auto"});this.element.wrap(e('<div class="ui-wrapper" style="overflow: hidden;"></div>').css({position:this.element.css("position"),width:this.element.outerWidth(),height:this.element.outerHeight(),
top:this.element.css("top"),left:this.element.css("left")}));this.element=this.element.parent().data("resizable",this.element.data("resizable"));this.elementIsWrapper=true;this.element.css({marginLeft:this.originalElement.css("marginLeft"),marginTop:this.originalElement.css("marginTop"),marginRight:this.originalElement.css("marginRight"),marginBottom:this.originalElement.css("marginBottom")});this.originalElement.css({marginLeft:0,marginTop:0,marginRight:0,marginBottom:0});this.originalResizeStyle=
this.originalElement.css("resize");this.originalElement.css("resize","none");this._proportionallyResizeElements.push(this.originalElement.css({position:"static",zoom:1,display:"block"}));this.originalElement.css({margin:this.originalElement.css("margin")});this._proportionallyResize()}this.handles=a.handles||(!e(".ui-resizable-handle",this.element).length?"e,s,se":{n:".ui-resizable-n",e:".ui-resizable-e",s:".ui-resizable-s",w:".ui-resizable-w",se:".ui-resizable-se",sw:".ui-resizable-sw",ne:".ui-resizable-ne",
nw:".ui-resizable-nw"});if(this.handles.constructor==String){if(this.handles=="all")this.handles="n,e,s,w,se,sw,ne,nw";var c=this.handles.split(",");this.handles={};for(var d=0;d<c.length;d++){var f=e.trim(c[d]),g=e('<div class="ui-resizable-handle '+("ui-resizable-"+f)+'"></div>');/sw|se|ne|nw/.test(f)&&g.css({zIndex:++a.zIndex});"se"==f&&g.addClass("ui-icon ui-icon-gripsmall-diagonal-se");this.handles[f]=".ui-resizable-"+f;this.element.append(g)}}this._renderAxis=function(h){h=h||this.element;for(var i in this.handles){if(this.handles[i].constructor==
String)this.handles[i]=e(this.handles[i],this.element).show();if(this.elementIsWrapper&&this.originalElement[0].nodeName.match(/textarea|input|select|button/i)){var j=e(this.handles[i],this.element),k=0;k=/sw|ne|nw|se|n|s/.test(i)?j.outerHeight():j.outerWidth();j=["padding",/ne|nw|n/.test(i)?"Top":/se|sw|s/.test(i)?"Bottom":/^e$/.test(i)?"Right":"Left"].join("");h.css(j,k);this._proportionallyResize()}e(this.handles[i])}};this._renderAxis(this.element);this._handles=e(".ui-resizable-handle",this.element).disableSelection();
this._handles.mouseover(function(){if(!b.resizing){if(this.className)var h=this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i);b.axis=h&&h[1]?h[1]:"se"}});if(a.autoHide){this._handles.hide();e(this.element).addClass("ui-resizable-autohide").hover(function(){e(this).removeClass("ui-resizable-autohide");b._handles.show()},function(){if(!b.resizing){e(this).addClass("ui-resizable-autohide");b._handles.hide()}})}this._mouseInit()},destroy:function(){this._mouseDestroy();var b=function(c){e(c).removeClass("ui-resizable ui-resizable-disabled ui-resizable-resizing").removeData("resizable").unbind(".resizable").find(".ui-resizable-handle").remove()};
if(this.elementIsWrapper){b(this.element);var a=this.element;a.after(this.originalElement.css({position:a.css("position"),width:a.outerWidth(),height:a.outerHeight(),top:a.css("top"),left:a.css("left")})).remove()}this.originalElement.css("resize",this.originalResizeStyle);b(this.originalElement);return this},_mouseCapture:function(b){var a=false;for(var c in this.handles)if(e(this.handles[c])[0]==b.target)a=true;return!this.options.disabled&&a},_mouseStart:function(b){var a=this.options,c=this.element.position(),
d=this.element;this.resizing=true;this.documentScroll={top:e(document).scrollTop(),left:e(document).scrollLeft()};if(d.is(".ui-draggable")||/absolute/.test(d.css("position")))d.css({position:"absolute",top:c.top,left:c.left});e.browser.opera&&/relative/.test(d.css("position"))&&d.css({position:"relative",top:"auto",left:"auto"});this._renderProxy();c=m(this.helper.css("left"));var f=m(this.helper.css("top"));if(a.containment){c+=e(a.containment).scrollLeft()||0;f+=e(a.containment).scrollTop()||0}this.offset=
this.helper.offset();this.position={left:c,top:f};this.size=this._helper?{width:d.outerWidth(),height:d.outerHeight()}:{width:d.width(),height:d.height()};this.originalSize=this._helper?{width:d.outerWidth(),height:d.outerHeight()}:{width:d.width(),height:d.height()};this.originalPosition={left:c,top:f};this.sizeDiff={width:d.outerWidth()-d.width(),height:d.outerHeight()-d.height()};this.originalMousePosition={left:b.pageX,top:b.pageY};this.aspectRatio=typeof a.aspectRatio=="number"?a.aspectRatio:
this.originalSize.width/this.originalSize.height||1;a=e(".ui-resizable-"+this.axis).css("cursor");e("body").css("cursor",a=="auto"?this.axis+"-resize":a);d.addClass("ui-resizable-resizing");this._propagate("start",b);return true},_mouseDrag:function(b){var a=this.helper,c=this.originalMousePosition,d=this._change[this.axis];if(!d)return false;c=d.apply(this,[b,b.pageX-c.left||0,b.pageY-c.top||0]);if(this._aspectRatio||b.shiftKey)c=this._updateRatio(c,b);c=this._respectSize(c,b);this._propagate("resize",
b);a.css({top:this.position.top+"px",left:this.position.left+"px",width:this.size.width+"px",height:this.size.height+"px"});!this._helper&&this._proportionallyResizeElements.length&&this._proportionallyResize();this._updateCache(c);this._trigger("resize",b,this.ui());return false},_mouseStop:function(b){this.resizing=false;var a=this.options,c=this;if(this._helper){var d=this._proportionallyResizeElements,f=d.length&&/textarea/i.test(d[0].nodeName);d=f&&e.ui.hasScroll(d[0],"left")?0:c.sizeDiff.height;
f=f?0:c.sizeDiff.width;f={width:c.helper.width()-f,height:c.helper.height()-d};d=parseInt(c.element.css("left"),10)+(c.position.left-c.originalPosition.left)||null;var g=parseInt(c.element.css("top"),10)+(c.position.top-c.originalPosition.top)||null;a.animate||this.element.css(e.extend(f,{top:g,left:d}));c.helper.height(c.size.height);c.helper.width(c.size.width);this._helper&&!a.animate&&this._proportionallyResize()}e("body").css("cursor","auto");this.element.removeClass("ui-resizable-resizing");
this._propagate("stop",b);this._helper&&this.helper.remove();return false},_updateCache:function(b){this.offset=this.helper.offset();if(l(b.left))this.position.left=b.left;if(l(b.top))this.position.top=b.top;if(l(b.height))this.size.height=b.height;if(l(b.width))this.size.width=b.width},_updateRatio:function(b){var a=this.position,c=this.size,d=this.axis;if(b.height)b.width=c.height*this.aspectRatio;else if(b.width)b.height=c.width/this.aspectRatio;if(d=="sw"){b.left=a.left+(c.width-b.width);b.top=
null}if(d=="nw"){b.top=a.top+(c.height-b.height);b.left=a.left+(c.width-b.width)}return b},_respectSize:function(b){var a=this.options,c=this.axis,d=l(b.width)&&a.maxWidth&&a.maxWidth<b.width,f=l(b.height)&&a.maxHeight&&a.maxHeight<b.height,g=l(b.width)&&a.minWidth&&a.minWidth>b.width,h=l(b.height)&&a.minHeight&&a.minHeight>b.height;if(g)b.width=a.minWidth;if(h)b.height=a.minHeight;if(d)b.width=a.maxWidth;if(f)b.height=a.maxHeight;var i=this.originalPosition.left+this.originalSize.width,j=this.position.top+
this.size.height,k=/sw|nw|w/.test(c);c=/nw|ne|n/.test(c);if(g&&k)b.left=i-a.minWidth;if(d&&k)b.left=i-a.maxWidth;if(h&&c)b.top=j-a.minHeight;if(f&&c)b.top=j-a.maxHeight;if((a=!b.width&&!b.height)&&!b.left&&b.top)b.top=null;else if(a&&!b.top&&b.left)b.left=null;return b},_proportionallyResize:function(){if(this._proportionallyResizeElements.length)for(var b=this.helper||this.element,a=0;a<this._proportionallyResizeElements.length;a++){var c=this._proportionallyResizeElements[a];if(!this.borderDif){var d=
[c.css("borderTopWidth"),c.css("borderRightWidth"),c.css("borderBottomWidth"),c.css("borderLeftWidth")],f=[c.css("paddingTop"),c.css("paddingRight"),c.css("paddingBottom"),c.css("paddingLeft")];this.borderDif=e.map(d,function(g,h){g=parseInt(g,10)||0;h=parseInt(f[h],10)||0;return g+h})}e.browser.msie&&(e(b).is(":hidden")||e(b).parents(":hidden").length)||c.css({height:b.height()-this.borderDif[0]-this.borderDif[2]||0,width:b.width()-this.borderDif[1]-this.borderDif[3]||0})}},_renderProxy:function(){var b=
this.options;this.elementOffset=this.element.offset();if(this._helper){this.helper=this.helper||e('<div style="overflow:hidden;"></div>');var a=e.browser.msie&&e.browser.version<7,c=a?1:0;a=a?2:-1;this.helper.addClass(this._helper).css({width:this.element.outerWidth()+a,height:this.element.outerHeight()+a,position:"absolute",left:this.elementOffset.left-c+"px",top:this.elementOffset.top-c+"px",zIndex:++b.zIndex});this.helper.appendTo("body").disableSelection()}else this.helper=this.element},_change:{e:function(b,
a){return{width:this.originalSize.width+a}},w:function(b,a){return{left:this.originalPosition.left+a,width:this.originalSize.width-a}},n:function(b,a,c){return{top:this.originalPosition.top+c,height:this.originalSize.height-c}},s:function(b,a,c){return{height:this.originalSize.height+c}},se:function(b,a,c){return e.extend(this._change.s.apply(this,arguments),this._change.e.apply(this,[b,a,c]))},sw:function(b,a,c){return e.extend(this._change.s.apply(this,arguments),this._change.w.apply(this,[b,a,
c]))},ne:function(b,a,c){return e.extend(this._change.n.apply(this,arguments),this._change.e.apply(this,[b,a,c]))},nw:function(b,a,c){return e.extend(this._change.n.apply(this,arguments),this._change.w.apply(this,[b,a,c]))}},_propagate:function(b,a){e.ui.plugin.call(this,b,[a,this.ui()]);b!="resize"&&this._trigger(b,a,this.ui())},plugins:{},ui:function(){return{originalElement:this.originalElement,element:this.element,helper:this.helper,position:this.position,size:this.size,originalSize:this.originalSize,
originalPosition:this.originalPosition}}});e.extend(e.ui.resizable,{version:"1.8.11"});e.ui.plugin.add("resizable","alsoResize",{start:function(){var b=e(this).data("resizable").options,a=function(c){e(c).each(function(){var d=e(this);d.data("resizable-alsoresize",{width:parseInt(d.width(),10),height:parseInt(d.height(),10),left:parseInt(d.css("left"),10),top:parseInt(d.css("top"),10),position:d.css("position")})})};if(typeof b.alsoResize=="object"&&!b.alsoResize.parentNode)if(b.alsoResize.length){b.alsoResize=
b.alsoResize[0];a(b.alsoResize)}else e.each(b.alsoResize,function(c){a(c)});else a(b.alsoResize)},resize:function(b,a){var c=e(this).data("resizable");b=c.options;var d=c.originalSize,f=c.originalPosition,g={height:c.size.height-d.height||0,width:c.size.width-d.width||0,top:c.position.top-f.top||0,left:c.position.left-f.left||0},h=function(i,j){e(i).each(function(){var k=e(this),q=e(this).data("resizable-alsoresize"),p={},r=j&&j.length?j:k.parents(a.originalElement[0]).length?["width","height"]:["width",
"height","top","left"];e.each(r,function(n,o){if((n=(q[o]||0)+(g[o]||0))&&n>=0)p[o]=n||null});if(e.browser.opera&&/relative/.test(k.css("position"))){c._revertToRelativePosition=true;k.css({position:"absolute",top:"auto",left:"auto"})}k.css(p)})};typeof b.alsoResize=="object"&&!b.alsoResize.nodeType?e.each(b.alsoResize,function(i,j){h(i,j)}):h(b.alsoResize)},stop:function(){var b=e(this).data("resizable"),a=b.options,c=function(d){e(d).each(function(){var f=e(this);f.css({position:f.data("resizable-alsoresize").position})})};
if(b._revertToRelativePosition){b._revertToRelativePosition=false;typeof a.alsoResize=="object"&&!a.alsoResize.nodeType?e.each(a.alsoResize,function(d){c(d)}):c(a.alsoResize)}e(this).removeData("resizable-alsoresize")}});e.ui.plugin.add("resizable","animate",{stop:function(b){var a=e(this).data("resizable"),c=a.options,d=a._proportionallyResizeElements,f=d.length&&/textarea/i.test(d[0].nodeName),g=f&&e.ui.hasScroll(d[0],"left")?0:a.sizeDiff.height;f={width:a.size.width-(f?0:a.sizeDiff.width),height:a.size.height-
g};g=parseInt(a.element.css("left"),10)+(a.position.left-a.originalPosition.left)||null;var h=parseInt(a.element.css("top"),10)+(a.position.top-a.originalPosition.top)||null;a.element.animate(e.extend(f,h&&g?{top:h,left:g}:{}),{duration:c.animateDuration,easing:c.animateEasing,step:function(){var i={width:parseInt(a.element.css("width"),10),height:parseInt(a.element.css("height"),10),top:parseInt(a.element.css("top"),10),left:parseInt(a.element.css("left"),10)};d&&d.length&&e(d[0]).css({width:i.width,
height:i.height});a._updateCache(i);a._propagate("resize",b)}})}});e.ui.plugin.add("resizable","containment",{start:function(){var b=e(this).data("resizable"),a=b.element,c=b.options.containment;if(a=c instanceof e?c.get(0):/parent/.test(c)?a.parent().get(0):c){b.containerElement=e(a);if(/document/.test(c)||c==document){b.containerOffset={left:0,top:0};b.containerPosition={left:0,top:0};b.parentData={element:e(document),left:0,top:0,width:e(document).width(),height:e(document).height()||document.body.parentNode.scrollHeight}}else{var d=
e(a),f=[];e(["Top","Right","Left","Bottom"]).each(function(i,j){f[i]=m(d.css("padding"+j))});b.containerOffset=d.offset();b.containerPosition=d.position();b.containerSize={height:d.innerHeight()-f[3],width:d.innerWidth()-f[1]};c=b.containerOffset;var g=b.containerSize.height,h=b.containerSize.width;h=e.ui.hasScroll(a,"left")?a.scrollWidth:h;g=e.ui.hasScroll(a)?a.scrollHeight:g;b.parentData={element:a,left:c.left,top:c.top,width:h,height:g}}}},resize:function(b){var a=e(this).data("resizable"),c=a.options,
d=a.containerOffset,f=a.position;b=a._aspectRatio||b.shiftKey;var g={top:0,left:0},h=a.containerElement;if(h[0]!=document&&/static/.test(h.css("position")))g=d;if(f.left<(a._helper?d.left:0)){a.size.width+=a._helper?a.position.left-d.left:a.position.left-g.left;if(b)a.size.height=a.size.width/c.aspectRatio;a.position.left=c.helper?d.left:0}if(f.top<(a._helper?d.top:0)){a.size.height+=a._helper?a.position.top-d.top:a.position.top;if(b)a.size.width=a.size.height*c.aspectRatio;a.position.top=a._helper?
d.top:0}a.offset.left=a.parentData.left+a.position.left;a.offset.top=a.parentData.top+a.position.top;c=Math.abs((a._helper?a.offset.left-g.left:a.offset.left-g.left)+a.sizeDiff.width);d=Math.abs((a._helper?a.offset.top-g.top:a.offset.top-d.top)+a.sizeDiff.height);f=a.containerElement.get(0)==a.element.parent().get(0);g=/relative|absolute/.test(a.containerElement.css("position"));if(f&&g)c-=a.parentData.left;if(c+a.size.width>=a.parentData.width){a.size.width=a.parentData.width-c;if(b)a.size.height=
a.size.width/a.aspectRatio}if(d+a.size.height>=a.parentData.height){a.size.height=a.parentData.height-d;if(b)a.size.width=a.size.height*a.aspectRatio}},stop:function(){var b=e(this).data("resizable"),a=b.options,c=b.containerOffset,d=b.containerPosition,f=b.containerElement,g=e(b.helper),h=g.offset(),i=g.outerWidth()-b.sizeDiff.width;g=g.outerHeight()-b.sizeDiff.height;b._helper&&!a.animate&&/relative/.test(f.css("position"))&&e(this).css({left:h.left-d.left-c.left,width:i,height:g});b._helper&&!a.animate&&
/static/.test(f.css("position"))&&e(this).css({left:h.left-d.left-c.left,width:i,height:g})}});e.ui.plugin.add("resizable","ghost",{start:function(){var b=e(this).data("resizable"),a=b.options,c=b.size;b.ghost=b.originalElement.clone();b.ghost.css({opacity:0.25,display:"block",position:"relative",height:c.height,width:c.width,margin:0,left:0,top:0}).addClass("ui-resizable-ghost").addClass(typeof a.ghost=="string"?a.ghost:"");b.ghost.appendTo(b.helper)},resize:function(){var b=e(this).data("resizable");
b.ghost&&b.ghost.css({position:"relative",height:b.size.height,width:b.size.width})},stop:function(){var b=e(this).data("resizable");b.ghost&&b.helper&&b.helper.get(0).removeChild(b.ghost.get(0))}});e.ui.plugin.add("resizable","grid",{resize:function(){var b=e(this).data("resizable"),a=b.options,c=b.size,d=b.originalSize,f=b.originalPosition,g=b.axis;a.grid=typeof a.grid=="number"?[a.grid,a.grid]:a.grid;var h=Math.round((c.width-d.width)/(a.grid[0]||1))*(a.grid[0]||1);a=Math.round((c.height-d.height)/
(a.grid[1]||1))*(a.grid[1]||1);if(/^(se|s|e)$/.test(g)){b.size.width=d.width+h;b.size.height=d.height+a}else if(/^(ne)$/.test(g)){b.size.width=d.width+h;b.size.height=d.height+a;b.position.top=f.top-a}else{if(/^(sw)$/.test(g)){b.size.width=d.width+h;b.size.height=d.height+a}else{b.size.width=d.width+h;b.size.height=d.height+a;b.position.top=f.top-a}b.position.left=f.left-h}}});var m=function(b){return parseInt(b,10)||0},l=function(b){return!isNaN(parseInt(b,10))}})(jQuery);
;/*
 * jQuery UI Selectable 1.8.11
 *
 * 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/Selectables
 *
 * Depends:
 *	jquery.ui.core.js
 *	jquery.ui.mouse.js
 *	jquery.ui.widget.js
 */
(function(e){e.widget("ui.selectable",e.ui.mouse,{options:{appendTo:"body",autoRefresh:true,distance:0,filter:"*",tolerance:"touch"},_create:function(){var c=this;this.element.addClass("ui-selectable");this.dragged=false;var f;this.refresh=function(){f=e(c.options.filter,c.element[0]);f.each(function(){var d=e(this),b=d.offset();e.data(this,"selectable-item",{element:this,$element:d,left:b.left,top:b.top,right:b.left+d.outerWidth(),bottom:b.top+d.outerHeight(),startselected:false,selected:d.hasClass("ui-selected"),
selecting:d.hasClass("ui-selecting"),unselecting:d.hasClass("ui-unselecting")})})};this.refresh();this.selectees=f.addClass("ui-selectee");this._mouseInit();this.helper=e("<div class='ui-selectable-helper'></div>")},destroy:function(){this.selectees.removeClass("ui-selectee").removeData("selectable-item");this.element.removeClass("ui-selectable ui-selectable-disabled").removeData("selectable").unbind(".selectable");this._mouseDestroy();return this},_mouseStart:function(c){var f=this;this.opos=[c.pageX,
c.pageY];if(!this.options.disabled){var d=this.options;this.selectees=e(d.filter,this.element[0]);this._trigger("start",c);e(d.appendTo).append(this.helper);this.helper.css({left:c.clientX,top:c.clientY,width:0,height:0});d.autoRefresh&&this.refresh();this.selectees.filter(".ui-selected").each(function(){var b=e.data(this,"selectable-item");b.startselected=true;if(!c.metaKey){b.$element.removeClass("ui-selected");b.selected=false;b.$element.addClass("ui-unselecting");b.unselecting=true;f._trigger("unselecting",
c,{unselecting:b.element})}});e(c.target).parents().andSelf().each(function(){var b=e.data(this,"selectable-item");if(b){var g=!c.metaKey||!b.$element.hasClass("ui-selected");b.$element.removeClass(g?"ui-unselecting":"ui-selected").addClass(g?"ui-selecting":"ui-unselecting");b.unselecting=!g;b.selecting=g;(b.selected=g)?f._trigger("selecting",c,{selecting:b.element}):f._trigger("unselecting",c,{unselecting:b.element});return false}})}},_mouseDrag:function(c){var f=this;this.dragged=true;if(!this.options.disabled){var d=
this.options,b=this.opos[0],g=this.opos[1],h=c.pageX,i=c.pageY;if(b>h){var j=h;h=b;b=j}if(g>i){j=i;i=g;g=j}this.helper.css({left:b,top:g,width:h-b,height:i-g});this.selectees.each(function(){var a=e.data(this,"selectable-item");if(!(!a||a.element==f.element[0])){var k=false;if(d.tolerance=="touch")k=!(a.left>h||a.right<b||a.top>i||a.bottom<g);else if(d.tolerance=="fit")k=a.left>b&&a.right<h&&a.top>g&&a.bottom<i;if(k){if(a.selected){a.$element.removeClass("ui-selected");a.selected=false}if(a.unselecting){a.$element.removeClass("ui-unselecting");
a.unselecting=false}if(!a.selecting){a.$element.addClass("ui-selecting");a.selecting=true;f._trigger("selecting",c,{selecting:a.element})}}else{if(a.selecting)if(c.metaKey&&a.startselected){a.$element.removeClass("ui-selecting");a.selecting=false;a.$element.addClass("ui-selected");a.selected=true}else{a.$element.removeClass("ui-selecting");a.selecting=false;if(a.startselected){a.$element.addClass("ui-unselecting");a.unselecting=true}f._trigger("unselecting",c,{unselecting:a.element})}if(a.selected)if(!c.metaKey&&
!a.startselected){a.$element.removeClass("ui-selected");a.selected=false;a.$element.addClass("ui-unselecting");a.unselecting=true;f._trigger("unselecting",c,{unselecting:a.element})}}}});return false}},_mouseStop:function(c){var f=this;this.dragged=false;e(".ui-unselecting",this.element[0]).each(function(){var d=e.data(this,"selectable-item");d.$element.removeClass("ui-unselecting");d.unselecting=false;d.startselected=false;f._trigger("unselected",c,{unselected:d.element})});e(".ui-selecting",this.element[0]).each(function(){var d=
e.data(this,"selectable-item");d.$element.removeClass("ui-selecting").addClass("ui-selected");d.selecting=false;d.selected=true;d.startselected=true;f._trigger("selected",c,{selected:d.element})});this._trigger("stop",c);this.helper.remove();return false}});e.extend(e.ui.selectable,{version:"1.8.11"})})(jQuery);
;/*
 * jQuery UI Sortable 1.8.11
 *
 * 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/Sortables
 *
 * Depends:
 *	jquery.ui.core.js
 *	jquery.ui.mouse.js
 *	jquery.ui.widget.js
 */
(function(d){d.widget("ui.sortable",d.ui.mouse,{widgetEventPrefix:"sort",options:{appendTo:"parent",axis:false,connectWith:false,containment:false,cursor:"auto",cursorAt:false,dropOnEmpty:true,forcePlaceholderSize:false,forceHelperSize:false,grid:false,handle:false,helper:"original",items:"> *",opacity:false,placeholder:false,revert:false,scroll:true,scrollSensitivity:20,scrollSpeed:20,scope:"default",tolerance:"intersect",zIndex:1E3},_create:function(){this.containerCache={};this.element.addClass("ui-sortable");
this.refresh();this.floating=this.items.length?/left|right/.test(this.items[0].item.css("float"))||/inline|table-cell/.test(this.items[0].item.css("display")):false;this.offset=this.element.offset();this._mouseInit()},destroy:function(){this.element.removeClass("ui-sortable ui-sortable-disabled").removeData("sortable").unbind(".sortable");this._mouseDestroy();for(var a=this.items.length-1;a>=0;a--)this.items[a].item.removeData("sortable-item");return this},_setOption:function(a,b){if(a==="disabled"){this.options[a]=
b;this.widget()[b?"addClass":"removeClass"]("ui-sortable-disabled")}else d.Widget.prototype._setOption.apply(this,arguments)},_mouseCapture:function(a,b){if(this.reverting)return false;if(this.options.disabled||this.options.type=="static")return false;this._refreshItems(a);var c=null,e=this;d(a.target).parents().each(function(){if(d.data(this,"sortable-item")==e){c=d(this);return false}});if(d.data(a.target,"sortable-item")==e)c=d(a.target);if(!c)return false;if(this.options.handle&&!b){var f=false;
d(this.options.handle,c).find("*").andSelf().each(function(){if(this==a.target)f=true});if(!f)return false}this.currentItem=c;this._removeCurrentsFromItems();return true},_mouseStart:function(a,b,c){b=this.options;var e=this;this.currentContainer=this;this.refreshPositions();this.helper=this._createHelper(a);this._cacheHelperProportions();this._cacheMargins();this.scrollParent=this.helper.scrollParent();this.offset=this.currentItem.offset();this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-
this.margins.left};this.helper.css("position","absolute");this.cssPosition=this.helper.css("position");d.extend(this.offset,{click:{left:a.pageX-this.offset.left,top:a.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()});this.originalPosition=this._generatePosition(a);this.originalPageX=a.pageX;this.originalPageY=a.pageY;b.cursorAt&&this._adjustOffsetFromHelper(b.cursorAt);this.domPosition={prev:this.currentItem.prev()[0],parent:this.currentItem.parent()[0]};
this.helper[0]!=this.currentItem[0]&&this.currentItem.hide();this._createPlaceholder();b.containment&&this._setContainment();if(b.cursor){if(d("body").css("cursor"))this._storedCursor=d("body").css("cursor");d("body").css("cursor",b.cursor)}if(b.opacity){if(this.helper.css("opacity"))this._storedOpacity=this.helper.css("opacity");this.helper.css("opacity",b.opacity)}if(b.zIndex){if(this.helper.css("zIndex"))this._storedZIndex=this.helper.css("zIndex");this.helper.css("zIndex",b.zIndex)}if(this.scrollParent[0]!=
document&&this.scrollParent[0].tagName!="HTML")this.overflowOffset=this.scrollParent.offset();this._trigger("start",a,this._uiHash());this._preserveHelperProportions||this._cacheHelperProportions();if(!c)for(c=this.containers.length-1;c>=0;c--)this.containers[c]._trigger("activate",a,e._uiHash(this));if(d.ui.ddmanager)d.ui.ddmanager.current=this;d.ui.ddmanager&&!b.dropBehaviour&&d.ui.ddmanager.prepareOffsets(this,a);this.dragging=true;this.helper.addClass("ui-sortable-helper");this._mouseDrag(a);
return true},_mouseDrag:function(a){this.position=this._generatePosition(a);this.positionAbs=this._convertPositionTo("absolute");if(!this.lastPositionAbs)this.lastPositionAbs=this.positionAbs;if(this.options.scroll){var b=this.options,c=false;if(this.scrollParent[0]!=document&&this.scrollParent[0].tagName!="HTML"){if(this.overflowOffset.top+this.scrollParent[0].offsetHeight-a.pageY<b.scrollSensitivity)this.scrollParent[0].scrollTop=c=this.scrollParent[0].scrollTop+b.scrollSpeed;else if(a.pageY-this.overflowOffset.top<
b.scrollSensitivity)this.scrollParent[0].scrollTop=c=this.scrollParent[0].scrollTop-b.scrollSpeed;if(this.overflowOffset.left+this.scrollParent[0].offsetWidth-a.pageX<b.scrollSensitivity)this.scrollParent[0].scrollLeft=c=this.scrollParent[0].scrollLeft+b.scrollSpeed;else if(a.pageX-this.overflowOffset.left<b.scrollSensitivity)this.scrollParent[0].scrollLeft=c=this.scrollParent[0].scrollLeft-b.scrollSpeed}else{if(a.pageY-d(document).scrollTop()<b.scrollSensitivity)c=d(document).scrollTop(d(document).scrollTop()-
b.scrollSpeed);else if(d(window).height()-(a.pageY-d(document).scrollTop())<b.scrollSensitivity)c=d(document).scrollTop(d(document).scrollTop()+b.scrollSpeed);if(a.pageX-d(document).scrollLeft()<b.scrollSensitivity)c=d(document).scrollLeft(d(document).scrollLeft()-b.scrollSpeed);else if(d(window).width()-(a.pageX-d(document).scrollLeft())<b.scrollSensitivity)c=d(document).scrollLeft(d(document).scrollLeft()+b.scrollSpeed)}c!==false&&d.ui.ddmanager&&!b.dropBehaviour&&d.ui.ddmanager.prepareOffsets(this,
a)}this.positionAbs=this._convertPositionTo("absolute");if(!this.options.axis||this.options.axis!="y")this.helper[0].style.left=this.position.left+"px";if(!this.options.axis||this.options.axis!="x")this.helper[0].style.top=this.position.top+"px";for(b=this.items.length-1;b>=0;b--){c=this.items[b];var e=c.item[0],f=this._intersectsWithPointer(c);if(f)if(e!=this.currentItem[0]&&this.placeholder[f==1?"next":"prev"]()[0]!=e&&!d.ui.contains(this.placeholder[0],e)&&(this.options.type=="semi-dynamic"?!d.ui.contains(this.element[0],
e):true)){this.direction=f==1?"down":"up";if(this.options.tolerance=="pointer"||this._intersectsWithSides(c))this._rearrange(a,c);else break;this._trigger("change",a,this._uiHash());break}}this._contactContainers(a);d.ui.ddmanager&&d.ui.ddmanager.drag(this,a);this._trigger("sort",a,this._uiHash());this.lastPositionAbs=this.positionAbs;return false},_mouseStop:function(a,b){if(a){d.ui.ddmanager&&!this.options.dropBehaviour&&d.ui.ddmanager.drop(this,a);if(this.options.revert){var c=this;b=c.placeholder.offset();
c.reverting=true;d(this.helper).animate({left:b.left-this.offset.parent.left-c.margins.left+(this.offsetParent[0]==document.body?0:this.offsetParent[0].scrollLeft),top:b.top-this.offset.parent.top-c.margins.top+(this.offsetParent[0]==document.body?0:this.offsetParent[0].scrollTop)},parseInt(this.options.revert,10)||500,function(){c._clear(a)})}else this._clear(a,b);return false}},cancel:function(){var a=this;if(this.dragging){this._mouseUp({target:null});this.options.helper=="original"?this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper"):
this.currentItem.show();for(var b=this.containers.length-1;b>=0;b--){this.containers[b]._trigger("deactivate",null,a._uiHash(this));if(this.containers[b].containerCache.over){this.containers[b]._trigger("out",null,a._uiHash(this));this.containers[b].containerCache.over=0}}}if(this.placeholder){this.placeholder[0].parentNode&&this.placeholder[0].parentNode.removeChild(this.placeholder[0]);this.options.helper!="original"&&this.helper&&this.helper[0].parentNode&&this.helper.remove();d.extend(this,{helper:null,
dragging:false,reverting:false,_noFinalSort:null});this.domPosition.prev?d(this.domPosition.prev).after(this.currentItem):d(this.domPosition.parent).prepend(this.currentItem)}return this},serialize:function(a){var b=this._getItemsAsjQuery(a&&a.connected),c=[];a=a||{};d(b).each(function(){var e=(d(a.item||this).attr(a.attribute||"id")||"").match(a.expression||/(.+)[-=_](.+)/);if(e)c.push((a.key||e[1]+"[]")+"="+(a.key&&a.expression?e[1]:e[2]))});!c.length&&a.key&&c.push(a.key+"=");return c.join("&")},
toArray:function(a){var b=this._getItemsAsjQuery(a&&a.connected),c=[];a=a||{};b.each(function(){c.push(d(a.item||this).attr(a.attribute||"id")||"")});return c},_intersectsWith:function(a){var b=this.positionAbs.left,c=b+this.helperProportions.width,e=this.positionAbs.top,f=e+this.helperProportions.height,g=a.left,h=g+a.width,i=a.top,k=i+a.height,j=this.offset.click.top,l=this.offset.click.left;j=e+j>i&&e+j<k&&b+l>g&&b+l<h;return this.options.tolerance=="pointer"||this.options.forcePointerForContainers||
this.options.tolerance!="pointer"&&this.helperProportions[this.floating?"width":"height"]>a[this.floating?"width":"height"]?j:g<b+this.helperProportions.width/2&&c-this.helperProportions.width/2<h&&i<e+this.helperProportions.height/2&&f-this.helperProportions.height/2<k},_intersectsWithPointer:function(a){var b=d.ui.isOverAxis(this.positionAbs.top+this.offset.click.top,a.top,a.height);a=d.ui.isOverAxis(this.positionAbs.left+this.offset.click.left,a.left,a.width);b=b&&a;a=this._getDragVerticalDirection();
var c=this._getDragHorizontalDirection();if(!b)return false;return this.floating?c&&c=="right"||a=="down"?2:1:a&&(a=="down"?2:1)},_intersectsWithSides:function(a){var b=d.ui.isOverAxis(this.positionAbs.top+this.offset.click.top,a.top+a.height/2,a.height);a=d.ui.isOverAxis(this.positionAbs.left+this.offset.click.left,a.left+a.width/2,a.width);var c=this._getDragVerticalDirection(),e=this._getDragHorizontalDirection();return this.floating&&e?e=="right"&&a||e=="left"&&!a:c&&(c=="down"&&b||c=="up"&&!b)},
_getDragVerticalDirection:function(){var a=this.positionAbs.top-this.lastPositionAbs.top;return a!=0&&(a>0?"down":"up")},_getDragHorizontalDirection:function(){var a=this.positionAbs.left-this.lastPositionAbs.left;return a!=0&&(a>0?"right":"left")},refresh:function(a){this._refreshItems(a);this.refreshPositions();return this},_connectWith:function(){var a=this.options;return a.connectWith.constructor==String?[a.connectWith]:a.connectWith},_getItemsAsjQuery:function(a){var b=[],c=[],e=this._connectWith();
if(e&&a)for(a=e.length-1;a>=0;a--)for(var f=d(e[a]),g=f.length-1;g>=0;g--){var h=d.data(f[g],"sortable");if(h&&h!=this&&!h.options.disabled)c.push([d.isFunction(h.options.items)?h.options.items.call(h.element):d(h.options.items,h.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),h])}c.push([d.isFunction(this.options.items)?this.options.items.call(this.element,null,{options:this.options,item:this.currentItem}):d(this.options.items,this.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),
this]);for(a=c.length-1;a>=0;a--)c[a][0].each(function(){b.push(this)});return d(b)},_removeCurrentsFromItems:function(){for(var a=this.currentItem.find(":data(sortable-item)"),b=0;b<this.items.length;b++)for(var c=0;c<a.length;c++)a[c]==this.items[b].item[0]&&this.items.splice(b,1)},_refreshItems:function(a){this.items=[];this.containers=[this];var b=this.items,c=[[d.isFunction(this.options.items)?this.options.items.call(this.element[0],a,{item:this.currentItem}):d(this.options.items,this.element),
this]],e=this._connectWith();if(e)for(var f=e.length-1;f>=0;f--)for(var g=d(e[f]),h=g.length-1;h>=0;h--){var i=d.data(g[h],"sortable");if(i&&i!=this&&!i.options.disabled){c.push([d.isFunction(i.options.items)?i.options.items.call(i.element[0],a,{item:this.currentItem}):d(i.options.items,i.element),i]);this.containers.push(i)}}for(f=c.length-1;f>=0;f--){a=c[f][1];e=c[f][0];h=0;for(g=e.length;h<g;h++){i=d(e[h]);i.data("sortable-item",a);b.push({item:i,instance:a,width:0,height:0,left:0,top:0})}}},refreshPositions:function(a){if(this.offsetParent&&
this.helper)this.offset.parent=this._getParentOffset();for(var b=this.items.length-1;b>=0;b--){var c=this.items[b],e=this.options.toleranceElement?d(this.options.toleranceElement,c.item):c.item;if(!a){c.width=e.outerWidth();c.height=e.outerHeight()}e=e.offset();c.left=e.left;c.top=e.top}if(this.options.custom&&this.options.custom.refreshContainers)this.options.custom.refreshContainers.call(this);else for(b=this.containers.length-1;b>=0;b--){e=this.containers[b].element.offset();this.containers[b].containerCache.left=
e.left;this.containers[b].containerCache.top=e.top;this.containers[b].containerCache.width=this.containers[b].element.outerWidth();this.containers[b].containerCache.height=this.containers[b].element.outerHeight()}return this},_createPlaceholder:function(a){var b=a||this,c=b.options;if(!c.placeholder||c.placeholder.constructor==String){var e=c.placeholder;c.placeholder={element:function(){var f=d(document.createElement(b.currentItem[0].nodeName)).addClass(e||b.currentItem[0].className+" ui-sortable-placeholder").removeClass("ui-sortable-helper")[0];
if(!e)f.style.visibility="hidden";return f},update:function(f,g){if(!(e&&!c.forcePlaceholderSize)){g.height()||g.height(b.currentItem.innerHeight()-parseInt(b.currentItem.css("paddingTop")||0,10)-parseInt(b.currentItem.css("paddingBottom")||0,10));g.width()||g.width(b.currentItem.innerWidth()-parseInt(b.currentItem.css("paddingLeft")||0,10)-parseInt(b.currentItem.css("paddingRight")||0,10))}}}}b.placeholder=d(c.placeholder.element.call(b.element,b.currentItem));b.currentItem.after(b.placeholder);
c.placeholder.update(b,b.placeholder)},_contactContainers:function(a){for(var b=null,c=null,e=this.containers.length-1;e>=0;e--)if(!d.ui.contains(this.currentItem[0],this.containers[e].element[0]))if(this._intersectsWith(this.containers[e].containerCache)){if(!(b&&d.ui.contains(this.containers[e].element[0],b.element[0]))){b=this.containers[e];c=e}}else if(this.containers[e].containerCache.over){this.containers[e]._trigger("out",a,this._uiHash(this));this.containers[e].containerCache.over=0}if(b)if(this.containers.length===
1){this.containers[c]._trigger("over",a,this._uiHash(this));this.containers[c].containerCache.over=1}else if(this.currentContainer!=this.containers[c]){b=1E4;e=null;for(var f=this.positionAbs[this.containers[c].floating?"left":"top"],g=this.items.length-1;g>=0;g--)if(d.ui.contains(this.containers[c].element[0],this.items[g].item[0])){var h=this.items[g][this.containers[c].floating?"left":"top"];if(Math.abs(h-f)<b){b=Math.abs(h-f);e=this.items[g]}}if(e||this.options.dropOnEmpty){this.currentContainer=
this.containers[c];e?this._rearrange(a,e,null,true):this._rearrange(a,null,this.containers[c].element,true);this._trigger("change",a,this._uiHash());this.containers[c]._trigger("change",a,this._uiHash(this));this.options.placeholder.update(this.currentContainer,this.placeholder);this.containers[c]._trigger("over",a,this._uiHash(this));this.containers[c].containerCache.over=1}}},_createHelper:function(a){var b=this.options;a=d.isFunction(b.helper)?d(b.helper.apply(this.element[0],[a,this.currentItem])):
b.helper=="clone"?this.currentItem.clone():this.currentItem;a.parents("body").length||d(b.appendTo!="parent"?b.appendTo:this.currentItem[0].parentNode)[0].appendChild(a[0]);if(a[0]==this.currentItem[0])this._storedCSS={width:this.currentItem[0].style.width,height:this.currentItem[0].style.height,position:this.currentItem.css("position"),top:this.currentItem.css("top"),left:this.currentItem.css("left")};if(a[0].style.width==""||b.forceHelperSize)a.width(this.currentItem.width());if(a[0].style.height==
""||b.forceHelperSize)a.height(this.currentItem.height());return a},_adjustOffsetFromHelper:function(a){if(typeof a=="string")a=a.split(" ");if(d.isArray(a))a={left:+a[0],top:+a[1]||0};if("left"in a)this.offset.click.left=a.left+this.margins.left;if("right"in a)this.offset.click.left=this.helperProportions.width-a.right+this.margins.left;if("top"in a)this.offset.click.top=a.top+this.margins.top;if("bottom"in a)this.offset.click.top=this.helperProportions.height-a.bottom+this.margins.top},_getParentOffset:function(){this.offsetParent=
this.helper.offsetParent();var a=this.offsetParent.offset();if(this.cssPosition=="absolute"&&this.scrollParent[0]!=document&&d.ui.contains(this.scrollParent[0],this.offsetParent[0])){a.left+=this.scrollParent.scrollLeft();a.top+=this.scrollParent.scrollTop()}if(this.offsetParent[0]==document.body||this.offsetParent[0].tagName&&this.offsetParent[0].tagName.toLowerCase()=="html"&&d.browser.msie)a={top:0,left:0};return{top:a.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:a.left+(parseInt(this.offsetParent.css("borderLeftWidth"),
10)||0)}},_getRelativeOffset:function(){if(this.cssPosition=="relative"){var a=this.currentItem.position();return{top:a.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:a.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}}else return{top:0,left:0}},_cacheMargins:function(){this.margins={left:parseInt(this.currentItem.css("marginLeft"),10)||0,top:parseInt(this.currentItem.css("marginTop"),10)||0}},_cacheHelperProportions:function(){this.helperProportions=
{width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var a=this.options;if(a.containment=="parent")a.containment=this.helper[0].parentNode;if(a.containment=="document"||a.containment=="window")this.containment=[0-this.offset.relative.left-this.offset.parent.left,0-this.offset.relative.top-this.offset.parent.top,d(a.containment=="document"?document:window).width()-this.helperProportions.width-this.margins.left,(d(a.containment=="document"?document:window).height()||
document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top];if(!/^(document|window|parent)$/.test(a.containment)){var b=d(a.containment)[0];a=d(a.containment).offset();var c=d(b).css("overflow")!="hidden";this.containment=[a.left+(parseInt(d(b).css("borderLeftWidth"),10)||0)+(parseInt(d(b).css("paddingLeft"),10)||0)-this.margins.left,a.top+(parseInt(d(b).css("borderTopWidth"),10)||0)+(parseInt(d(b).css("paddingTop"),10)||0)-this.margins.top,a.left+(c?Math.max(b.scrollWidth,
b.offsetWidth):b.offsetWidth)-(parseInt(d(b).css("borderLeftWidth"),10)||0)-(parseInt(d(b).css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left,a.top+(c?Math.max(b.scrollHeight,b.offsetHeight):b.offsetHeight)-(parseInt(d(b).css("borderTopWidth"),10)||0)-(parseInt(d(b).css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top]}},_convertPositionTo:function(a,b){if(!b)b=this.position;a=a=="absolute"?1:-1;var c=this.cssPosition=="absolute"&&!(this.scrollParent[0]!=
document&&d.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,e=/(html|body)/i.test(c[0].tagName);return{top:b.top+this.offset.relative.top*a+this.offset.parent.top*a-(d.browser.safari&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollTop():e?0:c.scrollTop())*a),left:b.left+this.offset.relative.left*a+this.offset.parent.left*a-(d.browser.safari&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollLeft():
e?0:c.scrollLeft())*a)}},_generatePosition:function(a){var b=this.options,c=this.cssPosition=="absolute"&&!(this.scrollParent[0]!=document&&d.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,e=/(html|body)/i.test(c[0].tagName);if(this.cssPosition=="relative"&&!(this.scrollParent[0]!=document&&this.scrollParent[0]!=this.offsetParent[0]))this.offset.relative=this._getRelativeOffset();var f=a.pageX,g=a.pageY;if(this.originalPosition){if(this.containment){if(a.pageX-
this.offset.click.left<this.containment[0])f=this.containment[0]+this.offset.click.left;if(a.pageY-this.offset.click.top<this.containment[1])g=this.containment[1]+this.offset.click.top;if(a.pageX-this.offset.click.left>this.containment[2])f=this.containment[2]+this.offset.click.left;if(a.pageY-this.offset.click.top>this.containment[3])g=this.containment[3]+this.offset.click.top}if(b.grid){g=this.originalPageY+Math.round((g-this.originalPageY)/b.grid[1])*b.grid[1];g=this.containment?!(g-this.offset.click.top<
this.containment[1]||g-this.offset.click.top>this.containment[3])?g:!(g-this.offset.click.top<this.containment[1])?g-b.grid[1]:g+b.grid[1]:g;f=this.originalPageX+Math.round((f-this.originalPageX)/b.grid[0])*b.grid[0];f=this.containment?!(f-this.offset.click.left<this.containment[0]||f-this.offset.click.left>this.containment[2])?f:!(f-this.offset.click.left<this.containment[0])?f-b.grid[0]:f+b.grid[0]:f}}return{top:g-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+(d.browser.safari&&
this.cssPosition=="fixed"?0:this.cssPosition=="fixed"?-this.scrollParent.scrollTop():e?0:c.scrollTop()),left:f-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+(d.browser.safari&&this.cssPosition=="fixed"?0:this.cssPosition=="fixed"?-this.scrollParent.scrollLeft():e?0:c.scrollLeft())}},_rearrange:function(a,b,c,e){c?c[0].appendChild(this.placeholder[0]):b.item[0].parentNode.insertBefore(this.placeholder[0],this.direction=="down"?b.item[0]:b.item[0].nextSibling);this.counter=
this.counter?++this.counter:1;var f=this,g=this.counter;window.setTimeout(function(){g==f.counter&&f.refreshPositions(!e)},0)},_clear:function(a,b){this.reverting=false;var c=[];!this._noFinalSort&&this.currentItem[0].parentNode&&this.placeholder.before(this.currentItem);this._noFinalSort=null;if(this.helper[0]==this.currentItem[0]){for(var e in this._storedCSS)if(this._storedCSS[e]=="auto"||this._storedCSS[e]=="static")this._storedCSS[e]="";this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper")}else this.currentItem.show();
this.fromOutside&&!b&&c.push(function(f){this._trigger("receive",f,this._uiHash(this.fromOutside))});if((this.fromOutside||this.domPosition.prev!=this.currentItem.prev().not(".ui-sortable-helper")[0]||this.domPosition.parent!=this.currentItem.parent()[0])&&!b)c.push(function(f){this._trigger("update",f,this._uiHash())});if(!d.ui.contains(this.element[0],this.currentItem[0])){b||c.push(function(f){this._trigger("remove",f,this._uiHash())});for(e=this.containers.length-1;e>=0;e--)if(d.ui.contains(this.containers[e].element[0],
this.currentItem[0])&&!b){c.push(function(f){return function(g){f._trigger("receive",g,this._uiHash(this))}}.call(this,this.containers[e]));c.push(function(f){return function(g){f._trigger("update",g,this._uiHash(this))}}.call(this,this.containers[e]))}}for(e=this.containers.length-1;e>=0;e--){b||c.push(function(f){return function(g){f._trigger("deactivate",g,this._uiHash(this))}}.call(this,this.containers[e]));if(this.containers[e].containerCache.over){c.push(function(f){return function(g){f._trigger("out",
g,this._uiHash(this))}}.call(this,this.containers[e]));this.containers[e].containerCache.over=0}}this._storedCursor&&d("body").css("cursor",this._storedCursor);this._storedOpacity&&this.helper.css("opacity",this._storedOpacity);if(this._storedZIndex)this.helper.css("zIndex",this._storedZIndex=="auto"?"":this._storedZIndex);this.dragging=false;if(this.cancelHelperRemoval){if(!b){this._trigger("beforeStop",a,this._uiHash());for(e=0;e<c.length;e++)c[e].call(this,a);this._trigger("stop",a,this._uiHash())}return false}b||
this._trigger("beforeStop",a,this._uiHash());this.placeholder[0].parentNode.removeChild(this.placeholder[0]);this.helper[0]!=this.currentItem[0]&&this.helper.remove();this.helper=null;if(!b){for(e=0;e<c.length;e++)c[e].call(this,a);this._trigger("stop",a,this._uiHash())}this.fromOutside=false;return true},_trigger:function(){d.Widget.prototype._trigger.apply(this,arguments)===false&&this.cancel()},_uiHash:function(a){var b=a||this;return{helper:b.helper,placeholder:b.placeholder||d([]),position:b.position,
originalPosition:b.originalPosition,offset:b.positionAbs,item:b.currentItem,sender:a?a.element:null}}});d.extend(d.ui.sortable,{version:"1.8.11"})})(jQuery);
;/*
 * jQuery UI Accordion 1.8.11
 *
 * 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/Accordion
 *
 * Depends:
 *	jquery.ui.core.js
 *	jquery.ui.widget.js
 */
(function(c){c.widget("ui.accordion",{options:{active:0,animated:"slide",autoHeight:true,clearStyle:false,collapsible:false,event:"click",fillSpace:false,header:"> li > :first-child,> :not(li):even",icons:{header:"ui-icon-triangle-1-e",headerSelected:"ui-icon-triangle-1-s"},navigation:false,navigationFilter:function(){return this.href.toLowerCase()===location.href.toLowerCase()}},_create:function(){var a=this,b=a.options;a.running=0;a.element.addClass("ui-accordion ui-widget ui-helper-reset").children("li").addClass("ui-accordion-li-fix");
a.headers=a.element.find(b.header).addClass("ui-accordion-header ui-helper-reset ui-state-default ui-corner-all").bind("mouseenter.accordion",function(){b.disabled||c(this).addClass("ui-state-hover")}).bind("mouseleave.accordion",function(){b.disabled||c(this).removeClass("ui-state-hover")}).bind("focus.accordion",function(){b.disabled||c(this).addClass("ui-state-focus")}).bind("blur.accordion",function(){b.disabled||c(this).removeClass("ui-state-focus")});a.headers.next().addClass("ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom");
if(b.navigation){var d=a.element.find("a").filter(b.navigationFilter).eq(0);if(d.length){var h=d.closest(".ui-accordion-header");a.active=h.length?h:d.closest(".ui-accordion-content").prev()}}a.active=a._findActive(a.active||b.active).addClass("ui-state-default ui-state-active").toggleClass("ui-corner-all").toggleClass("ui-corner-top");a.active.next().addClass("ui-accordion-content-active");a._createIcons();a.resize();a.element.attr("role","tablist");a.headers.attr("role","tab").bind("keydown.accordion",
function(f){return a._keydown(f)}).next().attr("role","tabpanel");a.headers.not(a.active||"").attr({"aria-expanded":"false","aria-selected":"false",tabIndex:-1}).next().hide();a.active.length?a.active.attr({"aria-expanded":"true","aria-selected":"true",tabIndex:0}):a.headers.eq(0).attr("tabIndex",0);c.browser.safari||a.headers.find("a").attr("tabIndex",-1);b.event&&a.headers.bind(b.event.split(" ").join(".accordion ")+".accordion",function(f){a._clickHandler.call(a,f,this);f.preventDefault()})},_createIcons:function(){var a=
this.options;if(a.icons){c("<span></span>").addClass("ui-icon "+a.icons.header).prependTo(this.headers);this.active.children(".ui-icon").toggleClass(a.icons.header).toggleClass(a.icons.headerSelected);this.element.addClass("ui-accordion-icons")}},_destroyIcons:function(){this.headers.children(".ui-icon").remove();this.element.removeClass("ui-accordion-icons")},destroy:function(){var a=this.options;this.element.removeClass("ui-accordion ui-widget ui-helper-reset").removeAttr("role");this.headers.unbind(".accordion").removeClass("ui-accordion-header ui-accordion-disabled ui-helper-reset ui-state-default ui-corner-all ui-state-active ui-state-disabled ui-corner-top").removeAttr("role").removeAttr("aria-expanded").removeAttr("aria-selected").removeAttr("tabIndex");
this.headers.find("a").removeAttr("tabIndex");this._destroyIcons();var b=this.headers.next().css("display","").removeAttr("role").removeClass("ui-helper-reset ui-widget-content ui-corner-bottom ui-accordion-content ui-accordion-content-active ui-accordion-disabled ui-state-disabled");if(a.autoHeight||a.fillHeight)b.css("height","");return c.Widget.prototype.destroy.call(this)},_setOption:function(a,b){c.Widget.prototype._setOption.apply(this,arguments);a=="active"&&this.activate(b);if(a=="icons"){this._destroyIcons();
b&&this._createIcons()}if(a=="disabled")this.headers.add(this.headers.next())[b?"addClass":"removeClass"]("ui-accordion-disabled ui-state-disabled")},_keydown:function(a){if(!(this.options.disabled||a.altKey||a.ctrlKey)){var b=c.ui.keyCode,d=this.headers.length,h=this.headers.index(a.target),f=false;switch(a.keyCode){case b.RIGHT:case b.DOWN:f=this.headers[(h+1)%d];break;case b.LEFT:case b.UP:f=this.headers[(h-1+d)%d];break;case b.SPACE:case b.ENTER:this._clickHandler({target:a.target},a.target);
a.preventDefault()}if(f){c(a.target).attr("tabIndex",-1);c(f).attr("tabIndex",0);f.focus();return false}return true}},resize:function(){var a=this.options,b;if(a.fillSpace){if(c.browser.msie){var d=this.element.parent().css("overflow");this.element.parent().css("overflow","hidden")}b=this.element.parent().height();c.browser.msie&&this.element.parent().css("overflow",d);this.headers.each(function(){b-=c(this).outerHeight(true)});this.headers.next().each(function(){c(this).height(Math.max(0,b-c(this).innerHeight()+
c(this).height()))}).css("overflow","auto")}else if(a.autoHeight){b=0;this.headers.next().each(function(){b=Math.max(b,c(this).height("").height())}).height(b)}return this},activate:function(a){this.options.active=a;a=this._findActive(a)[0];this._clickHandler({target:a},a);return this},_findActive:function(a){return a?typeof a==="number"?this.headers.filter(":eq("+a+")"):this.headers.not(this.headers.not(a)):a===false?c([]):this.headers.filter(":eq(0)")},_clickHandler:function(a,b){var d=this.options;
if(!d.disabled)if(a.target){a=c(a.currentTarget||b);b=a[0]===this.active[0];d.active=d.collapsible&&b?false:this.headers.index(a);if(!(this.running||!d.collapsible&&b)){var h=this.active;j=a.next();g=this.active.next();e={options:d,newHeader:b&&d.collapsible?c([]):a,oldHeader:this.active,newContent:b&&d.collapsible?c([]):j,oldContent:g};var f=this.headers.index(this.active[0])>this.headers.index(a[0]);this.active=b?c([]):a;this._toggle(j,g,e,b,f);h.removeClass("ui-state-active ui-corner-top").addClass("ui-state-default ui-corner-all").children(".ui-icon").removeClass(d.icons.headerSelected).addClass(d.icons.header);
if(!b){a.removeClass("ui-state-default ui-corner-all").addClass("ui-state-active ui-corner-top").children(".ui-icon").removeClass(d.icons.header).addClass(d.icons.headerSelected);a.next().addClass("ui-accordion-content-active")}}}else if(d.collapsible){this.active.removeClass("ui-state-active ui-corner-top").addClass("ui-state-default ui-corner-all").children(".ui-icon").removeClass(d.icons.headerSelected).addClass(d.icons.header);this.active.next().addClass("ui-accordion-content-active");var g=this.active.next(),
e={options:d,newHeader:c([]),oldHeader:d.active,newContent:c([]),oldContent:g},j=this.active=c([]);this._toggle(j,g,e)}},_toggle:function(a,b,d,h,f){var g=this,e=g.options;g.toShow=a;g.toHide=b;g.data=d;var j=function(){if(g)return g._completed.apply(g,arguments)};g._trigger("changestart",null,g.data);g.running=b.size()===0?a.size():b.size();if(e.animated){d={};d=e.collapsible&&h?{toShow:c([]),toHide:b,complete:j,down:f,autoHeight:e.autoHeight||e.fillSpace}:{toShow:a,toHide:b,complete:j,down:f,autoHeight:e.autoHeight||
e.fillSpace};if(!e.proxied)e.proxied=e.animated;if(!e.proxiedDuration)e.proxiedDuration=e.duration;e.animated=c.isFunction(e.proxied)?e.proxied(d):e.proxied;e.duration=c.isFunction(e.proxiedDuration)?e.proxiedDuration(d):e.proxiedDuration;h=c.ui.accordion.animations;var i=e.duration,k=e.animated;if(k&&!h[k]&&!c.easing[k])k="slide";h[k]||(h[k]=function(l){this.slide(l,{easing:k,duration:i||700})});h[k](d)}else{if(e.collapsible&&h)a.toggle();else{b.hide();a.show()}j(true)}b.prev().attr({"aria-expanded":"false",
"aria-selected":"false",tabIndex:-1}).blur();a.prev().attr({"aria-expanded":"true","aria-selected":"true",tabIndex:0}).focus()},_completed:function(a){this.running=a?0:--this.running;if(!this.running){this.options.clearStyle&&this.toShow.add(this.toHide).css({height:"",overflow:""});this.toHide.removeClass("ui-accordion-content-active");if(this.toHide.length)this.toHide.parent()[0].className=this.toHide.parent()[0].className;this._trigger("change",null,this.data)}}});c.extend(c.ui.accordion,{version:"1.8.11",
animations:{slide:function(a,b){a=c.extend({easing:"swing",duration:300},a,b);if(a.toHide.size())if(a.toShow.size()){var d=a.toShow.css("overflow"),h=0,f={},g={},e;b=a.toShow;e=b[0].style.width;b.width(parseInt(b.parent().width(),10)-parseInt(b.css("paddingLeft"),10)-parseInt(b.css("paddingRight"),10)-(parseInt(b.css("borderLeftWidth"),10)||0)-(parseInt(b.css("borderRightWidth"),10)||0));c.each(["height","paddingTop","paddingBottom"],function(j,i){g[i]="hide";j=(""+c.css(a.toShow[0],i)).match(/^([\d+-.]+)(.*)$/);
f[i]={value:j[1],unit:j[2]||"px"}});a.toShow.css({height:0,overflow:"hidden"}).show();a.toHide.filter(":hidden").each(a.complete).end().filter(":visible").animate(g,{step:function(j,i){if(i.prop=="height")h=i.end-i.start===0?0:(i.now-i.start)/(i.end-i.start);a.toShow[0].style[i.prop]=h*f[i.prop].value+f[i.prop].unit},duration:a.duration,easing:a.easing,complete:function(){a.autoHeight||a.toShow.css("height","");a.toShow.css({width:e,overflow:d});a.complete()}})}else a.toHide.animate({height:"hide",
paddingTop:"hide",paddingBottom:"hide"},a);else a.toShow.animate({height:"show",paddingTop:"show",paddingBottom:"show"},a)},bounceslide:function(a){this.slide(a,{easing:a.down?"easeOutBounce":"swing",duration:a.down?1E3:200})}}})})(jQuery);
;/*
 * jQuery UI Autocomplete 1.8.11
 *
 * 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/Autocomplete
 *
 * Depends:
 *	jquery.ui.core.js
 *	jquery.ui.widget.js
 *	jquery.ui.position.js
 */
(function(d){var e=0;d.widget("ui.autocomplete",{options:{appendTo:"body",autoFocus:false,delay:300,minLength:1,position:{my:"left top",at:"left bottom",collision:"none"},source:null},pending:0,_create:function(){var a=this,b=this.element[0].ownerDocument,g;this.element.addClass("ui-autocomplete-input").attr("autocomplete","off").attr({role:"textbox","aria-autocomplete":"list","aria-haspopup":"true"}).bind("keydown.autocomplete",function(c){if(!(a.options.disabled||a.element.attr("readonly"))){g=
false;var f=d.ui.keyCode;switch(c.keyCode){case f.PAGE_UP:a._move("previousPage",c);break;case f.PAGE_DOWN:a._move("nextPage",c);break;case f.UP:a._move("previous",c);c.preventDefault();break;case f.DOWN:a._move("next",c);c.preventDefault();break;case f.ENTER:case f.NUMPAD_ENTER:if(a.menu.active){g=true;c.preventDefault()}case f.TAB:if(!a.menu.active)return;a.menu.select(c);break;case f.ESCAPE:a.element.val(a.term);a.close(c);break;default:clearTimeout(a.searching);a.searching=setTimeout(function(){if(a.term!=
a.element.val()){a.selectedItem=null;a.search(null,c)}},a.options.delay);break}}}).bind("keypress.autocomplete",function(c){if(g){g=false;c.preventDefault()}}).bind("focus.autocomplete",function(){if(!a.options.disabled){a.selectedItem=null;a.previous=a.element.val()}}).bind("blur.autocomplete",function(c){if(!a.options.disabled){clearTimeout(a.searching);a.closing=setTimeout(function(){a.close(c);a._change(c)},150)}});this._initSource();this.response=function(){return a._response.apply(a,arguments)};
this.menu=d("<ul></ul>").addClass("ui-autocomplete").appendTo(d(this.options.appendTo||"body",b)[0]).mousedown(function(c){var f=a.menu.element[0];d(c.target).closest(".ui-menu-item").length||setTimeout(function(){d(document).one("mousedown",function(h){h.target!==a.element[0]&&h.target!==f&&!d.ui.contains(f,h.target)&&a.close()})},1);setTimeout(function(){clearTimeout(a.closing)},13)}).menu({focus:function(c,f){f=f.item.data("item.autocomplete");false!==a._trigger("focus",c,{item:f})&&/^key/.test(c.originalEvent.type)&&
a.element.val(f.value)},selected:function(c,f){var h=f.item.data("item.autocomplete"),i=a.previous;if(a.element[0]!==b.activeElement){a.element.focus();a.previous=i;setTimeout(function(){a.previous=i;a.selectedItem=h},1)}false!==a._trigger("select",c,{item:h})&&a.element.val(h.value);a.term=a.element.val();a.close(c);a.selectedItem=h},blur:function(){a.menu.element.is(":visible")&&a.element.val()!==a.term&&a.element.val(a.term)}}).zIndex(this.element.zIndex()+1).css({top:0,left:0}).hide().data("menu");
d.fn.bgiframe&&this.menu.element.bgiframe()},destroy:function(){this.element.removeClass("ui-autocomplete-input").removeAttr("autocomplete").removeAttr("role").removeAttr("aria-autocomplete").removeAttr("aria-haspopup");this.menu.element.remove();d.Widget.prototype.destroy.call(this)},_setOption:function(a,b){d.Widget.prototype._setOption.apply(this,arguments);a==="source"&&this._initSource();if(a==="appendTo")this.menu.element.appendTo(d(b||"body",this.element[0].ownerDocument)[0]);a==="disabled"&&
b&&this.xhr&&this.xhr.abort()},_initSource:function(){var a=this,b,g;if(d.isArray(this.options.source)){b=this.options.source;this.source=function(c,f){f(d.ui.autocomplete.filter(b,c.term))}}else if(typeof this.options.source==="string"){g=this.options.source;this.source=function(c,f){a.xhr&&a.xhr.abort();a.xhr=d.ajax({url:g,data:c,dataType:"json",autocompleteRequest:++e,success:function(h){this.autocompleteRequest===e&&f(h)},error:function(){this.autocompleteRequest===e&&f([])}})}}else this.source=
this.options.source},search:function(a,b){a=a!=null?a:this.element.val();this.term=this.element.val();if(a.length<this.options.minLength)return this.close(b);clearTimeout(this.closing);if(this._trigger("search",b)!==false)return this._search(a)},_search:function(a){this.pending++;this.element.addClass("ui-autocomplete-loading");this.source({term:a},this.response)},_response:function(a){if(!this.options.disabled&&a&&a.length){a=this._normalize(a);this._suggest(a);this._trigger("open")}else this.close();
this.pending--;this.pending||this.element.removeClass("ui-autocomplete-loading")},close:function(a){clearTimeout(this.closing);if(this.menu.element.is(":visible")){this.menu.element.hide();this.menu.deactivate();this._trigger("close",a)}},_change:function(a){this.previous!==this.element.val()&&this._trigger("change",a,{item:this.selectedItem})},_normalize:function(a){if(a.length&&a[0].label&&a[0].value)return a;return d.map(a,function(b){if(typeof b==="string")return{label:b,value:b};return d.extend({label:b.label||
b.value,value:b.value||b.label},b)})},_suggest:function(a){var b=this.menu.element.empty().zIndex(this.element.zIndex()+1);this._renderMenu(b,a);this.menu.deactivate();this.menu.refresh();b.show();this._resizeMenu();b.position(d.extend({of:this.element},this.options.position));this.options.autoFocus&&this.menu.next(new d.Event("mouseover"))},_resizeMenu:function(){var a=this.menu.element;a.outerWidth(Math.max(a.width("").outerWidth(),this.element.outerWidth()))},_renderMenu:function(a,b){var g=this;
d.each(b,function(c,f){g._renderItem(a,f)})},_renderItem:function(a,b){return d("<li></li>").data("item.autocomplete",b).append(d("<a></a>").text(b.label)).appendTo(a)},_move:function(a,b){if(this.menu.element.is(":visible"))if(this.menu.first()&&/^previous/.test(a)||this.menu.last()&&/^next/.test(a)){this.element.val(this.term);this.menu.deactivate()}else this.menu[a](b);else this.search(null,b)},widget:function(){return this.menu.element}});d.extend(d.ui.autocomplete,{escapeRegex:function(a){return a.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,
"\\$&")},filter:function(a,b){var g=new RegExp(d.ui.autocomplete.escapeRegex(b),"i");return d.grep(a,function(c){return g.test(c.label||c.value||c)})}})})(jQuery);
(function(d){d.widget("ui.menu",{_create:function(){var e=this;this.element.addClass("ui-menu ui-widget ui-widget-content ui-corner-all").attr({role:"listbox","aria-activedescendant":"ui-active-menuitem"}).click(function(a){if(d(a.target).closest(".ui-menu-item a").length){a.preventDefault();e.select(a)}});this.refresh()},refresh:function(){var e=this;this.element.children("li:not(.ui-menu-item):has(a)").addClass("ui-menu-item").attr("role","menuitem").children("a").addClass("ui-corner-all").attr("tabindex",
-1).mouseenter(function(a){e.activate(a,d(this).parent())}).mouseleave(function(){e.deactivate()})},activate:function(e,a){this.deactivate();if(this.hasScroll()){var b=a.offset().top-this.element.offset().top,g=this.element.attr("scrollTop"),c=this.element.height();if(b<0)this.element.attr("scrollTop",g+b);else b>=c&&this.element.attr("scrollTop",g+b-c+a.height())}this.active=a.eq(0).children("a").addClass("ui-state-hover").attr("id","ui-active-menuitem").end();this._trigger("focus",e,{item:a})},
deactivate:function(){if(this.active){this.active.children("a").removeClass("ui-state-hover").removeAttr("id");this._trigger("blur");this.active=null}},next:function(e){this.move("next",".ui-menu-item:first",e)},previous:function(e){this.move("prev",".ui-menu-item:last",e)},first:function(){return this.active&&!this.active.prevAll(".ui-menu-item").length},last:function(){return this.active&&!this.active.nextAll(".ui-menu-item").length},move:function(e,a,b){if(this.active){e=this.active[e+"All"](".ui-menu-item").eq(0);
e.length?this.activate(b,e):this.activate(b,this.element.children(a))}else this.activate(b,this.element.children(a))},nextPage:function(e){if(this.hasScroll())if(!this.active||this.last())this.activate(e,this.element.children(".ui-menu-item:first"));else{var a=this.active.offset().top,b=this.element.height(),g=this.element.children(".ui-menu-item").filter(function(){var c=d(this).offset().top-a-b+d(this).height();return c<10&&c>-10});g.length||(g=this.element.children(".ui-menu-item:last"));this.activate(e,
g)}else this.activate(e,this.element.children(".ui-menu-item").filter(!this.active||this.last()?":first":":last"))},previousPage:function(e){if(this.hasScroll())if(!this.active||this.first())this.activate(e,this.element.children(".ui-menu-item:last"));else{var a=this.active.offset().top,b=this.element.height();result=this.element.children(".ui-menu-item").filter(function(){var g=d(this).offset().top-a+b-d(this).height();return g<10&&g>-10});result.length||(result=this.element.children(".ui-menu-item:first"));
this.activate(e,result)}else this.activate(e,this.element.children(".ui-menu-item").filter(!this.active||this.first()?":last":":first"))},hasScroll:function(){return this.element.height()<this.element.attr("scrollHeight")},select:function(e){this._trigger("selected",e,{item:this.active})}})})(jQuery);
;/*
 * jQuery UI Button 1.8.11
 *
 * 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/Button
 *
 * Depends:
 *	jquery.ui.core.js
 *	jquery.ui.widget.js
 */
(function(a){var g,i=function(b){a(":ui-button",b.target.form).each(function(){var c=a(this).data("button");setTimeout(function(){c.refresh()},1)})},h=function(b){var c=b.name,d=b.form,f=a([]);if(c)f=d?a(d).find("[name='"+c+"']"):a("[name='"+c+"']",b.ownerDocument).filter(function(){return!this.form});return f};a.widget("ui.button",{options:{disabled:null,text:true,label:null,icons:{primary:null,secondary:null}},_create:function(){this.element.closest("form").unbind("reset.button").bind("reset.button",
i);if(typeof this.options.disabled!=="boolean")this.options.disabled=this.element.attr("disabled");this._determineButtonType();this.hasTitle=!!this.buttonElement.attr("title");var b=this,c=this.options,d=this.type==="checkbox"||this.type==="radio",f="ui-state-hover"+(!d?" ui-state-active":"");if(c.label===null)c.label=this.buttonElement.html();if(this.element.is(":disabled"))c.disabled=true;this.buttonElement.addClass("ui-button ui-widget ui-state-default ui-corner-all").attr("role","button").bind("mouseenter.button",
function(){if(!c.disabled){a(this).addClass("ui-state-hover");this===g&&a(this).addClass("ui-state-active")}}).bind("mouseleave.button",function(){c.disabled||a(this).removeClass(f)}).bind("focus.button",function(){a(this).addClass("ui-state-focus")}).bind("blur.button",function(){a(this).removeClass("ui-state-focus")});d&&this.element.bind("change.button",function(){b.refresh()});if(this.type==="checkbox")this.buttonElement.bind("click.button",function(){if(c.disabled)return false;a(this).toggleClass("ui-state-active");
b.buttonElement.attr("aria-pressed",b.element[0].checked)});else if(this.type==="radio")this.buttonElement.bind("click.button",function(){if(c.disabled)return false;a(this).addClass("ui-state-active");b.buttonElement.attr("aria-pressed",true);var e=b.element[0];h(e).not(e).map(function(){return a(this).button("widget")[0]}).removeClass("ui-state-active").attr("aria-pressed",false)});else{this.buttonElement.bind("mousedown.button",function(){if(c.disabled)return false;a(this).addClass("ui-state-active");
g=this;a(document).one("mouseup",function(){g=null})}).bind("mouseup.button",function(){if(c.disabled)return false;a(this).removeClass("ui-state-active")}).bind("keydown.button",function(e){if(c.disabled)return false;if(e.keyCode==a.ui.keyCode.SPACE||e.keyCode==a.ui.keyCode.ENTER)a(this).addClass("ui-state-active")}).bind("keyup.button",function(){a(this).removeClass("ui-state-active")});this.buttonElement.is("a")&&this.buttonElement.keyup(function(e){e.keyCode===a.ui.keyCode.SPACE&&a(this).click()})}this._setOption("disabled",
c.disabled)},_determineButtonType:function(){this.type=this.element.is(":checkbox")?"checkbox":this.element.is(":radio")?"radio":this.element.is("input")?"input":"button";if(this.type==="checkbox"||this.type==="radio"){var b=this.element.parents().filter(":last"),c="label[for="+this.element.attr("id")+"]";this.buttonElement=b.find(c);if(!this.buttonElement.length){b=b.length?b.siblings():this.element.siblings();this.buttonElement=b.filter(c);if(!this.buttonElement.length)this.buttonElement=b.find(c)}this.element.addClass("ui-helper-hidden-accessible");
(b=this.element.is(":checked"))&&this.buttonElement.addClass("ui-state-active");this.buttonElement.attr("aria-pressed",b)}else this.buttonElement=this.element},widget:function(){return this.buttonElement},destroy:function(){this.element.removeClass("ui-helper-hidden-accessible");this.buttonElement.removeClass("ui-button ui-widget ui-state-default ui-corner-all ui-state-hover ui-state-active  ui-button-icons-only ui-button-icon-only ui-button-text-icons ui-button-text-icon-primary ui-button-text-icon-secondary ui-button-text-only").removeAttr("role").removeAttr("aria-pressed").html(this.buttonElement.find(".ui-button-text").html());
this.hasTitle||this.buttonElement.removeAttr("title");a.Widget.prototype.destroy.call(this)},_setOption:function(b,c){a.Widget.prototype._setOption.apply(this,arguments);if(b==="disabled")c?this.element.attr("disabled",true):this.element.removeAttr("disabled");this._resetButton()},refresh:function(){var b=this.element.is(":disabled");b!==this.options.disabled&&this._setOption("disabled",b);if(this.type==="radio")h(this.element[0]).each(function(){a(this).is(":checked")?a(this).button("widget").addClass("ui-state-active").attr("aria-pressed",
true):a(this).button("widget").removeClass("ui-state-active").attr("aria-pressed",false)});else if(this.type==="checkbox")this.element.is(":checked")?this.buttonElement.addClass("ui-state-active").attr("aria-pressed",true):this.buttonElement.removeClass("ui-state-active").attr("aria-pressed",false)},_resetButton:function(){if(this.type==="input")this.options.label&&this.element.val(this.options.label);else{var b=this.buttonElement.removeClass("ui-button-icons-only ui-button-icon-only ui-button-text-icons ui-button-text-icon-primary ui-button-text-icon-secondary ui-button-text-only"),
c=a("<span></span>").addClass("ui-button-text").html(this.options.label).appendTo(b.empty()).text(),d=this.options.icons,f=d.primary&&d.secondary,e=[];if(d.primary||d.secondary){if(this.options.text)e.push("ui-button-text-icon"+(f?"s":d.primary?"-primary":"-secondary"));d.primary&&b.prepend("<span class='ui-button-icon-primary ui-icon "+d.primary+"'></span>");d.secondary&&b.append("<span class='ui-button-icon-secondary ui-icon "+d.secondary+"'></span>");if(!this.options.text){e.push(f?"ui-button-icons-only":
"ui-button-icon-only");this.hasTitle||b.attr("title",c)}}else e.push("ui-button-text-only");b.addClass(e.join(" "))}}});a.widget("ui.buttonset",{options:{items:":button, :submit, :reset, :checkbox, :radio, a, :data(button)"},_create:function(){this.element.addClass("ui-buttonset")},_init:function(){this.refresh()},_setOption:function(b,c){b==="disabled"&&this.buttons.button("option",b,c);a.Widget.prototype._setOption.apply(this,arguments)},refresh:function(){this.buttons=this.element.find(this.options.items).filter(":ui-button").button("refresh").end().not(":ui-button").button().end().map(function(){return a(this).button("widget")[0]}).removeClass("ui-corner-all ui-corner-left ui-corner-right").filter(":first").addClass("ui-corner-left").end().filter(":last").addClass("ui-corner-right").end().end()},
destroy:function(){this.element.removeClass("ui-buttonset");this.buttons.map(function(){return a(this).button("widget")[0]}).removeClass("ui-corner-left ui-corner-right").end().button("destroy");a.Widget.prototype.destroy.call(this)}})})(jQuery);
;/*
 * jQuery UI Dialog 1.8.11
 *
 * 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/Dialog
 *
 * Depends:
 *	jquery.ui.core.js
 *	jquery.ui.widget.js
 *  jquery.ui.button.js
 *	jquery.ui.draggable.js
 *	jquery.ui.mouse.js
 *	jquery.ui.position.js
 *	jquery.ui.resizable.js
 */
(function(c,j){var k={buttons:true,height:true,maxHeight:true,maxWidth:true,minHeight:true,minWidth:true,width:true},l={maxHeight:true,maxWidth:true,minHeight:true,minWidth:true};c.widget("ui.dialog",{options:{autoOpen:true,buttons:{},closeOnEscape:true,closeText:"close",dialogClass:"",draggable:true,hide:null,height:"auto",maxHeight:false,maxWidth:false,minHeight:150,minWidth:150,modal:false,position:{my:"center",at:"center",collision:"fit",using:function(a){var b=c(this).css(a).offset().top;b<0&&
c(this).css("top",a.top-b)}},resizable:true,show:null,stack:true,title:"",width:300,zIndex:1E3},_create:function(){this.originalTitle=this.element.attr("title");if(typeof this.originalTitle!=="string")this.originalTitle="";this.options.title=this.options.title||this.originalTitle;var a=this,b=a.options,d=b.title||"&#160;",e=c.ui.dialog.getTitleId(a.element),g=(a.uiDialog=c("<div></div>")).appendTo(document.body).hide().addClass("ui-dialog ui-widget ui-widget-content ui-corner-all "+b.dialogClass).css({zIndex:b.zIndex}).attr("tabIndex",
-1).css("outline",0).keydown(function(i){if(b.closeOnEscape&&i.keyCode&&i.keyCode===c.ui.keyCode.ESCAPE){a.close(i);i.preventDefault()}}).attr({role:"dialog","aria-labelledby":e}).mousedown(function(i){a.moveToTop(false,i)});a.element.show().removeAttr("title").addClass("ui-dialog-content ui-widget-content").appendTo(g);var f=(a.uiDialogTitlebar=c("<div></div>")).addClass("ui-dialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix").prependTo(g),h=c('<a href="#"></a>').addClass("ui-dialog-titlebar-close ui-corner-all").attr("role",
"button").hover(function(){h.addClass("ui-state-hover")},function(){h.removeClass("ui-state-hover")}).focus(function(){h.addClass("ui-state-focus")}).blur(function(){h.removeClass("ui-state-focus")}).click(function(i){a.close(i);return false}).appendTo(f);(a.uiDialogTitlebarCloseText=c("<span></span>")).addClass("ui-icon ui-icon-closethick").text(b.closeText).appendTo(h);c("<span></span>").addClass("ui-dialog-title").attr("id",e).html(d).prependTo(f);if(c.isFunction(b.beforeclose)&&!c.isFunction(b.beforeClose))b.beforeClose=
b.beforeclose;f.find("*").add(f).disableSelection();b.draggable&&c.fn.draggable&&a._makeDraggable();b.resizable&&c.fn.resizable&&a._makeResizable();a._createButtons(b.buttons);a._isOpen=false;c.fn.bgiframe&&g.bgiframe()},_init:function(){this.options.autoOpen&&this.open()},destroy:function(){var a=this;a.overlay&&a.overlay.destroy();a.uiDialog.hide();a.element.unbind(".dialog").removeData("dialog").removeClass("ui-dialog-content ui-widget-content").hide().appendTo("body");a.uiDialog.remove();a.originalTitle&&
a.element.attr("title",a.originalTitle);return a},widget:function(){return this.uiDialog},close:function(a){var b=this,d,e;if(false!==b._trigger("beforeClose",a)){b.overlay&&b.overlay.destroy();b.uiDialog.unbind("keypress.ui-dialog");b._isOpen=false;if(b.options.hide)b.uiDialog.hide(b.options.hide,function(){b._trigger("close",a)});else{b.uiDialog.hide();b._trigger("close",a)}c.ui.dialog.overlay.resize();if(b.options.modal){d=0;c(".ui-dialog").each(function(){if(this!==b.uiDialog[0]){e=c(this).css("z-index");
isNaN(e)||(d=Math.max(d,e))}});c.ui.dialog.maxZ=d}return b}},isOpen:function(){return this._isOpen},moveToTop:function(a,b){var d=this,e=d.options;if(e.modal&&!a||!e.stack&&!e.modal)return d._trigger("focus",b);if(e.zIndex>c.ui.dialog.maxZ)c.ui.dialog.maxZ=e.zIndex;if(d.overlay){c.ui.dialog.maxZ+=1;d.overlay.$el.css("z-index",c.ui.dialog.overlay.maxZ=c.ui.dialog.maxZ)}a={scrollTop:d.element.attr("scrollTop"),scrollLeft:d.element.attr("scrollLeft")};c.ui.dialog.maxZ+=1;d.uiDialog.css("z-index",c.ui.dialog.maxZ);
d.element.attr(a);d._trigger("focus",b);return d},open:function(){if(!this._isOpen){var a=this,b=a.options,d=a.uiDialog;a.overlay=b.modal?new c.ui.dialog.overlay(a):null;a._size();a._position(b.position);d.show(b.show);a.moveToTop(true);b.modal&&d.bind("keypress.ui-dialog",function(e){if(e.keyCode===c.ui.keyCode.TAB){var g=c(":tabbable",this),f=g.filter(":first");g=g.filter(":last");if(e.target===g[0]&&!e.shiftKey){f.focus(1);return false}else if(e.target===f[0]&&e.shiftKey){g.focus(1);return false}}});
c(a.element.find(":tabbable").get().concat(d.find(".ui-dialog-buttonpane :tabbable").get().concat(d.get()))).eq(0).focus();a._isOpen=true;a._trigger("open");return a}},_createButtons:function(a){var b=this,d=false,e=c("<div></div>").addClass("ui-dialog-buttonpane ui-widget-content ui-helper-clearfix"),g=c("<div></div>").addClass("ui-dialog-buttonset").appendTo(e);b.uiDialog.find(".ui-dialog-buttonpane").remove();typeof a==="object"&&a!==null&&c.each(a,function(){return!(d=true)});if(d){c.each(a,function(f,
h){h=c.isFunction(h)?{click:h,text:f}:h;f=c('<button type="button"></button>').attr(h,true).unbind("click").click(function(){h.click.apply(b.element[0],arguments)}).appendTo(g);c.fn.button&&f.button()});e.appendTo(b.uiDialog)}},_makeDraggable:function(){function a(f){return{position:f.position,offset:f.offset}}var b=this,d=b.options,e=c(document),g;b.uiDialog.draggable({cancel:".ui-dialog-content, .ui-dialog-titlebar-close",handle:".ui-dialog-titlebar",containment:"document",start:function(f,h){g=
d.height==="auto"?"auto":c(this).height();c(this).height(c(this).height()).addClass("ui-dialog-dragging");b._trigger("dragStart",f,a(h))},drag:function(f,h){b._trigger("drag",f,a(h))},stop:function(f,h){d.position=[h.position.left-e.scrollLeft(),h.position.top-e.scrollTop()];c(this).removeClass("ui-dialog-dragging").height(g);b._trigger("dragStop",f,a(h));c.ui.dialog.overlay.resize()}})},_makeResizable:function(a){function b(f){return{originalPosition:f.originalPosition,originalSize:f.originalSize,
position:f.position,size:f.size}}a=a===j?this.options.resizable:a;var d=this,e=d.options,g=d.uiDialog.css("position");a=typeof a==="string"?a:"n,e,s,w,se,sw,ne,nw";d.uiDialog.resizable({cancel:".ui-dialog-content",containment:"document",alsoResize:d.element,maxWidth:e.maxWidth,maxHeight:e.maxHeight,minWidth:e.minWidth,minHeight:d._minHeight(),handles:a,start:function(f,h){c(this).addClass("ui-dialog-resizing");d._trigger("resizeStart",f,b(h))},resize:function(f,h){d._trigger("resize",f,b(h))},stop:function(f,
h){c(this).removeClass("ui-dialog-resizing");e.height=c(this).height();e.width=c(this).width();d._trigger("resizeStop",f,b(h));c.ui.dialog.overlay.resize()}}).css("position",g).find(".ui-resizable-se").addClass("ui-icon ui-icon-grip-diagonal-se")},_minHeight:function(){var a=this.options;return a.height==="auto"?a.minHeight:Math.min(a.minHeight,a.height)},_position:function(a){var b=[],d=[0,0],e;if(a){if(typeof a==="string"||typeof a==="object"&&"0"in a){b=a.split?a.split(" "):[a[0],a[1]];if(b.length===
1)b[1]=b[0];c.each(["left","top"],function(g,f){if(+b[g]===b[g]){d[g]=b[g];b[g]=f}});a={my:b.join(" "),at:b.join(" "),offset:d.join(" ")}}a=c.extend({},c.ui.dialog.prototype.options.position,a)}else a=c.ui.dialog.prototype.options.position;(e=this.uiDialog.is(":visible"))||this.uiDialog.show();this.uiDialog.css({top:0,left:0}).position(c.extend({of:window},a));e||this.uiDialog.hide()},_setOptions:function(a){var b=this,d={},e=false;c.each(a,function(g,f){b._setOption(g,f);if(g in k)e=true;if(g in
l)d[g]=f});e&&this._size();this.uiDialog.is(":data(resizable)")&&this.uiDialog.resizable("option",d)},_setOption:function(a,b){var d=this,e=d.uiDialog;switch(a){case "beforeclose":a="beforeClose";break;case "buttons":d._createButtons(b);break;case "closeText":d.uiDialogTitlebarCloseText.text(""+b);break;case "dialogClass":e.removeClass(d.options.dialogClass).addClass("ui-dialog ui-widget ui-widget-content ui-corner-all "+b);break;case "disabled":b?e.addClass("ui-dialog-disabled"):e.removeClass("ui-dialog-disabled");
break;case "draggable":var g=e.is(":data(draggable)");g&&!b&&e.draggable("destroy");!g&&b&&d._makeDraggable();break;case "position":d._position(b);break;case "resizable":(g=e.is(":data(resizable)"))&&!b&&e.resizable("destroy");g&&typeof b==="string"&&e.resizable("option","handles",b);!g&&b!==false&&d._makeResizable(b);break;case "title":c(".ui-dialog-title",d.uiDialogTitlebar).html(""+(b||"&#160;"));break}c.Widget.prototype._setOption.apply(d,arguments)},_size:function(){var a=this.options,b,d,e=
this.uiDialog.is(":visible");this.element.show().css({width:"auto",minHeight:0,height:0});if(a.minWidth>a.width)a.width=a.minWidth;b=this.uiDialog.css({height:"auto",width:a.width}).height();d=Math.max(0,a.minHeight-b);if(a.height==="auto")if(c.support.minHeight)this.element.css({minHeight:d,height:"auto"});else{this.uiDialog.show();a=this.element.css("height","auto").height();e||this.uiDialog.hide();this.element.height(Math.max(a,d))}else this.element.height(Math.max(a.height-b,0));this.uiDialog.is(":data(resizable)")&&
this.uiDialog.resizable("option","minHeight",this._minHeight())}});c.extend(c.ui.dialog,{version:"1.8.11",uuid:0,maxZ:0,getTitleId:function(a){a=a.attr("id");if(!a){this.uuid+=1;a=this.uuid}return"ui-dialog-title-"+a},overlay:function(a){this.$el=c.ui.dialog.overlay.create(a)}});c.extend(c.ui.dialog.overlay,{instances:[],oldInstances:[],maxZ:0,events:c.map("focus,mousedown,mouseup,keydown,keypress,click".split(","),function(a){return a+".dialog-overlay"}).join(" "),create:function(a){if(this.instances.length===
0){setTimeout(function(){c.ui.dialog.overlay.instances.length&&c(document).bind(c.ui.dialog.overlay.events,function(d){if(c(d.target).zIndex()<c.ui.dialog.overlay.maxZ)return false})},1);c(document).bind("keydown.dialog-overlay",function(d){if(a.options.closeOnEscape&&d.keyCode&&d.keyCode===c.ui.keyCode.ESCAPE){a.close(d);d.preventDefault()}});c(window).bind("resize.dialog-overlay",c.ui.dialog.overlay.resize)}var b=(this.oldInstances.pop()||c("<div></div>").addClass("ui-widget-overlay")).appendTo(document.body).css({width:this.width(),
height:this.height()});c.fn.bgiframe&&b.bgiframe();this.instances.push(b);return b},destroy:function(a){var b=c.inArray(a,this.instances);b!=-1&&this.oldInstances.push(this.instances.splice(b,1)[0]);this.instances.length===0&&c([document,window]).unbind(".dialog-overlay");a.remove();var d=0;c.each(this.instances,function(){d=Math.max(d,this.css("z-index"))});this.maxZ=d},height:function(){var a,b;if(c.browser.msie&&c.browser.version<7){a=Math.max(document.documentElement.scrollHeight,document.body.scrollHeight);
b=Math.max(document.documentElement.offsetHeight,document.body.offsetHeight);return a<b?c(window).height()+"px":a+"px"}else return c(document).height()+"px"},width:function(){var a,b;if(c.browser.msie&&c.browser.version<7){a=Math.max(document.documentElement.scrollWidth,document.body.scrollWidth);b=Math.max(document.documentElement.offsetWidth,document.body.offsetWidth);return a<b?c(window).width()+"px":a+"px"}else return c(document).width()+"px"},resize:function(){var a=c([]);c.each(c.ui.dialog.overlay.instances,
function(){a=a.add(this)});a.css({width:0,height:0}).css({width:c.ui.dialog.overlay.width(),height:c.ui.dialog.overlay.height()})}});c.extend(c.ui.dialog.overlay.prototype,{destroy:function(){c.ui.dialog.overlay.destroy(this.$el)}})})(jQuery);
;/*
 * jQuery UI Slider 1.8.11
 *
 * 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/Slider
 *
 * Depends:
 *	jquery.ui.core.js
 *	jquery.ui.mouse.js
 *	jquery.ui.widget.js
 */
(function(d){d.widget("ui.slider",d.ui.mouse,{widgetEventPrefix:"slide",options:{animate:false,distance:0,max:100,min:0,orientation:"horizontal",range:false,step:1,value:0,values:null},_create:function(){var b=this,a=this.options;this._mouseSliding=this._keySliding=false;this._animateOff=true;this._handleIndex=null;this._detectOrientation();this._mouseInit();this.element.addClass("ui-slider ui-slider-"+this.orientation+" ui-widget ui-widget-content ui-corner-all");a.disabled&&this.element.addClass("ui-slider-disabled ui-disabled");
this.range=d([]);if(a.range){if(a.range===true){this.range=d("<div></div>");if(!a.values)a.values=[this._valueMin(),this._valueMin()];if(a.values.length&&a.values.length!==2)a.values=[a.values[0],a.values[0]]}else this.range=d("<div></div>");this.range.appendTo(this.element).addClass("ui-slider-range");if(a.range==="min"||a.range==="max")this.range.addClass("ui-slider-range-"+a.range);this.range.addClass("ui-widget-header")}d(".ui-slider-handle",this.element).length===0&&d("<a href='#'></a>").appendTo(this.element).addClass("ui-slider-handle");
if(a.values&&a.values.length)for(;d(".ui-slider-handle",this.element).length<a.values.length;)d("<a href='#'></a>").appendTo(this.element).addClass("ui-slider-handle");this.handles=d(".ui-slider-handle",this.element).addClass("ui-state-default ui-corner-all");this.handle=this.handles.eq(0);this.handles.add(this.range).filter("a").click(function(c){c.preventDefault()}).hover(function(){a.disabled||d(this).addClass("ui-state-hover")},function(){d(this).removeClass("ui-state-hover")}).focus(function(){if(a.disabled)d(this).blur();
else{d(".ui-slider .ui-state-focus").removeClass("ui-state-focus");d(this).addClass("ui-state-focus")}}).blur(function(){d(this).removeClass("ui-state-focus")});this.handles.each(function(c){d(this).data("index.ui-slider-handle",c)});this.handles.keydown(function(c){var e=true,f=d(this).data("index.ui-slider-handle"),h,g,i;if(!b.options.disabled){switch(c.keyCode){case d.ui.keyCode.HOME:case d.ui.keyCode.END:case d.ui.keyCode.PAGE_UP:case d.ui.keyCode.PAGE_DOWN:case d.ui.keyCode.UP:case d.ui.keyCode.RIGHT:case d.ui.keyCode.DOWN:case d.ui.keyCode.LEFT:e=
false;if(!b._keySliding){b._keySliding=true;d(this).addClass("ui-state-active");h=b._start(c,f);if(h===false)return}break}i=b.options.step;h=b.options.values&&b.options.values.length?(g=b.values(f)):(g=b.value());switch(c.keyCode){case d.ui.keyCode.HOME:g=b._valueMin();break;case d.ui.keyCode.END:g=b._valueMax();break;case d.ui.keyCode.PAGE_UP:g=b._trimAlignValue(h+(b._valueMax()-b._valueMin())/5);break;case d.ui.keyCode.PAGE_DOWN:g=b._trimAlignValue(h-(b._valueMax()-b._valueMin())/5);break;case d.ui.keyCode.UP:case d.ui.keyCode.RIGHT:if(h===
b._valueMax())return;g=b._trimAlignValue(h+i);break;case d.ui.keyCode.DOWN:case d.ui.keyCode.LEFT:if(h===b._valueMin())return;g=b._trimAlignValue(h-i);break}b._slide(c,f,g);return e}}).keyup(function(c){var e=d(this).data("index.ui-slider-handle");if(b._keySliding){b._keySliding=false;b._stop(c,e);b._change(c,e);d(this).removeClass("ui-state-active")}});this._refreshValue();this._animateOff=false},destroy:function(){this.handles.remove();this.range.remove();this.element.removeClass("ui-slider ui-slider-horizontal ui-slider-vertical ui-slider-disabled ui-widget ui-widget-content ui-corner-all").removeData("slider").unbind(".slider");
this._mouseDestroy();return this},_mouseCapture:function(b){var a=this.options,c,e,f,h,g;if(a.disabled)return false;this.elementSize={width:this.element.outerWidth(),height:this.element.outerHeight()};this.elementOffset=this.element.offset();c=this._normValueFromMouse({x:b.pageX,y:b.pageY});e=this._valueMax()-this._valueMin()+1;h=this;this.handles.each(function(i){var j=Math.abs(c-h.values(i));if(e>j){e=j;f=d(this);g=i}});if(a.range===true&&this.values(1)===a.min){g+=1;f=d(this.handles[g])}if(this._start(b,
g)===false)return false;this._mouseSliding=true;h._handleIndex=g;f.addClass("ui-state-active").focus();a=f.offset();this._clickOffset=!d(b.target).parents().andSelf().is(".ui-slider-handle")?{left:0,top:0}:{left:b.pageX-a.left-f.width()/2,top:b.pageY-a.top-f.height()/2-(parseInt(f.css("borderTopWidth"),10)||0)-(parseInt(f.css("borderBottomWidth"),10)||0)+(parseInt(f.css("marginTop"),10)||0)};this.handles.hasClass("ui-state-hover")||this._slide(b,g,c);return this._animateOff=true},_mouseStart:function(){return true},
_mouseDrag:function(b){var a=this._normValueFromMouse({x:b.pageX,y:b.pageY});this._slide(b,this._handleIndex,a);return false},_mouseStop:function(b){this.handles.removeClass("ui-state-active");this._mouseSliding=false;this._stop(b,this._handleIndex);this._change(b,this._handleIndex);this._clickOffset=this._handleIndex=null;return this._animateOff=false},_detectOrientation:function(){this.orientation=this.options.orientation==="vertical"?"vertical":"horizontal"},_normValueFromMouse:function(b){var a;
if(this.orientation==="horizontal"){a=this.elementSize.width;b=b.x-this.elementOffset.left-(this._clickOffset?this._clickOffset.left:0)}else{a=this.elementSize.height;b=b.y-this.elementOffset.top-(this._clickOffset?this._clickOffset.top:0)}a=b/a;if(a>1)a=1;if(a<0)a=0;if(this.orientation==="vertical")a=1-a;b=this._valueMax()-this._valueMin();return this._trimAlignValue(this._valueMin()+a*b)},_start:function(b,a){var c={handle:this.handles[a],value:this.value()};if(this.options.values&&this.options.values.length){c.value=
this.values(a);c.values=this.values()}return this._trigger("start",b,c)},_slide:function(b,a,c){var e;if(this.options.values&&this.options.values.length){e=this.values(a?0:1);if(this.options.values.length===2&&this.options.range===true&&(a===0&&c>e||a===1&&c<e))c=e;if(c!==this.values(a)){e=this.values();e[a]=c;b=this._trigger("slide",b,{handle:this.handles[a],value:c,values:e});this.values(a?0:1);b!==false&&this.values(a,c,true)}}else if(c!==this.value()){b=this._trigger("slide",b,{handle:this.handles[a],
value:c});b!==false&&this.value(c)}},_stop:function(b,a){var c={handle:this.handles[a],value:this.value()};if(this.options.values&&this.options.values.length){c.value=this.values(a);c.values=this.values()}this._trigger("stop",b,c)},_change:function(b,a){if(!this._keySliding&&!this._mouseSliding){var c={handle:this.handles[a],value:this.value()};if(this.options.values&&this.options.values.length){c.value=this.values(a);c.values=this.values()}this._trigger("change",b,c)}},value:function(b){if(arguments.length){this.options.value=
this._trimAlignValue(b);this._refreshValue();this._change(null,0)}return this._value()},values:function(b,a){var c,e,f;if(arguments.length>1){this.options.values[b]=this._trimAlignValue(a);this._refreshValue();this._change(null,b)}if(arguments.length)if(d.isArray(arguments[0])){c=this.options.values;e=arguments[0];for(f=0;f<c.length;f+=1){c[f]=this._trimAlignValue(e[f]);this._change(null,f)}this._refreshValue()}else return this.options.values&&this.options.values.length?this._values(b):this.value();
else return this._values()},_setOption:function(b,a){var c,e=0;if(d.isArray(this.options.values))e=this.options.values.length;d.Widget.prototype._setOption.apply(this,arguments);switch(b){case "disabled":if(a){this.handles.filter(".ui-state-focus").blur();this.handles.removeClass("ui-state-hover");this.handles.attr("disabled","disabled");this.element.addClass("ui-disabled")}else{this.handles.removeAttr("disabled");this.element.removeClass("ui-disabled")}break;case "orientation":this._detectOrientation();
this.element.removeClass("ui-slider-horizontal ui-slider-vertical").addClass("ui-slider-"+this.orientation);this._refreshValue();break;case "value":this._animateOff=true;this._refreshValue();this._change(null,0);this._animateOff=false;break;case "values":this._animateOff=true;this._refreshValue();for(c=0;c<e;c+=1)this._change(null,c);this._animateOff=false;break}},_value:function(){var b=this.options.value;return b=this._trimAlignValue(b)},_values:function(b){var a,c;if(arguments.length){a=this.options.values[b];
return a=this._trimAlignValue(a)}else{a=this.options.values.slice();for(c=0;c<a.length;c+=1)a[c]=this._trimAlignValue(a[c]);return a}},_trimAlignValue:function(b){if(b<=this._valueMin())return this._valueMin();if(b>=this._valueMax())return this._valueMax();var a=this.options.step>0?this.options.step:1,c=(b-this._valueMin())%a;alignValue=b-c;if(Math.abs(c)*2>=a)alignValue+=c>0?a:-a;return parseFloat(alignValue.toFixed(5))},_valueMin:function(){return this.options.min},_valueMax:function(){return this.options.max},
_refreshValue:function(){var b=this.options.range,a=this.options,c=this,e=!this._animateOff?a.animate:false,f,h={},g,i,j,l;if(this.options.values&&this.options.values.length)this.handles.each(function(k){f=(c.values(k)-c._valueMin())/(c._valueMax()-c._valueMin())*100;h[c.orientation==="horizontal"?"left":"bottom"]=f+"%";d(this).stop(1,1)[e?"animate":"css"](h,a.animate);if(c.options.range===true)if(c.orientation==="horizontal"){if(k===0)c.range.stop(1,1)[e?"animate":"css"]({left:f+"%"},a.animate);
if(k===1)c.range[e?"animate":"css"]({width:f-g+"%"},{queue:false,duration:a.animate})}else{if(k===0)c.range.stop(1,1)[e?"animate":"css"]({bottom:f+"%"},a.animate);if(k===1)c.range[e?"animate":"css"]({height:f-g+"%"},{queue:false,duration:a.animate})}g=f});else{i=this.value();j=this._valueMin();l=this._valueMax();f=l!==j?(i-j)/(l-j)*100:0;h[c.orientation==="horizontal"?"left":"bottom"]=f+"%";this.handle.stop(1,1)[e?"animate":"css"](h,a.animate);if(b==="min"&&this.orientation==="horizontal")this.range.stop(1,
1)[e?"animate":"css"]({width:f+"%"},a.animate);if(b==="max"&&this.orientation==="horizontal")this.range[e?"animate":"css"]({width:100-f+"%"},{queue:false,duration:a.animate});if(b==="min"&&this.orientation==="vertical")this.range.stop(1,1)[e?"animate":"css"]({height:f+"%"},a.animate);if(b==="max"&&this.orientation==="vertical")this.range[e?"animate":"css"]({height:100-f+"%"},{queue:false,duration:a.animate})}}});d.extend(d.ui.slider,{version:"1.8.11"})})(jQuery);
;/*
 * jQuery UI Tabs 1.8.11
 *
 * 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/Tabs
 *
 * Depends:
 *	jquery.ui.core.js
 *	jquery.ui.widget.js
 */
(function(d,p){function u(){return++v}function w(){return++x}var v=0,x=0;d.widget("ui.tabs",{options:{add:null,ajaxOptions:null,cache:false,cookie:null,collapsible:false,disable:null,disabled:[],enable:null,event:"click",fx:null,idPrefix:"ui-tabs-",load:null,panelTemplate:"<div></div>",remove:null,select:null,show:null,spinner:"<em>Loading&#8230;</em>",tabTemplate:"<li><a href='#{href}'><span>#{label}</span></a></li>"},_create:function(){this._tabify(true)},_setOption:function(b,e){if(b=="selected")this.options.collapsible&&
e==this.options.selected||this.select(e);else{this.options[b]=e;this._tabify()}},_tabId:function(b){return b.title&&b.title.replace(/\s/g,"_").replace(/[^\w\u00c0-\uFFFF-]/g,"")||this.options.idPrefix+u()},_sanitizeSelector:function(b){return b.replace(/:/g,"\\:")},_cookie:function(){var b=this.cookie||(this.cookie=this.options.cookie.name||"ui-tabs-"+w());return d.cookie.apply(null,[b].concat(d.makeArray(arguments)))},_ui:function(b,e){return{tab:b,panel:e,index:this.anchors.index(b)}},_cleanup:function(){this.lis.filter(".ui-state-processing").removeClass("ui-state-processing").find("span:data(label.tabs)").each(function(){var b=
d(this);b.html(b.data("label.tabs")).removeData("label.tabs")})},_tabify:function(b){function e(g,f){g.css("display","");!d.support.opacity&&f.opacity&&g[0].style.removeAttribute("filter")}var a=this,c=this.options,h=/^#.+/;this.list=this.element.find("ol,ul").eq(0);this.lis=d(" > li:has(a[href])",this.list);this.anchors=this.lis.map(function(){return d("a",this)[0]});this.panels=d([]);this.anchors.each(function(g,f){var i=d(f).attr("href"),l=i.split("#")[0],q;if(l&&(l===location.toString().split("#")[0]||
(q=d("base")[0])&&l===q.href)){i=f.hash;f.href=i}if(h.test(i))a.panels=a.panels.add(a.element.find(a._sanitizeSelector(i)));else if(i&&i!=="#"){d.data(f,"href.tabs",i);d.data(f,"load.tabs",i.replace(/#.*$/,""));i=a._tabId(f);f.href="#"+i;f=a.element.find("#"+i);if(!f.length){f=d(c.panelTemplate).attr("id",i).addClass("ui-tabs-panel ui-widget-content ui-corner-bottom").insertAfter(a.panels[g-1]||a.list);f.data("destroy.tabs",true)}a.panels=a.panels.add(f)}else c.disabled.push(g)});if(b){this.element.addClass("ui-tabs ui-widget ui-widget-content ui-corner-all");
this.list.addClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all");this.lis.addClass("ui-state-default ui-corner-top");this.panels.addClass("ui-tabs-panel ui-widget-content ui-corner-bottom");if(c.selected===p){location.hash&&this.anchors.each(function(g,f){if(f.hash==location.hash){c.selected=g;return false}});if(typeof c.selected!=="number"&&c.cookie)c.selected=parseInt(a._cookie(),10);if(typeof c.selected!=="number"&&this.lis.filter(".ui-tabs-selected").length)c.selected=
this.lis.index(this.lis.filter(".ui-tabs-selected"));c.selected=c.selected||(this.lis.length?0:-1)}else if(c.selected===null)c.selected=-1;c.selected=c.selected>=0&&this.anchors[c.selected]||c.selected<0?c.selected:0;c.disabled=d.unique(c.disabled.concat(d.map(this.lis.filter(".ui-state-disabled"),function(g){return a.lis.index(g)}))).sort();d.inArray(c.selected,c.disabled)!=-1&&c.disabled.splice(d.inArray(c.selected,c.disabled),1);this.panels.addClass("ui-tabs-hide");this.lis.removeClass("ui-tabs-selected ui-state-active");
if(c.selected>=0&&this.anchors.length){a.element.find(a._sanitizeSelector(a.anchors[c.selected].hash)).removeClass("ui-tabs-hide");this.lis.eq(c.selected).addClass("ui-tabs-selected ui-state-active");a.element.queue("tabs",function(){a._trigger("show",null,a._ui(a.anchors[c.selected],a.element.find(a._sanitizeSelector(a.anchors[c.selected].hash))[0]))});this.load(c.selected)}d(window).bind("unload",function(){a.lis.add(a.anchors).unbind(".tabs");a.lis=a.anchors=a.panels=null})}else c.selected=this.lis.index(this.lis.filter(".ui-tabs-selected"));
this.element[c.collapsible?"addClass":"removeClass"]("ui-tabs-collapsible");c.cookie&&this._cookie(c.selected,c.cookie);b=0;for(var j;j=this.lis[b];b++)d(j)[d.inArray(b,c.disabled)!=-1&&!d(j).hasClass("ui-tabs-selected")?"addClass":"removeClass"]("ui-state-disabled");c.cache===false&&this.anchors.removeData("cache.tabs");this.lis.add(this.anchors).unbind(".tabs");if(c.event!=="mouseover"){var k=function(g,f){f.is(":not(.ui-state-disabled)")&&f.addClass("ui-state-"+g)},n=function(g,f){f.removeClass("ui-state-"+
g)};this.lis.bind("mouseover.tabs",function(){k("hover",d(this))});this.lis.bind("mouseout.tabs",function(){n("hover",d(this))});this.anchors.bind("focus.tabs",function(){k("focus",d(this).closest("li"))});this.anchors.bind("blur.tabs",function(){n("focus",d(this).closest("li"))})}var m,o;if(c.fx)if(d.isArray(c.fx)){m=c.fx[0];o=c.fx[1]}else m=o=c.fx;var r=o?function(g,f){d(g).closest("li").addClass("ui-tabs-selected ui-state-active");f.hide().removeClass("ui-tabs-hide").animate(o,o.duration||"normal",
function(){e(f,o);a._trigger("show",null,a._ui(g,f[0]))})}:function(g,f){d(g).closest("li").addClass("ui-tabs-selected ui-state-active");f.removeClass("ui-tabs-hide");a._trigger("show",null,a._ui(g,f[0]))},s=m?function(g,f){f.animate(m,m.duration||"normal",function(){a.lis.removeClass("ui-tabs-selected ui-state-active");f.addClass("ui-tabs-hide");e(f,m);a.element.dequeue("tabs")})}:function(g,f){a.lis.removeClass("ui-tabs-selected ui-state-active");f.addClass("ui-tabs-hide");a.element.dequeue("tabs")};
this.anchors.bind(c.event+".tabs",function(){var g=this,f=d(g).closest("li"),i=a.panels.filter(":not(.ui-tabs-hide)"),l=a.element.find(a._sanitizeSelector(g.hash));if(f.hasClass("ui-tabs-selected")&&!c.collapsible||f.hasClass("ui-state-disabled")||f.hasClass("ui-state-processing")||a.panels.filter(":animated").length||a._trigger("select",null,a._ui(this,l[0]))===false){this.blur();return false}c.selected=a.anchors.index(this);a.abort();if(c.collapsible)if(f.hasClass("ui-tabs-selected")){c.selected=
-1;c.cookie&&a._cookie(c.selected,c.cookie);a.element.queue("tabs",function(){s(g,i)}).dequeue("tabs");this.blur();return false}else if(!i.length){c.cookie&&a._cookie(c.selected,c.cookie);a.element.queue("tabs",function(){r(g,l)});a.load(a.anchors.index(this));this.blur();return false}c.cookie&&a._cookie(c.selected,c.cookie);if(l.length){i.length&&a.element.queue("tabs",function(){s(g,i)});a.element.queue("tabs",function(){r(g,l)});a.load(a.anchors.index(this))}else throw"jQuery UI Tabs: Mismatching fragment identifier.";
d.browser.msie&&this.blur()});this.anchors.bind("click.tabs",function(){return false})},_getIndex:function(b){if(typeof b=="string")b=this.anchors.index(this.anchors.filter("[href$="+b+"]"));return b},destroy:function(){var b=this.options;this.abort();this.element.unbind(".tabs").removeClass("ui-tabs ui-widget ui-widget-content ui-corner-all ui-tabs-collapsible").removeData("tabs");this.list.removeClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all");this.anchors.each(function(){var e=
d.data(this,"href.tabs");if(e)this.href=e;var a=d(this).unbind(".tabs");d.each(["href","load","cache"],function(c,h){a.removeData(h+".tabs")})});this.lis.unbind(".tabs").add(this.panels).each(function(){d.data(this,"destroy.tabs")?d(this).remove():d(this).removeClass("ui-state-default ui-corner-top ui-tabs-selected ui-state-active ui-state-hover ui-state-focus ui-state-disabled ui-tabs-panel ui-widget-content ui-corner-bottom ui-tabs-hide")});b.cookie&&this._cookie(null,b.cookie);return this},add:function(b,
e,a){if(a===p)a=this.anchors.length;var c=this,h=this.options;e=d(h.tabTemplate.replace(/#\{href\}/g,b).replace(/#\{label\}/g,e));b=!b.indexOf("#")?b.replace("#",""):this._tabId(d("a",e)[0]);e.addClass("ui-state-default ui-corner-top").data("destroy.tabs",true);var j=c.element.find("#"+b);j.length||(j=d(h.panelTemplate).attr("id",b).data("destroy.tabs",true));j.addClass("ui-tabs-panel ui-widget-content ui-corner-bottom ui-tabs-hide");if(a>=this.lis.length){e.appendTo(this.list);j.appendTo(this.list[0].parentNode)}else{e.insertBefore(this.lis[a]);
j.insertBefore(this.panels[a])}h.disabled=d.map(h.disabled,function(k){return k>=a?++k:k});this._tabify();if(this.anchors.length==1){h.selected=0;e.addClass("ui-tabs-selected ui-state-active");j.removeClass("ui-tabs-hide");this.element.queue("tabs",function(){c._trigger("show",null,c._ui(c.anchors[0],c.panels[0]))});this.load(0)}this._trigger("add",null,this._ui(this.anchors[a],this.panels[a]));return this},remove:function(b){b=this._getIndex(b);var e=this.options,a=this.lis.eq(b).remove(),c=this.panels.eq(b).remove();
if(a.hasClass("ui-tabs-selected")&&this.anchors.length>1)this.select(b+(b+1<this.anchors.length?1:-1));e.disabled=d.map(d.grep(e.disabled,function(h){return h!=b}),function(h){return h>=b?--h:h});this._tabify();this._trigger("remove",null,this._ui(a.find("a")[0],c[0]));return this},enable:function(b){b=this._getIndex(b);var e=this.options;if(d.inArray(b,e.disabled)!=-1){this.lis.eq(b).removeClass("ui-state-disabled");e.disabled=d.grep(e.disabled,function(a){return a!=b});this._trigger("enable",null,
this._ui(this.anchors[b],this.panels[b]));return this}},disable:function(b){b=this._getIndex(b);var e=this.options;if(b!=e.selected){this.lis.eq(b).addClass("ui-state-disabled");e.disabled.push(b);e.disabled.sort();this._trigger("disable",null,this._ui(this.anchors[b],this.panels[b]))}return this},select:function(b){b=this._getIndex(b);if(b==-1)if(this.options.collapsible&&this.options.selected!=-1)b=this.options.selected;else return this;this.anchors.eq(b).trigger(this.options.event+".tabs");return this},
load:function(b){b=this._getIndex(b);var e=this,a=this.options,c=this.anchors.eq(b)[0],h=d.data(c,"load.tabs");this.abort();if(!h||this.element.queue("tabs").length!==0&&d.data(c,"cache.tabs"))this.element.dequeue("tabs");else{this.lis.eq(b).addClass("ui-state-processing");if(a.spinner){var j=d("span",c);j.data("label.tabs",j.html()).html(a.spinner)}this.xhr=d.ajax(d.extend({},a.ajaxOptions,{url:h,success:function(k,n){e.element.find(e._sanitizeSelector(c.hash)).html(k);e._cleanup();a.cache&&d.data(c,
"cache.tabs",true);e._trigger("load",null,e._ui(e.anchors[b],e.panels[b]));try{a.ajaxOptions.success(k,n)}catch(m){}},error:function(k,n){e._cleanup();e._trigger("load",null,e._ui(e.anchors[b],e.panels[b]));try{a.ajaxOptions.error(k,n,b,c)}catch(m){}}}));e.element.dequeue("tabs");return this}},abort:function(){this.element.queue([]);this.panels.stop(false,true);this.element.queue("tabs",this.element.queue("tabs").splice(-2,2));if(this.xhr){this.xhr.abort();delete this.xhr}this._cleanup();return this},
url:function(b,e){this.anchors.eq(b).removeData("cache.tabs").data("load.tabs",e);return this},length:function(){return this.anchors.length}});d.extend(d.ui.tabs,{version:"1.8.11"});d.extend(d.ui.tabs.prototype,{rotation:null,rotate:function(b,e){var a=this,c=this.options,h=a._rotate||(a._rotate=function(j){clearTimeout(a.rotation);a.rotation=setTimeout(function(){var k=c.selected;a.select(++k<a.anchors.length?k:0)},b);j&&j.stopPropagation()});e=a._unrotate||(a._unrotate=!e?function(j){j.clientX&&
a.rotate(null)}:function(){t=c.selected;h()});if(b){this.element.bind("tabsshow",h);this.anchors.bind(c.event+".tabs",e);h()}else{clearTimeout(a.rotation);this.element.unbind("tabsshow",h);this.anchors.unbind(c.event+".tabs",e);delete this._rotate;delete this._unrotate}return this}})})(jQuery);
;/*
 * jQuery UI Datepicker 1.8.11
 *
 * 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/Datepicker
 *
 * Depends:
 *	jquery.ui.core.js
 */
(function(d,A){function K(){this.debug=false;this._curInst=null;this._keyEvent=false;this._disabledInputs=[];this._inDialog=this._datepickerShowing=false;this._mainDivId="ui-datepicker-div";this._inlineClass="ui-datepicker-inline";this._appendClass="ui-datepicker-append";this._triggerClass="ui-datepicker-trigger";this._dialogClass="ui-datepicker-dialog";this._disableClass="ui-datepicker-disabled";this._unselectableClass="ui-datepicker-unselectable";this._currentClass="ui-datepicker-current-day";this._dayOverClass=
"ui-datepicker-days-cell-over";this.regional=[];this.regional[""]={closeText:"Done",prevText:"Prev",nextText:"Next",currentText:"Today",monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],monthNamesShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayNamesShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],dayNamesMin:["Su",
"Mo","Tu","We","Th","Fr","Sa"],weekHeader:"Wk",dateFormat:"mm/dd/yy",firstDay:0,isRTL:false,showMonthAfterYear:false,yearSuffix:""};this._defaults={showOn:"focus",showAnim:"fadeIn",showOptions:{},defaultDate:null,appendText:"",buttonText:"...",buttonImage:"",buttonImageOnly:false,hideIfNoPrevNext:false,navigationAsDateFormat:false,gotoCurrent:false,changeMonth:false,changeYear:false,yearRange:"c-10:c+10",showOtherMonths:false,selectOtherMonths:false,showWeek:false,calculateWeek:this.iso8601Week,shortYearCutoff:"+10",
minDate:null,maxDate:null,duration:"fast",beforeShowDay:null,beforeShow:null,onSelect:null,onChangeMonthYear:null,onClose:null,numberOfMonths:1,showCurrentAtPos:0,stepMonths:1,stepBigMonths:12,altField:"",altFormat:"",constrainInput:true,showButtonPanel:false,autoSize:false};d.extend(this._defaults,this.regional[""]);this.dpDiv=d('<div id="'+this._mainDivId+'" class="ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all"></div>')}function F(a,b){d.extend(a,b);for(var c in b)if(b[c]==
null||b[c]==A)a[c]=b[c];return a}d.extend(d.ui,{datepicker:{version:"1.8.11"}});var y=(new Date).getTime();d.extend(K.prototype,{markerClassName:"hasDatepicker",log:function(){this.debug&&console.log.apply("",arguments)},_widgetDatepicker:function(){return this.dpDiv},setDefaults:function(a){F(this._defaults,a||{});return this},_attachDatepicker:function(a,b){var c=null;for(var e in this._defaults){var f=a.getAttribute("date:"+e);if(f){c=c||{};try{c[e]=eval(f)}catch(h){c[e]=f}}}e=a.nodeName.toLowerCase();
f=e=="div"||e=="span";if(!a.id){this.uuid+=1;a.id="dp"+this.uuid}var i=this._newInst(d(a),f);i.settings=d.extend({},b||{},c||{});if(e=="input")this._connectDatepicker(a,i);else f&&this._inlineDatepicker(a,i)},_newInst:function(a,b){return{id:a[0].id.replace(/([^A-Za-z0-9_-])/g,"\\\\$1"),input:a,selectedDay:0,selectedMonth:0,selectedYear:0,drawMonth:0,drawYear:0,inline:b,dpDiv:!b?this.dpDiv:d('<div class="'+this._inlineClass+' ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all"></div>')}},
_connectDatepicker:function(a,b){var c=d(a);b.append=d([]);b.trigger=d([]);if(!c.hasClass(this.markerClassName)){this._attachments(c,b);c.addClass(this.markerClassName).keydown(this._doKeyDown).keypress(this._doKeyPress).keyup(this._doKeyUp).bind("setData.datepicker",function(e,f,h){b.settings[f]=h}).bind("getData.datepicker",function(e,f){return this._get(b,f)});this._autoSize(b);d.data(a,"datepicker",b)}},_attachments:function(a,b){var c=this._get(b,"appendText"),e=this._get(b,"isRTL");b.append&&
b.append.remove();if(c){b.append=d('<span class="'+this._appendClass+'">'+c+"</span>");a[e?"before":"after"](b.append)}a.unbind("focus",this._showDatepicker);b.trigger&&b.trigger.remove();c=this._get(b,"showOn");if(c=="focus"||c=="both")a.focus(this._showDatepicker);if(c=="button"||c=="both"){c=this._get(b,"buttonText");var f=this._get(b,"buttonImage");b.trigger=d(this._get(b,"buttonImageOnly")?d("<img/>").addClass(this._triggerClass).attr({src:f,alt:c,title:c}):d('<button type="button"></button>').addClass(this._triggerClass).html(f==
""?c:d("<img/>").attr({src:f,alt:c,title:c})));a[e?"before":"after"](b.trigger);b.trigger.click(function(){d.datepicker._datepickerShowing&&d.datepicker._lastInput==a[0]?d.datepicker._hideDatepicker():d.datepicker._showDatepicker(a[0]);return false})}},_autoSize:function(a){if(this._get(a,"autoSize")&&!a.inline){var b=new Date(2009,11,20),c=this._get(a,"dateFormat");if(c.match(/[DM]/)){var e=function(f){for(var h=0,i=0,g=0;g<f.length;g++)if(f[g].length>h){h=f[g].length;i=g}return i};b.setMonth(e(this._get(a,
c.match(/MM/)?"monthNames":"monthNamesShort")));b.setDate(e(this._get(a,c.match(/DD/)?"dayNames":"dayNamesShort"))+20-b.getDay())}a.input.attr("size",this._formatDate(a,b).length)}},_inlineDatepicker:function(a,b){var c=d(a);if(!c.hasClass(this.markerClassName)){c.addClass(this.markerClassName).append(b.dpDiv).bind("setData.datepicker",function(e,f,h){b.settings[f]=h}).bind("getData.datepicker",function(e,f){return this._get(b,f)});d.data(a,"datepicker",b);this._setDate(b,this._getDefaultDate(b),
true);this._updateDatepicker(b);this._updateAlternate(b);b.dpDiv.show()}},_dialogDatepicker:function(a,b,c,e,f){a=this._dialogInst;if(!a){this.uuid+=1;this._dialogInput=d('<input type="text" id="'+("dp"+this.uuid)+'" style="position: absolute; top: -100px; width: 0px; z-index: -10;"/>');this._dialogInput.keydown(this._doKeyDown);d("body").append(this._dialogInput);a=this._dialogInst=this._newInst(this._dialogInput,false);a.settings={};d.data(this._dialogInput[0],"datepicker",a)}F(a.settings,e||{});
b=b&&b.constructor==Date?this._formatDate(a,b):b;this._dialogInput.val(b);this._pos=f?f.length?f:[f.pageX,f.pageY]:null;if(!this._pos)this._pos=[document.documentElement.clientWidth/2-100+(document.documentElement.scrollLeft||document.body.scrollLeft),document.documentElement.clientHeight/2-150+(document.documentElement.scrollTop||document.body.scrollTop)];this._dialogInput.css("left",this._pos[0]+20+"px").css("top",this._pos[1]+"px");a.settings.onSelect=c;this._inDialog=true;this.dpDiv.addClass(this._dialogClass);
this._showDatepicker(this._dialogInput[0]);d.blockUI&&d.blockUI(this.dpDiv);d.data(this._dialogInput[0],"datepicker",a);return this},_destroyDatepicker:function(a){var b=d(a),c=d.data(a,"datepicker");if(b.hasClass(this.markerClassName)){var e=a.nodeName.toLowerCase();d.removeData(a,"datepicker");if(e=="input"){c.append.remove();c.trigger.remove();b.removeClass(this.markerClassName).unbind("focus",this._showDatepicker).unbind("keydown",this._doKeyDown).unbind("keypress",this._doKeyPress).unbind("keyup",
this._doKeyUp)}else if(e=="div"||e=="span")b.removeClass(this.markerClassName).empty()}},_enableDatepicker:function(a){var b=d(a),c=d.data(a,"datepicker");if(b.hasClass(this.markerClassName)){var e=a.nodeName.toLowerCase();if(e=="input"){a.disabled=false;c.trigger.filter("button").each(function(){this.disabled=false}).end().filter("img").css({opacity:"1.0",cursor:""})}else if(e=="div"||e=="span")b.children("."+this._inlineClass).children().removeClass("ui-state-disabled");this._disabledInputs=d.map(this._disabledInputs,
function(f){return f==a?null:f})}},_disableDatepicker:function(a){var b=d(a),c=d.data(a,"datepicker");if(b.hasClass(this.markerClassName)){var e=a.nodeName.toLowerCase();if(e=="input"){a.disabled=true;c.trigger.filter("button").each(function(){this.disabled=true}).end().filter("img").css({opacity:"0.5",cursor:"default"})}else if(e=="div"||e=="span")b.children("."+this._inlineClass).children().addClass("ui-state-disabled");this._disabledInputs=d.map(this._disabledInputs,function(f){return f==a?null:
f});this._disabledInputs[this._disabledInputs.length]=a}},_isDisabledDatepicker:function(a){if(!a)return false;for(var b=0;b<this._disabledInputs.length;b++)if(this._disabledInputs[b]==a)return true;return false},_getInst:function(a){try{return d.data(a,"datepicker")}catch(b){throw"Missing instance data for this datepicker";}},_optionDatepicker:function(a,b,c){var e=this._getInst(a);if(arguments.length==2&&typeof b=="string")return b=="defaults"?d.extend({},d.datepicker._defaults):e?b=="all"?d.extend({},
e.settings):this._get(e,b):null;var f=b||{};if(typeof b=="string"){f={};f[b]=c}if(e){this._curInst==e&&this._hideDatepicker();var h=this._getDateDatepicker(a,true),i=this._getMinMaxDate(e,"min"),g=this._getMinMaxDate(e,"max");F(e.settings,f);if(i!==null&&f.dateFormat!==A&&f.minDate===A)e.settings.minDate=this._formatDate(e,i);if(g!==null&&f.dateFormat!==A&&f.maxDate===A)e.settings.maxDate=this._formatDate(e,g);this._attachments(d(a),e);this._autoSize(e);this._setDateDatepicker(a,h);this._updateDatepicker(e)}},
_changeDatepicker:function(a,b,c){this._optionDatepicker(a,b,c)},_refreshDatepicker:function(a){(a=this._getInst(a))&&this._updateDatepicker(a)},_setDateDatepicker:function(a,b){if(a=this._getInst(a)){this._setDate(a,b);this._updateDatepicker(a);this._updateAlternate(a)}},_getDateDatepicker:function(a,b){(a=this._getInst(a))&&!a.inline&&this._setDateFromField(a,b);return a?this._getDate(a):null},_doKeyDown:function(a){var b=d.datepicker._getInst(a.target),c=true,e=b.dpDiv.is(".ui-datepicker-rtl");
b._keyEvent=true;if(d.datepicker._datepickerShowing)switch(a.keyCode){case 9:d.datepicker._hideDatepicker();c=false;break;case 13:c=d("td."+d.datepicker._dayOverClass+":not(."+d.datepicker._currentClass+")",b.dpDiv);c[0]?d.datepicker._selectDay(a.target,b.selectedMonth,b.selectedYear,c[0]):d.datepicker._hideDatepicker();return false;case 27:d.datepicker._hideDatepicker();break;case 33:d.datepicker._adjustDate(a.target,a.ctrlKey?-d.datepicker._get(b,"stepBigMonths"):-d.datepicker._get(b,"stepMonths"),
"M");break;case 34:d.datepicker._adjustDate(a.target,a.ctrlKey?+d.datepicker._get(b,"stepBigMonths"):+d.datepicker._get(b,"stepMonths"),"M");break;case 35:if(a.ctrlKey||a.metaKey)d.datepicker._clearDate(a.target);c=a.ctrlKey||a.metaKey;break;case 36:if(a.ctrlKey||a.metaKey)d.datepicker._gotoToday(a.target);c=a.ctrlKey||a.metaKey;break;case 37:if(a.ctrlKey||a.metaKey)d.datepicker._adjustDate(a.target,e?+1:-1,"D");c=a.ctrlKey||a.metaKey;if(a.originalEvent.altKey)d.datepicker._adjustDate(a.target,a.ctrlKey?
-d.datepicker._get(b,"stepBigMonths"):-d.datepicker._get(b,"stepMonths"),"M");break;case 38:if(a.ctrlKey||a.metaKey)d.datepicker._adjustDate(a.target,-7,"D");c=a.ctrlKey||a.metaKey;break;case 39:if(a.ctrlKey||a.metaKey)d.datepicker._adjustDate(a.target,e?-1:+1,"D");c=a.ctrlKey||a.metaKey;if(a.originalEvent.altKey)d.datepicker._adjustDate(a.target,a.ctrlKey?+d.datepicker._get(b,"stepBigMonths"):+d.datepicker._get(b,"stepMonths"),"M");break;case 40:if(a.ctrlKey||a.metaKey)d.datepicker._adjustDate(a.target,
+7,"D");c=a.ctrlKey||a.metaKey;break;default:c=false}else if(a.keyCode==36&&a.ctrlKey)d.datepicker._showDatepicker(this);else c=false;if(c){a.preventDefault();a.stopPropagation()}},_doKeyPress:function(a){var b=d.datepicker._getInst(a.target);if(d.datepicker._get(b,"constrainInput")){b=d.datepicker._possibleChars(d.datepicker._get(b,"dateFormat"));var c=String.fromCharCode(a.charCode==A?a.keyCode:a.charCode);return a.ctrlKey||a.metaKey||c<" "||!b||b.indexOf(c)>-1}},_doKeyUp:function(a){a=d.datepicker._getInst(a.target);
if(a.input.val()!=a.lastVal)try{if(d.datepicker.parseDate(d.datepicker._get(a,"dateFormat"),a.input?a.input.val():null,d.datepicker._getFormatConfig(a))){d.datepicker._setDateFromField(a);d.datepicker._updateAlternate(a);d.datepicker._updateDatepicker(a)}}catch(b){d.datepicker.log(b)}return true},_showDatepicker:function(a){a=a.target||a;if(a.nodeName.toLowerCase()!="input")a=d("input",a.parentNode)[0];if(!(d.datepicker._isDisabledDatepicker(a)||d.datepicker._lastInput==a)){var b=d.datepicker._getInst(a);
d.datepicker._curInst&&d.datepicker._curInst!=b&&d.datepicker._curInst.dpDiv.stop(true,true);var c=d.datepicker._get(b,"beforeShow");F(b.settings,c?c.apply(a,[a,b]):{});b.lastVal=null;d.datepicker._lastInput=a;d.datepicker._setDateFromField(b);if(d.datepicker._inDialog)a.value="";if(!d.datepicker._pos){d.datepicker._pos=d.datepicker._findPos(a);d.datepicker._pos[1]+=a.offsetHeight}var e=false;d(a).parents().each(function(){e|=d(this).css("position")=="fixed";return!e});if(e&&d.browser.opera){d.datepicker._pos[0]-=
document.documentElement.scrollLeft;d.datepicker._pos[1]-=document.documentElement.scrollTop}c={left:d.datepicker._pos[0],top:d.datepicker._pos[1]};d.datepicker._pos=null;b.dpDiv.empty();b.dpDiv.css({position:"absolute",display:"block",top:"-1000px"});d.datepicker._updateDatepicker(b);c=d.datepicker._checkOffset(b,c,e);b.dpDiv.css({position:d.datepicker._inDialog&&d.blockUI?"static":e?"fixed":"absolute",display:"none",left:c.left+"px",top:c.top+"px"});if(!b.inline){c=d.datepicker._get(b,"showAnim");
var f=d.datepicker._get(b,"duration"),h=function(){d.datepicker._datepickerShowing=true;var i=b.dpDiv.find("iframe.ui-datepicker-cover");if(i.length){var g=d.datepicker._getBorders(b.dpDiv);i.css({left:-g[0],top:-g[1],width:b.dpDiv.outerWidth(),height:b.dpDiv.outerHeight()})}};b.dpDiv.zIndex(d(a).zIndex()+1);d.effects&&d.effects[c]?b.dpDiv.show(c,d.datepicker._get(b,"showOptions"),f,h):b.dpDiv[c||"show"](c?f:null,h);if(!c||!f)h();b.input.is(":visible")&&!b.input.is(":disabled")&&b.input.focus();d.datepicker._curInst=
b}}},_updateDatepicker:function(a){var b=this,c=d.datepicker._getBorders(a.dpDiv);a.dpDiv.empty().append(this._generateHTML(a));var e=a.dpDiv.find("iframe.ui-datepicker-cover");e.length&&e.css({left:-c[0],top:-c[1],width:a.dpDiv.outerWidth(),height:a.dpDiv.outerHeight()});a.dpDiv.find("button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a").bind("mouseout",function(){d(this).removeClass("ui-state-hover");this.className.indexOf("ui-datepicker-prev")!=-1&&d(this).removeClass("ui-datepicker-prev-hover");
this.className.indexOf("ui-datepicker-next")!=-1&&d(this).removeClass("ui-datepicker-next-hover")}).bind("mouseover",function(){if(!b._isDisabledDatepicker(a.inline?a.dpDiv.parent()[0]:a.input[0])){d(this).parents(".ui-datepicker-calendar").find("a").removeClass("ui-state-hover");d(this).addClass("ui-state-hover");this.className.indexOf("ui-datepicker-prev")!=-1&&d(this).addClass("ui-datepicker-prev-hover");this.className.indexOf("ui-datepicker-next")!=-1&&d(this).addClass("ui-datepicker-next-hover")}}).end().find("."+
this._dayOverClass+" a").trigger("mouseover").end();c=this._getNumberOfMonths(a);e=c[1];e>1?a.dpDiv.addClass("ui-datepicker-multi-"+e).css("width",17*e+"em"):a.dpDiv.removeClass("ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4").width("");a.dpDiv[(c[0]!=1||c[1]!=1?"add":"remove")+"Class"]("ui-datepicker-multi");a.dpDiv[(this._get(a,"isRTL")?"add":"remove")+"Class"]("ui-datepicker-rtl");a==d.datepicker._curInst&&d.datepicker._datepickerShowing&&a.input&&a.input.is(":visible")&&!a.input.is(":disabled")&&
a.input[0]!=document.activeElement&&a.input.focus();if(a.yearshtml){var f=a.yearshtml;setTimeout(function(){f===a.yearshtml&&a.dpDiv.find("select.ui-datepicker-year:first").replaceWith(a.yearshtml);f=a.yearshtml=null},0)}},_getBorders:function(a){var b=function(c){return{thin:1,medium:2,thick:3}[c]||c};return[parseFloat(b(a.css("border-left-width"))),parseFloat(b(a.css("border-top-width")))]},_checkOffset:function(a,b,c){var e=a.dpDiv.outerWidth(),f=a.dpDiv.outerHeight(),h=a.input?a.input.outerWidth():
0,i=a.input?a.input.outerHeight():0,g=document.documentElement.clientWidth+d(document).scrollLeft(),j=document.documentElement.clientHeight+d(document).scrollTop();b.left-=this._get(a,"isRTL")?e-h:0;b.left-=c&&b.left==a.input.offset().left?d(document).scrollLeft():0;b.top-=c&&b.top==a.input.offset().top+i?d(document).scrollTop():0;b.left-=Math.min(b.left,b.left+e>g&&g>e?Math.abs(b.left+e-g):0);b.top-=Math.min(b.top,b.top+f>j&&j>f?Math.abs(f+i):0);return b},_findPos:function(a){for(var b=this._get(this._getInst(a),
"isRTL");a&&(a.type=="hidden"||a.nodeType!=1||d.expr.filters.hidden(a));)a=a[b?"previousSibling":"nextSibling"];a=d(a).offset();return[a.left,a.top]},_hideDatepicker:function(a){var b=this._curInst;if(!(!b||a&&b!=d.data(a,"datepicker")))if(this._datepickerShowing){a=this._get(b,"showAnim");var c=this._get(b,"duration"),e=function(){d.datepicker._tidyDialog(b);this._curInst=null};d.effects&&d.effects[a]?b.dpDiv.hide(a,d.datepicker._get(b,"showOptions"),c,e):b.dpDiv[a=="slideDown"?"slideUp":a=="fadeIn"?
"fadeOut":"hide"](a?c:null,e);a||e();if(a=this._get(b,"onClose"))a.apply(b.input?b.input[0]:null,[b.input?b.input.val():"",b]);this._datepickerShowing=false;this._lastInput=null;if(this._inDialog){this._dialogInput.css({position:"absolute",left:"0",top:"-100px"});if(d.blockUI){d.unblockUI();d("body").append(this.dpDiv)}}this._inDialog=false}},_tidyDialog:function(a){a.dpDiv.removeClass(this._dialogClass).unbind(".ui-datepicker-calendar")},_checkExternalClick:function(a){if(d.datepicker._curInst){a=
d(a.target);a[0].id!=d.datepicker._mainDivId&&a.parents("#"+d.datepicker._mainDivId).length==0&&!a.hasClass(d.datepicker.markerClassName)&&!a.hasClass(d.datepicker._triggerClass)&&d.datepicker._datepickerShowing&&!(d.datepicker._inDialog&&d.blockUI)&&d.datepicker._hideDatepicker()}},_adjustDate:function(a,b,c){a=d(a);var e=this._getInst(a[0]);if(!this._isDisabledDatepicker(a[0])){this._adjustInstDate(e,b+(c=="M"?this._get(e,"showCurrentAtPos"):0),c);this._updateDatepicker(e)}},_gotoToday:function(a){a=
d(a);var b=this._getInst(a[0]);if(this._get(b,"gotoCurrent")&&b.currentDay){b.selectedDay=b.currentDay;b.drawMonth=b.selectedMonth=b.currentMonth;b.drawYear=b.selectedYear=b.currentYear}else{var c=new Date;b.selectedDay=c.getDate();b.drawMonth=b.selectedMonth=c.getMonth();b.drawYear=b.selectedYear=c.getFullYear()}this._notifyChange(b);this._adjustDate(a)},_selectMonthYear:function(a,b,c){a=d(a);var e=this._getInst(a[0]);e._selectingMonthYear=false;e["selected"+(c=="M"?"Month":"Year")]=e["draw"+(c==
"M"?"Month":"Year")]=parseInt(b.options[b.selectedIndex].value,10);this._notifyChange(e);this._adjustDate(a)},_clickMonthYear:function(a){var b=this._getInst(d(a)[0]);b.input&&b._selectingMonthYear&&setTimeout(function(){b.input.focus()},0);b._selectingMonthYear=!b._selectingMonthYear},_selectDay:function(a,b,c,e){var f=d(a);if(!(d(e).hasClass(this._unselectableClass)||this._isDisabledDatepicker(f[0]))){f=this._getInst(f[0]);f.selectedDay=f.currentDay=d("a",e).html();f.selectedMonth=f.currentMonth=
b;f.selectedYear=f.currentYear=c;this._selectDate(a,this._formatDate(f,f.currentDay,f.currentMonth,f.currentYear))}},_clearDate:function(a){a=d(a);this._getInst(a[0]);this._selectDate(a,"")},_selectDate:function(a,b){a=this._getInst(d(a)[0]);b=b!=null?b:this._formatDate(a);a.input&&a.input.val(b);this._updateAlternate(a);var c=this._get(a,"onSelect");if(c)c.apply(a.input?a.input[0]:null,[b,a]);else a.input&&a.input.trigger("change");if(a.inline)this._updateDatepicker(a);else{this._hideDatepicker();
this._lastInput=a.input[0];typeof a.input[0]!="object"&&a.input.focus();this._lastInput=null}},_updateAlternate:function(a){var b=this._get(a,"altField");if(b){var c=this._get(a,"altFormat")||this._get(a,"dateFormat"),e=this._getDate(a),f=this.formatDate(c,e,this._getFormatConfig(a));d(b).each(function(){d(this).val(f)})}},noWeekends:function(a){a=a.getDay();return[a>0&&a<6,""]},iso8601Week:function(a){a=new Date(a.getTime());a.setDate(a.getDate()+4-(a.getDay()||7));var b=a.getTime();a.setMonth(0);
a.setDate(1);return Math.floor(Math.round((b-a)/864E5)/7)+1},parseDate:function(a,b,c){if(a==null||b==null)throw"Invalid arguments";b=typeof b=="object"?b.toString():b+"";if(b=="")return null;var e=(c?c.shortYearCutoff:null)||this._defaults.shortYearCutoff;e=typeof e!="string"?e:(new Date).getFullYear()%100+parseInt(e,10);for(var f=(c?c.dayNamesShort:null)||this._defaults.dayNamesShort,h=(c?c.dayNames:null)||this._defaults.dayNames,i=(c?c.monthNamesShort:null)||this._defaults.monthNamesShort,g=(c?
c.monthNames:null)||this._defaults.monthNames,j=c=-1,l=-1,u=-1,k=false,o=function(p){(p=z+1<a.length&&a.charAt(z+1)==p)&&z++;return p},m=function(p){var v=o(p);p=new RegExp("^\\d{1,"+(p=="@"?14:p=="!"?20:p=="y"&&v?4:p=="o"?3:2)+"}");p=b.substring(s).match(p);if(!p)throw"Missing number at position "+s;s+=p[0].length;return parseInt(p[0],10)},n=function(p,v,H){p=o(p)?H:v;for(v=0;v<p.length;v++)if(b.substr(s,p[v].length).toLowerCase()==p[v].toLowerCase()){s+=p[v].length;return v+1}throw"Unknown name at position "+
s;},r=function(){if(b.charAt(s)!=a.charAt(z))throw"Unexpected literal at position "+s;s++},s=0,z=0;z<a.length;z++)if(k)if(a.charAt(z)=="'"&&!o("'"))k=false;else r();else switch(a.charAt(z)){case "d":l=m("d");break;case "D":n("D",f,h);break;case "o":u=m("o");break;case "m":j=m("m");break;case "M":j=n("M",i,g);break;case "y":c=m("y");break;case "@":var w=new Date(m("@"));c=w.getFullYear();j=w.getMonth()+1;l=w.getDate();break;case "!":w=new Date((m("!")-this._ticksTo1970)/1E4);c=w.getFullYear();j=w.getMonth()+
1;l=w.getDate();break;case "'":if(o("'"))r();else k=true;break;default:r()}if(c==-1)c=(new Date).getFullYear();else if(c<100)c+=(new Date).getFullYear()-(new Date).getFullYear()%100+(c<=e?0:-100);if(u>-1){j=1;l=u;do{e=this._getDaysInMonth(c,j-1);if(l<=e)break;j++;l-=e}while(1)}w=this._daylightSavingAdjust(new Date(c,j-1,l));if(w.getFullYear()!=c||w.getMonth()+1!=j||w.getDate()!=l)throw"Invalid date";return w},ATOM:"yy-mm-dd",COOKIE:"D, dd M yy",ISO_8601:"yy-mm-dd",RFC_822:"D, d M y",RFC_850:"DD, dd-M-y",
RFC_1036:"D, d M y",RFC_1123:"D, d M yy",RFC_2822:"D, d M yy",RSS:"D, d M y",TICKS:"!",TIMESTAMP:"@",W3C:"yy-mm-dd",_ticksTo1970:(718685+Math.floor(492.5)-Math.floor(19.7)+Math.floor(4.925))*24*60*60*1E7,formatDate:function(a,b,c){if(!b)return"";var e=(c?c.dayNamesShort:null)||this._defaults.dayNamesShort,f=(c?c.dayNames:null)||this._defaults.dayNames,h=(c?c.monthNamesShort:null)||this._defaults.monthNamesShort;c=(c?c.monthNames:null)||this._defaults.monthNames;var i=function(o){(o=k+1<a.length&&
a.charAt(k+1)==o)&&k++;return o},g=function(o,m,n){m=""+m;if(i(o))for(;m.length<n;)m="0"+m;return m},j=function(o,m,n,r){return i(o)?r[m]:n[m]},l="",u=false;if(b)for(var k=0;k<a.length;k++)if(u)if(a.charAt(k)=="'"&&!i("'"))u=false;else l+=a.charAt(k);else switch(a.charAt(k)){case "d":l+=g("d",b.getDate(),2);break;case "D":l+=j("D",b.getDay(),e,f);break;case "o":l+=g("o",(b.getTime()-(new Date(b.getFullYear(),0,0)).getTime())/864E5,3);break;case "m":l+=g("m",b.getMonth()+1,2);break;case "M":l+=j("M",
b.getMonth(),h,c);break;case "y":l+=i("y")?b.getFullYear():(b.getYear()%100<10?"0":"")+b.getYear()%100;break;case "@":l+=b.getTime();break;case "!":l+=b.getTime()*1E4+this._ticksTo1970;break;case "'":if(i("'"))l+="'";else u=true;break;default:l+=a.charAt(k)}return l},_possibleChars:function(a){for(var b="",c=false,e=function(h){(h=f+1<a.length&&a.charAt(f+1)==h)&&f++;return h},f=0;f<a.length;f++)if(c)if(a.charAt(f)=="'"&&!e("'"))c=false;else b+=a.charAt(f);else switch(a.charAt(f)){case "d":case "m":case "y":case "@":b+=
"0123456789";break;case "D":case "M":return null;case "'":if(e("'"))b+="'";else c=true;break;default:b+=a.charAt(f)}return b},_get:function(a,b){return a.settings[b]!==A?a.settings[b]:this._defaults[b]},_setDateFromField:function(a,b){if(a.input.val()!=a.lastVal){var c=this._get(a,"dateFormat"),e=a.lastVal=a.input?a.input.val():null,f,h;f=h=this._getDefaultDate(a);var i=this._getFormatConfig(a);try{f=this.parseDate(c,e,i)||h}catch(g){this.log(g);e=b?"":e}a.selectedDay=f.getDate();a.drawMonth=a.selectedMonth=
f.getMonth();a.drawYear=a.selectedYear=f.getFullYear();a.currentDay=e?f.getDate():0;a.currentMonth=e?f.getMonth():0;a.currentYear=e?f.getFullYear():0;this._adjustInstDate(a)}},_getDefaultDate:function(a){return this._restrictMinMax(a,this._determineDate(a,this._get(a,"defaultDate"),new Date))},_determineDate:function(a,b,c){var e=function(h){var i=new Date;i.setDate(i.getDate()+h);return i},f=function(h){try{return d.datepicker.parseDate(d.datepicker._get(a,"dateFormat"),h,d.datepicker._getFormatConfig(a))}catch(i){}var g=
(h.toLowerCase().match(/^c/)?d.datepicker._getDate(a):null)||new Date,j=g.getFullYear(),l=g.getMonth();g=g.getDate();for(var u=/([+-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g,k=u.exec(h);k;){switch(k[2]||"d"){case "d":case "D":g+=parseInt(k[1],10);break;case "w":case "W":g+=parseInt(k[1],10)*7;break;case "m":case "M":l+=parseInt(k[1],10);g=Math.min(g,d.datepicker._getDaysInMonth(j,l));break;case "y":case "Y":j+=parseInt(k[1],10);g=Math.min(g,d.datepicker._getDaysInMonth(j,l));break}k=u.exec(h)}return new Date(j,
l,g)};if(b=(b=b==null||b===""?c:typeof b=="string"?f(b):typeof b=="number"?isNaN(b)?c:e(b):new Date(b.getTime()))&&b.toString()=="Invalid Date"?c:b){b.setHours(0);b.setMinutes(0);b.setSeconds(0);b.setMilliseconds(0)}return this._daylightSavingAdjust(b)},_daylightSavingAdjust:function(a){if(!a)return null;a.setHours(a.getHours()>12?a.getHours()+2:0);return a},_setDate:function(a,b,c){var e=!b,f=a.selectedMonth,h=a.selectedYear;b=this._restrictMinMax(a,this._determineDate(a,b,new Date));a.selectedDay=
a.currentDay=b.getDate();a.drawMonth=a.selectedMonth=a.currentMonth=b.getMonth();a.drawYear=a.selectedYear=a.currentYear=b.getFullYear();if((f!=a.selectedMonth||h!=a.selectedYear)&&!c)this._notifyChange(a);this._adjustInstDate(a);if(a.input)a.input.val(e?"":this._formatDate(a))},_getDate:function(a){return!a.currentYear||a.input&&a.input.val()==""?null:this._daylightSavingAdjust(new Date(a.currentYear,a.currentMonth,a.currentDay))},_generateHTML:function(a){var b=new Date;b=this._daylightSavingAdjust(new Date(b.getFullYear(),
b.getMonth(),b.getDate()));var c=this._get(a,"isRTL"),e=this._get(a,"showButtonPanel"),f=this._get(a,"hideIfNoPrevNext"),h=this._get(a,"navigationAsDateFormat"),i=this._getNumberOfMonths(a),g=this._get(a,"showCurrentAtPos"),j=this._get(a,"stepMonths"),l=i[0]!=1||i[1]!=1,u=this._daylightSavingAdjust(!a.currentDay?new Date(9999,9,9):new Date(a.currentYear,a.currentMonth,a.currentDay)),k=this._getMinMaxDate(a,"min"),o=this._getMinMaxDate(a,"max");g=a.drawMonth-g;var m=a.drawYear;if(g<0){g+=12;m--}if(o){var n=
this._daylightSavingAdjust(new Date(o.getFullYear(),o.getMonth()-i[0]*i[1]+1,o.getDate()));for(n=k&&n<k?k:n;this._daylightSavingAdjust(new Date(m,g,1))>n;){g--;if(g<0){g=11;m--}}}a.drawMonth=g;a.drawYear=m;n=this._get(a,"prevText");n=!h?n:this.formatDate(n,this._daylightSavingAdjust(new Date(m,g-j,1)),this._getFormatConfig(a));n=this._canAdjustMonth(a,-1,m,g)?'<a class="ui-datepicker-prev ui-corner-all" onclick="DP_jQuery_'+y+".datepicker._adjustDate('#"+a.id+"', -"+j+", 'M');\" title=\""+n+'"><span class="ui-icon ui-icon-circle-triangle-'+
(c?"e":"w")+'">'+n+"</span></a>":f?"":'<a class="ui-datepicker-prev ui-corner-all ui-state-disabled" title="'+n+'"><span class="ui-icon ui-icon-circle-triangle-'+(c?"e":"w")+'">'+n+"</span></a>";var r=this._get(a,"nextText");r=!h?r:this.formatDate(r,this._daylightSavingAdjust(new Date(m,g+j,1)),this._getFormatConfig(a));f=this._canAdjustMonth(a,+1,m,g)?'<a class="ui-datepicker-next ui-corner-all" onclick="DP_jQuery_'+y+".datepicker._adjustDate('#"+a.id+"', +"+j+", 'M');\" title=\""+r+'"><span class="ui-icon ui-icon-circle-triangle-'+
(c?"w":"e")+'">'+r+"</span></a>":f?"":'<a class="ui-datepicker-next ui-corner-all ui-state-disabled" title="'+r+'"><span class="ui-icon ui-icon-circle-triangle-'+(c?"w":"e")+'">'+r+"</span></a>";j=this._get(a,"currentText");r=this._get(a,"gotoCurrent")&&a.currentDay?u:b;j=!h?j:this.formatDate(j,r,this._getFormatConfig(a));h=!a.inline?'<button type="button" class="ui-datepicker-close ui-state-default ui-priority-primary ui-corner-all" onclick="DP_jQuery_'+y+'.datepicker._hideDatepicker();">'+this._get(a,
"closeText")+"</button>":"";e=e?'<div class="ui-datepicker-buttonpane ui-widget-content">'+(c?h:"")+(this._isInRange(a,r)?'<button type="button" class="ui-datepicker-current ui-state-default ui-priority-secondary ui-corner-all" onclick="DP_jQuery_'+y+".datepicker._gotoToday('#"+a.id+"');\">"+j+"</button>":"")+(c?"":h)+"</div>":"";h=parseInt(this._get(a,"firstDay"),10);h=isNaN(h)?0:h;j=this._get(a,"showWeek");r=this._get(a,"dayNames");this._get(a,"dayNamesShort");var s=this._get(a,"dayNamesMin"),z=
this._get(a,"monthNames"),w=this._get(a,"monthNamesShort"),p=this._get(a,"beforeShowDay"),v=this._get(a,"showOtherMonths"),H=this._get(a,"selectOtherMonths");this._get(a,"calculateWeek");for(var L=this._getDefaultDate(a),I="",D=0;D<i[0];D++){for(var M="",E=0;E<i[1];E++){var N=this._daylightSavingAdjust(new Date(m,g,a.selectedDay)),t=" ui-corner-all",x="";if(l){x+='<div class="ui-datepicker-group';if(i[1]>1)switch(E){case 0:x+=" ui-datepicker-group-first";t=" ui-corner-"+(c?"right":"left");break;case i[1]-
1:x+=" ui-datepicker-group-last";t=" ui-corner-"+(c?"left":"right");break;default:x+=" ui-datepicker-group-middle";t="";break}x+='">'}x+='<div class="ui-datepicker-header ui-widget-header ui-helper-clearfix'+t+'">'+(/all|left/.test(t)&&D==0?c?f:n:"")+(/all|right/.test(t)&&D==0?c?n:f:"")+this._generateMonthYearHeader(a,g,m,k,o,D>0||E>0,z,w)+'</div><table class="ui-datepicker-calendar"><thead><tr>';var B=j?'<th class="ui-datepicker-week-col">'+this._get(a,"weekHeader")+"</th>":"";for(t=0;t<7;t++){var q=
(t+h)%7;B+="<th"+((t+h+6)%7>=5?' class="ui-datepicker-week-end"':"")+'><span title="'+r[q]+'">'+s[q]+"</span></th>"}x+=B+"</tr></thead><tbody>";B=this._getDaysInMonth(m,g);if(m==a.selectedYear&&g==a.selectedMonth)a.selectedDay=Math.min(a.selectedDay,B);t=(this._getFirstDayOfMonth(m,g)-h+7)%7;B=l?6:Math.ceil((t+B)/7);q=this._daylightSavingAdjust(new Date(m,g,1-t));for(var O=0;O<B;O++){x+="<tr>";var P=!j?"":'<td class="ui-datepicker-week-col">'+this._get(a,"calculateWeek")(q)+"</td>";for(t=0;t<7;t++){var G=
p?p.apply(a.input?a.input[0]:null,[q]):[true,""],C=q.getMonth()!=g,J=C&&!H||!G[0]||k&&q<k||o&&q>o;P+='<td class="'+((t+h+6)%7>=5?" ui-datepicker-week-end":"")+(C?" ui-datepicker-other-month":"")+(q.getTime()==N.getTime()&&g==a.selectedMonth&&a._keyEvent||L.getTime()==q.getTime()&&L.getTime()==N.getTime()?" "+this._dayOverClass:"")+(J?" "+this._unselectableClass+" ui-state-disabled":"")+(C&&!v?"":" "+G[1]+(q.getTime()==u.getTime()?" "+this._currentClass:"")+(q.getTime()==b.getTime()?" ui-datepicker-today":
""))+'"'+((!C||v)&&G[2]?' title="'+G[2]+'"':"")+(J?"":' onclick="DP_jQuery_'+y+".datepicker._selectDay('#"+a.id+"',"+q.getMonth()+","+q.getFullYear()+', this);return false;"')+">"+(C&&!v?"&#xa0;":J?'<span class="ui-state-default">'+q.getDate()+"</span>":'<a class="ui-state-default'+(q.getTime()==b.getTime()?" ui-state-highlight":"")+(q.getTime()==u.getTime()?" ui-state-active":"")+(C?" ui-priority-secondary":"")+'" href="#">'+q.getDate()+"</a>")+"</td>";q.setDate(q.getDate()+1);q=this._daylightSavingAdjust(q)}x+=
P+"</tr>"}g++;if(g>11){g=0;m++}x+="</tbody></table>"+(l?"</div>"+(i[0]>0&&E==i[1]-1?'<div class="ui-datepicker-row-break"></div>':""):"");M+=x}I+=M}I+=e+(d.browser.msie&&parseInt(d.browser.version,10)<7&&!a.inline?'<iframe src="javascript:false;" class="ui-datepicker-cover" frameborder="0"></iframe>':"");a._keyEvent=false;return I},_generateMonthYearHeader:function(a,b,c,e,f,h,i,g){var j=this._get(a,"changeMonth"),l=this._get(a,"changeYear"),u=this._get(a,"showMonthAfterYear"),k='<div class="ui-datepicker-title">',
o="";if(h||!j)o+='<span class="ui-datepicker-month">'+i[b]+"</span>";else{i=e&&e.getFullYear()==c;var m=f&&f.getFullYear()==c;o+='<select class="ui-datepicker-month" onchange="DP_jQuery_'+y+".datepicker._selectMonthYear('#"+a.id+"', this, 'M');\" onclick=\"DP_jQuery_"+y+".datepicker._clickMonthYear('#"+a.id+"');\">";for(var n=0;n<12;n++)if((!i||n>=e.getMonth())&&(!m||n<=f.getMonth()))o+='<option value="'+n+'"'+(n==b?' selected="selected"':"")+">"+g[n]+"</option>";o+="</select>"}u||(k+=o+(h||!(j&&
l)?"&#xa0;":""));a.yearshtml="";if(h||!l)k+='<span class="ui-datepicker-year">'+c+"</span>";else{g=this._get(a,"yearRange").split(":");var r=(new Date).getFullYear();i=function(s){s=s.match(/c[+-].*/)?c+parseInt(s.substring(1),10):s.match(/[+-].*/)?r+parseInt(s,10):parseInt(s,10);return isNaN(s)?r:s};b=i(g[0]);g=Math.max(b,i(g[1]||""));b=e?Math.max(b,e.getFullYear()):b;g=f?Math.min(g,f.getFullYear()):g;for(a.yearshtml+='<select class="ui-datepicker-year" onchange="DP_jQuery_'+y+".datepicker._selectMonthYear('#"+
a.id+"', this, 'Y');\" onclick=\"DP_jQuery_"+y+".datepicker._clickMonthYear('#"+a.id+"');\">";b<=g;b++)a.yearshtml+='<option value="'+b+'"'+(b==c?' selected="selected"':"")+">"+b+"</option>";a.yearshtml+="</select>";if(d.browser.mozilla)k+='<select class="ui-datepicker-year"><option value="'+c+'" selected="selected">'+c+"</option></select>";else{k+=a.yearshtml;a.yearshtml=null}}k+=this._get(a,"yearSuffix");if(u)k+=(h||!(j&&l)?"&#xa0;":"")+o;k+="</div>";return k},_adjustInstDate:function(a,b,c){var e=
a.drawYear+(c=="Y"?b:0),f=a.drawMonth+(c=="M"?b:0);b=Math.min(a.selectedDay,this._getDaysInMonth(e,f))+(c=="D"?b:0);e=this._restrictMinMax(a,this._daylightSavingAdjust(new Date(e,f,b)));a.selectedDay=e.getDate();a.drawMonth=a.selectedMonth=e.getMonth();a.drawYear=a.selectedYear=e.getFullYear();if(c=="M"||c=="Y")this._notifyChange(a)},_restrictMinMax:function(a,b){var c=this._getMinMaxDate(a,"min");a=this._getMinMaxDate(a,"max");b=c&&b<c?c:b;return b=a&&b>a?a:b},_notifyChange:function(a){var b=this._get(a,
"onChangeMonthYear");if(b)b.apply(a.input?a.input[0]:null,[a.selectedYear,a.selectedMonth+1,a])},_getNumberOfMonths:function(a){a=this._get(a,"numberOfMonths");return a==null?[1,1]:typeof a=="number"?[1,a]:a},_getMinMaxDate:function(a,b){return this._determineDate(a,this._get(a,b+"Date"),null)},_getDaysInMonth:function(a,b){return 32-this._daylightSavingAdjust(new Date(a,b,32)).getDate()},_getFirstDayOfMonth:function(a,b){return(new Date(a,b,1)).getDay()},_canAdjustMonth:function(a,b,c,e){var f=this._getNumberOfMonths(a);
c=this._daylightSavingAdjust(new Date(c,e+(b<0?b:f[0]*f[1]),1));b<0&&c.setDate(this._getDaysInMonth(c.getFullYear(),c.getMonth()));return this._isInRange(a,c)},_isInRange:function(a,b){var c=this._getMinMaxDate(a,"min");a=this._getMinMaxDate(a,"max");return(!c||b.getTime()>=c.getTime())&&(!a||b.getTime()<=a.getTime())},_getFormatConfig:function(a){var b=this._get(a,"shortYearCutoff");b=typeof b!="string"?b:(new Date).getFullYear()%100+parseInt(b,10);return{shortYearCutoff:b,dayNamesShort:this._get(a,
"dayNamesShort"),dayNames:this._get(a,"dayNames"),monthNamesShort:this._get(a,"monthNamesShort"),monthNames:this._get(a,"monthNames")}},_formatDate:function(a,b,c,e){if(!b){a.currentDay=a.selectedDay;a.currentMonth=a.selectedMonth;a.currentYear=a.selectedYear}b=b?typeof b=="object"?b:this._daylightSavingAdjust(new Date(e,c,b)):this._daylightSavingAdjust(new Date(a.currentYear,a.currentMonth,a.currentDay));return this.formatDate(this._get(a,"dateFormat"),b,this._getFormatConfig(a))}});d.fn.datepicker=
function(a){if(!this.length)return this;if(!d.datepicker.initialized){d(document).mousedown(d.datepicker._checkExternalClick).find("body").append(d.datepicker.dpDiv);d.datepicker.initialized=true}var b=Array.prototype.slice.call(arguments,1);if(typeof a=="string"&&(a=="isDisabled"||a=="getDate"||a=="widget"))return d.datepicker["_"+a+"Datepicker"].apply(d.datepicker,[this[0]].concat(b));if(a=="option"&&arguments.length==2&&typeof arguments[1]=="string")return d.datepicker["_"+a+"Datepicker"].apply(d.datepicker,
[this[0]].concat(b));return this.each(function(){typeof a=="string"?d.datepicker["_"+a+"Datepicker"].apply(d.datepicker,[this].concat(b)):d.datepicker._attachDatepicker(this,a)})};d.datepicker=new K;d.datepicker.initialized=false;d.datepicker.uuid=(new Date).getTime();d.datepicker.version="1.8.11";window["DP_jQuery_"+y]=d})(jQuery);
;/*
 * jQuery UI Progressbar 1.8.11
 *
 * 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/Progressbar
 *
 * Depends:
 *   jquery.ui.core.js
 *   jquery.ui.widget.js
 */
(function(b,d){b.widget("ui.progressbar",{options:{value:0,max:100},min:0,_create:function(){this.element.addClass("ui-progressbar ui-widget ui-widget-content ui-corner-all").attr({role:"progressbar","aria-valuemin":this.min,"aria-valuemax":this.options.max,"aria-valuenow":this._value()});this.valueDiv=b("<div class='ui-progressbar-value ui-widget-header ui-corner-left'></div>").appendTo(this.element);this.oldValue=this._value();this._refreshValue()},destroy:function(){this.element.removeClass("ui-progressbar ui-widget ui-widget-content ui-corner-all").removeAttr("role").removeAttr("aria-valuemin").removeAttr("aria-valuemax").removeAttr("aria-valuenow");
this.valueDiv.remove();b.Widget.prototype.destroy.apply(this,arguments)},value:function(a){if(a===d)return this._value();this._setOption("value",a);return this},_setOption:function(a,c){if(a==="value"){this.options.value=c;this._refreshValue();this._value()===this.options.max&&this._trigger("complete")}b.Widget.prototype._setOption.apply(this,arguments)},_value:function(){var a=this.options.value;if(typeof a!=="number")a=0;return Math.min(this.options.max,Math.max(this.min,a))},_percentage:function(){return 100*
this._value()/this.options.max},_refreshValue:function(){var a=this.value(),c=this._percentage();if(this.oldValue!==a){this.oldValue=a;this._trigger("change")}this.valueDiv.toggleClass("ui-corner-right",a===this.options.max).width(c.toFixed(0)+"%");this.element.attr("aria-valuenow",a)}});b.extend(b.ui.progressbar,{version:"1.8.11"})})(jQuery);
;/*
 * jQuery UI Effects 1.8.11
 *
 * 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/Effects/
 */
jQuery.effects||function(f,j){function n(c){var a;if(c&&c.constructor==Array&&c.length==3)return c;if(a=/rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(c))return[parseInt(a[1],10),parseInt(a[2],10),parseInt(a[3],10)];if(a=/rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(c))return[parseFloat(a[1])*2.55,parseFloat(a[2])*2.55,parseFloat(a[3])*2.55];if(a=/#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(c))return[parseInt(a[1],
16),parseInt(a[2],16),parseInt(a[3],16)];if(a=/#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(c))return[parseInt(a[1]+a[1],16),parseInt(a[2]+a[2],16),parseInt(a[3]+a[3],16)];if(/rgba\(0, 0, 0, 0\)/.exec(c))return o.transparent;return o[f.trim(c).toLowerCase()]}function s(c,a){var b;do{b=f.curCSS(c,a);if(b!=""&&b!="transparent"||f.nodeName(c,"body"))break;a="backgroundColor"}while(c=c.parentNode);return n(b)}function p(){var c=document.defaultView?document.defaultView.getComputedStyle(this,null):this.currentStyle,
a={},b,d;if(c&&c.length&&c[0]&&c[c[0]])for(var e=c.length;e--;){b=c[e];if(typeof c[b]=="string"){d=b.replace(/\-(\w)/g,function(g,h){return h.toUpperCase()});a[d]=c[b]}}else for(b in c)if(typeof c[b]==="string")a[b]=c[b];return a}function q(c){var a,b;for(a in c){b=c[a];if(b==null||f.isFunction(b)||a in t||/scrollbar/.test(a)||!/color/i.test(a)&&isNaN(parseFloat(b)))delete c[a]}return c}function u(c,a){var b={_:0},d;for(d in a)if(c[d]!=a[d])b[d]=a[d];return b}function k(c,a,b,d){if(typeof c=="object"){d=
a;b=null;a=c;c=a.effect}if(f.isFunction(a)){d=a;b=null;a={}}if(typeof a=="number"||f.fx.speeds[a]){d=b;b=a;a={}}if(f.isFunction(b)){d=b;b=null}a=a||{};b=b||a.duration;b=f.fx.off?0:typeof b=="number"?b:b in f.fx.speeds?f.fx.speeds[b]:f.fx.speeds._default;d=d||a.complete;return[c,a,b,d]}function m(c){if(!c||typeof c==="number"||f.fx.speeds[c])return true;if(typeof c==="string"&&!f.effects[c])return true;return false}f.effects={};f.each(["backgroundColor","borderBottomColor","borderLeftColor","borderRightColor",
"borderTopColor","borderColor","color","outlineColor"],function(c,a){f.fx.step[a]=function(b){if(!b.colorInit){b.start=s(b.elem,a);b.end=n(b.end);b.colorInit=true}b.elem.style[a]="rgb("+Math.max(Math.min(parseInt(b.pos*(b.end[0]-b.start[0])+b.start[0],10),255),0)+","+Math.max(Math.min(parseInt(b.pos*(b.end[1]-b.start[1])+b.start[1],10),255),0)+","+Math.max(Math.min(parseInt(b.pos*(b.end[2]-b.start[2])+b.start[2],10),255),0)+")"}});var o={aqua:[0,255,255],azure:[240,255,255],beige:[245,245,220],black:[0,
0,0],blue:[0,0,255],brown:[165,42,42],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgrey:[169,169,169],darkgreen:[0,100,0],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkviolet:[148,0,211],fuchsia:[255,0,255],gold:[255,215,0],green:[0,128,0],indigo:[75,0,130],khaki:[240,230,140],lightblue:[173,216,230],lightcyan:[224,255,255],lightgreen:[144,238,144],lightgrey:[211,
211,211],lightpink:[255,182,193],lightyellow:[255,255,224],lime:[0,255,0],magenta:[255,0,255],maroon:[128,0,0],navy:[0,0,128],olive:[128,128,0],orange:[255,165,0],pink:[255,192,203],purple:[128,0,128],violet:[128,0,128],red:[255,0,0],silver:[192,192,192],white:[255,255,255],yellow:[255,255,0],transparent:[255,255,255]},r=["add","remove","toggle"],t={border:1,borderBottom:1,borderColor:1,borderLeft:1,borderRight:1,borderTop:1,borderWidth:1,margin:1,padding:1};f.effects.animateClass=function(c,a,b,
d){if(f.isFunction(b)){d=b;b=null}return this.queue("fx",function(){var e=f(this),g=e.attr("style")||" ",h=q(p.call(this)),l,v=e.attr("className");f.each(r,function(w,i){c[i]&&e[i+"Class"](c[i])});l=q(p.call(this));e.attr("className",v);e.animate(u(h,l),a,b,function(){f.each(r,function(w,i){c[i]&&e[i+"Class"](c[i])});if(typeof e.attr("style")=="object"){e.attr("style").cssText="";e.attr("style").cssText=g}else e.attr("style",g);d&&d.apply(this,arguments)});h=f.queue(this);l=h.splice(h.length-1,1)[0];
h.splice(1,0,l);f.dequeue(this)})};f.fn.extend({_addClass:f.fn.addClass,addClass:function(c,a,b,d){return a?f.effects.animateClass.apply(this,[{add:c},a,b,d]):this._addClass(c)},_removeClass:f.fn.removeClass,removeClass:function(c,a,b,d){return a?f.effects.animateClass.apply(this,[{remove:c},a,b,d]):this._removeClass(c)},_toggleClass:f.fn.toggleClass,toggleClass:function(c,a,b,d,e){return typeof a=="boolean"||a===j?b?f.effects.animateClass.apply(this,[a?{add:c}:{remove:c},b,d,e]):this._toggleClass(c,
a):f.effects.animateClass.apply(this,[{toggle:c},a,b,d])},switchClass:function(c,a,b,d,e){return f.effects.animateClass.apply(this,[{add:a,remove:c},b,d,e])}});f.extend(f.effects,{version:"1.8.11",save:function(c,a){for(var b=0;b<a.length;b++)a[b]!==null&&c.data("ec.storage."+a[b],c[0].style[a[b]])},restore:function(c,a){for(var b=0;b<a.length;b++)a[b]!==null&&c.css(a[b],c.data("ec.storage."+a[b]))},setMode:function(c,a){if(a=="toggle")a=c.is(":hidden")?"show":"hide";return a},getBaseline:function(c,
a){var b;switch(c[0]){case "top":b=0;break;case "middle":b=0.5;break;case "bottom":b=1;break;default:b=c[0]/a.height}switch(c[1]){case "left":c=0;break;case "center":c=0.5;break;case "right":c=1;break;default:c=c[1]/a.width}return{x:c,y:b}},createWrapper:function(c){if(c.parent().is(".ui-effects-wrapper"))return c.parent();var a={width:c.outerWidth(true),height:c.outerHeight(true),"float":c.css("float")},b=f("<div></div>").addClass("ui-effects-wrapper").css({fontSize:"100%",background:"transparent",
border:"none",margin:0,padding:0});c.wrap(b);b=c.parent();if(c.css("position")=="static"){b.css({position:"relative"});c.css({position:"relative"})}else{f.extend(a,{position:c.css("position"),zIndex:c.css("z-index")});f.each(["top","left","bottom","right"],function(d,e){a[e]=c.css(e);if(isNaN(parseInt(a[e],10)))a[e]="auto"});c.css({position:"relative",top:0,left:0,right:"auto",bottom:"auto"})}return b.css(a).show()},removeWrapper:function(c){if(c.parent().is(".ui-effects-wrapper"))return c.parent().replaceWith(c);
return c},setTransition:function(c,a,b,d){d=d||{};f.each(a,function(e,g){unit=c.cssUnit(g);if(unit[0]>0)d[g]=unit[0]*b+unit[1]});return d}});f.fn.extend({effect:function(c){var a=k.apply(this,arguments),b={options:a[1],duration:a[2],callback:a[3]};a=b.options.mode;var d=f.effects[c];if(f.fx.off||!d)return a?this[a](b.duration,b.callback):this.each(function(){b.callback&&b.callback.call(this)});return d.call(this,b)},_show:f.fn.show,show:function(c){if(m(c))return this._show.apply(this,arguments);
else{var a=k.apply(this,arguments);a[1].mode="show";return this.effect.apply(this,a)}},_hide:f.fn.hide,hide:function(c){if(m(c))return this._hide.apply(this,arguments);else{var a=k.apply(this,arguments);a[1].mode="hide";return this.effect.apply(this,a)}},__toggle:f.fn.toggle,toggle:function(c){if(m(c)||typeof c==="boolean"||f.isFunction(c))return this.__toggle.apply(this,arguments);else{var a=k.apply(this,arguments);a[1].mode="toggle";return this.effect.apply(this,a)}},cssUnit:function(c){var a=this.css(c),
b=[];f.each(["em","px","%","pt"],function(d,e){if(a.indexOf(e)>0)b=[parseFloat(a),e]});return b}});f.easing.jswing=f.easing.swing;f.extend(f.easing,{def:"easeOutQuad",swing:function(c,a,b,d,e){return f.easing[f.easing.def](c,a,b,d,e)},easeInQuad:function(c,a,b,d,e){return d*(a/=e)*a+b},easeOutQuad:function(c,a,b,d,e){return-d*(a/=e)*(a-2)+b},easeInOutQuad:function(c,a,b,d,e){if((a/=e/2)<1)return d/2*a*a+b;return-d/2*(--a*(a-2)-1)+b},easeInCubic:function(c,a,b,d,e){return d*(a/=e)*a*a+b},easeOutCubic:function(c,
a,b,d,e){return d*((a=a/e-1)*a*a+1)+b},easeInOutCubic:function(c,a,b,d,e){if((a/=e/2)<1)return d/2*a*a*a+b;return d/2*((a-=2)*a*a+2)+b},easeInQuart:function(c,a,b,d,e){return d*(a/=e)*a*a*a+b},easeOutQuart:function(c,a,b,d,e){return-d*((a=a/e-1)*a*a*a-1)+b},easeInOutQuart:function(c,a,b,d,e){if((a/=e/2)<1)return d/2*a*a*a*a+b;return-d/2*((a-=2)*a*a*a-2)+b},easeInQuint:function(c,a,b,d,e){return d*(a/=e)*a*a*a*a+b},easeOutQuint:function(c,a,b,d,e){return d*((a=a/e-1)*a*a*a*a+1)+b},easeInOutQuint:function(c,
a,b,d,e){if((a/=e/2)<1)return d/2*a*a*a*a*a+b;return d/2*((a-=2)*a*a*a*a+2)+b},easeInSine:function(c,a,b,d,e){return-d*Math.cos(a/e*(Math.PI/2))+d+b},easeOutSine:function(c,a,b,d,e){return d*Math.sin(a/e*(Math.PI/2))+b},easeInOutSine:function(c,a,b,d,e){return-d/2*(Math.cos(Math.PI*a/e)-1)+b},easeInExpo:function(c,a,b,d,e){return a==0?b:d*Math.pow(2,10*(a/e-1))+b},easeOutExpo:function(c,a,b,d,e){return a==e?b+d:d*(-Math.pow(2,-10*a/e)+1)+b},easeInOutExpo:function(c,a,b,d,e){if(a==0)return b;if(a==
e)return b+d;if((a/=e/2)<1)return d/2*Math.pow(2,10*(a-1))+b;return d/2*(-Math.pow(2,-10*--a)+2)+b},easeInCirc:function(c,a,b,d,e){return-d*(Math.sqrt(1-(a/=e)*a)-1)+b},easeOutCirc:function(c,a,b,d,e){return d*Math.sqrt(1-(a=a/e-1)*a)+b},easeInOutCirc:function(c,a,b,d,e){if((a/=e/2)<1)return-d/2*(Math.sqrt(1-a*a)-1)+b;return d/2*(Math.sqrt(1-(a-=2)*a)+1)+b},easeInElastic:function(c,a,b,d,e){c=1.70158;var g=0,h=d;if(a==0)return b;if((a/=e)==1)return b+d;g||(g=e*0.3);if(h<Math.abs(d)){h=d;c=g/4}else c=
g/(2*Math.PI)*Math.asin(d/h);return-(h*Math.pow(2,10*(a-=1))*Math.sin((a*e-c)*2*Math.PI/g))+b},easeOutElastic:function(c,a,b,d,e){c=1.70158;var g=0,h=d;if(a==0)return b;if((a/=e)==1)return b+d;g||(g=e*0.3);if(h<Math.abs(d)){h=d;c=g/4}else c=g/(2*Math.PI)*Math.asin(d/h);return h*Math.pow(2,-10*a)*Math.sin((a*e-c)*2*Math.PI/g)+d+b},easeInOutElastic:function(c,a,b,d,e){c=1.70158;var g=0,h=d;if(a==0)return b;if((a/=e/2)==2)return b+d;g||(g=e*0.3*1.5);if(h<Math.abs(d)){h=d;c=g/4}else c=g/(2*Math.PI)*Math.asin(d/
h);if(a<1)return-0.5*h*Math.pow(2,10*(a-=1))*Math.sin((a*e-c)*2*Math.PI/g)+b;return h*Math.pow(2,-10*(a-=1))*Math.sin((a*e-c)*2*Math.PI/g)*0.5+d+b},easeInBack:function(c,a,b,d,e,g){if(g==j)g=1.70158;return d*(a/=e)*a*((g+1)*a-g)+b},easeOutBack:function(c,a,b,d,e,g){if(g==j)g=1.70158;return d*((a=a/e-1)*a*((g+1)*a+g)+1)+b},easeInOutBack:function(c,a,b,d,e,g){if(g==j)g=1.70158;if((a/=e/2)<1)return d/2*a*a*(((g*=1.525)+1)*a-g)+b;return d/2*((a-=2)*a*(((g*=1.525)+1)*a+g)+2)+b},easeInBounce:function(c,
a,b,d,e){return d-f.easing.easeOutBounce(c,e-a,0,d,e)+b},easeOutBounce:function(c,a,b,d,e){return(a/=e)<1/2.75?d*7.5625*a*a+b:a<2/2.75?d*(7.5625*(a-=1.5/2.75)*a+0.75)+b:a<2.5/2.75?d*(7.5625*(a-=2.25/2.75)*a+0.9375)+b:d*(7.5625*(a-=2.625/2.75)*a+0.984375)+b},easeInOutBounce:function(c,a,b,d,e){if(a<e/2)return f.easing.easeInBounce(c,a*2,0,d,e)*0.5+b;return f.easing.easeOutBounce(c,a*2-e,0,d,e)*0.5+d*0.5+b}})}(jQuery);
;/*
 * jQuery UI Effects Blind 1.8.11
 *
 * 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/Effects/Blind
 *
 * Depends:
 *	jquery.effects.core.js
 */
(function(b){b.effects.blind=function(c){return this.queue(function(){var a=b(this),g=["position","top","bottom","left","right"],f=b.effects.setMode(a,c.options.mode||"hide"),d=c.options.direction||"vertical";b.effects.save(a,g);a.show();var e=b.effects.createWrapper(a).css({overflow:"hidden"}),h=d=="vertical"?"height":"width";d=d=="vertical"?e.height():e.width();f=="show"&&e.css(h,0);var i={};i[h]=f=="show"?d:0;e.animate(i,c.duration,c.options.easing,function(){f=="hide"&&a.hide();b.effects.restore(a,
g);b.effects.removeWrapper(a);c.callback&&c.callback.apply(a[0],arguments);a.dequeue()})})}})(jQuery);
;/*
 * jQuery UI Effects Bounce 1.8.11
 *
 * 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/Effects/Bounce
 *
 * Depends:
 *	jquery.effects.core.js
 */
(function(e){e.effects.bounce=function(b){return this.queue(function(){var a=e(this),l=["position","top","bottom","left","right"],h=e.effects.setMode(a,b.options.mode||"effect"),d=b.options.direction||"up",c=b.options.distance||20,m=b.options.times||5,i=b.duration||250;/show|hide/.test(h)&&l.push("opacity");e.effects.save(a,l);a.show();e.effects.createWrapper(a);var f=d=="up"||d=="down"?"top":"left";d=d=="up"||d=="left"?"pos":"neg";c=b.options.distance||(f=="top"?a.outerHeight({margin:true})/3:a.outerWidth({margin:true})/
3);if(h=="show")a.css("opacity",0).css(f,d=="pos"?-c:c);if(h=="hide")c/=m*2;h!="hide"&&m--;if(h=="show"){var g={opacity:1};g[f]=(d=="pos"?"+=":"-=")+c;a.animate(g,i/2,b.options.easing);c/=2;m--}for(g=0;g<m;g++){var j={},k={};j[f]=(d=="pos"?"-=":"+=")+c;k[f]=(d=="pos"?"+=":"-=")+c;a.animate(j,i/2,b.options.easing).animate(k,i/2,b.options.easing);c=h=="hide"?c*2:c/2}if(h=="hide"){g={opacity:0};g[f]=(d=="pos"?"-=":"+=")+c;a.animate(g,i/2,b.options.easing,function(){a.hide();e.effects.restore(a,l);e.effects.removeWrapper(a);
b.callback&&b.callback.apply(this,arguments)})}else{j={};k={};j[f]=(d=="pos"?"-=":"+=")+c;k[f]=(d=="pos"?"+=":"-=")+c;a.animate(j,i/2,b.options.easing).animate(k,i/2,b.options.easing,function(){e.effects.restore(a,l);e.effects.removeWrapper(a);b.callback&&b.callback.apply(this,arguments)})}a.queue("fx",function(){a.dequeue()});a.dequeue()})}})(jQuery);
;/*
 * jQuery UI Effects Clip 1.8.11
 *
 * 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/Effects/Clip
 *
 * Depends:
 *	jquery.effects.core.js
 */
(function(b){b.effects.clip=function(e){return this.queue(function(){var a=b(this),i=["position","top","bottom","left","right","height","width"],f=b.effects.setMode(a,e.options.mode||"hide"),c=e.options.direction||"vertical";b.effects.save(a,i);a.show();var d=b.effects.createWrapper(a).css({overflow:"hidden"});d=a[0].tagName=="IMG"?d:a;var g={size:c=="vertical"?"height":"width",position:c=="vertical"?"top":"left"};c=c=="vertical"?d.height():d.width();if(f=="show"){d.css(g.size,0);d.css(g.position,
c/2)}var h={};h[g.size]=f=="show"?c:0;h[g.position]=f=="show"?0:c/2;d.animate(h,{queue:false,duration:e.duration,easing:e.options.easing,complete:function(){f=="hide"&&a.hide();b.effects.restore(a,i);b.effects.removeWrapper(a);e.callback&&e.callback.apply(a[0],arguments);a.dequeue()}})})}})(jQuery);
;/*
 * jQuery UI Effects Drop 1.8.11
 *
 * 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/Effects/Drop
 *
 * Depends:
 *	jquery.effects.core.js
 */
(function(c){c.effects.drop=function(d){return this.queue(function(){var a=c(this),h=["position","top","bottom","left","right","opacity"],e=c.effects.setMode(a,d.options.mode||"hide"),b=d.options.direction||"left";c.effects.save(a,h);a.show();c.effects.createWrapper(a);var f=b=="up"||b=="down"?"top":"left";b=b=="up"||b=="left"?"pos":"neg";var g=d.options.distance||(f=="top"?a.outerHeight({margin:true})/2:a.outerWidth({margin:true})/2);if(e=="show")a.css("opacity",0).css(f,b=="pos"?-g:g);var i={opacity:e==
"show"?1:0};i[f]=(e=="show"?b=="pos"?"+=":"-=":b=="pos"?"-=":"+=")+g;a.animate(i,{queue:false,duration:d.duration,easing:d.options.easing,complete:function(){e=="hide"&&a.hide();c.effects.restore(a,h);c.effects.removeWrapper(a);d.callback&&d.callback.apply(this,arguments);a.dequeue()}})})}})(jQuery);
;/*
 * jQuery UI Effects Explode 1.8.11
 *
 * 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/Effects/Explode
 *
 * Depends:
 *	jquery.effects.core.js
 */
(function(j){j.effects.explode=function(a){return this.queue(function(){var c=a.options.pieces?Math.round(Math.sqrt(a.options.pieces)):3,d=a.options.pieces?Math.round(Math.sqrt(a.options.pieces)):3;a.options.mode=a.options.mode=="toggle"?j(this).is(":visible")?"hide":"show":a.options.mode;var b=j(this).show().css("visibility","hidden"),g=b.offset();g.top-=parseInt(b.css("marginTop"),10)||0;g.left-=parseInt(b.css("marginLeft"),10)||0;for(var h=b.outerWidth(true),i=b.outerHeight(true),e=0;e<c;e++)for(var f=
0;f<d;f++)b.clone().appendTo("body").wrap("<div></div>").css({position:"absolute",visibility:"visible",left:-f*(h/d),top:-e*(i/c)}).parent().addClass("ui-effects-explode").css({position:"absolute",overflow:"hidden",width:h/d,height:i/c,left:g.left+f*(h/d)+(a.options.mode=="show"?(f-Math.floor(d/2))*(h/d):0),top:g.top+e*(i/c)+(a.options.mode=="show"?(e-Math.floor(c/2))*(i/c):0),opacity:a.options.mode=="show"?0:1}).animate({left:g.left+f*(h/d)+(a.options.mode=="show"?0:(f-Math.floor(d/2))*(h/d)),top:g.top+
e*(i/c)+(a.options.mode=="show"?0:(e-Math.floor(c/2))*(i/c)),opacity:a.options.mode=="show"?1:0},a.duration||500);setTimeout(function(){a.options.mode=="show"?b.css({visibility:"visible"}):b.css({visibility:"visible"}).hide();a.callback&&a.callback.apply(b[0]);b.dequeue();j("div.ui-effects-explode").remove()},a.duration||500)})}})(jQuery);
;/*
 * jQuery UI Effects Fade 1.8.11
 *
 * 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/Effects/Fade
 *
 * Depends:
 *	jquery.effects.core.js
 */
(function(b){b.effects.fade=function(a){return this.queue(function(){var c=b(this),d=b.effects.setMode(c,a.options.mode||"hide");c.animate({opacity:d},{queue:false,duration:a.duration,easing:a.options.easing,complete:function(){a.callback&&a.callback.apply(this,arguments);c.dequeue()}})})}})(jQuery);
;/*
 * jQuery UI Effects Fold 1.8.11
 *
 * 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/Effects/Fold
 *
 * Depends:
 *	jquery.effects.core.js
 */
(function(c){c.effects.fold=function(a){return this.queue(function(){var b=c(this),j=["position","top","bottom","left","right"],d=c.effects.setMode(b,a.options.mode||"hide"),g=a.options.size||15,h=!!a.options.horizFirst,k=a.duration?a.duration/2:c.fx.speeds._default/2;c.effects.save(b,j);b.show();var e=c.effects.createWrapper(b).css({overflow:"hidden"}),f=d=="show"!=h,l=f?["width","height"]:["height","width"];f=f?[e.width(),e.height()]:[e.height(),e.width()];var i=/([0-9]+)%/.exec(g);if(i)g=parseInt(i[1],
10)/100*f[d=="hide"?0:1];if(d=="show")e.css(h?{height:0,width:g}:{height:g,width:0});h={};i={};h[l[0]]=d=="show"?f[0]:g;i[l[1]]=d=="show"?f[1]:0;e.animate(h,k,a.options.easing).animate(i,k,a.options.easing,function(){d=="hide"&&b.hide();c.effects.restore(b,j);c.effects.removeWrapper(b);a.callback&&a.callback.apply(b[0],arguments);b.dequeue()})})}})(jQuery);
;/*
 * jQuery UI Effects Highlight 1.8.11
 *
 * 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/Effects/Highlight
 *
 * Depends:
 *	jquery.effects.core.js
 */
(function(b){b.effects.highlight=function(c){return this.queue(function(){var a=b(this),e=["backgroundImage","backgroundColor","opacity"],d=b.effects.setMode(a,c.options.mode||"show"),f={backgroundColor:a.css("backgroundColor")};if(d=="hide")f.opacity=0;b.effects.save(a,e);a.show().css({backgroundImage:"none",backgroundColor:c.options.color||"#ffff99"}).animate(f,{queue:false,duration:c.duration,easing:c.options.easing,complete:function(){d=="hide"&&a.hide();b.effects.restore(a,e);d=="show"&&!b.support.opacity&&
this.style.removeAttribute("filter");c.callback&&c.callback.apply(this,arguments);a.dequeue()}})})}})(jQuery);
;/*
 * jQuery UI Effects Pulsate 1.8.11
 *
 * 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/Effects/Pulsate
 *
 * Depends:
 *	jquery.effects.core.js
 */
(function(d){d.effects.pulsate=function(a){return this.queue(function(){var b=d(this),c=d.effects.setMode(b,a.options.mode||"show");times=(a.options.times||5)*2-1;duration=a.duration?a.duration/2:d.fx.speeds._default/2;isVisible=b.is(":visible");animateTo=0;if(!isVisible){b.css("opacity",0).show();animateTo=1}if(c=="hide"&&isVisible||c=="show"&&!isVisible)times--;for(c=0;c<times;c++){b.animate({opacity:animateTo},duration,a.options.easing);animateTo=(animateTo+1)%2}b.animate({opacity:animateTo},duration,
a.options.easing,function(){animateTo==0&&b.hide();a.callback&&a.callback.apply(this,arguments)});b.queue("fx",function(){b.dequeue()}).dequeue()})}})(jQuery);
;/*
 * jQuery UI Effects Scale 1.8.11
 *
 * 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/Effects/Scale
 *
 * Depends:
 *	jquery.effects.core.js
 */
(function(c){c.effects.puff=function(b){return this.queue(function(){var a=c(this),e=c.effects.setMode(a,b.options.mode||"hide"),g=parseInt(b.options.percent,10)||150,h=g/100,i={height:a.height(),width:a.width()};c.extend(b.options,{fade:true,mode:e,percent:e=="hide"?g:100,from:e=="hide"?i:{height:i.height*h,width:i.width*h}});a.effect("scale",b.options,b.duration,b.callback);a.dequeue()})};c.effects.scale=function(b){return this.queue(function(){var a=c(this),e=c.extend(true,{},b.options),g=c.effects.setMode(a,
b.options.mode||"effect"),h=parseInt(b.options.percent,10)||(parseInt(b.options.percent,10)==0?0:g=="hide"?0:100),i=b.options.direction||"both",f=b.options.origin;if(g!="effect"){e.origin=f||["middle","center"];e.restore=true}f={height:a.height(),width:a.width()};a.from=b.options.from||(g=="show"?{height:0,width:0}:f);h={y:i!="horizontal"?h/100:1,x:i!="vertical"?h/100:1};a.to={height:f.height*h.y,width:f.width*h.x};if(b.options.fade){if(g=="show"){a.from.opacity=0;a.to.opacity=1}if(g=="hide"){a.from.opacity=
1;a.to.opacity=0}}e.from=a.from;e.to=a.to;e.mode=g;a.effect("size",e,b.duration,b.callback);a.dequeue()})};c.effects.size=function(b){return this.queue(function(){var a=c(this),e=["position","top","bottom","left","right","width","height","overflow","opacity"],g=["position","top","bottom","left","right","overflow","opacity"],h=["width","height","overflow"],i=["fontSize"],f=["borderTopWidth","borderBottomWidth","paddingTop","paddingBottom"],k=["borderLeftWidth","borderRightWidth","paddingLeft","paddingRight"],
p=c.effects.setMode(a,b.options.mode||"effect"),n=b.options.restore||false,m=b.options.scale||"both",l=b.options.origin,j={height:a.height(),width:a.width()};a.from=b.options.from||j;a.to=b.options.to||j;if(l){l=c.effects.getBaseline(l,j);a.from.top=(j.height-a.from.height)*l.y;a.from.left=(j.width-a.from.width)*l.x;a.to.top=(j.height-a.to.height)*l.y;a.to.left=(j.width-a.to.width)*l.x}var d={from:{y:a.from.height/j.height,x:a.from.width/j.width},to:{y:a.to.height/j.height,x:a.to.width/j.width}};
if(m=="box"||m=="both"){if(d.from.y!=d.to.y){e=e.concat(f);a.from=c.effects.setTransition(a,f,d.from.y,a.from);a.to=c.effects.setTransition(a,f,d.to.y,a.to)}if(d.from.x!=d.to.x){e=e.concat(k);a.from=c.effects.setTransition(a,k,d.from.x,a.from);a.to=c.effects.setTransition(a,k,d.to.x,a.to)}}if(m=="content"||m=="both")if(d.from.y!=d.to.y){e=e.concat(i);a.from=c.effects.setTransition(a,i,d.from.y,a.from);a.to=c.effects.setTransition(a,i,d.to.y,a.to)}c.effects.save(a,n?e:g);a.show();c.effects.createWrapper(a);
a.css("overflow","hidden").css(a.from);if(m=="content"||m=="both"){f=f.concat(["marginTop","marginBottom"]).concat(i);k=k.concat(["marginLeft","marginRight"]);h=e.concat(f).concat(k);a.find("*[width]").each(function(){child=c(this);n&&c.effects.save(child,h);var o={height:child.height(),width:child.width()};child.from={height:o.height*d.from.y,width:o.width*d.from.x};child.to={height:o.height*d.to.y,width:o.width*d.to.x};if(d.from.y!=d.to.y){child.from=c.effects.setTransition(child,f,d.from.y,child.from);
child.to=c.effects.setTransition(child,f,d.to.y,child.to)}if(d.from.x!=d.to.x){child.from=c.effects.setTransition(child,k,d.from.x,child.from);child.to=c.effects.setTransition(child,k,d.to.x,child.to)}child.css(child.from);child.animate(child.to,b.duration,b.options.easing,function(){n&&c.effects.restore(child,h)})})}a.animate(a.to,{queue:false,duration:b.duration,easing:b.options.easing,complete:function(){a.to.opacity===0&&a.css("opacity",a.from.opacity);p=="hide"&&a.hide();c.effects.restore(a,
n?e:g);c.effects.removeWrapper(a);b.callback&&b.callback.apply(this,arguments);a.dequeue()}})})}})(jQuery);
;/*
 * jQuery UI Effects Shake 1.8.11
 *
 * 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/Effects/Shake
 *
 * Depends:
 *	jquery.effects.core.js
 */
(function(d){d.effects.shake=function(a){return this.queue(function(){var b=d(this),j=["position","top","bottom","left","right"];d.effects.setMode(b,a.options.mode||"effect");var c=a.options.direction||"left",e=a.options.distance||20,l=a.options.times||3,f=a.duration||a.options.duration||140;d.effects.save(b,j);b.show();d.effects.createWrapper(b);var g=c=="up"||c=="down"?"top":"left",h=c=="up"||c=="left"?"pos":"neg";c={};var i={},k={};c[g]=(h=="pos"?"-=":"+=")+e;i[g]=(h=="pos"?"+=":"-=")+e*2;k[g]=
(h=="pos"?"-=":"+=")+e*2;b.animate(c,f,a.options.easing);for(e=1;e<l;e++)b.animate(i,f,a.options.easing).animate(k,f,a.options.easing);b.animate(i,f,a.options.easing).animate(c,f/2,a.options.easing,function(){d.effects.restore(b,j);d.effects.removeWrapper(b);a.callback&&a.callback.apply(this,arguments)});b.queue("fx",function(){b.dequeue()});b.dequeue()})}})(jQuery);
;/*
 * jQuery UI Effects Slide 1.8.11
 *
 * 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/Effects/Slide
 *
 * Depends:
 *	jquery.effects.core.js
 */
(function(c){c.effects.slide=function(d){return this.queue(function(){var a=c(this),h=["position","top","bottom","left","right"],f=c.effects.setMode(a,d.options.mode||"show"),b=d.options.direction||"left";c.effects.save(a,h);a.show();c.effects.createWrapper(a).css({overflow:"hidden"});var g=b=="up"||b=="down"?"top":"left";b=b=="up"||b=="left"?"pos":"neg";var e=d.options.distance||(g=="top"?a.outerHeight({margin:true}):a.outerWidth({margin:true}));if(f=="show")a.css(g,b=="pos"?isNaN(e)?"-"+e:-e:e);
var i={};i[g]=(f=="show"?b=="pos"?"+=":"-=":b=="pos"?"-=":"+=")+e;a.animate(i,{queue:false,duration:d.duration,easing:d.options.easing,complete:function(){f=="hide"&&a.hide();c.effects.restore(a,h);c.effects.removeWrapper(a);d.callback&&d.callback.apply(this,arguments);a.dequeue()}})})}})(jQuery);
;/*
 * jQuery UI Effects Transfer 1.8.11
 *
 * 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/Effects/Transfer
 *
 * Depends:
 *	jquery.effects.core.js
 */
(function(e){e.effects.transfer=function(a){return this.queue(function(){var b=e(this),c=e(a.options.to),d=c.offset();c={top:d.top,left:d.left,height:c.innerHeight(),width:c.innerWidth()};d=b.offset();var f=e('<div class="ui-effects-transfer"></div>').appendTo(document.body).addClass(a.options.className).css({top:d.top,left:d.left,height:b.innerHeight(),width:b.innerWidth(),position:"absolute"}).animate(c,a.duration,a.options.easing,function(){f.remove();a.callback&&a.callback.apply(b[0],arguments);
b.dequeue()})})}})(jQuery);
;
 /* adriver_async.js */ 
/**
* adriver
*/

function adriver (ph, prm, defer){ 
	if(this instanceof adriver){
		var p = null;
		if (typeof(ph) == "string"){
			p = document.getElementById(ph);
		}else{
			p = ph; ph = p.id;
		}
		
		if(!p) {return null}
		if (adriver.items[ph]){ return adriver.items[ph]}
		
		adriver.items[ph] = this;
		this.ph = ph;
		this.p = p;

		this.reply = {};
		this.prm = p.title ? adriver.parseJSON(p.title) : {};
		adriver.extend(this.prm, prm, {ph: ph});
		this.className = p.className.match(/\w+\b/); 

		this.loadCompleteQueue = new adriver.queue();
		this.domReadyQueue = new adriver.queue(adriver.isDomReady);

		var my = this;
		adriver.onDomReady(function(){my.domReady()});
		if (!defer) this.load(); 
		return this;
	}else{
		return arguments.length ? adriver.items[ph] : adriver.items;
	}
}
	
adriver.loadScript = function(req){ 
	try {
		req = req.replace(/!\[rnd\]/,Math.round(Math.random()*10000000));  
		var head = document.getElementsByTagName("head").item(0);
		var s = document.createElement("script");
		s.setAttribute("type", "text/javascript");
		s.setAttribute("charset", "windows-1251");
		s.setAttribute("src", req);
		s.onreadystatechange = function(){if (/loaded|complete/.test(this.readyState))head.removeChild(s)};
		s.onload = function (e) {head.removeChild(s)};
		head.insertBefore(s, head.firstChild); 
	}catch(e){}
} 

adriver.extend = function (){
	var l = arguments[0]; 
	for (var i = 1, len = arguments.length; i<len; i++){
		var r = arguments[i]; 
		for (var j in r){ 
			if(r.hasOwnProperty(j)){ 
				if (r[j] instanceof Object){if(l[j]) {adriver.extend(l[j], r[j]);}else{l[j] = adriver.extend(r[j] instanceof Array ? [] : {}, r[j]);}}else{l[j] = r[j];}
			}
		}
	}
	return l
}

adriver.extendL = function (l, r){for(var i in l){if (l.hasOwnProperty(i) && r.hasOwnProperty(i)) l[i] = r[i]}; return l}

adriver.toQueryString = function (o, delimiter, assign) {
	delimiter = delimiter || "&"; 
	assign = assign || "=";
	var l = []; 
	for (var i in o){if (o.hasOwnProperty(i)) l.push (i + assign + o[i])}
	return l.join(delimiter)
}

adriver.parseJSON = function (text){
	var cx = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g;
	if (cx.test(text)) {text = text.replace(cx, function (a) {return "\\u" + ("0000" + a.charCodeAt(0).toString(16)).slice(-4)})}
	if (!(/^\s*\{.*\}\s*$/).test(text)) text = "{" + text + "}";	
	text = text.replace(/'/g,"\"");
	
	return /^[\],:{}\s]*$/.
		test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, "@").
		replace(/\w+(?=\s+|:)|"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, "]").
		replace(/(?:^|:|,)(?:\s*\[)+/g, "")) ? eval("(" + text + ")") : {};
}


adriver.prototype = {
	isLoading : false,
	
	load : function (){ 
		try { 
			if (!this.isLoading){
				this.isLoading = true;
				var req = adriver.extend({}, adriver.defaults, this.prm);
				adriver.loadScript(adriver.redirectHost + "/cgi-bin/merle.cgi?rnd=![rnd]&" + adriver.toQueryString(req)); 
			}
		}catch(e){}
		return this;
	}, 
		
	reload: function (){
		this.reset();
		this.load();
		return this;
	},

	onLoadComplete : function (f) {
		this.loadCompleteQueue.push(f);
		return this;
	},
	
	loadComplete : function (){	
		this.isLoading = false; 
		this.loadCompleteQueue.execute(); 
		return this;
	},
	
	onDomReady : function (f) {
		this.domReadyQueue.push(f);
		return this;
	},
	
	domReady : function (){
		this.domReadyQueue.execute();
		return this;
	},
	
	reset : function (){	
		this.loadCompleteQueue.flush();
		this.domReadyQueue.flush(adriver.isDomReady);
		this.isLoading = false;
		return this;
	}
}

adriver.onDomReady = function (f){
	adriver.domReadyQueue.push(f);
}

adriver.onBeforeDomReady = function (f){
	adriver.domReadyQueue.unshift(f);
}

adriver.domReady = function(){ 
	adriver.isDomReady = true;
	adriver.domReadyQueue.execute();
}


adriver.setDefaults = function (defaults){adriver.extend(adriver.defaults, defaults)}
adriver.setOptions = function (options){adriver.extend(adriver.options, options)}
adriver.setPluginPath = function(path){adriver.extend(adriver.pluginPath, path)}


adriver.queue = function (flag){ this.q = []; this.flag = flag ? true: false }

adriver.queue.prototype = {
	push : function (f){this.flag ? f() : this.q.push(f)}, 
	unshift : function (f){this.flag ? f() : this.q.unshift(f)},
	execute : function (flag){var f; var undefined; while (f = this.q.shift()) f(); if (flag == undefined) flag=true; this.flag = flag ? true : false},	
	flush : function (flag){this.q.length = 0; this.flag = flag ? true: false}
}


adriver.Plugin = function (id){
	if(this instanceof adriver.Plugin){
		if(id && !adriver.plugins[id]){
			this.id = id;
			this.q = new adriver.queue();
			this.loadingStatus = 0;
			adriver.plugins[id] = this;
			return this;
		}
	}
	return adriver.plugins[id];
}

adriver.Plugin.prototype = {
	load: function (){
		this.loadingStatus = 1; 
		var suffix = this.id.substr(this.id.lastIndexOf('.')+1);
		var pluginPath = adriver.pluginPath[suffix] || adriver.defaultMirror + "/plugins/";
		adriver.loadScript(pluginPath + this.id + ".js");
	},
	loadComplete: function (){ this.loadingStatus = 2; this.q.execute(); return this },
	onLoadComplete: function (f){ this.q.push(f); return this }
}


adriver.Plugin.require = function(){ 
	var me = this, counter = 0; 
	this.q = new adriver.queue();
	
	for (var i = 0, len = arguments.length; i < len; i ++){
		var p = new adriver.Plugin(arguments[i]); 
		if (p.loadingStatus != 2){
			counter++;
			p.onLoadComplete(function (){if(counter-- == 1) {me.q.execute()}});
			if (!p.loadingStatus) p.load();
		}
	}
	if(!counter) {this.q.execute()}
}

adriver.Plugin.require.prototype.onLoadComplete = function (f){this.q.push(f); return this}


adriver.start = function (){
	adriver.version = "2.0";
	adriver.items = {};
	adriver.defaults = {tail256: (document.referrer ? escape(document.referrer) : 'unknown')};
	adriver.options = {};
	adriver.plugins = {};
	adriver.pluginPath = {};
	adriver.redirectHost = "http://ad.adriver.ru";
	adriver.defaultMirror = "http://content.adriver.ru";
	adriver.isDomReady = false;
	adriver.domReadyQueue = new adriver.queue();

	adriver.checkDomReady(adriver.domReady); 
}


adriver.checkDomReady = function(f){
	try {
		var d = document, oldOnload = window.onload;
		if (/WebKit/i.test(navigator.userAgent)) {(function(){/loaded|complete/.test(d.readyState) ? f() : setTimeout (arguments.callee, 100)})()} 
		else if (d.addEventListener) {d.addEventListener("DOMContentLoaded", f, false)} 
		else if (d.all && !window.opera){
			document.write("<script id=__onDOMContentLoaded defer src=//:><\/script>");
			document.getElementById("__onDOMContentLoaded").onreadystatechange = function(){if (this.readyState == "complete" ) { f() }}
		}
		window.onload = function(){if(oldOnload) oldOnload(); f()}
	} catch (e){}
}


adriver.start();
/**
* adriver end
*/

 /* adriver_gen.js */ 
/**
* adriver
*/

    var manageCookie = function(name, value, options) {
        if (typeof value != 'undefined') { // name and value given, set cookie
            options = options || {};
            if (value === null) {
                value = '';
                options.expires = -1;
            }
            var expires = '';
            if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) {
                var date;
                if (typeof options.expires == 'number') {
                    date = new Date();
                    date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000));
                } else {
                    date = options.expires;
                }
                expires = '; expires=' + date.toUTCString(); // use expires attribute, max-age is not supported by IE
            }
            // CAUTION: Needed to parenthesize options.path and options.domain
            // in the following expressions, otherwise they evaluate to undefined
            // in the packed version for some reason...
            var path = options.path ? '; path=' + (options.path) : '';
            var domain = options.domain ? '; domain=' + (options.domain) : '';
            var secure = options.secure ? '; secure' : '';
            document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join('');
        } else { // only name given, get cookie
            var cookieValue = null;
            if (document.cookie && document.cookie != '') {
                var cookies = document.cookie.split(';');
                for (var i = 0; i < cookies.length; i++) {
                    var cookie = cookies[i].replace( /^\s+|\s+$/g, "" );
                    // Does this cookie string begin with the name we want?
                    if (cookie.substring(0, name.length + 1) == (name + '=')) {
                        cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
                        break;
                    }
                }
            }
            return cookieValue;
        }
    };

    var genAdRiverValues = function () {
        var adRiverCookieName = 'adRiverGenValues';
        var cookieVal = manageCookie(adRiverCookieName);
        
        var cookieDomain = 'tochka.net';
        var cookiePath = '/';

        var secondParts = new Array('s1', 's2', 's3','s4');
        var date = new Date();
        var today = date.getUTCMonth().toString() + date.getUTCDate().toString();

        var firstPart = '';
        if(typeof cookieVal == 'string') {
            var split = cookieVal.split(/,/);

            var dayNMonthUTC = split[0];

            //start page visit count all over again if the cookie wasn't set today
            if(dayNMonthUTC == today) {
                firstPart = split[1];
            }
        }

        var newVal = '';
        switch(firstPart) {
            case 'p1':
                newVal = 'p2';
                break;

            case 'p2':
                newVal = 'p3';
                break;

            case 'p3':
            case 'p4':
                newVal = 'p4';
                break;

            default:
                newVal = 'p1';
        }

        var randIdx = Math.floor(Math.random() * 4);
        var secPart = secondParts[randIdx];

        var returnVal = newVal + ', ' + secPart;
        cookieVal = today + ',' + returnVal;
        manageCookie(adRiverCookieName, cookieVal, {expires: 0, path: cookiePath, domain: cookieDomain});

        return returnVal;
    }

    //prevent function from accidentaly executing more than once per page view
    if(!adRiverValsAlreadyGenerated) {
        var ar_bn1 = genAdRiverValues();
        var adRiverValsAlreadyGenerated = true;
    }
	
	
 /* passwordStrengthMeter.js */ 
// Password strength meter
// This jQuery plugin is written by Firas Kassem [2007.04.05] and modified by Amin Rajaee [2009.07.26]
// Firas Kassem  phiras.wordpress.com || phiras at gmail {dot} com
// Amin Rajaee  rajaee at gmail (dot) com
// for more information : http://phiras.wordpress.com/2007/04/08/password-strength-meter-a-jquery-plugin/
// modified by Aleksandro.


var PasswordStrengthMeter = {};

PasswordStrengthMeter.shortPass      = 'Too Short Password';
PasswordStrengthMeter.badPass        = 'Week; Use letters & numbers';
PasswordStrengthMeter.goodPass       = 'Medium; Use special charecters';
PasswordStrengthMeter.strongPass     = 'Strong Password';
PasswordStrengthMeter.sameAsUsername = 'Password is the same as username.';
PasswordStrengthMeter.score = 0;

PasswordStrengthMeter.passwordStrength = function(password,username) {
    PasswordStrengthMeter.score = 0 
    
    //password < 6
    if (password.length < 6 ) { return PasswordStrengthMeter.shortPass }
    
    //password == username
    if (password.toLowerCase() == username.toLowerCase()) return PasswordStrengthMeter.sameAsUsername
    
    //password length
    PasswordStrengthMeter.score += password.length * 2
    PasswordStrengthMeter.score += ( PasswordStrengthMeter.checkRepetition(1,password).length - password.length ) * 1
    PasswordStrengthMeter.score += ( PasswordStrengthMeter.checkRepetition(2,password).length - password.length ) * 1
    PasswordStrengthMeter.score += ( PasswordStrengthMeter.checkRepetition(3,password).length - password.length ) * 1
    PasswordStrengthMeter.score += ( PasswordStrengthMeter.checkRepetition(4,password).length - password.length ) * 1

    //password has 3 numbers
    if (password.match(/(.*[0-9].*[0-9].*[0-9])/))  PasswordStrengthMeter.score += 5 
    
    //password has 2 sybols
    if (password.match(/(.*[!,@,#,$,%,^,&,*,?,_,~].*[!,@,#,$,%,^,&,*,?,_,~])/)) PasswordStrengthMeter.score += 5 
    
    //password has Upper and Lower chars
    if (password.match(/([a-z].*[A-Z])|([A-Z].*[a-z])/))  PasswordStrengthMeter.score += 10 
    
    //password has number and chars
    if (password.match(/([a-zA-Z])/) && password.match(/([0-9])/))  PasswordStrengthMeter.score += 15 
    //
    //password has number and symbol
    if (password.match(/([!,@,#,$,%,^,&,*,?,_,~])/) && password.match(/([0-9])/))  PasswordStrengthMeter.score += 15 
    
    //password has char and symbol
    if (password.match(/([!,@,#,$,%,^,&,*,?,_,~])/) && password.match(/([a-zA-Z])/))  PasswordStrengthMeter.score += 15 
    
    //password is just a nubers or chars
    if (password.match(/^\w+$/) || password.match(/^\d+$/) )  PasswordStrengthMeter.score -= 10 
    
    //verifing 0 < PasswordStrengthMeter.score < 100
    if (PasswordStrengthMeter.score < 0)  PasswordStrengthMeter.score = 0; 
    if (PasswordStrengthMeter.score > 100)  PasswordStrengthMeter.score = 100; 
    
    if (PasswordStrengthMeter.score < 60)  return PasswordStrengthMeter.badPass;
    if (PasswordStrengthMeter.score < 75)  return PasswordStrengthMeter.goodPass;
    
    return PasswordStrengthMeter.strongPass;
};


PasswordStrengthMeter.passwordStrengthPercent = function(password,username) {
    PasswordStrengthMeter.score = 0 
    
    //password < 4
    if (password.length < 4 ) { return 0 }
    
    //password == username
    if (password.toLowerCase()==username.toLowerCase()) return 0
    
    //password length
    PasswordStrengthMeter.score += password.length * 4
    PasswordStrengthMeter.score += ( PasswordStrengthMeter.checkRepetition(1,password).length - password.length ) * 1
    PasswordStrengthMeter.score += ( PasswordStrengthMeter.checkRepetition(2,password).length - password.length ) * 1
    PasswordStrengthMeter.score += ( PasswordStrengthMeter.checkRepetition(3,password).length - password.length ) * 1
    PasswordStrengthMeter.score += ( PasswordStrengthMeter.checkRepetition(4,password).length - password.length ) * 1

    //password has 3 numbers
    if (password.match(/(.*[0-9].*[0-9].*[0-9])/))  PasswordStrengthMeter.score += 5 
    
    //password has 2 sybols
    if (password.match(/(.*[!,@,#,$,%,^,&,*,?,_,~].*[!,@,#,$,%,^,&,*,?,_,~])/)) PasswordStrengthMeter.score += 5 
    
    //password has Upper and Lower chars
    if (password.match(/([a-z].*[A-Z])|([A-Z].*[a-z])/))  PasswordStrengthMeter.score += 10 
    
    //password has number and chars
    if (password.match(/([a-zA-Z])/) && password.match(/([0-9])/))  PasswordStrengthMeter.score += 15 
    //
    //password has number and symbol
    if (password.match(/([!,@,#,$,%,^,&,*,?,_,~])/) && password.match(/([0-9])/))  PasswordStrengthMeter.score += 15 
    
    //password has char and symbol
    if (password.match(/([!,@,#,$,%,^,&,*,?,_,~])/) && password.match(/([a-zA-Z])/))  PasswordStrengthMeter.score += 15 
    
    //password is just a nubers or chars
    if (password.match(/^\w+$/) || password.match(/^\d+$/) )  PasswordStrengthMeter.score -= 10 
    if (PasswordStrengthMeter.score > 100) return 100
  
    return (PasswordStrengthMeter.score)
 
};


PasswordStrengthMeter.checkRepetition = function (pLen,str) {
    res = ""
    for ( i=0; i<str.length ; i++ ) {
        repeated=true
        for (j=0;j < pLen && (j+i+pLen) < str.length;j++)
            repeated=repeated && (str.charAt(j+i)==str.charAt(j+i+pLen))
        if (j<pLen) repeated=false
        if (repeated) {
            i+=pLen-1
            repeated=false
        }
        else {
            res+=str.charAt(i)
        }
    }
    return res
};
 /* jquery.json-2.2.min.js */ 

(function($){$.toJSON=function(o)
{if(typeof(JSON)=='object'&&JSON.stringify)
return JSON.stringify(o);var type=typeof(o);if(o===null)
return"null";if(type=="undefined")
return undefined;if(type=="number"||type=="boolean")
return o+"";if(type=="string")
return $.quoteString(o);if(type=='object')
{if(typeof o.toJSON=="function")
return $.toJSON(o.toJSON());if(o.constructor===Date)
{var month=o.getUTCMonth()+1;if(month<10)month='0'+month;var day=o.getUTCDate();if(day<10)day='0'+day;var year=o.getUTCFullYear();var hours=o.getUTCHours();if(hours<10)hours='0'+hours;var minutes=o.getUTCMinutes();if(minutes<10)minutes='0'+minutes;var seconds=o.getUTCSeconds();if(seconds<10)seconds='0'+seconds;var milli=o.getUTCMilliseconds();if(milli<100)milli='0'+milli;if(milli<10)milli='0'+milli;return'"'+year+'-'+month+'-'+day+'T'+
hours+':'+minutes+':'+seconds+'.'+milli+'Z"';}
if(o.constructor===Array)
{var ret=[];for(var i=0;i<o.length;i++)
ret.push($.toJSON(o[i])||"null");return"["+ret.join(",")+"]";}
var pairs=[];for(var k in o){var name;var type=typeof k;if(type=="number")
name='"'+k+'"';else if(type=="string")
name=$.quoteString(k);else
continue;if(typeof o[k]=="function")
continue;var val=$.toJSON(o[k]);pairs.push(name+":"+val);}
return"{"+pairs.join(", ")+"}";}};$.evalJSON=function(src)
{if(typeof(JSON)=='object'&&JSON.parse)
return JSON.parse(src);return eval("("+src+")");};$.secureEvalJSON=function(src)
{if(typeof(JSON)=='object'&&JSON.parse)
return JSON.parse(src);var filtered=src;filtered=filtered.replace(/\\["\\\/bfnrtu]/g,'@');filtered=filtered.replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,']');filtered=filtered.replace(/(?:^|:|,)(?:\s*\[)+/g,'');if(/^[\],:{}\s]*$/.test(filtered))
return eval("("+src+")");else
throw new SyntaxError("Error parsing JSON, source is not valid.");};$.quoteString=function(string)
{if(string.match(_escapeable))
{return'"'+string.replace(_escapeable,function(a)
{var c=_meta[a];if(typeof c==='string')return c;c=a.charCodeAt();return'\\u00'+Math.floor(c/16).toString(16)+(c%16).toString(16);})+'"';}
return'"'+string+'"';};var _escapeable=/["\\\x00-\x1f\x7f-\x9f]/g;var _meta={'\b':'\\b','\t':'\\t','\n':'\\n','\f':'\\f','\r':'\\r','"':'\\"','\\':'\\\\'};})(jQuery);
 /* ToolBarV3.js */ 
/*

http://digital-ventures.net

developer by Kazakov Aleksey 
a.kazakov@digital-ventures.net

*/

$(document).ready(function(){
	//class
	ToolBar = {
		setUlWidth: function(){
			var ua = navigator.userAgent;
			var isiPad = /iPad/i.test(ua) || /iPhone OS 3_1_2/i.test(ua) || /iPhone OS 3_2_2/i.test(ua) || /iPod/i.test(ua) || /iPhone/i.test(ua);
			if(isiPad==true){ $('html').addClass('ipad');}

			var w = s = 0;
			$('#ListServices>li>ul').each(function(){ 
				var ulWidth = this.offsetWidth;
				var liParentWidth = this.parentNode.offsetWidth;
				
				if($(this).find('ul').size()>1){
					$(this).find('ul').each(function(){ 
						if($.browser.msie&&$.browser.version == 7.0){ s = 62;} /*FIX IE*/
						ulWidth = w += this.offsetWidth+s;
					});
				}
				if(ulWidth<liParentWidth){ 
					this.style.width = (liParentWidth-24)+'px';
				}else{
					this.style.width = ulWidth+'px';
				}
				
			});
		},
		setScrollControl: function(obj){
			var ToolBarV3 = $('#ToolBarV3');
			if($(obj).scrollTop()>0){
				ToolBarV3.addClass('ScrollToolBar');
			}else{
				ToolBarV3.removeClass('ScrollToolBar');
			}
		}
	};
	ToolBar.setUlWidth();
	
	//events
	/*$('#ListServices>li').live('mouseover',function(){
		$(this).find('>ul').css('visibility','visible');
	}).live('mouseout',function(){
		$(this).find('>ul').css('visibility','hidden');
	});*/
	$(window).scroll(function(){ 
		ToolBar.setScrollControl(this);
	});
});

 /* conferences.js */ 
$(document).ready(function(){
    var objForChange = $('div.content p, div.content h3'),
		objExample = $('body'),
		originalFontSize = objExample.css('font-size'),
		originalFontSizeNum = parseFloat(originalFontSize, 10)*1.2,
		currentFont = originalFontSizeNum;

	//	Reset Font Size
	$("#resetFont").click(function(){
		currentFont = originalFontSizeNum;
		objForChange.css('font-size', currentFont);
		return false;
	});

	//	Increase Font Size
	$("#increaseFont").click(function(){
		currentFont++;
		objForChange.css('font-size', currentFont);
		return false;
	});

	//	Decrease Font Size
	$("#decreaseFont").click(function(){
		if (currentFont > 1){
			currentFont = currentFont ? currentFont - 1 : originalFontSizeNum - 1;
		}
		objForChange.css('font-size', currentFont);
		return false;
	});
});
var make_question = 0;
var redirect_link;
    function not_logged_in(obj) {
        callAuthForm();
        make_question = 1;
        redirect_link = obj.href;
        return false;
    }
 /* jquery.form.js */ 
/*!
 * jQuery Form Plugin
 * version: 2.84 (12-AUG-2011)
 * @requires jQuery v1.3.2 or later
 *
 * Examples and documentation at: http://malsup.com/jquery/form/
 * Dual licensed under the MIT and GPL licenses:
 *   http://www.opensource.org/licenses/mit-license.php
 *   http://www.gnu.org/licenses/gpl.html
 */
;(function($) {

/*
	Usage Note:
	-----------
	Do not use both ajaxSubmit and ajaxForm on the same form.  These
	functions are intended to be exclusive.  Use ajaxSubmit if you want
	to bind your own submit handler to the form.  For example,

	$(document).ready(function() {
		$('#myForm').bind('submit', function(e) {
			e.preventDefault(); // <-- important
			$(this).ajaxSubmit({
				target: '#output'
			});
		});
	});

	Use ajaxForm when you want the plugin to manage all the event binding
	for you.  For example,

	$(document).ready(function() {
		$('#myForm').ajaxForm({
			target: '#output'
		});
	});

	When using ajaxForm, the ajaxSubmit function will be invoked for you
	at the appropriate time.
*/

/**
 * ajaxSubmit() provides a mechanism for immediately submitting
 * an HTML form using AJAX.
 */
$.fn.ajaxSubmit = function(options) {
	// fast fail if nothing selected (http://dev.jquery.com/ticket/2752)
	if (!this.length) {
		log('ajaxSubmit: skipping submit process - no element selected');
		return this;
	}
	
	var method, action, url, $form = this;

	if (typeof options == 'function') {
		options = { success: options };
	}

	method = this.attr('method');
	action = this.attr('action');
	url = (typeof action === 'string') ? $.trim(action) : '';
	url = url || window.location.href || '';
	if (url) {
		// clean url (don't include hash vaue)
		url = (url.match(/^([^#]+)/)||[])[1];
	}

	options = $.extend(true, {
		url:  url,
		success: $.ajaxSettings.success,
		type: method || 'GET',
		iframeSrc: /^https/i.test(window.location.href || '') ? 'javascript:false' : 'about:blank'
	}, options);

	// hook for manipulating the form data before it is extracted;
	// convenient for use with rich editors like tinyMCE or FCKEditor
	var veto = {};
	this.trigger('form-pre-serialize', [this, options, veto]);
	if (veto.veto) {
		log('ajaxSubmit: submit vetoed via form-pre-serialize trigger');
		return this;
	}

	// provide opportunity to alter form data before it is serialized
	if (options.beforeSerialize && options.beforeSerialize(this, options) === false) {
		log('ajaxSubmit: submit aborted via beforeSerialize callback');
		return this;
	}

	var n,v,a = this.formToArray(options.semantic);
	if (options.data) {
		options.extraData = options.data;
		for (n in options.data) {
			if( $.isArray(options.data[n]) ) {
				for (var k in options.data[n]) {
					a.push( { name: n, value: options.data[n][k] } );
				}
			}
			else {
				v = options.data[n];
				v = $.isFunction(v) ? v() : v; // if value is fn, invoke it
				a.push( { name: n, value: v } );
			}
		}
	}

	// give pre-submit callback an opportunity to abort the submit
	if (options.beforeSubmit && options.beforeSubmit(a, this, options) === false) {
		log('ajaxSubmit: submit aborted via beforeSubmit callback');
		return this;
	}

	// fire vetoable 'validate' event
	this.trigger('form-submit-validate', [a, this, options, veto]);
	if (veto.veto) {
		log('ajaxSubmit: submit vetoed via form-submit-validate trigger');
		return this;
	}

	var q = $.param(a);

	if (options.type.toUpperCase() == 'GET') {
		options.url += (options.url.indexOf('?') >= 0 ? '&' : '?') + q;
		options.data = null;  // data is null for 'get'
	}
	else {
		options.data = q; // data is the query string for 'post'
	}

	var callbacks = [];
	if (options.resetForm) {
		callbacks.push(function() { $form.resetForm(); });
	}
	if (options.clearForm) {
		callbacks.push(function() { $form.clearForm(); });
	}

	// perform a load on the target only if dataType is not provided
	if (!options.dataType && options.target) {
		var oldSuccess = options.success || function(){};
		callbacks.push(function(data) {
			var fn = options.replaceTarget ? 'replaceWith' : 'html';
			$(options.target)[fn](data).each(oldSuccess, arguments);
		});
	}
	else if (options.success) {
		callbacks.push(options.success);
	}

	options.success = function(data, status, xhr) { // jQuery 1.4+ passes xhr as 3rd arg
		var context = options.context || options;   // jQuery 1.4+ supports scope context 
		for (var i=0, max=callbacks.length; i < max; i++) {
			callbacks[i].apply(context, [data, status, xhr || $form, $form]);
		}
	};

	// are there files to upload?
	var fileInputs = $('input:file', this).length > 0;
	var mp = 'multipart/form-data';
	var multipart = ($form.attr('enctype') == mp || $form.attr('encoding') == mp);

	// options.iframe allows user to force iframe mode
	// 06-NOV-09: now defaulting to iframe mode if file input is detected
   if (options.iframe !== false && (fileInputs || options.iframe || multipart)) {
	   // hack to fix Safari hang (thanks to Tim Molendijk for this)
	   // see:  http://groups.google.com/group/jquery-dev/browse_thread/thread/36395b7ab510dd5d
	   if (options.closeKeepAlive) {
		   $.get(options.closeKeepAlive, function() { fileUpload(a); });
		}
	   else {
		   fileUpload(a);
		}
   }
   else {
		// IE7 massage (see issue 57)
		if ($.browser.msie && method == 'get') { 
			var ieMeth = $form[0].getAttribute('method');
			if (typeof ieMeth === 'string')
				options.type = ieMeth;
		}
		$.ajax(options);
   }

	// fire 'notify' event
	this.trigger('form-submit-notify', [this, options]);
	return this;


	// private function for handling file uploads (hat tip to YAHOO!)
	function fileUpload(a) {
		var form = $form[0], el, i, s, g, id, $io, io, xhr, sub, n, timedOut, timeoutHandle;
        var useProp = !!$.fn.prop;

        if (a) {
        	// ensure that every serialized input is still enabled
          	for (i=0; i < a.length; i++) {
                el = $(form[a[i].name]);
                el[ useProp ? 'prop' : 'attr' ]('disabled', false);
          	}
        }

		if ($(':input[name=submit],:input[id=submit]', form).length) {
			// if there is an input with a name or id of 'submit' then we won't be
			// able to invoke the submit fn on the form (at least not x-browser)
			alert('Error: Form elements must not have name or id of "submit".');
			return;
		}
		
		s = $.extend(true, {}, $.ajaxSettings, options);
		s.context = s.context || s;
		id = 'jqFormIO' + (new Date().getTime());
		if (s.iframeTarget) {
			$io = $(s.iframeTarget);
			n = $io.attr('name');
			if (n == null)
			 	$io.attr('name', id);
			else
				id = n;
		}
		else {
			$io = $('<iframe name="' + id + '" src="'+ s.iframeSrc +'" />');
			$io.css({ position: 'absolute', top: '-1000px', left: '-1000px' });
		}
		io = $io[0];


		xhr = { // mock object
			aborted: 0,
			responseText: null,
			responseXML: null,
			status: 0,
			statusText: 'n/a',
			getAllResponseHeaders: function() {},
			getResponseHeader: function() {},
			setRequestHeader: function() {},
			abort: function(status) {
				var e = (status === 'timeout' ? 'timeout' : 'aborted');
				log('aborting upload... ' + e);
				this.aborted = 1;
				$io.attr('src', s.iframeSrc); // abort op in progress
				xhr.error = e;
				s.error && s.error.call(s.context, xhr, e, status);
				g && $.event.trigger("ajaxError", [xhr, s, e]);
				s.complete && s.complete.call(s.context, xhr, e);
			}
		};

		g = s.global;
		// trigger ajax global events so that activity/block indicators work like normal
		if (g && ! $.active++) {
			$.event.trigger("ajaxStart");
		}
		if (g) {
			$.event.trigger("ajaxSend", [xhr, s]);
		}

		if (s.beforeSend && s.beforeSend.call(s.context, xhr, s) === false) {
			if (s.global) {
				$.active--;
			}
			return;
		}
		if (xhr.aborted) {
			return;
		}

		// add submitting element to data if we know it
		sub = form.clk;
		if (sub) {
			n = sub.name;
			if (n && !sub.disabled) {
				s.extraData = s.extraData || {};
				s.extraData[n] = sub.value;
				if (sub.type == "image") {
					s.extraData[n+'.x'] = form.clk_x;
					s.extraData[n+'.y'] = form.clk_y;
				}
			}
		}
		
		var CLIENT_TIMEOUT_ABORT = 1;
		var SERVER_ABORT = 2;

		function getDoc(frame) {
			var doc = frame.contentWindow ? frame.contentWindow.document : frame.contentDocument ? frame.contentDocument : frame.document;
			return doc;
		}
		
		// take a breath so that pending repaints get some cpu time before the upload starts
		function doSubmit() {
			// make sure form attrs are set
			var t = $form.attr('target'), a = $form.attr('action');

			// update form attrs in IE friendly way
			form.setAttribute('target',id);
			if (!method) {
				form.setAttribute('method', 'POST');
			}
			if (a != s.url) {
				form.setAttribute('action', s.url);
			}

			// ie borks in some cases when setting encoding
			if (! s.skipEncodingOverride && (!method || /post/i.test(method))) {
				$form.attr({
					encoding: 'multipart/form-data',
					enctype:  'multipart/form-data'
				});
			}

			// support timout
			if (s.timeout) {
				timeoutHandle = setTimeout(function() { timedOut = true; cb(CLIENT_TIMEOUT_ABORT); }, s.timeout);
			}
			
			// look for server aborts
			function checkState() {
				try {
					var state = getDoc(io).readyState;
					log('state = ' + state);
					if (state.toLowerCase() == 'uninitialized')
						setTimeout(checkState,50);
				}
				catch(e) {
					log('Server abort: ' , e, ' (', e.name, ')');
					cb(SERVER_ABORT);
					timeoutHandle && clearTimeout(timeoutHandle);
					timeoutHandle = undefined;
				}
			}

			// add "extra" data to form if provided in options
			var extraInputs = [];
			try {
				if (s.extraData) {
					for (var n in s.extraData) {
						extraInputs.push(
							$('<input type="hidden" name="'+n+'" />').attr('value',s.extraData[n])
								.appendTo(form)[0]);
					}
				}

				if (!s.iframeTarget) {
					// add iframe to doc and submit the form
					$io.appendTo('body');
	                io.attachEvent ? io.attachEvent('onload', cb) : io.addEventListener('load', cb, false);
				}
				setTimeout(checkState,15);
				form.submit();
			}
			finally {
				// reset attrs and remove "extra" input elements
				form.setAttribute('action',a);
				if(t) {
					form.setAttribute('target', t);
				} else {
					$form.removeAttr('target');
				}
				$(extraInputs).remove();
			}
		}

		if (s.forceSync) {
			doSubmit();
		}
		else {
			setTimeout(doSubmit, 10); // this lets dom updates render
		}

		var data, doc, domCheckCount = 50, callbackProcessed;

		function cb(e) {
			if (xhr.aborted || callbackProcessed) {
				return;
			}
			try {
				doc = getDoc(io);
			}
			catch(ex) {
				log('cannot access response document: ', ex);
				e = SERVER_ABORT;
			}
			if (e === CLIENT_TIMEOUT_ABORT && xhr) {
				xhr.abort('timeout');
				return;
			}
			else if (e == SERVER_ABORT && xhr) {
				xhr.abort('server abort');
				return;
			}

			if (!doc || doc.location.href == s.iframeSrc) {
				// response not received yet
				if (!timedOut)
					return;
			}
            io.detachEvent ? io.detachEvent('onload', cb) : io.removeEventListener('load', cb, false);

			var status = 'success', errMsg;
			try {
				if (timedOut) {
					throw 'timeout';
				}

				var isXml = s.dataType == 'xml' || doc.XMLDocument || $.isXMLDoc(doc);
				log('isXml='+isXml);
				if (!isXml && window.opera && (doc.body == null || doc.body.innerHTML == '')) {
					if (--domCheckCount) {
						// in some browsers (Opera) the iframe DOM is not always traversable when
						// the onload callback fires, so we loop a bit to accommodate
						log('requeing onLoad callback, DOM not available');
						setTimeout(cb, 250);
						return;
					}
					// let this fall through because server response could be an empty document
					//log('Could not access iframe DOM after mutiple tries.');
					//throw 'DOMException: not available';
				}

				//log('response detected');
                var docRoot = doc.body ? doc.body : doc.documentElement;
                xhr.responseText = docRoot ? docRoot.innerHTML : null;
				xhr.responseXML = doc.XMLDocument ? doc.XMLDocument : doc;
				if (isXml)
					s.dataType = 'xml';
				xhr.getResponseHeader = function(header){
					var headers = {'content-type': s.dataType};
					return headers[header];
				};
                // support for XHR 'status' & 'statusText' emulation :
                if (docRoot) {
                    xhr.status = Number( docRoot.getAttribute('status') ) || xhr.status;
                    xhr.statusText = docRoot.getAttribute('statusText') || xhr.statusText;
                }

				var dt = s.dataType || '';
				var scr = /(json|script|text)/.test(dt.toLowerCase());
				if (scr || s.textarea) {
					// see if user embedded response in textarea
					var ta = doc.getElementsByTagName('textarea')[0];
					if (ta) {
						xhr.responseText = ta.value;
                        // support for XHR 'status' & 'statusText' emulation :
                        xhr.status = Number( ta.getAttribute('status') ) || xhr.status;
                        xhr.statusText = ta.getAttribute('statusText') || xhr.statusText;
					}
					else if (scr) {
						// account for browsers injecting pre around json response
						var pre = doc.getElementsByTagName('pre')[0];
						var b = doc.getElementsByTagName('body')[0];
						if (pre) {
							xhr.responseText = pre.textContent ? pre.textContent : pre.innerHTML;
						}
						else if (b) {
							xhr.responseText = b.innerHTML;
						}
					}
				}
				else if (s.dataType == 'xml' && !xhr.responseXML && xhr.responseText != null) {
					xhr.responseXML = toXml(xhr.responseText);
				}

                try {
                    data = httpData(xhr, s.dataType, s);
                }
                catch (e) {
                    status = 'parsererror';
                    xhr.error = errMsg = (e || status);
                }
			}
			catch (e) {
				log('error caught: ',e);
				status = 'error';
                xhr.error = errMsg = (e || status);
			}

			if (xhr.aborted) {
				log('upload aborted');
				status = null;
			}

            if (xhr.status) { // we've set xhr.status
                status = (xhr.status >= 200 && xhr.status < 300 || xhr.status === 304) ? 'success' : 'error';
            }

			// ordering of these callbacks/triggers is odd, but that's how $.ajax does it
			if (status === 'success') {
				s.success && s.success.call(s.context, data, 'success', xhr);
				g && $.event.trigger("ajaxSuccess", [xhr, s]);
			}
            else if (status) {
				if (errMsg == undefined)
					errMsg = xhr.statusText;
				s.error && s.error.call(s.context, xhr, status, errMsg);
				g && $.event.trigger("ajaxError", [xhr, s, errMsg]);
            }

			g && $.event.trigger("ajaxComplete", [xhr, s]);

			if (g && ! --$.active) {
				$.event.trigger("ajaxStop");
			}

			s.complete && s.complete.call(s.context, xhr, status);

			callbackProcessed = true;
			if (s.timeout)
				clearTimeout(timeoutHandle);

			// clean up
			setTimeout(function() {
				if (!s.iframeTarget)
					$io.remove();
				xhr.responseXML = null;
			}, 100);
		}

		var toXml = $.parseXML || function(s, doc) { // use parseXML if available (jQuery 1.5+)
			if (window.ActiveXObject) {
				doc = new ActiveXObject('Microsoft.XMLDOM');
				doc.async = 'false';
				doc.loadXML(s);
			}
			else {
				doc = (new DOMParser()).parseFromString(s, 'text/xml');
			}
			return (doc && doc.documentElement && doc.documentElement.nodeName != 'parsererror') ? doc : null;
		};
		var parseJSON = $.parseJSON || function(s) {
			return window['eval']('(' + s + ')');
		};

		var httpData = function( xhr, type, s ) { // mostly lifted from jq1.4.4

			var ct = xhr.getResponseHeader('content-type') || '',
				xml = type === 'xml' || !type && ct.indexOf('xml') >= 0,
				data = xml ? xhr.responseXML : xhr.responseText;

			if (xml && data.documentElement.nodeName === 'parsererror') {
				$.error && $.error('parsererror');
			}
			if (s && s.dataFilter) {
				data = s.dataFilter(data, type);
			}
			if (typeof data === 'string') {
				if (type === 'json' || !type && ct.indexOf('json') >= 0) {
					data = parseJSON(data);
				} else if (type === "script" || !type && ct.indexOf("javascript") >= 0) {
					$.globalEval(data);
				}
			}
			return data;
		};
	}
};

/**
 * ajaxForm() provides a mechanism for fully automating form submission.
 *
 * The advantages of using this method instead of ajaxSubmit() are:
 *
 * 1: This method will include coordinates for <input type="image" /> elements (if the element
 *	is used to submit the form).
 * 2. This method will include the submit element's name/value data (for the element that was
 *	used to submit the form).
 * 3. This method binds the submit() method to the form for you.
 *
 * The options argument for ajaxForm works exactly as it does for ajaxSubmit.  ajaxForm merely
 * passes the options argument along after properly binding events for submit elements and
 * the form itself.
 */
$.fn.ajaxForm = function(options) {
	// in jQuery 1.3+ we can fix mistakes with the ready state
	if (this.length === 0) {
		var o = { s: this.selector, c: this.context };
		if (!$.isReady && o.s) {
			log('DOM not ready, queuing ajaxForm');
			$(function() {
				$(o.s,o.c).ajaxForm(options);
			});
			return this;
		}
		// is your DOM ready?  http://docs.jquery.com/Tutorials:Introducing_$(document).ready()
		log('terminating; zero elements found by selector' + ($.isReady ? '' : ' (DOM not ready)'));
		return this;
	}

	return this.ajaxFormUnbind().bind('submit.form-plugin', function(e) {
		if (!e.isDefaultPrevented()) { // if event has been canceled, don't proceed
			e.preventDefault();
			$(this).ajaxSubmit(options);
		}
	}).bind('click.form-plugin', function(e) {
		var target = e.target;
		var $el = $(target);
		if (!($el.is(":submit,input:image"))) {
			// is this a child element of the submit el?  (ex: a span within a button)
			var t = $el.closest(':submit');
			if (t.length == 0) {
				return;
			}
			target = t[0];
		}
		var form = this;
		form.clk = target;
		if (target.type == 'image') {
			if (e.offsetX != undefined) {
				form.clk_x = e.offsetX;
				form.clk_y = e.offsetY;
			} else if (typeof $.fn.offset == 'function') { // try to use dimensions plugin
				var offset = $el.offset();
				form.clk_x = e.pageX - offset.left;
				form.clk_y = e.pageY - offset.top;
			} else {
				form.clk_x = e.pageX - target.offsetLeft;
				form.clk_y = e.pageY - target.offsetTop;
			}
		}
		// clear form vars
		setTimeout(function() { form.clk = form.clk_x = form.clk_y = null; }, 100);
	});
};

// ajaxFormUnbind unbinds the event handlers that were bound by ajaxForm
$.fn.ajaxFormUnbind = function() {
	return this.unbind('submit.form-plugin click.form-plugin');
};

/**
 * formToArray() gathers form element data into an array of objects that can
 * be passed to any of the following ajax functions: $.get, $.post, or load.
 * Each object in the array has both a 'name' and 'value' property.  An example of
 * an array for a simple login form might be:
 *
 * [ { name: 'username', value: 'jresig' }, { name: 'password', value: 'secret' } ]
 *
 * It is this array that is passed to pre-submit callback functions provided to the
 * ajaxSubmit() and ajaxForm() methods.
 */
$.fn.formToArray = function(semantic) {
	var a = [];
	if (this.length === 0) {
		return a;
	}

	var form = this[0];
	var els = semantic ? form.getElementsByTagName('*') : form.elements;
	if (!els) {
		return a;
	}

	var i,j,n,v,el,max,jmax;
	for(i=0, max=els.length; i < max; i++) {
		el = els[i];
		n = el.name;
		if (!n) {
			continue;
		}

		if (semantic && form.clk && el.type == "image") {
			// handle image inputs on the fly when semantic == true
			if(!el.disabled && form.clk == el) {
				a.push({name: n, value: $(el).val()});
				a.push({name: n+'.x', value: form.clk_x}, {name: n+'.y', value: form.clk_y});
			}
			continue;
		}

		v = $.fieldValue(el, true);
		if (v && v.constructor == Array) {
			for(j=0, jmax=v.length; j < jmax; j++) {
				a.push({name: n, value: v[j]});
			}
		}
		else if (v !== null && typeof v != 'undefined') {
			a.push({name: n, value: v});
		}
	}

	if (!semantic && form.clk) {
		// input type=='image' are not found in elements array! handle it here
		var $input = $(form.clk), input = $input[0];
		n = input.name;
		if (n && !input.disabled && input.type == 'image') {
			a.push({name: n, value: $input.val()});
			a.push({name: n+'.x', value: form.clk_x}, {name: n+'.y', value: form.clk_y});
		}
	}
	return a;
};

/**
 * Serializes form data into a 'submittable' string. This method will return a string
 * in the format: name1=value1&amp;name2=value2
 */
$.fn.formSerialize = function(semantic) {
	//hand off to jQuery.param for proper encoding
	return $.param(this.formToArray(semantic));
};

/**
 * Serializes all field elements in the jQuery object into a query string.
 * This method will return a string in the format: name1=value1&amp;name2=value2
 */
$.fn.fieldSerialize = function(successful) {
	var a = [];
	this.each(function() {
		var n = this.name;
		if (!n) {
			return;
		}
		var v = $.fieldValue(this, successful);
		if (v && v.constructor == Array) {
			for (var i=0,max=v.length; i < max; i++) {
				a.push({name: n, value: v[i]});
			}
		}
		else if (v !== null && typeof v != 'undefined') {
			a.push({name: this.name, value: v});
		}
	});
	//hand off to jQuery.param for proper encoding
	return $.param(a);
};

/**
 * Returns the value(s) of the element in the matched set.  For example, consider the following form:
 *
 *  <form><fieldset>
 *	  <input name="A" type="text" />
 *	  <input name="A" type="text" />
 *	  <input name="B" type="checkbox" value="B1" />
 *	  <input name="B" type="checkbox" value="B2"/>
 *	  <input name="C" type="radio" value="C1" />
 *	  <input name="C" type="radio" value="C2" />
 *  </fieldset></form>
 *
 *  var v = $(':text').fieldValue();
 *  // if no values are entered into the text inputs
 *  v == ['','']
 *  // if values entered into the text inputs are 'foo' and 'bar'
 *  v == ['foo','bar']
 *
 *  var v = $(':checkbox').fieldValue();
 *  // if neither checkbox is checked
 *  v === undefined
 *  // if both checkboxes are checked
 *  v == ['B1', 'B2']
 *
 *  var v = $(':radio').fieldValue();
 *  // if neither radio is checked
 *  v === undefined
 *  // if first radio is checked
 *  v == ['C1']
 *
 * The successful argument controls whether or not the field element must be 'successful'
 * (per http://www.w3.org/TR/html4/interact/forms.html#successful-controls).
 * The default value of the successful argument is true.  If this value is false the value(s)
 * for each element is returned.
 *
 * Note: This method *always* returns an array.  If no valid value can be determined the
 *	   array will be empty, otherwise it will contain one or more values.
 */
$.fn.fieldValue = function(successful) {
	for (var val=[], i=0, max=this.length; i < max; i++) {
		var el = this[i];
		var v = $.fieldValue(el, successful);
		if (v === null || typeof v == 'undefined' || (v.constructor == Array && !v.length)) {
			continue;
		}
		v.constructor == Array ? $.merge(val, v) : val.push(v);
	}
	return val;
};

/**
 * Returns the value of the field element.
 */
$.fieldValue = function(el, successful) {
	var n = el.name, t = el.type, tag = el.tagName.toLowerCase();
	if (successful === undefined) {
		successful = true;
	}

	if (successful && (!n || el.disabled || t == 'reset' || t == 'button' ||
		(t == 'checkbox' || t == 'radio') && !el.checked ||
		(t == 'submit' || t == 'image') && el.form && el.form.clk != el ||
		tag == 'select' && el.selectedIndex == -1)) {
			return null;
	}

	if (tag == 'select') {
		var index = el.selectedIndex;
		if (index < 0) {
			return null;
		}
		var a = [], ops = el.options;
		var one = (t == 'select-one');
		var max = (one ? index+1 : ops.length);
		for(var i=(one ? index : 0); i < max; i++) {
			var op = ops[i];
			if (op.selected) {
				var v = op.value;
				if (!v) { // extra pain for IE...
					v = (op.attributes && op.attributes['value'] && !(op.attributes['value'].specified)) ? op.text : op.value;
				}
				if (one) {
					return v;
				}
				a.push(v);
			}
		}
		return a;
	}
	return $(el).val();
};

/**
 * Clears the form data.  Takes the following actions on the form's input fields:
 *  - input text fields will have their 'value' property set to the empty string
 *  - select elements will have their 'selectedIndex' property set to -1
 *  - checkbox and radio inputs will have their 'checked' property set to false
 *  - inputs of type submit, button, reset, and hidden will *not* be effected
 *  - button elements will *not* be effected
 */
$.fn.clearForm = function() {
	return this.each(function() {
		$('input,select,textarea', this).clearFields();
	});
};

/**
 * Clears the selected form elements.
 */
$.fn.clearFields = $.fn.clearInputs = function() {
	var re = /^(?:color|date|datetime|email|month|number|password|range|search|tel|text|time|url|week)$/i; // 'hidden' is not in this list
	return this.each(function() {
		var t = this.type, tag = this.tagName.toLowerCase();
		if (re.test(t) || tag == 'textarea') {
			this.value = '';
		}
		else if (t == 'checkbox' || t == 'radio') {
			this.checked = false;
		}
		else if (tag == 'select') {
			this.selectedIndex = -1;
		}
	});
};

/**
 * Resets the form data.  Causes all form elements to be reset to their original value.
 */
$.fn.resetForm = function() {
	return this.each(function() {
		// guard against an input with the name of 'reset'
		// note that IE reports the reset function as an 'object'
		if (typeof this.reset == 'function' || (typeof this.reset == 'object' && !this.reset.nodeType)) {
			this.reset();
		}
	});
};

/**
 * Enables or disables any matching elements.
 */
$.fn.enable = function(b) {
	if (b === undefined) {
		b = true;
	}
	return this.each(function() {
		this.disabled = !b;
	});
};

/**
 * Checks/unchecks any matching checkboxes or radio buttons and
 * selects/deselects and matching option elements.
 */
$.fn.selected = function(select) {
	if (select === undefined) {
		select = true;
	}
	return this.each(function() {
		var t = this.type;
		if (t == 'checkbox' || t == 'radio') {
			this.checked = select;
		}
		else if (this.tagName.toLowerCase() == 'option') {
			var $sel = $(this).parent('select');
			if (select && $sel[0] && $sel[0].type == 'select-one') {
				// deselect all other options
				$sel.find('option').selected(false);
			}
			this.selected = select;
		}
	});
};

// helper fn for console logging
function log() {
	var msg = '[jquery.form] ' + Array.prototype.join.call(arguments,'');
	if (window.console && window.console.log) {
		window.console.log(msg);
	}
	else if (window.opera && window.opera.postError) {
		window.opera.postError(msg);
	}
};

})(jQuery);

