//** AnyLink CSS Menu (More Menu)
//** Script Download/ instructions page: http://www.dynamicdrive.com/dynamicindex1/anylinkcss.htm
//** January 19', 2009: Script Creation date

//**May 23rd, 09': v2.1
	//1) Automatically adds a "selectedanchor" CSS class to the currrently selected anchor link
	//2) For image anchor links, the custom HTML attributes "data-image" and "data-overimage" can be inserted to set the anchor's default and over images.

//**June 1st, 09': v2.2
	//1) Script now runs automatically after DOM has loaded. anylinkcssmenu.init) can now be called in the HEAD section

if (typeof dd_domreadycheck=="undefined") //global variable to detect if DOM is ready
	var dd_domreadycheck=false

var anylinkcssmenu={

menusmap: {},
preloadimages: [],
effects: {delayhide: 200, shadow:{enabled:true, opacity:0.3, depth: [5, 5]}, fade:{enabled:true, duration:500}}, //customize menu effects

dimensions: {},

getoffset:function(what, offsettype){
	return (what.offsetParent)? what[offsettype]+this.getoffset(what.offsetParent, offsettype) : what[offsettype]
},

getoffsetof:function(el){
	el._offsets={left:this.getoffset(el, "offsetLeft"), top:this.getoffset(el, "offsetTop"), h: el.offsetHeight}
},

getdimensions:function(menu){
	this.dimensions={anchorw:menu.anchorobj.offsetWidth, anchorh:menu.anchorobj.offsetHeight,
		docwidth:(window.innerWidth ||this.standardbody.clientWidth)-20,
		docheight:(window.innerHeight ||this.standardbody.clientHeight)-15,
		docscrollx:window.pageXOffset || this.standardbody.scrollLeft,
		docscrolly:window.pageYOffset || this.standardbody.scrollTop
	}
	if (!this.dimensions.dropmenuw){
		this.dimensions.dropmenuw=menu.dropmenu.offsetWidth
		this.dimensions.dropmenuh=menu.dropmenu.offsetHeight
	}
},

isContained:function(m, e){
	var e=window.event || e
	var c=e.relatedTarget || ((e.type=="mouseover")? e.fromElement : e.toElement)
	while (c && c!=m)try {c=c.parentNode} catch(e){c=m}
	if (c==m)
		return true
	else
		return false
},

setopacity:function(el, value){
	el.style.opacity=value
	if (typeof el.style.opacity!="string"){ //if it's not a string (ie: number instead), it means property not supported
		el.style.MozOpacity=value
		if (el.filters){
			el.style.filter="progid:DXImageTransform.Microsoft.alpha(opacity="+ value*100 +")"
		}
	}
},

showmenu:function(menuid){
	var menu=anylinkcssmenu.menusmap[menuid]
	clearTimeout(menu.hidetimer)
	this.getoffsetof(menu.anchorobj)
	this.getdimensions(menu)
	var posx=menu.anchorobj._offsets.left + (menu.orientation=="lr"? this.dimensions.anchorw : 0) //base x pos
	var posy=menu.anchorobj._offsets.top+this.dimensions.anchorh - (menu.orientation=="lr"? this.dimensions.anchorh : 0)//base y pos
	if (posx+this.dimensions.dropmenuw+this.effects.shadow.depth[0]>this.dimensions.docscrollx+this.dimensions.docwidth){ //drop left instead?
		posx=posx-this.dimensions.dropmenuw + (menu.orientation=="lr"? -this.dimensions.anchorw : this.dimensions.anchorw)
	}
	if (posy+this.dimensions.dropmenuh>this.dimensions.docscrolly+this.dimensions.docheight){  //drop up instead?
		posy=Math.max(posy-this.dimensions.dropmenuh - (menu.orientation=="lr"? -this.dimensions.anchorh : this.dimensions.anchorh), this.dimensions.docscrolly) //position above anchor or window's top edge
	}
	if (this.effects.fade.enabled){
		this.setopacity(menu.dropmenu, 0) //set opacity to 0 so menu appears hidden initially
		if (this.effects.shadow.enabled)
			this.setopacity(menu.shadow, 0) //set opacity to 0 so shadow appears hidden initially
	}
	menu.dropmenu.setcss({left:posx+'px', top:posy+'px', visibility:'visible'})
	if (this.effects.shadow.enabled)
		menu.shadow.setcss({left:posx+anylinkcssmenu.effects.shadow.depth[0]+'px', top:posy+anylinkcssmenu.effects.shadow.depth[1]+'px', visibility:'visible'})
	if (this.effects.fade.enabled){
		clearInterval(menu.animatetimer)
		menu.curanimatedegree=0
		menu.starttime=new Date().getTime() //get time just before animation is run
		menu.animatetimer=setInterval(function(){anylinkcssmenu.revealmenu(menuid)}, 20)
	}
},

revealmenu:function(menuid){
	var menu=anylinkcssmenu.menusmap[menuid]
	var elapsed=new Date().getTime()-menu.starttime //get time animation has run
	if (elapsed<this.effects.fade.duration){
		this.setopacity(menu.dropmenu, menu.curanimatedegree)
		if (this.effects.shadow.enabled)
			this.setopacity(menu.shadow, menu.curanimatedegree*this.effects.shadow.opacity)
	}
	else{
		clearInterval(menu.animatetimer)
		this.setopacity(menu.dropmenu, 1)
		menu.dropmenu.style.filter=""
	}
	menu.curanimatedegree=(1-Math.cos((elapsed/this.effects.fade.duration)*Math.PI)) / 2
},

setcss:function(param){
	for (prop in param){
		this.style[prop]=param[prop]
	}
},

setcssclass:function(el, targetclass, action){
	var needle=new RegExp("(^|\\s+)"+targetclass+"($|\\s+)", "ig")
	if (action=="check")
		return needle.test(el.className)
	else if (action=="remove")
		el.className=el.className.replace(needle, "")
	else if (action=="add" && !needle.test(el.className))
		el.className+=" "+targetclass
},

hidemenu:function(menuid){
	var menu=anylinkcssmenu.menusmap[menuid]
	clearInterval(menu.animatetimer)
	menu.dropmenu.setcss({visibility:'hidden', left:0, top:0})
	menu.shadow.setcss({visibility:'hidden', left:0, top:0})
},

getElementsByClass:function(targetclass){
	if (document.querySelectorAll)
		return document.querySelectorAll("."+targetclass)
	else{
		var classnameRE=new RegExp("(^|\\s+)"+targetclass+"($|\\s+)", "i") //regular expression to screen for classname
		var pieces=[]
		var alltags=document.all? document.all : document.getElementsByTagName("*")
		for (var i=0; i<alltags.length; i++){
			if (typeof alltags[i].className=="string" && alltags[i].className.search(classnameRE)!=-1)
				pieces[pieces.length]=alltags[i]
		}
		return pieces
	}
},

addEvent:function(targetarr, functionref, tasktype){
	if (targetarr.length>0){
		var target=targetarr.shift()
		if (target.addEventListener)
			target.addEventListener(tasktype, functionref, false)
		else if (target.attachEvent)
			target.attachEvent('on'+tasktype, function(){return functionref.call(target, window.event)})
		this.addEvent(targetarr, functionref, tasktype)
	}
},

domready:function(functionref){ //based on code from the jQuery library
	if (dd_domreadycheck){
		functionref()
		return
	}
	// Mozilla, Opera and webkit nightlies currently support this event
	if (document.addEventListener) {
		// Use the handy event callback
		document.addEventListener("DOMContentLoaded", function(){
			document.removeEventListener("DOMContentLoaded", arguments.callee, false )
			functionref();
			dd_domreadycheck=true
		}, false )
	}
	else if (document.attachEvent){
		// If IE and not an iframe
		// continually check to see if the document is ready
		if ( document.documentElement.doScroll && window == window.top) (function(){
			if (dd_domreadycheck) return
			try{
				// If IE is used, use the trick by Diego Perini
				// http://javascript.nwbox.com/IEContentLoaded/
				document.documentElement.doScroll("left")
			}catch(error){
				setTimeout( arguments.callee, 0)
				return;
			}
			//and execute any waiting functions
			functionref();
			dd_domreadycheck=true
		})();
	}
	if (document.attachEvent && parent.length>0) //account for page being in IFRAME, in which above doesn't fire in IE
		this.addEvent(window, function(){functionref()}, "load");
},

addState:function(anchorobj, state){
	if (anchorobj.getAttribute('data-image')){
		var imgobj=(anchorobj.tagName=="IMG")? anchorobj : anchorobj.getElementsByTagName('img')[0]
		if (imgobj){
			imgobj.src=(state=="add")? anchorobj.getAttribute('data-overimage') : anchorobj.getAttribute('data-image')
		}
	}
	else
		anylinkcssmenu.setcssclass(anchorobj, "selectedanchor", state)
},


setupmenu:function(targetclass, anchorobj, pos){
	this.standardbody=(document.compatMode=="CSS1Compat")? document.documentElement : document.body
	var relattr=anchorobj.getAttribute("rel")
	var dropmenuid=relattr.replace(/\[(\w+)\]/, '')
	var menu=this.menusmap[targetclass+pos]={
		id: targetclass+pos,
		anchorobj: anchorobj,	
		dropmenu: document.getElementById(dropmenuid),
		revealtype: (relattr.length!=dropmenuid.length && RegExp.$1=="click")? "click" : "mouseover",
		orientation: anchorobj.getAttribute("rev")=="lr"? "lr" : "ud",
		shadow: document.createElement("div")
	}
	menu.anchorobj._internalID=targetclass+pos
	menu.anchorobj._isanchor=true
	menu.dropmenu._internalID=targetclass+pos
	menu.shadow._internalID=targetclass+pos
	menu.shadow.className="anylinkshadow"
	document.body.appendChild(menu.dropmenu) //move drop down div to end of page
	document.body.appendChild(menu.shadow)
	menu.dropmenu.setcss=this.setcss
	menu.shadow.setcss=this.setcss
	menu.shadow.setcss({width: menu.dropmenu.offsetWidth+"px", height:menu.dropmenu.offsetHeight+"px"})
	this.setopacity(menu.shadow, this.effects.shadow.opacity)
	this.addEvent([menu.anchorobj, menu.dropmenu, menu.shadow], function(e){ //MOUSEOVER event for anchor, dropmenu, shadow
		var menu=anylinkcssmenu.menusmap[this._internalID]
		if (this._isanchor && menu.revealtype=="mouseover" && !anylinkcssmenu.isContained(this, e)){ //event for anchor
			anylinkcssmenu.showmenu(menu.id)
			anylinkcssmenu.addState(this, "add")
		}
		else if (typeof this._isanchor=="undefined"){ //event for drop down menu and shadow
			clearTimeout(menu.hidetimer)
		}
	}, "mouseover")
	this.addEvent([menu.anchorobj, menu.dropmenu, menu.shadow], function(e){ //MOUSEOUT event for anchor, dropmenu, shadow
		if (!anylinkcssmenu.isContained(this, e)){
			var menu=anylinkcssmenu.menusmap[this._internalID]
			menu.hidetimer=setTimeout(function(){
				anylinkcssmenu.addState(menu.anchorobj, "remove")
				anylinkcssmenu.hidemenu(menu.id)
			}, anylinkcssmenu.effects.delayhide)
		}
	}, "mouseout")
	this.addEvent([menu.anchorobj, menu.dropmenu], function(e){ //CLICK event for anchor, dropmenu
		var menu=anylinkcssmenu.menusmap[this._internalID]
		if ( this._isanchor && menu.revealtype=="click"){
			if (menu.dropmenu.style.visibility=="visible")
				anylinkcssmenu.hidemenu(menu.id)
			else{
				anylinkcssmenu.addState(this, "add")
				anylinkcssmenu.showmenu(menu.id)
			}
			if (e.preventDefault)
				e.preventDefault()
			return false
		}
		else
			menu.hidetimer=setTimeout(function(){anylinkcssmenu.hidemenu(menu.id)}, anylinkcssmenu.effects.delayhide)
	}, "click")
},

init:function(targetclass){
	this.domready(function(){anylinkcssmenu.trueinit(targetclass)})
},

trueinit:function(targetclass){
	var anchors=this.getElementsByClass(targetclass)
	var preloadimages=this.preloadimages
	for (var i=0; i<anchors.length; i++){
		if (anchors[i].getAttribute('data-image')){ //preload anchor image?
			preloadimages[preloadimages.length]=new Image()
			preloadimages[preloadimages.length-1].src=anchors[i].getAttribute('data-image')
		}
		if (anchors[i].getAttribute('data-overimage')){ //preload anchor image?
			preloadimages[preloadimages.length]=new Image()
			preloadimages[preloadimages.length-1].src=anchors[i].getAttribute('data-overimage')
		}
		this.setupmenu(targetclass, anchors[i], i)
	}
}

}


//** Sugestive Search Box
if(typeof(bsn)=="undefined")_b=bsn={};if(typeof(_b.Autosuggest)=="undefined")_b.Autosuggest={};else alert("Autosuggest is already set!");_b.AutoSuggest=function(b,c){if(!document.getElementById)return 0;this.fld=_b.DOM.gE(b);if(!this.fld)return 0;this.sInp="";this.nInpC=0;this.aSug=[];this.iHigh=0;this.oP=c?c:{};var k,def={minchars:1,meth:"get",varname:"input",className:"autosuggest",timeout:2500,delay:0,offsety:-5,shownoresults:true,noresults:"No results!",maxheight:250,cache:true,maxentries:25};for(k in def){if(typeof(this.oP[k])!=typeof(def[k]))this.oP[k]=def[k]}var p=this;this.fld.onkeypress=function(a){return p.onKeyPress(a)};this.fld.onkeyup=function(a){return p.onKeyUp(a)};this.fld.setAttribute("autocomplete","off")};_b.AutoSuggest.prototype.onKeyPress=function(a){var b=(window.event)?window.event.keyCode:a.keyCode;var c=13;var d=9;var e=27;var f=1;switch(b){case c:this.setHighlightedValue();f=0;break;case e:this.clearSuggestions();break}return f};_b.AutoSuggest.prototype.onKeyUp=function(a){var b=(window.event)?window.event.keyCode:a.keyCode;var c=38;var d=40;var e=1;switch(b){case c:this.changeHighlight(b);e=0;break;case d:this.changeHighlight(b);e=0;break;default:this.getSuggestions(this.fld.value)}return e};_b.AutoSuggest.prototype.getSuggestions=function(a){if(a==this.sInp)return 0;_b.DOM.remE(this.idAs);this.sInp=a;if(a.length<this.oP.minchars){this.aSug=[];this.nInpC=a.length;return 0}var b=this.nInpC;this.nInpC=a.length?a.length:0;var l=this.aSug.length;if(this.nInpC>b&&l&&l<this.oP.maxentries&&this.oP.cache){var c=[];for(var i=0;i<l;i++){if(this.aSug[i].value.substr(0,a.length).toLowerCase()==a.toLowerCase())c.push(this.aSug[i])}this.aSug=c;this.createList(this.aSug);return false}else{var d=this;var e=this.sInp;clearTimeout(this.ajID);this.ajID=setTimeout(function(){d.doAjaxRequest(e)},this.oP.delay)}return false};_b.AutoSuggest.prototype.doAjaxRequest=function(b){if(b!=this.fld.value)return false;var c=this;if(typeof(this.oP.script)=="function")var d=this.oP.script(encodeURIComponent(this.sInp));else var d=this.oP.script+this.oP.varname+"="+encodeURIComponent(this.sInp);if(!d)return false;var e=this.oP.meth;var b=this.sInp;var f=function(a){c.setSuggestions(a,b)};var g=function(a){alert("AJAX error: "+a)};var h=new _b.Ajax();h.makeRequest(d,e,f,g)};_b.AutoSuggest.prototype.setSuggestions=function(a,b){if(b!=this.fld.value)return false;this.aSug=[];if(this.oP.json){var c=eval('('+a.responseText+')');for(var i=0;i<c.results.length;i++){this.aSug.push({'id':c.results[i].id,'value':c.results[i].value,'info':c.results[i].info})}}else{var d=a.responseXML;var e=d.getElementsByTagName('results')[0].childNodes;for(var i=0;i<e.length;i++){if(e[i].hasChildNodes())this.aSug.push({'id':e[i].getAttribute('id'),'value':e[i].childNodes[0].nodeValue,'info':e[i].getAttribute('info')})}}this.idAs="as_"+this.fld.id;this.createList(this.aSug)};_b.AutoSuggest.prototype.createList=function(b){var c=this;_b.DOM.remE(this.idAs);this.killTimeout();if(b.length==0&&!this.oP.shownoresults)return false;var d=_b.DOM.cE("div",{id:this.idAs,className:this.oP.className});var e=_b.DOM.cE("div",{className:"as_corner"});var f=_b.DOM.cE("div",{className:"as_bar"});var g=_b.DOM.cE("div",{className:"as_header"});g.appendChild(e);g.appendChild(f);d.appendChild(g);var h=_b.DOM.cE("ul",{id:"as_ul"});for(var i=0;i<b.length;i++){var j=b[i].value;var k=j.toLowerCase().indexOf(this.sInp.toLowerCase());var l=j.substring(0,k)+"<em>"+j.substring(k,k+this.sInp.length)+"</em>"+j.substring(k+this.sInp.length);var m=_b.DOM.cE("span",{},l,true);if(b[i].info!=""){var n=_b.DOM.cE("br",{});m.appendChild(n);var o=_b.DOM.cE("small",{},b[i].info);m.appendChild(o)}var a=_b.DOM.cE("a",{href:"#"});var p=_b.DOM.cE("span",{className:"tl"}," ");var q=_b.DOM.cE("span",{className:"tr"}," ");a.appendChild(p);a.appendChild(q);a.appendChild(m);a.name=i+1;a.onclick=function(){c.setHighlightedValue();return false};a.onmouseover=function(){c.setHighlight(this.name)};var r=_b.DOM.cE("li",{},a);h.appendChild(r)}if(b.length==0&&this.oP.shownoresults){var r=_b.DOM.cE("li",{className:"as_warning"},this.oP.noresults);h.appendChild(r)}d.appendChild(h);var s=_b.DOM.cE("div",{className:"as_corner"});var t=_b.DOM.cE("div",{className:"as_bar"});var u=_b.DOM.cE("div",{className:"as_footer"});u.appendChild(s);u.appendChild(t);d.appendChild(u);var v=_b.DOM.getPos(this.fld);d.style.left=v.x+"px";d.style.top=(v.y+this.fld.offsetHeight+this.oP.offsety)+"px";d.style.width=this.fld.offsetWidth+"px";d.onmouseover=function(){c.killTimeout()};d.onmouseout=function(){c.resetTimeout()};document.getElementsByTagName("body")[0].appendChild(d);this.iHigh=0;var c=this;this.toID=setTimeout(function(){c.clearSuggestions()},this.oP.timeout)};_b.AutoSuggest.prototype.changeHighlight=function(a){var b=_b.DOM.gE("as_ul");if(!b)return false;var n;if(a==40)n=this.iHigh+1;else if(a==38)n=this.iHigh-1;if(n>b.childNodes.length)n=b.childNodes.length;if(n<1)n=1;this.setHighlight(n)};_b.AutoSuggest.prototype.setHighlight=function(n){var a=_b.DOM.gE("as_ul");if(!a)return false;if(this.iHigh>0)this.clearHighlight();this.iHigh=Number(n);a.childNodes[this.iHigh-1].className="as_highlight";this.killTimeout()};_b.AutoSuggest.prototype.clearHighlight=function(){var a=_b.DOM.gE("as_ul");if(!a)return false;if(this.iHigh>0){a.childNodes[this.iHigh-1].className="";this.iHigh=0}};_b.AutoSuggest.prototype.setHighlightedValue=function(){if(this.iHigh){this.sInp=this.fld.value=this.aSug[this.iHigh-1].value;this.fld.focus();if(this.fld.selectionStart)this.fld.setSelectionRange(this.sInp.length,this.sInp.length);this.clearSuggestions();if(typeof(this.oP.callback)=="function")this.oP.callback(this.aSug[this.iHigh-1])}};_b.AutoSuggest.prototype.killTimeout=function(){clearTimeout(this.toID)};_b.AutoSuggest.prototype.resetTimeout=function(){clearTimeout(this.toID);var a=this;this.toID=setTimeout(function(){a.clearSuggestions()},1000)};_b.AutoSuggest.prototype.clearSuggestions=function(){this.killTimeout();var a=_b.DOM.gE(this.idAs);var b=this;if(a){var c=new _b.Fader(a,1,0,250,function(){_b.DOM.remE(b.idAs)})}};if(typeof(_b.Ajax)=="undefined")_b.Ajax={};_b.Ajax=function(){this.req={};this.isIE=false};_b.Ajax.prototype.makeRequest=function(a,b,c,d){if(b!="POST")b="GET";this.onComplete=c;this.onError=d;var e=this;if(window.XMLHttpRequest){this.req=new XMLHttpRequest();this.req.onreadystatechange=function(){e.processReqChange()};this.req.open("GET",a,true);this.req.send(null)}else if(window.ActiveXObject){this.req=new ActiveXObject("Microsoft.XMLHTTP");if(this.req){this.req.onreadystatechange=function(){e.processReqChange()};this.req.open(b,a,true);this.req.send()}}};_b.Ajax.prototype.processReqChange=function(){if(this.req.readyState==4){if(this.req.status==200){this.onComplete(this.req)}else{this.onError(this.req.status)}}};if(typeof(_b.DOM)=="undefined")_b.DOM={};_b.DOM.cE=function(b,c,d,e){var f=document.createElement(b);if(!f)return 0;for(var a in c)f[a]=c[a];var t=typeof(d);if(t=="string"&&!e)f.appendChild(document.createTextNode(d));else if(t=="string"&&e)f.innerHTML=d;else if(t=="object")f.appendChild(d);return f};_b.DOM.gE=function(e){var t=typeof(e);if(t=="undefined")return 0;else if(t=="string"){var a=document.getElementById(e);if(!a)return 0;else if(typeof(a.appendChild)!="undefined")return a;else return 0}else if(typeof(e.appendChild)!="undefined")return e;else return 0};_b.DOM.remE=function(a){var e=this.gE(a);if(!e)return 0;else if(e.parentNode.removeChild(e))return true;else return 0};_b.DOM.getPos=function(e){var e=this.gE(e);var a=e;var b=0;if(a.offsetParent){while(a.offsetParent){b+=a.offsetLeft;a=a.offsetParent}}else if(a.x)b+=a.x;var a=e;var c=0;if(a.offsetParent){while(a.offsetParent){c+=a.offsetTop;a=a.offsetParent}}else if(a.y)c+=a.y;return{x:b,y:c}};if(typeof(_b.Fader)=="undefined")_b.Fader={};_b.Fader=function(a,b,c,d,e){if(!a)return 0;this.e=a;this.from=b;this.to=c;this.cb=e;this.nDur=d;this.nInt=50;this.nTime=0;var p=this;this.nID=setInterval(function(){p._fade()},this.nInt)};_b.Fader.prototype._fade=function(){this.nTime+=this.nInt;var a=Math.round(this._tween(this.nTime,this.from,this.to,this.nDur)*100);var b=a/100;if(this.e.filters){try{this.e.filters.item("DXImageTransform.Microsoft.Alpha").opacity=a}catch(e){this.e.style.filter='progid:DXImageTransform.Microsoft.Alpha(opacity='+a+')'}}else{this.e.style.opacity=b}if(this.nTime==this.nDur){clearInterval(this.nID);if(this.cb!=undefined)this.cb()}};_b.Fader.prototype._tween=function(t,b,c,d){return b+((c-b)*(t/d))};

function nav()
   {
   var w = document.faqnav.dest.selectedIndex;
   var url_add = document.faqnav.dest.options[w].value;
   window.location.href = url_add;
   }


