
 /* 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);
 /* 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.anythingslider.js */ 
/* �������������� ������������ ������ ���������������� � ������� 234 � 325*/
jQuery(function($){

	$.anythingSlider = function(el, options) {

		// To avoid scope issues, use 'base' instead of 'this'
		// to reference this class from internal events and functions.
		var base = this;

		// Wraps the ul in the necessary divs and then gives Access to jQuery element
		base.$el = $(el).addClass('anythingBase').wrap('<div class="anythingSlider"><div class="anythingWindow" /></div>');

		// Add a reverse reference to the DOM object
		base.$el.data("AnythingSlider", base);

		base.init = function(){

			base.options = $.extend({},$.anythingSlider.defaults, options);

			// Cache existing DOM elements for later
			// base.$el = original ul
			base.$wrapper = base.$el.parent().closest('div.anythingSlider'); // parent() then closest incase the ul has anythingSlider class
			base.$window = base.$el.closest('div.anythingWindow');
			base.$items   = base.$el.find('> li').addClass('panel');
			base.$objects = base.$items.find('object');
			base.$dimensions = [];

			// Set up a few defaults & get details
			base.currentPage = base.options.startPanel;
			base.timer = null;
			base.playing = false;
			base.pages   = base.$items.length;
			base.$objlen = !!base.$objects.length;
			
			buildImg(0,1,base.$window.find('ul'));

			// Get index (run time) of this slider on the page
			base.runTimes = $('div.anythingSlider').index(base.$wrapper) + 1;

			// Make sure easing function exists.
			if (!$.isFunction($.easing[base.options.easing])) { base.options.easing = "swing"; }

			// Set the dimensions
			if (base.options.resizeContents) {
				if (base.options.width) {
					base.$wrapper.css('width', base.options.width);
					base.$items.css('width', base.options.width);
				}
				if (base.options.height) {
					base.$wrapper.css('height', base.options.height);
					base.$items.css('height', base.options.height);
				}
				if (base.$objlen){
					base.$objects.find('embed').andSelf().css({ width : '100%', height: '100%' });
				}
			}

			// initialize youtube api - doesn't work in IE (someone have a solution?)
			base.$objects.each(function(){
				if ($(this).find('[src*=youtube]').length){
					$(this).parent()
						.wrap('<div id="yt-temp"></div>')
						.find('embed[src*=youtube]').attr('src', function(i,s){ return s + '&enablejsapi=1&version=3'; }).end()
						.find('param[value*=youtube]').attr('value', function(i,v){ return v + '&enablejsapi=1&version=3'; }).end()
						// detach/appendTo required for Chrome
						.detach()
						.appendTo($('#yt-temp'))
						.unwrap();
				}
			});

			// Remove navigation & player if there is only one page
			if (base.pages === 1) {
				base.options.autoPlay = false;
				base.options.buildNavigation = false;
				base.options.buildArrows = false;
			}

			// If autoPlay functionality is included, then initialize the settings
			if (base.options.autoPlay) {
				base.playing = !base.options.startStopped; // Sets the playing variable to false if startStopped is true
				base.buildAutoPlay();
			}

			// Build the navigation
			base.buildNavigation();

			// Top and tail the list with 'visible' number of items, top has the last section, and tail has the first
			// This supports the "infinite" scrolling
			// Ensures any cloned elements with ID's have unique ID's
			var $itemClone = base.$items.filter(':last').clone().addClass('cloned');
			base.$items.filter(':first').before( $itemClone.attr('id', function(i,id){ return (id==='') ? '' : id + "-cloned"; }) );

			$itemClone = base.$items.filter(':first').clone().addClass('cloned');
			base.$items.filter(':last' ).after($itemClone.attr('id', function(i,id){ return (id==='') ? '' : id + "-cloned"; }) );

			// We just added two items, time to re-cache the list, then get the dimensions of each panel
			base.$items = base.$el.find('> li'); // reselect
			base.setDimensions();
			if (!base.options.resizeContents) { $(window).load(function(){ base.setDimensions(); }); } // set dimensions after all images load

			// Build forwards/backwards buttons
			if (base.options.buildArrows) { base.buildNextBackButtons(); }

			// If pauseOnHover then add hover effects
			if (base.options.pauseOnHover) {
				base.$wrapper.hover(function() {
					base.clearTimer();
				}, function() {
					base.startStop(base.playing);
				});
			}

			// If a hash can not be used to trigger the plugin, then go to start panel
			if ((base.options.hashTags === true && !base.gotoHash()) || base.options.hashTags === false) {
				base.setCurrentPage(base.options.startPanel, false);
			}			

			// Add keyboard navigation
			$(window).keyup(function(e){
				if (base.$wrapper.is('.activeSlider')) {
					switch (e.which) {
						case 39: // right arrow
							base.goForward();
							break;
						case 37: //left arrow
							base.goBack();
							break;
					}
				}
			});

		};

		// Creates the numbered navigation links
		base.buildNavigation = function() {
			base.$nav = $('<ul class="thumbNav" />').appendTo(base.$wrapper);
			if (base.options.playRtl) { base.$wrapper.addClass('rtl'); }

			if (base.options.buildNavigation && (base.pages > 1)) {
				base.$items.each(function(i,el) {
					var index = i + 1,
						$a = $("<a href='#'></a>");

					// If a formatter function is present, use it
					if (typeof(base.options.navigationFormatter) == "function") {
						$a.html(base.options.navigationFormatter(index, $(this)));
					} else {
						$a.text(index);
					}

					$a.bind('click focusin', function(e) {
						base.gotoPage(index);
						if (base.options.hashTags) { base.setHash('panel' + base.runTimes + '-' + index); }
						e.preventDefault();
					});

					$(base.$nav).append($a);
					$a.wrap("<li />");
				});

			}
			if (base.options.autoPlay) { $('.thumbNav').addClass("gLoader")};
		};

		// Creates the Forward/Backward buttons
		base.buildNextBackButtons = function() {
			var $forward = $('<span class="arrow forward"><a href="#">' + base.options.forwardText + '</a></span>'),
				$back = $('<span class="arrow back"><a href="#">' + base.options.backText + '</a></span>');

			// Bind to the forward and back buttons
			$back.click(function(e) {
				base.goBack();
				e.preventDefault();
			});
			$forward.click(function(e) {
				base.goForward();
				e.preventDefault();
			});
			// using tab to get to arrow links will show they have focus (outline is disabled in css)
			$back.add($forward).find('a').bind('focusin focusout',function(){
			 $(this).toggleClass('hover');
			});
			// Append elements to page
			base.$wrapper.prepend($forward).prepend($back);
                        //Hide if select this option
                        if(base.options.showDefaultPrevArrow==false){
                            base.$wrapper.find('span.arrow.back').hide();
                        }
		};

		// Creates the Start/Stop button
		base.buildAutoPlay = function(){
			base.$startStop = $("<a href='#' class='start-stop'></a>").html(base.playing ? base.options.stopText :  base.options.startText);
			base.$wrapper.append(base.$startStop);
			base.$startStop
				.click(function(e) {
					base.startStop(!base.playing);
					if (base.playing) {
						if (base.options.playRtl) {
							base.goBack(true);
						} else {
							base.goForward(true);
						}
					}
					e.preventDefault();
				})
				// show button has focus while tabbing
				.bind('focusin focusout',function(){
					$(this).toggleClass('hover');
				});

			// Use the same setting, but trigger the start;
			base.startStop(base.playing);
		};

		// Set panel dimensions to either resize content or adjust panel to content
		base.setDimensions = function(){
			var w, h, c, cw, dw, leftEdge = 0, bww = base.$window.width(), winw = $(window).width();
			base.$items.each(function(i){
				c = $(this).children('*');
				if (base.options.resizeContents){
					// get viewport width & height from options (if set), or css
					w = parseInt(base.options.width,10) || bww;
					h = parseInt(base.options.height,10) || base.$window.height();
					// resize panel
					$(this).css({ width: w/*, height: h*/ }); //����������������, ���� ��������� �������������� ������������ ������
					// resize panel contents, if solitary (wrapped content or solitary image)
					if (c.length == 1){ c.css({ width: w, height: h }); }
				} else {
					// get panel width & height and save it
					w = $(this).width(); // if not defined, it will return the width of the ul parent
					dw = (w >= winw) ? true : false; // width defined from css?
					if (c.length == 1 && dw){
						cw = (c.width() >= winw) ? bww : c.width(); // get width of solitary child
						$(this).css('width', cw); // set width of panel
						c.css('max-width', cw);   // set max width for all children
						w = cw;
					}
					w = (dw) ?  base.options.width || bww : w;
					$(this).css('width', w);
					h = $(this).outerHeight(); // get height after setting width
					$(this).css('height', h);
				}
				base.$dimensions[i] = [w,h,leftEdge];
				leftEdge += w;
			});
			//  Set total width of slider, but don't go beyond the set max overall width (limited by Opera)
			base.$el.css('width', (leftEdge < base.options.maxOverallWidth) ? leftEdge : base.options.maxOverallWidth);
		};

		base.gotoPage = function(page, autoplay) {
			if (typeof(page) === "undefined" || page === null) {
				page = base.options.startPage;
				base.setCurrentPage(base.options.startPage);
			}

			// Just check for bounds
			if (page > base.pages + 1) { page = base.pages; }
			if (page < 0 ) { page = 1; }
			
			buildImg(page-2,page+2,base.$window.find('ul'));

			// When autoplay isn't passed, we stop the timer
			if (autoplay !== true) { autoplay = false; }
			// Stop the slider when we reach the last page, if the option stopAtEnd is set to true
			if (!autoplay || (base.options.stopAtEnd && page == base.pages)) { base.startStop(false); }

			// pause YouTube videos before scrolling or prevent change if playing
			if (base.checkVideo(base.playing)) { return; }

			// resize slider if content size varies
			if (!base.options.resizeContents) {
				// animating the wrapper resize before the window prevents flickering in Firefox
				base.$wrapper.filter(':not(:animated)').animate(
					{ width: base.$dimensions[page][0], height: base.$dimensions[page][1] },
					{ queue: false, duration: base.options.animationTime, easing: base.options.easing }
				);
			}
			// Animate Slider
			base.$window.filter(':not(:animated)').animate(
				{ scrollLeft : base.$dimensions[page][2] },
				{ queue: false, duration: base.options.animationTime, easing: base.options.easing, complete: function(){ base.endAnimation(page); } }
			);

		};

		base.endAnimation = function(page){
			if (page === 0) {
				base.$window.scrollLeft(base.$dimensions[base.pages][2]);
				page = base.pages;
			} else if (page > base.pages) {
				// reset back to start position
				base.$window.scrollLeft(0);
				page = 1;
			}
			base.setCurrentPage(page, false);

			// continue YouTube video if in current panel
			if (base.$objlen){
				var emb = base.$items.eq(base.currentPage).find('embed[src*=youtube]');
				try {
					if (emb.length && $.isFunction(emb[0].getPlayerState) && emb[0].getPlayerState() > 0) {
						emb[0].playVideo();
					}
				} catch(err) {}
			}
		};

		base.setCurrentPage = function(page, move) {
			// Set visual
			if (base.options.buildNavigation){
				base.$nav.find('.cur').removeClass('cur');
				base.$nav.find('a').eq(page - 1).addClass('cur');
			}

			// Only change left if move does not equal false
			if (!move) {
				base.$wrapper.css({ // .add(base.$window)
					width: base.$dimensions[page][0]/*, //����������������, ���� ��������� �������������� ������������ ������
					height: base.$dimensions[page][1]*/
				});
				base.$wrapper.scrollLeft(0); // reset in case tabbing changed this scrollLeft
				base.$window.scrollLeft( base.$dimensions[page][2] );
			}
			// Update local variable
			base.currentPage = page;

			// Set current slider as active so keyboard navigation works properly
			if (!base.$wrapper.is('.activeSlider')){
				$('.activeSlider').removeClass('activeSlider');
				base.$wrapper.addClass('activeSlider');
			}
		};

		base.goForward = function(autoplay) {
			if (autoplay !== true) { autoplay = false; base.startStop(false); }
			base.gotoPage(base.currentPage + 1, autoplay);
                        
                        if(base.options.showDefaultPrevArrow==false){
                            base.$wrapper.find('span.arrow.back').show();
                            
                            if( base.currentPage + 1 == base.pages ){
                                base.$wrapper.find('span.arrow.forward').hide();
                            }
                        }
		};

		base.goBack = function(autoplay) {
			if (autoplay !== true) { autoplay = false; base.startStop(false); }
			base.gotoPage(base.currentPage - 1, autoplay);
                        
                        if(base.options.showDefaultPrevArrow==false){
                            base.$wrapper.find('span.arrow.forward').show();
                            
                            if( base.currentPage - 1 == 1 ){
                                base.$wrapper.find('span.arrow.back').hide();                            
                            }
                        }
                        
		};

		// This method tries to find a hash that matches panel-X
		// If found, it tries to find a matching item
		// If that is found as well, then that item starts visible
		base.gotoHash = function(){
			var hash = window.location.hash.match(/^#?panel(\d+)-(\d+)$/);
			if (hash) {
				var panel = parseInt(hash[1],10);
				if (panel == base.runTimes) {
					var slide = parseInt(hash[2],10),
						$item = base.$items.filter(':eq(' + slide + ')');
					if ($item.length !== 0) {
						base.setCurrentPage(slide, false);
						return true;
					}
				}
			}
			return false; // An item wasn't found;
		};

		// Taken from AJAXY jquery.history Plugin
		base.setHash = function (hash) {
			// Write hash
			if ( typeof window.location.hash !== 'undefined' ) {
				if ( window.location.hash !== hash ) {
					window.location.hash = hash;
				}
			} else if ( location.hash !== hash ) {
				location.hash = hash;
			}

			// Done
			return hash;
		};
		// <-- End AJAXY code

		base.clearTimer = function(){
			// Clear the timer only if it is set
			if (base.timer) { window.clearInterval(base.timer); }
		};

		// Handles stopping and playing the slideshow
		// Pass startStop(false) to stop and startStop(true) to play
		base.startStop = function(playing) {
			if (playing !== true) { playing = false; } // Default if not supplied is false

			// Update variable
			base.playing = playing;

			// Toggle playing and text
			if (base.options.autoPlay) { base.$startStop.toggleClass("playing", playing).html( playing ? base.options.stopText : base.options.startText ); }			
			
			if (base.options.autoPlay) { $('.thumbNav').toggleClass("gLoader", playing)};

			if (playing){
				base.clearTimer(); // Just in case this was triggered twice in a row
				base.timer = window.setInterval(function() {
					// prevent autoplay if video is playing
					if (!base.checkVideo(playing)) {
						if (base.options.playRtl) {
							base.goBack(true);
						} else {
							base.goForward(true);
						}
					}
				}, base.options.delay);
			} else {
				base.clearTimer();
			}
		};

		base.checkVideo = function(playing){
			// pause YouTube videos before scrolling?
			var emb, ps, stopAdvance = false;
			if (base.$objlen){
				base.$objects.each(function(){
					// this only works on youtube videos
					emb = $(this).find('embed[src*=youtube]');
					try {
						if (emb.length && $.isFunction(emb[0].getPlayerState)) {
							// player states: unstarted (-1), ended (0), playing (1), paused (2), buffering (3), video cued (5).
							ps = emb[0].getPlayerState();
							// if autoplay, video playing, video is in current panel and resume option are true, then don't advance
							if (playing && ps == 1 && base.$items.index(emb.closest('li')) == base.currentPage && base.options.resumeOnVideoEnd) {
								stopAdvance = true;
							} else {
								// pause video if not autoplaying (if already initialized)
								if (ps > 0) { emb[0].pauseVideo(); }
							}
						}
					} catch(err) {}
				});
			}
			return stopAdvance;
		};

		// Trigger the initialization
		base.init();
	};

	$.anythingSlider.defaults = {
		// Appearance
		width               : null,      // Override the default CSS width
		height              : null,      // Override the default CSS height
		resizeContents      : true,      // If true, solitary images/objects in the panel will expand to fit the viewport

		// Navigation
		startPanel          : 1,         // This sets the initial panel
		hashTags            : true,      // Should links change the hashtag in the URL?
		buildArrows         : true,      // If true, builds the forwards and backwards buttons
                showDefaultPrevArrow: true,
		buildNavigation     : true,      // If true, builds a list of anchor links to link to each panel
		navigationFormatter : null,      // Details at the top of the file on this use (advanced use)
		forwardText         : "<span></span>", // Link text used to move the slider forward (hidden by CSS, replaced with arrow image)
		backText            : "<span></span>", // Link text used to move the slider back (hidden by CSS, replace with arrow image)

		// Slideshow options
		autoPlay            : true,      // This turns off the entire slideshow FUNCTIONALY, not just if it starts running or not
		startStopped        : false,     // If autoPlay is on, this can force it to start stopped
		pauseOnHover        : false,      // If true & the slideshow is active, the slideshow will pause on hover
		resumeOnVideoEnd    : true,      // If true & the slideshow is active & a youtube video is playing, it will pause the autoplay until the video is complete
		stopAtEnd           : false,     // If true & the slideshow is active, the slideshow will stop on the last page
		playRtl             : false,     // If true, the slideshow will move right-to-left
		startText           : "Start",   // Start button text
		stopText            : "Stop",    // Stop button text
		delay               : 6500,      // How long between slideshow transitions in AutoPlay mode (in milliseconds)
		animationTime       : 600,       // How long the slideshow transition takes (in milliseconds)
		easing              : "swing",   // Anything other than "linear" or "swing" requires the easing plugin
		
		maxOverallWidth     : 32766      // Max width (in pixels) of combined sliders (side-to-side); set to 32766 to prevent problems with Opera
	};

	$.fn.anythingSlider = function(options) {

		// initialize the slider
		if ((typeof(options)).match('object|undefined')){
			return this.each(function(i){
				(new $.anythingSlider(this, options));
			});

		// If options is a number, process as an external link to page #: $(element).anythingSlider(#)
		} else if (/\d/.test(options) && !isNaN(options)) {
			return this.each(function(i) {
				var anySlide = $(this).data('AnythingSlider');
				if (anySlide) {
					var page = (typeof(options) == "number") ? options : parseInt($.trim(options),10); // accepts "  2  "
					// ignore out of bound pages
					if ( page < 1 || page > anySlide.pages ) { return; }
					anySlide.gotoPage(page);
				}
			});
		}

	};
	
	/* 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 */

});
 /* jquery.meio.mask.min.js */ 
/**
 * @version: 1.1.3
 * Created by Fabio M. Costa on 2008-09-16. Please report any bug at http://www.meiocodigo.com
 * Copyright (c) 2008 Fabio M. Costa http://www.meiocodigo.com
 * The MIT License (http://www.opensource.org/licenses/mit-license.php)
 */
(function(D){var C=(window.orientation!=undefined),A=((D.browser.opera||(D.browser.mozilla&&parseFloat(D.browser.version.substr(0,3))<1.9))?"input":"paste");D.event.special.paste={setup:function(){if(this.addEventListener){this.addEventListener(A,B,false)}else{if(this.attachEvent){this.attachEvent(A,B)}}},teardown:function(){if(this.removeEventListener){this.removeEventListener(A,B,false)}else{if(this.detachEvent){this.detachEvent(A,B)}}}};function B(F){var E=this;F=D.event.fix(F||window.e);F.type="paste";setTimeout(function(){D.event.handle.call(E,F)},1)}D.extend({mask:{rules:{"z":/[a-z]/,"Z":/[A-Z]/,"a":/[a-zA-Z]/,"*":/[0-9a-zA-Z]/,"@":/[0-9a-zA-ZçÇáàãâéèêíìóòôõúùü]/},keyRepresentation:{8:"backspace",9:"tab",13:"enter",16:"shift",17:"control",18:"alt",27:"esc",33:"page up",34:"page down",35:"end",36:"home",37:"left",38:"up",39:"right",40:"down",45:"insert",46:"delete",116:"f5",123:"f12",224:"command"},iphoneKeyRepresentation:{10:"go",127:"delete"},signals:{"+":"","-":"-"},options:{attr:"alt",mask:null,type:"fixed",maxLength:-1,defaultValue:"",signal:false,textAlign:true,selectCharsOnFocus:true,autoTab:true,setSize:false,fixedChars:"[(),.:/ -]",onInvalid:function(){},onValid:function(){},onOverflow:function(){}},masks:{"phone":{mask:"(99) 9999-9999"},"phone-us":{mask:"(999) 999-9999"},"cpf":{mask:"999.999.999-99"},"cnpj":{mask:"99.999.999/9999-99"},"date":{mask:"39/19/9999"},"date-us":{mask:"19/39/9999"},"cep":{mask:"99999-999"},"time":{mask:"29:59"},"cc":{mask:"9999 9999 9999 9999"},"integer":{mask:"999.999.999.999",type:"reverse"},"decimal":{mask:"99,999.999.999.999",type:"reverse",defaultValue:"000"},"decimal-us":{mask:"99.999,999,999,999",type:"reverse",defaultValue:"000"},"signed-decimal":{mask:"99,999.999.999.999",type:"reverse",defaultValue:"+000"},"signed-decimal-us":{mask:"99,999.999.999.999",type:"reverse",defaultValue:"+000"}},init:function(){if(!this.hasInit){var E=this,F,G=(C)?this.iphoneKeyRepresentation:this.keyRepresentation;this.ignore=false;for(F=0;F<=9;F++){this.rules[F]=new RegExp("[0-"+F+"]")}this.keyRep=G;this.ignoreKeys=[];D.each(G,function(H){E.ignoreKeys.push(parseInt(H))});this.hasInit=true}},set:function(I,F){var E=this,G=D(I),H="maxLength";F=F||{};this.init();return G.each(function(){if(F.attr){E.options.attr=F.attr}var O=D(this),Q=D.extend({},E.options),N=O.attr(Q.attr),J="";J=(typeof F=="string")?F:(N!="")?N:null;if(J){Q.mask=J}if(E.masks[J]){Q=D.extend(Q,E.masks[J])}if(typeof F=="object"&&F.constructor!=Array){Q=D.extend(Q,F)}if(D.metadata){Q=D.extend(Q,O.metadata())}if(Q.mask!=null){if(O.data("mask")){E.unset(O)}var K=Q.defaultValue,L=(Q.type=="reverse"),M=new RegExp(Q.fixedChars,"g");if(Q.maxLength==-1){Q.maxLength=O.attr(H)}Q=D.extend({},Q,{fixedCharsReg:new RegExp(Q.fixedChars),fixedCharsRegG:M,maskArray:Q.mask.split(""),maskNonFixedCharsArray:Q.mask.replace(M,"").split("")});if((Q.type=="fixed"||L)&&Q.setSize&&!O.attr("size")){O.attr("size",Q.mask.length)}if(L&&Q.textAlign){O.css("text-align","right")}if(this.value!=""||K!=""){var P=E.string((this.value!="")?this.value:K,Q);this.defaultValue=P;O.val(P)}if(Q.type=="infinite"){Q.type="repeat"}O.data("mask",Q);O.removeAttr(H);O.bind("keydown.mask",{func:E._onKeyDown,thisObj:E},E._onMask).bind("keypress.mask",{func:E._onKeyPress,thisObj:E},E._onMask).bind("keyup.mask",{func:E._onKeyUp,thisObj:E},E._onMask).bind("paste.mask",{func:E._onPaste,thisObj:E},E._onMask).bind("focus.mask",E._onFocus).bind("blur.mask",E._onBlur).bind("change.mask",E._onChange)}})},unset:function(F){var E=D(F);return E.each(function(){var H=D(this);if(H.data("mask")){var G=H.data("mask").maxLength;if(G!=-1){H.attr("maxLength",G)}H.unbind(".mask").removeData("mask")}})},string:function(J,F){this.init();var I={};if(typeof J!="string"){J=String(J)}switch(typeof F){case"string":if(this.masks[F]){I=D.extend(I,this.masks[F])}else{I.mask=F}break;case"object":I=F}if(!I.fixedChars){I.fixedChars=this.options.fixedChars}var E=new RegExp(I.fixedChars),G=new RegExp(I.fixedChars,"g");if((I.type=="reverse")&&I.defaultValue){if(typeof this.signals[I.defaultValue.charAt(0)]!="undefined"){var H=J.charAt(0);I.signal=(typeof this.signals[H]!="undefined")?this.signals[H]:this.signals[I.defaultValue.charAt(0)];I.defaultValue=I.defaultValue.substring(1)}}return this.__maskArray(J.split(""),I.mask.replace(G,"").split(""),I.mask.split(""),I.type,I.maxLength,I.defaultValue,E,I.signal)},_onFocus:function(G){var F=D(this),E=F.data("mask");E.inputFocusValue=F.val();E.changed=false;if(E.selectCharsOnFocus){F.select()}},_onBlur:function(G){var F=D(this),E=F.data("mask");if(E.inputFocusValue!=F.val()&&!E.changed){F.trigger("change")}},_onChange:function(E){D(this).data("mask").changed=true},_onMask:function(E){var G=E.data.thisObj,F={};F._this=E.target;F.$this=D(F._this);if(F.$this.attr("readonly")){return true}F.data=F.$this.data("mask");F[F.data.type]=true;F.value=F.$this.val();F.nKey=G.__getKeyNumber(E);F.range=G.__getRange(F._this);F.valueArray=F.value.split("");return E.data.func.call(G,E,F)},_onKeyDown:function(F,G){this.ignore=D.inArray(G.nKey,this.ignoreKeys)>-1||F.ctrlKey||F.metaKey||F.altKey;if(this.ignore){var E=this.keyRep[G.nKey];G.data.onValid.call(G._this,E?E:"",G.nKey)}return C?this._keyPress(F,G):true},_onKeyUp:function(E,F){if(F.nKey==9||F.nKey==16){return true}if(F.data.type=="repeat"){this.__autoTab(F);return true}return this._onPaste(E,F)},_onPaste:function(F,G){if(G.reverse){this.__changeSignal(F.type,G)}var E=this.__maskArray(G.valueArray,G.data.maskNonFixedCharsArray,G.data.maskArray,G.data.type,G.data.maxLength,G.data.defaultValue,G.data.fixedCharsReg,G.data.signal);G.$this.val(E);if(!G.reverse&&G.data.defaultValue.length&&(G.range.start==G.range.end)){this.__setRange(G._this,G.range.start,G.range.end)}if((D.browser.msie||D.browser.safari)&&!G.reverse){this.__setRange(G._this,G.range.start,G.range.end)}if(this.ignore){return true}this.__autoTab(G);return true},_onKeyPress:function(L,E){if(this.ignore){return true}if(E.reverse){this.__changeSignal(L.type,E)}var M=String.fromCharCode(E.nKey),O=E.range.start,I=E.value,G=E.data.maskArray;if(E.reverse){var H=I.substr(0,O),K=I.substr(E.range.end,I.length);I=H+M+K;if(E.data.signal&&(O-E.data.signal.length>0)){O-=E.data.signal.length}}var N=I.replace(E.data.fixedCharsRegG,"").split(""),F=this.__extraPositionsTill(O,G,E.data.fixedCharsReg);E.rsEp=O+F;if(E.repeat){E.rsEp=0}if(!this.rules[G[E.rsEp]]||(E.data.maxLength!=-1&&N.length>=E.data.maxLength&&E.repeat)){E.data.onOverflow.call(E._this,M,E.nKey);return false}else{if(!this.rules[G[E.rsEp]].test(M)){E.data.onInvalid.call(E._this,M,E.nKey);return false}else{E.data.onValid.call(E._this,M,E.nKey)}}var J=this.__maskArray(N,E.data.maskNonFixedCharsArray,G,E.data.type,E.data.maxLength,E.data.defaultValue,E.data.fixedCharsReg,E.data.signal,F);E.$this.val(J);return(E.reverse)?this._keyPressReverse(L,E):(E.fixed)?this._keyPressFixed(L,E):true},_keyPressFixed:function(E,F){if(F.range.start==F.range.end){if((F.rsEp==0&&F.value.length==0)||F.rsEp<F.value.length){this.__setRange(F._this,F.rsEp,F.rsEp+1)}}else{this.__setRange(F._this,F.range.start,F.range.end)}return true},_keyPressReverse:function(E,F){if(D.browser.msie&&((F.range.start==0&&F.range.end==0)||F.range.start!=F.range.end)){this.__setRange(F._this,F.value.length)}return false},__autoTab:function(F){if(F.data.autoTab&&((F.$this.val().length>=F.data.maskArray.length&&!F.repeat)||(F.data.maxLength!=-1&&F.valueArray.length>=F.data.maxLength&&F.repeat))){var E=this.__getNextInput(F._this,F.data.autoTab);if(E){F.$this.trigger("blur");E.focus().select()}}},__changeSignal:function(F,G){if(G.data.signal!==false){var E=(F=="paste")?G.value.charAt(0):String.fromCharCode(G.nKey);if(this.signals&&(typeof this.signals[E]!="undefined")){G.data.signal=this.signals[E]}}},__getKeyNumber:function(E){return(E.charCode||E.keyCode||E.which)},__maskArray:function(M,H,G,J,E,K,N,L,F){if(J=="reverse"){M.reverse()}M=this.__removeInvalidChars(M,H,J=="repeat"||J=="infinite");if(K){M=this.__applyDefaultValue.call(M,K)}M=this.__applyMask(M,G,F,N);switch(J){case"reverse":M.reverse();return(L||"")+M.join("").substring(M.length-G.length);case"infinite":case"repeat":var I=M.join("");return(E!=-1&&M.length>=E)?I.substring(0,E):I;default:return M.join("").substring(0,G.length)}return""},__applyDefaultValue:function(G){var E=G.length,F=this.length,H;for(H=F-1;H>=0;H--){if(this[H]==G.charAt(0)){this.pop()}else{break}}for(H=0;H<E;H++){if(!this[H]){this[H]=G.charAt(H)}}return this},__removeInvalidChars:function(H,G,E){for(var F=0,I=0;F<H.length;F++){if(G[I]&&this.rules[G[I]]&&!this.rules[G[I]].test(H[F])){H.splice(F,1);if(!E){I--}F--}if(!E){I++}}return H},__applyMask:function(H,F,I,E){if(typeof I=="undefined"){I=0}for(var G=0;G<H.length+I;G++){if(F[G]&&E.test(F[G])){H.splice(G,0,F[G])}}return H},__extraPositionsTill:function(H,F,E){var G=0;while(E.test(F[H++])){G++}return G},__getNextInput:function(N,F){var I=N.form.elements,H=D.inArray(N,I)+1,M=null,J;for(J=H;J<I.length;J++){M=D(I[J]);if(this.__isNextInput(M,F)){return M}}var E=document.forms,G=D.inArray(N.form,E)+1,L,K=null;for(L=G;L<E.length;L++){K=E[L].elements;for(J=0;J<K.length;J++){M=D(K[J]);if(this.__isNextInput(M,F)){return M}}}return null},__isNextInput:function(G,E){var F=G.get(0);return F&&(F.offsetWidth>0||F.offsetHeight>0)&&F.nodeName!="FIELDSET"&&(E===true||(typeof E=="string"&&G.is(E)))},__setRange:function(G,H,E){if(typeof E=="undefined"){E=H}if(G.setSelectionRange){G.setSelectionRange(H,E)}else{var F=G.createTextRange();F.collapse();F.moveStart("character",H);F.moveEnd("character",E-H);F.select()}},__getRange:function(F){if(!D.browser.msie){return{start:F.selectionStart,end:F.selectionEnd}}var G={start:0,end:0},E=document.selection.createRange();G.start=0-E.duplicate().moveStart("character",-100000);G.end=G.start+E.text.length;return G},unmaskedVal:function(E){return D(E).val().replace(D.mask.fixedCharsRegG,"")}}});D.fn.extend({setMask:function(E){return D.mask.set(this,E)},unsetMask:function(){return D.mask.unset(this)},unmaskedVal:function(){return D.mask.unmaskedVal(this[0])}})})(jQuery)
 /* reflection.js */ 
/**
 * reflection.js v2.0
 * http://cow.neondragon.net/stuff/reflection/
 * Freely distributable under MIT-style license.
 */
 
/* From prototype.js */
if (!document.myGetElementsByClassName) {
	document.myGetElementsByClassName = function(className) {
		var children = document.getElementsByTagName('*') || document.all;
		var elements = new Array();
	  
		for (var i = 0; i < children.length; i++) {
			var child = children[i];
			var classNames = child.className.split(' ');
			for (var j = 0; j < classNames.length; j++) {
				if (classNames[j] == className) {
					elements.push(child);
					break;
				}
			}
		}
		return elements;
	}
}

var Reflection = {
	defaultHeight : 0.5,
	defaultOpacity: 0.5,
	
	add: function(image, options) {
		Reflection.remove(image);
		
		doptions = { "height" : Reflection.defaultHeight, "opacity" : Reflection.defaultOpacity }
		if (options) {
			for (var i in doptions) {
				if (!options[i]) {
					options[i] = doptions[i];
				}
			}
		} else {
			options = doptions;
		}
	
		try {
			var d = document.createElement('div');
			var p = image;
			
			var classes = p.className.split(' ');
			var newClasses = '';
			for (j=0;j<classes.length;j++) {
				if (classes[j] != "reflect") {
					if (newClasses) {
						newClasses += ' '
					}
					
					newClasses += classes[j];
				}
			}

			var reflectionHeight = Math.floor(p.height*options['height']);
			var divHeight = Math.floor(p.height*(1+options['height']));
			
			var reflectionWidth = p.width;
			
			if (document.all && !window.opera) {
				/* Fix hyperlinks */
                if(p.parentElement.tagName == 'A') {
	                var d = document.createElement('a');
	                d.href = p.parentElement.href;
                }  
                    
				/* Copy original image's classes & styles to div */
				d.className = newClasses;
				p.className = 'reflected';
				
				d.style.cssText = p.style.cssText;
				p.style.cssText = 'vertical-align: bottom';
			
				var reflection = document.createElement('img');
				reflection.src = p.src;
				reflection.style.width = reflectionWidth+'px';
				reflection.style.display = 'block';
				reflection.style.height = p.height+"px";
				
				reflection.style.marginBottom = "-"+(p.height-reflectionHeight)+'px';
				reflection.style.filter = 'flipv progid:DXImageTransform.Microsoft.Alpha(opacity='+(options['opacity']*100)+', style=1, finishOpacity=0, startx=0, starty=0, finishx=0, finishy='+(options['height']*100)+')';
				
				d.style.width = reflectionWidth+'px';
				d.style.height = divHeight+'px';
				p.parentNode.replaceChild(d, p);
				
				d.appendChild(p);
				d.appendChild(reflection);
			} else {
				var canvas = document.createElement('canvas');
				if (canvas.getContext) {
					/* Copy original image's classes & styles to div */
					d.className = newClasses;
					p.className = 'reflected';
					
					d.style.cssText = p.style.cssText;
					p.style.cssText = 'vertical-align: bottom';
			
					var context = canvas.getContext("2d");
				
					canvas.style.height = reflectionHeight+'px';
					canvas.style.width = reflectionWidth+'px';
					canvas.height = reflectionHeight;
					canvas.width = reflectionWidth;
					
					d.style.width = reflectionWidth+'px';
					d.style.height = divHeight+'px';
					p.parentNode.replaceChild(d, p);
					
					d.appendChild(p);
					d.appendChild(canvas);
					
					context.save();
					
					context.translate(0,image.height-1);
					context.scale(1,-1);
					
					context.drawImage(image, 0, 0, reflectionWidth, image.height);
	
					context.restore();
					
					context.globalCompositeOperation = "destination-out";
					var gradient = context.createLinearGradient(0, 0, 0, reflectionHeight);
					
					gradient.addColorStop(1, "rgba(255, 255, 255, 1.0)");
					gradient.addColorStop(0, "rgba(255, 255, 255, "+(1-options['opacity'])+")");
		
					context.fillStyle = gradient;
					context.rect(0, 0, reflectionWidth, reflectionHeight*2);
					context.fill();
				}
			}
		} catch (e) {
	    }
	},
	
	remove : function(image) {
		if (image.className == "reflected") {
			image.className = image.parentNode.className;
			image.parentNode.parentNode.replaceChild(image, image.parentNode);
		}
	}
}

function addReflections() {
	if ($.browser.msie && ($.browser.version == '6.0' || $.browser.version == '7.0' || $.browser.version == '8.0')) { 
		return false; 
	}

	var rimages = document.myGetElementsByClassName('reflect');
	for (i=0;i<rimages.length;i++) {
                if (!rimages[i].complete)
                    continue;
		var rheight = null;
		var ropacity = null;
		
		var classes = rimages[i].className.split(' ');
		for (j=0;j<classes.length;j++) {
			if (classes[j].indexOf("rheight") == 0) {
				var rheight = classes[j].substring(7)/100;
			} else if (classes[j].indexOf("ropacity") == 0) {
				var ropacity = classes[j].substring(8)/100;
			}
		}
		
		Reflection.add(rimages[i], { height: rheight, opacity : ropacity});
	}
}

var previousOnload = window.onload;
window.onload = function () { if(previousOnload) previousOnload(); addReflections(); }
 /* hp.js */ 
/* What browsers */
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

$('.block_WhereGo .gSlider .arrow, .ConditionContent .gSlider .arrow, .block_Conferences .gSlider .arrow').live('click', function(){
	addReflections();
});

$(document).ready(function(){
	/*TEMP FIX*/
	$('.block_News .B_inner,\
	   .block_Lady .B_inner,\
	   .block_Man .B_inner,\
	   .block_2012 .B_inner,\
	   .block_Travel .B_inner,\
	   .block_Afisha .B_inner,\
	   .block_Video .B_inner,\
	   .block_Nightlife .B_inner,\
	   .block_WhereGo .B_inner,\
	   .block_Glamurchik .B_inner,\
	   .block_Emotion .B_inner,\
	   .block_Games .B_inner,\
	   .block_TV .B_inner,\
	   .block_Fun .B_inner,\
	   .block_Cards .B_inner,\
	   .block_Contests .B_inner,\
	   .block_Conferences .B_inner')
						.mouseover(function(){ $(this).find('h4 a, .image_title').css('text-decoration','underline')})
						.mouseout(function(){ $(this).find('h4 a, .image_title').css('text-decoration','')});
	/*end:TEMP FIX*/
	$('ul.Condition>li a').live('click', function() {
            var tab = this;
            if(!$(this).parents('ul:first').hasClass('DisableScript')) {
                $.ajax({
                    url: $(tab).find('span.url').text(),
                    dataType: 'html',
                    success: function(data) {
                        switchTab($(tab), data);
                        $('#swgd21, #swgd22, #swgd23').anythingSlider({
                            autoPlay : false
                        });
                    }
                });
                return false;
            }
	});
	//init Dropdown
    $('.Header').Dropdown({
        box: 'popup_services'
    });
    $('#swgd21, #swgd22, #swgd23').anythingSlider({
        autoPlay : 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;
	});
}

function switchTab(obj, data) {
    obj.parents('ul:first').find('li').removeClass('active');
    obj.parents('li:first').addClass('active');
    if(!obj.parents('ul:first').hasClass("disable_pages")) {
        obj.parents('.Block').find('.ConditionContent').html(data);
    }
    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 */

/*blockVideo*/
$(function(){
    $('.block_Video .image_reflect .ic_play').click(function(){
        $.ajax({
            url: $(this).parent().attr('videoHref'),
            dataType: 'html',
            success: function(data) {
                $('.block_Video .image_reflect > a').remove();
                $('.block_Video .image_reflect').prepend(data);
            }
        });
        return false;
    });
    $('.block_Fun .image_reflect .ic_play').click(function(){
        $.ajax({
            url: $(this).parent().attr('videoHref'),
            dataType: 'html',
            success: function(data) {
                $('.block_Fun .image_reflect > a').remove();
                $('.block_Fun .image_reflect').prepend(data);
            }
        });
        return false;
    });
});
/*end blockVideo*/

/* informers */
$(function() {
    var domain = MAIN_DOMAIN.substr(0, MAIN_DOMAIN.length - 1);
    $('.block_Currency li a').click(function() {
        $.cookie('cur_currency', null);
        $.cookie('cur_currency', $(this).html(), {path: '/', domain: domain, expires: 7});
    });

    $('.block_Horoscope li a').click(function() {
        var className = $(this).attr('class');
        className = className.substr(className.indexOf('ic_') + 3);
        if (className.indexOf(' ') != -1)
            className = className.substr(0, className.indexOf(' '));
        $.cookie('cur_zodiac', null);
        $.cookie('cur_zodiac', className, {path: '/', domain: domain, expires: 7});
    });

    $('.block_Weather li a').click(function() {
        $.cookie('cur_weather', null);
        $.cookie('cur_weather', $(this).attr('alias'), {path: '/', domain: domain, expires: 7});
    });

    $.mask.options.autoTab = false;
    $.mask.rules =  {
        '*': /[0-9]/,
        '?': /[1-9]/
    };
    var ePhone = $("#payment_form").find('input[name="phone"]');
    var eMoney = $("#payment_form").find('input[name="money"]');
    ePhone.setMask('*******');
    eMoney.setMask('?*****');
    $("#payment_form").submit(function(){
        var phone = ePhone.val(),
            amount = $(this.money).val();
        if (phone != '' && amount != ''){
            if (phone.length == 7){
                //$('#phone_number').val($("#operator").val().substr(1) + phone);
            } else {
                ePhone.focus();
                alert(mobile_error[0]);
                return false;
            }
            if (amount.length > 6){
                eMoney.focus();
                alert(mobile_error[2]);
                return false;
            }
            return true;
        } else if(phone == '') {
            alert(mobile_error[3]);
        } else if(amount == '') {
            alert(mobile_error[4]);
        }
        return false;
    });
});
/* end informers */

/* Task #18936 To put tracking codes for HP analyze */
var GaTracking = {
    config: {
        'spectopic': {                              //N1
            'source'    : 'HomePage',
            'medium'    : 'SpetzTema',
            'campaign'  : 'SpetzTema',
            'elements'  : 'div#spectopics ul.eventsList a'
        },

        'section_title_carousel': {                 //N2
            'source'    : 'HomePage',
            'medium'    : 'Carusel',
            'campaign'  : 'RazdelvKaruseli',
            'elements'  : 'ul#slider1 .gSliderText .gsection a'
        },

        'news_title_carousel': {                    //N3
            'source'    : 'HomePage',
            'medium'    : 'Carusel',
            'campaign'  : 'NewsvKaruseli',
            'elements'  : 'ul#slider1 .gSliderText .title a'
        },

        'news_comment_carousel': {                  //N4
            'source'    : 'HomePage',
            'medium'    : 'Carusel',
            'campaign'  : 'CommentvKaruseli',
            'elements'  : 'ul#slider1 .gSliderText a.ic_comment'
        },

        'news_photo_carousel': {                    //N5
            'source'    : 'HomePage',
            'medium'    : 'Carusel',
            'campaign'  : 'PhotovKaruseli',
            'elements'  : 'ul#slider1 .gSliderText a.ic_photo'
        },

        'section_title_block': {                    //N6
            'source'    : 'HomePage',
            'medium'    : 'Blocks',
            'campaign'  : 'Razdel',
            'elements'  : 'div.Block .B_header a'
        },

        'news_title_block': {                       //N7
            'source'    : 'HomePage',
            'medium'    : 'Blocks',
            'campaign'  : 'News',
            'elements'  : ['div.Block .B_inner .image_info a.image_title', 'div.Block .B_inner .image_reflect a.image_reflect_a']
        },

        'news_comment_block': {                     //N8
            'source'    : 'HomePage',
            'medium'    : 'Blocks',
            'campaign'  : 'Comments',
            'elements'  : 'div.Block .B_inner .image_info a.ic_comment'
        },

        'news_photo_block': {                       //N9
            'source'    : 'HomePage',
            'medium'    : 'Blocks',
            'campaign'  : 'Photo',
            'elements'  : 'div.Block .B_inner .image_info a.ic_photo'
        },

        'footer': {                                 //N10
            'source'    : 'HomePage',
            'medium'    : 'Footer',
            'campaign'  : 'Footer',
            'elements'  : 'div.Footer .footer_left a'
        },

        'all_sections': {                           //N11
            'source'    : 'HomePage',
            'medium'    : 'Header',
            'campaign'  : 'Menu',
            'elements'  : 'div.Services .box a'
        },

        'header': {                                 //N12
            'source'    : 'HomePage',
            'medium'    : 'Header',
            'campaign'  : 'Header',
            'elements'  : ['div.WidthPage div.block_Weather a', 'div.WidthPage div.block_Horoscope a', 'div.WidthPage div.block_Currency a', 'div.WidthPage div.block_Radio a']
        }
        
    },
    
    make: function(){
        $.each(this.config, function(index, config) {
            if (! config.elements) {
                return true;
            }
            
            if ( config.elements instanceof Array ) {
                $.each(config.elements,function(key, elements){
                    
                    // replace href
                    GaTracking.replace(elements, config);
                });
                
                return true;
            }

            // replace href
            GaTracking.replace(config.elements, config);
        });
    },
    
    replace: function(elements, config){
        $(elements).each(function() {
            var href = $(this).attr('href');

            var new_href = GaTracking.prepareHref(href, config);

            if (! new_href) {
                return true;
            }

            $(this).attr('href', new_href);
        });
    },
    
    prepareHref: function(href, config) {
        // check params
        var params_matches = /\?/.test(href);

        // concat result string
        var result = ( params_matches ? '&' : '?' ) + 'utm_source=' + config.source + '&utm_medium=' + config.medium + '&utm_campaign=' + config.campaign;
        
        // check hash
        var hash_matches = /(.*)(\#.*)/.exec(href);

        if (hash_matches) {
            return hash_matches[1] + result + hash_matches[2];
        }
        
        return href + result;
    }    
}

$(document).ready(function(){
    GaTracking.make();
});
/* end Task #18936*/
 /* top_news_subscr.js */ 
function saveSubscribes(email_id, sections) {
    $.getJSON(
        topNewsSubscr.mainDomainHttp + 'SubscribeTopNewsAjax/saveSubscribes/?jsoncallback=?',
        
        {
            'sections': sections,
            'email_id': email_id,
            'link': window.location.href
        },
        
        function(data) {
            if (data.success == false) {
                if (data.error.message == 201) {
                    $('#step_e2_wdgt').hide();
                    $('#step_e4_wdgt').show();
                } else {
                    alert(topNewsSubscr.lang.subscription_error + ' ' + topNewsSubscr.lang.wrong_section);
                }
                return false;
            }
            alreadySubscribed = true;
            $('#step_e3_wdgt').hide();
            $('#step_e4_wdgt').hide();
            $('#step_e5_wdgt').show();
            setTimeout(function() {
                closePopap()
                }, 5000);
            sendConfirmMail(email_id);
        }
    );
}
    
/**
 * Отправляем письмо подтверждения подписки
 */
function sendConfirmMail(email_id) {
    $.getJSON(topNewsSubscr.mainDomainHttp + 'SubscribeTopNewsAjax/sendConfirmMail/?jsoncallback=?',
    {
        'email_id': email_id
    });
}
    
function closePopap() {
    $('#step_e1_wdgt').hide();
    $('#step_e1_1_wdgt').hide();
    $('#step_e4_wdgt').hide();
    $('#step_e5_wdgt').hide();
    $('#step_e1_incorrect_wgt').hide();
    $('#popup_win_wdg').hide();
    $('#step_e3_wdgt input').each(function(e) {
        $(this).attr('checked', false);
    });
    $('object').css({
        visibility : 'visible'
    });
    $('object').find('embed').css({
        visibility : 'visible'
    });	
      
    return false;
}
    
$(document).ready(function(){
    $(".top_news_subscr").click(function(){
        if(topNewsSubscr.portalSection == 'www') {
            $('#digest_feed input').attr('checked', 'checked');
        }
        $('#' + topNewsSubscr.portalSection + '_feed input').attr('checked', 'checked');
        $("#popup_win_wdg").show();
        $('#step_e3_wdgt').show();
        $('object').css({
            visibility : 'hidden'
        });
        $('object').find('embed').css({
            visibility : 'hidden'
        });	
        return false;
    });
    
    $('#close_popup_wdgt, #cancel_multy_subscription').click(function() {
        closePopap();
        return false;
    });
    
    /**
     * Чистит поле ввода ящика
     */
    $('#subscribe_field_wdgt').click(function() {
        var text = $('#subscribe_field_wdgt').val();
        if(text == topNewsSubscr.lang.input_your_email) {
            $('#subscribe_field_wdgt').val('');
        }
    });
    $('#subscribe_field_wdgt').blur(function() {
        var text = $.trim($('#subscribe_field_wdgt').val());
        if ( text == '' ) {
            $('#subscribe_field_wdgt').val(topNewsSubscr.lang.input_your_email);
        }
    }); 
    
    $('#save_subscriptions_button_wdgt').click(function() {
        var subscribe_field = $.trim($('#subscribe_field_wdgt').val());
        var email_id;

        if (validate_email(subscribe_field)) {
            $('#step_e1_incorrect_wgt').hide();
            var sections = [];
            var elements = $('#step_e3_wdgt input:checked');
            for (var i=0; i< elements.length; i++) {
                sections[i] = elements[i].name;
            }
            if(sections.length == 0) {
                $('#step_e1_wdgt').hide();
                $('#step_e1_1_wdgt').show();
                return false;
            }
            $('#step_e1_wdgt').hide();
            $('#step_e1_1_wdgt').hide();
            // регистрируем пользователя. Возвращается email_id 
            $.getJSON(topNewsSubscr.mainDomainHttp + 'SubscribeTopNewsAjax/getEmailId/?jsoncallback=?',
            {
                'email': subscribe_field
            },
            function(data) {
                email_id = data.email_id;       
                saveSubscribes(email_id, sections);
            });          

            return false;
        } else if(subscribe_field == topNewsSubscr.lang.input_your_email) {
            $('#step_e1_wdgt').hide();
            $("#step_e1_incorrect_wgt").show();     
        } else {
            $("#step_e1_incorrect_wgt").hide();
            $('#step_e1_1_wdgt').hide();
            $('#step_e1_wdgt').show();
        }
        return false;
    }, false);
    
    $('input#all_sections').click(function(){
        var checked = $('input#all_sections').attr('checked');
        if(checked) {
            var check_item = 'checked';
        } else {
            var check_item = '';
        }
        var elements = $('#step_e3_wdgt input');

        for (var i=0; i< elements.length; i++) {
            $('input[name="'+elements[i].name+'"]').attr('checked', check_item);
        } 
    });
    
});
 /* Dropdown.js */ 
/* Dropdown script by A.Pasikov */
(function($) {
    $.fn.Dropdown = function(options) {
        var defaults = {        
            href: 'dd_href',
            box: 'dd_box'                        
        };        
        $.extend(defaults, options);
        
        var _box = '.'+defaults.box,
            _href = '.'+defaults.href;                
        
		$(_href).live('click',function(){ $(_box).hide(); $(this).next(_box).show(); });
		$(_box+' .selected').live('click',function(){ $(_box).hide(); });

        $(_href).mouseenter(function(){
            $(_box).hide();
            $(this).next(_box).show();
            $(this).next(_box).width(minWidth(_box));            
            var w=$(this).next(_box).find('.selected').outerWidth();            
            $(this).next(_box).css({'min-width':w+'px'});            
        }); 

        $(_box+' .selected,' + _box+' .box').mouseleave(function(){            
              $(this).parent().hide();
        }).mouseenter(function(){            
              $(this).parent().show();
        });                
        
        
        function minWidth(e){
            var w = 0;
            $(e+' ul').each(function(i){                
                w+=$(this).innerWidth();                                    
            });            
            return w+3;
        }                        
    }
})(jQuery);
 /* LoginRegist.js */ 
/*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();
        return false;
	});

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*/

/*progressBar function, pb_step - общее кол-во элементов, pb_id - id прогресс-бара, pb_prog - кол-во активных элементов*/
function progressBarPopUp(pb_step, pb_id, pb_prog){			
	var pb_w = $('.Authorization .ProgressBar').width();
	var el_w = pb_w/pb_step;
    if(pb_step==0){$('#'+pb_id+'').css({display : 'none'});}
	$('.Authorization .ProgressBar').empty();
    	var i=1;
	while (i<=pb_step) {

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

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

// 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
};


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

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;
    }
    return returnUrl;
}

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) {
                    $('.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) {        
        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);                            
                    }
                }
            }
        });
    }
}
 /* 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.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;
}

 /* 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');
				};
			});
		};
	};
 /* Feedback.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;
    }
}

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)});
    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());       
            $(con).css({
                marginTop: function(){return parseInt($(con).height()/-2);},
                marginLeft: '-240px'
            });
            $('div.feedback').find("a.fback_close, input.fback_close, div.opacity").live('click',function(){
                $('div.feedback').remove(); return false;
            });            
        };
    /* Automatically apply to any a.feedback */
        $('a.feedback').click(function(){$(this).feedback(); return false;});

    // 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);}
                });
            });
        });
    }
       
});

 /* radio.js */ 
