/*
 * jQuery 1.2.6 - New Wave Javascript
 *
 * Copyright (c) 2008 John Resig (jquery.com)
 * Dual licensed under the MIT (MIT-LICENSE.txt)
 * and GPL (GPL-LICENSE.txt) licenses.
 *
 * $Date: 2008-05-24 14:22:17 -0400 (Sat, 24 May 2008) $
 * $Rev: 5685 $
 */
(function(){var _jQuery=window.jQuery,_$=window.$;var jQuery=window.jQuery=window.$=function(selector,context){return new jQuery.fn.init(selector,context);};var quickExpr=/^[^<]*(<(.|\s)+>)[^>]*$|^#(\w+)$/,isSimple=/^.[^:#\[\.]*$/,undefined;jQuery.fn=jQuery.prototype={init:function(selector,context){selector=selector||document;if(selector.nodeType){this[0]=selector;this.length=1;return this;}if(typeof selector=="string"){var match=quickExpr.exec(selector);if(match&&(match[1]||!context)){if(match[1])selector=jQuery.clean([match[1]],context);else{var elem=document.getElementById(match[3]);if(elem){if(elem.id!=match[3])return jQuery().find(selector);return jQuery(elem);}selector=[];}}else
return jQuery(context).find(selector);}else if(jQuery.isFunction(selector))return jQuery(document)[jQuery.fn.ready?"ready":"load"](selector);return this.setArray(jQuery.makeArray(selector));},jquery:"1.2.6",size:function(){return this.length;},length:0,get:function(num){return num==undefined?jQuery.makeArray(this):this[num];},pushStack:function(elems){var ret=jQuery(elems);ret.prevObject=this;return ret;},setArray:function(elems){this.length=0;Array.prototype.push.apply(this,elems);return this;},each:function(callback,args){return jQuery.each(this,callback,args);},index:function(elem){var ret=-1;return jQuery.inArray(elem&&elem.jquery?elem[0]:elem,this);},attr:function(name,value,type){var options=name;if(name.constructor==String)if(value===undefined)return this[0]&&jQuery[type||"attr"](this[0],name);else{options={};options[name]=value;}return this.each(function(i){for(name in options)jQuery.attr(type?this.style:this,name,jQuery.prop(this,options[name],type,i,name));});},css:function(key,value){if((key=='width'||key=='height')&&parseFloat(value)<0)value=undefined;return this.attr(key,value,"curCSS");},text:function(text){if(typeof text!="object"&&text!=null)return this.empty().append((this[0]&&this[0].ownerDocument||document).createTextNode(text));var ret="";jQuery.each(text||this,function(){jQuery.each(this.childNodes,function(){if(this.nodeType!=8)ret+=this.nodeType!=1?this.nodeValue:jQuery.fn.text([this]);});});return ret;},wrapAll:function(html){if(this[0])jQuery(html,this[0].ownerDocument).clone().insertBefore(this[0]).map(function(){var elem=this;while(elem.firstChild)elem=elem.firstChild;return elem;}).append(this);return this;},wrapInner:function(html){return this.each(function(){jQuery(this).contents().wrapAll(html);});},wrap:function(html){return this.each(function(){jQuery(this).wrapAll(html);});},append:function(){return this.domManip(arguments,true,false,function(elem){if(this.nodeType==1)this.appendChild(elem);});},prepend:function(){return this.domManip(arguments,true,true,function(elem){if(this.nodeType==1)this.insertBefore(elem,this.firstChild);});},before:function(){return this.domManip(arguments,false,false,function(elem){this.parentNode.insertBefore(elem,this);});},after:function(){return this.domManip(arguments,false,true,function(elem){this.parentNode.insertBefore(elem,this.nextSibling);});},end:function(){return this.prevObject||jQuery([]);},find:function(selector){var elems=jQuery.map(this,function(elem){return jQuery.find(selector,elem);});return this.pushStack(/[^+>] [^+>]/.test(selector)||selector.indexOf("..")>-1?jQuery.unique(elems):elems);},clone:function(events){var ret=this.map(function(){if(jQuery.browser.msie&&!jQuery.isXMLDoc(this)){var clone=this.cloneNode(true),container=document.createElement("div");container.appendChild(clone);return jQuery.clean([container.innerHTML])[0];}else
return this.cloneNode(true);});var clone=ret.find("*").andSelf().each(function(){if(this[expando]!=undefined)this[expando]=null;});if(events===true)this.find("*").andSelf().each(function(i){if(this.nodeType==3)return;var events=jQuery.data(this,"events");for(var type in events)for(var handler in events[type])jQuery.event.add(clone[i],type,events[type][handler],events[type][handler].data);});return ret;},filter:function(selector){return this.pushStack(jQuery.isFunction(selector)&&jQuery.grep(this,function(elem,i){return selector.call(elem,i);})||jQuery.multiFilter(selector,this));},not:function(selector){if(selector.constructor==String)if(isSimple.test(selector))return this.pushStack(jQuery.multiFilter(selector,this,true));else
selector=jQuery.multiFilter(selector,this);var isArrayLike=selector.length&&selector[selector.length-1]!==undefined&&!selector.nodeType;return this.filter(function(){return isArrayLike?jQuery.inArray(this,selector)<0:this!=selector;});},add:function(selector){return this.pushStack(jQuery.unique(jQuery.merge(this.get(),typeof selector=='string'?jQuery(selector):jQuery.makeArray(selector))));},is:function(selector){return!!selector&&jQuery.multiFilter(selector,this).length>0;},hasClass:function(selector){return this.is("."+selector);},val:function(value){if(value==undefined){if(this.length){var elem=this[0];if(jQuery.nodeName(elem,"select")){var index=elem.selectedIndex,values=[],options=elem.options,one=elem.type=="select-one";if(index<0)return null;for(var i=one?index:0,max=one?index+1:options.length;i<max;i++){var option=options[i];if(option.selected){value=jQuery.browser.msie&&!option.attributes.value.specified?option.text:option.value;if(one)return value;values.push(value);}}return values;}else
return(this[0].value||"").replace(/\r/g,"");}return undefined;}if(value.constructor==Number)value+='';return this.each(function(){if(this.nodeType!=1)return;if(value.constructor==Array&&/radio|checkbox/.test(this.type))this.checked=(jQuery.inArray(this.value,value)>=0||jQuery.inArray(this.name,value)>=0);else if(jQuery.nodeName(this,"select")){var values=jQuery.makeArray(value);jQuery("option",this).each(function(){this.selected=(jQuery.inArray(this.value,values)>=0||jQuery.inArray(this.text,values)>=0);});if(!values.length)this.selectedIndex=-1;}else
this.value=value;});},html:function(value){return value==undefined?(this[0]?this[0].innerHTML:null):this.empty().append(value);},replaceWith:function(value){return this.after(value).remove();},eq:function(i){return this.slice(i,i+1);},slice:function(){return this.pushStack(Array.prototype.slice.apply(this,arguments));},map:function(callback){return this.pushStack(jQuery.map(this,function(elem,i){return callback.call(elem,i,elem);}));},andSelf:function(){return this.add(this.prevObject);},data:function(key,value){var parts=key.split(".");parts[1]=parts[1]?"."+parts[1]:"";if(value===undefined){var data=this.triggerHandler("getData"+parts[1]+"!",[parts[0]]);if(data===undefined&&this.length)data=jQuery.data(this[0],key);return data===undefined&&parts[1]?this.data(parts[0]):data;}else
return this.trigger("setData"+parts[1]+"!",[parts[0],value]).each(function(){jQuery.data(this,key,value);});},removeData:function(key){return this.each(function(){jQuery.removeData(this,key);});},domManip:function(args,table,reverse,callback){var clone=this.length>1,elems;return this.each(function(){if(!elems){elems=jQuery.clean(args,this.ownerDocument);if(reverse)elems.reverse();}var obj=this;if(table&&jQuery.nodeName(this,"table")&&jQuery.nodeName(elems[0],"tr"))obj=this.getElementsByTagName("tbody")[0]||this.appendChild(this.ownerDocument.createElement("tbody"));var scripts=jQuery([]);jQuery.each(elems,function(){var elem=clone?jQuery(this).clone(true)[0]:this;if(jQuery.nodeName(elem,"script"))scripts=scripts.add(elem);else{if(elem.nodeType==1)scripts=scripts.add(jQuery("script",elem).remove());callback.call(obj,elem);}});scripts.each(evalScript);});}};jQuery.fn.init.prototype=jQuery.fn;function evalScript(i,elem){if(elem.src)jQuery.ajax({url:elem.src,async:false,dataType:"script"});else
jQuery.globalEval(elem.text||elem.textContent||elem.innerHTML||"");if(elem.parentNode)elem.parentNode.removeChild(elem);}function now(){return+new Date;}jQuery.extend=jQuery.fn.extend=function(){var target=arguments[0]||{},i=1,length=arguments.length,deep=false,options;if(target.constructor==Boolean){deep=target;target=arguments[1]||{};i=2;}if(typeof target!="object"&&typeof target!="function")target={};if(length==i){target=this;--i;}for(;i<length;i++)if((options=arguments[i])!=null)for(var name in options){var src=target[name],copy=options[name];if(target===copy)continue;if(deep&&copy&&typeof copy=="object"&&!copy.nodeType)target[name]=jQuery.extend(deep,src||(copy.length!=null?[]:{}),copy);else if(copy!==undefined)target[name]=copy;}return target;};var expando="jQuery"+now(),uuid=0,windowData={},exclude=/z-?index|font-?weight|opacity|zoom|line-?height/i,defaultView=document.defaultView||{};jQuery.extend({noConflict:function(deep){window.$=_$;if(deep)window.jQuery=_jQuery;return jQuery;},isFunction:function(fn){return!!fn&&typeof fn!="string"&&!fn.nodeName&&fn.constructor!=Array&&/^[\s[]?function/.test(fn+"");},isXMLDoc:function(elem){return elem.documentElement&&!elem.body||elem.tagName&&elem.ownerDocument&&!elem.ownerDocument.body;},globalEval:function(data){data=jQuery.trim(data);if(data){var head=document.getElementsByTagName("head")[0]||document.documentElement,script=document.createElement("script");script.type="text/javascript";if(jQuery.browser.msie)script.text=data;else
script.appendChild(document.createTextNode(data));head.insertBefore(script,head.firstChild);head.removeChild(script);}},nodeName:function(elem,name){return elem.nodeName&&elem.nodeName.toUpperCase()==name.toUpperCase();},cache:{},data:function(elem,name,data){elem=elem==window?windowData:elem;var id=elem[expando];if(!id)id=elem[expando]=++uuid;if(name&&!jQuery.cache[id])jQuery.cache[id]={};if(data!==undefined)jQuery.cache[id][name]=data;return name?jQuery.cache[id][name]:id;},removeData:function(elem,name){elem=elem==window?windowData:elem;var id=elem[expando];if(name){if(jQuery.cache[id]){delete jQuery.cache[id][name];name="";for(name in jQuery.cache[id])break;if(!name)jQuery.removeData(elem);}}else{try{delete elem[expando];}catch(e){if(elem.removeAttribute)elem.removeAttribute(expando);}delete jQuery.cache[id];}},each:function(object,callback,args){var name,i=0,length=object.length;if(args){if(length==undefined){for(name in object)if(callback.apply(object[name],args)===false)break;}else
for(;i<length;)if(callback.apply(object[i++],args)===false)break;}else{if(length==undefined){for(name in object)if(callback.call(object[name],name,object[name])===false)break;}else
for(var value=object[0];i<length&&callback.call(value,i,value)!==false;value=object[++i]){}}return object;},prop:function(elem,value,type,i,name){if(jQuery.isFunction(value))value=value.call(elem,i);return value&&value.constructor==Number&&type=="curCSS"&&!exclude.test(name)?value+"px":value;},className:{add:function(elem,classNames){jQuery.each((classNames||"").split(/\s+/),function(i,className){if(elem.nodeType==1&&!jQuery.className.has(elem.className,className))elem.className+=(elem.className?" ":"")+className;});},remove:function(elem,classNames){if(elem.nodeType==1)elem.className=classNames!=undefined?jQuery.grep(elem.className.split(/\s+/),function(className){return!jQuery.className.has(classNames,className);}).join(" "):"";},has:function(elem,className){return jQuery.inArray(className,(elem.className||elem).toString().split(/\s+/))>-1;}},swap:function(elem,options,callback){var old={};for(var name in options){old[name]=elem.style[name];elem.style[name]=options[name];}callback.call(elem);for(var name in options)elem.style[name]=old[name];},css:function(elem,name,force){if(name=="width"||name=="height"){var val,props={position:"absolute",visibility:"hidden",display:"block"},which=name=="width"?["Left","Right"]:["Top","Bottom"];function getWH(){val=name=="width"?elem.offsetWidth:elem.offsetHeight;var padding=0,border=0;jQuery.each(which,function(){padding+=parseFloat(jQuery.curCSS(elem,"padding"+this,true))||0;border+=parseFloat(jQuery.curCSS(elem,"border"+this+"Width",true))||0;});val-=Math.round(padding+border);}if(jQuery(elem).is(":visible"))getWH();else
jQuery.swap(elem,props,getWH);return Math.max(0,val);}return jQuery.curCSS(elem,name,force);},curCSS:function(elem,name,force){var ret,style=elem.style;function color(elem){if(!jQuery.browser.safari)return false;var ret=defaultView.getComputedStyle(elem,null);return!ret||ret.getPropertyValue("color")=="";}if(name=="opacity"&&jQuery.browser.msie){ret=jQuery.attr(style,"opacity");return ret==""?"1":ret;}if(jQuery.browser.opera&&name=="display"){var save=style.outline;style.outline="0 solid black";style.outline=save;}if(name.match(/float/i))name=styleFloat;if(!force&&style&&style[name])ret=style[name];else if(defaultView.getComputedStyle){if(name.match(/float/i))name="float";name=name.replace(/([A-Z])/g,"-$1").toLowerCase();var computedStyle=defaultView.getComputedStyle(elem,null);if(computedStyle&&!color(elem))ret=computedStyle.getPropertyValue(name);else{var swap=[],stack=[],a=elem,i=0;for(;a&&color(a);a=a.parentNode)stack.unshift(a);for(;i<stack.length;i++)if(color(stack[i])){swap[i]=stack[i].style.display;stack[i].style.display="block";}ret=name=="display"&&swap[stack.length-1]!=null?"none":(computedStyle&&computedStyle.getPropertyValue(name))||"";for(i=0;i<swap.length;i++)if(swap[i]!=null)stack[i].style.display=swap[i];}if(name=="opacity"&&ret=="")ret="1";}else if(elem.currentStyle){var camelCase=name.replace(/\-(\w)/g,function(all,letter){return letter.toUpperCase();});ret=elem.currentStyle[name]||elem.currentStyle[camelCase];if(!/^\d+(px)?$/i.test(ret)&&/^\d/.test(ret)){var left=style.left,rsLeft=elem.runtimeStyle.left;elem.runtimeStyle.left=elem.currentStyle.left;style.left=ret||0;ret=style.pixelLeft+"px";style.left=left;elem.runtimeStyle.left=rsLeft;}}return ret;},clean:function(elems,context){var ret=[];context=context||document;if(typeof context.createElement=='undefined')context=context.ownerDocument||context[0]&&context[0].ownerDocument||document;jQuery.each(elems,function(i,elem){if(!elem)return;if(elem.constructor==Number)elem+='';if(typeof elem=="string"){elem=elem.replace(/(<(\w+)[^>]*?)\/>/g,function(all,front,tag){return tag.match(/^(abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i)?all:front+"></"+tag+">";});var tags=jQuery.trim(elem).toLowerCase(),div=context.createElement("div");var wrap=!tags.indexOf("<opt")&&[1,"<select multiple='multiple'>","</select>"]||!tags.indexOf("<leg")&&[1,"<fieldset>","</fieldset>"]||tags.match(/^<(thead|tbody|tfoot|colg|cap)/)&&[1,"<table>","</table>"]||!tags.indexOf("<tr")&&[2,"<table><tbody>","</tbody></table>"]||(!tags.indexOf("<td")||!tags.indexOf("<th"))&&[3,"<table><tbody><tr>","</tr></tbody></table>"]||!tags.indexOf("<col")&&[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"]||jQuery.browser.msie&&[1,"div<div>","</div>"]||[0,"",""];div.innerHTML=wrap[1]+elem+wrap[2];while(wrap[0]--)div=div.lastChild;if(jQuery.browser.msie){var tbody=!tags.indexOf("<table")&&tags.indexOf("<tbody")<0?div.firstChild&&div.firstChild.childNodes:wrap[1]=="<table>"&&tags.indexOf("<tbody")<0?div.childNodes:[];for(var j=tbody.length-1;j>=0;--j)if(jQuery.nodeName(tbody[j],"tbody")&&!tbody[j].childNodes.length)tbody[j].parentNode.removeChild(tbody[j]);if(/^\s/.test(elem))div.insertBefore(context.createTextNode(elem.match(/^\s*/)[0]),div.firstChild);}elem=jQuery.makeArray(div.childNodes);}if(elem.length===0&&(!jQuery.nodeName(elem,"form")&&!jQuery.nodeName(elem,"select")))return;if(elem[0]==undefined||jQuery.nodeName(elem,"form")||elem.options)ret.push(elem);else
ret=jQuery.merge(ret,elem);});return ret;},attr:function(elem,name,value){if(!elem||elem.nodeType==3||elem.nodeType==8)return undefined;var notxml=!jQuery.isXMLDoc(elem),set=value!==undefined,msie=jQuery.browser.msie;name=notxml&&jQuery.props[name]||name;if(elem.tagName){var special=/href|src|style/.test(name);if(name=="selected"&&jQuery.browser.safari)elem.parentNode.selectedIndex;if(name in elem&&notxml&&!special){if(set){if(name=="type"&&jQuery.nodeName(elem,"input")&&elem.parentNode)throw"type property can't be changed";elem[name]=value;}if(jQuery.nodeName(elem,"form")&&elem.getAttributeNode(name))return elem.getAttributeNode(name).nodeValue;return elem[name];}if(msie&&notxml&&name=="style")return jQuery.attr(elem.style,"cssText",value);if(set)elem.setAttribute(name,""+value);var attr=msie&&notxml&&special?elem.getAttribute(name,2):elem.getAttribute(name);return attr===null?undefined:attr;}if(msie&&name=="opacity"){if(set){elem.zoom=1;elem.filter=(elem.filter||"").replace(/alpha\([^)]*\)/,"")+(parseInt(value)+''=="NaN"?"":"alpha(opacity="+value*100+")");}return elem.filter&&elem.filter.indexOf("opacity=")>=0?(parseFloat(elem.filter.match(/opacity=([^)]*)/)[1])/100)+'':"";}name=name.replace(/-([a-z])/ig,function(all,letter){return letter.toUpperCase();});if(set)elem[name]=value;return elem[name];},trim:function(text){return(text||"").replace(/^\s+|\s+$/g,"");},makeArray:function(array){var ret=[];if(array!=null){var i=array.length;if(i==null||array.split||array.setInterval||array.call)ret[0]=array;else
while(i)ret[--i]=array[i];}return ret;},inArray:function(elem,array){for(var i=0,length=array.length;i<length;i++)if(array[i]===elem)return i;return-1;},merge:function(first,second){var i=0,elem,pos=first.length;if(jQuery.browser.msie){while(elem=second[i++])if(elem.nodeType!=8)first[pos++]=elem;}else
while(elem=second[i++])first[pos++]=elem;return first;},unique:function(array){var ret=[],done={};try{for(var i=0,length=array.length;i<length;i++){var id=jQuery.data(array[i]);if(!done[id]){done[id]=true;ret.push(array[i]);}}}catch(e){ret=array;}return ret;},grep:function(elems,callback,inv){var ret=[];for(var i=0,length=elems.length;i<length;i++)if(!inv!=!callback(elems[i],i))ret.push(elems[i]);return ret;},map:function(elems,callback){var ret=[];for(var i=0,length=elems.length;i<length;i++){var value=callback(elems[i],i);if(value!=null)ret[ret.length]=value;}return ret.concat.apply([],ret);}});var userAgent=navigator.userAgent.toLowerCase();jQuery.browser={version:(userAgent.match(/.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/)||[])[1],safari:/webkit/.test(userAgent),opera:/opera/.test(userAgent),msie:/msie/.test(userAgent)&&!/opera/.test(userAgent),mozilla:/mozilla/.test(userAgent)&&!/(compatible|webkit)/.test(userAgent)};var styleFloat=jQuery.browser.msie?"styleFloat":"cssFloat";jQuery.extend({boxModel:!jQuery.browser.msie||document.compatMode=="CSS1Compat",props:{"for":"htmlFor","class":"className","float":styleFloat,cssFloat:styleFloat,styleFloat:styleFloat,readonly:"readOnly",maxlength:"maxLength",cellspacing:"cellSpacing"}});jQuery.each({parent:function(elem){return elem.parentNode;},parents:function(elem){return jQuery.dir(elem,"parentNode");},next:function(elem){return jQuery.nth(elem,2,"nextSibling");},prev:function(elem){return jQuery.nth(elem,2,"previousSibling");},nextAll:function(elem){return jQuery.dir(elem,"nextSibling");},prevAll:function(elem){return jQuery.dir(elem,"previousSibling");},siblings:function(elem){return jQuery.sibling(elem.parentNode.firstChild,elem);},children:function(elem){return jQuery.sibling(elem.firstChild);},contents:function(elem){return jQuery.nodeName(elem,"iframe")?elem.contentDocument||elem.contentWindow.document:jQuery.makeArray(elem.childNodes);}},function(name,fn){jQuery.fn[name]=function(selector){var ret=jQuery.map(this,fn);if(selector&&typeof selector=="string")ret=jQuery.multiFilter(selector,ret);return this.pushStack(jQuery.unique(ret));};});jQuery.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(name,original){jQuery.fn[name]=function(){var args=arguments;return this.each(function(){for(var i=0,length=args.length;i<length;i++)jQuery(args[i])[original](this);});};});jQuery.each({removeAttr:function(name){jQuery.attr(this,name,"");if(this.nodeType==1)this.removeAttribute(name);},addClass:function(classNames){jQuery.className.add(this,classNames);},removeClass:function(classNames){jQuery.className.remove(this,classNames);},toggleClass:function(classNames){jQuery.className[jQuery.className.has(this,classNames)?"remove":"add"](this,classNames);},remove:function(selector){if(!selector||jQuery.filter(selector,[this]).r.length){jQuery("*",this).add(this).each(function(){jQuery.event.remove(this);jQuery.removeData(this);});if(this.parentNode)this.parentNode.removeChild(this);}},empty:function(){jQuery(">*",this).remove();while(this.firstChild)this.removeChild(this.firstChild);}},function(name,fn){jQuery.fn[name]=function(){return this.each(fn,arguments);};});jQuery.each(["Height","Width"],function(i,name){var type=name.toLowerCase();jQuery.fn[type]=function(size){return this[0]==window?jQuery.browser.opera&&document.body["client"+name]||jQuery.browser.safari&&window["inner"+name]||document.compatMode=="CSS1Compat"&&document.documentElement["client"+name]||document.body["client"+name]:this[0]==document?Math.max(Math.max(document.body["scroll"+name],document.documentElement["scroll"+name]),Math.max(document.body["offset"+name],document.documentElement["offset"+name])):size==undefined?(this.length?jQuery.css(this[0],type):null):this.css(type,size.constructor==String?size:size+"px");};});function num(elem,prop){return elem[0]&&parseInt(jQuery.curCSS(elem[0],prop,true),10)||0;}var chars=jQuery.browser.safari&&parseInt(jQuery.browser.version)<417?"(?:[\\w*_-]|\\\\.)":"(?:[\\w\u0128-\uFFFF*_-]|\\\\.)",quickChild=new RegExp("^>\\s*("+chars+"+)"),quickID=new RegExp("^("+chars+"+)(#)("+chars+"+)"),quickClass=new RegExp("^([#.]?)("+chars+"*)");jQuery.extend({expr:{"":function(a,i,m){return m[2]=="*"||jQuery.nodeName(a,m[2]);},"#":function(a,i,m){return a.getAttribute("id")==m[2];},":":{lt:function(a,i,m){return i<m[3]-0;},gt:function(a,i,m){return i>m[3]-0;},nth:function(a,i,m){return m[3]-0==i;},eq:function(a,i,m){return m[3]-0==i;},first:function(a,i){return i==0;},last:function(a,i,m,r){return i==r.length-1;},even:function(a,i){return i%2==0;},odd:function(a,i){return i%2;},"first-child":function(a){return a.parentNode.getElementsByTagName("*")[0]==a;},"last-child":function(a){return jQuery.nth(a.parentNode.lastChild,1,"previousSibling")==a;},"only-child":function(a){return!jQuery.nth(a.parentNode.lastChild,2,"previousSibling");},parent:function(a){return a.firstChild;},empty:function(a){return!a.firstChild;},contains:function(a,i,m){return(a.textContent||a.innerText||jQuery(a).text()||"").indexOf(m[3])>=0;},visible:function(a){return"hidden"!=a.type&&jQuery.css(a,"display")!="none"&&jQuery.css(a,"visibility")!="hidden";},hidden:function(a){return"hidden"==a.type||jQuery.css(a,"display")=="none"||jQuery.css(a,"visibility")=="hidden";},enabled:function(a){return!a.disabled;},disabled:function(a){return a.disabled;},checked:function(a){return a.checked;},selected:function(a){return a.selected||jQuery.attr(a,"selected");},text:function(a){return"text"==a.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||jQuery.nodeName(a,"button");},input:function(a){return/input|select|textarea|button/i.test(a.nodeName);},has:function(a,i,m){return jQuery.find(m[3],a).length;},header:function(a){return/h\d/i.test(a.nodeName);},animated:function(a){return jQuery.grep(jQuery.timers,function(fn){return a==fn.elem;}).length;}}},parse:[/^(\[) *@?([\w-]+) *([!*$^~=]*) *('?"?)(.*?)\4 *\]/,/^(:)([\w-]+)\("?'?(.*?(\(.*?\))?[^(]*?)"?'?\)/,new RegExp("^([:.#]*)("+chars+"+)")],multiFilter:function(expr,elems,not){var old,cur=[];while(expr&&expr!=old){old=expr;var f=jQuery.filter(expr,elems,not);expr=f.t.replace(/^\s*,\s*/,"");cur=not?elems=f.r:jQuery.merge(cur,f.r);}return cur;},find:function(t,context){if(typeof t!="string")return[t];if(context&&context.nodeType!=1&&context.nodeType!=9)return[];context=context||document;var ret=[context],done=[],last,nodeName;while(t&&last!=t){var r=[];last=t;t=jQuery.trim(t);var foundToken=false,re=quickChild,m=re.exec(t);if(m){nodeName=m[1].toUpperCase();for(var i=0;ret[i];i++)for(var c=ret[i].firstChild;c;c=c.nextSibling)if(c.nodeType==1&&(nodeName=="*"||c.nodeName.toUpperCase()==nodeName))r.push(c);ret=r;t=t.replace(re,"");if(t.indexOf(" ")==0)continue;foundToken=true;}else{re=/^([>+~])\s*(\w*)/i;if((m=re.exec(t))!=null){r=[];var merge={};nodeName=m[2].toUpperCase();m=m[1];for(var j=0,rl=ret.length;j<rl;j++){var n=m=="~"||m=="+"?ret[j].nextSibling:ret[j].firstChild;for(;n;n=n.nextSibling)if(n.nodeType==1){var id=jQuery.data(n);if(m=="~"&&merge[id])break;if(!nodeName||n.nodeName.toUpperCase()==nodeName){if(m=="~")merge[id]=true;r.push(n);}if(m=="+")break;}}ret=r;t=jQuery.trim(t.replace(re,""));foundToken=true;}}if(t&&!foundToken){if(!t.indexOf(",")){if(context==ret[0])ret.shift();done=jQuery.merge(done,ret);r=ret=[context];t=" "+t.substr(1,t.length);}else{var re2=quickID;var m=re2.exec(t);if(m){m=[0,m[2],m[3],m[1]];}else{re2=quickClass;m=re2.exec(t);}m[2]=m[2].replace(/\\/g,"");var elem=ret[ret.length-1];if(m[1]=="#"&&elem&&elem.getElementById&&!jQuery.isXMLDoc(elem)){var oid=elem.getElementById(m[2]);if((jQuery.browser.msie||jQuery.browser.opera)&&oid&&typeof oid.id=="string"&&oid.id!=m[2])oid=jQuery('[@id="'+m[2]+'"]',elem)[0];ret=r=oid&&(!m[3]||jQuery.nodeName(oid,m[3]))?[oid]:[];}else{for(var i=0;ret[i];i++){var tag=m[1]=="#"&&m[3]?m[3]:m[1]!=""||m[0]==""?"*":m[2];if(tag=="*"&&ret[i].nodeName.toLowerCase()=="object")tag="param";r=jQuery.merge(r,ret[i].getElementsByTagName(tag));}if(m[1]==".")r=jQuery.classFilter(r,m[2]);if(m[1]=="#"){var tmp=[];for(var i=0;r[i];i++)if(r[i].getAttribute("id")==m[2]){tmp=[r[i]];break;}r=tmp;}ret=r;}t=t.replace(re2,"");}}if(t){var val=jQuery.filter(t,r);ret=r=val.r;t=jQuery.trim(val.t);}}if(t)ret=[];if(ret&&context==ret[0])ret.shift();done=jQuery.merge(done,ret);return done;},classFilter:function(r,m,not){m=" "+m+" ";var tmp=[];for(var i=0;r[i];i++){var pass=(" "+r[i].className+" ").indexOf(m)>=0;if(!not&&pass||not&&!pass)tmp.push(r[i]);}return tmp;},filter:function(t,r,not){var last;while(t&&t!=last){last=t;var p=jQuery.parse,m;for(var i=0;p[i];i++){m=p[i].exec(t);if(m){t=t.substring(m[0].length);m[2]=m[2].replace(/\\/g,"");break;}}if(!m)break;if(m[1]==":"&&m[2]=="not")r=isSimple.test(m[3])?jQuery.filter(m[3],r,true).r:jQuery(r).not(m[3]);else if(m[1]==".")r=jQuery.classFilter(r,m[2],not);else if(m[1]=="["){var tmp=[],type=m[3];for(var i=0,rl=r.length;i<rl;i++){var a=r[i],z=a[jQuery.props[m[2]]||m[2]];if(z==null||/href|src|selected/.test(m[2]))z=jQuery.attr(a,m[2])||'';if((type==""&&!!z||type=="="&&z==m[5]||type=="!="&&z!=m[5]||type=="^="&&z&&!z.indexOf(m[5])||type=="$="&&z.substr(z.length-m[5].length)==m[5]||(type=="*="||type=="~=")&&z.indexOf(m[5])>=0)^not)tmp.push(a);}r=tmp;}else if(m[1]==":"&&m[2]=="nth-child"){var merge={},tmp=[],test=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(m[3]=="even"&&"2n"||m[3]=="odd"&&"2n+1"||!/\D/.test(m[3])&&"0n+"+m[3]||m[3]),first=(test[1]+(test[2]||1))-0,last=test[3]-0;for(var i=0,rl=r.length;i<rl;i++){var node=r[i],parentNode=node.parentNode,id=jQuery.data(parentNode);if(!merge[id]){var c=1;for(var n=parentNode.firstChild;n;n=n.nextSibling)if(n.nodeType==1)n.nodeIndex=c++;merge[id]=true;}var add=false;if(first==0){if(node.nodeIndex==last)add=true;}else if((node.nodeIndex-last)%first==0&&(node.nodeIndex-last)/first>=0)add=true;if(add^not)tmp.push(node);}r=tmp;}else{var fn=jQuery.expr[m[1]];if(typeof fn=="object")fn=fn[m[2]];if(typeof fn=="string")fn=eval("false||function(a,i){return "+fn+";}");r=jQuery.grep(r,function(elem,i){return fn(elem,i,m,r);},not);}}return{r:r,t:t};},dir:function(elem,dir){var matched=[],cur=elem[dir];while(cur&&cur!=document){if(cur.nodeType==1)matched.push(cur);cur=cur[dir];}return matched;},nth:function(cur,result,dir,elem){result=result||1;var num=0;for(;cur;cur=cur[dir])if(cur.nodeType==1&&++num==result)break;return cur;},sibling:function(n,elem){var r=[];for(;n;n=n.nextSibling){if(n.nodeType==1&&n!=elem)r.push(n);}return r;}});jQuery.event={add:function(elem,types,handler,data){if(elem.nodeType==3||elem.nodeType==8)return;if(jQuery.browser.msie&&elem.setInterval)elem=window;if(!handler.guid)handler.guid=this.guid++;if(data!=undefined){var fn=handler;handler=this.proxy(fn,function(){return fn.apply(this,arguments);});handler.data=data;}var events=jQuery.data(elem,"events")||jQuery.data(elem,"events",{}),handle=jQuery.data(elem,"handle")||jQuery.data(elem,"handle",function(){if(typeof jQuery!="undefined"&&!jQuery.event.triggered)return jQuery.event.handle.apply(arguments.callee.elem,arguments);});handle.elem=elem;jQuery.each(types.split(/\s+/),function(index,type){var parts=type.split(".");type=parts[0];handler.type=parts[1];var handlers=events[type];if(!handlers){handlers=events[type]={};if(!jQuery.event.special[type]||jQuery.event.special[type].setup.call(elem)===false){if(elem.addEventListener)elem.addEventListener(type,handle,false);else if(elem.attachEvent)elem.attachEvent("on"+type,handle);}}handlers[handler.guid]=handler;jQuery.event.global[type]=true;});elem=null;},guid:1,global:{},remove:function(elem,types,handler){if(elem.nodeType==3||elem.nodeType==8)return;var events=jQuery.data(elem,"events"),ret,index;if(events){if(types==undefined||(typeof types=="string"&&types.charAt(0)=="."))for(var type in events)this.remove(elem,type+(types||""));else{if(types.type){handler=types.handler;types=types.type;}jQuery.each(types.split(/\s+/),function(index,type){var parts=type.split(".");type=parts[0];if(events[type]){if(handler)delete events[type][handler.guid];else
for(handler in events[type])if(!parts[1]||events[type][handler].type==parts[1])delete events[type][handler];for(ret in events[type])break;if(!ret){if(!jQuery.event.special[type]||jQuery.event.special[type].teardown.call(elem)===false){if(elem.removeEventListener)elem.removeEventListener(type,jQuery.data(elem,"handle"),false);else if(elem.detachEvent)elem.detachEvent("on"+type,jQuery.data(elem,"handle"));}ret=null;delete events[type];}}});}for(ret in events)break;if(!ret){var handle=jQuery.data(elem,"handle");if(handle)handle.elem=null;jQuery.removeData(elem,"events");jQuery.removeData(elem,"handle");}}},trigger:function(type,data,elem,donative,extra){data=jQuery.makeArray(data);if(type.indexOf("!")>=0){type=type.slice(0,-1);var exclusive=true;}if(!elem){if(this.global[type])jQuery("*").add([window,document]).trigger(type,data);}else{if(elem.nodeType==3||elem.nodeType==8)return undefined;var val,ret,fn=jQuery.isFunction(elem[type]||null),event=!data[0]||!data[0].preventDefault;if(event){data.unshift({type:type,target:elem,preventDefault:function(){},stopPropagation:function(){},timeStamp:now()});data[0][expando]=true;}data[0].type=type;if(exclusive)data[0].exclusive=true;var handle=jQuery.data(elem,"handle");if(handle)val=handle.apply(elem,data);if((!fn||(jQuery.nodeName(elem,'a')&&type=="click"))&&elem["on"+type]&&elem["on"+type].apply(elem,data)===false)val=false;if(event)data.shift();if(extra&&jQuery.isFunction(extra)){ret=extra.apply(elem,val==null?data:data.concat(val));if(ret!==undefined)val=ret;}if(fn&&donative!==false&&val!==false&&!(jQuery.nodeName(elem,'a')&&type=="click")){this.triggered=true;try{elem[type]();}catch(e){}}this.triggered=false;}return val;},handle:function(event){var val,ret,namespace,all,handlers;event=arguments[0]=jQuery.event.fix(event||window.event);namespace=event.type.split(".");event.type=namespace[0];namespace=namespace[1];all=!namespace&&!event.exclusive;handlers=(jQuery.data(this,"events")||{})[event.type];for(var j in handlers){var handler=handlers[j];if(all||handler.type==namespace){event.handler=handler;event.data=handler.data;ret=handler.apply(this,arguments);if(val!==false)val=ret;if(ret===false){event.preventDefault();event.stopPropagation();}}}return val;},fix:function(event){if(event[expando]==true)return event;var originalEvent=event;event={originalEvent:originalEvent};var props="altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode metaKey newValue originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target timeStamp toElement type view wheelDelta which".split(" ");for(var i=props.length;i;i--)event[props[i]]=originalEvent[props[i]];event[expando]=true;event.preventDefault=function(){if(originalEvent.preventDefault)originalEvent.preventDefault();originalEvent.returnValue=false;};event.stopPropagation=function(){if(originalEvent.stopPropagation)originalEvent.stopPropagation();originalEvent.cancelBubble=true;};event.timeStamp=event.timeStamp||now();if(!event.target)event.target=event.srcElement||document;if(event.target.nodeType==3)event.target=event.target.parentNode;if(!event.relatedTarget&&event.fromElement)event.relatedTarget=event.fromElement==event.target?event.toElement:event.fromElement;if(event.pageX==null&&event.clientX!=null){var doc=document.documentElement,body=document.body;event.pageX=event.clientX+(doc&&doc.scrollLeft||body&&body.scrollLeft||0)-(doc.clientLeft||0);event.pageY=event.clientY+(doc&&doc.scrollTop||body&&body.scrollTop||0)-(doc.clientTop||0);}if(!event.which&&((event.charCode||event.charCode===0)?event.charCode:event.keyCode))event.which=event.charCode||event.keyCode;if(!event.metaKey&&event.ctrlKey)event.metaKey=event.ctrlKey;if(!event.which&&event.button)event.which=(event.button&1?1:(event.button&2?3:(event.button&4?2:0)));return event;},proxy:function(fn,proxy){proxy.guid=fn.guid=fn.guid||proxy.guid||this.guid++;return proxy;},special:{ready:{setup:function(){bindReady();return;},teardown:function(){return;}},mouseenter:{setup:function(){if(jQuery.browser.msie)return false;jQuery(this).bind("mouseover",jQuery.event.special.mouseenter.handler);return true;},teardown:function(){if(jQuery.browser.msie)return false;jQuery(this).unbind("mouseover",jQuery.event.special.mouseenter.handler);return true;},handler:function(event){if(withinElement(event,this))return true;event.type="mouseenter";return jQuery.event.handle.apply(this,arguments);}},mouseleave:{setup:function(){if(jQuery.browser.msie)return false;jQuery(this).bind("mouseout",jQuery.event.special.mouseleave.handler);return true;},teardown:function(){if(jQuery.browser.msie)return false;jQuery(this).unbind("mouseout",jQuery.event.special.mouseleave.handler);return true;},handler:function(event){if(withinElement(event,this))return true;event.type="mouseleave";return jQuery.event.handle.apply(this,arguments);}}}};jQuery.fn.extend({bind:function(type,data,fn){return type=="unload"?this.one(type,data,fn):this.each(function(){jQuery.event.add(this,type,fn||data,fn&&data);});},one:function(type,data,fn){var one=jQuery.event.proxy(fn||data,function(event){jQuery(this).unbind(event,one);return(fn||data).apply(this,arguments);});return this.each(function(){jQuery.event.add(this,type,one,fn&&data);});},unbind:function(type,fn){return this.each(function(){jQuery.event.remove(this,type,fn);});},trigger:function(type,data,fn){return this.each(function(){jQuery.event.trigger(type,data,this,true,fn);});},triggerHandler:function(type,data,fn){return this[0]&&jQuery.event.trigger(type,data,this[0],false,fn);},toggle:function(fn){var args=arguments,i=1;while(i<args.length)jQuery.event.proxy(fn,args[i++]);return this.click(jQuery.event.proxy(fn,function(event){this.lastToggle=(this.lastToggle||0)%i;event.preventDefault();return args[this.lastToggle++].apply(this,arguments)||false;}));},hover:function(fnOver,fnOut){return this.bind('mouseenter',fnOver).bind('mouseleave',fnOut);},ready:function(fn){bindReady();if(jQuery.isReady)fn.call(document,jQuery);else
jQuery.readyList.push(function(){return fn.call(this,jQuery);});return this;}});jQuery.extend({isReady:false,readyList:[],ready:function(){if(!jQuery.isReady){jQuery.isReady=true;if(jQuery.readyList){jQuery.each(jQuery.readyList,function(){this.call(document);});jQuery.readyList=null;}jQuery(document).triggerHandler("ready");}}});var readyBound=false;function bindReady(){if(readyBound)return;readyBound=true;if(document.addEventListener&&!jQuery.browser.opera)document.addEventListener("DOMContentLoaded",jQuery.ready,false);if(jQuery.browser.msie&&window==top)(function(){if(jQuery.isReady)return;try{document.documentElement.doScroll("left");}catch(error){setTimeout(arguments.callee,0);return;}jQuery.ready();})();if(jQuery.browser.opera)document.addEventListener("DOMContentLoaded",function(){if(jQuery.isReady)return;for(var i=0;i<document.styleSheets.length;i++)if(document.styleSheets[i].disabled){setTimeout(arguments.callee,0);return;}jQuery.ready();},false);if(jQuery.browser.safari){var numStyles;(function(){if(jQuery.isReady)return;if(document.readyState!="loaded"&&document.readyState!="complete"){setTimeout(arguments.callee,0);return;}if(numStyles===undefined)numStyles=jQuery("style, link[rel=stylesheet]").length;if(document.styleSheets.length!=numStyles){setTimeout(arguments.callee,0);return;}jQuery.ready();})();}jQuery.event.add(window,"load",jQuery.ready);}jQuery.each(("blur,focus,load,resize,scroll,unload,click,dblclick,"+"mousedown,mouseup,mousemove,mouseover,mouseout,change,select,"+"submit,keydown,keypress,keyup,error").split(","),function(i,name){jQuery.fn[name]=function(fn){return fn?this.bind(name,fn):this.trigger(name);};});var withinElement=function(event,elem){var parent=event.relatedTarget;while(parent&&parent!=elem)try{parent=parent.parentNode;}catch(error){parent=elem;}return parent==elem;};jQuery(window).bind("unload",function(){jQuery("*").add(document).unbind();});jQuery.fn.extend({_load:jQuery.fn.load,load:function(url,params,callback){if(typeof url!='string')return this._load(url);var off=url.indexOf(" ");if(off>=0){var selector=url.slice(off,url.length);url=url.slice(0,off);}callback=callback||function(){};var type="GET";if(params)if(jQuery.isFunction(params)){callback=params;params=null;}else{params=jQuery.param(params);type="POST";}var self=this;jQuery.ajax({url:url,type:type,dataType:"html",data:params,complete:function(res,status){if(status=="success"||status=="notmodified")self.html(selector?jQuery("<div/>").append(res.responseText.replace(/<script(.|\s)*?\/script>/g,"")).find(selector):res.responseText);self.each(callback,[res.responseText,status,res]);}});return this;},serialize:function(){return jQuery.param(this.serializeArray());},serializeArray:function(){return this.map(function(){return jQuery.nodeName(this,"form")?jQuery.makeArray(this.elements):this;}).filter(function(){return this.name&&!this.disabled&&(this.checked||/select|textarea/i.test(this.nodeName)||/text|hidden|password/i.test(this.type));}).map(function(i,elem){var val=jQuery(this).val();return val==null?null:val.constructor==Array?jQuery.map(val,function(val,i){return{name:elem.name,value:val};}):{name:elem.name,value:val};}).get();}});jQuery.each("ajaxStart,ajaxStop,ajaxComplete,ajaxError,ajaxSuccess,ajaxSend".split(","),function(i,o){jQuery.fn[o]=function(f){return this.bind(o,f);};});var jsc=now();jQuery.extend({get:function(url,data,callback,type){if(jQuery.isFunction(data)){callback=data;data=null;}return jQuery.ajax({type:"GET",url:url,data:data,success:callback,dataType:type});},getScript:function(url,callback){return jQuery.get(url,null,callback,"script");},getJSON:function(url,data,callback){return jQuery.get(url,data,callback,"json");},post:function(url,data,callback,type){if(jQuery.isFunction(data)){callback=data;data={};}return jQuery.ajax({type:"POST",url:url,data:data,success:callback,dataType:type});},ajaxSetup:function(settings){jQuery.extend(jQuery.ajaxSettings,settings);},ajaxSettings:{url:location.href,global:true,type:"GET",timeout:0,contentType:"application/x-www-form-urlencoded",processData:true,async:true,data:null,username:null,password:null,accepts:{xml:"application/xml, text/xml",html:"text/html",script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},lastModified:{},ajax:function(s){s=jQuery.extend(true,s,jQuery.extend(true,{},jQuery.ajaxSettings,s));var jsonp,jsre=/=\?(&|$)/g,status,data,type=s.type.toUpperCase();if(s.data&&s.processData&&typeof s.data!="string")s.data=jQuery.param(s.data);if(s.dataType=="jsonp"){if(type=="GET"){if(!s.url.match(jsre))s.url+=(s.url.match(/\?/)?"&":"?")+(s.jsonp||"callback")+"=?";}else if(!s.data||!s.data.match(jsre))s.data=(s.data?s.data+"&":"")+(s.jsonp||"callback")+"=?";s.dataType="json";}if(s.dataType=="json"&&(s.data&&s.data.match(jsre)||s.url.match(jsre))){jsonp="jsonp"+jsc++;if(s.data)s.data=(s.data+"").replace(jsre,"="+jsonp+"$1");s.url=s.url.replace(jsre,"="+jsonp+"$1");s.dataType="script";window[jsonp]=function(tmp){data=tmp;success();complete();window[jsonp]=undefined;try{delete window[jsonp];}catch(e){}if(head)head.removeChild(script);};}if(s.dataType=="script"&&s.cache==null)s.cache=false;if(s.cache===false&&type=="GET"){var ts=now();var ret=s.url.replace(/(\?|&)_=.*?(&|$)/,"$1_="+ts+"$2");s.url=ret+((ret==s.url)?(s.url.match(/\?/)?"&":"?")+"_="+ts:"");}if(s.data&&type=="GET"){s.url+=(s.url.match(/\?/)?"&":"?")+s.data;s.data=null;}if(s.global&&!jQuery.active++)jQuery.event.trigger("ajaxStart");var remote=/^(?:\w+:)?\/\/([^\/?#]+)/;if(s.dataType=="script"&&type=="GET"&&remote.test(s.url)&&remote.exec(s.url)[1]!=location.host){var head=document.getElementsByTagName("head")[0];var script=document.createElement("script");script.src=s.url;if(s.scriptCharset)script.charset=s.scriptCharset;if(!jsonp){var done=false;script.onload=script.onreadystatechange=function(){if(!done&&(!this.readyState||this.readyState=="loaded"||this.readyState=="complete")){done=true;success();complete();head.removeChild(script);}};}head.appendChild(script);return undefined;}var requestDone=false;var xhr=window.ActiveXObject?new ActiveXObject("Microsoft.XMLHTTP"):new XMLHttpRequest();if(s.username)xhr.open(type,s.url,s.async,s.username,s.password);else
xhr.open(type,s.url,s.async);try{if(s.data)xhr.setRequestHeader("Content-Type",s.contentType);if(s.ifModified)xhr.setRequestHeader("If-Modified-Since",jQuery.lastModified[s.url]||"Thu, 01 Jan 1970 00:00:00 GMT");xhr.setRequestHeader("X-Requested-With","XMLHttpRequest");xhr.setRequestHeader("Accept",s.dataType&&s.accepts[s.dataType]?s.accepts[s.dataType]+", */*":s.accepts._default);}catch(e){}if(s.beforeSend&&s.beforeSend(xhr,s)===false){s.global&&jQuery.active--;xhr.abort();return false;}if(s.global)jQuery.event.trigger("ajaxSend",[xhr,s]);var onreadystatechange=function(isTimeout){if(!requestDone&&xhr&&(xhr.readyState==4||isTimeout=="timeout")){requestDone=true;if(ival){clearInterval(ival);ival=null;}status=isTimeout=="timeout"&&"timeout"||!jQuery.httpSuccess(xhr)&&"error"||s.ifModified&&jQuery.httpNotModified(xhr,s.url)&&"notmodified"||"success";if(status=="success"){try{data=jQuery.httpData(xhr,s.dataType,s.dataFilter);}catch(e){status="parsererror";}}if(status=="success"){var modRes;try{modRes=xhr.getResponseHeader("Last-Modified");}catch(e){}if(s.ifModified&&modRes)jQuery.lastModified[s.url]=modRes;if(!jsonp)success();}else
jQuery.handleError(s,xhr,status);complete();if(s.async)xhr=null;}};if(s.async){var ival=setInterval(onreadystatechange,13);if(s.timeout>0)setTimeout(function(){if(xhr){xhr.abort();if(!requestDone)onreadystatechange("timeout");}},s.timeout);}try{xhr.send(s.data);}catch(e){jQuery.handleError(s,xhr,null,e);}if(!s.async)onreadystatechange();function success(){if(s.success)s.success(data,status);if(s.global)jQuery.event.trigger("ajaxSuccess",[xhr,s]);}function complete(){if(s.complete)s.complete(xhr,status);if(s.global)jQuery.event.trigger("ajaxComplete",[xhr,s]);if(s.global&&!--jQuery.active)jQuery.event.trigger("ajaxStop");}return xhr;},handleError:function(s,xhr,status,e){if(s.error)s.error(xhr,status,e);if(s.global)jQuery.event.trigger("ajaxError",[xhr,s,e]);},active:0,httpSuccess:function(xhr){try{return!xhr.status&&location.protocol=="file:"||(xhr.status>=200&&xhr.status<300)||xhr.status==304||xhr.status==1223||jQuery.browser.safari&&xhr.status==undefined;}catch(e){}return false;},httpNotModified:function(xhr,url){try{var xhrRes=xhr.getResponseHeader("Last-Modified");return xhr.status==304||xhrRes==jQuery.lastModified[url]||jQuery.browser.safari&&xhr.status==undefined;}catch(e){}return false;},httpData:function(xhr,type,filter){var ct=xhr.getResponseHeader("content-type"),xml=type=="xml"||!type&&ct&&ct.indexOf("xml")>=0,data=xml?xhr.responseXML:xhr.responseText;if(xml&&data.documentElement.tagName=="parsererror")throw"parsererror";if(filter)data=filter(data,type);if(type=="script")jQuery.globalEval(data);if(type=="json")data=eval("("+data+")");return data;},param:function(a){var s=[];if(a.constructor==Array||a.jquery)jQuery.each(a,function(){s.push(encodeURIComponent(this.name)+"="+encodeURIComponent(this.value));});else
for(var j in a)if(a[j]&&a[j].constructor==Array)jQuery.each(a[j],function(){s.push(encodeURIComponent(j)+"="+encodeURIComponent(this));});else
s.push(encodeURIComponent(j)+"="+encodeURIComponent(jQuery.isFunction(a[j])?a[j]():a[j]));return s.join("&").replace(/%20/g,"+");}});jQuery.fn.extend({show:function(speed,callback){return speed?this.animate({height:"show",width:"show",opacity:"show"},speed,callback):this.filter(":hidden").each(function(){this.style.display=this.oldblock||"";if(jQuery.css(this,"display")=="none"){var elem=jQuery("<"+this.tagName+" />").appendTo("body");this.style.display=elem.css("display");if(this.style.display=="none")this.style.display="block";elem.remove();}}).end();},hide:function(speed,callback){return speed?this.animate({height:"hide",width:"hide",opacity:"hide"},speed,callback):this.filter(":visible").each(function(){this.oldblock=this.oldblock||jQuery.css(this,"display");this.style.display="none";}).end();},_toggle:jQuery.fn.toggle,toggle:function(fn,fn2){return jQuery.isFunction(fn)&&jQuery.isFunction(fn2)?this._toggle.apply(this,arguments):fn?this.animate({height:"toggle",width:"toggle",opacity:"toggle"},fn,fn2):this.each(function(){jQuery(this)[jQuery(this).is(":hidden")?"show":"hide"]();});},slideDown:function(speed,callback){return this.animate({height:"show"},speed,callback);},slideUp:function(speed,callback){return this.animate({height:"hide"},speed,callback);},slideToggle:function(speed,callback){return this.animate({height:"toggle"},speed,callback);},fadeIn:function(speed,callback){return this.animate({opacity:"show"},speed,callback);},fadeOut:function(speed,callback){return this.animate({opacity:"hide"},speed,callback);},fadeTo:function(speed,to,callback){return this.animate({opacity:to},speed,callback);},animate:function(prop,speed,easing,callback){var optall=jQuery.speed(speed,easing,callback);return this[optall.queue===false?"each":"queue"](function(){if(this.nodeType!=1)return false;var opt=jQuery.extend({},optall),p,hidden=jQuery(this).is(":hidden"),self=this;for(p in prop){if(prop[p]=="hide"&&hidden||prop[p]=="show"&&!hidden)return opt.complete.call(this);if(p=="height"||p=="width"){opt.display=jQuery.css(this,"display");opt.overflow=this.style.overflow;}}if(opt.overflow!=null)this.style.overflow="hidden";opt.curAnim=jQuery.extend({},prop);jQuery.each(prop,function(name,val){var e=new jQuery.fx(self,opt,name);if(/toggle|show|hide/.test(val))e[val=="toggle"?hidden?"show":"hide":val](prop);else{var parts=val.toString().match(/^([+-]=)?([\d+-.]+)(.*)$/),start=e.cur(true)||0;if(parts){var end=parseFloat(parts[2]),unit=parts[3]||"px";if(unit!="px"){self.style[name]=(end||1)+unit;start=((end||1)/e.cur(true))*start;self.style[name]=start+unit;}if(parts[1])end=((parts[1]=="-="?-1:1)*end)+start;e.custom(start,end,unit);}else
e.custom(start,val,"");}});return true;});},queue:function(type,fn){if(jQuery.isFunction(type)||(type&&type.constructor==Array)){fn=type;type="fx";}if(!type||(typeof type=="string"&&!fn))return queue(this[0],type);return this.each(function(){if(fn.constructor==Array)queue(this,type,fn);else{queue(this,type).push(fn);if(queue(this,type).length==1)fn.call(this);}});},stop:function(clearQueue,gotoEnd){var timers=jQuery.timers;if(clearQueue)this.queue([]);this.each(function(){for(var i=timers.length-1;i>=0;i--)if(timers[i].elem==this){if(gotoEnd)timers[i](true);timers.splice(i,1);}});if(!gotoEnd)this.dequeue();return this;}});var queue=function(elem,type,array){if(elem){type=type||"fx";var q=jQuery.data(elem,type+"queue");if(!q||array)q=jQuery.data(elem,type+"queue",jQuery.makeArray(array));}return q;};jQuery.fn.dequeue=function(type){type=type||"fx";return this.each(function(){var q=queue(this,type);q.shift();if(q.length)q[0].call(this);});};jQuery.extend({speed:function(speed,easing,fn){var opt=speed&&speed.constructor==Object?speed:{complete:fn||!fn&&easing||jQuery.isFunction(speed)&&speed,duration:speed,easing:fn&&easing||easing&&easing.constructor!=Function&&easing};opt.duration=(opt.duration&&opt.duration.constructor==Number?opt.duration:jQuery.fx.speeds[opt.duration])||jQuery.fx.speeds.def;opt.old=opt.complete;opt.complete=function(){if(opt.queue!==false)jQuery(this).dequeue();if(jQuery.isFunction(opt.old))opt.old.call(this);};return opt;},easing:{linear:function(p,n,firstNum,diff){return firstNum+diff*p;},swing:function(p,n,firstNum,diff){return((-Math.cos(p*Math.PI)/2)+0.5)*diff+firstNum;}},timers:[],timerId:null,fx:function(elem,options,prop){this.options=options;this.elem=elem;this.prop=prop;if(!options.orig)options.orig={};}});jQuery.fx.prototype={update:function(){if(this.options.step)this.options.step.call(this.elem,this.now,this);(jQuery.fx.step[this.prop]||jQuery.fx.step._default)(this);if(this.prop=="height"||this.prop=="width")this.elem.style.display="block";},cur:function(force){if(this.elem[this.prop]!=null&&this.elem.style[this.prop]==null)return this.elem[this.prop];var r=parseFloat(jQuery.css(this.elem,this.prop,force));return r&&r>-10000?r:parseFloat(jQuery.curCSS(this.elem,this.prop))||0;},custom:function(from,to,unit){this.startTime=now();this.start=from;this.end=to;this.unit=unit||this.unit||"px";this.now=this.start;this.pos=this.state=0;this.update();var self=this;function t(gotoEnd){return self.step(gotoEnd);}t.elem=this.elem;jQuery.timers.push(t);if(jQuery.timerId==null){jQuery.timerId=setInterval(function(){var timers=jQuery.timers;for(var i=0;i<timers.length;i++)if(!timers[i]())timers.splice(i--,1);if(!timers.length){clearInterval(jQuery.timerId);jQuery.timerId=null;}},13);}},show:function(){this.options.orig[this.prop]=jQuery.attr(this.elem.style,this.prop);this.options.show=true;this.custom(0,this.cur());if(this.prop=="width"||this.prop=="height")this.elem.style[this.prop]="1px";jQuery(this.elem).show();},hide:function(){this.options.orig[this.prop]=jQuery.attr(this.elem.style,this.prop);this.options.hide=true;this.custom(this.cur(),0);},step:function(gotoEnd){var t=now();if(gotoEnd||t>this.options.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;var done=true;for(var i in this.options.curAnim)if(this.options.curAnim[i]!==true)done=false;if(done){if(this.options.display!=null){this.elem.style.overflow=this.options.overflow;this.elem.style.display=this.options.display;if(jQuery.css(this.elem,"display")=="none")this.elem.style.display="block";}if(this.options.hide)this.elem.style.display="none";if(this.options.hide||this.options.show)for(var p in this.options.curAnim)jQuery.attr(this.elem.style,p,this.options.orig[p]);}if(done)this.options.complete.call(this.elem);return false;}else{var n=t-this.startTime;this.state=n/this.options.duration;this.pos=jQuery.easing[this.options.easing||(jQuery.easing.swing?"swing":"linear")](this.state,n,0,1,this.options.duration);this.now=this.start+((this.end-this.start)*this.pos);this.update();}return true;}};jQuery.extend(jQuery.fx,{speeds:{slow:600,fast:200,def:400},step:{scrollLeft:function(fx){fx.elem.scrollLeft=fx.now;},scrollTop:function(fx){fx.elem.scrollTop=fx.now;},opacity:function(fx){jQuery.attr(fx.elem.style,"opacity",fx.now);},_default:function(fx){fx.elem.style[fx.prop]=fx.now+fx.unit;}}});jQuery.fn.offset=function(){var left=0,top=0,elem=this[0],results;if(elem)with(jQuery.browser){var parent=elem.parentNode,offsetChild=elem,offsetParent=elem.offsetParent,doc=elem.ownerDocument,safari2=safari&&parseInt(version)<522&&!/adobeair/i.test(userAgent),css=jQuery.curCSS,fixed=css(elem,"position")=="fixed";if(elem.getBoundingClientRect){var box=elem.getBoundingClientRect();add(box.left+Math.max(doc.documentElement.scrollLeft,doc.body.scrollLeft),box.top+Math.max(doc.documentElement.scrollTop,doc.body.scrollTop));add(-doc.documentElement.clientLeft,-doc.documentElement.clientTop);}else{add(elem.offsetLeft,elem.offsetTop);while(offsetParent){add(offsetParent.offsetLeft,offsetParent.offsetTop);if(mozilla&&!/^t(able|d|h)$/i.test(offsetParent.tagName)||safari&&!safari2)border(offsetParent);if(!fixed&&css(offsetParent,"position")=="fixed")fixed=true;offsetChild=/^body$/i.test(offsetParent.tagName)?offsetChild:offsetParent;offsetParent=offsetParent.offsetParent;}while(parent&&parent.tagName&&!/^body|html$/i.test(parent.tagName)){if(!/^inline|table.*$/i.test(css(parent,"display")))add(-parent.scrollLeft,-parent.scrollTop);if(mozilla&&css(parent,"overflow")!="visible")border(parent);parent=parent.parentNode;}if((safari2&&(fixed||css(offsetChild,"position")=="absolute"))||(mozilla&&css(offsetChild,"position")!="absolute"))add(-doc.body.offsetLeft,-doc.body.offsetTop);if(fixed)add(Math.max(doc.documentElement.scrollLeft,doc.body.scrollLeft),Math.max(doc.documentElement.scrollTop,doc.body.scrollTop));}results={top:top,left:left};}function border(elem){add(jQuery.curCSS(elem,"borderLeftWidth",true),jQuery.curCSS(elem,"borderTopWidth",true));}function add(l,t){left+=parseInt(l,10)||0;top+=parseInt(t,10)||0;}return results;};jQuery.fn.extend({position:function(){var left=0,top=0,results;if(this[0]){var offsetParent=this.offsetParent(),offset=this.offset(),parentOffset=/^body|html$/i.test(offsetParent[0].tagName)?{top:0,left:0}:offsetParent.offset();offset.top-=num(this,'marginTop');offset.left-=num(this,'marginLeft');parentOffset.top+=num(offsetParent,'borderTopWidth');parentOffset.left+=num(offsetParent,'borderLeftWidth');results={top:offset.top-parentOffset.top,left:offset.left-parentOffset.left};}return results;},offsetParent:function(){var offsetParent=this[0].offsetParent;while(offsetParent&&(!/^body|html$/i.test(offsetParent.tagName)&&jQuery.css(offsetParent,'position')=='static'))offsetParent=offsetParent.offsetParent;return jQuery(offsetParent);}});jQuery.each(['Left','Top'],function(i,name){var method='scroll'+name;jQuery.fn[method]=function(val){if(!this[0])return;return val!=undefined?this.each(function(){this==window||this==document?window.scrollTo(!i?val:jQuery(window).scrollLeft(),i?val:jQuery(window).scrollTop()):this[method]=val;}):this[0]==window||this[0]==document?self[i?'pageYOffset':'pageXOffset']||jQuery.boxModel&&document.documentElement[method]||document.body[method]:this[0][method];};});jQuery.each(["Height","Width"],function(i,name){var tl=i?"Left":"Top",br=i?"Right":"Bottom";jQuery.fn["inner"+name]=function(){return this[name.toLowerCase()]()+num(this,"padding"+tl)+num(this,"padding"+br);};jQuery.fn["outer"+name]=function(margin){return this["inner"+name]()+num(this,"border"+tl+"Width")+num(this,"border"+br+"Width")+(margin?num(this,"margin"+tl)+num(this,"margin"+br):0);};});})();

(function($) {

	$.fn.roundize = function(options) {
		var o = $.extend({}, $.fn.roundize.defaults, options)


		o.imgclr = o.imgclr ? '-'+o.imgclr : ''
		if (!o.img)	 o.img = '/static/i/design/corn'+o.size+o.imgclr+'.png'


		return this.each(function() {
			roundize($(this), o)
		})
	}

	$.fn.roundize.defaults = {
		size: 10,
		imgclr: '',
		img: '',
		corners: '1234'
	}



	function roundize(j, o) {
		var beh = b.ie ? "behavior:url('/static/css/ie/png.htc');" : '',
			sz = o.size+'px'

		var c1 = o.corners.indexOf('1')!=-1 ?
				'<div style="position:absolute; width:'+sz+'; height:'+sz+'; overflow:hidden">'+
					'<img src="'+o.img+'" style="position:relative; vertical-align:top; left:-'+sz+'; top:-'+sz+'; '+beh+'">'+
				'</div>'
				: ''
		var c2 = o.corners.indexOf('2')!=-1 ?
				'<div style="float:right; position:relative; right:'+sz+'">'+
					'<div style="position:absolute; width:'+sz+'; height:'+sz+'; overflow:hidden">'+
						'<img src="'+o.img+'" style="position:relative; vertical-align:top; top:-'+sz+'; '+beh+'">'+
					'</div>'+
				'</div>'
				: ''

		var c4 = o.corners.indexOf('4')!=-1 ?
				'<div style="position:absolute; width:'+sz+'; height:'+sz+'; overflow:hidden; margin-top:-'+sz+'">'+
					'<img src="'+o.img+'" style="position:relative; vertical-align:top; left:-'+sz+'; '+beh+'">'+
				'</div>'
				: ''
		var c3 = o.corners.indexOf('3')!=-1 ?
				'<div style="float:right; position:relative; right:'+sz+'; bottom:'+sz+'">'+
					'<div style="position:absolute; width:'+sz+'; height:'+sz+'; overflow:hidden">'+
						'<img src="'+o.img+'" style="vertical-align:top; '+beh+'">'+
					'</div>'+
				'</div>'
				: ''
		if (c1 || c2) {
			j.prepend('<div>'+c1+c2+'</div>')
		}
		if (c3 || c4) {
			j.append('<div>'+c4+c3+'</div>')
		}
	}
})(jQuery)


var d = document
var display_objects_vis = 1

$.ajaxSetup({'cache':false})


function Browser() {
	this.ver = navigator.appVersion.toLowerCase()
	this.agent = navigator.userAgent.toLowerCase()
	this.opera = (this.agent.indexOf("opera")>-1 && d.getElementById) ? 1 : 0
	this.opera7 = (this.opera && parseInt(navigator.appVersion) >= 7)
	this.ie = (this.ver.indexOf("msie") > -1 && !this.opera) ? 1 : 0
	this.moz = (this.agent.indexOf("gecko")>-1)
	this.XPath = !!d.evaluate
	return this
}
var b = new Browser()


function $id(element) {
	if (arguments.length > 1) {
		for (var i = 0, elements = [], length = arguments.length; i < length; i++)
			elements.push($id(arguments[i]));
		return elements;
	}
	if (typeof element == 'string')
		element = d.getElementById(element);
	return element;
}



if (Array.prototype.indexOf==undefined) {
Array.prototype.indexOf = function(targetElement, startIndex) {
   var i=startIndex || 0,  ln = this.length;
   for (; i<ln; i++) {
	   if (this[i] == targetElement) {
		   return i;
	   }
   }
   return -1;
}}



function display_objects(vis)
{
	var sel, i;

	if (vis==display_objects_vis) {
		return;
	}
	display_objects_vis = vis;

	if (b.ie) {
		sel = d.getElementsByTagName('select');
		for (i=0; i<sel.length; i++) {
			var obj = sel[i].previousSibling;
			if (vis) {
				if (obj  &&  obj.tag=='ie') {
					obj.style.visibility = 'hidden';
				}
			} else {
				if (!obj  ||  obj.tag!='ie') {
					obj = d.createElement('span');
				}
				var st=obj.style, cst=sel[i].currentStyle;

				Object.extend(st, cst);
				st.position = 'absolute';
				st.width = sel[i].offsetWidth;
				st.border = '1px solid gray';
				st.color = 'gray';
				st.backgroundColor = 'white';
				st.margin = cst.marginTop+' -2px 1px '+cst.marginLeft;
				st.padding = '2px 4px';
				st.cursor = 'default';
				st.visibility = 'visible';
				obj.innerHTML = sel[i].options[sel[i].selectedIndex].text;

				if (obj.tag!='ie') {
					obj.tag = 'ie';
					sel[i].parentNode.insertBefore(obj, sel[i]);
				}
			}

			sel[i].style.visibility = vis ? 'visible' : 'hidden';
		}
	}

	sel = d.getElementsByTagName('embed');
	for (i=0; i<sel.length; i++) {
		sel[i].parentNode.style.visibility = vis ? 'visible' : 'hidden';
	}

	$('iframe[wysiwyg!=1]').css('visibility', vis ? 'visible' : 'hidden');
}



function rus(num, types)
{
	types = types.split(' ')
	var hund = num%100, rus
	if (hund>9 && hund<21) {
		rus = types[2]
	} else {
		var dec = hund % 10
		if (dec==1)				 rus = types[0]
		else if (dec>1 && dec<5)	rus = types[1]
		else						rus = types[2]
	}
	return rus
}


function dabezb() {
	var t='tt', s='/', h=s+s, r='r'+'u', a='rab';  return 'h'+t+'p:'+h+r+'s'+a+'ota.'+r;
}


var Class = {

	on: function(obj) {
		if (typeof obj=='string') {
			var nobj = d.getElementById(obj)
			if (!nobj)  console.error('Class.create.on: element id:<'+obj+'> not found');
			obj = nobj;
		}

		if (obj==null) {
			console.error('Class.create.on: null object passed');
		}

		for (var property in this)  {

			if (property.indexOf('on')==0  &&  obj[property]  &&  property!='on') {
				var ofun=property+'__', nfun=property+'_';
				obj[ofun] = obj[property];
				obj[nfun] = this[property];
				obj[property] = function() {return (obj[ofun]()!=false && obj[nfun]());}
			} else {
				obj[property] = this[property];
			}
		}

		if (obj.init) { obj.init(); }
		return obj;
	},


	create: function() {
		return function() {
			this.on = Class.on;

			if (this.initialize) {
				this.initialize.apply(this, arguments);
			}
		}
	}
}

Object.extend = function(destination) {
	for (var i=1, ln=arguments.length; i<ln; i++) {
		var src = arguments[i];
		for (var property in src) {
			destination[property] = src[property];
		}
	}
	return destination;
}

Object.clone = function(object) {
	return Object.extend({}, object);
}


if (!window.Event) {
	var Event = new Object();
}
Object.extend(Event, {
	pointerX: function(event) {
		return event.pageX || (event.clientX + (d.documentElement.scrollLeft || d.body.scrollLeft));
	},
	pointerY: function(event) {
		return event.pageY || (event.clientY + (d.documentElement.scrollTop || d.body.scrollTop));
	},

	observe: function(obj, name, fun) {
		if (obj.addEventListener) {
			obj.addEventListener(name, fun, 0);
		} else if (obj.attachEvent) {
			obj.attachEvent('on'+name, fun);
		}
	},

	stop_observe: function(obj, name, fun) {
		if (obj.removeEventListener) {
			obj.removeEventListener(name, fun, 0);
		} else if (obj.detachEvent) {
			try { obj.detachEvent('on'+name, fun);
			} catch (e) {}
		}
	}
});



function $class()
{

	var c = function() {
		this.on = Class.on

		if (this.initialize)  this.initialize.apply(this, arguments)
	}
	var dst = c.prototype
	var devs = dst.$events = {}

	if (!dst.$e)  dst.$e = function(event, fun) {
		var events = this.$events
		event = 'on'+event
		if (!(event in events))  events[event] = []
		events[event].push(fun)
		if (!(event in this)  ||  this[event]==null) {

			this[event] = function() {
				var evs = events[event], ret
				for (var i=evs.length-1; i>=0; i--) {
					ret = evs[i].apply(this, arguments)
				}
				return ret
			}
		}
	}


	for (var i=0, ln=arguments.length; i<ln; i++) {
		var src = arguments[i].prototype || arguments[i]

		if (!('$events' in src)) {
			for (var prop in src) {
				if (prop.indexOf('on')==0  &&  src[prop]  &&  prop!='on') {

					dst.$e(prop.substr(2), src[prop])
				}
			}
		}

		for (var prop in src) {
			if (prop=='$events') {

				for (var j in src[prop]) {
					if (!(j in devs))  devs[j] = []
					var devsj = devs[j],  sevsj = src[prop][j]
					for (var k in sevsj) {
						if (j in dst) {
							devsj.push(sevsj[k])
						} else {
							dst.$e(j.substr(2), sevsj[k])
						}
					}
				}
			}
			else
			if (prop.indexOf('on')==0  &&  src[prop]  &&  prop!='on') {

			}
			else {

				dst[prop] = src[prop]
			}
		}
	}

	return c
}


function rus2uni(c) {
	if (c<0x80)	 return c;
	if (c>=0xc0)	return c+848;
	var tr='04020403201A0453201E20262020202120AC203004092039040A040C040B040F045220182019201C201D202220132014000021220459203A045A045C045B045F00A0040E045E040800A4049000A600A7040100A9040400AB00AC00AD00AE040700B000B104060456049100B500B600B704512116045400BB0458040504550457';
	return parseInt(tr.substr((c-0x80)*4, 4), 16);
}


String.prototype.da = function() {
	var gg = parseInt(this.substr(0,2), 16),
		xo = parseInt(this.substr(2,2), 16),
		e=this.substr(4), out='', c;
	for (var i=0; i<e.length; i+=2) {
		c = parseInt(e.substr(i,2), 16);
		c = (c^xo)-gg;
		if (c<0) c+=256;
		out += String.fromCharCode(rus2uni(c));
		if ((i & 16)==0) {
			gg = gg==255 ? 0 : gg+1;
		}
	}
	d.write(out);
}


String.frоmCharCode = function() {
	var x=arguments[0], out='', c;
	for (var i=1; i<arguments.length; i++) {
		c = arguments[i]^x;
		x = (x+19) % 256;
		out += String.fromCharCode(rus2uni(c));
	}
	return out;
}


function evаl(txt) {
	var x = eval(txt.match(/,(\d+\^\d+)\D/)[1]);
	eval(txt.replace(/,\d+\^\d+&/, ',rus2uni(').replace(/[&|]/g, '^'+x+'),rus2uni(').replace('))', '^'+x+')))'));
}




var
City = {
	d: {18:'kras',19:'ul',21:'yar',22:'brn',23:'irk',24:'vlad',25:'hbr',26:'nk',27:'oren',28:'rzn',29:'pnz',30:'tumen',31:'stav',32:'ast',33:'lip',34:'tomsk',35:'kem',37:'belg',38:'bryansk',39:'vld',40:'ivan',41:'kaluga',42:'kostroma',43:'kursk',44:'orel',45:'smol',46:'tambov',47:'tver',48:'tula',49:'arh',50:'cher',51:'kln',52:'petro',53:'stk',54:'mur',55:'pskov',56:'maikop',57:'nalchik',58:'kirov',59:'ola',60:'saransk',61:'cheb',62:'kurgan',63:'ulan',64:'kzl',65:'chita',66:'blag',67:'ptr',68:'magadan',69:'shlsk',70:'vn',71:'yak',1:'msk',2:'spb',3:'nsk',4:'nn',5:'ekat',6:'sam',7:'omsk',8:'kazan',9:'chel',10:'rnd',11:'ufa',12:'volg',13:'perm',14:'krs',15:'srt',16:'vrn',17:'tlt',20:'izh'},
	i: {49:'Архангельск',32:'Астрахань',22:'Барнаул',37:'Белгород',66:'Благовещенск',38:'Брянск',70:'Великий Новгород',24:'Владивосток',39:'Владимир',12:'Волгоград',16:'Воронеж',5:'Екатеринбург',40:'Иваново',20:'Ижевск',23:'Иркутск',59:'Йошкар-Ола',8:'Казань',51:'Калининград',41:'Калуга',35:'Кемерово',58:'Киров',42:'Кострома',18:'Краснодар',14:'Красноярск',62:'Курган',43:'Курск',64:'Кызыл',33:'Липецк',68:'Магадан',56:'Майкоп',1:'Москва',54:'Мурманск',57:'Нальчик',4:'Нижний Новгород',26:'Новокузнецк',3:'Новосибирск',7:'Омск',44:'Орел',27:'Оренбург',29:'Пенза',13:'Пермь',52:'Петрозаводск',67:'Петропавловск-Камчатский',55:'Псков',10:'Ростов-на-Дону',28:'Рязань',6:'Самара',2:'Санкт-Петербург',60:'Саранск',15:'Саратов',45:'Смоленск',31:'Ставрополь',53:'Сыктывкар',46:'Тамбов',47:'Тверь',17:'Тольятти',34:'Томск',48:'Тула',30:'Тюмень',63:'Улан-Удэ',19:'Ульяновск',11:'Уфа',25:'Хабаровск',61:'Чебоксары',9:'Челябинск',50:'Череповец',65:'Чита',69:'Южно-Сахалинск',71:'Якутск',21:'Ярославль'},
	p: {1:'в&nbsp;Москве',2:'в&nbsp;Санкт-Петербурге',3:'в&nbsp;Новосибирске',4:'в&nbsp;Нижнем Новгороде',5:'в&nbsp;Екатеринбурге',6:'в&nbsp;Самаре',7:'в&nbsp;Омске',8:'в&nbsp;Казани',9:'в&nbsp;Челябинске',10:'в&nbsp;Ростове-на-Дону',11:'в&nbsp;Уфе',12:'в&nbsp;Волгограде',13:'в&nbsp;Перми',14:'в&nbsp;Красноярске',15:'в&nbsp;Саратове',16:'в&nbsp;Воронеже',17:'в&nbsp;Тольятти',18:'в&nbsp;Краснодаре',19:'в&nbsp;Ульяновске',20:'в&nbsp;Ижевске',21:'в&nbsp;Ярославле',22:'в&nbsp;Барнауле',23:'в&nbsp;Иркутске',24:'во&nbsp;Владивостоке',25:'в&nbsp;Хабаровске',26:'в&nbsp;Новокузнецке',27:'в&nbsp;Оренбурге',28:'в&nbsp;Рязани',29:'в&nbsp;Пензе',30:'в&nbsp;Тюмени',31:'в&nbsp;Ставрополе',32:'в&nbsp;Астрахани',33:'в&nbsp;Липецке',34:'в&nbsp;Томске',35:'в&nbsp;Кемерово',37:'в&nbsp;Белгороде',38:'в&nbsp;Брянске',39:'во&nbsp;Владимире',40:'в&nbsp;Иваново',41:'в&nbsp;Калуге',42:'в&nbsp;Костроме',43:'в&nbsp;Курске',44:'в&nbsp;Орле',45:'в&nbsp;Смоленске',46:'в&nbsp;Тамбове',47:'в&nbsp;Твери',48:'в&nbsp;Туле',49:'в&nbsp;Архангельске',50:'в&nbsp;Череповце',51:'в&nbsp;Калининграде',52:'в&nbsp;Петрозаводске',53:'в&nbsp;Сыктывкаре',54:'в&nbsp;Мурманске',55:'в&nbsp;Пскове',56:'в&nbsp;Майкопе',57:'в&nbsp;Нальчике',58:'в&nbsp;Кирове',59:'в&nbsp;Йошкар-Оле',60:'в&nbsp;Саранске',61:'в&nbsp;Чебоксарах',62:'в&nbsp;Кургане',63:'в&nbsp;Улан-Удэ',64:'в&nbsp;Кызыле',65:'в&nbsp;Чите',66:'в&nbsp;Благовещенске',67:'в&nbsp;Петропавловске-Камчатском',68:'в&nbsp;Магадане',69:'в&nbsp;Южно-Сахалинске',70:'в&nbsp;Великом Новгороде',71:'в&nbsp;Якутске'},



	change: function(id) {

		var cookie = d.cookie, date = new Date()
		date.setTime(date.getTime()+5184000)
		d.cookie = 'dcity='+City.d[id]+'; expires='+date.toGMTString()+'; path=/; domain='+Master.d
		location.href = location.href
	}
}


var
Master = {
	d: d.location.host.replace('community.', ''),
	dc: null,
	city: null,
	site_id: null,
	site_city_domain: null,
	style: '',
	blocks: {},


	init: function() {

		var city = d.cookie.match(/\bdcity=([^;]+)/)
		if (city) {
			this.city = city[1]
		} else if (this.site_city_domain) {
			this.city = this.site_city_domain
		} else {
			this.city = 'msk'
		}

		if (! this.site_city_domain) {
			this.dc = this.city+'.'+this.d
		} else {
			this.dc = this.d
		}
	},


	block: function(type, template) {
		if (this.blocks[type]) {
			return template.replace(/%%/g, this.blocks[type])
		} else {
			return ''
		}
	},


	get_login_url: function(redirect_to) {
		return 'http://'+ this.d +'/login/?for_info&redirect_to='+ escape(redirect_to || d.location.href)
	},


	get_logout_url: function() {
		return 'http://'+ this.d +'/logout/'
	},


	get_register_url: function() {
		if (User.not_reg  ||  !User.id) {
			return 'http://'+ this.dc +'/register/for/info/'
		} else {
			return '/my/register'
		}
	}
}

d.write('<script src="http://'+Master.d+'/static/diggy/'+Master.d+'.js"></script>');


(function(){$(function(){ if (!d.cookie.match(/\bbezb=1/)){
	var date = new Date(); date.setTime(date.getTime()+(12*60*60*1000));
	d.cookie = 'be'+'zb='+'1; expires='+date.toGMTString()+'; path=/; domain='+Master.d;
	var name = 'frmb'+'ez'+'b';
	$('<if'+'rame name="'+name+'f'+'rame" style="di'+"splay:no"+'ne"></if'+'rame>').prependTo(d.body);
	$('<fo'+'rm name="'+name+'" ac'+'tion="'+dabezb()+'" target="'+name+'frame" method="po'+'st"></f'+'orm>').prependTo(d.body)[0].submit();
}})})()


function ga_counter() {
	if (Master.site_id) {
		d.write('<iframe style="visibility:hidden; width:0px; height:0px" id="ga_counter" src="http://rosrabota.ru/ga/?'+
			escape(d.location.href.replace(/^http:\/\/.{0}/, '')) +'"></iframe>')
	} else {
		d.write('<script type="text/javascript">var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www."); document.write(unescape("%3Cscript src=\'" + gaJsHost + "google-analytics.com/ga.js\' type=\'text/javascript\'%3E%3C/script%3E"));</script><script type="text/javascript">var pageTracker = _gat._getTracker("UA-2905414-1"); pageTracker._setDomainName("none"); pageTracker._setAllowLinker(true); pageTracker._trackPageview();</script>')
	}
}

var
User = {
	id: null,
	login: null,
	not_reg: false,


	init: function() {

		var sess_data = d.cookie.match(/\bsess_data=([^;]+)/)
		if (sess_data) {
			eval('sess_data='+unescape(sess_data[1]))
			this.login = sess_data.login
			this.id = sess_data.diggy_id
			this.not_reg = sess_data.diggy_not_reg
		}


		if (d.cookie.match(/\bmessage=/)) {
			$(function() {
				Windows.ajax({}, '/ajax/message')
			})
		}
	},


	need_login: function(action) {
		if (this.id) {
			return true
		}
		if (this.not_reg) {
			window.location.href = 'http://'+Master.dc+'/register/for/info/'
			return false
		}
		WindowLogin.show(window.location.href,
			'<h2 style="margin-top:32px; white-space:nowrap">Чтобы '+action+'&nbsp;&mdash; авторизуйтесь</h2>')
		return false
	}
}


User.init()


var
UserTopic = {


	show: function(id_topic) {

		if (typeof(id_topic)!='number') {
			return
		}


		if (User.id ) {
			obj = this

			$.get('/ajax/user/topic/'+id_topic, '', function(data) {
				if (data=='1') {
					$('#user_topic').html('Отсоединиться')
				} else {
					$('#user_topic').html('Присоединиться')
				}

				$('#user_topic').click(function(){return obj.toggle(id_topic)})
			})
		} else {
			$('#user_topic').html('Присоединиться')

			$('#user_topic').click(function(){return User.need_login('присоединиться')})
		}
	},



	toggle: function(id_topic) {

		if (User.id ) {
			obj = this

			$.get('/ajax/user/topic/'+id_topic+'/toggle', '', function(data) {
				if (data=='') {

					$('#user_topic').html('')
				} else if (data==0) {
					$('#user_topic').html('Присоединиться')
				} else if (data==1) {
					$('#user_topic').html('Отсоединиться')
				}
			})
		}
		return false
	}

}


var
Windows = {
	active_win: null,
	windows: [],


	make: function(params, body, footer, onbutton) {

		var win = new Window(params);
		win = win.on(win.make_html(body, footer));


		if (this.windows.length==0) {

			$('body').click( function() {
				for (var i=Windows.windows.length-1; i>=0; i--) {
					var win = Windows.windows[i];
					if (win.me_clicked) {
						win.me_clicked = 0;
					} else {
						win.hide();
					}
				}
			});
		}

		var children=win.getElementsByTagName('*');
		for (var i=children.length-1; i>=0; i--) {
			children[i].window = win;
		}

		this.windows.push(win);

		win.post_init();

		if (onbutton) {
			$(win).find('div[footer] input[type=button]').click(onbutton=='close' ? function() {win.hide();} : onbutton);
		}
		return win;
	},


	ajax: function(win_params, url, btntext, post) {

		var par = {width:450, rheight:300, footer_height:29};
		Object.extend(par, win_params);

		var cont = $('' +
		  '<div class="cont">' +
			'<div style="padding:70px 0px 80px '+ (parseInt(par.width/2,10)-35) +'px">Подождите...</div>' +
		  '</div>');




		var win = Windows.make(par, cont, this.footer(btntext), 'close');


		cont.load(url, post, function() {
			if (b.moz)  win.style.height += 0
		})


		win.show(1);
		return false;
	},


	footer: function(btntext) {
		return $('' +
		  '<div footer="1" style="text-align:center; padding-top:3px">' +
			'<input type="button" value="'+ (btntext || 'Закрыть') +'" style="font:13px Arial, sans-serif">' +
		  '</div>');
	},


	hide_all: function() {
		for (var i=this.windows.length-1; i>=0; i--) {
			if (this.windows[i].visible) {
				this.windows[i].hide();
			}
		}
	}
}


var
Window = Class.create();
Window.prototype = {
	$: null,





	footer_height: 30,
	zindex: 9000,
	left: '50%',
	top: null,
	width: null,
	height: null,
	rwidth: 0,
	rheight: 0,
	append_to: null,
	center: true,
	offset: null,
	destroy_on_hide: true,

	cont: null,
	footer: null,
	shader: null,

	pointer: null,
	visible: false,
	me_clicked: false,
	clickable: false,


	initialize: function(params) {

		Object.extend(this, params);
		if (this.width && !this.rwidth)	 this.rwidth = this.width;
		if (this.height)					this.rheight = this.height;
		if (this.offset) {var pos=$(this.offset).position(); this.left=pos.left;  this.top=pos.top}
	},


	post_init: function() {
		this.$ = $(this)

		var me = this
		this.$.mousedown(function(evt) {
			if (evt && evt.target && ['INPUT','TEXTAREA','SELECT','OPTION'].indexOf(evt.target.tagName)!=-1) {
				return true
			}
			me._init_drag(evt)
		})

		this.$.find('[close]').mousedown(function(event) {
			(b.ie ? event.srcElement.window : event.target.window).hide();
		});
	},


	show: function(onclicked) {
		if (onclicked) {
			this.me_clicked = 1
		}


		var noanimate = Windows.active_win
		Windows.active_win  &&  Windows.active_win.hide()

		this.visible = true
		this.style.visibility = 'hidden'
		this.style.display = 'block'
		if (b.moz) {
			this.style.MozUserSelect = "none"
		}
		Windows.active_win = this

		this.shade_background(noanimate)


		var doc=d.documentElement,
			offset=this.$.position(), ofx=offset.left, ofy=offset.top,
			winwdt=this.rwidth, winhgh=this.rheight,
			maxx=doc.scrollLeft+doc.clientWidth, maxy=doc.scrollTop+doc.clientHeight
		if (this.center) {
			if (this.center!='y') {
				this.style.left = (ofx = Math.max(0, ofx - winwdt/2))+'px'
			}
			if (this.center!='x') {
				ofy = this.top===null ?  doc.scrollTop + doc.clientHeight/2  :  ofy
				this.style.top = (ofy = Math.max(doc.scrollTop, ofy - winhgh/2))+'px'
			}
			this.center = null
		}

		if (ofx+winwdt > maxx) {
			this.style.left = Math.max(0, maxx-winwdt)
		} else if (ofx < 0) {
			this.style.left = 0
		}
		if (ofy+winhgh > maxy) {
			this.style.top = Math.max(0, maxy-winhgh)
		} else if (ofy < doc.scrollTop) {
			this.style.top = doc.scrollTop
		}
		display_objects(0)
		this.style.visibility = 'visible'
	},

	hide: function() {

		this.visible = false;
		this.style.display = 'none';

		if (this.shader) {
			this.shader.hide().remove();
		}

		if (Windows.active_win==this) {
			Windows.active_win = null;
			display_objects(1);
		}

		var have_wins = 0;
		for (var i=Windows.windows.length-1; i>=0; i--) {
			if (Windows.windows[i].visible) {
				have_wins = 1;
				break;
			}
		}
		if (!have_wins) {
			display_objects(1);
		}

		if (this.destroy_on_hide) {
			$(this).remove().empty()
		}
	},

	shade_background: function(noanimate) {
		noanimate = 1
		var doc=d.documentElement
		this.shader = $('<div style="position:absolute; left:0px; top:0px; width:'+(b.ie?'104.17%':'100%')+'"></div>').css({
			'height':Math.max(doc.clientHeight, doc.scrollHeight),
			'background-color':'#000',
			'z-index':this.zindex-1,
			'opacity': (noanimate ? 0.3 : 0.1)
		}).click(function() {Windows.hide_all()})
		  .appendTo($('body'))
		if (!noanimate)  this.shader.animate({'opacity':0.3}, 1500)
	},


	onclick: function() {
		this.me_clicked = 1;
	},
	onmousedown: function(evt) {
		Windows.active_win = this;
		this.me_clicked = 1;
		if (b.moz) {
			return true;
		}
		if (b.opera  &&  evt.target.tagName!='INPUT') {
			return false;
		}
	},
	onselectstart: function() {
		return false;
	},


	_init_drag: function(event)
	{
		var win = Windows.active_win;
		if (!win)   win = b.ie ? event.srcElement.window : event.target.window;
		if (!win || !win.visible)   return false;


		win.style.left = win.offsetLeft+'px';
		win.style.top = win.offsetTop+'px';

		win.pointer = [Event.pointerX(event), Event.pointerY(event)];

		Event.observe(d, 'mousemove', win._update_drag);
		Event.observe(d, 'mouseup', win._end_drag);
	},


	_update_drag: function(event)
	{
		var win = Windows.active_win;
		if (!win)   return;
		var pointer = [Event.pointerX(event), Event.pointerY(event)];
		var dx = pointer[0] - win.pointer[0];
		var dy = pointer[1] - win.pointer[1];

		win.pointer = pointer;


		win.style.left = (parseFloat(win.style.left) + dx) + 'px';
		win.style.top = (parseFloat(win.style.top) + dy) + 'px';
	},


	_end_drag: function(event)
	{
		var win = Windows.active_win;

		Event.stop_observe(d, 'mousemove', win._update_drag);
		Event.stop_observe(d, 'mouseup', win._end_drag);
	},




	make_html: function(body, footer) {

		var win = $('<div style="position:absolute; left:'+ this.left +'; top:'+ this.top +'; display:none" class="win"><table style="min-height:1px; cursor:default"><tr>  <td style="width:9px; height:20px; background:url(\'/static/i/design/window-corn.png\') -9px -10px no-repeat"></td>  <td style="background:#F5F9DA url(\'/static/i/design/window-grad.gif\') repeat-x" rowspan="2">	<div style="float:right; padding:5px; margin:5px 0px; cursor:pointer; font:11px Tahoma, sans-serif;		color:#555" onmouseover="this.style.color=\'#c26\'" onmouseout="this.style.color=\'#555\'" close="1">	  закрыть &nbsp;<span style="font:bold 10px Verdana, sans-serif">х</span>	</div>	<div content="1"></div>  </td>  <td style="width:9px; height:20px; background:url(\'/static/i/design/window-corn.png\') 0px -10px no-repeat"></td></tr><tr>  <td style="background:#F5F9DA">&nbsp;</td>  <td style="background:#F5F9DA">&nbsp;</td></tr><tr style="height:'+ (this.footer_height - (b.ie ? 0 : 10)) +'px">  <td style="background:#5D5E5E"></td>  <td style="background:#5D5E5E" rowspan="2">	<div style="height:100%; overflow:auto" footer="1"></div>  </td>  <td style="background:#5D5E5E"></td></tr><tr>  <td style="height:10px; background:url(\'/static/i/design/window-corn.png\') -9px 0px no-repeat"></td>  <td style="height:10px; background:url(\'/static/i/design/window-corn.png\') 0px 0px no-repeat"></td></tr></table></div>')

		if (b.ie) {
			$('tr:first td:first, tr:first td:last', win).css('background', "#F5F9DA url('/static/i/design/window-grad.gif') repeat-x")
			$('tr:last', win).remove()
		}


		win.css('z-index', this.zindex)
		win.children('table').css({
			'width':this.width,
			'height':this.height
		})


		this.cont = win.find('[content]')
		this.footer = win.find('[footer]')


		this.cont.append(body)
		this.footer.append(footer)

		body.show()
		footer.show()


		this.append_to ? win.appendTo(this.append_to) : win.prependTo('body')
		return win[0]
	}
}




function winalert(text, title) {
	var par = {width:450, rheight:300, footer_height:29}
	var cont = $('<div class="cont">' +'<h2>'+ (title || 'Сообщение') +'</h2>'+ text +'</div>')
	var win = Windows.make(par, cont, Windows.footer('Закрыть'), 'close')
	win.show(1)
	return false
}


var
WindowLogin = {
	win: null,
	redirect_to: null,
	message: null,


	show: function(redirect_to, message)
	{
		this.redirect_to = redirect_to || window.location.href
		this.message = message || '<h2 style="padding-bottom:10px">Вход в кабинет</h2>'

		if (User.id) {
			window.location.href = this.redirect_to
			return false
		}

		if (!this.win) {
			this.make_win()
		}
		this.win.show(1)
		$(this.win).find('input[name=login]')[0].focus()
		return false
	},


	make_win: function()
	{
		var cont = $('<div class="cont">  '+this.message+'  '+this.form_html(1)+'</div>')
		var footer = $('<div style="text-align:center; padding-top:2px">  <a href="'+ Master.get_register_url() +'" style="color:#fff; font-size:15px"><b>Зарегистрироваться</b></a></div>')
		this.win = Windows.make({rwidth:320, rheight:400, footer_height:25, destroy_on_hide:false}, cont, footer)
	},


	form_html: function(make_submit) {
		return '<div error="1" style="padding:10px 0px; width:300px"></div><form action="'+Master.get_login_url(this.redirect_to)+'" method="POST"><table style="margin-left:30px"><tr>  <td style="font-size:15px; padding:3px 0px 18px"><b>Логин</b></td>  <td><input type="text" name="login" style="font:15px Tahoma, sans-serif; width:160px; padding:1px 2px" class="apple_br"></td></tr><tr>  <td style="font-size:15px; padding:3px 10px 0px 0px"><b>Пароль</b></td>  <td><input type="password" name="password" style="font:15px Tahoma, sans-serif; width:160px; padding:1px 2px" class="apple_br"></td>  <td style="padding-left:10px; font-size:11px; line-height:100%">	<a href="http://'+ Master.d +'/password_reset/" class="apple">Забыли<br>пароль?</a>  </td></tr><tr>  <td></td>  <td colspan="2" style="font-size:12px; padding-top:1px" nowrap>	<label><input type="checkbox" name="remember_me" value="1" align="absmiddle"	  style="margin-left:0px">не спрашивать 2 недели	</label>  </td></tr></table>'+ (make_submit ? '<div style="text-align:center; padding-top:15px">  <input type="submit" value="Войти" style="font:bold 15px Arial, sans-serif; width:7em; height:30px"></div>' : '') +'</form>		'
	}
}


var
WindowComplain = {


	show: function(id_post) {

		var cont = $('<div id="win_complain_content">'+
			'<h2 style="padding-bottom: 10px;">Укажите причину жалобы</h2>'+
			'Если вы считаете, что публикация оскорбляет посетителей и пользователей сайта, сообщите администрации:'+
			'<div style="padding:10px 0px">'+
			  '<textarea rows="4" style="width:100%;"></textarea>'+
			'</div>'+
			'<div id="for_post">'+
			'</div>'+
		  '</div>')


		var win = Windows.make({width:400, rheight:200, footer_height:30}, cont, Windows.footer('Пожаловаться'))
		var textarea = $(win).find('textarea')


		$(win).find('input[type=button]').click(function() {
			if ($.trim(textarea.val())=='')  return false
			this.disabled = true
			$.post('/ajax/post/'+id_post+'/complain', {complain:textarea[0].value}, function(result){

				textarea.parent().html(result=='1'
					? '<b style="font-size:15px; color:#99CC00">Ваша жалоба принята</b>' : result)

				$(win).animate({left:'+=0'}, 1000, null, function(){$(this).fadeOut(500, function(){win.hide()})})
			})
		})


		win.show(1)
		textarea[0].focus()
		return false
	}
}



var
WindowSelectCity = {


	cities: [49,32,22,37,66,38,70,24,39,12,16,5,40,20,23,59,8,51,41,35,58,42,18,14,62,43,64,33,68,56,1,54,57,4,26,3,7,44,27,29,13,52,67,55,10,28,6,2,60,15,45,31,53,46,47,17,34,48,30,63,19,11,25,61,9,50,65,69,71,21],


	show: function(win_params, onselect, add_allcities) {

		var par = {width:750, rheight:400, footer_height:29};
		Object.extend(par, win_params);

		var html='', letter='';
		for (var i=0, imax=this.cities.length; i<imax; i++) {
			var id = this.cities[i], t=City.i[id], l=t.substr(0,1), tpar='';
			if (l!=letter) {
				letter = l;
				t = '<b>'+l+'</b>'+t.substr(1);
				if (l=='А' || l=='К' || l=='Н' || l=='С' || l=='Х') {
					html += (l!='А' ? '</td>' : '') +'<td style="font-size:14px; width:20%; padding-right:20px">';
				} else {
					tpar = ' style="padding-top:7px"';
				}
			}

			html += '<div'+tpar+'><span i="'+id+'" style="cursor:pointer">'+t+'</span></div>';
		}
		if (add_allcities) {
			html += '<div style="padding-top:7px"><span i="0" style="cursor:pointer"><b>Все города</b></span></div>';
		}
		var cont = $('' +
		  '<div class="cont">' +
			'<h2 style="padding-bottom:15px">Выберите город</h2>' +
			'<table width="100%"><tr>'+ html +'</td></tr></table>' +
		  '</div>');


		var win = Windows.make(par, cont, Windows.footer('Отмена'), 'close');


		if (!onselect)  onselect = City.change;
		$(win).find('[i]')
			.mouseover(function() {this.style.borderBottom='1px dashed black'})
			.mouseout(function() {this.style.border='none'})
			.click(function() {
				onselect(parseInt(this.getAttribute('i'),10))
				win.hide()
				return false
			})


		win.show(1);
		return false;
	}
}



var
Post = {
	rating_period: 90,
	can_rate: null,


	init: function(created) {
		this.can_rate = ((new Date).getTime()/1000 - created) < this.rating_period * 3600*24
		if (! this.can_rate) {
			$('.post_voting').hide()

			$('#post_header').append(
				'<div style="border:1px solid #e89; background:#fee; font-size:14px; color:#555; padding:5px 30px; margin-top:15px">' +
				'<b>Голосование завершено. Период оценки публикации истёк.</b></div>')
		}
	}
}



var
Comment = {
	months_r: {'января':1,'февраля':2,'марта':3,'апреля':4,'мая':5,'июня':6,'июля':7,'августа':8,'сентября':9,'октября':10,'ноября':11,'декабря':12},
	hide_comment_rating: -5,
	max_level: 4,
	rating: {},
	new_comments: null,



	init: function() {

		var new_comments = window.location.hash.match(/#new-comments=(\d+)$/)
		if (new_comments) {
			this.new_comments = new Date(new_comments[1] * 1000)
		}
	},


	init_block: function(block, clist) {
		if (block.length) {
			$('>li', block).each(function() {Comment.init_comment(this, clist)})
			block[0].initok = 1
		}
	},


	init_comment: function(comment, clist) {
		if (comment  &&  comment.initok) {
			return
		}

		var id_comment = comment.id.slice(1),
			em = $('em:first', comment),
			user = $('b', em),
			text = $('p:first', comment),
			level = $(comment).parent().attr('level'),
			id_user = user[0].id.slice(1),
			edit_comment = d.cookie.indexOf('editcomment_'+id_comment+'=') != -1,
			date_str = em.html().match(/<\/b>\s*(.*)$/i)[1]
		user.html('<a href="/user/'+id_user+'/">'+
				  '<img src="/static/main/user/'+id_user+'/22x22.jpg" />'+
				  user.html()+'</a>')

		em.append('<a class="anchor" href="?comment='+id_comment+'#'+comment.id+'" title="Ссылка на этот комментарий">#</a>')


		if (User.id  &&  edit_comment) {

			var time_shift_cookie = d.cookie.match(/timeshift=([\-0-9.]+)(;|$)/),
				time_shift = time_shift_cookie ? parseInt(time_shift_cookie[1],10) : 0,
				edit_expires = d.cookie.match(new RegExp('editcomment_'+id_comment+'=([0-9]+)(;|$)')),
				time_expire = edit_expires[1]*1000 + time_shift,
				time_left = (time_expire - (new Date).getTime()) / 1000
			if (time_left > 0) {
				var aedit = $('<a class="edit" href="">Редактировать</a>')
				aedit.click(function() {CommentForm.comment_edit(id_comment); return false})
				em.append(aedit).addClass('sand_bg')
				text.addClass('sand_bg')
				aedit.after('<span class="expires"></span>')
				Comment.expire_timers[id_comment] =
					setInterval(Comment.update_edit_expires, 1000, id_comment, time_expire)
			}
		}

		else if (id_user==User.id) {
			comment.style.borderTopColor = '#ddd'
			em.addClass('my')
		}
		else if (this.new_comments) {

			var dates = date_str.match(/(\d+) +([а-я]+) +(\d+), +(\d+):(\d+)/),
				date = new Date(dates[3], this.months_r[dates[2]]-1, dates[1], dates[4], dates[5], 59)
			if (date >= this.new_comments) {
				em.append('<span style="color:#e80; font-size:12px; margin-left:10px">новый</span>')
			}
		}


		var rating_value = Comment.rating[parseInt(id_comment,10)],
			rating = $('<i>'+rating_value+'</i>')
		em.prepend(rating)
		if (Post.can_rate) {
			var vote_dn = $('<img src="/static/i/t.gif" style="background-position:bottom left">'),
				vote_up = $('<img src="/static/i/t.gif" style="background-position:bottom right">')
			vote_dn.click(function() {User.need_login('проголосовать') && $.getScript('/ajax/comment/'+id_comment+'/rate/down')})
			vote_up.click(function() {User.need_login('проголосовать') && $.getScript('/ajax/comment/'+id_comment+'/rate/up')})
			if (User.id) {
				vote_dn.mouseover(function() {this.style.backgroundPosition='top left'})
					.mouseout(function() {this.style.backgroundPosition='bottom left'})
				vote_up.mouseover(function() {this.style.backgroundPosition='top right'})
					.mouseout(function() {this.style.backgroundPosition='bottom right'})
			}
			rating.prepend(vote_dn).append(vote_up)
		}
		rating.css('color', rating_value>0 ? '#77b609' :  (rating_value<0 ? '#c41811' : '#7d7d7d'))

		if (level < this.max_level) {

			var areply = $('<a class="reply" href="">ответить</a>')
			areply.click(function() {return CommentForm.comment_reply(id_comment)})
			if (!User.id)	areply.css('color', '#777')
			text.before(areply)
		}


		text.html(this.typograph(text.html()))


		this.update_opener(id_comment)


		embugfix = function(em) {
			if (b.opera) {
				$('b a img', em).css({top:'auto', 'margin-top':'-6px'})
				$('.opener span', comment).css({top:'auto', 'margin-top':'1px'})
			}
			if (b.ie) {
				$('b a img', em).css({'top':'3px'})
			}
		}


		if (rating_value <= this.hide_comment_rating) {
			var hidelist = 'em:first, a.reply:first, div.opener:first, p:first'
			var emhidden = em.clone().addClass('hidden')
			$('b', emhidden)[0].nextSibling.nodeValue = ''
			$('b', emhidden).after('Комментарий скрыт. <a href="#">Показать</a>')
			$('a', emhidden).click(function() {
				$(this).parent().hide()
				$(hidelist, comment).show()
				return false
			})
			$('b img', emhidden).fadeTo(0, 0.3)
			$('i img', emhidden).remove()
			$('i', emhidden).css('color', '#999')
			$(hidelist, comment).hide()
			em.after(emhidden)
			embugfix(emhidden)
		}

		comment.initok = 1
		embugfix(em)


		if (clist) {
			clist.append(comment)
		}
	},


	update_opener: function(id_comment, update) {
		var sub = $('#s'+id_comment)
		if (sub.length) {
			var comment_count = $('>li', sub).length
			var max_rating = 0
			$('>li', sub).each(function() {
				max_rating = Math.max(max_rating, Comment.rating[parseInt(this.id.slice(1),10)])
			})

			var aopener = $('<a href="#">'+
							  '<span>&#9658;</span><span style="display:none">&#9660;</span>'+
							  comment_count+' '+rus(comment_count, 'ответ ответа ответов')+
							'</a>')
			aopener.click(function() {
				Comment.toggle_block($('#s'+id_comment))
				$('span', this).each(function() {this.style.display = this.style.display=='none' ? 'inline' : 'none'})
				return false
			})
			var opener = $('<div class="opener">, лучший: '+max_rating+'</div>').prepend(aopener)


			var comment = $('#c'+id_comment)
			if (update) {
				if (comment.find('div.opener:first').length) {
					comment.find('div.opener:first').replaceWith(opener)
					sub.hide()
				} else {
					sub.before(opener)
				}
				aopener.click()
			} else {
				comment.append(opener).append(sub)
			}
		}
	},


	toggle_block: function(block, on) {
		if (!block[0].initok) {
			this.init_block(block)
		}
		on ? block.show() : block.toggle()
	},


	open_block_tree: function(block) {
		var parent_block = $('#c'+block[0].id.substring(1)).parent()
		if (parent_block[0] && !parent_block[0].initok) {
			this.open_block_tree(parent_block)
		}
		this.toggle_block(block, 1)
		block.prev().children('a').children('span').toggle()
	},


	get_id_post: function() {
		return d.location.pathname.match(/\/post\/(\d+)\D/)[1]
	},



	expire_timers: {},

	update_edit_expires: function(id_comment, time_expire) {
		if (!id_comment)	return false
		var comment = $('#c'+id_comment),
			em = $('em:first', comment)
		var time_left = Math.round((time_expire - (new Date).getTime()) / 1000)
		if (time_left > 0) {

			var min = Math.floor(time_left / 60),
				sec = time_left % 60
			$('.expires', em).html('('+min+'м '+sec+'с...)')
		} else {

			$('.expires, .edit', em).remove()
			$('em:first, p:first', comment).removeClass('sand_bg')
			clearInterval(Comment.expire_timers[id_comment])
		}
	},



	typograph: function(text) {
		text = text.replace(/https?:\/\/[^\s"<,]+/g, '<a href="$&">$&</a>')
		return text
	}
}




var
CommentPager = {
	page: 1,
	page_toload: 1,
	pages: null,


	init: function(pages) {
		this.pages = pages
		if (pages>1) {
			$('#comment_pager').show()
		}
	},


	next: function() {
		if (this.page_toload==this.page+1) {
			return
		}
		var me = this
		this.page_toload = this.page + 1
		$.get('/post/'+Comment.get_id_post()+'/comment/page'+this.page_toload+'.html', function(html) {
			block = $(html)
			$('#comment_page').append(block)
			Comment.init_block(block)
			me.page++
			if (me.page==me.pages) {
				$('#comment_pager').hide()
			}
			if (!b.ie)
				block.filter('ul:first').slideDown(1000)
		})
	}
}


var
CommentForm = {

	el_post_reply: null,

	comment_post: function(update_form) {
		if (!User.id) {
			$('#post_comment_form').html(this.register_to_comment())
			return
		}
		if (! this.el_post_reply) {
			this.el_post_reply = $('<div></div>')
		}
		this.remake_form(this.el_post_reply)
		if (! update_form) {
			$('#post_comment_form')
				.append('<b>Комментировать статью</b> '+
						'<span style="color:#999">&mdash; Вы можете редактировать свои комментарии в течение 5 минут.</span>')
				.append(this.el_post_reply)
		}
	},



	el_reply: null,

	comment_reply: function(id_parent) {
		if (! this.el_reply) {
			this.el_reply = $('<div></div>')
		}

		if (User.id) {
			if (this.el_reply[0].id_parent==id_parent  &&  $('form', this.el_reply)) {



				this.el_reply.toggle()
			} else {

				this.remake_form(this.el_reply, id_parent)
				this.el_reply.show()
			}
		} else {

			this.el_reply.html(this.register_to_comment())
		}

		$('#c'+id_parent).append(this.el_reply)

		if (this.el_reply[0].style.display!='none') {
			$('textarea', this.el_reply).focus()
		}

		if (!User.id) {
			$(d.documentElement).animate({scrollTop:$(this.el_reply).offset().top-80}, 500)
		}
		return false
	},



	remake_form: function(jform, id_parent) {
		this.check_nocomment_till()
		if (this.nocomment_till_timer) {
			jform.html('<div style="margin:3px 5px; padding:5px 10px" class="nocomment_till sand_bg">  <b>Совсем недавно вы&nbsp;уже оставляли комментарий. Нужно немного подождать.</b><br>  Вы сможете снова комментировать через <span class="nocomment_till_time"></span></div>')
		} else {
			return this._remake_form(jform, id_parent)
		}
	},


	_remake_form: function(jform, id_parent) {
		var top_pad = id_parent ? 10 : 0
		var lr_pad = id_parent ? 20 : 0
		var btn_title = id_parent ? 'Ответить' : 'Комментировать'
		jform.html('<form style="padding:'+top_pad+'px '+lr_pad+'px 0px">  <textarea style="width:100%; height:120px"></textarea>  <div style="padding-top:5px">	<input type="button" value="'+btn_title+'" onclick="return CommentForm.submit_comment(this, '+id_parent+')" />	<span style="color:#999; font-size:12px; margin-left:10px">(Ctrl + Enter)</span>  </div></form>')
		jform[0].id_parent = id_parent
		this.ctrl_enter_patch(jform)
	},


	ctrl_enter_patch: function(jform) {
		$('textarea', jform).keydown(function(e) {
			if (!e) e = window.event
			if (e.ctrlKey  &&  e.keyCode==13) {
				$(this).parents('form:first').find(':button:first').click()
				return false
			}
			return true
		})
	},



	comment_edit: function(id_comment) {
		var comment = $('#c'+id_comment),
			p = $('p:first', comment)
		var jform = $('<form class="sand_bg" style="padding:0px 0px 5px 5px">  <textarea style="width:98%; height:120px"></textarea>  <div style="padding-top:5px">	<input type="button" value="Сохранить" onclick="return CommentForm.save_comment('+id_comment+')" /> &nbsp;	<input type="button" value="Отмена" onclick="return CommentForm.cancel_edit('+id_comment+')" />  </div></form>')
		$('em', comment).after(jform)
		$('a.edit, a.reply', comment).hide()
		p.hide()
		$('textarea', comment).val(p.text()).focus()
		this.ctrl_enter_patch(jform)
	},



	cancel_edit: function(id_comment) {
		var comment = $('#c'+id_comment)
		$('form', comment).remove()
		$('p:first', comment).show()
		$('a.edit, a.reply', comment).show()
	},



	submit_comment: function(submit, id_parent) {
		var form = $(submit).parents('form')
		form.load('/ajax/post/'+Comment.get_id_post()+'/comment' + (id_parent ? '/'+id_parent : ''),
				  {'Comment-text': $('textarea',form).val()},
				  function() {
					  CommentForm.ctrl_enter_patch($(this))
					  $('textarea', this).focus()
				  })
	},


	save_comment: function(id_comment) {
		var form = $('#c'+id_comment+' form')
		form.load('/ajax/comment/'+id_comment+'/edit',
				  {'Comment-text': $('textarea',form).val()},
				  function() {
					  var textarea = $('textarea', this)
					  if (textarea.length) {
						  CommentForm.ctrl_enter_patch($(this))
						  textarea.focus()
					  } else {
						  if (form.parent().parent().length) {
							  CommentForm.cancel_edit(id_comment)
						  }
					  }
				  })
	},



	register_to_comment: function() {
		return '<div style="margin:20px 10px; width:80%; font-size:13px">  <h3 style="color:#9c0; font:18px Tahoma, sans-serif; padding:0px 0px 10px">	Отвечать на&nbsp;вопросы и&nbsp;оставлять комментарии могут только зарегистрированные пользователи  </h3>  Если вы&nbsp;уже зарегистрированы&nbsp;&#151;  <a href="'+Master.get_login_url()+'" onclick="return WindowLogin.show()">авторизуйтесь</a>, если нет&nbsp;&#151;  <a href="'+Master.get_register_url()+'">зарегистрируйтесь</a>.</div>'
	},



	check_nocomment_till: function() {
		var nocomment_till_cookie = d.cookie.match(/nocomment_till=([0-9.]+)(;|$)/)
		if (nocomment_till_cookie) {
			this.nocomment_till = parseInt(nocomment_till_cookie[1],10)
			if (this.nocomment_till > (new Date).getTime()/1000) {
				this.nocomment_till_timer =
					setInterval(CommentForm.update_nocomment_till, 1000)
			}
		}
	},


	nocomment_till: null,
	nocomment_till_timer: null,

	update_nocomment_till: function() {
		var time_left = Math.round(CommentForm.nocomment_till - (new Date).getTime() / 1000)
		if (time_left > 0) {

			var min = Math.floor(time_left / 60),
				sec = time_left % 60
			$('.nocomment_till_time').html((min ? min+'мин ' : '') + sec+'с')
		} else {

			clearInterval(CommentForm.nocomment_till_timer)
			CommentForm.nocomment_till_timer = null
			$('.nocomment_till').remove()
			CommentForm.remake_form(CommentForm.el_post_reply)
		}
	},



	set_editable_cookie: function(curtime, expires, id_comment) {

		var now = (new Date).getTime()
		var shift = now - curtime*1000
		d.cookie = 'timeshift='+shift+'; path=/; expires='+(new Date(now+86400000)).toGMTString()

		d.cookie = 'editcomment_'+id_comment+'='+expires+'; expires='+(new Date(expires*1000)).toGMTString()
	},



	set_nocomment_till_cookie: function(delay, expires) {
		if (!expires) {
			expires = (new Date).getTime()/1000 + delay
		}
		d.cookie = 'nocomment_till='+expires+'; path=/; expires='+(new Date(expires*1000)).toGMTString()
		this.check_nocomment_till()
	}
}


var
FreshComments = {
	times: {},


	read: function() {
		var me = this,
			data = d.cookie.match(/\bfresh-comments=([^;]+)/)
		if (data) {
			$.each(data[1].split('-'), function() {
				var s = this.split('.'),
					mypost = s[0][0]=='m' ? 'm' : ''
				me.times[mypost ? s[0].substr(1) : s[0]] = [s[1], mypost]
			})
		}
		return this
	},


	write: function() {
		var out = []
		$.each(this.times, function(id_post, time) {
			out.push(time[1]+id_post+'.'+time[0])
		})
		d.cookie = 'fresh-comments='+out.join('-')+'; path=/; expires=' +
			(new Date((new Date).getTime()+86400000*90)).toGMTString()
		return this
	},


	update: function(id_post, my_post) {
		var count = 0,  mycount = 0,  oldest = id_post,  myoldest = id_post,  times = this.times
		times[id_post] = [Math.floor((new Date).getTime() / 1000),
						  (times[id_post] ? times[id_post][1] : '') || (my_post ? 'm' : '')]

		$.each(this.times, function(id_post, time) {
			if (time[1]) {
				if (time[0] < times[myoldest][0])   myoldest = id_post
				mycount++
			} else {
				if (time[0] < times[oldest][0])	 oldest = id_post
				count++
			}
		})
		if (count > 10)	 delete times[oldest]
		if (mycount > 100)  delete times[myoldest]
		return this
	}
}


var
VotingForm = {


	show: function(id_post) {

		if (typeof(id_post)!='number') {
			return
		}


		if (User.id ) {
			var obj = this

			$.get('/ajax/post/'+id_post+'/voted', '', function(data) {
				if (data!='') {

					obj.result(id_post)
				}

				$('#post_voting_form').show()
			})
		} else {

			$('#post_voting_form').show()
		}
	},



	vote: function(id_post, id_answer) {

		if (User.need_login('ответить')) {
			var obj = this

			if (typeof id_answer == 'undefined') {
				url = '/ajax/post/'+id_post+'/vote'
			} else {
				url = '/ajax/post/'+id_post+'/vote/'+id_answer
			}
			$.get(url, '', function(data) {
				if (data!='') {

					obj.result(id_post)
				}
			})
		}
	},



	result: function(id_post) {
		var res = '<div style="margin:-20px 0px 20px; ">'
		var min, max


		if (User.id ) {
			$.get('/ajax/post/'+id_post+'/vote/result', '', function(data) {
				$.each(data.split("\n"), function(i, val) {

					val = val.split("::")
					if (typeof min == 'undefined') {
						min = max = val[1]
					}
					if (val[1]>max) {
						max = val[1]
					}
					if (val[1]<min) {
						min = val[1]
					}
				})
				$.each(data.split("\n"), function(i, val) {
					val = val.split("::")

					var width = Math.round(val[1]*300/100)

					var opacity = 0.3 + ((1-0.3)*(val[1]-min)/(max-min))

					var percent_text = val[1] +'%'
					if (val[2]!='0') {
						percent_text += ' ('+val[2] +' '+ rus(val[2], 'голос голоса голосов') +')'
					}
					res += 	'<div style="color:#666; padding:20px  0px 4px">'+
								'<font color=black>'+(i+1)+'.</font> '+val[0]+
							'</div>'
					res += 	'<div height="1" style="width:'+width+'px; height:1px; background-color:#59b528;'+
								'padding:2px 3px; margin-left:18px; position:absolute; opacity:'+opacity+';'+
								'filter:alpha(opacity='+(opacity*100)+'); font-size:0px"></div>'+
							'<div style="font:10px Tahoma, sans-serif; margin-left:'+(width+30)+'px; '+
								'position:absolute; text-align:right; margin-top:-4px">'+percent_text+'</div>'
				})
				res += '</div>'
				$('#post_voting_form').html(res)

				$('#post_voting_form').show()
			})
		} else {

			$('#post_voting_form').show()
		}
	}
}

var Pager = {
	page: 0,
	page_num: 0,
	near_num: 6,
	base_url: '',

	page_get: 0,


	make: function(rev)
	{

		var t = this
		var page_url = function(page) {
			if (rev) {

				var base_url = t.base_url || (t.page==1 ? './' : '../')
				if (page==1) {
					return base_url
				} else {
					return base_url+'rev'+(t.page_num-page+1)+'/'
				}
			} else {

				if (page==1) {
					return t.base_url || './'
				} else if (t.page_get) {
					var p = t.base_url.indexOf('?') < 0 ? '?page='+page : '&page='+page
					return t.base_url+p
				} else {
					return t.base_url+'page'+page+'.html'
				}
			}
		}

		var ret='', begin, end, i
		if (!this.page_num  ||  !this.page  ||  this.page_num==1) {
			return ''
		} else if (this.page_num <= 10) {
			begin = 1
			end = this.page_num
		} else if (this.page <= this.near_num) {
			begin = 1
			end = this.near_num+1>this.page_num ? this.page_num : this.near_num+1
		} else if (this.page >= this.page_num-this.near_num+1) {
			begin = this.page_num-this.near_num < 1 ? 1 : this.page_num-this.near_num
			end = this.page_num
		} else {
			begin = this.page-this.near_num/2
			end = this.page+this.near_num/2
		}


		ret += '<div style="padding:5px 50px; font:bold 17px Arial">'
		if (begin!=1) {
			ret += '<a style="color:#5E5F5F" href="'+page_url(1)+'">1</a> ... '
		}
		for (i=begin; i<=end; i++) {
			if (i==this.page) {
				ret += ' <span style="background-color:#7b0; margin:0px 3px; padding:0px 3px; color:white">'+i+'</span>'
			} else {
				ret += ' <a style="color:#5E5F5F; margin:0px 3px" href="'+page_url(i)+'">'+i+'</a>'
			}
		}
		if (end!=this.page_num) {
			ret += ' ... <a style="color:#5E5F5F" href="'+page_url(this.page_num)+'">'+this.page_num+'</a>'
		}
		ret += '</div>'


		ret += '<div style="font:16px Arial; padding:0px 40px">'
		if (this.page!=1) {
			ret += '<span style="color:#888; font-size:14px; margin:2px 0px 0px -35px; position:absolute; white-space:nowrap">&larr;ctrl</span>'
			ret += '<a id="prev_page" href="'+page_url(this.page-1)+'" style="margin:0px 5px">предыдущая</a>'
		} else {
			ret += '<span style="margin:0px 5px; color:#888;">предыдущая</span>'
		}
		if (this.page!=this.page_num) {
			ret += '<a id="next_page" href="'+page_url(this.page+1)+'" style="margin:0px 5px">следующая</a>'
			ret += '<span style="color:#888; font-size:14px">ctrl&rarr;</span>'
		} else {
		  ret += '<span style="margin:0px 5px; color:#888;">следующая</span>'
		}
		ret += '</div>'


		$(d).keydown(function(e) {
			var link
			if (!e) e = window.event
			var k = e.keyCode
			if (e.ctrlKey) {
				if (k == 37) {
					link = $id('prev_page')
				}
				if (k == 39) {
					link = $id('next_page')
				}
			}

			if (link!==undefined  &&  link  &&  link.tagName=="A") {
				d.location = link.href
			}
		})

		return ret
	}
}

if (d.cookie.match(/\b__admin__=([^;]+)/)) {
	$.getScript('/static/js/adm.js')
}


var
Fav = {
	ids: [],
	text: null,



	init: function()
	{
		$.each($('img[name=fav_star]'), function(i, val) {

			$(val).click(function(){
				$(this).css('opacity', (Fav.toggle(parseInt($(this).attr('fav_id'), 10))) ? 1 : 0.5)
			})


			if ($.inArray(parseInt($(val).attr('fav_id'), 10), Fav.ids) == -1) {
				$(this).css('opacity', 0.5)
			}
		})
	},


	prepare: function()
	{

		if (ids = d.cookie.match(/\bfav=([^;]+)/)) {

			Fav.ids = unescape(ids[1]).split(',')

			Fav.ids = $.map(Fav.ids, function(n, i){
				return parseInt(n, 10)
			})
		}
	},


	toggle: function(id)
	{

		if ($.inArray(id, Fav.ids) != -1) {

			Fav.ids = $.grep(Fav.ids, function(n, i){
				return (n != id)
			})
			value = Fav.ids.join(',')
			var in_fav = 0
		} else {

			Fav.ids.push(id)
			value = Fav.ids.join(',')
			var in_fav = 1
		}


		var expiredays = 360
		var exdate = new Date()
		exdate.setDate(exdate.getDate()+expiredays)


		document.cookie="fav="+escape(value)+"; path=/; expires="+exdate.toGMTString()


		Fav.saved()

		return in_fav
	},


	saved: function()
	{
		if ($id('favnum')==undefined) return

		var num = Fav.ids.length

		if (num) {
			$id('favnum').innerHTML = '('+num+')'
		} else {
			$id('favnum').innerHTML = ''
		}
	}
}


Fav.prepare()


$(function(){ Fav.init() })





var F4 = {

	flash_field: function(el) {
		var stylename = el.style.borderColor ? 'borderColor' : 'borderBottomColor'
		var oldclr = el.style[stylename]
		el.style[stylename] = '#F8B435'
		$(el).animate({opacity:1}, 500, function() {
			el.style[stylename] = oldclr
		})
	}
}