var Prototype={Version:"1.6.1_rc3",Browser:(function(){var b=navigator.userAgent;var a=Object.prototype.toString.call(window.opera)=="[object Opera]";return{IE:!!window.attachEvent&&!a,Opera:a,WebKit:b.indexOf("AppleWebKit/")>-1,Gecko:b.indexOf("Gecko")>-1&&b.indexOf("KHTML")===-1,MobileSafari:/Apple.*Mobile.*Safari/.test(b)}})(),BrowserFeatures:{XPath:!!document.evaluate,SelectorsAPI:!!document.querySelector,ElementExtensions:(function(){var a=window.Element||window.HTMLElement;return !!(a&&a.prototype)})(),SpecificElementExtensions:(function(){if(typeof window.HTMLDivElement!=="undefined"){return true}var c=document.createElement("div");var b=document.createElement("form");var a=false;if(c.__proto__&&(c.__proto__!==b.__proto__)){a=true}c=b=null;return a})()},ScriptFragment:"<script[^>]*>([\\S\\s]*?)<\/script>",JSONFilter:/^\/\*-secure-([\s\S]*)\*\/\s*$/,emptyFunction:function(){},K:function(a){return a}};if(Prototype.Browser.MobileSafari){Prototype.BrowserFeatures.SpecificElementExtensions=false}var Abstract={};var Try={these:function(){var c;for(var b=0,f=arguments.length;b<f;b++){var a=arguments[b];try{c=a();break}catch(g){}}return c}};var Class=(function(){function a(){}function b(){var h=null,g=$A(arguments);if(Object.isFunction(g[0])){h=g.shift()}function e(){this.initialize.apply(this,arguments)}Object.extend(e,Class.Methods);e.superclass=h;e.subclasses=[];if(h){a.prototype=h.prototype;e.prototype=new a;h.subclasses.push(e)}for(var f=0;f<g.length;f++){e.addMethods(g[f])}if(!e.prototype.initialize){e.prototype.initialize=Prototype.emptyFunction}e.prototype.constructor=e;return e}function c(m){var g=this.superclass&&this.superclass.prototype;var f=Object.keys(m);if(!Object.keys({toString:true}).length){if(m.toString!=Object.prototype.toString){f.push("toString")}if(m.valueOf!=Object.prototype.valueOf){f.push("valueOf")}}for(var e=0,h=f.length;e<h;e++){var l=f[e],j=m[l];if(g&&Object.isFunction(j)&&j.argumentNames().first()=="$super"){var n=j;j=(function(o){return function(){return g[o].apply(this,arguments)}})(l).wrap(n);j.valueOf=n.valueOf.bind(n);j.toString=n.toString.bind(n)}this.prototype[l]=j}return this}return{create:b,Methods:{addMethods:c}}})();(function(){function o(t){return Object.prototype.toString.call(t).match(/^\[object\s(.*)\]$/)[1]}function j(t,v){for(var u in v){t[u]=v[u]}return t}function n(t){try{if(e(t)){return"undefined"}if(t===null){return"null"}return t.inspect?t.inspect():String(t)}catch(u){if(u instanceof RangeError){return"..."}throw u}}function m(t){var v=typeof t;switch(v){case"undefined":case"function":case"unknown":return;case"boolean":return t.toString()}if(t===null){return"null"}if(t.toJSON){return t.toJSON()}if(h(t)){return}var u=[];for(var y in t){var w=m(t[y]);if(!e(w)){u.push(y.toJSON()+": "+w)}}return"{"+u.join(", ")+"}"}function c(t){return $H(t).toQueryString()}function f(t){return t&&t.toHTML?t.toHTML():String.interpret(t)}function r(t){var u=[];for(var v in t){u.push(v)}return u}function p(t){var u=[];for(var v in t){u.push(t[v])}return u}function l(t){return j({},t)}function h(t){return !!(t&&t.nodeType==1)}function g(t){return o(t)==="Array"}function s(t){return t instanceof Hash}function b(t){return typeof t==="function"}function a(t){return o(t)==="String"}function q(t){return o(t)==="Number"}function e(t){return typeof t==="undefined"}j(Object,{extend:j,inspect:n,toJSON:m,toQueryString:c,toHTML:f,keys:r,values:p,clone:l,isElement:h,isArray:g,isHash:s,isFunction:b,isString:a,isNumber:q,isUndefined:e})})();Object.extend(Function.prototype,(function(){var n=Array.prototype.slice;function e(r,o){var q=r.length,p=o.length;while(p--){r[q+p]=o[p]}return r}function l(p,o){p=n.call(p,0);return e(p,o)}function h(){var o=this.toString().match(/^[\s\(]*function[^(]*\(([^)]*)\)/)[1].replace(/\/\/.*?[\r\n]|\/\*(?:.|[\r\n])*?\*\//g,"").replace(/\s+/g,"").split(",");return o.length==1&&!o[0]?[]:o}function j(q){if(arguments.length<2&&Object.isUndefined(arguments[0])){return this}var o=this,p=n.call(arguments,1);return function(){var r=l(p,arguments);return o.apply(q,r)}}function g(q){var o=this,p=n.call(arguments,1);return function(s){var r=e([s||window.event],p);return o.apply(q,r)}}function m(){if(!arguments.length){return this}var o=this,p=n.call(arguments,0);return function(){var q=l(p,arguments);return o.apply(this,q)}}function f(q){var o=this,p=n.call(arguments,1);q=q*1000;return window.setTimeout(function(){return o.apply(o,p)},q)}function a(){var o=e([0.01],arguments);return this.delay.apply(this,o)}function c(p){var o=this;return function(){var q=e([o.bind(this)],arguments);return p.apply(this,q)}}function b(){if(this._methodized){return this._methodized}var o=this;return this._methodized=function(){var p=e([this],arguments);return o.apply(null,p)}}return{argumentNames:h,bind:j,bindAsEventListener:g,curry:m,delay:f,defer:a,wrap:c,methodize:b}})());Date.prototype.toJSON=function(){return'"'+this.getUTCFullYear()+"-"+(this.getUTCMonth()+1).toPaddedString(2)+"-"+this.getUTCDate().toPaddedString(2)+"T"+this.getUTCHours().toPaddedString(2)+":"+this.getUTCMinutes().toPaddedString(2)+":"+this.getUTCSeconds().toPaddedString(2)+'Z"'};RegExp.prototype.match=RegExp.prototype.test;RegExp.escape=function(a){return String(a).replace(/([.*+?^=!:${}()|[\]\/\\])/g,"\\$1")};var PeriodicalExecuter=Class.create({initialize:function(b,a){this.callback=b;this.frequency=a;this.currentlyExecuting=false;this.registerCallback()},registerCallback:function(){this.timer=setInterval(this.onTimerEvent.bind(this),this.frequency*1000)},execute:function(){this.callback(this)},stop:function(){if(!this.timer){return}clearInterval(this.timer);this.timer=null},onTimerEvent:function(){if(!this.currentlyExecuting){try{this.currentlyExecuting=true;this.execute()}catch(a){}finally{this.currentlyExecuting=false}}}});Object.extend(String,{interpret:function(a){return a==null?"":String(a)},specialChar:{"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r","\\":"\\\\"}});Object.extend(String.prototype,(function(){function prepareReplacement(replacement){if(Object.isFunction(replacement)){return replacement}var template=new Template(replacement);return function(match){return template.evaluate(match)}}function gsub(pattern,replacement){var result="",source=this,match;replacement=prepareReplacement(replacement);if(Object.isString(pattern)){pattern=RegExp.escape(pattern)}if(!(pattern.length||pattern.source)){replacement=replacement("");return replacement+source.split("").join(replacement)+replacement}while(source.length>0){if(match=source.match(pattern)){result+=source.slice(0,match.index);result+=String.interpret(replacement(match));source=source.slice(match.index+match[0].length)}else{result+=source,source=""}}return result}function sub(pattern,replacement,count){replacement=prepareReplacement(replacement);count=Object.isUndefined(count)?1:count;return this.gsub(pattern,function(match){if(--count<0){return match[0]}return replacement(match)})}function scan(pattern,iterator){this.gsub(pattern,iterator);return String(this)}function truncate(length,truncation){length=length||30;truncation=Object.isUndefined(truncation)?"...":truncation;return this.length>length?this.slice(0,length-truncation.length)+truncation:String(this)}function strip(){return this.replace(/^\s+/,"").replace(/\s+$/,"")}function stripTags(){return this.replace(/<\w+(\s+("[^"]*"|'[^']*'|[^>])+)?>|<\/\w+>/gi,"")}function stripScripts(){return this.replace(new RegExp(Prototype.ScriptFragment,"img"),"")}function extractScripts(){var matchAll=new RegExp(Prototype.ScriptFragment,"img");var matchOne=new RegExp(Prototype.ScriptFragment,"im");return(this.match(matchAll)||[]).map(function(scriptTag){return(scriptTag.match(matchOne)||["",""])[1]})}function evalScripts(){return this.extractScripts().map(function(script){return eval(script)})}function escapeHTML(){escapeHTML.text.data=this;return escapeHTML.div.innerHTML}function unescapeHTML(){var div=document.createElement("div");div.innerHTML=this.stripTags();return div.childNodes[0]?(div.childNodes.length>1?$A(div.childNodes).inject("",function(memo,node){return memo+node.nodeValue}):div.childNodes[0].nodeValue):""}function toQueryParams(separator){var match=this.strip().match(/([^?#]*)(#.*)?$/);if(!match){return{}}return match[1].split(separator||"&").inject({},function(hash,pair){if((pair=pair.split("="))[0]){var key=decodeURIComponent(pair.shift());var value=pair.length>1?pair.join("="):pair[0];if(value!=undefined){value=decodeURIComponent(value)}if(key in hash){if(!Object.isArray(hash[key])){hash[key]=[hash[key]]}hash[key].push(value)}else{hash[key]=value}}return hash})}function toArray(){return this.split("")}function succ(){return this.slice(0,this.length-1)+String.fromCharCode(this.charCodeAt(this.length-1)+1)}function times(count){return count<1?"":new Array(count+1).join(this)}function camelize(){var parts=this.split("-"),len=parts.length;if(len==1){return parts[0]}var camelized=this.charAt(0)=="-"?parts[0].charAt(0).toUpperCase()+parts[0].substring(1):parts[0];for(var i=1;i<len;i++){camelized+=parts[i].charAt(0).toUpperCase()+parts[i].substring(1)}return camelized}function capitalize(){return this.charAt(0).toUpperCase()+this.substring(1).toLowerCase()}function underscore(){return this.gsub(/::/,"/").gsub(/([A-Z]+)([A-Z][a-z])/,"#{1}_#{2}").gsub(/([a-z\d])([A-Z])/,"#{1}_#{2}").gsub(/-/,"_").toLowerCase()}function dasherize(){return this.gsub(/_/,"-")}function inspect(useDoubleQuotes){var escapedString=this.gsub(/[\x00-\x1f\\]/,function(match){var character=String.specialChar[match[0]];return character?character:"\\u00"+match[0].charCodeAt().toPaddedString(2,16)});if(useDoubleQuotes){return'"'+escapedString.replace(/"/g,'\\"')+'"'}return"'"+escapedString.replace(/'/g,"\\'")+"'"}function toJSON(){return this.inspect(true)}function unfilterJSON(filter){return this.sub(filter||Prototype.JSONFilter,"#{1}")}function isJSON(){var str=this;if(str.blank()){return false}str=this.replace(/\\./g,"@").replace(/"[^"\\\n\r]*"/g,"");return(/^[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]*$/).test(str)}function evalJSON(sanitize){var json=this.unfilterJSON();try{if(!sanitize||json.isJSON()){return eval("("+json+")")}}catch(e){}throw new SyntaxError("Badly formed JSON string: "+this.inspect())}function include(pattern){return this.indexOf(pattern)>-1}function startsWith(pattern){return this.indexOf(pattern)===0}function endsWith(pattern){var d=this.length-pattern.length;return d>=0&&this.lastIndexOf(pattern)===d}function empty(){return this==""}function blank(){return/^\s*$/.test(this)}function interpolate(object,pattern){return new Template(this,pattern).evaluate(object)}return{gsub:gsub,sub:sub,scan:scan,truncate:truncate,strip:String.prototype.trim?String.prototype.trim:strip,stripTags:stripTags,stripScripts:stripScripts,extractScripts:extractScripts,evalScripts:evalScripts,escapeHTML:escapeHTML,unescapeHTML:unescapeHTML,toQueryParams:toQueryParams,parseQuery:toQueryParams,toArray:toArray,succ:succ,times:times,camelize:camelize,capitalize:capitalize,underscore:underscore,dasherize:dasherize,inspect:inspect,toJSON:toJSON,unfilterJSON:unfilterJSON,isJSON:isJSON,evalJSON:evalJSON,include:include,startsWith:startsWith,endsWith:endsWith,empty:empty,blank:blank,interpolate:interpolate}})());Object.extend(String.prototype.escapeHTML,{div:document.createElement("div"),text:document.createTextNode("")});String.prototype.escapeHTML.div.appendChild(String.prototype.escapeHTML.text);if("<\n>".escapeHTML()!=="<\n>"){String.prototype.escapeHTML=function(){return this.replace(/&/g,"&").replace(/</g,"&lt;").replace(/>/g,">")}}if("<\n>".unescapeHTML()!=="<\n>"){String.prototype.unescapeHTML=function(){return this.stripTags().replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&")}}var Template=Class.create({initialize:function(a,b){this.template=a.toString();this.pattern=b||Template.Pattern},evaluate:function(a){if(a&&Object.isFunction(a.toTemplateReplacements)){a=a.toTemplateReplacements()}return this.template.gsub(this.pattern,function(e){if(a==null){return(e[1]+"")}var g=e[1]||"";if(g=="\\"){return e[2]}var b=a,h=e[3];var f=/^([^.[]+|\[((?:.*?[^\\])?)\])(\.|\[|$)/;e=f.exec(h);if(e==null){return g}while(e!=null){var c=e[1].startsWith("[")?e[2].gsub("\\\\]","]"):e[1];b=b[c];if(null==b||""==e[3]){break}h=h.substring("["==e[3]?e[1].length:e[0].length);e=f.exec(h)}return g+String.interpret(b)})}});Template.Pattern=/(^|.|\r|\n)(#\{(.*?)\})/;var $break={};var Enumerable=(function(){function c(C,B){var A=0;try{this._each(function(E){C.call(B,E,A++)})}catch(D){if(D!=$break){throw D}}return this}function u(D,C,B){var A=-D,E=[],F=this.toArray();if(D<1){return F}while((A+=D)<F.length){E.push(F.slice(A,A+D))}return E.collect(C,B)}function b(C,B){C=C||Prototype.K;var A=true;this.each(function(E,D){A=A&&!!C.call(B,E,D);if(!A){throw $break}});return A}function l(C,B){C=C||Prototype.K;var A=false;this.each(function(E,D){if(A=!!C.call(B,E,D)){throw $break}});return A}function m(C,B){C=C||Prototype.K;var A=[];this.each(function(E,D){A.push(C.call(B,E,D))});return A}function w(C,B){var A;this.each(function(E,D){if(C.call(B,E,D)){A=E;throw $break}});return A}function j(C,B){var A=[];this.each(function(E,D){if(C.call(B,E,D)){A.push(E)}});return A}function h(D,C,B){C=C||Prototype.K;var A=[];if(Object.isString(D)){D=new RegExp(RegExp.escape(D))}this.each(function(F,E){if(D.match(F)){A.push(C.call(B,F,E))}});return A}function a(A){if(Object.isFunction(this.indexOf)){if(this.indexOf(A)!=-1){return true}}var B=false;this.each(function(C){if(C==A){B=true;throw $break}});return B}function t(B,A){A=Object.isUndefined(A)?null:A;return this.eachSlice(B,function(C){while(C.length<B){C.push(A)}return C})}function o(A,C,B){this.each(function(E,D){A=C.call(B,A,E,D)});return A}function z(B){var A=$A(arguments).slice(1);return this.map(function(C){return C[B].apply(C,A)})}function s(C,B){C=C||Prototype.K;var A;this.each(function(E,D){E=C.call(B,E,D);if(A==null||E>=A){A=E}});return A}function q(C,B){C=C||Prototype.K;var A;this.each(function(E,D){E=C.call(B,E,D);if(A==null||E<A){A=E}});return A}function f(D,B){D=D||Prototype.K;var C=[],A=[];this.each(function(F,E){(D.call(B,F,E)?C:A).push(F)});return[C,A]}function g(B){var A=[];this.each(function(C){A.push(C[B])});return A}function e(C,B){var A=[];this.each(function(E,D){if(!C.call(B,E,D)){A.push(E)}});return A}function p(B,A){return this.map(function(D,C){return{value:D,criteria:B.call(A,D,C)}}).sort(function(F,E){var D=F.criteria,C=E.criteria;return D<C?-1:D>C?1:0}).pluck("value")}function r(){return this.map()}function v(){var B=Prototype.K,A=$A(arguments);if(Object.isFunction(A.last())){B=A.pop()}var C=[this].concat(A).map($A);return this.map(function(E,D){return B(C.pluck(D))})}function n(){return this.toArray().length}function y(){return"#<Enumerable:"+this.toArray().inspect()+">"}return{each:c,eachSlice:u,all:b,every:b,any:l,some:l,collect:m,map:m,detect:w,findAll:j,select:j,filter:j,grep:h,include:a,member:a,inGroupsOf:t,inject:o,invoke:z,max:s,min:q,partition:f,pluck:g,reject:e,sortBy:p,toArray:r,entries:r,zip:v,size:n,inspect:y,find:w}})();function $A(c){if(!c){return[]}if("toArray" in Object(c)){return c.toArray()}var b=c.length||0,a=new Array(b);while(b--){a[b]=c[b]}return a}function $w(a){if(!Object.isString(a)){return[]}a=a.strip();return a?a.split(/\s+/):[]}Array.from=$A;(function(){var v=Array.prototype,p=v.slice,r=v.forEach;function b(A){for(var z=0,B=this.length;z<B;z++){A(this[z])}}if(!r){r=b}function o(){this.length=0;return this}function e(){return this[0]}function h(){return this[this.length-1]}function l(){return this.select(function(z){return z!=null})}function y(){return this.inject([],function(A,z){if(Object.isArray(z)){return A.concat(z.flatten())}A.push(z);return A})}function j(){var z=p.call(arguments,0);return this.select(function(A){return !z.include(A)})}function g(z){return(z!==false?this:this.toArray())._reverse()}function n(z){return this.inject([],function(C,B,A){if(0==A||(z?C.last()!=B:!C.include(B))){C.push(B)}return C})}function s(z){return this.uniq().findAll(function(A){return z.detect(function(B){return A===B})})}function t(){return p.call(this,0)}function m(){return this.length}function w(){return"["+this.map(Object.inspect).join(", ")+"]"}function u(){var z=[];this.each(function(A){var B=Object.toJSON(A);if(!Object.isUndefined(B)){z.push(B)}});return"["+z.join(", ")+"]"}function a(B,z){z||(z=0);var A=this.length;if(z<0){z=A+z}for(;z<A;z++){if(this[z]===B){return z}}return -1}function q(A,z){z=isNaN(z)?this.length:(z<0?this.length+z:z)+1;var B=this.slice(0,z).reverse().indexOf(A);return(B<0)?B:z-B-1}function c(){var E=p.call(this,0),C;for(var A=0,B=arguments.length;A<B;A++){C=arguments[A];if(Object.isArray(C)&&!("callee" in C)){for(var z=0,D=C.length;z<D;z++){E.push(C[z])}}else{E.push(C)}}return E}Object.extend(v,Enumerable);if(!v._reverse){v._reverse=v.reverse}Object.extend(v,{_each:r,clear:o,first:e,last:h,compact:l,flatten:y,without:j,reverse:g,uniq:n,intersect:s,clone:t,toArray:t,size:m,inspect:w,toJSON:u});var f=(function(){return[].concat(arguments)[0][0]!==1})(1,2);if(f){v.concat=c}if(!v.indexOf){v.indexOf=a}if(!v.lastIndexOf){v.lastIndexOf=q}})();function $H(a){return new Hash(a)}var Hash=Class.create(Enumerable,(function(){function f(t){this._object=Object.isHash(t)?t.toObject():Object.clone(t)}function g(u){for(var t in this._object){var v=this._object[t],w=[t,v];w.key=t;w.value=v;u(w)}}function n(t,u){return this._object[t]=u}function c(t){if(this._object[t]!==Object.prototype[t]){return this._object[t]}}function q(t){var u=this._object[t];delete this._object[t];return u}function s(){return Object.clone(this._object)}function r(){return this.pluck("key")}function p(){return this.pluck("value")}function h(u){var t=this.detect(function(v){return v.value===u});return t&&t.key}function l(t){return this.clone().update(t)}function e(t){return new Hash(t).inject(this,function(u,v){u.set(v.key,v.value);return u})}function b(t,u){if(Object.isUndefined(u)){return t}return t+"="+encodeURIComponent(String.interpret(u))}function a(){return this.inject([],function(v,w){var u=encodeURIComponent(w.key),t=w.value;if(t&&typeof t=="object"){if(Object.isArray(t)){return v.concat(t.map(b.curry(u)))}}else{v.push(b(u,t))}return v}).join("&")}function o(){return"#<Hash:{"+this.map(function(t){return t.map(Object.inspect).join(": ")}).join(", ")+"}>"}function m(){return Object.toJSON(this.toObject())}function j(){return new Hash(this)}return{initialize:f,_each:g,set:n,get:c,unset:q,toObject:s,toTemplateReplacements:s,keys:r,values:p,index:h,merge:l,update:e,toQueryString:a,inspect:o,toJSON:m,clone:j}})());Hash.from=$H;Object.extend(Number.prototype,(function(){function e(){return this.toPaddedString(2,16)}function f(){return this+1}function a(n,m){$R(0,this,true).each(n,m);return this}function b(o,n){var m=this.toString(n||10);return"0".times(o-m.length)+m}function g(){return isFinite(this)?this.toString():"null"}function l(){return Math.abs(this)}function j(){return Math.round(this)}function h(){return Math.ceil(this)}function c(){return Math.floor(this)}return{toColorPart:e,succ:f,times:a,toPaddedString:b,toJSON:g,abs:l,round:j,ceil:h,floor:c}})());function $R(c,a,b){return new ObjectRange(c,a,b)}var ObjectRange=Class.create(Enumerable,(function(){function b(g,e,f){this.start=g;this.end=e;this.exclusive=f}function c(e){var f=this.start;while(this.include(f)){e(f);f=f.succ()}}function a(e){if(e<this.start){return false}if(this.exclusive){return e<this.end}return e<=this.end}return{initialize:b,_each:c,include:a}})());var Ajax={getTransport:function(){return Try.these(function(){return new XMLHttpRequest()},function(){return new ActiveXObject("Msxml2.XMLHTTP")},function(){return new ActiveXObject("Microsoft.XMLHTTP")})||false},activeRequestCount:0};Ajax.Responders={responders:[],_each:function(a){this.responders._each(a)},register:function(a){if(!this.include(a)){this.responders.push(a)}},unregister:function(a){this.responders=this.responders.without(a)},dispatch:function(e,b,c,a){this.each(function(f){if(Object.isFunction(f[e])){try{f[e].apply(f,[b,c,a])}catch(g){}}})}};Object.extend(Ajax.Responders,Enumerable);Ajax.Responders.register({onCreate:function(){Ajax.activeRequestCount++},onComplete:function(){Ajax.activeRequestCount--}});Ajax.Base=Class.create({initialize:function(a){this.options={method:"post",asynchronous:true,contentType:"application/x-www-form-urlencoded",encoding:"UTF-8",parameters:"",evalJSON:true,evalJS:true};Object.extend(this.options,a||{});this.options.method=this.options.method.toLowerCase();if(Object.isString(this.options.parameters)){this.options.parameters=this.options.parameters.toQueryParams()}else{if(Object.isHash(this.options.parameters)){this.options.parameters=this.options.parameters.toObject()}}}});Ajax.Request=Class.create(Ajax.Base,{_complete:false,initialize:function($super,b,a){$super(a);this.transport=Ajax.getTransport();this.request(b)},request:function(b){this.url=b;this.method=this.options.method;var f=Object.clone(this.options.parameters);if(!["get","post"].include(this.method)){f._method=this.method;this.method="post"}this.parameters=f;if(f=Object.toQueryString(f)){if(this.method=="get"){this.url+=(this.url.include("?")?"&":"?")+f}else{if(/Konqueror|Safari|KHTML/.test(navigator.userAgent)){f+="&_="}}}try{var a=new Ajax.Response(this);if(this.options.onCreate){this.options.onCreate(a)}Ajax.Responders.dispatch("onCreate",this,a);this.transport.open(this.method.toUpperCase(),this.url,this.options.asynchronous);if(this.options.asynchronous){this.respondToReadyState.bind(this).defer(1)}this.transport.onreadystatechange=this.onStateChange.bind(this);this.setRequestHeaders();this.body=this.method=="post"?(this.options.postBody||f):null;this.transport.send(this.body);if(!this.options.asynchronous&&this.transport.overrideMimeType){this.onStateChange()}}catch(c){this.dispatchException(c)}},onStateChange:function(){var a=this.transport.readyState;if(a>1&&!((a==4)&&this._complete)){this.respondToReadyState(this.transport.readyState)}},setRequestHeaders:function(){var f={"X-Requested-With":"XMLHttpRequest","X-Prototype-Version":Prototype.Version,Accept:"text/javascript, text/html, application/xml, text/xml, */*"};if(this.method=="post"){f["Content-type"]=this.options.contentType+(this.options.encoding?"; charset="+this.options.encoding:"");if(this.transport.overrideMimeType&&(navigator.userAgent.match(/Gecko\/(\d{4})/)||[0,2005])[1]<2005){f.Connection="close"}}if(typeof this.options.requestHeaders=="object"){var c=this.options.requestHeaders;if(Object.isFunction(c.push)){for(var b=0,e=c.length;b<e;b+=2){f[c[b]]=c[b+1]}}else{$H(c).each(function(g){f[g.key]=g.value})}}for(var a in f){this.transport.setRequestHeader(a,f[a])}},success:function(){var a=this.getStatus();return !a||(a>=200&&a<300)},getStatus:function(){try{return this.transport.status||0}catch(a){return 0}},respondToReadyState:function(a){var c=Ajax.Request.Events[a],b=new Ajax.Response(this);if(c=="Complete"){try{this._complete=true;(this.options["on"+b.status]||this.options["on"+(this.success()?"Success":"Failure")]||Prototype.emptyFunction)(b,b.headerJSON)}catch(f){this.dispatchException(f)}var g=b.getHeader("Content-type");if(this.options.evalJS=="force"||(this.options.evalJS&&this.isSameOrigin()&&g&&g.match(/^\s*(text|application)\/(x-)?(java|ecma)script(;.*)?\s*$/i))){this.evalResponse()}}try{(this.options["on"+c]||Prototype.emptyFunction)(b,b.headerJSON);Ajax.Responders.dispatch("on"+c,this,b,b.headerJSON)}catch(f){this.dispatchException(f)}if(c=="Complete"){this.transport.onreadystatechange=Prototype.emptyFunction}},isSameOrigin:function(){var a=this.url.match(/^\s*https?:\/\/[^\/]*/);return !a||(a[0]=="#{protocol}//#{domain}#{port}".interpolate({protocol:location.protocol,domain:document.domain,port:location.port?":"+location.port:""}))},getHeader:function(a){try{return this.transport.getResponseHeader(a)||null}catch(b){return null}},evalResponse:function(){try{return eval((this.transport.responseText||"").unfilterJSON())}catch(e){this.dispatchException(e)}},dispatchException:function(a){(this.options.onException||Prototype.emptyFunction)(this,a);Ajax.Responders.dispatch("onException",this,a)}});Ajax.Request.Events=["Uninitialized","Loading","Loaded","Interactive","Complete"];Ajax.Response=Class.create({initialize:function(c){this.request=c;var e=this.transport=c.transport,a=this.readyState=e.readyState;if((a>2&&!Prototype.Browser.IE)||a==4){this.status=this.getStatus();this.statusText=this.getStatusText();this.responseText=String.interpret(e.responseText);this.headerJSON=this._getHeaderJSON()}if(a==4){var b=e.responseXML;this.responseXML=Object.isUndefined(b)?null:b;this.responseJSON=this._getResponseJSON()}},status:0,statusText:"",getStatus:Ajax.Request.prototype.getStatus,getStatusText:function(){try{return this.transport.statusText||""}catch(a){return""}},getHeader:Ajax.Request.prototype.getHeader,getAllHeaders:function(){try{return this.getAllResponseHeaders()}catch(a){return null}},getResponseHeader:function(a){return this.transport.getResponseHeader(a)},getAllResponseHeaders:function(){return this.transport.getAllResponseHeaders()},_getHeaderJSON:function(){var a=this.getHeader("X-JSON");if(!a){return null}a=decodeURIComponent(escape(a));try{return a.evalJSON(this.request.options.sanitizeJSON||!this.request.isSameOrigin())}catch(b){this.request.dispatchException(b)}},_getResponseJSON:function(){var a=this.request.options;if(!a.evalJSON||(a.evalJSON!="force"&&!(this.getHeader("Content-type")||"").include("application/json"))||this.responseText.blank()){return null}try{return this.responseText.evalJSON(a.sanitizeJSON||!this.request.isSameOrigin())}catch(b){this.request.dispatchException(b)}}});Ajax.Updater=Class.create(Ajax.Request,{initialize:function($super,a,c,b){this.container={success:(a.success||a),failure:(a.failure||(a.success?null:a))};b=Object.clone(b);var e=b.onComplete;b.onComplete=(function(f,g){this.updateContent(f.responseText);if(Object.isFunction(e)){e(f,g)}}).bind(this);$super(c,b)},updateContent:function(e){var c=this.container[this.success()?"success":"failure"],a=this.options;if(!a.evalScripts){e=e.stripScripts()}if(c=$(c)){if(a.insertion){if(Object.isString(a.insertion)){var b={};b[a.insertion]=e;c.insert(b)}else{a.insertion(c,e)}}else{c.update(e)}}}});Ajax.PeriodicalUpdater=Class.create(Ajax.Base,{initialize:function($super,a,c,b){$super(b);this.onComplete=this.options.onComplete;this.frequency=(this.options.frequency||2);this.decay=(this.options.decay||1);this.updater={};this.container=a;this.url=c;this.start()},start:function(){this.options.onComplete=this.updateComplete.bind(this);this.onTimerEvent()},stop:function(){this.updater.options.onComplete=undefined;clearTimeout(this.timer);(this.onComplete||Prototype.emptyFunction).apply(this,arguments)},updateComplete:function(a){if(this.options.decay){this.decay=(a.responseText==this.lastText?this.decay*this.options.decay:1);this.lastText=a.responseText}this.timer=this.onTimerEvent.bind(this).delay(this.decay*this.frequency)},onTimerEvent:function(){this.updater=new Ajax.Updater(this.container,this.url,this.options)}});function $(b){if(arguments.length>1){for(var a=0,e=[],c=arguments.length;a<c;a++){e.push($(arguments[a]))}return e}if(Object.isString(b)){b=document.getElementById(b)}return Element.extend(b)}if(Prototype.BrowserFeatures.XPath){document._getElementsByXPath=function(g,a){var c=[];var f=document.evaluate(g,$(a)||document,null,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null);for(var b=0,e=f.snapshotLength;b<e;b++){c.push(Element.extend(f.snapshotItem(b)))}return c}}if(!window.Node){var Node={}}if(!Node.ELEMENT_NODE){Object.extend(Node,{ELEMENT_NODE:1,ATTRIBUTE_NODE:2,TEXT_NODE:3,CDATA_SECTION_NODE:4,ENTITY_REFERENCE_NODE:5,ENTITY_NODE:6,PROCESSING_INSTRUCTION_NODE:7,COMMENT_NODE:8,DOCUMENT_NODE:9,DOCUMENT_TYPE_NODE:10,DOCUMENT_FRAGMENT_NODE:11,NOTATION_NODE:12})}(function(c){var b=(function(){var g=document.createElement("form");var f=document.createElement("input");var e=document.documentElement;f.setAttribute("name","test");g.appendChild(f);e.appendChild(g);var h=g.elements?(typeof g.elements.test=="undefined"):null;e.removeChild(g);g=f=null;return h})();var a=c.Element;c.Element=function(g,f){f=f||{};g=g.toLowerCase();var e=Element.cache;if(b&&f.name){g="<"+g+' name="'+f.name+'">';delete f.name;return Element.writeAttribute(document.createElement(g),f)}if(!e[g]){e[g]=Element.extend(document.createElement(g))}return Element.writeAttribute(e[g].cloneNode(false),f)};Object.extend(c.Element,a||{});if(a){c.Element.prototype=a.prototype}})(this);Element.cache={};Element.idCounter=1;Element.Methods={visible:function(a){return $(a).style.display!="none"},toggle:function(a){a=$(a);Element[Element.visible(a)?"hide":"show"](a);return a},hide:function(a){a=$(a);a.style.display="none";return a},show:function(a){a=$(a);a.style.display="";return a},remove:function(a){a=$(a);a.parentNode.removeChild(a);return a},update:(function(){var b=(function(){var f=document.createElement("select"),g=true;f.innerHTML='<option value="test">test</option>';if(f.options&&f.options[0]){g=f.options[0].nodeName.toUpperCase()!=="OPTION"}f=null;return g})();var a=(function(){try{var f=document.createElement("table");if(f&&f.tBodies){f.innerHTML="<tbody><tr><td>test</td></tr></tbody>";var h=typeof f.tBodies[0]=="undefined";f=null;return h}}catch(g){return true}})();var e=(function(){var f=document.createElement("script"),h=false;try{f.appendChild(document.createTextNode(""));h=!f.firstChild||f.firstChild&&f.firstChild.nodeType!==3}catch(g){h=true}f=null;return h})();function c(g,h){g=$(g);if(h&&h.toElement){h=h.toElement()}if(Object.isElement(h)){return g.update().insert(h)}h=Object.toHTML(h);var f=g.tagName.toUpperCase();if(f==="SCRIPT"&&e){g.text=h;return g}if(b||a){if(f in Element._insertionTranslations.tags){while(g.firstChild){g.removeChild(g.firstChild)}Element._getContentFromAnonymousElement(f,h.stripScripts()).each(function(j){g.appendChild(j)})}else{g.innerHTML=h.stripScripts()}}else{g.innerHTML=h.stripScripts()}h.evalScripts.bind(h).defer();return g}return c})(),replace:function(b,c){b=$(b);if(c&&c.toElement){c=c.toElement()}else{if(!Object.isElement(c)){c=Object.toHTML(c);var a=b.ownerDocument.createRange();a.selectNode(b);c.evalScripts.bind(c).defer();c=a.createContextualFragment(c.stripScripts())}}b.parentNode.replaceChild(c,b);return b},insert:function(c,f){c=$(c);if(Object.isString(f)||Object.isNumber(f)||Object.isElement(f)||(f&&(f.toElement||f.toHTML))){f={bottom:f}}var e,g,b,h;for(var a in f){e=f[a];a=a.toLowerCase();g=Element._insertionTranslations[a];if(e&&e.toElement){e=e.toElement()}if(Object.isElement(e)){g(c,e);continue}e=Object.toHTML(e);b=((a=="before"||a=="after")?c.parentNode:c).tagName.toUpperCase();h=Element._getContentFromAnonymousElement(b,e.stripScripts());if(a=="top"||a=="after"){h.reverse()}h.each(g.curry(c));e.evalScripts.bind(e).defer()}return c},wrap:function(b,c,a){b=$(b);if(Object.isElement(c)){$(c).writeAttribute(a||{})}else{if(Object.isString(c)){c=new Element(c,a)}else{c=new Element("div",c)}}if(b.parentNode){b.parentNode.replaceChild(c,b)}c.appendChild(b);return c},inspect:function(b){b=$(b);var a="<"+b.tagName.toLowerCase();$H({id:"id",className:"class"}).each(function(g){var f=g.first(),c=g.last();var e=(b[f]||"").toString();if(e){a+=" "+c+"="+e.inspect(true)}});return a+">"},recursivelyCollect:function(a,c){a=$(a);var b=[];while(a=a[c]){if(a.nodeType==1){b.push(Element.extend(a))}}return b},ancestors:function(a){return Element.recursivelyCollect(a,"parentNode")},descendants:function(a){return Element.select(a,"*")},firstDescendant:function(a){a=$(a).firstChild;while(a&&a.nodeType!=1){a=a.nextSibling}return $(a)},immediateDescendants:function(a){if(!(a=$(a).firstChild)){return[]}while(a&&a.nodeType!=1){a=a.nextSibling}if(a){return[a].concat($(a).nextSiblings())}return[]},previousSiblings:function(a){return Element.recursivelyCollect(a,"previousSibling")},nextSiblings:function(a){return Element.recursivelyCollect(a,"nextSibling")},siblings:function(a){a=$(a);return Element.previousSiblings(a).reverse().concat(Element.nextSiblings(a))},match:function(b,a){if(Object.isString(a)){a=new Selector(a)}return a.match($(b))},up:function(b,e,a){b=$(b);if(arguments.length==1){return $(b.parentNode)}var c=Element.ancestors(b);return Object.isNumber(e)?c[e]:Selector.findElement(c,e,a)},down:function(b,c,a){b=$(b);if(arguments.length==1){return Element.firstDescendant(b)}return Object.isNumber(c)?Element.descendants(b)[c]:Element.select(b,c)[a||0]},previous:function(b,e,a){b=$(b);if(arguments.length==1){return $(Selector.handlers.previousElementSibling(b))}var c=Element.previousSiblings(b);return Object.isNumber(e)?c[e]:Selector.findElement(c,e,a)},next:function(c,e,b){c=$(c);if(arguments.length==1){return $(Selector.handlers.nextElementSibling(c))}var a=Element.nextSiblings(c);return Object.isNumber(e)?a[e]:Selector.findElement(a,e,b)},select:function(b){var a=Array.prototype.slice.call(arguments,1);return Selector.findChildElements(b,a)},adjacent:function(b){var a=Array.prototype.slice.call(arguments,1);return Selector.findChildElements(b.parentNode,a).without(b)},identify:function(a){a=$(a);var b=Element.readAttribute(a,"id");if(b){return b}do{b="anonymous_element_"+Element.idCounter++}while($(b));Element.writeAttribute(a,"id",b);return b},readAttribute:(function(){var a=(function(){var b=document.createElement("iframe"),f=false;document.documentElement.appendChild(b);try{b.getAttribute("type",2)}catch(c){f=true}document.documentElement.removeChild(b);b=null;return f})();return function(e,b){e=$(e);if(a&&b==="type"&&e.tagName.toUpperCase()=="IFRAME"){return e.getAttribute("type")}if(Prototype.Browser.IE){var c=Element._attributeTranslations.read;if(c.values[b]){return c.values[b](e,b)}if(c.names[b]){b=c.names[b]}if(b.include(":")){return(!e.attributes||!e.attributes[b])?null:e.attributes[b].value}}return e.getAttribute(b)}})(),writeAttribute:function(f,c,g){f=$(f);var b={},e=Element._attributeTranslations.write;if(typeof c=="object"){b=c}else{b[c]=Object.isUndefined(g)?true:g}for(var a in b){c=e.names[a]||a;g=b[a];if(e.values[a]){c=e.values[a](f,g)}if(g===false||g===null){f.removeAttribute(c)}else{if(g===true){f.setAttribute(c,c)}else{f.setAttribute(c,g)}}}return f},getHeight:function(a){return Element.getDimensions(a).height},getWidth:function(a){return Element.getDimensions(a).width},classNames:function(a){return new Element.ClassNames(a)},hasClassName:function(a,b){if(!(a=$(a))){return}var c=a.className;return(c.length>0&&(c==b||new RegExp("(^|\\s)"+b+"(\\s|$)").test(c)))},addClassName:function(a,b){if(!(a=$(a))){return}if(!Element.hasClassName(a,b)){a.className+=(a.className?" ":"")+b}return a},removeClassName:function(a,b){if(!(a=$(a))){return}a.className=a.className.replace(new RegExp("(^|\\s+)"+b+"(\\s+|$)")," ").strip();return a},toggleClassName:function(a,b){if(!(a=$(a))){return}return Element[Element.hasClassName(a,b)?"removeClassName":"addClassName"](a,b)},cleanWhitespace:function(b){b=$(b);var c=b.firstChild;while(c){var a=c.nextSibling;if(c.nodeType==3&&!/\S/.test(c.nodeValue)){b.removeChild(c)}c=a}return b},empty:function(a){return $(a).innerHTML.blank()},descendantOf:function(b,a){b=$(b),a=$(a);if(b.compareDocumentPosition){return(b.compareDocumentPosition(a)&8)===8}if(a.contains){return a.contains(b)&&a!==b}while(b=b.parentNode){if(b==a){return true}}return false},scrollTo:function(a){a=$(a);var b=Element.cumulativeOffset(a);window.scrollTo(b[0],b[1]);return a},getStyle:function(b,c){b=$(b);c=c=="float"?"cssFloat":c.camelize();var e=b.style[c];if(!e||e=="auto"){var a=document.defaultView.getComputedStyle(b,null);e=a?a[c]:null}if(c=="opacity"){return e?parseFloat(e):1}return e=="auto"?null:e},getOpacity:function(a){return $(a).getStyle("opacity")},setStyle:function(b,c){b=$(b);var f=b.style,a;if(Object.isString(c)){b.style.cssText+=";"+c;return c.include("opacity")?b.setOpacity(c.match(/opacity:\s*(\d?\.?\d*)/)[1]):b}for(var e in c){if(e=="opacity"){b.setOpacity(c[e])}else{f[(e=="float"||e=="cssFloat")?(Object.isUndefined(f.styleFloat)?"cssFloat":"styleFloat"):e]=c[e]}}return b},setOpacity:function(a,b){a=$(a);a.style.opacity=(b==1||b==="")?"":(b<0.00001)?0:b;return a},getDimensions:function(c){c=$(c);var h=Element.getStyle(c,"display");if(h!="none"&&h!=null){return{width:c.offsetWidth,height:c.offsetHeight}}var b=c.style;var g=b.visibility;var e=b.position;var a=b.display;b.visibility="hidden";if(e!="fixed"){b.position="absolute"}b.display="block";var j=c.clientWidth;var f=c.clientHeight;b.display=a;b.position=e;b.visibility=g;return{width:j,height:f}},makePositioned:function(a){a=$(a);var b=Element.getStyle(a,"position");if(b=="static"||!b){a._madePositioned=true;a.style.position="relative";if(Prototype.Browser.Opera){a.style.top=0;a.style.left=0}}return a},undoPositioned:function(a){a=$(a);if(a._madePositioned){a._madePositioned=undefined;a.style.position=a.style.top=a.style.left=a.style.bottom=a.style.right=""}return a},makeClipping:function(a){a=$(a);if(a._overflow){return a}a._overflow=Element.getStyle(a,"overflow")||"auto";if(a._overflow!=="hidden"){a.style.overflow="hidden"}return a},undoClipping:function(a){a=$(a);if(!a._overflow){return a}a.style.overflow=a._overflow=="auto"?"":a._overflow;a._overflow=null;return a},cumulativeOffset:function(b){var a=0,c=0;do{a+=b.offsetTop||0;c+=b.offsetLeft||0;b=b.offsetParent}while(b);return Element._returnOffset(c,a)},positionedOffset:function(b){var a=0,e=0;do{a+=b.offsetTop||0;e+=b.offsetLeft||0;b=b.offsetParent;if(b){if(b.tagName.toUpperCase()=="BODY"){break}var c=Element.getStyle(b,"position");if(c!=="static"){break}}}while(b);return Element._returnOffset(e,a)},absolutize:function(b){b=$(b);if(Element.getStyle(b,"position")=="absolute"){return b}var e=Element.positionedOffset(b);var g=e[1];var f=e[0];var c=b.clientWidth;var a=b.clientHeight;b._originalLeft=f-parseFloat(b.style.left||0);b._originalTop=g-parseFloat(b.style.top||0);b._originalWidth=b.style.width;b._originalHeight=b.style.height;b.style.position="absolute";b.style.top=g+"px";b.style.left=f+"px";b.style.width=c+"px";b.style.height=a+"px";return b},relativize:function(a){a=$(a);if(Element.getStyle(a,"position")=="relative"){return a}a.style.position="relative";var c=parseFloat(a.style.top||0)-(a._originalTop||0);var b=parseFloat(a.style.left||0)-(a._originalLeft||0);a.style.top=c+"px";a.style.left=b+"px";a.style.height=a._originalHeight;a.style.width=a._originalWidth;return a},cumulativeScrollOffset:function(b){var a=0,c=0;do{a+=b.scrollTop||0;c+=b.scrollLeft||0;b=b.parentNode}while(b);return Element._returnOffset(c,a)},getOffsetParent:function(a){if(a.offsetParent){return $(a.offsetParent)}if(a==document.body){return $(a)}while((a=a.parentNode)&&a!=document.body){if(Element.getStyle(a,"position")!="static"){return $(a)}}return $(document.body)},viewportOffset:function(e){var a=0,c=0;var b=e;do{a+=b.offsetTop||0;c+=b.offsetLeft||0;if(b.offsetParent==document.body&&Element.getStyle(b,"position")=="absolute"){break}}while(b=b.offsetParent);b=e;do{if(!Prototype.Browser.Opera||(b.tagName&&(b.tagName.toUpperCase()=="BODY"))){a-=b.scrollTop||0;c-=b.scrollLeft||0}}while(b=b.parentNode);return Element._returnOffset(c,a)},clonePosition:function(b,e){var a=Object.extend({setLeft:true,setTop:true,setWidth:true,setHeight:true,offsetTop:0,offsetLeft:0},arguments[2]||{});e=$(e);var f=Element.viewportOffset(e);b=$(b);var g=[0,0];var c=null;if(Element.getStyle(b,"position")=="absolute"){c=Element.getOffsetParent(b);g=Element.viewportOffset(c)}if(c==document.body){g[0]-=document.body.offsetLeft;g[1]-=document.body.offsetTop}if(a.setLeft){b.style.left=(f[0]-g[0]+a.offsetLeft)+"px"}if(a.setTop){b.style.top=(f[1]-g[1]+a.offsetTop)+"px"}if(a.setWidth){b.style.width=e.offsetWidth+"px"}if(a.setHeight){b.style.height=e.offsetHeight+"px"}return b}};Object.extend(Element.Methods,{getElementsBySelector:Element.Methods.select,childElements:Element.Methods.immediateDescendants});Element._attributeTranslations={write:{names:{className:"class",htmlFor:"for"},values:{}}};if(Prototype.Browser.Opera){Element.Methods.getStyle=Element.Methods.getStyle.wrap(function(e,b,c){switch(c){case"left":case"top":case"right":case"bottom":if(e(b,"position")==="static"){return null}case"height":case"width":if(!Element.visible(b)){return null}var f=parseInt(e(b,c),10);if(f!==b["offset"+c.capitalize()]){return f+"px"}var a;if(c==="height"){a=["border-top-width","padding-top","padding-bottom","border-bottom-width"]}else{a=["border-left-width","padding-left","padding-right","border-right-width"]}return a.inject(f,function(g,h){var j=e(b,h);return j===null?g:g-parseInt(j,10)})+"px";default:return e(b,c)}});Element.Methods.readAttribute=Element.Methods.readAttribute.wrap(function(c,a,b){if(b==="title"){return a.title}return c(a,b)})}else{if(Prototype.Browser.IE){Element.Methods.getOffsetParent=Element.Methods.getOffsetParent.wrap(function(c,b){b=$(b);try{b.offsetParent}catch(g){return $(document.body)}var a=b.getStyle("position");if(a!=="static"){return c(b)}b.setStyle({position:"relative"});var f=c(b);b.setStyle({position:a});return f});$w("positionedOffset viewportOffset").each(function(a){Element.Methods[a]=Element.Methods[a].wrap(function(g,c){c=$(c);try{c.offsetParent}catch(j){return Element._returnOffset(0,0)}var b=c.getStyle("position");if(b!=="static"){return g(c)}var f=c.getOffsetParent();if(f&&f.getStyle("position")==="fixed"){f.setStyle({zoom:1})}c.setStyle({position:"relative"});var h=g(c);c.setStyle({position:b});return h})});Element.Methods.cumulativeOffset=Element.Methods.cumulativeOffset.wrap(function(b,a){try{a.offsetParent}catch(c){return Element._returnOffset(0,0)}return b(a)});Element.Methods.getStyle=function(a,b){a=$(a);b=(b=="float"||b=="cssFloat")?"styleFloat":b.camelize();var c=a.style[b];if(!c&&a.currentStyle){c=a.currentStyle[b]}if(b=="opacity"){if(c=(a.getStyle("filter")||"").match(/alpha\(opacity=(.*)\)/)){if(c[1]){return parseFloat(c[1])/100}}return 1}if(c=="auto"){if((b=="width"||b=="height")&&(a.getStyle("display")!="none")){return a["offset"+b.capitalize()]+"px"}return null}return c};Element.Methods.setOpacity=function(b,f){function g(h){return h.replace(/alpha\([^\)]*\)/gi,"")}b=$(b);var a=b.currentStyle;if((a&&!a.hasLayout)||(!a&&b.style.zoom=="normal")){b.style.zoom=1}var e=b.getStyle("filter"),c=b.style;if(f==1||f===""){(e=g(e))?c.filter=e:c.removeAttribute("filter");return b}else{if(f<0.00001){f=0}}c.filter=g(e)+"alpha(opacity="+(f*100)+")";return b};Element._attributeTranslations=(function(){var b="className";var a="for";var c=document.createElement("div");c.setAttribute(b,"x");if(c.className!=="x"){c.setAttribute("class","x");if(c.className==="x"){b="class"}}c=null;c=document.createElement("label");c.setAttribute(a,"x");if(c.htmlFor!=="x"){c.setAttribute("htmlFor","x");if(c.htmlFor==="x"){a="htmlFor"}}c=null;return{read:{names:{"class":b,className:b,"for":a,htmlFor:a},values:{_getAttr:function(e,f){return e.getAttribute(f,2)},_getAttrNode:function(e,g){var f=e.getAttributeNode(g);return f?f.value:""},_getEv:(function(){var e=document.createElement("div");e.onclick=Prototype.emptyFunction;var h=e.getAttribute("onclick");var g;if(String(h).indexOf("{")>-1){g=function(f,j){j=f.getAttribute(j);if(!j){return null}j=j.toString();j=j.split("{")[1];j=j.split("}")[0];return j.strip()}}else{if(h===""){g=function(f,j){j=f.getAttribute(j);if(!j){return null}return j.strip()}}}e=null;return g})(),_flag:function(e,f){return $(e).hasAttribute(f)?f:null},style:function(e){return e.style.cssText.toLowerCase()},title:function(e){return e.title}}}}})();Element._attributeTranslations.write={names:Object.extend({cellpadding:"cellPadding",cellspacing:"cellSpacing"},Element._attributeTranslations.read.names),values:{checked:function(a,b){a.checked=!!b},style:function(a,b){a.style.cssText=b?b:""}}};Element._attributeTranslations.has={};$w("colSpan rowSpan vAlign dateTime accessKey tabIndex encType maxLength readOnly longDesc frameBorder").each(function(a){Element._attributeTranslations.write.names[a.toLowerCase()]=a;Element._attributeTranslations.has[a.toLowerCase()]=a});(function(a){Object.extend(a,{href:a._getAttr,src:a._getAttr,type:a._getAttr,action:a._getAttrNode,disabled:a._flag,checked:a._flag,readonly:a._flag,multiple:a._flag,onload:a._getEv,onunload:a._getEv,onclick:a._getEv,ondblclick:a._getEv,onmousedown:a._getEv,onmouseup:a._getEv,onmouseover:a._getEv,onmousemove:a._getEv,onmouseout:a._getEv,onfocus:a._getEv,onblur:a._getEv,onkeypress:a._getEv,onkeydown:a._getEv,onkeyup:a._getEv,onsubmit:a._getEv,onreset:a._getEv,onselect:a._getEv,onchange:a._getEv})})(Element._attributeTranslations.read.values);if(Prototype.BrowserFeatures.ElementExtensions){(function(){function a(f){var b=f.getElementsByTagName("*"),e=[];for(var c=0,g;g=b[c];c++){if(g.tagName!=="!"){e.push(g)}}return e}Element.Methods.down=function(c,e,b){c=$(c);if(arguments.length==1){return c.firstDescendant()}return Object.isNumber(e)?a(c)[e]:Element.select(c,e)[b||0]}})()}}else{if(Prototype.Browser.Gecko&&/rv:1\.8\.0/.test(navigator.userAgent)){Element.Methods.setOpacity=function(a,b){a=$(a);a.style.opacity=(b==1)?0.999999:(b==="")?"":(b<0.00001)?0:b;return a}}else{if(Prototype.Browser.WebKit){Element.Methods.setOpacity=function(a,b){a=$(a);a.style.opacity=(b==1||b==="")?"":(b<0.00001)?0:b;if(b==1){if(a.tagName.toUpperCase()=="IMG"&&a.width){a.width++;a.width--}else{try{var f=document.createTextNode(" ");a.appendChild(f);a.removeChild(f)}catch(c){}}}return a};Element.Methods.cumulativeOffset=function(b){var a=0,c=0;do{a+=b.offsetTop||0;c+=b.offsetLeft||0;if(b.offsetParent==document.body){if(Element.getStyle(b,"position")=="absolute"){break}}b=b.offsetParent}while(b);return Element._returnOffset(c,a)}}}}}if("outerHTML" in document.documentElement){Element.Methods.replace=function(c,f){c=$(c);if(f&&f.toElement){f=f.toElement()}if(Object.isElement(f)){c.parentNode.replaceChild(f,c);return c}f=Object.toHTML(f);var e=c.parentNode,b=e.tagName.toUpperCase();if(Element._insertionTranslations.tags[b]){var g=c.next();var a=Element._getContentFromAnonymousElement(b,f.stripScripts());e.removeChild(c);if(g){a.each(function(h){e.insertBefore(h,g)})}else{a.each(function(h){e.appendChild(h)})}}else{c.outerHTML=f.stripScripts()}f.evalScripts.bind(f).defer();return c}}Element._returnOffset=function(b,c){var a=[b,c];a.left=b;a.top=c;return a};Element._getContentFromAnonymousElement=function(c,b){var e=new Element("div"),a=Element._insertionTranslations.tags[c];if(a){e.innerHTML=a[0]+b+a[1];a[2].times(function(){e=e.firstChild})}else{e.innerHTML=b}return $A(e.childNodes)};Element._insertionTranslations={before:function(a,b){a.parentNode.insertBefore(b,a)},top:function(a,b){a.insertBefore(b,a.firstChild)},bottom:function(a,b){a.appendChild(b)},after:function(a,b){a.parentNode.insertBefore(b,a.nextSibling)},tags:{TABLE:["<table>","</table>",1],TBODY:["<table><tbody>","</tbody></table>",2],TR:["<table><tbody><tr>","</tr></tbody></table>",3],TD:["<table><tbody><tr><td>","</td></tr></tbody></table>",4],SELECT:["<select>","</select>",1]}};(function(){var a=Element._insertionTranslations.tags;Object.extend(a,{THEAD:a.TBODY,TFOOT:a.TBODY,TH:a.TD})})();Element.Methods.Simulated={hasAttribute:function(a,c){c=Element._attributeTranslations.has[c]||c;var b=$(a).getAttributeNode(c);return !!(b&&b.specified)}};Element.Methods.ByTag={};Object.extend(Element,Element.Methods);(function(a){if(!Prototype.BrowserFeatures.ElementExtensions&&a.__proto__){window.HTMLElement={};window.HTMLElement.prototype=a.__proto__;Prototype.BrowserFeatures.ElementExtensions=true}a=null})(document.createElement("div"));Element.extend=(function(){function c(h){if(typeof window.Element!="undefined"){var l=window.Element.prototype;if(l){var n="_"+(Math.random()+"").slice(2);var j=document.createElement(h);l[n]="x";var m=(j[n]!=="x");delete l[n];j=null;return m}}return false}function b(j,h){for(var m in h){var l=h[m];if(Object.isFunction(l)&&!(m in j)){j[m]=l.methodize()}}}var e=c("object");if(Prototype.BrowserFeatures.SpecificElementExtensions){if(e){return function(j){var h;if(j&&(h=j.tagName)){if(/^(?:object|applet|embed)$/i.test(h)){b(j,Element.Methods);b(j,Element.Methods.ByTag[h.toUpperCase()])}}return j}}return Prototype.K}var a={},f=Element.Methods.ByTag;var g=Object.extend(function(l){if(!l||typeof l._extendedByPrototype!="undefined"||l.nodeType!=1||l==window){return l}var h=Object.clone(a),j=l.tagName.toUpperCase();if(f[j]){Object.extend(h,f[j])}b(l,h);l._extendedByPrototype=Prototype.emptyFunction;return l},{refresh:function(){if(!Prototype.BrowserFeatures.ElementExtensions){Object.extend(a,Element.Methods);Object.extend(a,Element.Methods.Simulated)}}});g.refresh();return g})();Element.hasAttribute=function(a,b){if(a.hasAttribute){return a.hasAttribute(b)}return Element.Methods.Simulated.hasAttribute(a,b)};Element.addMethods=function(c){var l=Prototype.BrowserFeatures,e=Element.Methods.ByTag;if(!c){Object.extend(Form,Form.Methods);Object.extend(Form.Element,Form.Element.Methods);Object.extend(Element.Methods.ByTag,{FORM:Object.clone(Form.Methods),INPUT:Object.clone(Form.Element.Methods),SELECT:Object.clone(Form.Element.Methods),TEXTAREA:Object.clone(Form.Element.Methods)})}if(arguments.length==2){var b=c;c=arguments[1]}if(!b){Object.extend(Element.Methods,c||{})}else{if(Object.isArray(b)){b.each(h)}else{h(b)}}function h(n){n=n.toUpperCase();if(!Element.Methods.ByTag[n]){Element.Methods.ByTag[n]={}}Object.extend(Element.Methods.ByTag[n],c)}function a(p,o,n){n=n||false;for(var r in p){var q=p[r];if(!Object.isFunction(q)){continue}if(!n||!(r in o)){o[r]=q.methodize()}}}function f(q){var n;var p={OPTGROUP:"OptGroup",TEXTAREA:"TextArea",P:"Paragraph",FIELDSET:"FieldSet",UL:"UList",OL:"OList",DL:"DList",DIR:"Directory",H1:"Heading",H2:"Heading",H3:"Heading",H4:"Heading",H5:"Heading",H6:"Heading",Q:"Quote",INS:"Mod",DEL:"Mod",A:"Anchor",IMG:"Image",CAPTION:"TableCaption",COL:"TableCol",COLGROUP:"TableCol",THEAD:"TableSection",TFOOT:"TableSection",TBODY:"TableSection",TR:"TableRow",TH:"TableCell",TD:"TableCell",FRAMESET:"FrameSet",IFRAME:"IFrame"};if(p[q]){n="HTML"+p[q]+"Element"}if(window[n]){return window[n]}n="HTML"+q+"Element";if(window[n]){return window[n]}n="HTML"+q.capitalize()+"Element";if(window[n]){return window[n]}var o=document.createElement(q);var r=o.__proto__||o.constructor.prototype;o=null;return r}var j=window.HTMLElement?HTMLElement.prototype:Element.prototype;if(l.ElementExtensions){a(Element.Methods,j);a(Element.Methods.Simulated,j,true)}if(l.SpecificElementExtensions){for(var m in Element.Methods.ByTag){var g=f(m);if(Object.isUndefined(g)){continue}a(e[m],g.prototype)}}Object.extend(Element,Element.Methods);delete Element.ByTag;if(Element.extend.refresh){Element.extend.refresh()}Element.cache={}};document.viewport={getDimensions:function(){return{width:this.getWidth(),height:this.getHeight()}},getScrollOffsets:function(){return Element._returnOffset(window.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft,window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop)}};(function(b){var h=Prototype.Browser,f=document,c,e={};function a(){if(h.WebKit&&!f.evaluate){return document}if(h.Opera&&window.parseFloat(window.opera.version())<9.5){return document.body}return document.documentElement}function g(j){if(!c){c=a()}e[j]="client"+j;b["get"+j]=function(){return c[e[j]]};return b["get"+j]()}b.getWidth=g.curry("Width");b.getHeight=g.curry("Height")})(document.viewport);Element.Storage={UID:1};Element.addMethods({getStorage:function(b){if(!(b=$(b))){return}var a;if(b===window){a=0}else{if(typeof b._prototypeUID==="undefined"){b._prototypeUID=[Element.Storage.UID++]}a=b._prototypeUID[0]}if(!Element.Storage[a]){Element.Storage[a]=$H()}return Element.Storage[a]},store:function(b,a,c){if(!(b=$(b))){return}if(arguments.length===2){Element.getStorage(b).update(a)}else{Element.getStorage(b).set(a,c)}return b},retrieve:function(c,b,a){if(!(c=$(c))){return}var f=Element.getStorage(c),e=f.get(b);if(Object.isUndefined(e)){f.set(b,a);e=a}return e},clone:function(c,a){if(!(c=$(c))){return}var f=c.cloneNode(a);f._prototypeUID=void 0;if(a){var e=Element.select(f,"*"),b=e.length;while(b--){e[b]._prototypeUID=void 0}}return Element.extend(f)}});var Selector=Class.create({initialize:function(a){this.expression=a.strip();if(this.shouldUseSelectorsAPI()){this.mode="selectorsAPI"}else{if(this.shouldUseXPath()){this.mode="xpath";this.compileXPathMatcher()}else{this.mode="normal";this.compileMatcher()}}},shouldUseXPath:(function(){var a=(function(){var f=false;if(document.evaluate&&window.XPathResult){var e=document.createElement("div");e.innerHTML="<ul><li></li></ul><div><ul><li></li></ul></div>";var c=".//*[local-name()='ul' or local-name()='UL']//*[local-name()='li' or local-name()='LI']";var b=document.evaluate(c,e,null,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null);f=(b.snapshotLength!==2);e=null}return f})();return function(){if(!Prototype.BrowserFeatures.XPath){return false}var b=this.expression;if(Prototype.Browser.WebKit&&(b.include("-of-type")||b.include(":empty"))){return false}if((/(\[[\w-]*?:|:checked)/).test(b)){return false}if(a){return false}return true}})(),shouldUseSelectorsAPI:function(){if(!Prototype.BrowserFeatures.SelectorsAPI){return false}if(Selector.CASE_INSENSITIVE_CLASS_NAMES){return false}if(!Selector._div){Selector._div=new Element("div")}try{Selector._div.querySelector(this.expression)}catch(a){return false}return true},compileMatcher:function(){var e=this.expression,ps=Selector.patterns,h=Selector.handlers,c=Selector.criteria,le,p,m,len=ps.length,name;if(Selector._cache[e]){this.matcher=Selector._cache[e];return}this.matcher=["this.matcher = function(root) {","var r = root, h = Selector.handlers, c = false, n;"];while(e&&le!=e&&(/\S/).test(e)){le=e;for(var i=0;i<len;i++){p=ps[i].re;name=ps[i].name;if(m=e.match(p)){this.matcher.push(Object.isFunction(c[name])?c[name](m):new Template(c[name]).evaluate(m));e=e.replace(m[0],"");break}}}this.matcher.push("return h.unique(n);\n}");eval(this.matcher.join("\n"));Selector._cache[this.expression]=this.matcher},compileXPathMatcher:function(){var j=this.expression,l=Selector.patterns,c=Selector.xpath,h,b,a=l.length,f;if(Selector._cache[j]){this.xpath=Selector._cache[j];return}this.matcher=[".//*"];while(j&&h!=j&&(/\S/).test(j)){h=j;for(var g=0;g<a;g++){f=l[g].name;if(b=j.match(l[g].re)){this.matcher.push(Object.isFunction(c[f])?c[f](b):new Template(c[f]).evaluate(b));j=j.replace(b[0],"");break}}}this.xpath=this.matcher.join("");Selector._cache[this.expression]=this.xpath},findElements:function(a){a=a||document;var c=this.expression,b;switch(this.mode){case"selectorsAPI":if(a!==document){var f=a.id,g=$(a).identify();g=g.replace(/[\.:]/g,"\\$0");c="#"+g+" "+c}b=$A(a.querySelectorAll(c)).map(Element.extend);a.id=f;return b;case"xpath":return document._getElementsByXPath(this.xpath,a);default:return this.matcher(a)}},match:function(n){this.tokens=[];var s=this.expression,a=Selector.patterns,g=Selector.assertions;var b,f,h,r=a.length,c;while(s&&b!==s&&(/\S/).test(s)){b=s;for(var l=0;l<r;l++){f=a[l].re;c=a[l].name;if(h=s.match(f)){if(g[c]){this.tokens.push([c,Object.clone(h)]);s=s.replace(h[0],"")}else{return this.findElements(document).include(n)}}}}var q=true,c,o;for(var l=0,j;j=this.tokens[l];l++){c=j[0],o=j[1];if(!Selector.assertions[c](n,o)){q=false;break}}return q},toString:function(){return this.expression},inspect:function(){return"#<Selector:"+this.expression.inspect()+">"}});if(Prototype.BrowserFeatures.SelectorsAPI&&document.compatMode==="BackCompat"){Selector.CASE_INSENSITIVE_CLASS_NAMES=(function(){var c=document.createElement("div"),a=document.createElement("span");c.id="prototype_test_id";a.className="Test";c.appendChild(a);var b=(c.querySelector("#prototype_test_id .test")!==null);c=a=null;return b})()}Object.extend(Selector,{_cache:{},xpath:{descendant:"//*",child:"/*",adjacent:"/following-sibling::*[1]",laterSibling:"/following-sibling::*",tagName:function(a){if(a[1]=="*"){return""}return"[local-name()='"+a[1].toLowerCase()+"' or local-name()='"+a[1].toUpperCase()+"']"},className:"[contains(concat(' ', @class, ' '), ' #{1} ')]",id:"[@id='#{1}']",attrPresence:function(a){a[1]=a[1].toLowerCase();return new Template("[@#{1}]").evaluate(a)},attr:function(a){a[1]=a[1].toLowerCase();a[3]=a[5]||a[6];return new Template(Selector.xpath.operators[a[2]]).evaluate(a)},pseudo:function(a){var b=Selector.xpath.pseudos[a[1]];if(!b){return""}if(Object.isFunction(b)){return b(a)}return new Template(Selector.xpath.pseudos[a[1]]).evaluate(a)},operators:{"=":"[@#{1}='#{3}']","!=":"[@#{1}!='#{3}']","^=":"[starts-with(@#{1}, '#{3}')]","$=":"[substring(@#{1}, (string-length(@#{1}) - string-length('#{3}') + 1))='#{3}']","*=":"[contains(@#{1}, '#{3}')]","~=":"[contains(concat(' ', @#{1}, ' '), ' #{3} ')]","|=":"[contains(concat('-', @#{1}, '-'), '-#{3}-')]"},pseudos:{"first-child":"[not(preceding-sibling::*)]","last-child":"[not(following-sibling::*)]","only-child":"[not(preceding-sibling::* or following-sibling::*)]",empty:"[count(*) = 0 and (count(text()) = 0)]",checked:"[@checked]",disabled:"[(@disabled) and (@type!='hidden')]",enabled:"[not(@disabled) and (@type!='hidden')]",not:function(g){var l=g[6],c=Selector.patterns,n=Selector.xpath,a,o,j=c.length,b;var f=[];while(l&&a!=l&&(/\S/).test(l)){a=l;for(var h=0;h<j;h++){b=c[h].name;if(g=l.match(c[h].re)){o=Object.isFunction(n[b])?n[b](g):new Template(n[b]).evaluate(g);f.push("("+o.substring(1,o.length-1)+")");l=l.replace(g[0],"");break}}}return"[not("+f.join(" and ")+")]"},"nth-child":function(a){return Selector.xpath.pseudos.nth("(count(./preceding-sibling::*) + 1) ",a)},"nth-last-child":function(a){return Selector.xpath.pseudos.nth("(count(./following-sibling::*) + 1) ",a)},"nth-of-type":function(a){return Selector.xpath.pseudos.nth("position() ",a)},"nth-last-of-type":function(a){return Selector.xpath.pseudos.nth("(last() + 1 - position()) ",a)},"first-of-type":function(a){a[6]="1";return Selector.xpath.pseudos["nth-of-type"](a)},"last-of-type":function(a){a[6]="1";return Selector.xpath.pseudos["nth-last-of-type"](a)},"only-of-type":function(a){var b=Selector.xpath.pseudos;return b["first-of-type"](a)+b["last-of-type"](a)},nth:function(h,f){var j,l=f[6],e;if(l=="even"){l="2n+0"}if(l=="odd"){l="2n+1"}if(j=l.match(/^(\d+)$/)){return"["+h+"= "+j[1]+"]"}if(j=l.match(/^(-?\d*)?n(([+-])(\d+))?/)){if(j[1]=="-"){j[1]=-1}var g=j[1]?Number(j[1]):1;var c=j[2]?Number(j[2]):0;e="[((#{fragment} - #{b}) mod #{a} = 0) and ((#{fragment} - #{b}) div #{a} >= 0)]";return new Template(e).evaluate({fragment:h,a:g,b:c})}}}},criteria:{tagName:'n = h.tagName(n, r, "#{1}", c);      c = false;',className:'n = h.className(n, r, "#{1}", c);    c = false;',id:'n = h.id(n, r, "#{1}", c);           c = false;',attrPresence:'n = h.attrPresence(n, r, "#{1}", c); c = false;',attr:function(a){a[3]=(a[5]||a[6]);return new Template('n = h.attr(n, r, "#{1}", "#{3}", "#{2}", c); c = false;').evaluate(a)},pseudo:function(a){if(a[6]){a[6]=a[6].replace(/"/g,'\\"')}return new Template('n = h.pseudo(n, "#{1}", "#{6}", r, c); c = false;').evaluate(a)},descendant:'c = "descendant";',child:'c = "child";',adjacent:'c = "adjacent";',laterSibling:'c = "laterSibling";'},patterns:[{name:"laterSibling",re:/^\s*~\s*/},{name:"child",re:/^\s*>\s*/},{name:"adjacent",re:/^\s*\+\s*/},{name:"descendant",re:/^\s/},{name:"tagName",re:/^\s*(\*|[\w\-]+)(\b|$)?/},{name:"id",re:/^#([\w\-\*]+)(\b|$)/},{name:"className",re:/^\.([\w\-\*]+)(\b|$)/},{name:"pseudo",re:/^:((first|last|nth|nth-last|only)(-child|-of-type)|empty|checked|(en|dis)abled|not)(\((.*?)\))?(\b|$|(?=\s|[:+~>]))/},{name:"attrPresence",re:/^\[((?:[\w-]+:)?[\w-]+)\]/},{name:"attr",re:/\[((?:[\w-]*:)?[\w-]+)\s*(?:([!^$*~|]?=)\s*((['"])([^\4]*?)\4|([^'"][^\]]*?)))?\]/}],assertions:{tagName:function(a,b){return b[1].toUpperCase()==a.tagName.toUpperCase()},className:function(a,b){return Element.hasClassName(a,b[1])},id:function(a,b){return a.id===b[1]},attrPresence:function(a,b){return Element.hasAttribute(a,b[1])},attr:function(b,c){var a=Element.readAttribute(b,c[1]);return a&&Selector.operators[c[2]](a,c[5]||c[6])}},handlers:{concat:function(e,c){for(var f=0,g;g=c[f];f++){e.push(g)}return e},mark:function(a){var e=Prototype.emptyFunction;for(var b=0,c;c=a[b];b++){c._countedByPrototype=e}return a},unmark:(function(){var a=(function(){var b=document.createElement("div"),f=false,e="_countedByPrototype",c="x";b[e]=c;f=(b.getAttribute(e)===c);b=null;return f})();return a?function(b){for(var c=0,e;e=b[c];c++){e.removeAttribute("_countedByPrototype")}return b}:function(b){for(var c=0,e;e=b[c];c++){e._countedByPrototype=void 0}return b}})(),index:function(a,e,h){a._countedByPrototype=Prototype.emptyFunction;if(e){for(var b=a.childNodes,f=b.length-1,c=1;f>=0;f--){var g=b[f];if(g.nodeType==1&&(!h||g._countedByPrototype)){g.nodeIndex=c++}}}else{for(var f=0,c=1,b=a.childNodes;g=b[f];f++){if(g.nodeType==1&&(!h||g._countedByPrototype)){g.nodeIndex=c++}}}},unique:function(b){if(b.length==0){return b}var e=[],f;for(var c=0,a=b.length;c<a;c++){if(typeof(f=b[c])._countedByPrototype=="undefined"){f._countedByPrototype=Prototype.emptyFunction;e.push(Element.extend(f))}}return Selector.handlers.unmark(e)},descendant:function(a){var e=Selector.handlers;for(var c=0,b=[],f;f=a[c];c++){e.concat(b,f.getElementsByTagName("*"))}return b},child:function(a){var f=Selector.handlers;for(var e=0,c=[],g;g=a[e];e++){for(var b=0,l;l=g.childNodes[b];b++){if(l.nodeType==1&&l.tagName!="!"){c.push(l)}}}return c},adjacent:function(a){for(var c=0,b=[],f;f=a[c];c++){var e=this.nextElementSibling(f);if(e){b.push(e)}}return b},laterSibling:function(a){var e=Selector.handlers;for(var c=0,b=[],f;f=a[c];c++){e.concat(b,Element.nextSiblings(f))}return b},nextElementSibling:function(a){while(a=a.nextSibling){if(a.nodeType==1){return a}}return null},previousElementSibling:function(a){while(a=a.previousSibling){if(a.nodeType==1){return a}}return null},tagName:function(a,l,c,b){var m=c.toUpperCase();var f=[],j=Selector.handlers;if(a){if(b){if(b=="descendant"){for(var g=0,e;e=a[g];g++){j.concat(f,e.getElementsByTagName(c))}return f}else{a=this[b](a)}if(c=="*"){return a}}for(var g=0,e;e=a[g];g++){if(e.tagName.toUpperCase()===m){f.push(e)}}return f}else{return l.getElementsByTagName(c)}},id:function(a,n,b,c){var m=$(b),l=Selector.handlers;if(n==document){if(!m){return[]}if(!a){return[m]}}else{if(!n.sourceIndex||n.sourceIndex<1){var a=n.getElementsByTagName("*");for(var f=0,e;e=a[f];f++){if(e.id===b){return[e]}}}}if(a){if(c){if(c=="child"){for(var g=0,e;e=a[g];g++){if(m.parentNode==e){return[m]}}}else{if(c=="descendant"){for(var g=0,e;e=a[g];g++){if(Element.descendantOf(m,e)){return[m]}}}else{if(c=="adjacent"){for(var g=0,e;e=a[g];g++){if(Selector.handlers.previousElementSibling(m)==e){return[m]}}}else{a=l[c](a)}}}}for(var g=0,e;e=a[g];g++){if(e==m){return[m]}}return[]}return(m&&Element.descendantOf(m,n))?[m]:[]},className:function(b,a,c,e){if(b&&e){b=this[e](b)}return Selector.handlers.byClassName(b,a,c)},byClassName:function(c,b,g){if(!c){c=Selector.handlers.descendant([b])}var j=" "+g+" ";for(var f=0,e=[],h,a;h=c[f];f++){a=h.className;if(a.length==0){continue}if(a==g||(" "+a+" ").include(j)){e.push(h)}}return e},attrPresence:function(c,b,a,h){if(!c){c=b.getElementsByTagName("*")}if(c&&h){c=this[h](c)}var f=[];for(var e=0,g;g=c[e];e++){if(Element.hasAttribute(g,a)){f.push(g)}}return f},attr:function(a,l,j,m,c,b){if(!a){a=l.getElementsByTagName("*")}if(a&&b){a=this[b](a)}var n=Selector.operators[c],g=[];for(var f=0,e;e=a[f];f++){var h=Element.readAttribute(e,j);if(h===null){continue}if(n(h,m)){g.push(e)}}return g},pseudo:function(b,c,f,a,e){if(b&&e){b=this[e](b)}if(!b){b=a.getElementsByTagName("*")}return Selector.pseudos[c](b,f,a)}},pseudos:{"first-child":function(b,g,a){for(var e=0,c=[],f;f=b[e];e++){if(Selector.handlers.previousElementSibling(f)){continue}c.push(f)}return c},"last-child":function(b,g,a){for(var e=0,c=[],f;f=b[e];e++){if(Selector.handlers.nextElementSibling(f)){continue}c.push(f)}return c},"only-child":function(b,j,a){var f=Selector.handlers;for(var e=0,c=[],g;g=b[e];e++){if(!f.previousElementSibling(g)&&!f.nextElementSibling(g)){c.push(g)}}return c},"nth-child":function(b,c,a){return Selector.pseudos.nth(b,c,a)},"nth-last-child":function(b,c,a){return Selector.pseudos.nth(b,c,a,true)},"nth-of-type":function(b,c,a){return Selector.pseudos.nth(b,c,a,false,true)},"nth-last-of-type":function(b,c,a){return Selector.pseudos.nth(b,c,a,true,true)},"first-of-type":function(b,c,a){return Selector.pseudos.nth(b,"1",a,false,true)},"last-of-type":function(b,c,a){return Selector.pseudos.nth(b,"1",a,true,true)},"only-of-type":function(b,e,a){var c=Selector.pseudos;return c["last-of-type"](c["first-of-type"](b,e,a),e,a)},getIndices:function(e,c,f){if(e==0){return c>0?[c]:[]}return $R(1,f).inject([],function(a,b){if(0==(b-c)%e&&(b-c)/e>=0){a.push(b)}return a})},nth:function(c,u,w,t,f){if(c.length==0){return[]}if(u=="even"){u="2n+0"}if(u=="odd"){u="2n+1"}var s=Selector.handlers,r=[],e=[],n;s.mark(c);for(var q=0,g;g=c[q];q++){if(!g.parentNode._countedByPrototype){s.index(g.parentNode,t,f);e.push(g.parentNode)}}if(u.match(/^\d+$/)){u=Number(u);for(var q=0,g;g=c[q];q++){if(g.nodeIndex==u){r.push(g)}}}else{if(n=u.match(/^(-?\d*)?n(([+-])(\d+))?/)){if(n[1]=="-"){n[1]=-1}var y=n[1]?Number(n[1]):1;var v=n[2]?Number(n[2]):0;var z=Selector.pseudos.getIndices(y,v,c.length);for(var q=0,g,o=z.length;g=c[q];q++){for(var p=0;p<o;p++){if(g.nodeIndex==z[p]){r.push(g)}}}}}s.unmark(c);s.unmark(e);return r},empty:function(b,g,a){for(var e=0,c=[],f;f=b[e];e++){if(f.tagName=="!"||f.firstChild){continue}c.push(f)}return c},not:function(a,e,n){var j=Selector.handlers,o,c;var l=new Selector(e).findElements(n);j.mark(l);for(var g=0,f=[],b;b=a[g];g++){if(!b._countedByPrototype){f.push(b)}}j.unmark(l);return f},enabled:function(b,g,a){for(var e=0,c=[],f;f=b[e];e++){if(!f.disabled&&(!f.type||f.type!=="hidden")){c.push(f)}}return c},disabled:function(b,g,a){for(var e=0,c=[],f;f=b[e];e++){if(f.disabled){c.push(f)}}return c},checked:function(b,g,a){for(var e=0,c=[],f;f=b[e];e++){if(f.checked){c.push(f)}}return c}},operators:{"=":function(b,a){return b==a},"!=":function(b,a){return b!=a},"^=":function(b,a){return b==a||b&&b.startsWith(a)},"$=":function(b,a){return b==a||b&&b.endsWith(a)},"*=":function(b,a){return b==a||b&&b.include(a)},"~=":function(b,a){return(" "+b+" ").include(" "+a+" ")},"|=":function(b,a){return("-"+(b||"").toUpperCase()+"-").include("-"+(a||"").toUpperCase()+"-")}},split:function(b){var a=[];b.scan(/(([\w#:.~>+()\s-]+|\*|\[.*?\])+)\s*(,|$)/,function(c){a.push(c[1].strip())});return a},matchElements:function(g,j){var f=$$(j),e=Selector.handlers;e.mark(f);for(var c=0,b=[],a;a=g[c];c++){if(a._countedByPrototype){b.push(a)}}e.unmark(f);return b},findElement:function(b,c,a){if(Object.isNumber(c)){a=c;c=false}return Selector.matchElements(b,c||"*")[a||0]},findChildElements:function(f,j){j=Selector.split(j.join(","));var e=[],g=Selector.handlers;for(var c=0,b=j.length,a;c<b;c++){a=new Selector(j[c].strip());g.concat(e,a.findElements(f))}return(b>1)?g.unique(e):e}});if(Prototype.Browser.IE){Object.extend(Selector.handlers,{concat:function(e,c){for(var f=0,g;g=c[f];f++){if(g.tagName!=="!"){e.push(g)}}return e}})}function $$(){return Selector.findChildElements(document,$A(arguments))}var Form={reset:function(a){a=$(a);a.reset();return a},serializeElements:function(h,b){if(typeof b!="object"){b={hash:!!b}}else{if(Object.isUndefined(b.hash)){b.hash=true}}var c,g,a=false,f=b.submit;var e=h.inject({},function(j,l){if(!l.disabled&&l.name){c=l.name;g=$(l).getValue();if(g!=null&&l.type!="file"&&(l.type!="submit"||(!a&&f!==false&&(!f||c==f)&&(a=true)))){if(c in j){if(!Object.isArray(j[c])){j[c]=[j[c]]}j[c].push(g)}else{j[c]=g}}}return j});return b.hash?e:Object.toQueryString(e)}};Form.Methods={serialize:function(b,a){return Form.serializeElements(Form.getElements(b),a)},getElements:function(f){var g=$(f).getElementsByTagName("*"),e,a=[],c=Form.Element.Serializers;for(var b=0;e=g[b];b++){a.push(e)}return a.inject([],function(h,j){if(c[j.tagName.toLowerCase()]){h.push(Element.extend(j))}return h})},getInputs:function(h,c,e){h=$(h);var a=h.getElementsByTagName("input");if(!c&&!e){return $A(a).map(Element.extend)}for(var f=0,j=[],g=a.length;f<g;f++){var b=a[f];if((c&&b.type!=c)||(e&&b.name!=e)){continue}j.push(Element.extend(b))}return j},disable:function(a){a=$(a);Form.getElements(a).invoke("disable");return a},enable:function(a){a=$(a);Form.getElements(a).invoke("enable");return a},findFirstElement:function(b){var c=$(b).getElements().findAll(function(e){return"hidden"!=e.type&&!e.disabled});var a=c.findAll(function(e){return e.hasAttribute("tabIndex")&&e.tabIndex>=0}).sortBy(function(e){return e.tabIndex}).first();return a?a:c.find(function(e){return/^(?:input|select|textarea)$/i.test(e.tagName)})},focusFirstElement:function(a){a=$(a);a.findFirstElement().activate();return a},request:function(b,a){b=$(b),a=Object.clone(a||{});var e=a.parameters,c=b.readAttribute("action")||"";if(c.blank()){c=window.location.href}a.parameters=b.serialize(true);if(e){if(Object.isString(e)){e=e.toQueryParams()}Object.extend(a.parameters,e)}if(b.hasAttribute("method")&&!a.method){a.method=b.method}return new Ajax.Request(c,a)}};Form.Element={focus:function(a){$(a).focus();return a},select:function(a){$(a).select();return a}};Form.Element.Methods={serialize:function(a){a=$(a);if(!a.disabled&&a.name){var b=a.getValue();if(b!=undefined){var c={};c[a.name]=b;return Object.toQueryString(c)}}return""},getValue:function(a){a=$(a);var b=a.tagName.toLowerCase();return Form.Element.Serializers[b](a)},setValue:function(a,b){a=$(a);var c=a.tagName.toLowerCase();Form.Element.Serializers[c](a,b);return a},clear:function(a){$(a).value="";return a},present:function(a){return $(a).value!=""},activate:function(a){a=$(a);try{a.focus();if(a.select&&(a.tagName.toLowerCase()!="input"||!(/^(?:button|reset|submit)$/i.test(a.type)))){a.select()}}catch(b){}return a},disable:function(a){a=$(a);a.disabled=true;return a},enable:function(a){a=$(a);a.disabled=false;return a}};var Field=Form.Element;var $F=Form.Element.Methods.getValue;Form.Element.Serializers={input:function(a,b){switch(a.type.toLowerCase()){case"checkbox":case"radio":return Form.Element.Serializers.inputSelector(a,b);default:return Form.Element.Serializers.textarea(a,b)}},inputSelector:function(a,b){if(Object.isUndefined(b)){return a.checked?a.value:null}else{a.checked=!!b}},textarea:function(a,b){if(Object.isUndefined(b)){return a.value}else{a.value=b}},select:function(c,g){if(Object.isUndefined(g)){return this[c.type=="select-one"?"selectOne":"selectMany"](c)}else{var b,e,h=!Object.isArray(g);for(var a=0,f=c.length;a<f;a++){b=c.options[a];e=this.optionValue(b);if(h){if(e==g){b.selected=true;return}}else{b.selected=g.include(e)}}}},selectOne:function(b){var a=b.selectedIndex;return a>=0?this.optionValue(b.options[a]):null},selectMany:function(e){var a,f=e.length;if(!f){return null}for(var c=0,a=[];c<f;c++){var b=e.options[c];if(b.selected){a.push(this.optionValue(b))}}return a},optionValue:function(a){return Element.extend(a).hasAttribute("value")?a.value:a.text}};Abstract.TimedObserver=Class.create(PeriodicalExecuter,{initialize:function($super,a,b,c){$super(c,b);this.element=$(a);this.lastValue=this.getValue()},execute:function(){var a=this.getValue();if(Object.isString(this.lastValue)&&Object.isString(a)?this.lastValue!=a:String(this.lastValue)!=String(a)){this.callback(this.element,a);this.lastValue=a}}});Form.Element.Observer=Class.create(Abstract.TimedObserver,{getValue:function(){return Form.Element.getValue(this.element)}});Form.Observer=Class.create(Abstract.TimedObserver,{getValue:function(){return Form.serialize(this.element)}});Abstract.EventObserver=Class.create({initialize:function(a,b){this.element=$(a);this.callback=b;this.lastValue=this.getValue();if(this.element.tagName.toLowerCase()=="form"){this.registerFormCallbacks()}else{this.registerCallback(this.element)}},onElementEvent:function(){var a=this.getValue();if(this.lastValue!=a){this.callback(this.element,a);this.lastValue=a}},registerFormCallbacks:function(){Form.getElements(this.element).each(this.registerCallback,this)},registerCallback:function(a){if(a.type){switch(a.type.toLowerCase()){case"checkbox":case"radio":Event.observe(a,"click",this.onElementEvent.bind(this));break;default:Event.observe(a,"change",this.onElementEvent.bind(this));break}}}});Form.Element.EventObserver=Class.create(Abstract.EventObserver,{getValue:function(){return Form.Element.getValue(this.element)}});Form.EventObserver=Class.create(Abstract.EventObserver,{getValue:function(){return Form.serialize(this.element)}});(function(){var z={KEY_BACKSPACE:8,KEY_TAB:9,KEY_RETURN:13,KEY_ESC:27,KEY_LEFT:37,KEY_UP:38,KEY_RIGHT:39,KEY_DOWN:40,KEY_DELETE:46,KEY_HOME:36,KEY_END:35,KEY_PAGEUP:33,KEY_PAGEDOWN:34,KEY_INSERT:45,cache:{}};var f=document.documentElement;var A="onmouseenter" in f&&"onmouseleave" in f;var r;if(Prototype.Browser.IE){var j={0:1,1:4,2:2};r=function(C,B){return C.button===j[B]}}else{if(Prototype.Browser.WebKit){r=function(C,B){switch(B){case 0:return C.which==1&&!C.metaKey;case 1:return C.which==1&&C.metaKey;default:return false}}}else{r=function(C,B){return C.which?(C.which===B+1):(C.button===B)}}}function u(B){return r(B,0)}function t(B){return r(B,1)}function n(B){return r(B,2)}function c(D){D=z.extend(D);var C=D.target,B=D.type,E=D.currentTarget;if(E&&E.tagName){if(B==="load"||B==="error"||(B==="click"&&E.tagName.toLowerCase()==="input"&&E.type==="radio")){C=E}}if(C.nodeType==Node.TEXT_NODE){C=C.parentNode}return Element.extend(C)}function p(C,E){var B=z.element(C);if(!E){return B}var D=[B].concat(B.ancestors());return Selector.findElement(D,E,0)}function s(B){return{x:b(B),y:a(B)}}function b(D){var C=document.documentElement,B=document.body||{scrollLeft:0};return D.pageX||(D.clientX+(C.scrollLeft||B.scrollLeft)-(C.clientLeft||0))}function a(D){var C=document.documentElement,B=document.body||{scrollTop:0};return D.pageY||(D.clientY+(C.scrollTop||B.scrollTop)-(C.clientTop||0))}function q(B){z.extend(B);B.preventDefault();B.stopPropagation();B.stopped=true}z.Methods={isLeftClick:u,isMiddleClick:t,isRightClick:n,element:c,findElement:p,pointer:s,pointerX:b,pointerY:a,stop:q};var w=Object.keys(z.Methods).inject({},function(B,C){B[C]=z.Methods[C].methodize();return B});if(Prototype.Browser.IE){function h(C){var B;switch(C.type){case"mouseover":B=C.fromElement;break;case"mouseout":B=C.toElement;break;default:return null}return Element.extend(B)}Object.extend(w,{stopPropagation:function(){this.cancelBubble=true},preventDefault:function(){this.returnValue=false},inspect:function(){return"[object Event]"}});z.extend=function(C,B){if(!C){return false}if(C._extendedByPrototype){return C}C._extendedByPrototype=Prototype.emptyFunction;var D=z.pointer(C);Object.extend(C,{target:C.srcElement||B,relatedTarget:h(C),pageX:D.x,pageY:D.y});return Object.extend(C,w)}}else{z.prototype=window.Event.prototype||document.createEvent("HTMLEvents").__proto__;Object.extend(z.prototype,w);z.extend=Prototype.K}function o(F,E,G){var D=Element.retrieve(F,"prototype_event_registry");if(Object.isUndefined(D)){e.push(F);D=Element.retrieve(F,"prototype_event_registry",$H())}var B=D.get(E);if(Object.isUndefined(B)){B=[];D.set(E,B)}if(B.pluck("handler").include(G)){return false}var C;if(E.include(":")){C=function(H){if(Object.isUndefined(H.eventName)){return false}if(H.eventName!==E){return false}z.extend(H,F);G.call(F,H)}}else{if(!A&&(E==="mouseenter"||E==="mouseleave")){if(E==="mouseenter"||E==="mouseleave"){C=function(I){z.extend(I,F);var H=I.relatedTarget;while(H&&H!==F){try{H=H.parentNode}catch(J){H=F}}if(H===F){return}G.call(F,I)}}}else{C=function(H){z.extend(H,F);G.call(F,H)}}}C.handler=G;B.push(C);return C}function g(){for(var B=0,C=e.length;B<C;B++){z.stopObserving(e[B]);e[B]=null}}var e=[];if(Prototype.Browser.IE){window.attachEvent("onunload",g)}if(Prototype.Browser.WebKit){window.addEventListener("unload",Prototype.emptyFunction,false)}var m=Prototype.K;if(!A){m=function(C){var B={mouseenter:"mouseover",mouseleave:"mouseout"};return C in B?B[C]:C}}function v(E,D,F){E=$(E);var C=o(E,D,F);if(!C){return E}if(D.include(":")){if(E.addEventListener){E.addEventListener("dataavailable",C,false)}else{E.attachEvent("ondataavailable",C);E.attachEvent("onfilterchange",C)}}else{var B=m(D);if(E.addEventListener){E.addEventListener(B,C,false)}else{E.attachEvent("on"+B,C)}}return E}function l(G,E,H){G=$(G);var D=Element.retrieve(G,"prototype_event_registry");if(Object.isUndefined(D)){return G}if(E&&!H){var F=D.get(E);if(Object.isUndefined(F)){return G}F.each(function(I){Element.stopObserving(G,E,I.handler)});return G}else{if(!E){D.each(function(K){var I=K.key,J=K.value;J.each(function(L){Element.stopObserving(G,I,L.handler)})});return G}}var F=D.get(E);if(!F){return}var C=F.find(function(I){return I.handler===H});if(!C){return G}var B=m(E);if(E.include(":")){if(G.removeEventListener){G.removeEventListener("dataavailable",C,false)}else{G.detachEvent("ondataavailable",C);G.detachEvent("onfilterchange",C)}}else{if(G.removeEventListener){G.removeEventListener(B,C,false)}else{G.detachEvent("on"+B,C)}}D.set(E,F.without(C));return G}function y(E,D,C,B){E=$(E);if(Object.isUndefined(B)){B=true}if(E==document&&document.createEvent&&!E.dispatchEvent){E=document.documentElement}var F;if(document.createEvent){F=document.createEvent("HTMLEvents");F.initEvent("dataavailable",true,true)}else{F=document.createEventObject();F.eventType=B?"ondataavailable":"onfilterchange"}F.eventName=D;F.memo=C||{};if(document.createEvent){E.dispatchEvent(F)}else{E.fireEvent(F.eventType,F)}return z.extend(F)}Object.extend(z,z.Methods);Object.extend(z,{fire:y,observe:v,stopObserving:l});Element.addMethods({fire:y,observe:v,stopObserving:l});Object.extend(document,{fire:y.methodize(),observe:v.methodize(),stopObserving:l.methodize(),loaded:false});if(window.Event){Object.extend(window.Event,z)}else{window.Event=z}})();(function(){var e;function a(){if(document.loaded){return}if(e){window.clearTimeout(e)}document.loaded=true;document.fire("dom:loaded")}function c(){if(document.readyState==="complete"){document.stopObserving("readystatechange",c);a()}}function b(){try{document.documentElement.doScroll("left")}catch(f){e=b.defer();return}a()}if(document.addEventListener){document.addEventListener("DOMContentLoaded",a,false)}else{document.observe("readystatechange",c);if(window==top){e=b.defer()}}Event.observe(window,"load",a)})();Element.addMethods();Hash.toQueryString=Object.toQueryString;var Toggle={display:Element.toggle};Element.Methods.childOf=Element.Methods.descendantOf;var Insertion={Before:function(a,b){return Element.insert(a,{before:b})},Top:function(a,b){return Element.insert(a,{top:b})},Bottom:function(a,b){return Element.insert(a,{bottom:b})},After:function(a,b){return Element.insert(a,{after:b})}};var $continue=new Error('"throw $continue" is deprecated, use "return" instead');var Position={includeScrollOffsets:false,prepare:function(){this.deltaX=window.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft||0;this.deltaY=window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0},within:function(b,a,c){if(this.includeScrollOffsets){return this.withinIncludingScrolloffsets(b,a,c)}this.xcomp=a;this.ycomp=c;this.offset=Element.cumulativeOffset(b);return(c>=this.offset[1]&&c<this.offset[1]+b.offsetHeight&&a>=this.offset[0]&&a<this.offset[0]+b.offsetWidth)},withinIncludingScrolloffsets:function(b,a,e){var c=Element.cumulativeScrollOffset(b);this.xcomp=a+c[0]-this.deltaX;this.ycomp=e+c[1]-this.deltaY;this.offset=Element.cumulativeOffset(b);return(this.ycomp>=this.offset[1]&&this.ycomp<this.offset[1]+b.offsetHeight&&this.xcomp>=this.offset[0]&&this.xcomp<this.offset[0]+b.offsetWidth)},overlap:function(b,a){if(!b){return 0}if(b=="vertical"){return((this.offset[1]+a.offsetHeight)-this.ycomp)/a.offsetHeight}if(b=="horizontal"){return((this.offset[0]+a.offsetWidth)-this.xcomp)/a.offsetWidth}},cumulativeOffset:Element.Methods.cumulativeOffset,positionedOffset:Element.Methods.positionedOffset,absolutize:function(a){Position.prepare();return Element.absolutize(a)},relativize:function(a){Position.prepare();return Element.relativize(a)},realOffset:Element.Methods.cumulativeScrollOffset,offsetParent:Element.Methods.getOffsetParent,page:Element.Methods.viewportOffset,clone:function(b,c,a){a=a||{};return Element.clonePosition(c,b,a)}};if(!document.getElementsByClassName){document.getElementsByClassName=function(b){function a(c){return c.blank()?null:"[contains(concat(' ', @class, ' '), ' "+c+" ')]"}b.getElementsByClassName=Prototype.BrowserFeatures.XPath?function(c,f){f=f.toString().strip();var e=/\s/.test(f)?$w(f).map(a).join(""):a(f);return e?document._getElementsByXPath(".//*"+e,c):[]}:function(f,g){g=g.toString().strip();var h=[],j=(/\s/.test(g)?$w(g):null);if(!j&&!g){return h}var c=$(f).getElementsByTagName("*");g=" "+g+" ";for(var e=0,m,l;m=c[e];e++){if(m.className&&(l=" "+m.className+" ")&&(l.include(g)||(j&&j.all(function(n){return !n.toString().blank()&&l.include(" "+n+" ")})))){h.push(Element.extend(m))}}return h};return function(e,c){return $(c||document.body).getElementsByClassName(e)}}(Element.Methods)}Element.ClassNames=Class.create();Element.ClassNames.prototype={initialize:function(a){this.element=$(a)},_each:function(a){this.element.className.split(/\s+/).select(function(b){return b.length>0})._each(a)},set:function(a){this.element.className=a},add:function(a){if(this.include(a)){return}this.set($A(this).concat(a).join(" "))},remove:function(a){if(!this.include(a)){return}this.set($A(this).without(a).join(" "))},toString:function(){return $A(this).join(" ")}};Object.extend(Element.ClassNames.prototype,Enumerable);function ActiveUser(a){this.initialize(a)}ActiveUser.UPDATE_FREQUENCY=20*60;ActiveUser.COOKIE_NAME="kong_user_data";ActiveUser.SILENCED_TEMPLATE=new Template('You have been silenced for #{until}. Click <a href="/pages/silenced">here</a> to read about silences.');ActiveUser.prototype={initialize:function(a){this._holodeck=null;this._attributes=$H();this._game_attributes=$H();this._attribute_observers=[];this._on_authenticated_observers=[];this._captured_inline_selectors=[];this._domain=a.domain;this.getAttributesFromCookie();if(this.isAuthenticated()){this.createUpdater()}},setHolodeck:function(a){this._holodeck=a},createUpdater:function(){var a=this;new PeriodicalExecuter(function(){a.pullUserData()},ActiveUser.UPDATE_FREQUENCY)},pullUserData:function(){var a=this,b="/accounts/"+this.username()+"/info.json";new Ajax.Request(b,{method:"get",onSuccess:function(c){a.updateAttributes(c.responseJSON)}})},addAttributesObserver:function(a){this._attribute_observers.push(a)},addOnAuthenticatedObserver:function(a){this._on_authenticated_observers.push(a)},addRunWhenAuthenticatedObserver:function(a){if(this.isAuthenticated()){a(this)}else{this.addOnAuthenticatedObserver(a)}},updateAttributes:function(b){var c=(b.username&&b.username!=this._attributes.get("username"));var a=this;this._attributes.update(b);this._attribute_observers.each(function(e){e(a)});if(c){this.usernameUpdated()}},updateGameAttributes:function(a){this._game_attributes.update(a)},getAttributesFromCookie:function(){var b=Cookie.get(ActiveUser.COOKIE_NAME);if(b){var a=b.evalJSON();this.updateAttributes(a)}},gameCookieName:function(){if(this._game_id){return"kong_game_"+this._game_id}},getGameAttributesFromCookie:function(){var a=Cookie.get(this.gameCookieName());if(a){this.updateGameAttributes(a.evalJSON())}},updateUserDataCookie:function(){var a=this.getAttributes();Cookie.set(ActiveUser.COOKIE_NAME,Object.toJSON(a),undefined,"/")},updateGameAttributesCookie:function(){var a=this.getGameAttributes();if(a){Cookie.set(this.gameCookieName(),Object.toJSON(a),undefined,this.gameCookiePath())}},getAttributes:function(){return this._attributes.toObject()},getGameAttributes:function(){return this._game_attributes.toObject()},username:function(){return this._attributes.get("username")},avatarPath:function(){var a=this._attributes.get("avatar_url");if(!a){return""}var b=a.match(/http:\/\/[a-z\.:0-9]*(.*)$/);if(b&&b.length==2){return b[1]}},id:function(){return this._attributes.get("id")},solvedCaptcha:function(){return this._attributes.get("solved_captcha")},chatUsername:function(){return this._attributes.get("chat_username")||this._attributes.get("username")},chatPassword:function(){return this._attributes.get("chat_password")},gameAuthToken:function(){return this._game_attributes.get("game_auth_token")},userVars:function(){return this._game_attributes.get("user_vars")},userVarsSig:function(){return this._game_attributes.get("user_vars_sig")},age:function(){return this._attributes.get("age")},senderNameOrEmail:function(){return this._attributes.get("sender_name_or_email")},boshEnabled:function(){return this._game_attributes.get("bosh_enabled")},compressionEnabled:function(){return this._game_attributes.get("compression_enabled")},usernameUpdated:function(){var a=this;if(this.isAuthenticated()){this.populateUserSpecificLinks.bind(this).runWhenDomLoaded();this.createUpdater();this._on_authenticated_observers.each(function(b){b(a)})}},isAuthenticated:function(){var a=this.username();return !!(a&&!(/^Guest/).match(this.username()))},isAdmin:function(){return this.isAuthenticated()&&this._attributes.get("admin")},isModerator:function(){return this.isAuthenticated()&&this._attributes.get("moderator")},isCurator:function(){return this.isAuthenticated()&&this._attributes.get("curator")},isForumModerator:function(){return this.isAuthenticated()&&this._attributes.get("forum_moderator")},getsAdminBar:function(){return this.isModerator()||this.isCurator()||this.isForumModerator()},silencedUntil:function(){var a=this._attributes.get("silenced_until");return a?new Date(a):undefined},isSilenced:function(){var a=this.silencedUntil();return Boolean(a&&a>new Date())},silencedMessage:function(){return ActiveUser.SILENCED_TEMPLATE.evaluate({until:TimeInWordsHelper.distanceInWords(new Date(),this.silencedUntil())})},populateUserSpecificLinks:function(a){if(!a){a=$(document.body)}var c=this.username(),b=(a.select?a.select("a.user_specific").concat($$("#full-nav-wrap a")):[]);b.each(function(e){e.href=e.href.replace("Guest",c).replace("KongregateHolodeckTemplateUsername",c)})},addCapturedSelector:function(a){this._captured_inline_selectors.push(a);var b=this;$$(a).each(function(c){c.getElementsBySelector("a").each(function(e){var f=e.onclick;e.onclick=b.capturedSelectorWrapper.bindAsEventListener(b,f.bind(e))});c.addClassName("lbOn")})},capturedSelectorWrapper:function(c,b){var a=this;if(a.isAuthenticated()){if("function"==typeof b){return b(c)}}else{a.activateInlineLogin();if("function"==typeof b){this.saveCapturedFunction(b.curry(c))}Event.stop(c);return false}},activateInlineLogin:function(a){if(!a){a={}}var c=$H(a),b="/accounts/new/behind_login";if(this._holodeck){this._holodeck.recordAnalyticsEvent("Lightbox","Signin");c.set("game_id",this._game_id)}if(c.size()>0){b=b+"?"+c.toQueryString()}lightbox.prototype.initializeKongregateLightboxFromAjax(b,{done_class_name:"lightbox_login"})},activatePasswordRecovery:function(){if(this.isGamePage()){this.activateInlineLogin({recover:true})}else{document.location="/sessions/new?recover=true"}},debugLevel:function(){if(!this._debug_level){this._debug_level=this.documentLocationSearchQuery().debug_level}return this._debug_level},documentLocationSearchQuery:function(){if(!this._document_location_search_query){this._document_location_search_query=document.location.search.parseQuery()}return this._document_location_search_query},seenSharedContentWelcome:function(){return !!this._game_attributes.get("seen_shared_content_welcome")},setSeenSharedContentWelcome:function(a){this._game_attributes.set("seen_shared_content_welcome",a);this.updateGameAttributesCookie()},saveCapturedFunction:function(a){this._capturedFunction=a},runCapturedFunction:function(){if("function"==typeof this._capturedFunction){this._capturedFunction.defer()}this._capturedFunction=null},gameId:function(){return this._game_id},setGame:function(a,b){this._game_id=a;this._game_resource_path=b;this.getGameAttributesFromCookie()},gamePath:function(){if(!this._game_path){var a=document.location.pathname.match(/(.*)\/$/);this._game_path=a?a[1]:document.location.pathname}return this._game_path},gameResourcePath:function(){return this._game_resource_path},gameCookiePath:function(){if(!this._game_cookie_path){this._game_cookie_path=this.gamePath().match(/(.*)\/.*/)[1]}return this._game_cookie_path},referrerUrl:function(a){if(!this.isAuthenticated()){return a}var b=(a.match(/\?/)?"&":"?");return a+b+"referrer="+encodeURIComponent(this.username())},formAuthenticityToken:function(){return this._attributes.get("form_authenticity_token")},accountUrl:function(){return"/accounts/"+this.username()},isGamePage:function(){return !!this._holodeck},domain:function(){return this._domain}};String.prototype.parseColor=function(){var a="#";if(this.slice(0,4)=="rgb("){var c=this.slice(4,this.length-1).split(",");var b=0;do{a+=parseInt(c[b]).toColorPart()}while(++b<3)}else{if(this.slice(0,1)=="#"){if(this.length==4){for(var b=1;b<4;b++){a+=(this.charAt(b)+this.charAt(b)).toLowerCase()}}if(this.length==7){a=this.toLowerCase()}}}return(a.length==7?a:(arguments[0]||this))};Element.collectTextNodes=function(a){return $A($(a).childNodes).collect(function(b){return(b.nodeType==3?b.nodeValue:(b.hasChildNodes()?Element.collectTextNodes(b):""))}).flatten().join("")};Element.collectTextNodesIgnoreClass=function(a,b){return $A($(a).childNodes).collect(function(c){return(c.nodeType==3?c.nodeValue:((c.hasChildNodes()&&!Element.hasClassName(c,b))?Element.collectTextNodesIgnoreClass(c,b):""))}).flatten().join("")};Element.setContentZoom=function(a,b){a=$(a);a.setStyle({fontSize:(b/100)+"em"});if(Prototype.Browser.WebKit){window.scrollBy(0,0)}return a};Element.getInlineOpacity=function(a){return $(a).style.opacity||""};Element.forceRerendering=function(a){try{a=$(a);var c=document.createTextNode(" ");a.appendChild(c);a.removeChild(c)}catch(b){}};var Effect={_elementDoesNotExistError:{name:"ElementDoesNotExistError",message:"The specified DOM element does not exist, but is required for this effect to operate"},Transitions:{linear:Prototype.K,sinoidal:function(a){return(-Math.cos(a*Math.PI)/2)+0.5},reverse:function(a){return 1-a},flicker:function(a){var a=((-Math.cos(a*Math.PI)/4)+0.75)+Math.random()/4;return a>1?1:a},wobble:function(a){return(-Math.cos(a*Math.PI*(9*a))/2)+0.5},pulse:function(b,a){return(-Math.cos((b*((a||5)-0.5)*2)*Math.PI)/2)+0.5},spring:function(a){return 1-(Math.cos(a*4.5*Math.PI)*Math.exp(-a*6))},none:function(a){return 0},full:function(a){return 1}},DefaultOptions:{duration:1,fps:100,sync:false,from:0,to:1,delay:0,queue:"parallel"},tagifyText:function(a){var b="position:relative";if(Prototype.Browser.IE){b+=";zoom:1"}a=$(a);$A(a.childNodes).each(function(c){if(c.nodeType==3){c.nodeValue.toArray().each(function(e){a.insertBefore(new Element("span",{style:b}).update(e==" "?String.fromCharCode(160):e),c)});Element.remove(c)}})},multiple:function(b,c){var f;if(((typeof b=="object")||Object.isFunction(b))&&(b.length)){f=b}else{f=$(b).childNodes}var a=Object.extend({speed:0.1,delay:0},arguments[2]||{});var e=a.delay;$A(f).each(function(h,g){new c(h,Object.extend(a,{delay:g*a.speed+e}))})},PAIRS:{slide:["SlideDown","SlideUp"],blind:["BlindDown","BlindUp"],appear:["Appear","Fade"]},toggle:function(b,c){b=$(b);c=(c||"appear").toLowerCase();var a=Object.extend({queue:{position:"end",scope:(b.id||"global"),limit:1}},arguments[2]||{});Effect[b.visible()?Effect.PAIRS[c][1]:Effect.PAIRS[c][0]](b,a)}};Effect.DefaultOptions.transition=Effect.Transitions.sinoidal;Effect.ScopedQueue=Class.create(Enumerable,{initialize:function(){this.effects=[];this.interval=null},_each:function(a){this.effects._each(a)},add:function(b){var c=new Date().getTime();var a=Object.isString(b.options.queue)?b.options.queue:b.options.queue.position;switch(a){case"front":this.effects.findAll(function(f){return f.state=="idle"}).each(function(f){f.startOn+=b.finishOn;f.finishOn+=b.finishOn});break;case"with-last":c=this.effects.pluck("startOn").max()||c;break;case"end":c=this.effects.pluck("finishOn").max()||c;break}b.startOn+=c;b.finishOn+=c;if(!b.options.queue.limit||(this.effects.length<b.options.queue.limit)){this.effects.push(b)}if(!this.interval){this.interval=setInterval(this.loop.bind(this),15)}},remove:function(a){this.effects=this.effects.reject(function(b){return b==a});if(this.effects.length==0){clearInterval(this.interval);this.interval=null}},loop:function(){var c=new Date().getTime();for(var b=0,a=this.effects.length;b<a;b++){this.effects[b]&&this.effects[b].loop(c)}}});Effect.Queues={instances:$H(),get:function(a){if(!Object.isString(a)){return a}return this.instances.get(a)||this.instances.set(a,new Effect.ScopedQueue())}};Effect.Queue=Effect.Queues.get("global");Effect.Base=Class.create({position:null,start:function(a){function b(e,c){return((e[c+"Internal"]?"this.options."+c+"Internal(this);":"")+(e[c]?"this.options."+c+"(this);":""))}if(a&&a.transition===false){a.transition=Effect.Transitions.linear}this.options=Object.extend(Object.extend({},Effect.DefaultOptions),a||{});this.currentFrame=0;this.state="idle";this.startOn=this.options.delay*1000;this.finishOn=this.startOn+(this.options.duration*1000);this.fromToDelta=this.options.to-this.options.from;this.totalTime=this.finishOn-this.startOn;this.totalFrames=this.options.fps*this.options.duration;this.render=(function(){function c(f,e){if(f.options[e+"Internal"]){f.options[e+"Internal"](f)}if(f.options[e]){f.options[e](f)}}return function(e){if(this.state==="idle"){this.state="running";c(this,"beforeSetup");if(this.setup){this.setup()}c(this,"afterSetup")}if(this.state==="running"){e=(this.options.transition(e)*this.fromToDelta)+this.options.from;this.position=e;c(this,"beforeUpdate");if(this.update){this.update(e)}c(this,"afterUpdate")}}})();this.event("beforeStart");if(!this.options.sync){Effect.Queues.get(Object.isString(this.options.queue)?"global":this.options.queue.scope).add(this)}},loop:function(c){if(c>=this.startOn){if(c>=this.finishOn){this.render(1);this.cancel();this.event("beforeFinish");if(this.finish){this.finish()}this.event("afterFinish");return}var b=(c-this.startOn)/this.totalTime,a=(b*this.totalFrames).round();if(a>this.currentFrame){this.render(b);this.currentFrame=a}}},cancel:function(){if(!this.options.sync){Effect.Queues.get(Object.isString(this.options.queue)?"global":this.options.queue.scope).remove(this)}this.state="finished"},event:function(a){if(this.options[a+"Internal"]){this.options[a+"Internal"](this)}if(this.options[a]){this.options[a](this)}},inspect:function(){var a=$H();for(property in this){if(!Object.isFunction(this[property])){a.set(property,this[property])}}return"#<Effect:"+a.inspect()+",options:"+$H(this.options).inspect()+">"}});Effect.Parallel=Class.create(Effect.Base,{initialize:function(a){this.effects=a||[];this.start(arguments[1])},update:function(a){this.effects.invoke("render",a)},finish:function(a){this.effects.each(function(b){b.render(1);b.cancel();b.event("beforeFinish");if(b.finish){b.finish(a)}b.event("afterFinish")})}});Effect.Tween=Class.create(Effect.Base,{initialize:function(c,g,f){c=Object.isString(c)?$(c):c;var b=$A(arguments),e=b.last(),a=b.length==5?b[3]:null;this.method=Object.isFunction(e)?e.bind(c):Object.isFunction(c[e])?c[e].bind(c):function(h){c[e]=h};this.start(Object.extend({from:g,to:f},a||{}))},update:function(a){this.method(a)}});Effect.Event=Class.create(Effect.Base,{initialize:function(){this.start(Object.extend({duration:0},arguments[0]||{}))},update:Prototype.emptyFunction});Effect.Opacity=Class.create(Effect.Base,{initialize:function(b){this.element=$(b);if(!this.element){throw (Effect._elementDoesNotExistError)}if(Prototype.Browser.IE&&(!this.element.currentStyle.hasLayout)){this.element.setStyle({zoom:1})}var a=Object.extend({from:this.element.getOpacity()||0,to:1},arguments[1]||{});this.start(a)},update:function(a){this.element.setOpacity(a)}});Effect.Move=Class.create(Effect.Base,{initialize:function(b){this.element=$(b);if(!this.element){throw (Effect._elementDoesNotExistError)}var a=Object.extend({x:0,y:0,mode:"relative"},arguments[1]||{});this.start(a)},setup:function(){this.element.makePositioned();this.originalLeft=parseFloat(this.element.getStyle("left")||"0");this.originalTop=parseFloat(this.element.getStyle("top")||"0");if(this.options.mode=="absolute"){this.options.x=this.options.x-this.originalLeft;this.options.y=this.options.y-this.originalTop}},update:function(a){this.element.setStyle({left:(this.options.x*a+this.originalLeft).round()+"px",top:(this.options.y*a+this.originalTop).round()+"px"})}});Effect.MoveBy=function(b,a,c){return new Effect.Move(b,Object.extend({x:c,y:a},arguments[3]||{}))};Effect.Scale=Class.create(Effect.Base,{initialize:function(b,c){this.element=$(b);if(!this.element){throw (Effect._elementDoesNotExistError)}var a=Object.extend({scaleX:true,scaleY:true,scaleContent:true,scaleFromCenter:false,scaleMode:"box",scaleFrom:100,scaleTo:c},arguments[2]||{});this.start(a)},setup:function(){this.restoreAfterFinish=this.options.restoreAfterFinish||false;this.elementPositioning=this.element.getStyle("position");this.originalStyle={};["top","left","width","height","fontSize"].each(function(b){this.originalStyle[b]=this.element.style[b]}.bind(this));this.originalTop=this.element.offsetTop;this.originalLeft=this.element.offsetLeft;var a=this.element.getStyle("font-size")||"100%";["em","px","%","pt"].each(function(b){if(a.indexOf(b)>0){this.fontSize=parseFloat(a);this.fontSizeType=b}}.bind(this));this.factor=(this.options.scaleTo-this.options.scaleFrom)/100;this.dims=null;if(this.options.scaleMode=="box"){this.dims=[this.element.offsetHeight,this.element.offsetWidth]}if(/^content/.test(this.options.scaleMode)){this.dims=[this.element.scrollHeight,this.element.scrollWidth]}if(!this.dims){this.dims=[this.options.scaleMode.originalHeight,this.options.scaleMode.originalWidth]}},update:function(a){var b=(this.options.scaleFrom/100)+(this.factor*a);if(this.options.scaleContent&&this.fontSize){this.element.setStyle({fontSize:this.fontSize*b+this.fontSizeType})}this.setDimensions(this.dims[0]*b,this.dims[1]*b)},finish:function(a){if(this.restoreAfterFinish){this.element.setStyle(this.originalStyle)}},setDimensions:function(a,e){var f={};if(this.options.scaleX){f.width=e.round()+"px"}if(this.options.scaleY){f.height=a.round()+"px"}if(this.options.scaleFromCenter){var c=(a-this.dims[0])/2;var b=(e-this.dims[1])/2;if(this.elementPositioning=="absolute"){if(this.options.scaleY){f.top=this.originalTop-c+"px"}if(this.options.scaleX){f.left=this.originalLeft-b+"px"}}else{if(this.options.scaleY){f.top=-c+"px"}if(this.options.scaleX){f.left=-b+"px"}}}this.element.setStyle(f)}});Effect.Highlight=Class.create(Effect.Base,{initialize:function(b){this.element=$(b);if(!this.element){throw (Effect._elementDoesNotExistError)}var a=Object.extend({startcolor:"#ffff99"},arguments[1]||{});this.start(a)},setup:function(){if(this.element.getStyle("display")=="none"){this.cancel();return}this.oldStyle={};if(!this.options.keepBackgroundImage){this.oldStyle.backgroundImage=this.element.getStyle("background-image");this.element.setStyle({backgroundImage:"none"})}if(!this.options.endcolor){this.options.endcolor=this.element.getStyle("background-color").parseColor("#ffffff")}if(!this.options.restorecolor){this.options.restorecolor=this.element.getStyle("background-color")}this._base=$R(0,2).map(function(a){return parseInt(this.options.startcolor.slice(a*2+1,a*2+3),16)}.bind(this));this._delta=$R(0,2).map(function(a){return parseInt(this.options.endcolor.slice(a*2+1,a*2+3),16)-this._base[a]}.bind(this))},update:function(a){this.element.setStyle({backgroundColor:$R(0,2).inject("#",function(b,c,e){return b+((this._base[e]+(this._delta[e]*a)).round().toColorPart())}.bind(this))})},finish:function(){this.element.setStyle(Object.extend(this.oldStyle,{backgroundColor:this.options.restorecolor}))}});Effect.ScrollTo=function(c){var b=arguments[1]||{},a=document.viewport.getScrollOffsets(),e=$(c).cumulativeOffset();if(b.offset){e[1]+=b.offset}return new Effect.Tween(null,a.top,e[1],b,function(f){scrollTo(a.left,f.round())})};Effect.Fade=function(c){c=$(c);var a=c.getInlineOpacity();var b=Object.extend({from:c.getOpacity()||1,to:0,afterFinishInternal:function(e){if(e.options.to!=0){return}e.element.hide().setStyle({opacity:a})}},arguments[1]||{});return new Effect.Opacity(c,b)};Effect.Appear=function(b){b=$(b);var a=Object.extend({from:(b.getStyle("display")=="none"?0:b.getOpacity()||0),to:1,afterFinishInternal:function(c){c.element.forceRerendering()},beforeSetup:function(c){c.element.setOpacity(c.options.from).show()}},arguments[1]||{});return new Effect.Opacity(b,a)};Effect.Puff=function(b){b=$(b);var a={opacity:b.getInlineOpacity(),position:b.getStyle("position"),top:b.style.top,left:b.style.left,width:b.style.width,height:b.style.height};return new Effect.Parallel([new Effect.Scale(b,200,{sync:true,scaleFromCenter:true,scaleContent:true,restoreAfterFinish:true}),new Effect.Opacity(b,{sync:true,to:0})],Object.extend({duration:1,beforeSetupInternal:function(c){Position.absolutize(c.effects[0].element)},afterFinishInternal:function(c){c.effects[0].element.hide().setStyle(a)}},arguments[1]||{}))};Effect.BlindUp=function(a){a=$(a);a.makeClipping();return new Effect.Scale(a,0,Object.extend({scaleContent:false,scaleX:false,restoreAfterFinish:true,afterFinishInternal:function(b){b.element.hide().undoClipping()}},arguments[1]||{}))};Effect.BlindDown=function(b){b=$(b);var a=b.getDimensions();return new Effect.Scale(b,100,Object.extend({scaleContent:false,scaleX:false,scaleFrom:0,scaleMode:{originalHeight:a.height,originalWidth:a.width},restoreAfterFinish:true,afterSetup:function(c){c.element.makeClipping().setStyle({height:"0px"}).show()},afterFinishInternal:function(c){c.element.undoClipping()}},arguments[1]||{}))};Effect.SwitchOff=function(b){b=$(b);var a=b.getInlineOpacity();return new Effect.Appear(b,Object.extend({duration:0.4,from:0,transition:Effect.Transitions.flicker,afterFinishInternal:function(c){new Effect.Scale(c.element,1,{duration:0.3,scaleFromCenter:true,scaleX:false,scaleContent:false,restoreAfterFinish:true,beforeSetup:function(e){e.element.makePositioned().makeClipping()},afterFinishInternal:function(e){e.element.hide().undoClipping().undoPositioned().setStyle({opacity:a})}})}},arguments[1]||{}))};Effect.DropOut=function(b){b=$(b);var a={top:b.getStyle("top"),left:b.getStyle("left"),opacity:b.getInlineOpacity()};return new Effect.Parallel([new Effect.Move(b,{x:0,y:100,sync:true}),new Effect.Opacity(b,{sync:true,to:0})],Object.extend({duration:0.5,beforeSetup:function(c){c.effects[0].element.makePositioned()},afterFinishInternal:function(c){c.effects[0].element.hide().undoPositioned().setStyle(a)}},arguments[1]||{}))};Effect.Shake=function(e){e=$(e);var b=Object.extend({distance:20,duration:0.5},arguments[1]||{});var f=parseFloat(b.distance);var c=parseFloat(b.duration)/10;var a={top:e.getStyle("top"),left:e.getStyle("left")};return new Effect.Move(e,{x:f,y:0,duration:c,afterFinishInternal:function(g){new Effect.Move(g.element,{x:-f*2,y:0,duration:c*2,afterFinishInternal:function(h){new Effect.Move(h.element,{x:f*2,y:0,duration:c*2,afterFinishInternal:function(j){new Effect.Move(j.element,{x:-f*2,y:0,duration:c*2,afterFinishInternal:function(l){new Effect.Move(l.element,{x:f*2,y:0,duration:c*2,afterFinishInternal:function(m){new Effect.Move(m.element,{x:-f,y:0,duration:c,afterFinishInternal:function(n){n.element.undoPositioned().setStyle(a)}})}})}})}})}})}})};Effect.SlideDown=function(c){c=$(c).cleanWhitespace();var a=c.down().getStyle("bottom");var b=c.getDimensions();return new Effect.Scale(c,100,Object.extend({scaleContent:false,scaleX:false,scaleFrom:window.opera?0:1,scaleMode:{originalHeight:b.height,originalWidth:b.width},restoreAfterFinish:true,afterSetup:function(e){e.element.makePositioned();e.element.down().makePositioned();if(window.opera){e.element.setStyle({top:""})}e.element.makeClipping().setStyle({height:"0px"}).show()},afterUpdateInternal:function(e){e.element.down().setStyle({bottom:(e.dims[0]-e.element.clientHeight)+"px"})},afterFinishInternal:function(e){e.element.undoClipping().undoPositioned();e.element.down().undoPositioned().setStyle({bottom:a})}},arguments[1]||{}))};Effect.SlideUp=function(c){c=$(c).cleanWhitespace();var a=c.down().getStyle("bottom");var b=c.getDimensions();return new Effect.Scale(c,window.opera?0:1,Object.extend({scaleContent:false,scaleX:false,scaleMode:"box",scaleFrom:100,scaleMode:{originalHeight:b.height,originalWidth:b.width},restoreAfterFinish:true,afterSetup:function(e){e.element.makePositioned();e.element.down().makePositioned();if(window.opera){e.element.setStyle({top:""})}e.element.makeClipping().show()},afterUpdateInternal:function(e){e.element.down().setStyle({bottom:(e.dims[0]-e.element.clientHeight)+"px"})},afterFinishInternal:function(e){e.element.hide().undoClipping().undoPositioned();e.element.down().undoPositioned().setStyle({bottom:a})}},arguments[1]||{}))};Effect.Squish=function(a){return new Effect.Scale(a,window.opera?1:0,{restoreAfterFinish:true,beforeSetup:function(b){b.element.makeClipping()},afterFinishInternal:function(b){b.element.hide().undoClipping()}})};Effect.Grow=function(c){c=$(c);var b=Object.extend({direction:"center",moveTransition:Effect.Transitions.sinoidal,scaleTransition:Effect.Transitions.sinoidal,opacityTransition:Effect.Transitions.full},arguments[1]||{});var a={top:c.style.top,left:c.style.left,height:c.style.height,width:c.style.width,opacity:c.getInlineOpacity()};var h=c.getDimensions();var j,g;var f,e;switch(b.direction){case"top-left":j=g=f=e=0;break;case"top-right":j=h.width;g=e=0;f=-h.width;break;case"bottom-left":j=f=0;g=h.height;e=-h.height;break;case"bottom-right":j=h.width;g=h.height;f=-h.width;e=-h.height;break;case"center":j=h.width/2;g=h.height/2;f=-h.width/2;e=-h.height/2;break}return new Effect.Move(c,{x:j,y:g,duration:0.01,beforeSetup:function(l){l.element.hide().makeClipping().makePositioned()},afterFinishInternal:function(l){new Effect.Parallel([new Effect.Opacity(l.element,{sync:true,to:1,from:0,transition:b.opacityTransition}),new Effect.Move(l.element,{x:f,y:e,sync:true,transition:b.moveTransition}),new Effect.Scale(l.element,100,{scaleMode:{originalHeight:h.height,originalWidth:h.width},sync:true,scaleFrom:window.opera?1:0,transition:b.scaleTransition,restoreAfterFinish:true})],Object.extend({beforeSetup:function(m){m.effects[0].element.setStyle({height:"0px"}).show()},afterFinishInternal:function(m){m.effects[0].element.undoClipping().undoPositioned().setStyle(a)}},b))}})};Effect.Shrink=function(c){c=$(c);var b=Object.extend({direction:"center",moveTransition:Effect.Transitions.sinoidal,scaleTransition:Effect.Transitions.sinoidal,opacityTransition:Effect.Transitions.none},arguments[1]||{});var a={top:c.style.top,left:c.style.left,height:c.style.height,width:c.style.width,opacity:c.getInlineOpacity()};var g=c.getDimensions();var f,e;switch(b.direction){case"top-left":f=e=0;break;case"top-right":f=g.width;e=0;break;case"bottom-left":f=0;e=g.height;break;case"bottom-right":f=g.width;e=g.height;break;case"center":f=g.width/2;e=g.height/2;break}return new Effect.Parallel([new Effect.Opacity(c,{sync:true,to:0,from:1,transition:b.opacityTransition}),new Effect.Scale(c,window.opera?1:0,{sync:true,transition:b.scaleTransition,restoreAfterFinish:true}),new Effect.Move(c,{x:f,y:e,sync:true,transition:b.moveTransition})],Object.extend({beforeStartInternal:function(h){h.effects[0].element.makePositioned().makeClipping()},afterFinishInternal:function(h){h.effects[0].element.hide().undoClipping().undoPositioned().setStyle(a)}},b))};Effect.Pulsate=function(c){c=$(c);var b=arguments[1]||{},a=c.getInlineOpacity(),f=b.transition||Effect.Transitions.linear,e=function(g){return 1-f((-Math.cos((g*(b.pulses||5)*2)*Math.PI)/2)+0.5)};return new Effect.Opacity(c,Object.extend(Object.extend({duration:2,from:0,afterFinishInternal:function(g){g.element.setStyle({opacity:a})}},b),{transition:e}))};Effect.Fold=function(b){b=$(b);var a={top:b.style.top,left:b.style.left,width:b.style.width,height:b.style.height};b.makeClipping();return new Effect.Scale(b,5,Object.extend({scaleContent:false,scaleX:false,afterFinishInternal:function(c){new Effect.Scale(b,1,{scaleContent:false,scaleY:false,afterFinishInternal:function(e){e.element.hide().undoClipping().setStyle(a)}})}},arguments[1]||{}))};Effect.Morph=Class.create(Effect.Base,{initialize:function(c){this.element=$(c);if(!this.element){throw (Effect._elementDoesNotExistError)}var a=Object.extend({style:{}},arguments[1]||{});if(!Object.isString(a.style)){this.style=$H(a.style)}else{if(a.style.include(":")){this.style=a.style.parseStyle()}else{this.element.addClassName(a.style);this.style=$H(this.element.getStyles());this.element.removeClassName(a.style);var b=this.element.getStyles();this.style=this.style.reject(function(e){return e.value==b[e.key]});a.afterFinishInternal=function(e){e.element.addClassName(e.options.style);e.transforms.each(function(f){e.element.style[f.style]=""})}}}this.start(a)},setup:function(){function a(b){if(!b||["rgba(0, 0, 0, 0)","transparent"].include(b)){b="#ffffff"}b=b.parseColor();return $R(0,2).map(function(c){return parseInt(b.slice(c*2+1,c*2+3),16)})}this.transforms=this.style.map(function(h){var g=h[0],f=h[1],e=null;if(f.parseColor("#zzzzzz")!="#zzzzzz"){f=f.parseColor();e="color"}else{if(g=="opacity"){f=parseFloat(f);if(Prototype.Browser.IE&&(!this.element.currentStyle.hasLayout)){this.element.setStyle({zoom:1})}}else{if(Element.CSS_LENGTH.test(f)){var c=f.match(/^([\+\-]?[0-9\.]+)(.*)$/);f=parseFloat(c[1]);e=(c.length==3)?c[2]:null}}}var b=this.element.getStyle(g);return{style:g.camelize(),originalValue:e=="color"?a(b):parseFloat(b||0),targetValue:e=="color"?a(f):f,unit:e}}.bind(this)).reject(function(b){return((b.originalValue==b.targetValue)||(b.unit!="color"&&(isNaN(b.originalValue)||isNaN(b.targetValue))))})},update:function(a){var e={},b,c=this.transforms.length;while(c--){e[(b=this.transforms[c]).style]=b.unit=="color"?"#"+(Math.round(b.originalValue[0]+(b.targetValue[0]-b.originalValue[0])*a)).toColorPart()+(Math.round(b.originalValue[1]+(b.targetValue[1]-b.originalValue[1])*a)).toColorPart()+(Math.round(b.originalValue[2]+(b.targetValue[2]-b.originalValue[2])*a)).toColorPart():(b.originalValue+(b.targetValue-b.originalValue)*a).toFixed(3)+(b.unit===null?"":b.unit)}this.element.setStyle(e,true)}});Effect.Transform=Class.create({initialize:function(a){this.tracks=[];this.options=arguments[1]||{};this.addTracks(a)},addTracks:function(a){a.each(function(b){b=$H(b);var c=b.values().first();this.tracks.push($H({ids:b.keys().first(),effect:Effect.Morph,options:{style:c}}))}.bind(this));return this},play:function(){return new Effect.Parallel(this.tracks.map(function(a){var e=a.get("ids"),c=a.get("effect"),b=a.get("options");var f=[$(e)||$$(e)].flatten();return f.map(function(g){return new c(g,Object.extend({sync:true},b))})}).flatten(),this.options)}});Element.CSS_PROPERTIES=$w("backgroundColor backgroundPosition borderBottomColor borderBottomStyle borderBottomWidth borderLeftColor borderLeftStyle borderLeftWidth borderRightColor borderRightStyle borderRightWidth borderSpacing borderTopColor borderTopStyle borderTopWidth bottom clip color fontSize fontWeight height left letterSpacing lineHeight marginBottom marginLeft marginRight marginTop markerOffset maxHeight maxWidth minHeight minWidth opacity outlineColor outlineOffset outlineWidth paddingBottom paddingLeft paddingRight paddingTop right textIndent top width wordSpacing zIndex");Element.CSS_LENGTH=/^(([\+\-]?[0-9\.]+)(em|ex|px|in|cm|mm|pt|pc|\%))|0$/;String.__parseStyleElement=document.createElement("div");String.prototype.parseStyle=function(){var b,a=$H();if(Prototype.Browser.WebKit){b=new Element("div",{style:this}).style}else{String.__parseStyleElement.innerHTML='<div style="'+this+'"></div>';b=String.__parseStyleElement.childNodes[0].style}Element.CSS_PROPERTIES.each(function(c){if(b[c]){a.set(c,b[c])}});if(Prototype.Browser.IE&&this.include("opacity")){a.set("opacity",this.match(/opacity:\s*((?:0|1)?(?:\.\d*)?)/)[1])}return a};if(document.defaultView&&document.defaultView.getComputedStyle){Element.getStyles=function(b){var a=document.defaultView.getComputedStyle($(b),null);return Element.CSS_PROPERTIES.inject({},function(c,e){c[e]=a[e];return c})}}else{Element.getStyles=function(b){b=$(b);var a=b.currentStyle,c;c=Element.CSS_PROPERTIES.inject({},function(e,f){e[f]=a[f];return e});if(!c.opacity){c.opacity=b.getOpacity()}return c}}Effect.Methods={morph:function(a,b){a=$(a);new Effect.Morph(a,Object.extend({style:b},arguments[2]||{}));return a},visualEffect:function(c,f,b){c=$(c);var e=f.dasherize().camelize(),a=e.charAt(0).toUpperCase()+e.substring(1);new Effect[a](c,b);return c},highlight:function(b,a){b=$(b);new Effect.Highlight(b,a);return b}};$w("fade appear grow shrink fold blindUp blindDown slideUp slideDown pulsate shake puff squish switchOff dropOut").each(function(a){Effect.Methods[a]=function(c,b){c=$(c);Effect[a.charAt(0).toUpperCase()+a.substring(1)](c,b);return c}});$w("getInlineOpacity forceRerendering setContentZoom collectTextNodes collectTextNodesIgnoreClass getStyles").each(function(a){Effect.Methods[a]=Element[a]});Element.addMethods(Effect.Methods);if(typeof Effect=="undefined"){throw ("controls.js requires including script.aculo.us' effects.js library")}var Autocompleter={};Autocompleter.Base=Class.create({baseInitialize:function(b,c,a){b=$(b);this.element=b;this.update=$(c);this.hasFocus=false;this.changed=false;this.active=false;this.index=0;this.entryCount=0;this.oldElementValue=this.element.value;if(this.setOptions){this.setOptions(a)}else{this.options=a||{}}this.options.paramName=this.options.paramName||this.element.name;this.options.tokens=this.options.tokens||[];this.options.frequency=this.options.frequency||0.4;this.options.minChars=this.options.minChars||1;this.options.onShow=this.options.onShow||function(e,f){if(!f.style.position||f.style.position=="absolute"){f.style.position="absolute";Position.clone(e,f,{setHeight:false,offsetTop:e.offsetHeight})}Effect.Appear(f,{duration:0.15})};this.options.onHide=this.options.onHide||function(e,f){new Effect.Fade(f,{duration:0.15})};if(typeof(this.options.tokens)=="string"){this.options.tokens=new Array(this.options.tokens)}if(!this.options.tokens.include("\n")){this.options.tokens.push("\n")}this.observer=null;this.element.setAttribute("autocomplete","off");Element.hide(this.update);Event.observe(this.element,"blur",this.onBlur.bindAsEventListener(this));Event.observe(this.element,"keydown",this.onKeyPress.bindAsEventListener(this))},show:function(){if(Element.getStyle(this.update,"display")=="none"){this.options.onShow(this.element,this.update)}if(!this.iefix&&(Prototype.Browser.IE)&&(Element.getStyle(this.update,"position")=="absolute")){new Insertion.After(this.update,'<iframe id="'+this.update.id+'_iefix" style="display:none;position:absolute;filter:progid:DXImageTransform.Microsoft.Alpha(opacity=0);" src="javascript:false;" frameborder="0" scrolling="no"></iframe>');this.iefix=$(this.update.id+"_iefix")}if(this.iefix){setTimeout(this.fixIEOverlapping.bind(this),50)}},fixIEOverlapping:function(){Position.clone(this.update,this.iefix,{setTop:(!this.update.style.height)});this.iefix.style.zIndex=1;this.update.style.zIndex=2;Element.show(this.iefix)},hide:function(){this.stopIndicator();if(Element.getStyle(this.update,"display")!="none"){this.options.onHide(this.element,this.update)}if(this.iefix){Element.hide(this.iefix)}},startIndicator:function(){if(this.options.indicator){Element.show(this.options.indicator)}},stopIndicator:function(){if(this.options.indicator){Element.hide(this.options.indicator)}},onKeyPress:function(a){if(this.active){switch(a.keyCode){case Event.KEY_TAB:case Event.KEY_RETURN:this.selectEntry();Event.stop(a);case Event.KEY_ESC:this.hide();this.active=false;Event.stop(a);return;case Event.KEY_LEFT:case Event.KEY_RIGHT:return;case Event.KEY_UP:this.markPrevious();this.render();Event.stop(a);return;case Event.KEY_DOWN:this.markNext();this.render();Event.stop(a);return}}else{if(a.keyCode==Event.KEY_TAB||a.keyCode==Event.KEY_RETURN||(Prototype.Browser.WebKit>0&&a.keyCode==0)){return}}this.changed=true;this.hasFocus=true;if(this.observer){clearTimeout(this.observer)}this.observer=setTimeout(this.onObserverEvent.bind(this),this.options.frequency*1000)},activate:function(){this.changed=false;this.hasFocus=true;this.getUpdatedChoices()},onHover:function(b){var a=Event.findElement(b,"LI");if(this.index!=a.autocompleteIndex){this.index=a.autocompleteIndex;this.render()}Event.stop(b)},onClick:function(b){var a=Event.findElement(b,"LI");this.index=a.autocompleteIndex;this.selectEntry();this.hide()},onBlur:function(a){setTimeout(this.hide.bind(this),250);this.hasFocus=false;this.active=false},render:function(){if(this.entryCount>0){for(var a=0;a<this.entryCount;a++){this.index==a?Element.addClassName(this.getEntry(a),"selected"):Element.removeClassName(this.getEntry(a),"selected")}if(this.hasFocus){this.show();this.active=true}}else{this.active=false;this.hide()}},markPrevious:function(){if(this.index>0){this.index--}else{this.index=this.entryCount-1}this.getEntry(this.index).scrollIntoView(true)},markNext:function(){if(this.index<this.entryCount-1){this.index++}else{this.index=0}this.getEntry(this.index).scrollIntoView(false)},getEntry:function(a){return this.update.firstChild.childNodes[a]},getCurrentEntry:function(){return this.getEntry(this.index)},selectEntry:function(){this.active=false;this.updateElement(this.getCurrentEntry())},updateElement:function(g){if(this.options.updateElement){this.options.updateElement(g);return}var e="";if(this.options.select){var a=$(g).select("."+this.options.select)||[];if(a.length>0){e=Element.collectTextNodes(a[0],this.options.select)}}else{e=Element.collectTextNodesIgnoreClass(g,"informal")}var c=this.getTokenBounds();if(c[0]!=-1){var f=this.element.value.substr(0,c[0]);var b=this.element.value.substr(c[0]).match(/^\s+/);if(b){f+=b[0]}this.element.value=f+e+this.element.value.substr(c[1])}else{this.element.value=e}this.oldElementValue=this.element.value;this.element.focus();if(this.options.afterUpdateElement){this.options.afterUpdateElement(this.element,g)}},updateChoices:function(c){if(!this.changed&&this.hasFocus){this.update.innerHTML=c;Element.cleanWhitespace(this.update);Element.cleanWhitespace(this.update.down());if(this.update.firstChild&&this.update.down().childNodes){this.entryCount=this.update.down().childNodes.length;for(var a=0;a<this.entryCount;a++){var b=this.getEntry(a);b.autocompleteIndex=a;this.addObservers(b)}}else{this.entryCount=0}this.stopIndicator();this.index=0;if(this.entryCount==1&&this.options.autoSelect){this.selectEntry();this.hide()}else{this.render()}}},addObservers:function(a){Event.observe(a,"mouseover",this.onHover.bindAsEventListener(this));Event.observe(a,"click",this.onClick.bindAsEventListener(this))},onObserverEvent:function(){this.changed=false;this.tokenBounds=null;if(this.getToken().length>=this.options.minChars){this.getUpdatedChoices()}else{this.active=false;this.hide()}this.oldElementValue=this.element.value},getToken:function(){var a=this.getTokenBounds();return this.element.value.substring(a[0],a[1]).strip()},getTokenBounds:function(){if(null!=this.tokenBounds){return this.tokenBounds}var f=this.element.value;if(f.strip().empty()){return[-1,0]}var g=arguments.callee.getFirstDifferencePos(f,this.oldElementValue);var j=(g==this.oldElementValue.length?1:0);var e=-1,c=f.length;var h;for(var b=0,a=this.options.tokens.length;b<a;++b){h=f.lastIndexOf(this.options.tokens[b],g+j-1);if(h>e){e=h}h=f.indexOf(this.options.tokens[b],g+j);if(-1!=h&&h<c){c=h}}return(this.tokenBounds=[e+1,c])}});Autocompleter.Base.prototype.getTokenBounds.getFirstDifferencePos=function(c,a){var e=Math.min(c.length,a.length);for(var b=0;b<e;++b){if(c[b]!=a[b]){return b}}return e};Ajax.Autocompleter=Class.create(Autocompleter.Base,{initialize:function(c,e,b,a){this.baseInitialize(c,e,a);this.options.asynchronous=true;this.options.onComplete=this.onComplete.bind(this);this.options.defaultParams=this.options.parameters||null;this.url=b},getUpdatedChoices:function(){this.startIndicator();var a=encodeURIComponent(this.options.paramName)+"="+encodeURIComponent(this.getToken());this.options.parameters=this.options.callback?this.options.callback(this.element,a):a;if(this.options.defaultParams){this.options.parameters+="&"+this.options.defaultParams}new Ajax.Request(this.url,this.options)},onComplete:function(a){this.updateChoices(a.responseText)}});Autocompleter.Local=Class.create(Autocompleter.Base,{initialize:function(b,e,c,a){this.baseInitialize(b,e,a);this.options.array=c},getUpdatedChoices:function(){this.updateChoices(this.options.selector(this))},setOptions:function(a){this.options=Object.extend({choices:10,partialSearch:true,partialChars:2,ignoreCase:true,fullSearch:false,selector:function(b){var e=[];var c=[];var j=b.getToken();var h=0;for(var f=0;f<b.options.array.length&&e.length<b.options.choices;f++){var g=b.options.array[f];var l=b.options.ignoreCase?g.toLowerCase().indexOf(j.toLowerCase()):g.indexOf(j);while(l!=-1){if(l==0&&g.length!=j.length){e.push("<li><strong>"+g.substr(0,j.length)+"</strong>"+g.substr(j.length)+"</li>");break}else{if(j.length>=b.options.partialChars&&b.options.partialSearch&&l!=-1){if(b.options.fullSearch||/\s/.test(g.substr(l-1,1))){c.push("<li>"+g.substr(0,l)+"<strong>"+g.substr(l,j.length)+"</strong>"+g.substr(l+j.length)+"</li>");break}}}l=b.options.ignoreCase?g.toLowerCase().indexOf(j.toLowerCase(),l+1):g.indexOf(j,l+1)}}if(c.length){e=e.concat(c.slice(0,b.options.choices-e.length))}return"<ul>"+e.join("")+"</ul>"}},a||{})}});Field.scrollFreeActivate=function(a){setTimeout(function(){Field.activate(a)},1)};Ajax.InPlaceEditor=Class.create({initialize:function(c,b,a){this.url=b;this.element=c=$(c);this.prepareOptions();this._controls={};arguments.callee.dealWithDeprecatedOptions(a);Object.extend(this.options,a||{});if(!this.options.formId&&this.element.id){this.options.formId=this.element.id+"-inplaceeditor";if($(this.options.formId)){this.options.formId=""}}if(this.options.externalControl){this.options.externalControl=$(this.options.externalControl)}if(!this.options.externalControl){this.options.externalControlOnly=false}this._originalBackground=this.element.getStyle("background-color")||"transparent";this.element.title=this.options.clickToEditText;this._boundCancelHandler=this.handleFormCancellation.bind(this);this._boundComplete=(this.options.onComplete||Prototype.emptyFunction).bind(this);this._boundFailureHandler=this.handleAJAXFailure.bind(this);this._boundSubmitHandler=this.handleFormSubmission.bind(this);this._boundWrapperHandler=this.wrapUp.bind(this);this.registerListeners()},checkForEscapeOrReturn:function(a){if(!this._editing||a.ctrlKey||a.altKey||a.shiftKey){return}if(Event.KEY_ESC==a.keyCode){this.handleFormCancellation(a)}else{if(Event.KEY_RETURN==a.keyCode){this.handleFormSubmission(a)}}},createControl:function(h,c,b){var f=this.options[h+"Control"];var g=this.options[h+"Text"];if("button"==f){var a=document.createElement("input");a.type="submit";a.value=g;a.className="editor_"+h+"_button";if("cancel"==h){a.onclick=this._boundCancelHandler}this._form.appendChild(a);this._controls[h]=a}else{if("link"==f){var e=document.createElement("a");e.href="#";e.appendChild(document.createTextNode(g));e.onclick="cancel"==h?this._boundCancelHandler:this._boundSubmitHandler;e.className="editor_"+h+"_link";if(b){e.className+=" "+b}this._form.appendChild(e);this._controls[h]=e}}},createEditField:function(){var c=(this.options.loadTextURL?this.options.loadingText:this.getText());var b;if(1>=this.options.rows&&!/\r|\n/.test(this.getText())){b=document.createElement("input");b.type="text";var a=this.options.size||this.options.cols||0;if(0<a){b.size=a}}else{b=document.createElement("textarea");b.rows=(1>=this.options.rows?this.options.autoRows:this.options.rows);b.cols=this.options.cols||40}b.name=this.options.paramName;b.value=c;b.className="editor_field";if(this.options.submitOnBlur){b.onblur=this._boundSubmitHandler}this._controls.editor=b;if(this.options.loadTextURL){this.loadExternalText()}this._form.appendChild(this._controls.editor)},createForm:function(){var b=this;function a(e,f){var c=b.options["text"+e+"Controls"];if(!c||f===false){return}b._form.appendChild(document.createTextNode(c))}this._form=$(document.createElement("form"));this._form.id=this.options.formId;this._form.addClassName(this.options.formClassName);this._form.onsubmit=this._boundSubmitHandler;this.createEditField();if("textarea"==this._controls.editor.tagName.toLowerCase()){this._form.appendChild(document.createElement("br"))}if(this.options.onFormCustomization){this.options.onFormCustomization(this,this._form)}a("Before",this.options.okControl||this.options.cancelControl);this.createControl("ok",this._boundSubmitHandler);a("Between",this.options.okControl&&this.options.cancelControl);this.createControl("cancel",this._boundCancelHandler,"editor_cancel");a("After",this.options.okControl||this.options.cancelControl)},destroy:function(){if(this._oldInnerHTML){this.element.innerHTML=this._oldInnerHTML}this.leaveEditMode();this.unregisterListeners()},enterEditMode:function(a){if(this._saving||this._editing){return}this._editing=true;this.triggerCallback("onEnterEditMode");if(this.options.externalControl){this.options.externalControl.hide()}this.element.hide();this.createForm();this.element.parentNode.insertBefore(this._form,this.element);if(!this.options.loadTextURL){this.postProcessEditField()}if(a){Event.stop(a)}},enterHover:function(a){if(this.options.hoverClassName){this.element.addClassName(this.options.hoverClassName)}if(this._saving){return}this.triggerCallback("onEnterHover")},getText:function(){return this.element.innerHTML.unescapeHTML()},handleAJAXFailure:function(a){this.triggerCallback("onFailure",a);if(this._oldInnerHTML){this.element.innerHTML=this._oldInnerHTML;this._oldInnerHTML=null}},handleFormCancellation:function(a){this.wrapUp();if(a){Event.stop(a)}},handleFormSubmission:function(f){var b=this._form;var c=$F(this._controls.editor);this.prepareSubmission();var g=this.options.callback(b,c)||"";if(Object.isString(g)){g=g.toQueryParams()}g.editorId=this.element.id;if(this.options.htmlResponse){var a=Object.extend({evalScripts:true},this.options.ajaxOptions);Object.extend(a,{parameters:g,onComplete:this._boundWrapperHandler,onFailure:this._boundFailureHandler});new Ajax.Updater({success:this.element},this.url,a)}else{var a=Object.extend({method:"get"},this.options.ajaxOptions);Object.extend(a,{parameters:g,onComplete:this._boundWrapperHandler,onFailure:this._boundFailureHandler});new Ajax.Request(this.url,a)}if(f){Event.stop(f)}},leaveEditMode:function(){this.element.removeClassName(this.options.savingClassName);this.removeForm();this.leaveHover();this.element.style.backgroundColor=this._originalBackground;this.element.show();if(this.options.externalControl){this.options.externalControl.show()}this._saving=false;this._editing=false;this._oldInnerHTML=null;this.triggerCallback("onLeaveEditMode")},leaveHover:function(a){if(this.options.hoverClassName){this.element.removeClassName(this.options.hoverClassName)}if(this._saving){return}this.triggerCallback("onLeaveHover")},loadExternalText:function(){this._form.addClassName(this.options.loadingClassName);this._controls.editor.disabled=true;var a=Object.extend({method:"get"},this.options.ajaxOptions);Object.extend(a,{parameters:"editorId="+encodeURIComponent(this.element.id),onComplete:Prototype.emptyFunction,onSuccess:function(c){this._form.removeClassName(this.options.loadingClassName);var b=c.responseText;if(this.options.stripLoadedTextTags){b=b.stripTags()}this._controls.editor.value=b;this._controls.editor.disabled=false;this.postProcessEditField()}.bind(this),onFailure:this._boundFailureHandler});new Ajax.Request(this.options.loadTextURL,a)},postProcessEditField:function(){var a=this.options.fieldPostCreation;if(a){$(this._controls.editor)["focus"==a?"focus":"activate"]()}},prepareOptions:function(){this.options=Object.clone(Ajax.InPlaceEditor.DefaultOptions);Object.extend(this.options,Ajax.InPlaceEditor.DefaultCallbacks);[this._extraDefaultOptions].flatten().compact().each(function(a){Object.extend(this.options,a)}.bind(this))},prepareSubmission:function(){this._saving=true;this.removeForm();this.leaveHover();this.showSaving()},registerListeners:function(){this._listeners={};var a;$H(Ajax.InPlaceEditor.Listeners).each(function(b){a=this[b.value].bind(this);this._listeners[b.key]=a;if(!this.options.externalControlOnly){this.element.observe(b.key,a)}if(this.options.externalControl){this.options.externalControl.observe(b.key,a)}}.bind(this))},removeForm:function(){if(!this._form){return}this._form.remove();this._form=null;this._controls={}},showSaving:function(){this._oldInnerHTML=this.element.innerHTML;this.element.innerHTML=this.options.savingText;this.element.addClassName(this.options.savingClassName);this.element.style.backgroundColor=this._originalBackground;this.element.show()},triggerCallback:function(b,a){if("function"==typeof this.options[b]){this.options[b](this,a)}},unregisterListeners:function(){$H(this._listeners).each(function(a){if(!this.options.externalControlOnly){this.element.stopObserving(a.key,a.value)}if(this.options.externalControl){this.options.externalControl.stopObserving(a.key,a.value)}}.bind(this))},wrapUp:function(a){this.leaveEditMode();this._boundComplete(a,this.element)}});Object.extend(Ajax.InPlaceEditor.prototype,{dispose:Ajax.InPlaceEditor.prototype.destroy});Ajax.InPlaceCollectionEditor=Class.create(Ajax.InPlaceEditor,{initialize:function($super,c,b,a){this._extraDefaultOptions=Ajax.InPlaceCollectionEditor.DefaultOptions;$super(c,b,a)},createEditField:function(){var a=document.createElement("select");a.name=this.options.paramName;a.size=1;this._controls.editor=a;this._collection=this.options.collection||[];if(this.options.loadCollectionURL){this.loadCollection()}else{this.checkForExternalText()}this._form.appendChild(this._controls.editor)},loadCollection:function(){this._form.addClassName(this.options.loadingClassName);this.showLoadingText(this.options.loadingCollectionText);var options=Object.extend({method:"get"},this.options.ajaxOptions);Object.extend(options,{parameters:"editorId="+encodeURIComponent(this.element.id),onComplete:Prototype.emptyFunction,onSuccess:function(transport){var js=transport.responseText.strip();if(!/^\[.*\]$/.test(js)){throw ("Server returned an invalid collection representation.")}this._collection=eval(js);this.checkForExternalText()}.bind(this),onFailure:this.onFailure});new Ajax.Request(this.options.loadCollectionURL,options)},showLoadingText:function(b){this._controls.editor.disabled=true;var a=this._controls.editor.firstChild;if(!a){a=document.createElement("option");a.value="";this._controls.editor.appendChild(a);a.selected=true}a.update((b||"").stripScripts().stripTags())},checkForExternalText:function(){this._text=this.getText();if(this.options.loadTextURL){this.loadExternalText()}else{this.buildOptionList()}},loadExternalText:function(){this.showLoadingText(this.options.loadingText);var a=Object.extend({method:"get"},this.options.ajaxOptions);Object.extend(a,{parameters:"editorId="+encodeURIComponent(this.element.id),onComplete:Prototype.emptyFunction,onSuccess:function(b){this._text=b.responseText.strip();this.buildOptionList()}.bind(this),onFailure:this.onFailure});new Ajax.Request(this.options.loadTextURL,a)},buildOptionList:function(){this._form.removeClassName(this.options.loadingClassName);this._collection=this._collection.map(function(e){return 2===e.length?e:[e,e].flatten()});var b=("value" in this.options)?this.options.value:this._text;var a=this._collection.any(function(e){return e[0]==b}.bind(this));this._controls.editor.update("");var c;this._collection.each(function(f,e){c=document.createElement("option");c.value=f[0];c.selected=a?f[0]==b:0==e;c.appendChild(document.createTextNode(f[1]));this._controls.editor.appendChild(c)}.bind(this));this._controls.editor.disabled=false;Field.scrollFreeActivate(this._controls.editor)}});Ajax.InPlaceEditor.prototype.initialize.dealWithDeprecatedOptions=function(a){if(!a){return}function b(c,e){if(c in a||e===undefined){return}a[c]=e}b("cancelControl",(a.cancelLink?"link":(a.cancelButton?"button":a.cancelLink==a.cancelButton==false?false:undefined)));b("okControl",(a.okLink?"link":(a.okButton?"button":a.okLink==a.okButton==false?false:undefined)));b("highlightColor",a.highlightcolor);b("highlightEndColor",a.highlightendcolor)};Object.extend(Ajax.InPlaceEditor,{DefaultOptions:{ajaxOptions:{},autoRows:3,cancelControl:"link",cancelText:"cancel",clickToEditText:"Click to edit",externalControl:null,externalControlOnly:false,fieldPostCreation:"activate",formClassName:"inplaceeditor-form",formId:null,highlightColor:"#ffff99",highlightEndColor:"#ffffff",hoverClassName:"",htmlResponse:true,loadingClassName:"inplaceeditor-loading",loadingText:"Loading...",okControl:"button",okText:"ok",paramName:"value",rows:1,savingClassName:"inplaceeditor-saving",savingText:"Saving...",size:0,stripLoadedTextTags:false,submitOnBlur:false,textAfterControls:"",textBeforeControls:"",textBetweenControls:""},DefaultCallbacks:{callback:function(a){return Form.serialize(a)},onComplete:function(b,a){new Effect.Highlight(a,{startcolor:this.options.highlightColor,keepBackgroundImage:true})},onEnterEditMode:null,onEnterHover:function(a){a.element.style.backgroundColor=a.options.highlightColor;if(a._effect){a._effect.cancel()}},onFailure:function(b,a){alert("Error communication with the server: "+b.responseText.stripTags())},onFormCustomization:null,onLeaveEditMode:null,onLeaveHover:function(a){a._effect=new Effect.Highlight(a.element,{startcolor:a.options.highlightColor,endcolor:a.options.highlightEndColor,restorecolor:a._originalBackground,keepBackgroundImage:true})}},Listeners:{click:"enterEditMode",keydown:"checkForEscapeOrReturn",mouseover:"enterHover",mouseout:"leaveHover"}});Ajax.InPlaceCollectionEditor.DefaultOptions={loadingCollectionText:"Loading options..."};Form.Element.DelayedObserver=Class.create({initialize:function(b,a,c){this.delay=a||0.5;this.element=$(b);this.callback=c;this.timer=null;this.lastValue=$F(this.element);Event.observe(this.element,"keyup",this.delayedListener.bindAsEventListener(this))},delayedListener:function(a){if(this.lastValue==$F(this.element)){return}if(this.timer){clearTimeout(this.timer)}this.timer=setTimeout(this.onTimerEvent.bind(this),this.delay*1000);this.lastValue=$F(this.element)},onTimerEvent:function(){this.timer=null;this.callback(this.element,$F(this.element))}});if(!document.onunload){document.onunload=function(){}}function write_to_document(a){document.write(a)}function toggleTabs(a,b){Element.show(a);Element.show(a+"_title");Element.show(b+"_link");Element.hide(b);Element.hide(b+"_title");Element.hide(a+"_link");$(a+"_tab").className="tab current";$(b+"_tab").className="tab"}var TopicForm={editNewTitle:function(a){$("new_topic").innerHTML=(a.value.length>5)?a.value:"New Topic"}};var EditForm={init:function(a){$("edit-post-"+a+"_spinner").show();this.clearReplyId()},setReplyId:function(a){$("edit").setAttribute("post_id",a.toString());$("posts-"+a+"-row").addClassName("editing");if($("reply")){$("reply").hide()}},clearReplyId:function(){var a=this.currentReplyId();if(!a||a==""){return}var b=$("posts-"+a+"-row");if(b){b.removeClassName("editing")}$("edit").setAttribute("post_id","")},currentReplyId:function(){return $("edit").getAttribute("post_id")},isEditing:function(a){if(this.currentReplyId()==a.toString()){$("edit").show();$("edit_post_body").focus();return true}return false},cancel:function(){this.clearReplyId();$("edit").hide()}};var ReplyForm={init:function(){EditForm.cancel();$("reply").toggle();$("post_body").focus()}};function showChatSelector(b,a){new lightbox("/rooms/change?game_rooms="+b+"&game_id="+a)}function limitText(b,a){if(b.value.length>a){b.value=b.value.substring(0,a)}}Prototype.Platform={Windows:!!navigator.platform.match(/Win/),Macintosh:!!navigator.platform.match(/Mac/),Linux:!!navigator.platform.match(/Linux/)};Hash.prototype.getWithDefault=function(b,c){var a=this.get(b);return(undefined==a?this.set(b,c()):a)};Hash.prototype.getOrSet=function(b,c){var a=this.get(b);return(undefined==a?this.set(b,c):a)};Prototype.Browser.IE6=navigator.userAgent.indexOf("MSIE 6.")>-1;Prototype.Browser.IE7=navigator.userAgent.indexOf("MSIE 7.")>-1;Prototype.Browser.IE8=navigator.userAgent.indexOf("MSIE 8.")>-1;if(Prototype.Browser.IE8){Element._attributeTranslations.write.names["class"]=undefined}Element.addMethods("textarea",{positionCaretAtEnd:function(c){var b=$(c);if(b.createTextRange){var a=b.createTextRange();a.move("character",b.value.length);a.select()}else{if(b.selectionStart!=null){var f=b.value.length;b.focus();b.setSelectionRange(f,f)}else{b.focus();b.value+=""}}return b}});Element.addMethods({ieHappyHide:function(a){var b=$(a);b.style.display="none";b.style.visibility="hidden";return b},ieHappyShow:function(a){var b=$(a);b.style.display="";b.style.visibility="visible";return b}});String.prototype.evalScripts=function(){if(this.extractScripts){return this.extractScripts().map(function(script){return eval(script)})}else{return this}};Function.prototype.runWhenDomLoaded=function(){if(document.loaded){this.defer()}else{var a=this;document.observe("dom:loaded",function(){(a)()})}};function insertTrackingPixelWithTimestamp(a){stamp=new Date().getTime();document.write('<img src="'+a+stamp+'?"/>')}Function.prototype.bufferingFunction=function(f,e){var a=Function.preconditionBufferingGroup(f,e),c=this,b=function(){a.push(c,arguments,this,b,e);if(f(this)){a.unwind()}};return b};Function.preconditionBufferingGroup=function(c,b){if(!this._buffering_function_groups){this._buffering_function_groups=[]}if(undefined===c._buffering_group_id){c._buffering_group_id=this._buffering_function_groups.length}var a=c._buffering_group_id;if(!this._buffering_function_groups[a]){this._buffering_function_groups[a]=function(){var e=[];return{push:function(h,f,l,g,j){e.push({fn:h,outerFunction:g,args:f,bind_to:l,timestamp:new Date(),tag:j})},unwind:function(){if(!e.length){return}var l,h=function(n,m){var o=function(q,p){if(q.localeCompare&&p.localeCompare){return q.localeCompare(p)}if(q>p){return -1}if(q<p){return 1}return 0};return(o(n.tag,m.tag)||o(n.timestamp,m.timestamp))};if(b instanceof Function){e.sort(b)}else{if(b){e.sort(h)}}while(l=e.shift()){var g=l.fn,f=l.args,j=l.bind_to;g.apply(j,f)}}}}()}return this._buffering_function_groups[a]};Function.unbufferBufferingGroup=function(a){if(!a._buffering_group_id){return}Function.preconditionBufferingGroup(a).unwind()};function CommentsController(a){this.initialize(a)}CommentsController.prototype={initialize:function(a){this._comments_path=a.comments_path;this._hidden_threshold=a.hidden_threshold;this._active_user=a.active_user;this._comment_ids=a.comment_ids},showNewCommentForm:function(){if(this._active_user.isAuthenticated()){try{holodeck.recordAnalyticsEvent("Comments","Add")}catch(a){}Element.hide("commentutility");Element.show("comment_new")}},resetNewCommentForm:function(){$("comment_content").value="";$("comment_errors").hide();Element.hide("comment_new");this.reenableNewCommentForm();$("commentutility").show()},reenableNewCommentForm:function(){Element.hide("comment_indicator");$("post_comment_submit").disabled=false},submitNewCommentForm:function(b){var a=this;Element.show("comment_indicator");$("post_comment_submit").disabled=true;$(b).request({method:"post",onSuccess:function(c){$("comments_list").insert(c.responseText);$("no_comments").hide();a.resetNewCommentForm();urchinTracker("/new_comment")},on400:function(c){a.showNewCommentErrors(c.responseText)},on500:function(c){a.showNewCommentErrors("A server error occured.")}})},showNewCommentErrors:function(a){var b=$("comment_errors");b.show();b.update(a);this.reenableNewCommentForm()},userSilenced:function(){var a=$("comment_user_silenced");$("comment_add_a_comment").hide();a.update(this._active_user.silencedMessage());a.show()},checkUserSilenced:function(){if(this._active_user.isSilenced()){this.userSilenced()}},lightUpSingleComment:function(a,b){var c=$("comment_"+a);c.removeClassName("rated_negative");c.removeClassName("rated_positive");c.addClassName(b?"rated_positive":"rated_negative")},rateComment:function(c,f,e){var g=$("comment_"+c),b=$("comment_rating_area_"+c),a=this;this.hideRatingLinks(c);$("comment_current_rating_"+c).update(e);g.removeClassName("below_threshold");g.removeClassName("above_threshold");g.addClassName(e>this._hidden_threshold?"above_threshold":"below_threshold");this.lightUpSingleComment(c,f);new Ajax.Request(this._comments_path+"/"+c+"/ratings.js",{parameters:{opinion:f},onComplete:function(h){a.showRatingLinks(c)}})},flagComment:function(b){var a=this;this.hideRatingLinks(b);new Ajax.Request(this._comments_path+"/"+b+"/flaggings.js",{onComplete:function(c){a.showRatingLinks(b);$("comment_flagged_"+b).show();$("comment_flagged_"+b).update("<span>This comment has been flagged for review.</span>")}})},hideRatingLinks:function(c){var b=$("comment_rating_links_"+c),a=$("flag_indicator_"+c),e=$("comment_status_"+c);a.show();e.hide();b.hide()},showRatingLinks:function(c){var b=$("comment_rating_links_"+c),a=$("flag_indicator_"+c),e=$("comment_status_"+c);a.hide();b.show();e.show()},showCommentContent:function(a){Element.hide("show_comment_content_"+a);Element.show("hide_comment_content_"+a);Element.show("comment_content_"+a)},hideCommentContent:function(a){Element.show("show_comment_content_"+a);Element.hide("hide_comment_content_"+a);Element.hide("comment_content_"+a)},removeComment:function(e){var b=this._comments_path+"/"+e+".js",c=$("flag_indicator_"+e),a=$("remove_comment_"+e),f=$("comment_"+e);c.show();a.hide();new Ajax.Request(this._comments_path+"/"+e+".js",{method:"delete",onSuccess:function(g){f.remove()}})},checkUserRatingStatus:function(){var a=this;new Ajax.Request(this._active_user.accountUrl()+"/comment_ratings.json",{method:"get",parameters:{comment_ids:Object.toJSON(this._comment_ids),game_id:this._active_user.gameId()},onSuccess:function(b){a.lightUpComments(b.responseJSON)}})},lightUpComments:function(b){var a=this;$H(b).each(function(c){a.lightUpSingleComment(c.key,c.value)})}};var CreditCardForm=Class.create({initialize:function(f,e,b,c,a){this._tableElement=f;this._rows=[];this._togglePayNow=a;this._ccImages={};$H({visa:"/images/ccmark_visa.gif",master_card:"/images/ccmark_mastercard.gif",american_express:"/images/ccmark_amex.gif",discover:"/images/ccmark_discover.gif"}).each(function(g){this._ccImages[g.key]=new Element("img");this._ccImages[g.key].src=g.value}.bind(this));this._ccNumberRow=new FormCreditCardNumberRow("","Credit card number","cc_number",c.cc_number,this._checkAllRowsForValidity.bind(this),this._propagateCreditCardType.bind(this));this._rows.push(this._ccNumberRow);this._rows.push(new FormExpirationDateRow("","Expiration Date","",e,b,c.cc_month,c.cc_year,this._checkAllRowsForValidity.bind(this)));this._cvvRow=new FormCvvRow("","Card security code","cc_verification_value",c.cc_verification_value,this._checkAllRowsForValidity.bind(this));this._rows.push(this._cvvRow);this._rows.push(new FormNonEmptyRow("","First name","cc_first_name","Please enter your first name exactly as it appears on your credit card",c.cc_first_name,this._checkAllRowsForValidity.bind(this),false));this._rows.push(new FormNonEmptyRow("","Last name","cc_last_name","Please enter your last name exactly as it appears on your credit card",c.cc_last_name,this._checkAllRowsForValidity.bind(this),false));this._rows.push(new FormNonEmptyRow("","Billing address","cc_address_1","Enter the street address where your statements are mailed to. (eg, 12 Maple Drive)",c.cc_address_1,this._checkAllRowsForValidity.bind(this),false));this._rows.push(new FormCanBeEmptyRow("","Billing address (cont)","cc_address_2","Apartment number, suite number or department",c.cc_address_2,this._checkAllRowsForValidity.bind(this),false));this._rows.push(new FormNonEmptyRow("","City","cc_city","",c.cc_city,this._checkAllRowsForValidity.bind(this),false));this._rows.push(new FormNonEmptyRow("","State/Province/Region","cc_state","",c.cc_state,this._checkAllRowsForValidity.bind(this),false));this._rows.push(new FormNonEmptyRow("","Postal Code","cc_postal_code","",c.cc_postal_code,this._checkAllRowsForValidity.bind(this),true));this._attachRowsToTableElement()},rowCount:function(){return this._rows.length},_checkAllRowsForValidity:function(){},_enablePayNow:function(){var a=$$(".checkout_button")[0];a.disabled=false;a.removeClassName("disabled")},_disablePayNow:function(){var a=$$(".checkout_button")[0];if(this._togglePayNow){a.disabled=true;a.addClassName("disabled")}},_attachRowsToTableElement:function(){this._rows.each(function(a){Element.insert(this._tableElement,{before:a.getElement()})}.bind(this))},_propagateCreditCardType:function(){var a=this._ccNumberRow.getCreditCardType();this._ccNumberRow._helpCreditCardFocusHandler._setImage(this._ccImages[a]);this._cvvRow.setCreditCardType(a)}});var updatePaypalFormValues=function(b){var a=new RegExp(/kpid=(\d*)/);custom_input=$("custom");custom_input.value=custom_input.value.replace(a,"kpid="+b);$("kred_package_id").value=b};var paypalInformationPath=function(a){a.kred_amount=$("kred_amount").innerHTML;a.kred_package_id=$("kred_package_id").value;return"/paypal_informations?"+Object.toQueryString(a)};var updatePurchaseSummary=function(b,a){$("kred_amount").innerHTML=b;$("dollar_price").innerHTML=a;$("item_name").value=b+" Kreds";$("amount").value=a};FeedbackFormBuilder=Class.create();FeedbackFormType=Class.create();FeedbackFormType.prototype={initialize:function(c,b,f,a,e){this.type=c;this.property_class=b;this.desc_text_area=f;this.sidebar_id=a;this.login_required=e}};FeedbackFormBuilder.selectAccomplishment=function(a){if(a==""){$("missing_accomplishment_options").innerHTML="Please select a game"}else{$("missing_accomplishment_options").innerHTML='<img src="/images/spinner.gif" style="float:right;"/>';new Ajax.Request("/feedbacks/missing_accomplishments_for.js?game_id="+a,{method:"get"})}};FeedbackFormBuilder.prototype={initialize:function(a){var b=$("select_topic").options[$("select_topic").selectedIndex].value;this.currentTextArea=null;this._element=$(a);this._classes=new Array("abuse","general","game_missing_accomplishment","game_bug");this.types=[new FeedbackFormType("Feedback","general","feedback_general_content","general_feedback_instructions"),new FeedbackFormType("BugReport","general","feedback_general_content","general_bug_feedback_instructions"),new FeedbackFormType("FeatureRequest","general","feedback_general_content","general_feedback_instructions"),new FeedbackFormType("AdvertisingInquiryFeedback","general","feedback_general_content","advertiser_feedback_instructions"),new FeedbackFormType("OtherInquiryFeedback","general","feedback_general_content","general_feedback_instructions"),new FeedbackFormType("DevelopmentSupportFeedback","general","feedback_general_content","developer_support_feedback_instructions"),new FeedbackFormType("AbusiveUser","abuse","feedback_abuse_content","abusive_user_feedback_instructions"),new FeedbackFormType("MissingAccomplishmentFeedback","game_missing_accomplishment","feedback_missing_accomplishment_content","missing_accomplishment_feedback_instructions",true),new FeedbackFormType("GameBugReport","game_bug","feedback_game_bug_content","game_bug_feedback_instructions")];this._clearContentExcept(b);this._hideAll();this.subjectChanged();this._setSubmitState()},_findTypeByTypeStr:function(a){return this.types.find(function(b){return b.type==a})},_findAllTextAreas:function(a){var b=new Hash();a.each(function(e){var c=e.desc_text_area;b.set(c,true)});return b.keys()},_findAllSidebars:function(b){var a=new Hash();this.types.each(function(e){var c=e.sidebar_id;a.set(c,true)});return a.keys()},_findAllClasses:function(a){},_clearContentExcept:function(b){var a=this._findAllTextAreas(this.types);var c=this._findTypeByTypeStr(b);a.each(function(e){if(e!=c.desc_text_area){$(e).value=""}})},_hideAll:function(){this._classes.each(function(a){var b=this._getElementsForClass(a);b.each(function(c){c.hide()})}.bind(this));this._hideSidebars()},_hideSidebars:function(){this._findAllSidebars().each(function(a){$(a).hide()})},_showType:function(b){var a=this._findTypeByTypeStr(b);this.type=a;this.showElementsOfClass(a.property_class);this._showSidebarForType(a);this.copyContent(a.desc_text_area)},_showSidebarForType:function(a){$(a.sidebar_id).show()},copyContent:function(a){var b=$(a);if(this.currentTextArea&&this.currentTextArea!=b){b.value=this.currentTextArea.value;this.currentTextArea.value=""}this.currentTextArea=b},_setSubmitState:function(){var a=$F("select_topic");if(a=="Feedback"){$("feedback_submit_button").disable();$("feedback_submission_warning").show()}else{$("feedback_submit_button").enable();$("feedback_submission_warning").hide()}},_getElementsForClass:function(a){return this._element.select("."+a)},showElementsOfClass:function(a){var b=this._getElementsForClass(a);b.each(function(c){c.show()})},select:function(a){this._hideAll();this._showType(a)},_loginRequired:function(){return(typeof(this.type)!="undefined"&&this.type.login_required)},_enableForm:function(){$("login_message").hide();$("feedback_form_form").enable();$("feedback_submit_button").show()},_disableForm:function(){$("login_message").show();$("feedback_form_form").disable();$("select_topic").enable();$("feedback_submit_button").hide()},subjectChanged:function(){var c=$F("select_topic");this.select(c);if(this._loginRequired()&&!active_user.isAuthenticated()){this._disableForm()}else{this._enableForm()}var b=$("chooser");var a=$("feedback_game_id");a.onchange=function(){};if(c=="GameBugReport"){$("game_bug_input_cell").appendChild(b)}if(c=="MissingAccomplishmentFeedback"){$("game_missing_accomplishment_input_cell").appendChild(b);a.onchange=function(){FeedbackFormBuilder.selectAccomplishment(a.value)};if(a.value!=""){a.onchange()}}this._setSubmitState()},_spin:function(){$("feedback_form_content").style.display="none";$("feedback_spinner").style.display="block"},_unspin:function(){$("feedback_spinner").style.display="none";$("feedback_form_content").style.display="block"}};var FocusHandler=Class.create({initialize:function(b,a,c){this._row=b;this._text=a;this._callback=c;this._elementsToInspect=b.getInputElements();this._elementToAffect=b.getHelpElement()},setText:function(a){this._text=a},_inputIsValid:undefined,onFocus:function(){FocusHandler._last_row=this._row},onBlur:function(){var a=false;if(this._inputIsValid()){this._elementsToInspect.each(function(b){Element.removeClassName(b,"error_field")});Element.removeClassName(this._elementToAffect,"error_msg");this._elementToAffect.innerHTML="";return false}else{this._elementsToInspect.each(function(b){Element.addClassName(b,"error_field")});Element.addClassName(this._elementToAffect,"error_msg");this._elementToAffect.innerHTML=this._text;this._callback();return true}},_rowChanged:function(){return !(this._row==FocusHandler._last_row)}});var HelpFocusHandler=Class.create(FocusHandler,{initialize:function($super,b,a){$super(b,a,function(){})},onBlur:function(){var a=this._elementToAffect.childNodes[0];if(a){a.remove()}return false},_createHelpDiv:function(){this._removeHelpDiv();var a=new Element("div");a.id="help_wrapper";var b=new Element("div");b.id="help_text";a.appendChild(b);this._elementToAffect.appendChild(a);return b},_removeHelpDiv:function(){var a=this._elementToAffect.childNodes[0];if(a){a.remove()}},_errorsArePresent:function(){return this._elementToAffect.hasClassName("error_msg")}});var HelpTextFocusHandler=Class.create(HelpFocusHandler,{initialize:function($super,b,a){$super(b,a)},onFocus:function($super){$super();if(this._errorsArePresent()){return false}if(this._text){var a=this._createHelpDiv();a.innerHTML=this._text}return true}});var HelpImageFocusHandler=Class.create(HelpFocusHandler,{initialize:function($super,b,a){$super(b,null);this._imageElement=a},onFocus:function($super){$super();if(this._errorsArePresent()){return false}this._setImage(this._imageElement);return true},_setImage:function(b){var a=this._createHelpDiv();a.appendChild(b)}});var HelpCreditCardFocusHandler=Class.create(HelpImageFocusHandler,{initialize:function($super,b,a){$super(b,a);this._setImage(this._imageElement)},onBlur:function($super){}});var NonEmptyInputFocusHandler=Class.create(FocusHandler,{initialize:function($super,b,a,c){$super(b,a,c)},_inputIsValid:function(){return this._row.getInputValue()!=""}});var CreditCardValidationFocusHandler=Class.create(FocusHandler,{initialize:function($super,b,a,c){$super(b,a,c)},_inputIsValid:function(){var h=/^4\d{12}(\d{3})?$/;var j=/^(5[1-5]\d{4}|677189)\d{10}$/;var g=/^(6011|65\d{2})\d{12}$/;var e=/^3[47]\d{13}$/;var b=[h,j,g,e];var c=["visa","master_card","discover","american_express"];for(var f=0,a=b.length;f<a;f++){if(this._row.getInputValue().match(b[f])){this._creditCardType=c[f];return true}}return false},getCreditCardType:function(){return this._creditCardType}});var DateValidationFocusHandler=Class.create(FocusHandler,{initialize:function($super,b,a,c){$super(b,a,c)},_deferValidation:function(){return(!this._rowChanged()&&this._isIncomplete())},_isIncomplete:function(){return(!this._month()||!this._year())},_month:function(){return this._row.getInputElements()[0].value},_year:function(){return this._row.getInputElements()[1].value}});var CompleteDateValidationFocusHandler=Class.create(DateValidationFocusHandler,{initialize:function($super,b,a,c){$super(b,a,c)},_inputIsValid:function(){if(this._deferValidation()){return true}var a=this._row.getInputValue();return(a.length>=6)}});var FutureDateValidationFocusHandler=Class.create(DateValidationFocusHandler,{initialize:function($super,b,a,c){$super(b,a,c)},_getCurrentDate:function(){return new Date()},_inputIsValid:function(){if(this._deferValidation()){return true}var c=this._row.getInputValue();var b=c.split("/");var a=this._getCurrentDate();return !(b[1]==a.getFullYear()&&b[0]<a.getMonth()+1)}});var CvvValidationFocusHandler=Class.create(FocusHandler,{initialize:function($super,a,b){this._requiredCvvLength=0;$super(a,"credit card number must be valid",b)},setCreditCardType:function(a){this._requiredCvvLength=this._getRequiredCvvLengthFor(a);this.setText("code must be "+this._requiredCvvLength+" digits")},_getRequiredCvvLengthFor:function(a){if(a=="american_express"){return 4}else{if(a=="test"){return 1}}return 3},_inputIsValid:function(){return this._row.getInputValue().length==this._requiredCvvLength}});var ValidInputCallbackFocusHandler=Class.create(FocusHandler,{initialize:function($super,a,b){$super(a,"",b)},onBlur:function(){this._callback();return false}});var hookup_hintables=function(){$$(".hintable").each(function(c){var h=c.title,e=c.form,g=e.restoreHints,b=function(){if(h==c.value||""==c.value){c.value="";c.removeClassName("hinted_value")}},f=function(){if(""==c.value){c.value=h;c.addClassName("hinted_value")}},a=c.form.onsubmit;f();c.observe("click",b);c.observe("focus",b);c.observe("blur",f);c.restoreHint=f;e.onsubmit=function(){var j=true;b();if(a){try{j=a.apply(this,arguments)}catch(l){}}f();return j};e.restoreHints=function(){f();if(g){g.apply(this,arguments)}}})};document.observe("dom:loaded",function(){hookup_hintables()});function SiteNavigation(b,a){this.initialize(b,a)}SiteNavigation.prototype={initialize:function(b,a){this._rollover_delay=a.rollover_delay||0.2;this._waiting=false;this._active_nav_element=null;this._active_user=a.active_user;var e=this;$(document.body).observe("mouseover",function(g){var f=$(g.target);if(f&&f.descendantOf&&!f.descendantOf($("full-nav-wrap"))){e.onMouseLeave()}});$$(".hovertarget").each(function(f){f.subnav=$(f.id.slice(4,f.id.length)+"_subnav");f.observe("mouseover",function(g){var h=g.target;if("A"==g.target.tagName){h=g.target.parentNode}e.onMouseOverNavigationCategory(h)})});$$(".subnav").each(function(f){f.observe("mouseover",function(g){e.clearResetTimer()})});if(this._active_user){var c=function(){var f=$$("#full-nav-wrap a");f.each(function(g){g.href=g.getAttribute("authUrl")})};if(this._active_user.isAuthenticated()){c()}else{this._active_user.addOnAuthenticatedObserver(c)}}this.activateNav(b)},activateNav:function(a){if(this._active_nav_element){this._active_nav_element.removeClassName("hover");this._active_nav_element.down("a").removeClassName("active")}this._active_nav_element=a;$$(".subnav").invoke("hide");a.subnav.show();a.addClassName("hover");a.down("a").addClassName("active")},clearResetTimer:function(){if(this._reset_timer){clearTimeout(this._reset_timer)}this._reset_timer=null},resetCurrentNav:function(){this.activateNav($$(".active-nav-category-item")[0])},onMouseLeave:function(){this.clearResetTimer();this._waiting=false;this._reset_timer=this.resetCurrentNav.bind(this).delay(this._rollover_delay)},onMouseOverNavigationCategory:function(a){this.clearResetTimer();if(this._waiting){this._reset_timer=this.activateNav.bind(this).delay(this._rollover_delay,a)}else{this._waiting=true;this._reset_timer=this.activateNav.bind(this).delay(0,a)}}};function WelcomeBox(a){this.initialize(a)}WelcomeBox.prototype={initialize:function(a){this._user=a;this._template=new Template($("logged_in_user_welcome_template").innerHTML);this.updateValues();var b=this;a.addAttributesObserver(function(){b.updateValues()})},updateValues:function(){if(this._user.isAuthenticated()){var b=this._user.getAttributes();b.friends_online_string=this.friendsOnlineString(b.friends_online_count);b.unread_messages_count_string=this.messagesCountString(b.unread_messages_count);b.kreds_balance_or_my_profile_link=this.kredsBalanceOrMyProfileString(b.kreds_balance);b.kreds_balance_or_my_profile_link_url=this.kredAccountUrlOrMyProfileUrl(b.kreds_balance);var e=this._template.evaluate(b);var a=$("welcome");a.update(e);a.down("#friends_online_welcome_box_link").writeAttribute({title:b.friends_online_names});var f=new Element("img").writeAttribute({id:"welcome_box_user_avatar","class":"user_avatar",src:b.avatar_url,title:b.username,name:"user_avatar",alt:"avatar for"+b.username});a.down("span#welcome_box_avatar_placeholder").update(f);var c=new Element("img").writeAttribute({id:"welcome_levelbug","class":"levelbug_image",src:b.levelbug_url,title:"Level "+b.level,name:"welcome_levelbug",alt:"Levelbug"+b.level});a.down("span#welcome_box_levelbug_img_placeholder").update(c);a.down("#levelbug").observe("click",this.seeLevelStatusFunction());this._user.populateUserSpecificLinks(a);a.show()}},friendsOnlineString:function(a){if(1==a){return"<strong>1 friend online</strong>"}else{if(a>1){return"<strong>"+a+" friends online</strong>"}else{return"No friends online"}}},messagesCountString:function(b){if(b>0){var a=b>99?"99+":b;return"<strong>Messages ("+a+")</strong>"}else{return"Messages"}},kredsBalanceOrMyProfileString:function(a){if(0==a){return"My Profile"}else{if(1==a){return"1 Kred"}else{return a.withDelimiters()+" Kreds"}}},kredAccountUrlOrMyProfileUrl:function(a){if(0==a){return"/accounts/"+encodeURIComponent(this._user.username())}else{return"/accounts/"+encodeURIComponent(this._user.username())+"/kred_account"}},seeLevelStatusFunction:function(){var a=this;return function(c){var b="/accounts/"+a._user.username()+"/points";new Ajax.Updater("points",b,{method:"GET",onComplete:function(e){Element.toggle("mystuff");Element.toggle("points")}});c.stop();return false}}};Ajax.CachedAutocompleter=Class.create();Object.extend(Object.extend(Ajax.CachedAutocompleter.prototype,Autocompleter.Base.prototype),{initialize:function(c,e,b,a){this.baseInitialize(c,e,a);this.options.asynchronous=true;this.options.onComplete=this.onComplete.bind(this);this.options.defaultParams=this.options.parameters||null;this.url=b;this.cache={}},getUpdatedChoices:function(){var a=this.getToken().toLowerCase();if(this.cache[a]){this.updateChoices(this.cache[a])}else{this.startIndicator();entry=encodeURIComponent(this.options.paramName)+"="+encodeURIComponent(a);this.options.parameters=this.options.callback?this.options.callback(this.element,entry):entry;if(this.options.defaultParams){this.options.parameters+="&"+this.options.defaultParams}new Ajax.Request(this.url,this.options)}},onComplete:function(a){this.updateChoices(this.cache[a.request.parameters.search]=a.responseText)},markPrevious:function(){if(this.index>0){this.index--}else{this.index=this.entryCount-1;this.update.scrollTop=this.update.scrollHeight}selection=this.getEntry(this.index);selection_top=selection.offsetTop;if(selection_top<this.update.scrollTop){this.update.scrollTop=this.update.scrollTop-selection.offsetHeight}},markNext:function(){if(this.index<this.entryCount-1){this.index++}else{this.index=0;this.update.scrollTop=0}selection=this.getEntry(this.index);selection_bottom=selection.offsetTop+selection.offsetHeight;if(selection_bottom>this.update.scrollTop+this.update.offsetHeight){this.update.scrollTop=this.update.scrollTop+selection.offsetHeight}},selectEntry:function(){if(this.index>=0){this.active=false;this.updateElement(this.getCurrentEntry())}else{try{this.element.form.onsubmit()}catch(a){}this.element.form.submit()}},updateChoices:function(c){if(!this.changed&&this.hasFocus){this.update.innerHTML=c;Element.cleanWhitespace(this.update);Element.cleanWhitespace(this.update.down());if(this.update.firstChild&&this.update.down().childNodes){this.entryCount=this.update.down().childNodes.length;for(var a=0;a<this.entryCount;a++){var b=this.getEntry(a);b.autocompleteIndex=a;this.addObservers(b)}}else{this.entryCount=0}this.stopIndicator();this.update.scrollTop=0;this.index=this.options.noAutoDefault?-1:0;if(this.entryCount==1&&this.options.autoSelect){this.selectEntry();this.hide()}else{this.render()}}}});Number.prototype.withDelimiters=function(a,e){if(!a){a=","}if(!e){e=1000}var c=[],b=Math.floor(this);while(b){c.unshift(b%e);b=Math.floor(b/e)}return[c.shift()].concat(c.map(function(f){return f.toPaddedString(((e-1)+"").length)})).join(a)};Ajax.Poller=function(c,b,a,e){this.initialize(c,b)};Ajax.Poller.prototype={initialize:function(e,c,b,f){b=b||5000;f=f||30000;var g=this,a=Object.extend({method:"get",on202:function(){setTimeout(g._poll,b)},onFailure:function(){setTimeout(g._poll,f)}},c);this._poll=function(){new Ajax.Request(e,a)}},start:function(a){setTimeout(this._poll.bind(this),a||0)}};var SocialHistory=function(l){var r={Digg:["http://digg.com","http://digg.com/login"],Reddit:["http://reddit.com","http://reddit.com/new/","http://reddit.com/controversial/","http://reddit.com/top/","http://reddit.com/r/reddit.com/","http://reddit.com/r/programming/"],StumbleUpon:["http://stumbleupon.com"],"Yahoo Buzz":["http://buzz.yahoo.com"],Facebook:["http://facebook.com/home.php","http://facebook.com","https://login.facebook.com/login.php"],"Del.icio.us":["https://secure.del.icio.us/login","http://del.icio.us/"],MySpace:["http://www.myspace.com/"],Technorati:["http://www.technorati.com"],Newsvine:["https://www.newsvine.com","https://www.newsvine.com/_tools/user/login"],Songza:["http://songza.com"],Slashdot:["http://slashdot.org/"],"Ma.gnolia":["http://ma.gnolia.com/"],Blinklist:["http://www.blinklist.com"],Furl:["http://furl.net","http://furl.net/members/login"],"Mister Wong":["http://www.mister-wong.com"],Current:["http://current.com","http://current.com/login.html"],Menaeme:["http://meneame.net","http://meneame.net/login.php"],Oknotizie:["http://oknotizie.alice.it","http://oknotizie.alice.it/login.html.php"],Diigo:["http://www.diigo.com/","https://secure.diigo.com/sign-in"],Funp:["http://funp.com","http://funp.com/account/loginpage.php"],Blogmarks:["http://blogmarks.net"],"Yahoo Bookmarks":["http://bookmarks.yahoo.com"],Xanga:["http://xanga.com"],Blogger:["http://blogger.com"],"Last.fm":["http://www.last.fm/","https://www.last.fm/login/"],N4G:["http://www.n4g.com"],Faves:["http://faves.com","http://faves.com/home","https://secure.faves.com/signIn"],Simpy:["http://www.simpy.com","http://www.simpy.com/login"],Yigg:["http://www.yigg.de"],Kirtsy:["http://www.kirtsy.com","http://www.kirtsy.com/login.php"],Fark:["http://www.fark.com","http://cgi.fark.com/cgi/fark/users.pl?self=1"],Mixx:["https://www.mixx.com/login/dual","http://www.mixx.com"],"Google Bookmarks":["http://www.google.com/bookmarks","http://www.google.com/ig/add?moduleurl=bookmarks.xml&hl=en"],Subbmitt:["http://subbmitt.com/"],Twitter:["http://twitter.com","http://twitter.com/login"]};for(var a in l){if(typeof(r[a])=="undefined"){r[a]=[]}if(typeof(l[a])=="string"){r[a].push(l[a])}else{r[a]=r[a].concat(l[a])}}var o={};function p(w,v,u){if(w.currentStyle){var z=w.currentStyle[u]}else{if(window.getComputedStyle){var z=v.defaultView.getComputedStyle(w,null).getPropertyValue(u)}}return z}function m(u){u.parentNode.removeChild(u)}function s(){var u=document.createElement("iframe");u.style.position="absolute";u.style.visibility="hidden";document.body.appendChild(u);if(u.contentDocument){u.doc=u.contentDocument}else{if(u.contentWindow){u.doc=u.contentWindow.document}}u.doc.open();u.doc.write("<style>");u.doc.write("a{color: #000000; display:none;}");u.doc.write("a:visited {color: #FF0000; display:inline;}");u.doc.write("</style>");u.doc.close();return u}var h=s();function c(v,w){var u=h.doc.createElement("a");u.href=v;u.innerHTML=a;h.doc.body.appendChild(u)}for(var a in r){var q=r[a];for(var j=0;j<q.length;j++){c(q[j],a);if(q[j].match(/www\./)){var f=q[j].replace(/www\./,"");c(f,a)}else{var e=q[j].indexOf("//")+2;var g=q[j].substring(0,e)+"www."+q[j].substring(e);c(g,a)}}}var t=h.doc.body.childNodes;for(var j=0;j<t.length;j++){var n=p(t[j],h.doc,"display");var b=n!="none";if(b){o[t[j].innerHTML]=true}}m(h);return new (function(){var u=[];for(var v in o){u.push(v)}this.visitedSites=function(){return u};this.doesVisit=function(y){if(typeof(r[y])=="undefined"){return -1}return typeof(o[y])!="undefined"};var w=[];for(var v in r){w.push(v)}this.checkedSites=function(){return w}})()};function subjectChanged(b){if($("select_type")){var a=$F("select_type");if(a&&a!=""){$("abuse_form_submit").enable()}if(a=="OtherAbuseReport"||a=="InappropriateChatReport"||a=="UnderageUserReport"||a=="PermabanRequest"){$("description_field").show();updateDescriptionPrompt(true,b)}if(a=="InappropriateUsernameReport"||a=="InappropriateAvatarReport"||a=="InappropriateProfileReport"){$("description_field").show();updateDescriptionPrompt(false,b)}}}function updateDescriptionPrompt(f,g){var a="Please describe your reason for reporting "+g+" using as much detail as possible";var b="Please add any other information that would be helpful";var c=$("abuse_report_description_label_block").innerHTML;var e;if(f){e=c.gsub(b,a)}else{e=c.gsub(a,b)}$("abuse_report_description_label_block").update(e)}function upd(a,b,c){if(a.checked||c=="always"){if(c){index=a.id.substring(a.id.indexOf("[")+1,a.id.indexOf("]"));radio_id="handle["+index+"]";$(radio_id).checked="handle"}if(b){b.show()}}else{if(b){b.hide()}}}function AgeGate(){if(arguments[0]&&arguments[1]){this.initialize(arguments[0],arguments[1])}else{this.initialize(null,arguments[0])}}AgeGate.MONTHS=["January","February","March","April","May","June","July","August","September","October","November","December"];AgeGate.prototype={initialize:function(c,a){var b=this;this._cookie_name=a.cookie_name||"age_gate";this._active_user=a.active_user||active_user;this._required_age=a.required_age;this._age_met=false;this._use_form=a.use_form===undefined?true:a.use_form;if(this._use_form){this._element=$(c);this._button_text=a.button_text||"Go"}this._onSuccess=(a.onSuccess||function(){}).wrap(function(f){b._age_met=true;Cookie.set(b._cookie_name,"YES");return f()});this._onFailure=(a.onFailure||function(){}).wrap(function(f){Cookie.set(b._cookie_name,"NO");return f()});this._onError=a.onError||function(){};var e=this.preflight();if(!(e||this._age_met)){if(this._use_form){this.writeForm()}else{this._onFailure()}}},preflight:function(){var a=this._active_user.age();if(a){if(a>=this._required_age){this._onSuccess()}else{this._onFailure()}return true}var b=Cookie.get(this._cookie_name);if(b=="YES"){this._onSuccess();return true}else{if(b=="NO"){this._onFailure();return true}}return false},writeForm:function(){var b=this,c="",a=0;c='<form action="#">';c+="<dl>";c+="<dt><label>Date of Birth</label></dt>";c+='<dd id="date">';c+='<select id="user_month" name="user_month">';c+='<option value=""></option>';for(a=0;a<AgeGate.MONTHS.length;a++){c+='<option value="'+a+'">'+AgeGate.MONTHS[a]+"</option>"}c+="</select>";c+='<select id="user_day" name="user_day">';c+='<option value=""></option>';for(a=1;a<=31;a++){c+='<option value="'+a+'">'+a+"</option>"}c+="</select>";c+='<select id="user_year" name="user_year">';c+='<option value=""></option>';for(a=2005;a>=1908;a--){c+='<option value="'+a+'">'+a+"</option>"}c+="</select>";c+="</dd>";c+="</dl>";c+='<input type="submit" value="'+this._button_text+'" />';c+="</form>";this._element.innerHTML+=c;(function(){b._element.immediateDescendants()[0].onsubmit=function(){b.checkAge(this);return false}}).defer()},checkAge:function(e){var f=Number(e.user_month.getValue()),b=Number(e.user_day.getValue()),c=Number(e.user_year.getValue());if(isNaN(f)||b===0||c===0){this._onError();return}var g=new Date((c+this._required_age),f,b),a=new Date();if((a.getTime()-g.getTime())<0){this._onFailure()}else{this._onSuccess()}}};function hideAllButOne(b,a){$$(b).each(function(c){Element.hide(c)});Element.show(a)}Array.prototype.binarySearch=function binarySearch(h,b,g){if(!b){b=function(l,j){return((l==j)?0:((l<j)?-1:1))}}var a=0;var f=this.length-1;var c,e;while(a<=f){c=parseInt((a+f)/2,10);e=b(this[c],h);if(e<0){a=c+1;continue}if(e>0){f=c-1;continue}return c}if(g){return a}return -1};Array.prototype.orderedInsert=function orderedInsert(c,a){var b=this.binarySearch(c,a,true);this.splice(b,0,c);return b};Array.prototype.orderedDelete=function orderedDelete(c,a){var b=this.binarySearch(c,a);if(b>=0){this.splice(b,1)}return b};var BrowserDetect={init:function(){this.browser=this.searchString(this.dataBrowser)||"An unknown browser";this.version=this.searchVersion(navigator.userAgent)||this.searchVersion(navigator.appVersion)||"an unknown version";this.OS=this.searchString(this.dataOS)||"an unknown OS"},searchString:function(e){for(var a=0;a<e.length;a++){var b=e[a].string;var c=e[a].prop;this.versionSearchString=e[a].versionSearch||e[a].identity;if(b){if(b.indexOf(e[a].subString)!=-1){return e[a].identity}}else{if(c){return e[a].identity}}}},searchVersion:function(b){var a=b.indexOf(this.versionSearchString);if(a==-1){return}return parseFloat(b.substring(a+this.versionSearchString.length+1))},dataBrowser:[{string:navigator.userAgent,subString:"OmniWeb",versionSearch:"OmniWeb/",identity:"OmniWeb"},{string:navigator.vendor,subString:"Apple",identity:"Safari"},{prop:window.opera,identity:"Opera"},{string:navigator.vendor,subString:"iCab",identity:"iCab"},{string:navigator.vendor,subString:"KDE",identity:"Konqueror"},{string:navigator.userAgent,subString:"Firefox",identity:"Firefox"},{string:navigator.vendor,subString:"Camino",identity:"Camino"},{string:navigator.userAgent,subString:"Netscape",identity:"Netscape"},{string:navigator.userAgent,subString:"MSIE",identity:"Explorer",versionSearch:"MSIE"},{string:navigator.userAgent,subString:"Gecko",identity:"Mozilla",versionSearch:"rv"},{string:navigator.userAgent,subString:"Mozilla",identity:"Netscape",versionSearch:"Mozilla"}],dataOS:[{string:navigator.platform,subString:"Win",identity:"Windows"},{string:navigator.platform,subString:"Mac",identity:"Mac"},{string:navigator.platform,subString:"Linux",identity:"Linux"}]};function bumperAdVersion(){return 3}function initBumperAd(a){bumperAd=new Bumper(a)}function embedAd(a){if(!bumperAd.isTimedOut()){try{if(bumperAd.validateAdResponse(a)){bumperAd.processAdResponse(a);bumperAd.showAd()}else{bumperAd.showContent()}}catch(b){bumperAd.closeAd()}}}function Bumper(a){this.initialize(a)}Bumper.HTML_TEMPLATE=new Template('<html lang="en" xml:lang="en" xmlns="http://www.w3.org/1999/xhtml"><head><title>Kongregate</title><style type="text/css">img{border-style:none;}html,body,div{padding:0;margin:0;border:none;overflow:hidden;background-color:#000}</style></head><body>#{body}</body></html>');Bumper.JAVASCRIPT_TEMPLATE=new Template('<script type="text/javascript" src="#{src}"><\/script>');Bumper.IFRAME_TEMPLATE=new Template("<iframe id='ad_iframe' name='ad_iframe' style='overflow:hidden;position:relative;top:0px;left:0px;padding:0;margin:0;border:none;width:#{width}px;;height:#{height}px;background-color:#000' scrolling='no' border='0' frameborder='0' #{extra}></iframe>");Bumper.prototype={initialize:function(a){this._timed_out=false;this._response_received=false;this._content_rendered=false;this._closed=false;this._options={};this._internal=null;this._shown=false;this._content_divs=a.content_divs;this._render_function=a.render_function;this._ansense_swf_path=a.adsense_swf_path;this._category=a.category;this._debug=a.debug},getOption:function(a){return(this._options[a])},isTimedOut:function(){return(this._timed_out)},wasShown:function(){return(this._shown)},requestAd:function(){this.initAdTimeouts();if(GA_available){GA_googleFillSlot("kong_bumper_preroll_600x400")}else{this.showContent()}},initAdTimeouts:function(){setTimeout(this.adResponseTimeout.bind(this),3000)},processAdResponse:function(b){var f=b.type,e=this._content_divs[f];var j=e.getDimensions(),c=j.width,a=j.height;b.countdown=!!b.countdown;b.preload=!!b.preload;var g=navigator.userAgent.toLowerCase();if(b.content_type=="adsense_video"){b.preload=false}this._options=b;this._parent=e;this._type=f;this._response_received=true;this.hideContent();if(b.preload){this.renderContent()}if(b.content_type=="adsense_video"){this._width=c;this._height=a;this._x=0;this._y=0}else{var h=20;this._width=b.width;this._height=b.height;this._x=(c-this._width)/2;this._y=(a-(this._height+h))/2}},validateAdResponse:function(a){if(a.type||a.url){a.type=(a.type)?a.type:"bumper";if(a.type=="bumper"||a.type=="superbumper"){a.content_type=(a.content_type)?a.content_type:"image";if(a.content_type=="image"||a.content_type=="adsense_video"||a.content_type=="swf"||a.content_type=="javascript"||a.content_type=="iframe"||a.content_type=="html"){return(true)}}}return(false)},showAd:function(){var f=this._parent.getDimensions(),b=f.width,a=f.height;this.insertAdDivs(b,a);this.showUncoveredContent();switch(this.getOption("content_type")){case"javascript":this.showJavascriptAd();break;case"image":this.showBumperImageAd();break;case"swf":this.showBumperFlashAd();break;case"adsense_video":this.showAdsenseVideoAd();break;case"iframe":this.showIframeAd();break;case"html":this.showHtmlAd();break}try{if(pageTracker){pageTracker._setVar("bumper_shown")}}catch(c){}},showBumperImageAd:function(){var a=this._options;$("ad_content").insert("<img id='ad_image' alt='' src='"+a.url+"'/>");$("ad_image").observe("click",function(){window.open(a.click_url)});this.insertCountdownText()},showAdsenseVideoAd:function(){var b=this._ansense_swf_path,e=this.getOption("duration"),c=this.getOption("allow_text_ads"),a={category:this._category,permalink:this._permalink,debug_enabled:this._debug,fullscreen_enabled:c,duration:e};swfobject.embedSWF(b,"ad_holder",this._width,this._height,"6",false,a,{allownetworking:"all",allowscriptaccess:"always",wmode:"opaque"},{})},showBumperFlashAd:function(){swfobject.embedSWF(this.getOption("url"),"ad_content",this._width,this._height,"6",false,{},{allownetworking:"all",wmode:"opaque"},{});this.insertCountdownText()},showIframeAd:function(){$("ad_content").innerHTML=Bumper.IFRAME_TEMPLATE.evaluate({width:this._width,height:this._height,extra:"src='"+this.getOption("url")+"'"});this.insertCountdownText()},showJavascriptAd:function(){this._options.html=escape(Bumper.JAVASCRIPT_TEMPLATE.evaluate({src:this.getOption("url")}));this.showHtmlAd()},showHtmlAd:function(){$("ad_content").update(Bumper.IFRAME_TEMPLATE.evaluate({width:this._width,height:this._height,extra:""}));var a=Bumper.HTML_TEMPLATE.evaluate({body:unescape(this.getOption("html"))});this.insertCountdownText();setTimeout(function(){var b=$("ad_iframe"),c=window.frames.ad_iframe.document;if(c==null){if(b.contentDocument){c=b.contentDocument}else{if(b.contentWindow){c=b.contentWindow.document}}}c.open();c.write(a);if(!!window.opera){c.close()}}.bind(this),0)},insertCountdownText:function(){var a=this._options;if(this._closed){return}if(a.countdown){$("ad_label").innerHTML='<div id="ad_label_countdown" style="display: inline"></div><a href="javascript:bumperAd.closeAd();" style="color: #900; margin-left: 2px">&#40;close&#41;</a>';this.updateAdDurationText(a.duration)}else{var b=(!!a.preload)?"Your game is loading, and this ad will close automatically":"This ad will close automatically";$("ad_label").innerHTML=b+" <a style='color: #900' href='javascript:bumperAd.closeAd();'>&#40;close&#41;</a>"}setTimeout(function(){this._end_time=(new Date()).getTime()+a.duration;this._interval=setInterval(this.checkAdDuration.bind(this),250);this.updateAdDurationText(a.duration)}.bind(this),500);setTimeout(function(){if($("ad_label")){$("ad_label").appear({duration:1})}},1500)},closeAd:function(){if(!this._closed){setTimeout(this.removeAd.bind(this),0);this._closed=true;this.showContent();clearInterval(this._interval)}},removeAd:function(){if($("ad_content")){$("ad_content").remove()}if($("ad_holder")){$("ad_holder").remove();if(!!navigator.userAgent.toLowerCase().match(/safari/)){window.scrollBy(0,1);window.scrollBy(0,-1)}}},checkAdDuration:function(){var a=this._end_time-(new Date()).getTime();if(a>0){this.updateAdDurationText(a)}else{this.closeAd()}},updateAdDurationText:function(b){if(this.getOption("countdown")&&!this._closed){var a=Math.round(b/1000);$("ad_label_countdown").innerHTML=(this.getOption("preload")?"Your game is loading ":"This ad will close automatically ")+a}},showContent:function(){this.renderContent();for(var a in this._content_divs){if(!lightbox.prototype._activated){if(!this._content_divs[a].hiddenByLightbox){this._content_divs[a].style.visibility="visible"}}else{lightbox.prototype._dom_elements_actually_hidden.push(this._content_divs[a])}}},hideContent:function(){for(var a in this._content_divs){if(a==this._type||this._type=="superbumper"){this._content_divs[a].style.visibility="hidden"}}},adResponseTimeout:function(){if(!this._response_received){this.timed_out=true;this.closeAd()}},showUncoveredContent:function(){if(this._type!="superbumper"){for(var a in this._content_divs){if(a!=this._type&&this._content_divs[a].hiddenByLightbox){this._content_divs[a].style.visibility="visible"}}}},renderContent:function(){if(!this._content_rendered){this._content_rendered=true;this._render_function()}},insertAdDivs:function(b,a){this._parent.insert("<div id='ad_holder' name='ad_holder' style='position:absolute; width:"+b+"px; height:"+a+"px; visibility:hidden; z-index: 9999998; background-color:#000; overflow:hidden'></div>");$("ad_holder").insert("<div id='ad' name='ad' style='position:relative;'>");$("ad").insert("<div id='ad_content'></div><div id='ad_label' style='display:none; font: 11px Verdana, Arial, sans-serif; color: #fff;text-align: center'></div>");$("ad").setStyle({top:this._y+"px",left:"0px"});$("ad_holder").setStyle({visibility:"visible",top:"0px",left:"0px"})}};var Cookie={set:function(b,e,a,f){var c=(escape(b)+"="+escape(e||""));if(a!==undefined){var g=new Date();g.setTime(g.getTime()+(86400000*parseFloat(a)));c+="; expires="+g.toGMTString()}if(f){c+="; path="+f}return(document.cookie=c)},get:function(a){var b=document.cookie.match(new RegExp("(^|;)\\s*"+escape(a)+"=([^;\\s]*)"));return(b?unescape(b[2].gsub(/\+/,"%20")):null)},erase:function(a,c){var b=Cookie.get(a)||true;Cookie.set(a,"",-1,c);return b},accept:function(){if(typeof navigator.cookieEnabled=="boolean"){return navigator.cookieEnabled}Cookie.set("_test","1");return(Cookie.erase("_test")==="1")}};if(Object.isUndefined(Effect)){throw ("dragdrop.js requires including script.aculo.us' effects.js library")}var Droppables={drops:[],remove:function(a){this.drops=this.drops.reject(function(b){return b.element==$(a)})},add:function(b){b=$(b);var a=Object.extend({greedy:true,hoverclass:null,tree:false},arguments[1]||{});if(a.containment){a._containers=[];var c=a.containment;if(Object.isArray(c)){c.each(function(e){a._containers.push($(e))})}else{a._containers.push($(c))}}if(a.accept){a.accept=[a.accept].flatten()}Element.makePositioned(b);a.element=b;this.drops.push(a)},findDeepestChild:function(a){deepest=a[0];for(i=1;i<a.length;++i){if(Element.isParent(a[i].element,deepest.element)){deepest=a[i]}}return deepest},isContained:function(b,a){var c;if(a.tree){c=b.treeNode}else{c=b.parentNode}return a._containers.detect(function(e){return c==e})},isAffected:function(a,c,b){return((b.element!=c)&&((!b._containers)||this.isContained(c,b))&&((!b.accept)||(Element.classNames(c).detect(function(e){return b.accept.include(e)})))&&Position.within(b.element,a[0],a[1]))},deactivate:function(a){if(a.hoverclass){Element.removeClassName(a.element,a.hoverclass)}this.last_active=null},activate:function(a){if(a.hoverclass){Element.addClassName(a.element,a.hoverclass)}this.last_active=a},show:function(a,c){if(!this.drops.length){return}var b,e=[];this.drops.each(function(f){if(Droppables.isAffected(a,c,f)){e.push(f)}});if(e.length>0){b=Droppables.findDeepestChild(e)}if(this.last_active&&this.last_active!=b){this.deactivate(this.last_active)}if(b){Position.within(b.element,a[0],a[1]);if(b.onHover){b.onHover(c,b.element,Position.overlap(b.overlap,b.element))}if(b!=this.last_active){Droppables.activate(b)}}},fire:function(b,a){if(!this.last_active){return}Position.prepare();if(this.isAffected([Event.pointerX(b),Event.pointerY(b)],a,this.last_active)){if(this.last_active.onDrop){this.last_active.onDrop(a,this.last_active.element,b);return true}}},reset:function(){if(this.last_active){this.deactivate(this.last_active)}}};var Draggables={drags:[],observers:[],register:function(a){if(this.drags.length==0){this.eventMouseUp=this.endDrag.bindAsEventListener(this);this.eventMouseMove=this.updateDrag.bindAsEventListener(this);this.eventKeypress=this.keyPress.bindAsEventListener(this);Event.observe(document,"mouseup",this.eventMouseUp);Event.observe(document,"mousemove",this.eventMouseMove);Event.observe(document,"keypress",this.eventKeypress)}this.drags.push(a)},unregister:function(a){this.drags=this.drags.reject(function(b){return b==a});if(this.drags.length==0){Event.stopObserving(document,"mouseup",this.eventMouseUp);Event.stopObserving(document,"mousemove",this.eventMouseMove);Event.stopObserving(document,"keypress",this.eventKeypress)}},activate:function(a){if(a.options.delay){this._timeout=setTimeout(function(){Draggables._timeout=null;window.focus();Draggables.activeDraggable=a}.bind(this),a.options.delay)}else{window.focus();this.activeDraggable=a}},deactivate:function(){this.activeDraggable=null},updateDrag:function(a){if(!this.activeDraggable){return}var b=[Event.pointerX(a),Event.pointerY(a)];if(this._lastPointer&&(this._lastPointer.inspect()==b.inspect())){return}this._lastPointer=b;this.activeDraggable.updateDrag(a,b)},endDrag:function(a){if(this._timeout){clearTimeout(this._timeout);this._timeout=null}if(!this.activeDraggable){return}this._lastPointer=null;this.activeDraggable.endDrag(a);this.activeDraggable=null},keyPress:function(a){if(this.activeDraggable){this.activeDraggable.keyPress(a)}},addObserver:function(a){this.observers.push(a);this._cacheObserverCallbacks()},removeObserver:function(a){this.observers=this.observers.reject(function(b){return b.element==a});this._cacheObserverCallbacks()},notify:function(b,a,c){if(this[b+"Count"]>0){this.observers.each(function(e){if(e[b]){e[b](b,a,c)}})}if(a.options[b]){a.options[b](a,c)}},_cacheObserverCallbacks:function(){["onStart","onEnd","onDrag"].each(function(a){Draggables[a+"Count"]=Draggables.observers.select(function(b){return b[a]}).length})}};var Draggable=Class.create({initialize:function(b){var c={handle:false,reverteffect:function(g,f,e){var h=Math.sqrt(Math.abs(f^2)+Math.abs(e^2))*0.02;new Effect.Move(g,{x:-e,y:-f,duration:h,queue:{scope:"_draggable",position:"end"}})},endeffect:function(f){var e=Object.isNumber(f._opacity)?f._opacity:1;new Effect.Opacity(f,{duration:0.2,from:0.7,to:e,queue:{scope:"_draggable",position:"end"},afterFinish:function(){Draggable._dragging[f]=false}})},zindex:1000,revert:false,quiet:false,scroll:false,scrollSensitivity:20,scrollSpeed:15,snap:false,delay:0};if(!arguments[1]||Object.isUndefined(arguments[1].endeffect)){Object.extend(c,{starteffect:function(e){e._opacity=Element.getOpacity(e);Draggable._dragging[e]=true;new Effect.Opacity(e,{duration:0.2,from:e._opacity,to:0.7})}})}var a=Object.extend(c,arguments[1]||{});this.element=$(b);if(a.handle&&Object.isString(a.handle)){this.handle=this.element.down("."+a.handle,0)}if(!this.handle){this.handle=$(a.handle)}if(!this.handle){this.handle=this.element}if(a.scroll&&!a.scroll.scrollTo&&!a.scroll.outerHTML){a.scroll=$(a.scroll);this._isScrollChild=Element.childOf(this.element,a.scroll)}Element.makePositioned(this.element);this.options=a;this.dragging=false;this.eventMouseDown=this.initDrag.bindAsEventListener(this);Event.observe(this.handle,"mousedown",this.eventMouseDown);Draggables.register(this)},destroy:function(){Event.stopObserving(this.handle,"mousedown",this.eventMouseDown);Draggables.unregister(this)},currentDelta:function(){return([parseInt(Element.getStyle(this.element,"left")||"0"),parseInt(Element.getStyle(this.element,"top")||"0")])},initDrag:function(a){if(!Object.isUndefined(Draggable._dragging[this.element])&&Draggable._dragging[this.element]){return}if(Event.isLeftClick(a)){var c=Event.element(a);if((tag_name=c.tagName.toUpperCase())&&(tag_name=="INPUT"||tag_name=="SELECT"||tag_name=="OPTION"||tag_name=="BUTTON"||tag_name=="TEXTAREA")){return}var b=[Event.pointerX(a),Event.pointerY(a)];var e=Position.cumulativeOffset(this.element);this.offset=[0,1].map(function(f){return(b[f]-e[f])});Draggables.activate(this);Event.stop(a)}},startDrag:function(b){this.dragging=true;if(!this.delta){this.delta=this.currentDelta()}if(this.options.zindex){this.originalZ=parseInt(Element.getStyle(this.element,"z-index")||0);this.element.style.zIndex=this.options.zindex}if(this.options.ghosting){this._clone=this.element.cloneNode(true);this._originallyAbsolute=(this.element.getStyle("position")=="absolute");if(!this._originallyAbsolute){Position.absolutize(this.element)}this.element.parentNode.insertBefore(this._clone,this.element)}if(this.options.scroll){if(this.options.scroll==window){var a=this._getWindowScroll(this.options.scroll);this.originalScrollLeft=a.left;this.originalScrollTop=a.top}else{this.originalScrollLeft=this.options.scroll.scrollLeft;this.originalScrollTop=this.options.scroll.scrollTop}}Draggables.notify("onStart",this,b);if(this.options.starteffect){this.options.starteffect(this.element)}},updateDrag:function(event,pointer){if(!this.dragging){this.startDrag(event)}if(!this.options.quiet){Position.prepare();Droppables.show(pointer,this.element)}Draggables.notify("onDrag",this,event);this.draw(pointer);if(this.options.change){this.options.change(this)}if(this.options.scroll){this.stopScrolling();var p;if(this.options.scroll==window){with(this._getWindowScroll(this.options.scroll)){p=[left,top,left+width,top+height]}}else{p=Position.page(this.options.scroll);p[0]+=this.options.scroll.scrollLeft+Position.deltaX;p[1]+=this.options.scroll.scrollTop+Position.deltaY;p.push(p[0]+this.options.scroll.offsetWidth);p.push(p[1]+this.options.scroll.offsetHeight)}var speed=[0,0];if(pointer[0]<(p[0]+this.options.scrollSensitivity)){speed[0]=pointer[0]-(p[0]+this.options.scrollSensitivity)}if(pointer[1]<(p[1]+this.options.scrollSensitivity)){speed[1]=pointer[1]-(p[1]+this.options.scrollSensitivity)}if(pointer[0]>(p[2]-this.options.scrollSensitivity)){speed[0]=pointer[0]-(p[2]-this.options.scrollSensitivity)}if(pointer[1]>(p[3]-this.options.scrollSensitivity)){speed[1]=pointer[1]-(p[3]-this.options.scrollSensitivity)}this.startScrolling(speed)}if(Prototype.Browser.WebKit){window.scrollBy(0,0)}Event.stop(event)},finishDrag:function(b,f){this.dragging=false;if(this.options.quiet){Position.prepare();var e=[Event.pointerX(b),Event.pointerY(b)];Droppables.show(e,this.element)}if(this.options.ghosting){if(!this._originallyAbsolute){Position.relativize(this.element)}delete this._originallyAbsolute;Element.remove(this._clone);this._clone=null}var g=false;if(f){g=Droppables.fire(b,this.element);if(!g){g=false}}if(g&&this.options.onDropped){this.options.onDropped(this.element)}Draggables.notify("onEnd",this,b);var a=this.options.revert;if(a&&Object.isFunction(a)){a=a(this.element)}var c=this.currentDelta();if(a&&this.options.reverteffect){if(g==0||a!="failure"){this.options.reverteffect(this.element,c[1]-this.delta[1],c[0]-this.delta[0])}}else{this.delta=c}if(this.options.zindex){this.element.style.zIndex=this.originalZ}if(this.options.endeffect){this.options.endeffect(this.element)}Draggables.deactivate(this);Droppables.reset()},keyPress:function(a){if(a.keyCode!=Event.KEY_ESC){return}this.finishDrag(a,false);Event.stop(a)},endDrag:function(a){if(!this.dragging){return}this.stopScrolling();this.finishDrag(a,true);Event.stop(a)},draw:function(a){var g=Position.cumulativeOffset(this.element);if(this.options.ghosting){var c=Position.realOffset(this.element);g[0]+=c[0]-Position.deltaX;g[1]+=c[1]-Position.deltaY}var f=this.currentDelta();g[0]-=f[0];g[1]-=f[1];if(this.options.scroll&&(this.options.scroll!=window&&this._isScrollChild)){g[0]-=this.options.scroll.scrollLeft-this.originalScrollLeft;g[1]-=this.options.scroll.scrollTop-this.originalScrollTop}var e=[0,1].map(function(h){return(a[h]-g[h]-this.offset[h])}.bind(this));if(this.options.snap){if(Object.isFunction(this.options.snap)){e=this.options.snap(e[0],e[1],this)}else{if(Object.isArray(this.options.snap)){e=e.map(function(h,j){return(h/this.options.snap[j]).round()*this.options.snap[j]}.bind(this))}else{e=e.map(function(h){return(h/this.options.snap).round()*this.options.snap}.bind(this))}}}var b=this.element.style;if((!this.options.constraint)||(this.options.constraint=="horizontal")){b.left=e[0]+"px"}if((!this.options.constraint)||(this.options.constraint=="vertical")){b.top=e[1]+"px"}if(b.visibility=="hidden"){b.visibility=""}},stopScrolling:function(){if(this.scrollInterval){clearInterval(this.scrollInterval);this.scrollInterval=null;Draggables._lastScrollPointer=null}},startScrolling:function(a){if(!(a[0]||a[1])){return}this.scrollSpeed=[a[0]*this.options.scrollSpeed,a[1]*this.options.scrollSpeed];this.lastScrolled=new Date();this.scrollInterval=setInterval(this.scroll.bind(this),10)},scroll:function(){var current=new Date();var delta=current-this.lastScrolled;this.lastScrolled=current;if(this.options.scroll==window){with(this._getWindowScroll(this.options.scroll)){if(this.scrollSpeed[0]||this.scrollSpeed[1]){var d=delta/1000;this.options.scroll.scrollTo(left+d*this.scrollSpeed[0],top+d*this.scrollSpeed[1])}}}else{this.options.scroll.scrollLeft+=this.scrollSpeed[0]*delta/1000;this.options.scroll.scrollTop+=this.scrollSpeed[1]*delta/1000}Position.prepare();Droppables.show(Draggables._lastPointer,this.element);Draggables.notify("onDrag",this);if(this._isScrollChild){Draggables._lastScrollPointer=Draggables._lastScrollPointer||$A(Draggables._lastPointer);Draggables._lastScrollPointer[0]+=this.scrollSpeed[0]*delta/1000;Draggables._lastScrollPointer[1]+=this.scrollSpeed[1]*delta/1000;if(Draggables._lastScrollPointer[0]<0){Draggables._lastScrollPointer[0]=0}if(Draggables._lastScrollPointer[1]<0){Draggables._lastScrollPointer[1]=0}this.draw(Draggables._lastScrollPointer)}if(this.options.change){this.options.change(this)}},_getWindowScroll:function(w){var T,L,W,H;with(w.document){if(w.document.documentElement&&documentElement.scrollTop){T=documentElement.scrollTop;L=documentElement.scrollLeft}else{if(w.document.body){T=body.scrollTop;L=body.scrollLeft}}if(w.innerWidth){W=w.innerWidth;H=w.innerHeight}else{if(w.document.documentElement&&documentElement.clientWidth){W=documentElement.clientWidth;H=documentElement.clientHeight}else{W=body.offsetWidth;H=body.offsetHeight}}}return{top:T,left:L,width:W,height:H}}});Draggable._dragging={};var SortableObserver=Class.create({initialize:function(b,a){this.element=$(b);this.observer=a;this.lastValue=Sortable.serialize(this.element)},onStart:function(){this.lastValue=Sortable.serialize(this.element)},onEnd:function(){Sortable.unmark();if(this.lastValue!=Sortable.serialize(this.element)){this.observer(this.element)}}});var Sortable={SERIALIZE_RULE:/^[^_\-](?:[A-Za-z0-9\-\_]*)[_](.*)$/,sortables:{},_findRootElement:function(a){while(a.tagName.toUpperCase()!="BODY"){if(a.id&&Sortable.sortables[a.id]){return a}a=a.parentNode}},options:function(a){a=Sortable._findRootElement($(a));if(!a){return}return Sortable.sortables[a.id]},destroy:function(a){a=$(a);var b=Sortable.sortables[a.id];if(b){Draggables.removeObserver(b.element);b.droppables.each(function(c){Droppables.remove(c)});b.draggables.invoke("destroy");delete Sortable.sortables[b.element.id]}},create:function(c){c=$(c);var b=Object.extend({element:c,tag:"li",dropOnEmpty:false,tree:false,treeTag:"ul",overlap:"vertical",constraint:"vertical",containment:c,handle:false,only:false,delay:0,hoverclass:null,ghosting:false,quiet:false,scroll:false,scrollSensitivity:20,scrollSpeed:15,format:this.SERIALIZE_RULE,elements:false,handles:false,onChange:Prototype.emptyFunction,onUpdate:Prototype.emptyFunction},arguments[1]||{});this.destroy(c);var a={revert:true,quiet:b.quiet,scroll:b.scroll,scrollSpeed:b.scrollSpeed,scrollSensitivity:b.scrollSensitivity,delay:b.delay,ghosting:b.ghosting,constraint:b.constraint,handle:b.handle};if(b.starteffect){a.starteffect=b.starteffect}if(b.reverteffect){a.reverteffect=b.reverteffect}else{if(b.ghosting){a.reverteffect=function(g){g.style.top=0;g.style.left=0}}}if(b.endeffect){a.endeffect=b.endeffect}if(b.zindex){a.zindex=b.zindex}var e={overlap:b.overlap,containment:b.containment,tree:b.tree,hoverclass:b.hoverclass,onHover:Sortable.onHover};var f={onHover:Sortable.onEmptyHover,overlap:b.overlap,containment:b.containment,hoverclass:b.hoverclass};Element.cleanWhitespace(c);b.draggables=[];b.droppables=[];if(b.dropOnEmpty||b.tree){Droppables.add(c,f);b.droppables.push(c)}(b.elements||this.findElements(c,b)||[]).each(function(j,g){var h=b.handles?$(b.handles[g]):(b.handle?$(j).select("."+b.handle)[0]:j);b.draggables.push(new Draggable(j,Object.extend(a,{handle:h})));Droppables.add(j,e);if(b.tree){j.treeNode=c}b.droppables.push(j)});if(b.tree){(Sortable.findTreeElements(c,b)||[]).each(function(g){Droppables.add(g,f);g.treeNode=c;b.droppables.push(g)})}this.sortables[c.id]=b;Draggables.addObserver(new SortableObserver(c,b.onUpdate))},findElements:function(b,a){return Element.findChildren(b,a.only,a.tree?true:false,a.tag)},findTreeElements:function(b,a){return Element.findChildren(b,a.only,a.tree?true:false,a.treeTag)},onHover:function(f,e,a){if(Element.isParent(e,f)){return}if(a>0.33&&a<0.66&&Sortable.options(e).tree){return}else{if(a>0.5){Sortable.mark(e,"before");if(e.previousSibling!=f){var b=f.parentNode;f.style.visibility="hidden";e.parentNode.insertBefore(f,e);if(e.parentNode!=b){Sortable.options(b).onChange(f)}Sortable.options(e.parentNode).onChange(f)}}else{Sortable.mark(e,"after");var c=e.nextSibling||null;if(c!=f){var b=f.parentNode;f.style.visibility="hidden";e.parentNode.insertBefore(f,c);if(e.parentNode!=b){Sortable.options(b).onChange(f)}Sortable.options(e.parentNode).onChange(f)}}}},onEmptyHover:function(f,h,j){var l=f.parentNode;var a=Sortable.options(h);if(!Element.isParent(h,f)){var g;var c=Sortable.findElements(h,{tag:a.tag,only:a.only});var b=null;if(c){var e=Element.offsetSize(h,a.overlap)*(1-j);for(g=0;g<c.length;g+=1){if(e-Element.offsetSize(c[g],a.overlap)>=0){e-=Element.offsetSize(c[g],a.overlap)}else{if(e-(Element.offsetSize(c[g],a.overlap)/2)>=0){b=g+1<c.length?c[g+1]:null;break}else{b=c[g];break}}}}h.insertBefore(f,b);Sortable.options(l).onChange(f);a.onChange(f)}},unmark:function(){if(Sortable._marker){Sortable._marker.hide()}},mark:function(b,a){var e=Sortable.options(b.parentNode);if(e&&!e.ghosting){return}if(!Sortable._marker){Sortable._marker=($("dropmarker")||Element.extend(document.createElement("DIV"))).hide().addClassName("dropmarker").setStyle({position:"absolute"});document.getElementsByTagName("body").item(0).appendChild(Sortable._marker)}var c=Position.cumulativeOffset(b);Sortable._marker.setStyle({left:c[0]+"px",top:c[1]+"px"});if(a=="after"){if(e.overlap=="horizontal"){Sortable._marker.setStyle({left:(c[0]+b.clientWidth)+"px"})}else{Sortable._marker.setStyle({top:(c[1]+b.clientHeight)+"px"})}}Sortable._marker.show()},_tree:function(f,b,g){var e=Sortable.findElements(f,b)||[];for(var c=0;c<e.length;++c){var a=e[c].id.match(b.format);if(!a){continue}var h={id:encodeURIComponent(a?a[1]:null),element:f,parent:g,children:[],position:g.children.length,container:$(e[c]).down(b.treeTag)};if(h.container){this._tree(h.container,b,h)}g.children.push(h)}return g},tree:function(e){e=$(e);var c=this.options(e);var b=Object.extend({tag:c.tag,treeTag:c.treeTag,only:c.only,name:e.id,format:c.format},arguments[1]||{});var a={id:null,parent:null,children:[],container:e,position:0};return Sortable._tree(e,b,a)},_constructIndex:function(b){var a="";do{if(b.id){a="["+b.position+"]"+a}}while((b=b.parent)!=null);return a},sequence:function(b){b=$(b);var a=Object.extend(this.options(b),arguments[1]||{});return $(this.findElements(b,a)||[]).map(function(c){return c.id.match(a.format)?c.id.match(a.format)[1]:""})},setSequence:function(b,c){b=$(b);var a=Object.extend(this.options(b),arguments[2]||{});var e={};this.findElements(b,a).each(function(f){if(f.id.match(a.format)){e[f.id.match(a.format)[1]]=[f,f.parentNode]}f.parentNode.removeChild(f)});c.each(function(f){var g=e[f];if(g){g[1].appendChild(g[0]);delete e[f]}})},serialize:function(c){c=$(c);var b=Object.extend(Sortable.options(c),arguments[1]||{});var a=encodeURIComponent((arguments[1]&&arguments[1].name)?arguments[1].name:c.id);if(b.tree){return Sortable.tree(c,arguments[1]).children.map(function(e){return[a+Sortable._constructIndex(e)+"[id]="+encodeURIComponent(e.id)].concat(e.children.map(arguments.callee))}).flatten().join("&")}else{return Sortable.sequence(c,arguments[1]).map(function(e){return a+"[]="+encodeURIComponent(e)}).join("&")}}};Element.isParent=function(b,a){if(!b.parentNode||b==a){return false}if(b.parentNode==a){return true}return Element.isParent(b.parentNode,a)};Element.findChildren=function(e,b,a,c){if(!e.hasChildNodes()){return null}c=c.toUpperCase();if(b){b=[b].flatten()}var f=[];$A(e.childNodes).each(function(h){if(h.tagName&&h.tagName.toUpperCase()==c&&(!b||(Element.classNames(h).detect(function(j){return b.include(j)})))){f.push(h)}if(a){var g=Element.findChildren(h,b,a,c);if(g){f.push(g)}}});return(f.length>0?f.flatten():[])};Element.offsetSize=function(a,b){return a["offset"+((b=="vertical"||b=="height")?"Height":"Width")]};function FlashMessages(a){this.initialize(a)}FlashMessages.DISPLAY_TEMPLATE=new Template('<div class="sitemessage"><h2>#{message}</h2></div>');FlashMessages.prototype={initialize:function(a){this._messages_node=$("global");this._insertMessages();this._pageTracker=a.pageTracker;this._reported_tracking_codes={};this.reportTrackingCode()},data:function(){this._getDataFromCookie();return this._data},reportTrackingCode:function(){this._reportTrackingCodeWithPageView();this._reportTrackingCodeWithoutPageView()},_getDataFromCookie:function(){var a=Cookie.get("kong_flash_messages");if(a){a=a.evalJSON();if(!this._data){this._data=a}else{Object.extend(this._data,a)}}else{this._data={}}this._clearCookie()},_insertMessages:function(){if(this._messages_node){this._messages_node.innerHTML=this.data().messages.map(function(a){return FlashMessages.DISPLAY_TEMPLATE.evaluate({message:a})}).join()}},_clearCookie:function(){Cookie.erase("kong_flash_messages")},_reportTrackingCodeWithPageView:function(){this._reportTrackingCodeWithReporter(this.data().tracking_code,function(a){var b=a.split("?");this._pageTracker._trackPageview(a);this._pageTracker._trackEvent(b[0],b[1]||"")});this._data.tracking_code=undefined},_reportTrackingCodeWithoutPageView:function(){this._reportTrackingCodeWithReporter(this.data().minor_tracking_code,function(a){var b=a.split("?");this._pageTracker._trackEvent(b[0],b[1]||"")});this._data.minor_tracking_code=undefined},_reportTrackingCodeWithReporter:function(c,a){if(!c||!this._pageTracker){return}var b=(new Date()).getTime(),e=this._reported_tracking_codes[c];if(!e||(b-e>15000)){this._reported_tracking_codes[c]=b;a.bind(this)(c)}}};var FormRow=Class.create({initialize:function(f,c,h,b,e){this._formCallback=e;this._tr=new Element("tr");var g=this._createFieldNameColumn(c,h);this._tr.appendChild(g);var a=this._createInputColumn(h,b);this._tr.appendChild(a);this._helpColumn=this._createHelpColumn(h);this._tr.appendChild(this._helpColumn);this._focusHandlers=[];this.getInputElements().each(function(j){j.onfocus=this._callAllOnFocusHandlers.bind(this);j.onblur=this._callAllOnBlurHandlers.bind(this)}.bind(this));this._hasValidInput=false;this._setInputValidityTrue=function(){this.setInputValidity(true)}.bind(this);this._setInputValidityFalse=function(){this.setInputValidity(false)}.bind(this)},hasValidInput:function(){return this._hasValidInput},setInputValidity:function(a){this._hasValidInput=a;this._formCallback()},_callAllOnFocusHandlers:function(){for(var a=0;a<this._focusHandlers.length;a++){if(this._focusHandlers[a].onFocus()){break}}},_callAllOnBlurHandlers:function(){for(var a=0;a<this._focusHandlers.length;a++){if(this._focusHandlers[a].onBlur()){break}}},getElement:function(){return this._tr},getInputElements:function(){return[this.getColumn(1).childNodes[0]]},getInputValue:function(){return this.getColumn(1).childNodes[0].value},getHelpElement:function(){return this.getColumn(2)},getColumn:function(a){return this._tr.childNodes[a]},addFocusHandler:function(a){this._focusHandlers.push(a)},focusHandlerCount:function(){return this._focusHandlers.length},_createFieldNameColumn:function(a,c){var b=new Element("td");b.innerHTML='<label for="kred_package_credit_card_purchase_'+c+'">'+a+"</label>";b.className="purchase_label";return b},_createInputColumn:function(c,a){var b=new Element("td");b.className="purchase_input";this._inputElement=new Element("input");this._inputElement.id="kred_package_credit_card_purchase_"+c;this._inputElement.name="kred_package_credit_card_purchase["+c+"]";this._inputElement.size=30;this._inputElement.value=a?a:"";b.appendChild(this._inputElement);return b},_createHelpColumn:function(b){var a=new Element("td");a.id=b+"_help";return a}});var FormNonEmptyRow=Class.create(FormRow,{initialize:function($super,c,h,l,g,e,a,b){$super(c,h,l,e,a);if(b){this.getInputElements().each(function(m){m.onkeyup=function(){if(this.getInputValue()!=""){this._callAllOnBlurHandlers()}}.bind(this)}.bind(this))}var f=new NonEmptyInputFocusHandler(this,"can't be blank",this._setInputValidityFalse);this.addFocusHandler(f);this._validInputCallbackFocusHandler=new ValidInputCallbackFocusHandler(this,this._setInputValidityTrue);this.addFocusHandler(this._validInputCallbackFocusHandler);var j=new HelpTextFocusHandler(this,g);this.addFocusHandler(j)}});var FormCanBeEmptyRow=Class.create(FormRow,{initialize:function($super,f,b,h,c,a,e){$super(f,b,h,a,e);this._hasValidInput=true;var g=new HelpTextFocusHandler(this,c);this.addFocusHandler(g)}});var FormCreditCardNumberRow=Class.create(FormRow,{initialize:function($super,e,h,j,f,a,c){$super(e,h,j,f,a);var g=new NonEmptyInputFocusHandler(this,"can't be blank",this._setInputValidityFalse);this.addFocusHandler(g);this._ccNumberFocusHandler=new CreditCardValidationFocusHandler(this,"invalid account number",this._setInputValidityFalse);this.addFocusHandler(this._ccNumberFocusHandler);this._validInputCallbackFocusHandler=new ValidInputCallbackFocusHandler(this,c,this._setInputValidityFalse);this.addFocusHandler(this._validInputCallbackFocusHandler);this._validInputCallbackFocusHandler=new ValidInputCallbackFocusHandler(this,this._setInputValidityTrue);this.addFocusHandler(this._validInputCallbackFocusHandler);var b=new Element("img");b.src="/images/creditcard_marks.gif";this._helpCreditCardFocusHandler=new HelpCreditCardFocusHandler(this,b);this.addFocusHandler(this._helpCreditCardFocusHandler)},getCreditCardType:function(){return this._ccNumberFocusHandler.getCreditCardType()},getInputValue:function(){return this.getColumn(1).childNodes[0].value.replace(/\s+/g,"")}});var FormCvvRow=Class.create(FormRow,{initialize:function($super,f,c,g,b,e){$super(f,c,g,b,e);var a=new NonEmptyInputFocusHandler(this,"can't be blank",this._setInputValidityFalse);this.addFocusHandler(a);this._cvvValidationFocusHandler=new CvvValidationFocusHandler(this,this._setInputValidityFalse);this.addFocusHandler(this._cvvValidationFocusHandler);this._validInputCallbackFocusHandler=new ValidInputCallbackFocusHandler(this,this._setInputValidityTrue);this.addFocusHandler(this._validInputCallbackFocusHandler);this._helpTextFocusHandler=new HelpTextFocusHandler(this,"");this.addFocusHandler(this._helpTextFocusHandler)},setCreditCardType:function(b){this._cvvValidationFocusHandler.setCreditCardType(b);var a="";if(b=="american_express"){a="Please enter the four digit code that's printed on the front of your card, just to the right of the account number."}else{a="Please enter the last three digits printed on the signature line on the back side of your card."}this._helpTextFocusHandler.setText(a)}});var FormExpirationDateRow=Class.create(FormRow,{initialize:function($super,g,h,n,l,c,e,f,a){this._formCallback=a;this._monthHTML=l;this._yearHTML=c;this._defaultMonth=e;this._defaultYear=f;$super(g,h,n+"cc_month","",a);var j=new CompleteDateValidationFocusHandler(this,"month &amp; year are required",this._setInputValidityFalse);this.addFocusHandler(j);var b=new FutureDateValidationFocusHandler(this,"date must be in the future",this._setInputValidityFalse);this.addFocusHandler(b);this._validInputCallbackFocusHandler=new ValidInputCallbackFocusHandler(this,this._setInputValidityTrue);this.addFocusHandler(this._validInputCallbackFocusHandler);var m=new HelpTextFocusHandler(this,"");this.addFocusHandler(m)},_createInputColumn:function(){var a=new Element("td");a.addClassName("purchase_input");Element.insert(a,this._monthHTML);a.childNodes[0].value=this._defaultMonth;Element.insert(a,this._yearHTML);a.childNodes[1].value=this._defaultYear;return a},_createSelect:function(b){var a=new Element("select");a.id="kred_package_credit_card_purchase_"+b;a.name="kred_package_credit_card_purchase["+b+"]";a.size=30;return a},getInputElements:function(){return[this.getColumn(1).childNodes[0],this.getColumn(1).childNodes[1]]},getInputValue:function(){return this.getColumn(1).childNodes[0].value+"/"+this.getColumn(1).childNodes[1].value},setMonthInput:function(a){this.getColumn(1).childNodes[0].selectedIndex=a},setYearInput:function(a){this.getColumn(1).childNodes[1].selectedIndex=a}});function evalJS(js_str){eval(js_str)}function updateTaskProgress(a,c){try{$(a+"-progress-amount").update(c)}catch(b){console.warn("error during updateTaskProgress on %s to %s",a,c)}}function markTaskComplete(a){try{Element.addClassName(a,"complete");Element.removeClassName(a,"incomplete");if($(a+"-progress")){Element.hide(a+"-progress")}new Effect.Highlight(a,{})}catch(b){console.warn("error during markTaskComplete on %s",a)}}function markAccomplishmentComplete(a){try{Element.addClassName(a,"complete");Element.removeClassName(a,"incomplete");new Effect.Highlight(a,{})}catch(b){console.warn("error during markAccomplishmentComplete on %s",a)}}var GameBrowser={highlightCurrentSidebarItem:function(b){var a=$("browser-sidebar-"+b);if(a){a.addClassName("active")}}};var GameMetricsUpdater=(function(){var a=function(){new Ajax.Request(active_user.gameResourcePath()+"/metrics.json",{method:"get",onSuccess:function(c){var b=c.responseJSON,e=function(g){var f=g[0],h=g[1];if(h){$$(f).each(function(j){j.update(h)})}};[[".favorites_count",b.favorites_count_with_delimiter],[".gameplays_count",b.gameplays_count_with_delimiter],[".average_rating",b.average_rating_text],["#rating_message",b.rating_message],["#below_game_rating_message",b.below_game_rating_message],["#star_ratings_block",b.user_rating],["#below_game_star_ratings_block",b.below_game_user_rating],[".flag_game",b.flagged],["#favorite_game",b.favorite_message],["#below_game_favorite_game",b.below_game_favorite_message],["#quicklinks_favorite_block",b.quicklinks_favorite_message],["#user_donation_holder",b.last_tip_message]].each(e)},onFailure:function(b){console.error("Error loading game metrics: %o",b.responseText)}})};return{update:a}})();function ImageSwitcher(a){this.initialize(a)}ImageSwitcher.prototype={initialize:function(a){var b=this;this._image_ids=a.image_ids;this._current_image=this._image_ids.first();this._current_text=this.makeTextId(this._current_image);document.observe("dom:loaded",function(){b._image_ids.each(function(c){$(b.makeTextId(c)).observe("mouseover",b.switchFunction(c))})})},switchFunction:function(a){var b=this;return function(){$(b._current_image).hide();$(b._current_text).removeClassName("selected");b._current_image=a;b._current_text=b.makeTextId(a);$(b._current_image).show();$(b._current_text).addClassName("selected")}},makeTextId:function(a){return a+"Text"}};function showTrailerPopup(a){window.open(a,"","width=520,height=400,status=no,resizable=no,scrollbars=no")}function KredPackagePicker(a){this.initialize(a)}KredPackagePicker.prototype={initialize:function(b){this._kred_packages=b.kred_packages;this._active_user=b.active_user;this._purchase_methods={};this._package_purchase_selected_callbacks={};this._payment_options_selected_callbacks={};this._kav_required=b.kav_required;this._package_template=null;this._zong_packages={};this._required_kreds=b.required_kreds;this._current_balance=b.current_balance;this._thank_you_button_iframe_url=b.thank_you_url;var a=this._required_kreds-this._current_balance;this._kred_deficit=a>0?a:0;this._payment_option_selected=false},customPackageVariables:function(){return Object.toQueryString({uid:this._active_user.id(),kpid:this._selected_kred_package.id})},returnToSelectPackage:function(){this.selectPaymentOption(this._selected_payment_option)},returnToSelectPaymentMethod:function(){$$(".zong_package").each(Element.remove);$$(".kred_flow_step").each(Element.hide);$("payment_method_selection").show();$("common_choose_other_payment_link").show()},checkIfVerificationRequired:function(){if(this._kav_required){window.location="/accounts/"+active_user.username()+"/kred_account_verification/edit";return true}},hideKredFlow:function(){$$(".kred_flow_step").each(Element.hide)},addPurchaseMethod:function(a){this._purchase_methods[a.preselect_param]=a},showPreselectedPaymentOption:function(a){var b=this._purchase_methods[a];if(b){this.selectPaymentOption(b)}else{if(!this._payment_option_selected){$("payment_method_selection").show()}}},selectPaymentOption:function(b){this._payment_option_selected=true;if(this.checkIfVerificationRequired()){return}this.hideKredFlow();this._selected_payment_option=b;if("UgcTransaction"==b.purchase_record_class||"OfferpalTransaction"==b.purchase_record_class){this.showPurchaseForm()}else{if("ZongTransaction"==b.purchase_record_class){if(0===$$(".zong_package_input").length){this.loadZongPackages()}else{$("zong_country_code_form").show()}this.showPurchaseForm()}else{this.showPackageSelection(b)}}var a=this._payment_options_selected_callbacks[b.purchase_record_class];if(a){a.each(function(c){c(b)})}},loadZongPackages:function(){var a=$("zong_transaction_country_code");a.form.onsubmit()},showZongPackageSelection:function(b){this.hidePackageSelection();$("common_choose_other_payment_link").hide();this._zong_packages={};b.each(function(c){this._zong_packages[c.id]=c;c.additional_classes="zong_package";c.additional_input_classes="zong_package_input";this.addPackage(c)}.bind(this));var a=$F("zong_transaction_country_code");$("selected_country").update($("zong_transaction_country_code").down("[value="+a+"]").innerHTML);this.showPackageSelection({kred_package_ids:b.pluck("id"),purchase_record_class:"ZongTransaction"})},addPackage:function(a){if(this._package_template===null){this._package_template=new Template($("kred_package_template").innerHTML);this._package_choices_node=$("kred_package_choices_ul")}this._package_choices_node.insert(this._package_template.evaluate(a),{position:"bottom"})},showPackageSelection:function(f){var b=this.recommendPackage(f),c=$("kred_package_selection");this.hidePackageSelection();f.kred_package_ids.each(function(g){$("kred_package_"+g).show();$("kred_package_radio_"+g).checked=(g==b)});c.show();var a=c.down(".purchase-method-specific"),e=c.down(".purchase-method-specific."+f.purchase_record_class);if(a){a.hide()}if(e){e.show()}},kredDeficit:function(){return this._kred_deficit},kredPackageById:function(a){return this._kred_packages.find(function(b){return b.id==a})||this._zong_packages[a]},recommendPackage:function(a){if(!this.kredDeficit()){return this.defaultRecommendation(a)}var b=a.kred_package_ids.find(function(e){var c=this.kredPackageById(e);return c&&c.kred_amount>=this.kredDeficit()}.bind(this));return b||this.defaultRecommendation(a)},defaultRecommendation:function(a){return a.preferred_kred_package_id||a.kred_package_ids.last()},hidePackageSelection:function(){$$(".kred_package").each(Element.hide)},selectPackage:function(){$$(".kred_flow_step").each(Element.hide);var f=this._selected_payment_option;var e=f.kred_package_ids.find(function(g){return $("kred_package_radio_"+g).checked}),b=this._kred_packages.find(function(g){return g.id==e}),c=this._package_purchase_selected_callbacks[this._selected_payment_option.purchase_record_class];if("ZongTransaction"==f.purchase_record_class){if(c){c.each(function(g){g(b)})}this.selectZongPackage();return}this._selected_kred_package=b;var a=this;$$(".kred_purchase_form_kred_package_id").each(function(g){g.value=b.id});$$(".kred_purchase_form_kred_package_dollar_price").each(function(g){g.value=b.dollar_price});$$(".kred_purchase_form_kred_package_kred_amount").each(function(g){g.value=b.kred_amount});$$(".kred_purchase_form_kred_package_item_name").each(function(g){g.value=b.kred_amount+" Kreds"});$$(".kred_purchase_form_kred_package_custom_package_variables").each(function(g){g.value=a.customPackageVariables()});$$(".kred_purchase_summary_dollar_price").each(function(g){g.update(b.dollar_price)});$$(".kred_purchase_summary_kred_amount").each(function(g){g.update(b.kred_amount)});if(c){c.each(function(g){g(b)})}this.showPurchaseForm()},selectZongPackage:function(){var b=$$(".zong_package_input").find(function(c){return c.checked});var a=this._zong_packages[b.value];$("zong_iframe").contentWindow.location.replace(a.iframe_url);$("zong_iframe_wrapper").show();$("purchase_method_form_ZongTransaction").show()},showPurchaseForm:function(){$("purchase_method_form_"+this._selected_payment_option.purchase_record_class).show()},ugcTryAgain:function(){$("ugc_postback_failure").hide();$("ugc_form").show();$("ugc_form_spinner").restore();$("ugc_transaction_ugc_pin").value="";this.returnToSelectPaymentMethod()},addSelectedPaymentOptionCallback:function(a,b){if(!this._payment_options_selected_callbacks[a]){this._payment_options_selected_callbacks[a]=[]}this._payment_options_selected_callbacks[a].push(b)},addSelectedPackageCallback:function(a,b){if(!this._package_purchase_selected_callbacks[a]){this._package_purchase_selected_callbacks[a]=[]}this._package_purchase_selected_callbacks[a].push(b)},displayCurrency:function(a,b){output="";if(["USD","CAD"].include(a)){output+="$"}output+=b.toFixed(2);if("USD"!=a){output+=" "+a}return output}};var detect=navigator.userAgent.toLowerCase();var total,thestring;var lightbox=Class.create();lightbox.prototype={yPos:0,xPos:0,initialize:function(b,a){this._activated=false;this.wait_for_shutdown=false;this.done_class_name="done";if(typeof b=="string"){this.content=b;this.activate()}else{this.content=b.href;b.observer_function=this.activate.bindAsEventListener(this);Event.observe(b,"click",b.observer_function,true);b.onclick=function(){return false}}this._on_close_callbacks=[];if(a){this._on_close_callbacks.push(a)}},shutdown:function(){if(this.wait_for_shutdown){return}this.stopListening();this.deactivate.apply(this,arguments)},shutdownWithoutCallbacks:function(){this._on_close_callbacks=[];this.shutdown.apply(this,arguments)},addOnCloseCallback:function(a){if(!this._on_close_callbacks){this._on_close_callbacks=[]}this._on_close_callbacks.push(a)},initializeKredTipPurchaseFrame:function(b,a){if(a){this.addOnCloseCallback(a)}this.addOnCloseCallback(function(){new Ajax.Request(active_user.gamePath()+"/game_tips",{method:"get"})});this.initializeKredPurchaseFrame(b)},initializeKredItemPurchaseFrame:function(a){this.addOnCloseCallback(function(c){var e=c||{success:false};e.success=!!e.success;try{holodeck.konduit().dispatchEvent({type:"purchase_result",data:e})}catch(b){}});this.initializeKredPurchaseFrame(a)},initializeKredCardCartPurchaseFrame:function(a){this.addOnCloseCallback(function(b){if(b&&b.success){top.location=top.location.href}});this.initializeKredPurchaseFrame(a)},initializeKredPurchaseFrame:function(a){if(!this._kongregate_lightbox_wrapper_template){this._kongregate_lightbox_wrapper_template=new Template($("kongregate_lightbox_wrapper_template").innerHTML)}this.staticContent=this._kongregate_lightbox_wrapper_template.evaluate({iframe_src:a});this.done_class_name="kred_purchase";this.activate()},initializeKongregateLightboxFromAjax:function(b,a){if(!a){a={}}if(!this._kongregate_lightbox_wrapper_template_noframe){this._kongregate_lightbox_wrapper_template_noframe=new Template($("kongregate_lightbox_wrapper_template_noframe").innerHTML)}this.staticContent=this._kongregate_lightbox_wrapper_template_noframe.evaluate({});this.staticContentDivUrl=b;this.afterStaticContentLoad=a.afterStaticContentLoad;this.done_class_name=["kred_purchase"].concat(a.done_class_name||[]).join(" ");this.activate()},initializeKredPurchase:function(a){var c=window.location.host,f="https://",e="/kred_package_purchases/new";if(c.match(/local/)||c.match(/dev/)){f="http://"}var b=f+c+e;if(a){b+="?purchase_method="+a}this.initializeKredPurchaseFrame(b)},activate:function(b){if(!$("lightbox")){return}if(this._activated){return}else{this._activated=true;if(!this.done_class_name){this.done_class_name="done"}}if(Prototype.Browser.IE){this.getScroll();this.prepareIE("100%","hidden");this.setScroll(0,0);this.hideSelects("hidden")}this.hideHiddenElements();var a=function(){$("lightbox").className="loading";this.displayLightbox("block")};setTimeout(a.bind(this),10);if(b&&typeof b=="object"&&b.stopPropagation){b.stopPropagation()}},deactivate:function(){if(!this._activated){return}this._activated=false;this.staticContent=undefined;var b=$("lbContent");if(b){b.remove()}if(Prototype.Browser.IE){this.setScroll(0,this.yPos);this.prepareIE("auto","auto");this.hideSelects("visible")}this.displayLightbox("none");this.done_class_name="done";this.onClose.apply(this,arguments);this.showHiddenElements();try{holodeck.saveSharedContentFailed()}catch(a){}},prepareIE:function(a,b){bod=document.getElementsByTagName("body")[0];bod.style.height=a;bod.style.overflow=b;htm=document.getElementsByTagName("html")[0];htm.style.height=a;htm.style.overflow=b},hideSelects:function(a){selects=document.getElementsByTagName("select");for(i=0;i<selects.length;i++){selects[i].style.visibility=a}},domElementsToHide:function(){return[$("game"),$("gamediv")].concat($$("object")).concat($$(".ad")).select(function(a){return a&&"konduit"!=a.id})},hideHiddenElements:function(){this._dom_elements_actually_hidden=[];var a=this._dom_elements_actually_hidden;this.domElementsToHide().each(function(b){if("visible"==b.getStyle("visibility")){a.push(b);b.setStyle({visibility:"hidden"});b.hiddenByLightbox=true}});this.hideGameInIFrame()},showHiddenElements:function(){if(!this._dom_elements_actually_hidden){return}this._dom_elements_actually_hidden.each(function(a){a.setStyle({visibility:"visible"});a.hiddenByLightbox=false});this.showGameInIFrame()},hideGameInIFrame:function(){},showGameInIFrame:function(){},getScroll:function(){if(self.pageYOffset){this.yPos=self.pageYOffset}else{if(document.documentElement&&document.documentElement.scrollTop){this.yPos=document.documentElement.scrollTop}else{if(document.body){this.yPos=document.body.scrollTop}}}},setScroll:function(a,b){window.scrollTo(a,b)},displayLightbox:function(a){$("overlay").style.display=a;$("lightbox").style.display=a;if(a!="none"){this.loadInfo()}},reloadInfo:function(){var b=$("lbContent");if(b){var a=$("lightbox");a.removeClassName("done");a.removeClassName("wide");b.remove();this.loadInfo()}else{this.activate()}},loadInfo:function(){if(this.staticContent){this.renderContents(this.staticContent);this.staticContent=undefined;if(this.staticContentDivUrl){new Ajax.Request(this.staticContentDivUrl,{method:"get",onComplete:(function(b){Element.hide("kongregate_lightbox_spinner");$("lightbox_form").update(b.responseText);if(this.afterStaticContentLoad){this.afterStaticContentLoad()}this.afterStaticContentLoad=undefined}).bind(this)});this.staticContentDivUrl=undefined}else{if(this.afterStaticContentLoad){this.afterStaticContentLoad()}this.afterStaticContentLoad=undefined}return}var a=new Ajax.Request(this.content,{method:"get",parameters:"",onComplete:this.processInfo.bindAsEventListener(this)})},processInfo:function(a){this.renderContents(a.responseText)},renderContents:function(b){var c="<div id='lbContent'>"+b+"</div>";var a=$("lbLoadMessage");new Insertion.Before(a,c);a.hide();$("lightbox").className=this.done_class_name;this.actions()},actions:function(){lbActions=document.getElementsByClassName("lbAction");var a=document.getElementById("username");if(a&&Prototype.Browser.Gecko&&Prototype.Platform.Macintosh){a.focus()}for(i=0;i<lbActions.length;i++){Event.observe(lbActions[i],"click",this[lbActions[i].rel].bindAsEventListener(this),false);lbActions[i].onclick=function(){return false}}},insert:function(b){link=Event.element(b).parentNode;Element.remove($("lbContent"));var a=new Ajax.Request(link.href,{method:"post",parameters:"",onComplete:this.processInfo.bindAsEventListener(this)})},toggleRegistration:function(){var f=$("lightbox"),e=$("lightboxlogin"),a=$("lightboxregister"),b,g,c;if(a.style.display=="block"){b="none";g="block";c="kred_purchase lightbox_login"}else{b="block";g="none";c="kred_purchase"}if(e){e.style.display=g}a.style.display=b;f.className=c},onClose:function(){if(this._on_close_callbacks){var a=arguments;this._on_close_callbacks.each(function(b){b.apply(this,a)})}this._on_close_callbacks=[]},stopListening:function(){$$(".lbOn").each(function(a){a.stopObserving("click",a.observer_function,true);a.getElementsBySelector("a").each(function(b){if(b.original_onclick){b.onclick=b.original_onclick;b.original_onclick=null}})})}};function initialize(){addLightboxMarkup();lbox=document.getElementsByClassName("lbOn");for(i=0;i<lbox.length;i++){valid=new lightbox(lbox[i])}}function addLightboxMarkup(){bod=document.getElementsByTagName("body")[0];overlay=document.createElement("div");overlay.id="overlay";lb=document.createElement("div");lb.id="lightbox";lb.className="loading";lb.innerHTML='<div id="lbLoadMessage"><p><img src="/images/presentation/indicator.gif" class="indicator" style="width: 16px; height: 16px;" /> Loading</p></div>';bod.appendChild(overlay);bod.appendChild(lb)}var NoteWatcher={watch:function(){var a=$("note");var b=$("submit");if(a.value!=""){b.enable()}else{b.disable();a.focus()}},setFocus:function(){if($("note")){$("note").focus()}}};d=document;ndc=new Array();coc=new Array();kg=true;function zelph_onDOMload(dtw,ctr){es=zelph_getElementsBySelector(dtw);if(ndc[dtw]==null){ndc[dtw]=0;coc[coc.length]="zelph_onDOMload('"+dtw+"', '"+ctr+"')"}if(es.length>ndc[dtw]){nes=es.length;for(var x=ndc[dtw];x<nes;x++){theTarget=es[x];eval(ctr)}ndc[dtw]=nes}if(kg==true){setTimeout("zelph_onDOMload('"+dtw+"', '"+ctr+"')",100)}return true}function zelph_getElementsBySelector(b){var c;var j=[];var a="";var f="";var l=b;var g=[];if(b.indexOf(" ")>0){j=b.split(" ");var e=j[0].split("#");if(e.length==1){return(g)}if(d.getElementById(e[1])){return(d.getElementById(e[1]).getElementsByTagName(j[1]))}return false}if(b.indexOf("#")>0){j=b.split("#");l=j[0];a=j[1]}if(a!=""){if(d.getElementById(a)){g.push(d.getElementById(a));return(g)}return false}if(b.indexOf(".")>0){j=b.split(".");l=j[0];f=j[1]}var h=d.getElementsByTagName(l);if(f==""){return(h)}for(c=0;c<h.length;c++){curClass=" "+h[c].className+" ";if(curClass.indexOf(" "+f+" ")!="-1"){g.push(h[c])}}return(g)}function zelph_stopIt(){kg="";for(x=0;x<coc.length;x++){eval(coc[x])}}function zelph_addLoadEvent(a){var b=window.onload;if(typeof window.onload!="function"){window.onload=a}else{window.onload=function(){b();a()}}}zelph_addLoadEvent(zelph_stopIt);var PaymentHelpText={showHelpText:function(e,a){var b=$("help_wrapper");var c=$(a);if(e==""||e==null){return}if(c.className=="error_msg"){return}c.appendChild(b);$("help_text").innerHTML=e;b.show()},hideHelpText:function(){$("help_wrapper").hide()}};function QuickPick(a){this.initialize(a)}QuickPick.prototype={initialize:function(a){this._destination=a.destination;this._template=a.template;this._destination.down()},setQuickPicks:function(a){this._quick_picks=a.map(function(b){b.plays=b.plays.withDelimiters()+" plays";return b});this._last_pick=parseInt(Math.random()*a.length,10)},pickOne:function(){this._last_pick=(this._last_pick+1)%this._quick_picks.length;this._destination.update(this._template.evaluate(this._quick_picks[this._last_pick]))},spin:function(b,c,a){if(0==arguments.length){this.spin(10,1.4,300)}else{this.pickOne();if(b<a){setTimeout(this.spin.bind(this,b*c,c,a),b)}}if(!this._ever_spun){this._ever_spun=true;this.prefetchIcons()}},prefetchIcons:function(){var a=$(document.body);this._quick_picks.each(function(b){a.insert(new Element("img",{src:b.icon,style:"display:none"}))})}};var SiteStatsUpdater=(function(){var b=new Template("<strong>#{users_online_count_with_delimiter}</strong> online playing <strong>#{games_count_with_delimiter}</strong> free games!");var a=new Template('<a onclick="holodeck.showChatTab(); return false;" href="#">Join #{people_online_text} in chat right now!</a>');var c=function(){new Ajax.Request("/site_stats.json",{method:"get",onSuccess:function(f){var e=f.responseJSON;$("playing").update(b.evaluate(e));if($("holodeck_chat_promotion")){$("holodeck_chat_promotion").update(a.evaluate(e))}}})};return{update:c}})();Element.addMethods({textNodes:function(a){return $A(a.childNodes).map(function(b){if(b.nodeType==3){return[b]}else{if(b.nodeType==1){return $(b).textNodes()}else{return[]}}}).flatten()},splitLongWords:function(a){var e=30,c=new RegExp("\\S{"+e+",}"),b=function(){return Prototype.Browser.IE?document.createElement("wbr"):document.createTextNode(String.fromCharCode(8203))};a.textNodes().each(function(h){var f=h.parentNode,g=h,j;while((j=g.nodeValue.search(c))>=0){if(!/http:/.test(g.nodeValue.substr(0,j+e))){g=g.splitText(j+e);f.insertBefore(b(),g)}else{if(/^\s/.test(g.nodeValue)){j=g.nodeValue.search(/\S/);g=g.splitText(j)}else{if((j=g.nodeValue.search(/\s+/))>=0){g=g.splitText(j)}else{return}}}}})}});document.observe("dom:loaded",function(){$$(".splittext").invoke("splitLongWords")});var swfobject=function(){var aq="undefined",aD="object",ab="Shockwave Flash",X="ShockwaveFlash.ShockwaveFlash",aE="application/x-shockwave-flash",ac="SWFObjectExprInst",ax="onreadystatechange",af=window,aL=document,aB=navigator,aa=false,Z=[aN],aG=[],ag=[],al=[],aJ,ad,ap,at,ak=false,aU=false,aH,an,aI=true,ah=function(){var a=typeof aL.getElementById!=aq&&typeof aL.getElementsByTagName!=aq&&typeof aL.createElement!=aq,f=aB.userAgent.toLowerCase(),c=aB.platform.toLowerCase(),j=c?/win/.test(c):/win/.test(f),m=c?/mac/.test(c):/mac/.test(f),h=/webkit/.test(f)?parseFloat(f.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,"$1")):false,e=!+"\v1",g=[0,0,0],n=null;if(typeof aB.plugins!=aq&&typeof aB.plugins[ab]==aD){n=aB.plugins[ab].description;if(n&&!(typeof aB.mimeTypes!=aq&&aB.mimeTypes[aE]&&!aB.mimeTypes[aE].enabledPlugin)){aa=true;e=false;n=n.replace(/^.*\s+(\S+\s+\S+$)/,"$1");g[0]=parseInt(n.replace(/^(.*)\..*$/,"$1"),10);g[1]=parseInt(n.replace(/^.*\.(.*)\s.*$/,"$1"),10);g[2]=/[a-zA-Z]/.test(n)?parseInt(n.replace(/^.*[a-zA-Z]+(.*)$/,"$1"),10):0}}else{if(typeof af.ActiveXObject!=aq){try{var l=new ActiveXObject(X);if(l){n=l.GetVariable("$version");if(n){e=true;n=n.split(" ")[1].split(",");g=[parseInt(n[0],10),parseInt(n[1],10),parseInt(n[2],10)]}}}catch(b){}}}return{w3:a,pv:g,wk:h,ie:e,win:j,mac:m}}(),aK=function(){if(!ah.w3){return}if((typeof aL.readyState!=aq&&aL.readyState=="complete")||(typeof aL.readyState==aq&&(aL.getElementsByTagName("body")[0]||aL.body))){aP()}if(!ak){if(typeof aL.addEventListener!=aq){aL.addEventListener("DOMContentLoaded",aP,false)}if(ah.ie&&ah.win){aL.attachEvent(ax,function(){if(aL.readyState=="complete"){aL.detachEvent(ax,arguments.callee);aP()}});if(af==top){(function(){if(ak){return}try{aL.documentElement.doScroll("left")}catch(a){setTimeout(arguments.callee,0);return}aP()})()}}if(ah.wk){(function(){if(ak){return}if(!/loaded|complete/.test(aL.readyState)){setTimeout(arguments.callee,0);return}aP()})()}aC(aP)}}();function aP(){if(ak){return}try{var b=aL.getElementsByTagName("body")[0].appendChild(ar("span"));b.parentNode.removeChild(b)}catch(a){return}ak=true;var e=Z.length;for(var c=0;c<e;c++){Z[c]()}}function aj(a){if(ak){a()}else{Z[Z.length]=a}}function aC(a){if(typeof af.addEventListener!=aq){af.addEventListener("load",a,false)}else{if(typeof aL.addEventListener!=aq){aL.addEventListener("load",a,false)}else{if(typeof af.attachEvent!=aq){aM(af,"onload",a)}else{if(typeof af.onload=="function"){var b=af.onload;af.onload=function(){b();a()}}else{af.onload=a}}}}}function aN(){if(aa){Y()}else{am()}}function Y(){var e=aL.getElementsByTagName("body")[0];var b=ar(aD);b.setAttribute("type",aE);var a=e.appendChild(b);if(a){var c=0;(function(){if(typeof a.GetVariable!=aq){var f=a.GetVariable("$version");if(f){f=f.split(" ")[1].split(",");ah.pv=[parseInt(f[0],10),parseInt(f[1],10),parseInt(f[2],10)]}}else{if(c<10){c++;setTimeout(arguments.callee,10);return}}e.removeChild(b);a=null;am()})()}else{am()}}function am(){var h=aG.length;if(h>0){for(var j=0;j<h;j++){var c=aG[j].id;var o=aG[j].callbackFn;var a={success:false,id:c};if(ah.pv[0]>0){var l=aS(c);if(l){if(ao(aG[j].swfVersion)&&!(ah.wk&&ah.wk<312)){ay(c,true);if(o){a.success=true;a.ref=av(c);o(a)}}else{if(aG[j].expressInstall&&au()){var f={};f.data=aG[j].expressInstall;f.width=l.getAttribute("width")||"0";f.height=l.getAttribute("height")||"0";if(l.getAttribute("class")){f.styleclass=l.getAttribute("class")}if(l.getAttribute("align")){f.align=l.getAttribute("align")}var g={};var e=l.getElementsByTagName("param");var n=e.length;for(var m=0;m<n;m++){if(e[m].getAttribute("name").toLowerCase()!="movie"){g[e[m].getAttribute("name")]=e[m].getAttribute("value")}}ae(f,g,c,o)}else{aF(l);if(o){o(a)}}}}}else{ay(c,true);if(o){var b=av(c);if(b&&typeof b.SetVariable!=aq){a.success=true;a.ref=b}o(a)}}}}}function av(b){var e=null;var c=aS(b);if(c&&c.nodeName=="OBJECT"){if(typeof c.SetVariable!=aq){e=c}else{var a=c.getElementsByTagName(aD)[0];if(a){e=a}}}return e}function au(){return !aU&&ao("6.0.65")&&(ah.win||ah.mac)&&!(ah.wk&&ah.wk<312)}function ae(g,e,j,f){aU=true;ap=f||null;at={success:false,id:j};var a=aS(j);if(a){if(a.nodeName=="OBJECT"){aJ=aO(a);ad=null}else{aJ=a;ad=j}g.id=ac;if(typeof g.width==aq||(!/%$/.test(g.width)&&parseInt(g.width,10)<310)){g.width="310"}if(typeof g.height==aq||(!/%$/.test(g.height)&&parseInt(g.height,10)<137)){g.height="137"}aL.title=aL.title.slice(0,47)+" - Flash Player Installation";var b=ah.ie&&ah.win?"ActiveX":"PlugIn",c="MMredirectURL="+af.location.toString().replace(/&/g,"%26")+"&MMplayerType="+b+"&MMdoctitle="+aL.title;if(typeof e.flashvars!=aq){e.flashvars+="&"+c}else{e.flashvars=c}if(ah.ie&&ah.win&&a.readyState!=4){var h=ar("div");j+="SWFObjectNew";h.setAttribute("id",j);a.parentNode.insertBefore(h,a);a.style.display="none";(function(){if(a.readyState==4){a.parentNode.removeChild(a)}else{setTimeout(arguments.callee,10)}})()}aA(g,e,j)}}function aF(a){if(ah.ie&&ah.win&&a.readyState!=4){var b=ar("div");a.parentNode.insertBefore(b,a);b.parentNode.replaceChild(aO(a),b);a.style.display="none";(function(){if(a.readyState==4){a.parentNode.removeChild(a)}else{setTimeout(arguments.callee,10)}})()}else{a.parentNode.replaceChild(aO(a),a)}}function aO(b){var e=ar("div");if(ah.win&&ah.ie){e.innerHTML=b.innerHTML}else{var f=b.getElementsByTagName(aD)[0];if(f){var a=f.childNodes;if(a){var g=a.length;for(var c=0;c<g;c++){if(!(a[c].nodeType==1&&a[c].nodeName=="PARAM")&&!(a[c].nodeType==8)){e.appendChild(a[c].cloneNode(true))}}}}}return e}function aA(f,h,c){var e,a=aS(c);if(ah.wk&&ah.wk<312){return e}if(a){if(typeof f.id==aq){f.id=c}if(ah.ie&&ah.win){var g="";for(var l in f){if(f[l]!=Object.prototype[l]){if(l.toLowerCase()=="data"){h.movie=f[l]}else{if(l.toLowerCase()=="styleclass"){g+=' class="'+f[l]+'"'}else{if(l.toLowerCase()!="classid"){g+=" "+l+'="'+f[l]+'"'}}}}}var j="";for(var m in h){if(h[m]!=Object.prototype[m]){j+='<param name="'+m+'" value="'+h[m]+'" />'}}a.outerHTML='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'+g+">"+j+"</object>";ag[ag.length]=f.id;e=aS(f.id)}else{var b=ar(aD);b.setAttribute("type",aE);for(var n in f){if(f[n]!=Object.prototype[n]){if(n.toLowerCase()=="styleclass"){b.setAttribute("class",f[n])}else{if(n.toLowerCase()!="classid"){b.setAttribute(n,f[n])}}}}for(var o in h){if(h[o]!=Object.prototype[o]&&o.toLowerCase()!="movie"){aQ(b,o,h[o])}}a.parentNode.replaceChild(b,a);e=b}}return e}function aQ(b,e,c){var a=ar("param");a.setAttribute("name",e);a.setAttribute("value",c);b.appendChild(a)}function aw(a){var b=aS(a);if(b&&b.nodeName=="OBJECT"){if(ah.ie&&ah.win){b.style.display="none";(function(){if(b.readyState==4){aT(a)}else{setTimeout(arguments.callee,10)}})()}else{b.parentNode.removeChild(b)}}}function aT(a){var b=aS(a);if(b){for(var c in b){if(typeof b[c]=="function"){b[c]=null}}b.parentNode.removeChild(b)}}function aS(a){var c=null;try{c=aL.getElementById(a)}catch(b){}return c}function ar(a){return aL.createElement(a)}function aM(a,c,b){a.attachEvent(c,b);al[al.length]=[a,c,b]}function ao(a){var b=ah.pv,c=a.split(".");c[0]=parseInt(c[0],10);c[1]=parseInt(c[1],10)||0;c[2]=parseInt(c[2],10)||0;return(b[0]>c[0]||(b[0]==c[0]&&b[1]>c[1])||(b[0]==c[0]&&b[1]==c[1]&&b[2]>=c[2]))?true:false}function az(b,g,a,c){if(ah.ie&&ah.mac){return}var f=aL.getElementsByTagName("head")[0];if(!f){return}var h=(a&&typeof a=="string")?a:"screen";if(c){aH=null;an=null}if(!aH||an!=h){var e=ar("style");e.setAttribute("type","text/css");e.setAttribute("media",h);aH=f.appendChild(e);if(ah.ie&&ah.win&&typeof aL.styleSheets!=aq&&aL.styleSheets.length>0){aH=aL.styleSheets[aL.styleSheets.length-1]}an=h}if(ah.ie&&ah.win){if(aH&&typeof aH.addRule==aD){aH.addRule(b,g)}}else{if(aH&&typeof aL.createTextNode!=aq){aH.appendChild(aL.createTextNode(b+" {"+g+"}"))}}}function ay(a,c){if(!aI){return}var b=c?"visible":"hidden";if(ak&&aS(a)){aS(a).style.visibility=b}else{az("#"+a,"visibility:"+b)}}function ai(b){var a=/[\\\"<>\.;]/;var c=a.exec(b)!=null;return c&&typeof encodeURIComponent!=aq?encodeURIComponent(b):b}var aR=function(){if(ah.ie&&ah.win){window.attachEvent("onunload",function(){var a=al.length;for(var b=0;b<a;b++){al[b][0].detachEvent(al[b][1],al[b][2])}var e=ag.length;for(var c=0;c<e;c++){aw(ag[c])}for(var f in ah){ah[f]=null}ah=null;for(var g in swfobject){swfobject[g]=null}swfobject=null})}}();return{registerObject:function(a,f,c,b){if(ah.w3&&a&&f){var e={};e.id=a;e.swfVersion=f;e.expressInstall=c;e.callbackFn=b;aG[aG.length]=e;ay(a,false)}else{if(b){b({success:false,id:a})}}},getObjectById:function(a){if(ah.w3){return av(a)}},embedSWF:function(n,f,j,g,c,a,b,l,h,m){var e={success:false,id:f};if(ah.w3&&!(ah.wk&&ah.wk<312)&&n&&f&&j&&g&&c){ay(f,false);aj(function(){j+="";g+="";var t={};if(h&&typeof h===aD){for(var r in h){t[r]=h[r]}}t.data=n;t.width=j;t.height=g;var q={};if(l&&typeof l===aD){for(var s in l){q[s]=l[s]}}if(b&&typeof b===aD){for(var o in b){if(typeof q.flashvars!=aq){q.flashvars+="&"+o+"="+b[o]}else{q.flashvars=o+"="+b[o]}}}if(ao(c)){var p=aA(t,q,f);if(t.id==f){ay(f,true)}e.success=true;e.ref=p}else{if(a&&au()){t.data=a;ae(t,q,f,m);return}else{ay(f,true)}}if(m){m(e)}})}else{if(m){m(e)}}},switchOffAutoHideShow:function(){aI=false},ua:ah,getFlashPlayerVersion:function(){return{major:ah.pv[0],minor:ah.pv[1],release:ah.pv[2]}},hasFlashPlayerVersion:ao,createSWF:function(a,b,c){if(ah.w3){return aA(a,b,c)}else{return undefined}},showExpressInstall:function(b,a,e,c){if(ah.w3&&au()){ae(b,a,e,c)}},removeSWF:function(a){if(ah.w3){aw(a)}},createCSS:function(b,a,c,e){if(ah.w3){az(b,a,c,e)}},addDomLoadEvent:aj,addLoadEvent:aC,getQueryParamValue:function(b){var a=aL.location.search||aL.location.hash;if(a){if(/\?/.test(a)){a=a.split("?")[1]}if(b==null){return ai(a)}var c=a.split("&");for(var e=0;e<c.length;e++){if(c[e].substring(0,c[e].indexOf("="))==b){return ai(c[e].substring((c[e].indexOf("=")+1)))}}}return""},expressInstallCallback:function(){if(aU){var a=aS(ac);if(a&&aJ){a.parentNode.replaceChild(aJ,a);if(ad){ay(ad,true);if(ah.ie&&ah.win){aJ.style.display="block"}}if(ap){ap(at)}}aU=false}}}}();function addDOMLoadEvent(a){if(!window.__load_events){var b=function(){if(arguments.callee.done){return}arguments.callee.done=true;if(window.__load_timer){clearInterval(window.__load_timer);window.__load_timer=null}for(var c=0;c<window.__load_events.length;c++){window.__load_events[c]()}window.__load_events=null};if(document.addEventListener){document.addEventListener("DOMContentLoaded",b,false)}if(/WebKit/i.test(navigator.userAgent)){window.__load_timer=setInterval(function(){if(/loaded|complete/.test(document.readyState)){b()}},10)}window.onload=b;window.__load_events=[]}window.__load_events.push(a)}function tabset(){if(!document.getElementById){return false}var a=document.getElementsByTagName("dl");for(k=0;k<a.length;k++){var f=a[k];if(f.className.indexOf("tabset")==-1){continue}var j=0;var e=f.getElementsByTagName("dd");for(i=0;i<e.length;i++){if(e[i].parentNode==f){if(i==0){var c=e.item(0)}else{e[i].style.display="none"}e[i].count=j++}}var g=new Array();var b=f.getElementsByTagName("dt");for(i=0;i<b.length;i++){if(b[i].parentNode==f){g[g.length]=b[i]}}var h=[];for(i=0;i<g.length;i++){if(!g[i].transformed_to_tab){g[i].transformed_to_tab=true;g[i].count=i;g[i].onclick=toggleDt;g[i].innerHTML="<a href='#' title='"+g[i].innerHTML+"'>"+g[i].innerHTML+"</a>";g[i].parentNode.removeChild(g[i]);c.parentNode.insertBefore(g[i],c)}if(g[i].className.indexOf("active")>=0){h[h.length]=g[i]}}for(i=0;i<h.length;i++){h[i].onclick()}}}function toggleDt(){var b=this.parentNode.getElementsByTagName("dt");for(i=0;i<b.length;i++){if(this==b[i]&&this.className.indexOf("dormant")>=0&&this.className.indexOf("active")==-1&&b[i].parentNode==this.parentNode){this.className+=" active";this.className=this.className.replace(/(?:^\s*|\s*$)/,"")}else{if(this!=b[i]&&b[i].parentNode==this.parentNode){b[i].className=b[i].className.replace("active","dormant")}}}var a=this.parentNode.getElementsByTagName("dd");for(i=0;i<a.length;i++){if(a[i].parentNode==this.parentNode){if(this.count==a[i].count){a[i].style.display="block"}else{a[i].style.display="none"}}}return false}addDOMLoadEvent(tabset);function autoInit_trees(){var b=document.getElementsByTagName("ul");for(var a=0;a<b.length;a++){if(b[a].className&&b[a].className.indexOf("tree")!=-1){initTree(b[a]);b[a].className=b[a].className.replace(/ ?unformatted ?/," ")}}}function initTree(a){var f,e;var l,h,g;var c,n,b;for(f=0;f<a.childNodes.length;f++){if(a.childNodes[f].tagName&&a.childNodes[f].tagName.toLowerCase()=="li"){var m=a.childNodes[f];l=document.createElement("span");h=document.createElement("span");g=document.createElement("span");l.appendChild(h);h.appendChild(g);l.className="a "+m.className.replace("closed","spanClosed");l.onMouseOver=function(){};h.className="b";h.onclick=treeToggle;g.className="c";n=m.childNodes.length;c=0;b=null;for(e=0;e<m.childNodes.length;e++){if(m.childNodes[e].tagName&&m.childNodes[e].tagName.toLowerCase()=="div"){c=e+1;continue}if(m.childNodes[e].tagName&&m.childNodes[e].tagName.toLowerCase()=="ul"){b=m.childNodes[e];n=e;break}}for(e=c;e<n;e++){g.appendChild(m.childNodes[c])}if(m.childNodes.length>c){m.insertBefore(l,m.childNodes[c])}else{m.appendChild(l)}if(b!=null){if(initTree(b)){addClass(m,"children","closed");addClass(l,"children","spanClosed")}}}}if(m){addClass(m,"last","closed");addClass(l,"last","spanClosed");return true}else{return false}}function treeToggle(c,e){c=this;while(c!=null&&(!c.tagName||c.tagName.toLowerCase()!="li")){c=c.parentNode}var a=findChildWithTag(c,"ul");var b=findChildWithTag(c,"span");if(e!=null){if(e=="open"){treeOpen(b,c)}else{if(e=="close"){treeClose(b,c)}}}else{if(a!=null){if(!c.className.match(/(^| )closed($| )/)){treeClose(b,c)}else{treeOpen(b,c)}}}}function treeOpen(e,c){removeClass(e,"spanClosed");removeClass(c,"closed")}function treeClose(e,c){addClass(e,"spanClosed");addClass(c,"closed")}function findChildWithTag(c,a){for(var b=0;b<c.childNodes.length;b++){if(c.childNodes[b].tagName!=null&&c.childNodes[b].tagName.toLowerCase()==a){return c.childNodes[b]}}return null}function addClass(c,b,a){if(a!=null&&c.className.match(new RegExp("(^| )"+a))){c.className=c.className.replace(new RegExp("( |^)"+a),"$1"+b+" "+a)}else{if(!c.className.match(new RegExp("(^| )"+b+"($| )"))){c.className+=" "+b;c.className=c.className.replace(/(^ +)|( +$)/g,"")}}}function removeClass(c,b){var a=c.className;var e=" "+c.className+" ";e=e.replace(new RegExp(" ("+b+" +)+","g")," ");c.className=e.replace(/(^ +)|( +$)/g,"")}_LOADERS=Array();function callAllLoaders(){var b,a;for(b=0;b<_LOADERS.length;b++){a=_LOADERS[b];if(a!=callAllLoaders){a()}}}function appendLoader(a){if(window.onload&&window.onload!=callAllLoaders){_LOADERS[_LOADERS.length]=window.onload}window.onload=callAllLoaders;_LOADERS[_LOADERS.length]=a}appendLoader(autoInit_trees);function whenAvailable(b,c,f){if("object"!=typeof(availabilityCheckers)){availabilityCheckers={}}var e=function(){if("undefined"!=typeof(b[c])){checker=availabilityCheckers[a];clearInterval(checker.interval);checker.onAvailable(c,b[c])}};var a=setInterval(e,500);availabilityCheckers[a]={interval:a,onAvailable:f}};