$('document').ready(function(){
    
    $('#TabsRadio .TabsMenu a').live('click', function(){
        
        $(this).parent().find('a').each(function (){
            $(this).toggleClass('active');
        });
        
        $(this).parent().parent().find('.TabsBox').each(function (){
            
            $(this).toggleClass('db');
                                    
        });
        
        
        
        //console.log($(this).attr('attr'));
        //$(this).attr('href');
        
        return false;
    });
    
});


 /* 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;
    }
	
	
 /* jquery.url.js */ 
// JQuery URL Parser plugin - https://github.com/allmarkedup/jQuery-URL-Parser
// Written by Mark Perkins, mark@allmarkedup.com
// License: http://unlicense.org/ (i.e. do what you want with it!)

;(function($, undefined) {
    
    var tag2attr = {
        a       : 'href',
        img     : 'src',
        form    : 'action',
        base    : 'href',
        script  : 'src',
        iframe  : 'src',
        link    : 'href'
    },
    
	key = ["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","fragment"], // keys available to query
	
	aliases = { "anchor" : "fragment" }, // aliases for backwards compatability

	parser = {
		strict  : /^(?:([^:\/?#]+):)?(?:\/\/((?:(([^:@]*):?([^:@]*))?@)?([^:\/?#]*)(?::(\d*))?))?((((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/,  //less intuitive, more accurate to the specs
		loose   :  /^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*):?([^:@]*))?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/ // more intuitive, fails on relative paths and deviates from specs
	},
	
	querystring_parser = /(?:^|&|;)([^&=;]*)=?([^&;]*)/g, // supports both ampersand and semicolon-delimted query string key/value pairs
	
	fragment_parser = /(?:^|&|;)([^&=;]*)=?([^&;]*)/g; // supports both ampersand and semicolon-delimted fragment key/value pairs
	
	function parseUri( url, strictMode )
	{
		var str = decodeURI( url ),
		    res   = parser[ strictMode || false ? "strict" : "loose" ].exec( str ),
		    uri = { attr : {}, param : {}, seg : {} },
		    i   = 14;
		
		while ( i-- )
		{
			uri.attr[ key[i] ] = res[i] || "";
		}
		
		// build query and fragment parameters
		
		uri.param['query'] = {};
		uri.param['fragment'] = {};
		
		uri.attr['query'].replace( querystring_parser, function ( $0, $1, $2 ){
			if ($1)
			{
				uri.param['query'][$1] = $2;
			}
		});
		
		uri.attr['fragment'].replace( fragment_parser, function ( $0, $1, $2 ){
			if ($1)
			{
				uri.param['fragment'][$1] = $2;
			}
		});
				
		// split path and fragement into segments
		
        uri.seg['path'] = uri.attr.path.replace(/^\/+|\/+$/g,'').split('/');
        
        uri.seg['fragment'] = uri.attr.fragment.replace(/^\/+|\/+$/g,'').split('/');
        
        // compile a 'base' domain attribute
        
        uri.attr['base'] = uri.attr.host ? uri.attr.protocol+"://"+uri.attr.host + (uri.attr.port ? ":"+uri.attr.port : '') : '';
        
		return uri;
	};
	
	function getAttrName( elm )
	{
		var tn = elm.tagName;
		if ( tn !== undefined ) return tag2attr[tn.toLowerCase()];
		return tn;
	}
	
	$.fn.url = function( strictMode )
	{
	    var url = '';
	    
	    if ( this.length )
	    {
	        url = $(this).attr( getAttrName(this[0]) ) || '';
	    }
	    
        return $.url( url, strictMode );
	};
	
	$.url = function( url, strictMode )
	{
	    if ( arguments.length === 1 && url === true )
        {
            strictMode = true;
            url = undefined;
        }
        
        strictMode = strictMode || false;
        url = url || window.location.toString();
        	    	            
        return {
            
            data : parseUri(url, strictMode),
            
            // get various attributes from the URI
            attr : function( attr )
            {
                attr = aliases[attr] || attr;
                return attr !== undefined ? this.data.attr[attr] : this.data.attr;
            },
            
            // return query string parameters
            param : function( param )
            {
                return param !== undefined ? this.data.param.query[param] : this.data.param.query;
            },
            
            // return fragment parameters
            fparam : function( param )
            {
                return param !== undefined ? this.data.param.fragment[param] : this.data.param.fragment;
            },
            
            // return path segments
            segment : function( seg )
            {
                if ( seg === undefined )
                {
                    return this.data.seg.path;                    
                }
                else
                {
                    seg = seg < 0 ? this.data.seg.path.length + seg : seg - 1; // negative segments count from the end
                    return this.data.seg.path[seg];                    
                }
            },
            
            // return fragment segments
            fsegment : function( seg )
            {
                if ( seg === undefined )
                {
                    return this.data.seg.fragment;                    
                }
                else
                {
                    seg = seg < 0 ? this.data.seg.fragment.length + seg : seg - 1; // negative segments count from the end
                    return this.data.seg.fragment[seg];                    
                }
            }
            
        };
        
	};
	
})(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);
	});
});

