_ua=/*@cc_on (_=document.createElement('I'),_.innerHTML='<!--[if IE 7]>ie7<![endif]--><!--[if IE 8]>ie8<![endif]-->',_.innerText)||'ie6' @*/+''||window.opera&&'op'||(function _(){})[-5]=='_'&&'ff3'||(function _(){})[-6]=='_'&&'ff2'||/a/.__proto__=='\/\/'&&'wk'||/source/.test((/a/.toString+''))&&'cr'||''; _0=function(){ if(!window._1||!window._id) return; document.cookie="t="+escape([_id,_2&&_2-_1,_3&&_3-_2,_4&&_4-_1,_ua].join('|'))+"; path=/; domain=."+/[^.]+\.[^.]+$/.exec(location.host); },_1=window._1||+new Date,_2=_3=_4=0; function $class(superclass, overrides) { var subclass, F, supp, subp, i, s, d; i=superclass instanceof Function; overrides=overrides || !i && superclass || {}; superclass=i && superclass || null; if(overrides.constructor!=Object.prototype.constructor) subclass=overrides.constructor, delete overrides.constructor; else if(superclass) subclass=function(){ arguments.callee.$super.apply(this,arguments); }; else subclass=function(){}; if(!superclass){ subclass.prototype=overrides; }else{ F=function(){}; supp=F.prototype=superclass.prototype; subp=subclass.prototype=new F(); subp.constructor=subclass; subclass.$super=superclass; if(supp.constructor==Object.prototype.constructor) supp.constructor=superclass; for(i in overrides){ s=overrides[i], d=subp[i]; if(s instanceof Function && d instanceof Function) s.$super=d; subp[i]=s; } } return this.constructor==arguments.callee ? new subclass() : subclass; } function $super(scope,args) { var fn=args.callee.$super; if(arguments.length>2) args=Array.prototype.slice.call(arguments,2); return fn && fn.apply(scope,args); } function $config(dst,src,def) { var i; for(i in def) dst[i]=def[i]; for(i in src) dst[i]=src[i]; return dst; } function $mixin(dst,src) { var i,s,d; if(dst instanceof Function) dst=dst.prototype; if(src instanceof Function) src=src.prototype; for(i in src){ s=src[i], d=dst[i]; if('function'==typeof s==typeof d ){ if(dst.hasOwnProperty(i) && d.$super) s.$super=d.$super; else p.$super=d; } dst[i]=src[i]; } return dst; } function $static(self) { return self.prototype.constructor; } Function.prototype.bind=function(scope) { var fn=this; if(arguments.length<2){ return function(){ return fn.apply(scope, arguments); } }else{ var args=Array.prototype.slice.call(arguments,1); return function(){ return fn.apply(scope, args.concat(Array.prototype.slice.call(arguments,0))); } } }; if(!window.XMLHttpRequest && window.ActiveXObject) (function(){ var msid=['MSXML2.XMLHTTP.6.0','MSXML2.XMLHTTP.5.0','MSXML2.XMLHTTP.4.0','MSXML2.XMLHTTP.3.0','MSXML2.XMLHTTP', 'MICROSOFT.XMLHTTP.1.0','MICROSOFT.XMLHTTP.1','MICROSOFT.XMLHTTP']; for(var i=0; i<msid.length; i++) try{ new ActiveXObject(msid[i]); msid=msid[i]; break; }catch(er){} if(typeof msid=='string') window.XMLHttpRequest=function(){ return new ActiveXObject(msid); }; })(); var $r=$class({ url:'', params:'', method:'get', async:true, ws:true, auto:true, ready:function(){}, error:function(){}, scope:null, _stub:function(){}, transport:null, json:null, constructor:function(url, options, scope) { $config(this,options); this.scope=scope||this; this.url=url; if(!url) return; var self=this; this.wait_fn=function(){ self.wait(); }; if(this.auto) this.request(); }, request:function() { var url=this.url, params_str='', method=this.method.toUpperCase(); if(typeof(this.params)=='string'){ params_str=this.params; }else{ if(this.ws) this.params.ws=1; params_str=$r.toQueryString(this.params); } if(method=='GET' && params_str){ url+=(url.indexOf('?')!=-1?'&':'?')+params_str; params_str=''; } if(this.transport){ this.abort(); this.json=null; } else this.transport=new XMLHttpRequest(); var t=this.transport; t.onreadystatechange=this.wait_fn; t.open(method, url, this.async); if(method=='POST'){ t.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=utf-8'); t.setRequestHeader('Content-Length', params_str.length); if(t.overrideMimeType && (navigator.userAgent.match(/Gecko\/(\d{4})/)||[0,2005])[1]<2005) t.setRequestHeader('Connection', 'close'); } t.send(params_str||null); }, wait:function() { var t=this.transport; if(t.readyState!=4 || !t.status) return; try{ if(t.status!=200) throw 'response status is '+t.status; if(!t.responseText) throw 'response is empty'; if('text/javascript'==t.getResponseHeader("Content-Type").split(';')[0]) this.json=eval('('+t.responseText+')'); }catch(er){ this.errorEx(er); } var scope=(this.readyEx==$r.prototype.readyEx?this:this.scope); this.readyEx.call(scope,this); }, abort:function() { var t=this.transport; if(!t) return; t.onreadystatechange=this._stub; t.abort(); }, readyEx:function(transport) { if(!this.json) return this.errorEx('not a JSON'); if('auth' in this.json){ window.location.href=this.json.auth; return; } this.ready.call(this.scope,this.json); }, errorEx:function(er) { this.error.call(this.scope); } }); if(!window.XMLHttpRequest){ $r.prototype.request=function(){ this.errorEx('not supported'); }; } $r.script=function(src, onloadfn, scope) { var script=document.createElement('SCRIPT'); script.setAttribute('type', 'text/javascript'); if(onloadfn){ var script_loaded=function(){ onloadfn.call(scope); script.onreadystatechange=null; $e.stopObserving(script,'load',script_loaded); script=null; }; script.onreadystatechange=function(){ if(this.readyState=='complete' || this.readyState=='loaded'){ script_loaded(); } }; $e.observe(script,'load',script_loaded); } script.src=src; document.getElementsByTagName('HEAD')[0].appendChild(script); }; $r.toQueryString=function(params) { var r=[],v; for(var i in params){ v=params[i]; switch(typeof(v)){ case 'string': v=encodeURIComponent(v); break; case 'number': case 'boolean': break; case 'object': if(v instanceof Array){ if(i.indexOf('[]')==-1) i=i+'[]'; i=encodeURIComponent(i); for(var j=0, n=v.length; j<n; j++){ r[r.length]=(i+'='+encodeURIComponent(v[j])); } continue; } default: v=''; } r[r.length]=(encodeURIComponent(i)+'='+v); } return r.join('&'); }; $r.fromQueryString=function(str) { if(str.indexOf('?')!=-1) str=str.substring(str.indexOf('?')+1); var obj={}; str=str.split('&'); for(var i=0, p, n=str.length; i<n; i++){ p=str[i].split('='); obj[decodeURIComponent(p[0])]=decodeURIComponent(p[1]); } return obj; }; $r.serialize=function(el) { if(!el) return; var els=el.elements, r={}; for(var i=0, n=els.length; i<n; i++){ el=els[i]; if(!el.name || el.disabled || (!el.checked && !/select|textarea/i.test(el.nodeName) && !/text|hidden|password/i.test(el.type))) continue; if(el.nodeName!='SELECT'){ if(el.name.indexOf('[]')!==-1){ if(el.name in r) r[el.name][r[el.name].length]=el.value; else r[el.name]=[el.value]; }else{ r[el.name]=el.value; } }else{ var values=[], one=(el.type=='select-one'); if(el.selectedIndex<0) values=''; else if(one) values=el.value; else for(var j=0, options=el.options, m=options.length; j<m; j++){ var option=options[j]; if(option.selected){ value=(option.attributes.value||{}).specified?option.value:option.text; values[values.length]=value; } } r[el.name]=values; } } return r; }; var $=window.$||function(el) { if(typeof(el)=='string') el=document.getElementById(el); return el || null; }; var $el={ _document_dimensions:function () { var w=0, h=0; if(_ua=='wk' && !document.evaluate){ w=self.innerWidth, h=self.innerHeight; }else if(window.opera && parseFloat(window.opera.version()) < 9.5){ w=document.body.clientWidth, h=document.body.clientHeight; }else{ w=document.documentElement.clientWidth, h=document.documentElement.clientHeight; } return {width:w, height:h}; }, cumulativeOffset:function(el) { var top=0, left=0; do{ top+=el.offsetTop||0; left+=el.offsetLeft||0; el=el.offsetParent; }while(el); return {left:left, top:top}; }, dimensions:function(el) { if(el==document) return $el._document_dimensions(); var display=el.style.display; if (display!='none' && display!=null) return {width: el.offsetWidth, height: el.offsetHeight}; var els=el.style, originalVisibility=els.visibility, originalPosition=els.position, originalDisplay=els.display; els.visibility='hidden'; els.position='absolute'; els.display='block'; var originalWidth=el.clientWidth, originalHeight=el.clientHeight; els.display=originalDisplay; els.position=originalPosition; els.visibility=originalVisibility; return {width: originalWidth, height: originalHeight}; }, remove:function(el) { el && el.parentNode && el.parentNode.removeChild(el); }, hasClassName:function(el, className) { if(!el) return; var ecl=el.className; return ecl.length>0 && (ecl==className || new RegExp("(^|\\s)"+className+"(\\s|$)").test(ecl)); }, addClassName:function(el, className) { if(!el) return; if(!$el.hasClassName(el,className)) el.className += (el.className ? ' ' :'') + className; }, removeClassName:function(el, className) { if(!el) return; el.className=el.className.replace(new RegExp("(^|\\s+)"+className+"(\\s+|$)"), ' '); }, toggleClassName:function(el, className) { if(!el) return; var fl=$el.hasClassName(el,className); if(fl) $el.removeClassName(el,className); else $el.addClassName(el,className); return fl; } }; var $u=new $class({ el:function(nodeName, attributes) { var el, style, i; if(/*@cc_on!@*/false && attributes && (nodeName.toLowerCase()=='input' || 'name' in attributes || 'type' in attributes)){ el=document.createElement('<'+nodeName.toLowerCase()+' name="'+attributes.name+'" type="'+attributes.type+'" >'); delete attributes.name, delete attributes.type; }else{ el=document.createElement(nodeName.toUpperCase()); } if(!attributes) return el; style=attributes.style; if(style){ if(typeof style=='string') el.style.cssText=style; else $config(el.style,style); delete attributes.style; } $config(el,attributes); return el; }, tpl:function(tpl,dict,dict_def) { return tpl.replace( /\{([\w-]+)\}/g, dict_def ? function(str,key){ return dict[key]||dict_def[key]||((typeof(dict[key])=='number'||typeof(dict_def[key])=='number')?0:''); } : function(str,key){ return dict[key]||(typeof(dict[key])=='number'?0:''); } ); }, tpl2el:function(tpl,dict,dict_def) { var el=document.createElement('DIV'); el.innerHTML=(dict||dict_def) && $u.tpl(tpl.replace(/(^\s+|\s+$)/g,''),dict,dict_def) || tpl; return el.childNodes.length==1 ? el.firstChild : el; }, _imageArray:[], preloadImages:function(imgs) { if(!document.images) return; var ar=$u._imageArray; for(var i=0,j=ar.length; i<imgs.length; i++,j++){ ar[j]=new Image; ar[j].src=imgs[i]; } }, set_cookie:function(name, value, expires, path, domain, secure) { document.cookie = name + '=' + escape(value) + (expires ? '; expires=' + (expires instanceof Date ? expires.toGMTString() : expires):'') + (path ? '; path=' + path:'') + (domain ? '; domain=' + domain:'') + (secure ? '; secure':''); }, get_cookie:function(name) { var m=document.cookie.match(new RegExp('(^|; )'+name+'=(.*?)(;|$)')); return m && decodeURIComponent(m[2]) || null; }, wins:{}, wopen:function(url, name, w, h, antiblock, resizable, scrollbars) { $u.wins[name]=window.open(url, name, 'width=' + w + ',height=' + h + ',resizable=' + (resizable||'1') + ',toolbar=0,location=0,status=0,menubar=0,directories=0,scrollbars=' + (scrollbars || 'yes')); if($u.wins[name]) $u.wins[name].focus(); return $u.wins[name]; }, add_href:function(href, add) { return href + (href.indexOf('?')!=-1 ? '&' : '?') + add; }, textarea_count:function(textarea,counter,limit) { if(0+counter==counter){ limit=counter; counter=$(textarea+'_count'); } if(!counter) return; textarea=$(textarea); if(!textarea) return; limit=parseInt(limit)||50; var do_count=function() { var cnt=limit-textarea.value.length; if(cnt<0){ textarea.value=textarea.value.substr(0,limit); cnt=0; } counter.innerHTML=cnt; }; do_count(); textarea._textarea_count=do_count; $e.add(textarea,'keyup',do_count,this); }, textarea_stop_count:function(textarea) { textarea=$(textarea); if(textarea && textarea._textarea_count){ $e.del(textarea,'keyup',textarea._textarea_count,this); textarea._textarea_count=null; } } }); var $e=$class( { constructor:function() { this._manage_fn=this.manage.bind(this); var hs=this._handlers; this._type_map={'#':hs.id, '.':hs.cl, '* ':hs.up, '__any__':hs.any, '__all__':hs.all}; this.observe(document, 'click', this._manage_fn); this._init_ready(); }, observe:function(el, type, fn) { el && el.addEventListener(type,fn,false); }, stopObserving:function(el, type, fn) { el && el.removeEventListener(type,fn,false); }, stop:function(e) { e.preventDefault(); e.stopPropagation(); return true; }, isLeftClick:function(e) { return e.which ? (e.which==1 && !e.metaKey) : event.button==0; }, pointerXY:function(e) { var docElement=document.documentElement, body=document.body || { scrollLeft: 0, scrollTop: 0 }; return { x: e.pageX || (e.clientX + (docElement.scrollLeft || body.scrollLeft) - (docElement.clientLeft || 0)), y: e.pageY || (e.clientY + (docElement.scrollTop || body.scrollTop) - (docElement.clientTop || 0)) }; }, element:function(e) { return e && (e.target||e.srcElement); }, key:function(e) { return e && (e.charCode||e.keyCode||e.which||0); }, e:null, add:function(el, type, fn, scope) { this.observe(el, type, this._extend(fn,scope)); }, del:function(el, type, fn, scope) { var f, fns=this._extend_fns; for(var i=0, n=fns.length; i<n; i++) if(fns[i][0]==fn && fns[i][1]==scope){ f=fns[i][2]; if(!--fns[i][3]) fns.splice(i,1); break; } if(f) this.stopObserving(el, type, f); }, _extend_fns:[], _extend:function(fn,scope) { var fns=this._extend_fns; for(var i=0, fni, n=fns.length; i<n; i++){ fni=fns[i]; if(fni[0]==fn && fni[1]==scope){ fni[3]++; return fni[2]; } } var fnEx=function $e_extend_wrapper(e){ $e.e=e; if(!fn.call(scope,$(e.target||e.srcElement))) $e.stop(e); }; fns[i]=[fn,scope,fnEx,1]; return fnEx; }, _is_ready:false, _ready_handlers:[], _init_ready:function() { if(!window.encodeURIComponent || !document.getElementById) return; var _fire_ready=this._fire_ready_fn=this._fire_ready.bind(this); if(document.addEventListener) document.addEventListener('DOMContentLoaded', _fire_ready, false); if(/WebKit/i.test(navigator.userAgent)){ (function(){ if(!/loaded|complete/.test(document.readyState)){ setTimeout(arguments.callee, 10); return; } _fire_ready(); })(); } if(/*@cc_on!@*/false){ document.write('<scr'+'ipt id="__ie_init" defer '+'src="\/\/:"></'+'script>'); var script=document.getElementById('__ie_init'); script.onreadystatechange=function(){ if(this.readyState=='complete') _fire_ready(); }; script=null; } this.observe(window, 'load', _fire_ready); }, _fire_ready:function() { if(this._is_ready) return; this._is_ready=true; _0(_2=+new Date); var ar=this._ready_handlers; for(var i=0, n=ar.length; i<n; i++){ ar[i][0].call(ar[i][1]); } _0(_3=+new Date); this._ready_handlers=[]; this.stopObserving(window, 'load', this._fire_ready_fn); if(document.addEventListener) document.removeEventListener('DOMContentLoaded', this._fire_ready_fn, false); var script=document.getElementById('__ie_init'); script && script.parentNode.removeChild(script); }, onload:function(fn,scope) { if(this._is_ready) fn.call(scope); else this._ready_handlers[this._ready_handlers.length]=[fn,scope]; }, _handlers:{ id:{}, cl:{}, up:{}, all:[], any:[] }, _type_re:/(?:(#|\.|\* |__all__|__any__)\s*([\w\-_]*\s*([^,]*)),?\s*)/g, _type_map:{'#':'id', '.':'cl', '* ':'up', '__any__':'any', '__all__':'all'}, on:function(type,fn,scope) { if(typeof(type)=='object'){ for(var i in type) this.on(i,type[i],fn); return false; } var self=this; type=type.replace(this._type_re,function(match, typeclass, selector, complex, offset, type) { if(complex && typeclass!='* '){ return match; } var hs=self._type_map[typeclass]; hs[selector||hs.length]=[fn,scope||null]; return ''; }); }, un:function(type,fn,scope) { if(typeof(type)=='object'){ for(var i in type) this.un(i,type[i],fn); return; } var self=this; var res=type.replace(this._type_re,function(match, typeclass, selector, complex, offset, type) { if(complex && typeclass!='* '){ return ''; } var hs=self._type_map[typeclass]; if(selector){ delete hs[selector]; }else{ for(var i=0, n=hs.length; i<n; i++){ if(hs[i][0]==fn && hs[i][1]==scope){ hs.splice(i,1); break; } } } return ''; }); }, manage:function $e_manage(e) { $e.e=e; var i, n, ar, ari, fn, cl, hs=this._handlers, el=$(e.target||e.srcElement); try{ ar=hs.all; if(ar.length) try{ for(var i=0,n=ar.length; i<n; i++){ ar[i][0].apply(ar[i][1],arguments) } }catch(er){ if(er==$e){ this.stop(e); return; } throw er; } fn=hs.id[el.id]; if(fn){ if(!fn[0].call(fn[1],el)) this.stop(e); return; } cl=el.className; ar=hs.cl; if(cl){ cl=cl.split(' '); for(var i=0,n=cl.length; i<n; i++){ fn=ar[cl[i]]; if(fn){ if(!fn[0].call(fn[1],el)) this.stop(e); return; } } } ar=hs.up; for(var i in ar){ ari=ar[i]; var tfnres=$q.up(el,i); if(tfnres){ if(!ari[0].call(ari[1],tfnres)) this.stop(e); return; } } ar=hs.any; if(ar.length) for(var i=0,n=ar.length; i<n; i++){ ari=ar[i]; if(ari[0].apply(ari[1],arguments)){ this.stop(e); return; } } }catch(er){ } } }); if(!window.addEventListener){ $config($e.prototype, { _ie_handlers:[], observe:function(el, type, fn) { if(!el) return; el.attachEvent('on'+type,fn); this._ie_handlers[this._ie_handlers.length]=[el,type,fn]; }, stopObserving:function(el, type, fn) { if(!el) return; el.detachEvent('on'+type,fn); var hs=this._ie_handlers; for(var i=0,n=hs.length; i<n; i++){ var h=hs[i]; if(h[0]==el && h[1]==type && h[2]==fn){ hs.splice(i,1); return; } } }, stop:function(e) { e.returnValue=false; e.cancelBubble=true; return true; }, isLeftClick:function(e) { return e.button==1; } }); window.attachEvent('onunload', function() { var hs=$e._ie_handlers; for(var i=0,n=hs.length; i<n; i++){ var h=hs[i]; h[0].detachEvent('on'+h[1],h[2]); } $e._ie_handlers=[]; window.detachEvent('onunload', arguments.callee); }); } $e=new $e(); $e.observe(window,'load',function(){ _0(_4=+new Date); }); $u.app=new $class({ state:{}, constructor:function() { var init_fn=this.init.bind(this); $e.onload(function() { setTimeout(init_fn,50); }); }, init:function() { var state=window.location.hash; if(!state && !/^#!/.test(state)) return; state=state.substr(2); var handler=this.state[state]; if(handler) handler[0].call(handler[1]); }, on:function(state,fn,scope) { this.state[state]=[fn,scope||null]; }, un:function(state,fn,scope) { delete this.state[state]; }, set:function(url) { if(!url) return; var href=url.split('#'); var hash=href[1]; href=href[0]; if(window.location.href.split('#')[0]==href || !href){ if(hash){ window.location.hash=hash; this.init(); }else{ window.location.reload(); } }else{ window.location=url; } } }); var $q=(function() { var yass= (function(){ var r_simple=/^[\w#.]\w*$/, r_comma=/ *, */, r_space=/ +/, r_sel=/([^[:.#]+)?(?:#([^[:.#]+))?(?:\.([^[:.]+))?(?:\[([^!~^*|$[:=]+)([!$^*|]?=)?([^:\]]+)?\])?(?:\:([^(]+)(?:\(([^)]+)\))?)?/, doc = document, q = !!doc.querySelectorAll, k = !!doc.getElementsByClassName, toArray=function(col) { var ar=[], el, i=0; while(el=col[i]) ar[i++]=el; return ar; }; var _ = function (root, selector, one) { root = root || doc; if (r_simple.test(selector)) { var idx = 0, sets = []; switch (selector.charAt(0)) { case '#': idx = selector.slice(1); sets = doc.getElementById(idx); if (doc.all && sets && sets.id !== idx) { sets = doc.all[idx]; } if (sets) { var p = sets; if (root != doc) while((p = p.parentNode) && p != root) {} if (p) return one ? sets : [sets]; } return one ? null : []; case '.': var klass = selector.slice(1); if (k) { sets = root.getElementsByClassName(klass); return sets.length ? one ? sets[0] : toArray(sets) : one ? null : []; } else { klass = ' ' + klass + ' '; var nodes = root.getElementsByTagName('*'), i = 0, node; while (node = nodes[i++]) { if ((' ' + node.className + ' ').indexOf(klass) != -1) { sets[idx++] = node; if(one) return node; } } return idx ? sets : one ? null : []; } default: sets = root.getElementsByTagName(selector); return sets.length ? one ? sets[0] : toArray(sets) : one ? null : []; } } else { if (q && selector.indexOf('!=') == -1) { if (one) return root.querySelector(selector); else return toArray(root.querySelectorAll(selector)); } else { var groups_length = 0, groups = selector.split(r_comma), group, sets = [], singles, single, i, nodes, newNodes, idx, J, child, last, childs, item, h, id, klass, tag, par, stack, rootReq = root && root !== doc; while (group = groups[groups_length++]) { singles = group.split(r_space); newNodes = []; stack = []; h = 0; idx = 0; J = 0; i = 0; while (single = singles[i++]) { single = r_sel.exec(single); stack[h++] = [single[1] ? single[1].toLowerCase() : '', single[2], single[3] ? ' ' + single[3] + ' ' : '']; } item = stack[h - 1]; tag = item[0]; id = item[1]; klass = item[2]; if (id) { nodes = [doc.getElementById(id)]; if (doc.all && nodes[0].id !== id) { nodes = doc.all[idx]; } while (child = nodes[J++]) { if ((!tag || child.nodeName.toLowerCase() === tag) && (!klass || (' ' + child.className + ' ').indexOf(klass) != -1)) { if (one && h==1) return child; if (i == 1) { child._cse = 1; } newNodes[idx++] = child; } } } else { if (k && klass) { nodes = doc.getElementsByClassName(klass); while (child = nodes[J++]) { if ((!tag || child.nodeName.toLowerCase() === tag) && (!id || child.id === id)) { if (one && h==1) return child; if (i == 1) { child._cse = 1; } newNodes[idx++] = child; } } } else { nodes = root.getElementsByTagName(tag || '*'); while (child = nodes[J++]) { if ((!id || child.id === id) && (!klass || (' ' + child.className + ' ').indexOf(klass) != -1)) { if (one && h==1) return child; if (i == 1) { child._cse = 1; } newNodes[idx++] = child; } } } } i = h; if (i--) { nodes = newNodes; idx = 0; J = 0; newNodes = []; while (child = nodes[J++]) { h = i - 1; par = child; while ((item = stack[h--]) && par && (par = par.parentNode)) { tag = item[0]; id = item[1]; klass = item[2]; while (par && ((tag && par.nodeName.toLowerCase() !== tag) || (id && par.id !== id) || (klass && (' ' + par.className + ' ').indexOf(klass) == -1))) { par = par.parentNode; } } if (rootReq) { while ((par = par.parentNode) && par !== root) {} } if (child && par && !child._cse) { if (one) return child; child._cse = 1; newNodes[idx++] = child; } } } if (groups_length > 1) { sets = sets.concat(newNodes); } else { sets = newNodes; } } if (one && (!sets || !sets.length)) return null; idx = (sets = sets || []).length; while (idx--) { sets[idx]._cse = null; } return sets; } } }; _.up = function(node, selector) { if (r_simple.test(selector)) { var s1, p = node; switch (selector.charAt(0)) { case '#': s1 = selector.slice(1); while ((p=p.parentNode)) if (p.id == s1) return p; break; case '.': s1 = ' ' + selector.slice(1) + ' '; while ((p=p.parentNode)) if ((' ' + p.className + ' ').indexOf(s1) != -1) return p; break; default: while ((p=p.parentNode)) if (p.nodeName.toLowerCase() === selector) return p; } return null; } else { var i, j = 0, l, groups = selector.split(r_comma), group, singles, single, p, r, id, klass, tag; groups:while (group = groups[j++]) { p = r = node; singles = group.split(r_space); i = l = singles.length; l--; singles:while (single = singles[--i]) { single = r_sel.exec(single); tag = single[1] ? single[1].toLowerCase() : '', id = single[2], klass = single[3] ? ' ' + single[3] + ' ' : ''; while(p=p.parentNode){ if ((!id || p.id === id) && (!tag || tag === '*' || p.nodeName.toLowerCase() === tag) && (!klass || (' ' + p.className + ' ').indexOf(klass) != -1)) { if (i==l) r = p; if (i==0) return r; else continue singles; } } continue groups; } } return null; } }; return _; })(); return { select:yass, down:function(el,s) { return yass(el,s,true); }, up:yass.up }; })(); var vars=this.vars || {}, $vars=this.$vars || {}; var dPage=$class({ name:'', constructor:function() { if(this.init || !this.name) $e.onload(this.name ? this.onload : this.init, this); }, onload:function() { var _vars=$vars[this.name] || vars[this.name]; _vars && $config(this, _vars, this.defaults); this.init && this.init.apply(this,arguments); } }); dPage.getVars=function(name) { return $vars[name] || vars[name]; }; dPage.setVars=function(name, config) { return $vars[name]=$config($vars[name] || vars[name] || {}, config); }; JSRoot='\/\/images.badoo.com/1614/-/-/'; try{ document.documentElement.className='js'; }catch(e){} if(_ua=='ie6') try{ document.execCommand('BackgroundImageCache', false, true); }catch(er){} var dOvlClass=$class(dPage, { name:'dOvl', close_str:'Close', title_str:'Loading...', html:'<div class="dOvl-loading"><h3>{title}<span class="waiting"></span></h3></div>', url:'', params:{}, onLoad:null, onUnLoad:null, onError:null, onResize:null, scope:null, hide_close:false, defaults:{ html:'<div class="dOvl-loading"><h3>{title}<span class="waiting"></span></h3></div>', url:'', params:{}, onLoad:null, onUnLoad:null, onError:null, onResize:null, scope:null, hide_close:false, tpl:'' }, tpl:'', _tpl:'<div class="dOvl-wrap">\ <a href="#" class="dOvl-close-css dOvl-close" title="{close}">{close}</a>\ <div id="dOvl">\ {html}\ </div>\ </div>\ <div class="dOvl-f"><div class="dOvl-br"></div></div>', _bg:null, _cont:null, _el:null, _transport:null, _evts:false, _visible:false, _labels:null, init:function() { $e.on({ '.dOvl-open':this.auto, '.dOvl-close':this.close, '.dOvl-next':this.next, '.dOvl-prev':this.prev, '.dOvl-prev-other':this.prev_other }, this); this.prepare_tpl(); }, prepare_tpl:function() { this.html=this.defaults.html=$u.tpl(this.html,{title:this.title_str}); this._tpl=$u.tpl(this._tpl,{ close:this.close_str, html:'{html}' }); }, auto:function(el) { var url=el.rev || el.rel || el.href || ''; if(!url){ return; } this.open({ url:url }); }, _update_bg:function() { if(!this._bg){ this._bg=$u.el('div',{className:'dOvl-bg'}); document.body.appendChild(this._bg); } this._bg.style.height=$('wrap').offsetHeight+'px'; }, open:function(options) { dOvlErr.close(); if(!this._evts){ $e.add(window,'resize',this.center,this); $e.add(document,'keydown',this.keypress,this); this._evts=true; } if(window.dConfirm) dConfirm.hide(); $config(this, options, this.defaults); this.removeContainer(); if(!this._cont){ this._cont=$u.el('div',{className:'dOvl-cont',innerHTML:$u.tpl(this._tpl,{html:this.html})}); document.body.appendChild(this._cont); this._el=$('dOvl')||$('dOvlCloud'); } if(this.tpl) this._cont.innerHTML=$u.tpl(this.tpl,{html:this.html}); if(this.hide_close) $el.addClassName(this._cont, 'dOvl-hide-close'); this._update_bg(); if(!this._visible) $el.addClassName(document.body, 'dOvl-opened'); this._cont.style.display='block'; this._visible=true; if(this.url) this.load(); else this.post_load(this.html); this.center(); }, removeContainer:function() { if (!this._cont) return; document.body.removeChild(this._cont); this._cont = null; }, close:function() { if(this.onUnLoad) if(this.onUnLoad.call(this.scope)) return; dLabel.destroy(this._labels); this._labels=null; if(this._cont && this.hide_close) $el.removeClassName(this._cont, 'dOvl-hide-close'); if(this._evts){ $e.del(window,'resize',this.center,this); $e.del(document,'keydown',this.keypress,this); this._evts=false; } this.removeContainer(); if(this._visible) $el.removeClassName(document.body, 'dOvl-opened'); if(this._transport){ this._transport.abort(); this._transport=null; } this._visible=false; }, load:function() { var method='get'; this.params=this.params||{}; if(this.params.method){ method=this.params.method; delete this.params.method; } this.params.rand=(''+Math.random()).substr(2,5); this._transport=new $r(this.url,{ method:method, params:this.params, readyEx:this.load_done, error:this.load_error },this); }, load_done:function(r) { var res={errno:0}; try{ res=eval('('+r.transport.responseText+')'); }catch(er){ res.html=r.transport.responseText; } this._transport=null; return this.load_done2(res); }, load_done2:function(res) { if (!res.errno && !res.pp_type){ html=res.html; }else{ if(res.auth){ window.location=res.auth; return; }else{ dOvlErr.open({html:res.html}); return this.onError && this.onError.call(this.scope, res); } } if(res && res.tpl) this._cont.innerHTML=$u.tpl(res.tpl,{html:res.html}); else this._el.innerHTML=res.html; this.post_load(res); this.center(); }, post_load:function(res) { if(this.onLoad) this.onLoad.call(this.scope, res); this._labels=dLabel.init(this._el); }, next:function(el) { if (!this._el) return true; var form=$q.down(this._el,'form'); if(!form) this.close(); var submit; for(var els=form.elements, i=els.length-1; i>=0; i--){ if(els[i].type=='submit'){ submit=els[i]; break; } } if(submit && $el.hasClassName(submit,'disabled')) return; if(this.onUnLoad) this.onUnLoad.call(this.scope); if (submit) $u.startWaiting(submit); if (el && el.getAttribute('rev')) this.url = el.getAttribute('rev'); else this.url=form.action || this.url; this.params=$r.serialize(form) || {}; this.params.method=form.method||'post'; this.load(); }, prev:function(el) { this.url=el.rev||el.href||this.url; this.params={ method:'get' }; if(this.onUnLoad) this.onUnLoad.call(this.scope); var prev=$q.up(el,'.prev_step'); prev && $el.addClassName(prev,'load'); this.load(); }, prev_other:function(el) { this.onUnLoad && this.onUnLoad.call(this.scope); $config(this, this.defaults); return this.prev(el); }, load_error:function(r, er) { if(this._evts){ $e.del(window,'resize',this.center,this); this._evts=false; } this.onError && this.onError.call(this.scope, null); }, center:function(e) { if(!this._cont) return; var h=this._cont.offsetHeight; var wh=(self.innerHeight || document.documentElement.clientHeight || document.body.clientHeight || 0); var t=(wh-h)/2; t=parseInt(t<0?0:t); if(_ua=='ie6') this._cont.style.marginTop=t+'px'; else this._cont.style.top=t+'px'; this._bg.style.height=$('wrap').offsetHeight+'px'; this.onResize && this.onResize.call(this,t); if(e){ this._bg.style.height=$('wrap').offsetHeight+'px'; } return t; }, keypress:function(el) { var e=$e.e; var code = e.charCode||e.keyCode||e.which||0; if(code==27) this.close(); if(code==13 && el) { var enter_btn = el.getAttribute('enter_btn'); if (enter_btn && $(enter_btn)) { if(/*@cc_on!@*/true) { setTimeout(function () { $(enter_btn).click(); }, 1); } else { $(enter_btn).click(); } return false; } return true; } return true; } }); var dOvlClassEx=$class(dOvlClass, { handlers_url:JSRoot+'js/overlays/handlers.js', handlers_loaded:false, handlers:{}, init:function() { $super(this,arguments); $e.on({ '.dOvl-open-ex': this.open_ex, '.dOvl-open-ex-up': this.open_ex_up }, this); var _vars=dPage.getVars('promo'); _vars && this.open_ex(_vars); }, on:function(name,fn,scope) { if(typeof name=='string'){ this.handlers[name]=[fn,scope]; }else{ for(var i in name){ this.handlers[i]=[name[i],fn]; } } }, open_ex:function(el) { var type=el.type||el.rel, url=el.url||el.rev, handler=this.handlers[type]; if(!type || (!handler && this.handlers_loaded)){ return this.open('nodeType' in el ? el : {url:url}); } if(handler){ return handler[0].call(handler[1], el); } if(!this.handlers_loaded){ this.open({}); $r.script(this.handlers_url, this.open_ex.bind(this,el)); this.handlers_loaded=true; return; } }, open_ex_up:function(el) { return this.open_ex(el.parentNode); } }); var dOvlErr=$class(dOvlClass,{ _tpl:'<div class="wizard_cloud pngbg">\ <div class="ctnt">\ <span class="v_center"></span>\ <p id="dOvlCloud">{html}</p>\ </div>\ </div>', init:function() { $e.on('.dOvl-close-err', this.close, this); this.prepare_tpl(); }, open:function() { dOvl.close(); return $super(this,arguments); } }); var Promo=new $class(dPage,{ init:function() { var _vars=dPage.getVars('promo'); _vars && this.open(_vars); }, popups:{}, register:function(name,fn,scope,params) { this.popups[name]=function(cfg) { return fn.call(scope, $config({},cfg,params)); }; }, open:function(_vars) { if('type' in _vars){ if(_vars.type in this.popups) this.popups[_vars.type](_vars); }else{ dOvl.open(_vars); } } }); var dOvl=new dOvlClassEx(); var dOvlErr=new dOvlErr(); $u.app.on('upload_photo',dOvl.open_ex.bind(dOvl,{rev:'',rel:'files'})); $u.app.on('webcam_link',dOvl.open_ex.bind(this,{rev:'',rel:'webcam'})); var Flash={ detected:{}, version:[ 0, 0, 0 ], init:function(version) { if(!(version in Flash.detected)) Flash.detected[version]=Flash.detect(version); return Flash.detected[version]; }, detect:function(version) { var a=null; var d=''; if(/*@cc_on!@*/false){ try{ a=new ActiveXObject('ShockwaveFlash.ShockwaveFlash.'+version); if(version<=6) d='WIN 6,0,21,0'; a.AllowScriptAccess='always'; d=a.GetVariable('$version'); }catch(er){ if(version>6) return false; } if(!a) return false; if(d){ d=d.split(" ")[1].split(","); Flash.version=[ parseInt(d[0], 10), parseInt(d[1], 10), parseInt(d[2], 10) ]; } return true; }else if(navigator.plugins['Shockwave Flash']){ d=navigator.plugins['Shockwave Flash'].description; if(d){ d=d.replace(/^.*\s+(\S+\s+\S+$)/, "$1"); Flash.version[0]=parseInt(d.replace(/^(.*)\..*$/, "$1"), 10); Flash.version[1]=parseInt(d.replace(/^.*\.(.*)\s.*$/, "$1"), 10); Flash.version[2]=/r/.test(d)?parseInt(d.replace(/^.*r(.*)$/, "$1"), 10):0; } return (Flash.version[0] >= version); } return false; }, draw:function(src, width, height, bgcolor, vars, transparent, id, zindex) { var ret='<object id="'+id+'" name="'+id+'" style="z-index:'+(zindex||0)+'" type="application/x-shockwave-flash" width="'+width+'" height="'+height+'" '; if(/*@cc_on!@*/true) ret+=' data="'+src+'" '; ret+='>'; if(bgcolor) ret+='<param name="bgcolor" value="'+bgcolor+'" />'; if(vars){ if(typeof(vars)=='object'){ var v=[]; for(var key in vars){ v.push(key+"="+encodeURIComponent(vars[key])); } vars=v.join('&'); } ret+='<param name="FlashVars" value="'+vars+'" />'; } if(transparent) ret+='<param name="wmode" value="transparent" />'; if(/*@cc_on!@*/false) ret+='<param name="movie" value="'+src+'" />'; return ret+'<param name="allowFullScreen" value="true" />\ <param name="allowScriptAccess" value="always" />\ <param name="menu" value="false" />\ <param name="quality" value="high" />\ </object>'; }, get:function(f){ return (window[f]?window[f]:document[f]); } }; var $fx={}; $fx.transitions={ sineInOut:function(t,b,e,d){ return Math.round(-(e-b)/2*(Math.cos(Math.PI*t/d)-1)+b); } }; $fx.timer=$class({ duration:500, fps:50, wait:false, _timer:0, _stime:0, onStart:null, onEnd:null, scope:null, constructor:function(config) { $config(this,config); this.step_fn=this._step.bind(this); if(!this.wait) this.start(); }, start:function() { this.onStart && this.onStart.call(this.scope||this); this._stime=+new Date; this._timer=setInterval(this.step_fn, Math.round(1000/this.fps)); }, _step:function() { var ct=+new Date-this._stime, d=this.duration; if(ct>d) ct=d; this.step(ct,d); if(ct>=d) this.end(); }, end:function() { this._timer=clearInterval(this._timer); if(this.onEnd) this.onEnd.call(this.scope||this); } }); $fx.effect=$class($fx.timer,{ wait:true, items:null, constructor:function() { this.items=[]; $super(this,arguments); }, add:function(item) { this.items[this.items.length]=item; }, start:function() { for(var i=0, items=this.items, n=items.length; i<n; i++) items[i].start(); $super(this,arguments); }, step:function(ct,d) { var items=this.items; for(var i=0, n=items.length; i<n; i++) items[i].step(ct,d); }, end:function() { for(var i=0, items=this.items, n=items.length; i<n; i++) items[i].end(); $super(this,arguments); } }); $fx.style=$class({ el:null, prop:'', from:0, to:0, dimm:'px', fx:$fx.transitions.sineInOut, constructor:function(config) { $config(this,config); }, start:function(){}, end:function(){}, step:function(ct,d) { this.el.style[this.prop]=this.fx(ct,this.from,this.to,d)+this.dimm; } }); var Base= { name:'Base', is_frame:false, init:function() { if(!this.is_frame && top!=self) top.location.href=self.location.href; if(_ua=='ie6' && !this.is_frame){ var iemw, wrap1=$('wrap1'), footwrap=$('footwrap'); if(wrap1){ if(!footwrap) iemw=function(){ wrap1.runtimeStyle.width=(document.body.clientWidth>1200)?'1200px':'auto'; }; else iemw=function(){ footwrap.runtimeStyle.width=wrap1.runtimeStyle.width=(document.body.clientWidth>1200)?'1200px':'auto'; }; iemw(); $e.observe(window, 'resize', iemw); } } $e.on({ '.balance_info':this.balance_info, '.balance_info_close':this.balance_info_close }, this); }, balance_info:function(el) { $el.removeClassName($('balance_alert'),'hidden'); }, balance_info_close:function(el) { $el.addClassName($('balance_alert'),'hidden'); } }; Base=new $class(dPage,Base); var dLabel=$class({ el:null, input:null, constructor:function(config) { $config(this,config); if(!this.input) this.input=$(this.el && this.el.htmlFor); if(!this.el || !this.input){ return; } $e.add(this.el,'click',this.hide,this); $e.add(this.input,'focus',this.hide,this); $e.add(this.input,'blur',this.show,this); this.show(); }, destroy:function() { $e.del(this.el,'click',this.hide,this); $e.del(this.input,'focus',this.hide,this); $e.del(this.input,'blur',this.show,this); this.input=this.el=null; }, hide:function(el) { this.el.style.display='none'; if($e.e.type!='focus' && !this.input.disabled) this.input.focus(); }, show:function(el) { this.el.style.display=this.input.value?'none':'block'; } }); $config(dLabel, { init:function(wrap) { var dls=[], els=$q.select(wrap, '.dLabel'); for(var i=0, n=els.length; i<n; i++) dls[dls.length]=new dLabel({el:els[i]}); return dls; }, destroy:function(labels) { if(!labels || !(labels instanceof Array)) return; for(var i=0, n=labels.length; i<n; i++) labels[i].destroy(); } }); $e.onload(dLabel.init,dLabel); $config($u, { startWaiting:function(el) { el=$(el); if(!el || el._waiting) return; el._waiting=true; el._loading=$u.el('div',{className:'waiting'}); (el.parentNode || document.body).appendChild(el._loading); if(el.type=='submit' ){ el._hid=$u.el('input',{ type:'hidden', name:el.name, value:el.value }); el.parentNode.appendChild(el._hid); el.disabled=true; } if(/*@cc_on!@*/false) el.style.position='relative'; $config(el._loading.style,{ left: (el.offsetLeft + el.offsetWidth + 5) + 'px', top: (el.offsetTop + Math.round((el.offsetHeight - 16) / 2)) + 'px', width: 16 + 'px', height: 16 + 'px' }); }, stopWaiting:function(el) { el=$(el); if(!el || !el._waiting) return; if(el.type=='submit'){ el.disabled=false; $el.remove(el._hid); el._hid=null; if(/*@cc_on!@*/false) el.style.position='static'; } $el.remove(el._loading); el._loading=el._waiting=null; }, form_submit:function(form) { $e.add(form, 'submit', function(form) { var bn; for(var els=form.elements, i=els.length-1; i>=0; i--) if(els[i].type=='submit'){ bn=els[i]; break; } bn && $u.startWaiting(bn); return true; }); } }); var FormSubmit=function() { var forms=document.forms; for(var i=0, n=forms.length; i<n; i++) if(!$el.hasClassName(forms[i],'no_autoloader')) $u.form_submit(forms[i]); }; $e.onload(FormSubmit,FormSubmit); var MessengerLink= { mb:null, msg_count:0, init:function() { this.mb=$('mb'); if(!this.mb) return; $e.on('.msgr-lnk, * .msgr-lnk', this.open, this); $e.add(window, 'load', this.insert_swf, this); this.blink_fn=this.blink.bind(this); if(this.get_mc()) this.blink_start(); }, insert_swf:function() { if($("Baloon") && Flash.init(9)) $("Baloon").innerHTML=Flash.draw(JSRoot + "flash/communicator.swf?" + $("f_baloon_ts").value, 1, 1, false, $("f_baloon_vars").value, true, "fBaloon"); }, get_mc:function() { var m=/\d+/.exec(this.mb.innerHTML); return this.msg_count=m&&+m[0]||0; }, set_mc:function(num) { this.mb.innerHTML=this.mb.innerHTML.replace(/\d+/,(this.msg_count=+num||0)); }, open:function(el) { if(!el) return; if(el.target.substr(0, 3)!="my_" || (window.opera && navigator.userAgent.toLowerCase().indexOf('wii') != -1)) return true; var href=el.href; var tmp=href.split('/'); tmp.pop(); var u=tmp.pop(); var t=el.target; var opened=false; if(Flash.init(9)){ href=$u.add_href(href, 'swf=1'); try{ opened=($('fBaloon') ? Flash.get('fBaloon').CallFlash('Open', [ u ]):false); }catch(e){} } if(!opened) var win=$u.wopen(href, t, 780, 500, false, "1", "no"); }, unread_messages:function(params) { this.set_mc(params.sum); if(params.sum){ $el.removeClassName(this.mb,'zm'); this.blink_start(); }else{ $el.addClassName(this.mb,'zm'); this.blink_stop(); } }, blink_i:0, blink_timer:0, blink_start:function() { this.blink_i=0; this.mb.style.visibility=''; if(this.blink_timer) return; this.blink_timer=setInterval(this.blink_fn,500); }, blink_stop:function() { if(!this.blink_timer) return; this.mb.style.visibility=''; clearInterval(this.blink_timer); this.blink_timer=this.blink_i=0; }, blink:function() { this.blink_i=(this.blink_i+1)%3; this.mb.style.visibility=this.blink_i?'':'hidden'; } }; MessengerLink=new $class(dPage,MessengerLink); function CallJS(action, params) { switch(action){ case 'UnreadMessages': MessengerLink.unread_messages(params); break; } } $u.toggle=new $class(dPage,{ init:function() { $e.on('.jst, * .jst', this.toggle, this); }, toggle:function(el) { var wrap=$q.up(el,'.jsw'); if(!wrap) return; $el.toggleClassName(wrap,el.rel||'jse'); if(el.nodeName=='INPUT') return true; } }); $u.format_number=function(v,sp) { var n=+v||0, s=''+n, i=s.length%3||3; return s.slice(0,i+(n<0))+s.slice(i).replace(/(\d{3})/g, sp + '$1'); }; var UserCountersPage=new $class(dPage, { name:'', fns:[], _timer:0, timeout: 3, init:function() { $e.add(window,'load',this.loaded,this); }, loaded:function() { this.add('user_total', 0, 4*this.timeout ); this.add('user_country', 0, 1*this.timeout ); this.add('user_online', 0, 3*this.timeout ); this.add('photo', 0, 25*this.timeout ); if(this.fns.length){ this._timer=setInterval(this.update.bind(this),this.timeout*1000); $e.add(window,'unload',this.destroy,this); } }, destroy:function() { clearInterval(this._timer); var fns=this.fns; for(var i=0, n=fns.length; i<n; i++){ fns[i].destroy(); } this.fns=[]; }, add:function(name, from, to) { var counter=UserCounter(name, from, to); if(counter) this.fns[this.fns.length]=counter; }, update:function() { var fns=this.fns; for(var i=0, n=fns.length; i<n; i++){ fns[i](); } } }); var UserCounter=function(name, from, to) { var els=$q.select(document, '.uc_'+name); if(!els.length) return null; var val=UserCounter.clean(els[0].innerHTML); var _=function() { val+=Math.round(from+Math.random()*(to-from)); for(var i=0, n=els.length; i<n; i++) els[i].innerHTML=$u.format_number(val,UserCounter.separator); }; _.destroy=function(){ els=null; }; return _; }; UserCounter.clean=function(txt) { UserCounter.clean=function(txt) { return parseInt(txt.replace(/\D/g,'')); }; var m=/\D/.exec(txt.replace(/^\D+|\D+$/g,'')); UserCounter.separator=m && m[0] || ' '; return UserCounter.clean(txt); };