/* Copyright (c) 2008 Akatoo Inc. */

function addEvent(C,B,A){if(C.addEventListener){C.addEventListener(B,A,false);EventCache.add(C,B,A)}else{if(C.attachEvent){C["e"+B+A]=A;C[B+A]=function(){C["e"+B+A](window.event)};C.attachEvent("on"+B,C[B+A]);EventCache.add(C,B,A)}else{C["on"+B]=C["e"+B+A]}}}var EventCache=function(){var A=[];return{listEvents:A,add:function(B,D,C){A.push(arguments)},flush:function(){var B,C;for(B=A.length-1;B>=0;B=B-1){C=A[B];if(C[0].removeEventListener){C[0].removeEventListener(C[1],C[2],C[3])}if(C[1].substring(0,2)!="on"){C[1]="on"+C[1]}if(C[0].detachEvent){C[0].detachEvent(C[1],C[2])}C[0][C[1]]=null}}}}();addEvent(window,"unload",EventCache.flush);function $(A){return document.getElementById(A)}function stopEventPropagation(A){if(!A){A=window.event}A.cancelBubble=true;if(A.stopPropagation){A.stopPropagation()}}function preventEventDefault(A){if(!A){A=window.event}if(A.preventDefault){A.preventDefault()}else{A.returnValue=false}}Function.prototype.bind=function(){var B=[],D=arguments[0],C=this,A;for(A=1;A<arguments.length;++A){B.push(arguments[A])}return function(){for(var E=0;E<arguments.length;++E){B.push(arguments[E])}return C.apply(D,B)}};function focusFirstEmptyAfterPageLoads(){var A=arguments;addEvent(window,"load",function(){focusFields(A)})}function focusFirstEmpty(){var A=arguments;focusFields(A)}function focusFields(B){var A=B.length,D,C,E;for(D=0;D<A;D++){C=null;E=$(B[D]);if(null!=E){if(E.style.display!="none"&&E.style.visibility!="hidden"){if("text"==E.type||"password"==E.type){C=E.value}else{if("textarea"==E.type){C=E.innerHTML}}if(null!=C){if(""==C){try{E.focus()}catch(E){}break}}}}}}function focusAfterPageLoads(A){addEvent(window,"load",function(){try{$(A).focus()}catch(B){}})};

/* Taken with modification from Alfred's "Pica". */

var instances = new Object();


// For JS and DOM.
function Lang(){
	
	// Browser
	
		/*public*/ this.isIE = function(){
			return this.findBrowserName("MSIE");
		}
		
		/*public*/ this.isIE7OrNewer = function(){
			return (
				this.findBrowserName("MSIE 7") ||
				this.findBrowserName("MSIE 8") ||
				this.findBrowserName("MSIE 9") );
		}
		
		/*public*/ this.isIE8 = function(){
			return this.findBrowserName("MSIE 8");
		}
		
		/*public*/ this.isIE7 = function(){
			return this.findBrowserName("MSIE 7");
		}
		
		/*public*/ this.isIE6 = function(){
			return this.findBrowserName("MSIE 6");
		}
		
		/*public*/ this.isIE6OrOlder = function(){
			return (
				this.findBrowserName("MSIE 6") ||
				this.findBrowserName("MSIE 5") ||
				this.findBrowserName("MSIE 4") );
		}
		
		/*public*/ this.isFirefox = function(){
			return this.findBrowserName("Firefox");
		}
		
		/*public*/ this.isSafari = function(){
			return this.findBrowserName("Safari") &&
				 ! this.findBrowserName("Chrome") ;
		}
		
		/*public*/ this.isChrome = function(){
			return this.findBrowserName("Chrome");
		}
		
		/*private*/ this.findBrowserName = function(/*string*/ text){
			var nav = navigator.userAgent ;
			return -1 != nav.indexOf( text ) ;
		}
		
	// Window
	
		/*public*/ this.getWindowWidth = function(){
			return window.innerWidth ? 
				window.innerWidth : 
				document.body.clientWidth ;
		}
		
		/*public*/ this.getWindowHeight = function(){
			return window.innerHeight ? 
				window.innerHeight : 
				document.body.clientHeight ;
		}
		
		/*public*/ this.getWindowScrollY = function(){
			var out = 0;
			if( lang.isIE() ){
				//document.compatMode;
				//out = document.documentElement.scrollTop;
				out = lang.b().scrollTop;
			}
			else out = lang.w().scrollY;
			return out;
		}
		
		/*public*/ this.getWindowScrollX = function(){
			var out = 0;
			if( lang.isIE() ){
				//document.compatMode;
				//out = lang.d().documentElement.scrollLeft; 
				out = lang.b().scrollLeft;
			}
			else out = lang.w().scrollX;
			return out;
		}
		
		/*public*/ this.center = function(/*Element*/ e){
			
			var wx = lang.getWindowScrollX();
			var wy = lang.getWindowScrollY();
			var ww = lang.getWindowWidth();
			var wh = lang.getWindowHeight();
			var ew = lang.getW( e );
			var eh = lang.getH( e );
			if( lang.isIE() ){
				// caution: may need to change if
				// not in IE Quirks mode.
				lang.setL( e, wx + ((ww-ew)/2) );
				lang.setT( e, wy + ((wh-eh)/2) );
			}
			else{
				lang.setL( e, wx + ((ww-ew)/2) );
				lang.setT( e, wy + ((wh-eh)/2) );
			}
		}
	
	// Common Elements.
	
		/*public*/ this.w = function(){ 
			return window; 
		}
		
		/*public*/ this.d = function(){ 
			return document; 
		}
		
		/*public*/ this.b = function(){ 
			return this.d().body; 
		}
		
		/*public*/ this.e = function( /*string*/ id ){ 
			var e = this.d().getElementById(id);
			if( !e ){
				var elms = this.d().getElementsByName(id);
				if( elms )
					if( elms.length )
						e = elms[0];
			}
			
			return e;
		}

	// Element ID's.
		
		/*private*/ this.defaultID = 0;
		
		/*public*/ this.id = function( /*Element*/ e ){ 
			if( e ){
				if( ! e.id ) 
					e.id = "ELEMENT" + (lang.defaultID++) ;
				return e.id;
			}
			return null;
		}
		
		/*public*/ this.getIDIndex = function( /*string*/ id, /*int*/ pos ){
			var a = 0;
			for(var p=0; p<=pos; p++){
				a = id.indexOf("[", a);
				if( -1 == a ) return -1;
				a += 1;
			}
			var b = id.indexOf("]", a);
			return lang.int( id.substr(a, b-a) );
		}
		
	// Creating new elements.
	
		/*public*/ this.newElement = function( /*string*/ tag ){ 
			return this.d().createElement(tag); 
		}
		
		/*public*/ this.newDiv	= function(){
			return this.newElement("div"); 
		}
		
		/*public*/ this.newScript = function(){ 
			return this.newElement("script"); 
		}
		
		/*public*/ this.newStyle = function(){ 
			return this.newElement("style"); 
		}
		
		/*public*/ this.newStyleSheet = function(){ 
			return this.newElement("styleSheet"); 
		}
		
		/*public*/ this.newLink = function(){ 
			return this.newElement("link"); 
		}
		
		/*public*/ this.newImg = function(){
			return this.newElement("img"); 
		}
	
	// Text
	
		/*public*/ this.setText	= function( /*Element*/ e, /*string*/ text ){ 
			var tag = e.tagName.toUpperCase();
			if( 	 tag == "INPUT" 	){ e.value = text; }
			else if( tag == "IMG"   	){ e.src   = text; }
			else if( tag == "TEXTAREA"	){ e.value = text; e.innerHTML = text; } // For Firefox & IE.
			else /*last attempt*/		 { e.innerHTML = text; }			
		}
		
		/*public*/ this.getText	= function( /*Element*/ e ){
			var tag = e.tagName.toUpperCase();
			if( 	 tag == "INPUT" 	){ 
				var t = e.type;
				if( "checkbox" == t ){
					if( e.checked ) return "on";
					else return "off";
				}
				else{
					return e.value;
				}
			}
			else if( tag == "IMG"   	){ return e.src; }
			else if( tag == "TEXTAREA"	){ return e.value ? e.value : e.innerHTML ; } // For Firefox & IE.
			else /*last attempt*/		 { return e.innerHTML; }
		}
		
	// Read / ReadWrite
	
		/*public*/ this.setRead = function( /*Element*/ e ){
			if( this.isIE() )
				 e.readOnly = true;
			else e.readOnly = "yes";
		}
		
		/*public*/ this.setReadWrite = function( /*Element*/ e ){
			if( this.isIE() )
				 e.readOnly = false;
			else e.readOnly = "";
		}
	
	// Checked
	
		/*public*/ this.setChecked = function( /*Element*/ e ){
			e.checked = true;
		}
		
		/*public*/ this.setUnChecked = function( /*Element*/ e ){	
			e.checked = false;
		}
		
		/*public*/ this.isChecked = function( /*Element*/ e ){
			return ( "yes"==e.check || true==e.checked );
		}
		
	// Visibility
	
		// Fixies IE visibility problems.
		/*public*/ this.show = function( /*Element*/ e, /*int*/ msBegin ){ 
			var id = lang.id(e);
			if( ! lang.isShown(e) ){
				if( msBegin )
					setTimeout( "lang.setL(lang.e('"+id+"'), lang.getL(lang.e('"+id+"')) + 10000);", msBegin);
				else
					lang.setL(e, lang.getL(e) + 10000 );
			}
		}
		
		/*public*/ this.hide = function( /*Element*/ e, /*int*/ msBegin ){ 
			var id = lang.id(e);
			if( lang.isShown(e) ){
				if( msBegin )
					setTimeout( "lang.setL(lang.e('"+id+"'), lang.getL(lang.e('"+id+"')) - 10000);", msBegin);
				else
					lang.setL(e, lang.getL(e) - 10000 );
			}
		}
		
		/*public*/ this.isShown = function( /*Element*/ e ){
			return ( -1000 < lang.getL(e) ) ;
		}
		
	// Opacity
	
		/*public*/ this.setOpacity = function( /*Element*/ e, /*float*/ alpha ){ 
			e.style.opacity=alpha; 
			e.style.filter = "alpha(opacity = " + 
				(alpha*100) + ")"; 
		}
		
		/*public*/ this.getOpacity = function( /*Element*/ e ){ 
			var o = e.style.opacity ? 
				e.style.opacity : e.style.filter ;
			if( !o ) o = -1;
			return this.float(o); 
		}
		
		/*public*/ this.fade = function( /*Element*/ e, /*float*/ alphaFrom, /*float*/ alphaTo, /*int*/ msBegin ){
			var id = lang.id(e);
			if( ! msBegin ) msBegin = 0;
			setTimeout("lang.fadeStep(lang.e('"+id+"'), "+alphaFrom+", "+alphaTo+");", msBegin);
		}
		
		/*private*/ this.fadeStep = function( /*Element*/ e, /*float*/ alphaFrom, /*float*/ alphaTo){
			if( e ){
				var id = lang.id(e);
				var ms = 100;
				var dt = alphaTo - alphaFrom;
				if( dt ){
					var a = alphaFrom ;
					if( alphaFrom < alphaTo ){
						
						a += 0.1;
						
						if( alphaTo < a ) a = alphaTo;
					}
					else{
						a -= 0.1;
						if( a > alphaFrom ) a = alphaFrom;
					}
					lang.setOpacity(e, a);
					if( a!=alphaFrom && a!=alphaTo ){
						alphaFrom = a;
						setTimeout("lang.fadeStep(lang.e('"+id+"'), "+alphaFrom+", "+alphaTo+");", 25);
					}
					else{ // Hack to fix an IE opacity bug
						if( 1 == lang.getOpacity(e) )
							if( e.style.filter )
								e.style.filter = "";
					}
				}
			}
		}
	
	// Event Handling.
	
		/*public*/ this.onEvent = function( /*Element*/ e, /*string*/ evt, /*Function*/ f ){ 
			// Hook 'em up!
			if( null != e && undefined != e ){
				if( e.addEventListener )
					 e.addEventListener(evt, f, false); 
				else e.attachEvent( "on" + evt, f );
			}
		}
		
		/*public*/ this.onLoad = function( /*Element*/ e, /*Function*/ f ){ 
			this.onEvent(e, 'load', f); 
		}
		
		/*public*/ this.onClick = function( /*Element*/ e, /*Function*/ f ){ 
			this.onEvent(e, 'click', f); 
		}	
		
		/*public*/ this.onDblClick = function( /*Element*/ e, /*Function*/ f ){ 
			this.onEvent(e, 'dblclick', f); 
		}	
		
		/*public*/ this.onMouseOver = function( /*Element*/ e, /*Function*/ f ){ 
			this.onEvent(e, 'mouseover', f); 
		}	
		
		/*public*/ this.onMouseOut = function( /*Element*/ e, /*Function*/ f ){ 
			this.onEvent(e, 'mouseout', f); 
		}	
		
		/*public*/ this.onMouseDown = function( /*Element*/ e, /*Function*/ f ){ 
			this.onEvent(e, 'mousedown', f); 
		}	
		
		/*public*/ this.onMouseUp = function( /*Element*/ e, /*Function*/ f ){ 
			this.onEvent(e, 'mouseup', f); 
		}	
		
		/*public*/ this.onFocus = function( /*Element*/ e, /*Function*/ f ){ 
			this.onEvent(e, 'focus', f); 
		}	
		
		/*public*/ this.onBlur = function( /*Element*/ e, /*Function*/ f ){ 
			this.onEvent(e, 'blur', f); 
		}
		
		/*public*/ this.onKeyDown = function( /*Element*/ e, /*Function*/ f ){ 
			this.onEvent(e, 'keydown', f); 
		}
		
		/*public*/ this.onKeyUp = function( /*Element*/ e, /*Function*/ f ){ 
			this.onEvent(e, 'keyup', f);
		}
		
		/*public*/ this.onType = function( /*Element*/ e, /*Function*/ f ){ 
			this.onEvent(e, 'keyup', f);
		}
		
		/*public*/ this.onChange = function( /*Element*/ e, /*Function*/ f ){
			this.onEvent(e, 'change', f);
		}
		
		/*public*/ this.onScroll = function( /*Element*/ e, /*Function*/ f ){
			this.onEvent(e, 'scroll', f);
		}
		
		/*public*/ this.target = function( /*Event*/   v ){ 
			return (v.target ? v.target : v.srcElement) ; 
		}
		
		// To revisit.
		/*public*/ this.originalTarget = function( /*Event*/ v ){
			return (v.originalTarget ? v.originalTarget : v.srcElement) ; 
		}
		
	// Casts.
	
		/*public*/ this.int = function( /*string*/ txt ){ 
			return parseInt(txt, 10); 
		}
		
		/*public*/ this.float = function( /*string*/ txt ){ 
			return parseFloat(txt, 10); 
		}
	
	// Positioning.
	
		/*public*/ this.getL = function( /*Element*/ e ){ 
			return this.int( e.style.left 	); 
		}
		
		/*public*/ this.getR = function( /*Element*/ e ){ 
			return this.int( e.style.right ); 
		}
		
		/*public*/ this.getT = function( /*Element*/ e ){ 
			return this.int( e.style.top 	); 
		}
		
		/*public*/ this.getB = function( /*Element*/ e ){ 
			return this.int( e.style.bottom ); 
		}
		
		/*public*/ this.getW = function( /*Element*/ e ){ 
			return this.int( e.style.width 	); 
		}
		
		/*public*/ this.getH = function( /*Element*/ e ){ 
			return this.int( e.style.height 	); 
		}
		
		/*public*/ this.getScreenL = function(/*Element*/ e){
			var l=0;
			while(true){
				if( null==e || undefined==e ) break;
				l+=e.offsetLeft;
				e = e.offsetParent;
			}
			return l;
		}
		
		/*public*/ this.getScreenT = function(/*Element*/ e){
			var t=0;
			while(true){
				if( null==e || undefined==e ) break;
				t+=e.offsetTop;
				e = e.offsetParent;
			}
			return t;
		}
		
		/*public*/ this.getViewportL = function(/*Element*/ e){
			var l=0;
			while(true){
				if( null==e || undefined==e ) break;
				l+=(e.offsetLeft-e.scrollLeft);
				e = e.offsetParent;
			}
			return l;
		}
		
		/*public*/ this.getViewportT = function(/*Element*/ e){
			var t=0;
			while(true){
				if( null==e || undefined==e ) break;
				t+=(e.offsetTop-e.scrollTop);
				e = e.offsetParent;
			}
			return t;
		}
		
		/*public*/ this.setL = function( /*Element*/ e, /*int*/ px, /*int*/ msBegin ){ 
			if( ! msBegin ){
				e.style.left = px + "px"; 
			}
			else{
				var id = lang.id( e );
				var js = "lang.e('" + id + "').style.left = \"" + px + "px\";" ;
				setTimeout( js, msBegin );
			}
		}
		
		/*public*/ this.setR = function( /*Element*/ e, /*int*/ px, /*int*/ msBegin ){ 
			if( ! msBegin ){
				e.style.right = px + "px"; 
			}
			else{
				var id = lang.id( e );
				var js = "lang.e('" + id + "').style.right = \"" + px + "px\";" ;
				setTimeout( js, msBegin );
			}
		}
		
		/*public*/ this.setT = function( /*Element*/ e, /*int*/ px, /*int*/ msBegin ){ 
			if( ! msBegin ){
				e.style.top = px + "px"; 
			}
			else{
				var id = lang.id( e );
				var js = "lang.e('" + id + "').style.top = \"" + px + "px\";" ;
				setTimeout( js, msBegin );
			}
		}
		
		/*public*/ this.setB = function( /*Element*/ e, /*int*/ px, /*int*/ msBegin ){ 
			if( ! msBegin ){
				e.style.bottom = px + "px"; 
			}
			else{
				var id = lang.id( e );
				var js = "lang.e('" + id + "').style.botttom = \"" + px + "px\";" ;
				setTimeout( js, msBegin );
			}
		}
		
		/*public*/ this.setW = function( /*Element*/ e, /*int*/ px, /*int*/ msBegin ){ 
			if( ! msBegin ){
				e.style.width = px + "px"; 
			}
			else{
				var id = lang.id( e );
				var js = "lang.e('" + id + "').style.width = \"" + px + "px\";" ;
				setTimeout( js, msBegin );
			}
		}
			
		/*public*/ this.setH = function( /*Element*/ e, /*int*/ px, /*int*/ msBegin ){ 
			if( ! msBegin ){
				e.style.height = px + "px"; 
			}
			else{
				var id = lang.id( e );
				var js = "lang.e('" + id + "').style.height = \"" + px + "px\";" ;
				setTimeout( js, msBegin );
			}
		}
		
		/*public*/ this.centerWithRespectTo = function( /*Element*/ toCenter, /*Element*/ withRespectTo ){
			var a = toCenter;
			var b = withRespectTo;
			
			var aL = lang.getL( a );
			var aT = lang.getT( a );
			var aW = lang.getW( a );
			var aH = lang.getH( a );
			
			var bL = lang.getL( b );
			var bT = lang.getT( b );
			var bW = lang.getW( b );
			var bH = lang.getH( b );
			
			lang.setL( a, bL + ((bW - aW)/2) );
			lang.setT( a, bT + ((bH - aH)/2) );
			lang.setW( a, aW );
			lang.setH( a, aH );
		}
		
	// Math.
	
		/*public*/ this.min	= function( /*number*/ lhs, /*number*/ rhs ){ 
			return Math.min( lhs, rhs ); 
		}
		
		/*public*/ this.max	= function( /*number*/ lhs, /*number*/ rhs ){ 
			return Math.max( lhs, rhs ); 
		}
		
		/*public*/ this.floor = function( /*number*/ n ){
			return Math.floor(n);
		}
		
		/*public*/ this.ceil = function( /*number*/ n ){
			return Math.ceil(n);
		}
		
		/*public*/ this.round = function( /*number*/ n ){ 
			return Math.round(n); 
		}
		
		/*public*/ this.abs	= function( /*number*/ n ){ 
			return Math.abs(n); 
		}
		
		/*public*/ this.pow = function( /*number*/ n, /*int*/ power ){
			return Math.pow(n, power);
		}
		
	// String
	
		/*public*/ this.replaceCaseSensitive = function( /*string*/ s, /*string*/ toReplace, /*string*/ replaceWith){
			return this.replace( s, toReplace, replaceWith, true );
		}
		
		/*public*/ this.replaceCaseInsensitive = function( /*string*/ s, /*string*/ toReplace, /*string*/ replaceWith){
			return this.replace( s, toReplace, replaceWith, false );
		}
		
		/*public*/ this.replace = function( /*string*/ s, /*string*/ toReplace, /*string*/ replaceWith, /*bool*/ caseSensitive){
			
			var f = caseSensitive ? "g" : "gi" ;
			if( this.isIE() ){
				var re = new RegExp( toReplace, f );
			 	s = s.replace(re, replaceWith);
			 	delete re;
		 	}
		 	else if( this.isFirefox() ){
			 	s = s.replace(toReplace, replaceWith, f);
		 	}
		 	else{
			 	var bef = s; var aft = s;
			 	for( var i=0; i<500; i++){
				 	bef = aft;
			 		aft = bef.replace( toReplace, replaceWith );
			 		if( bef == aft ) break;
		 		}
			 	s = aft;
		 	}
		 	return s;
		}
		
		/*public*/ this.strLeft = function( /*string*/ s, /*int*/ chars ){
			return s.substr(0, chars);
		}
		
		/*public*/ this.strRight = function( /*string*/ s, /*int*/ chars ){
			var l = this.strLength(s);
			var s = this.max( l-chars, 0 );
			return s.substr(s);
		}
		
		/*public*/ this.strLength = function( /*string*/ s ){
			return s.length;
		}
		
		/*public*/ this.strMid = function( /*string*/ s, /*int*/ start, /*int*/ chars ){
			if( chars ) return s.substr(start, chars);
			else return s.substr(start);
		}
		
		/*public*/ this.strToUpper = function(/*string*/ s){
			return s.toUpperCase();
		}
		
		/*public*/ this.strToLower = function(/*string*/ s){
			return s.toLowerCase();
		}
		
	// Ajax.
	
		/*public*/ this.sendAjax = function(/*string*/ method, /*string*/ url, /*Object*/ params, /*function*/ clbSuccess, /*function*/ clbFailure){
			var req = this.getAjaxRequest();
			req.onreadystatechange = function(){ 
			    if (req.readyState == 4) {
			        if (req.status == 200) {
			            if( clbSuccess ) clbSuccess(req.responseText);
			        } else {
				        //alert("There was a problem retrieving the XML data:\n" + req.statusText + "/" + req.responseText);
				        if( clbFailure ) clbFailure(req.responseText);
			            
			        }
			    }
			};			
			
			var body = "";
			for( key in params ){
				var val = params[key];
				if( body ) body += "&";
				body += key + "=" + encodeURI(val) ;
			}
			req.open("POST", url + "?" + body, true); // true means asynch, false means synch
			req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
			req.send(body);
		}
		
		/*private*/ this.getAjaxRequest = function(){
			var req = null;
			if( this.isIE() ){
				try{ req = new ActiveXObject("Msxml2.XMLHTTP"); }
				catch(e){
				    try{ req =new ActiveXObject("Microsoft.XMLHTTP"); }
				    catch(e){}
				}
			}
			else{
				try{ req = new XMLHttpRequest(); }
				catch(e){}
			}
			return req;
		}
		
	// Date And Time.
		
		/*public*/ this.now = function(){
			var now = new Date();
			var nowMs = now.getTime();
			delete now;
			return nowMs;
		}
	
	// MsgBox
	
		/*public*/ this.msgBox = function( /*string*/ s0, /*string*/ s1, /*string*/ s2, /*string*/ s3, /*string*/ s4, /*string*/ s5, /*string*/ s6, /*string*/ s7, /*string*/ s8, /*string*/ s9 ){
			alert( "[" + s0 + "]\n[" + s1 + "]\n[" + s2 + "]\n[" + s3 + "]\n[" + s4 + "]\n[" + s5 + "]\n[" + s6 + "]\n[" + s7 + "]\n[" + s8 + "]\n[" + s9 + "]" ); 
		}
	
	/*public*/ this.trash = function( /*string*/ objectPath ){}
}
var lang = new Lang();



function AnimationSequence(/*string*/ eid, /*string*/ f){
	/*public*/ this.elementID = null;
	/*public*/ this.facet = ""; 		// L,T,W,H
	
	// Specifies the travelling path.
	/*public*/ this.deltaPx = -1;
	/*public*/ this.deltaMs = -1;
	/*public*/ this.curve 	= "";
	
	// Decided at runtime.
	/*public*/ this.startPx = -1;
	/*public*/ this.startMs = -1;
	
	// Implicit constructor.
	this.construct = function(){
		this.elementID = eid;
		this.facet = f;
	}
	this.construct();
	
	/*public*/ this.setTravellingPath = function(/*int*/ deltaPx, /*int*/ deltaMs, /*string*/ curve){
		this.deltaPx = deltaPx;
		this.deltaMs = deltaMs;
		this.curve 	 = curve;
	}
	
	/*public*/ this.startFrame = function(){
		var e = lang.e(this.elementID);
		if( 	"L" == this.facet ) this.startPx = lang.getL( e );
		else if("R" == this.facet ) this.startPx = lang.getR( e );
		else if("T" == this.facet ) this.startPx = lang.getT( e );
		else if("B" == this.facet ) this.startPx = lang.getB( e );
		else if("W" == this.facet ) this.startPx = lang.getW( e );
		else if("H" == this.facet ) this.startPx = lang.getH( e );
		this.startMs = lang.now();
	}
	
	/*public*/ this.drawFrame = function(){
		if( 	 "linear" 	 == this.curve ) return this.computeLinear();
		else if( "quadratic" == this.curve ) return this.computeQuadratic();
		else if( "cubic"	 == this.curve ) return this.computeCubic();
		else return this.computeLinear();
	}
	
	
	/*private*/ this.computeLinear = function(){
		var per = (lang.now() - this.startMs) / this.deltaMs;
		if( per < 0 ) per = 0;
		if( 1 < per ) per = 1;
		
		var px = lang.round( (per * this.deltaPx) + this.startPx );
		var e = lang.e(this.elementID);
		if( 	"L" == this.facet ) lang.setL( e, px );
		else if("R" == this.facet ) lang.setR( e, px );
		else if("T" == this.facet ) lang.setT( e, px );
		else if("B" == this.facet ) lang.setB( e, px );
		else if("W" == this.facet ) lang.setW( e, px );
		else if("H" == this.facet ) lang.setH( e, px );
		return (per != 1) ;
	}
	
	/*private*/ this.computeQuadratic = function(){
		var now = lang.now();
		var per = (now - this.startMs) / this.deltaMs;
		if( per < 0 ) per = 0;
		if( 1 < per ) per = 1;
		
		// Two quadratic formulas spliced together:
		// Left formula if a normal quadratic: y = a(x^2);
		// Right formula is an upside-down quadratic: y = -a((x-dx)^2) + dy
		
		// You really just have to trust me on this one...
		var dy = this.deltaPx;
		var dx = this.deltaMs;
		var a = (dy/2) / lang.pow( (dx/2), 2 ) ;
		
		var x = per * dx;
		var y = null;
		if( x < (dx/2) ) 		// Left formula.
			y = a*lang.pow(x, 2) ;
		else 					// Right formula.
			y = ( (-1*a)*lang.pow(x-dx,2) ) + dy ;
		
		var px = lang.round(y) + this.startPx;
		var e = lang.e(this.elementID);
		if( 	"L" == this.facet ) lang.setL( e, px );
		else if("R" == this.facet ) lang.setR( e, px );
		else if("T" == this.facet ) lang.setT( e, px );
		else if("B" == this.facet ) lang.setB( e, px );
		else if("W" == this.facet ) lang.setW( e, px );
		else if("H" == this.facet ) lang.setH( e, px );
		return (per != 1);
	}
	
	/*private*/ this.computeCubic = function(){
		
		var now = lang.now();
		var per = (now - this.startMs) / this.deltaMs;
		if( per < 0 ) per = 0;
		if( 1 < per ) per = 1;
		
		// Two cubic formulas spliced together:
		// Left formula if a normal cubic: y = a(x^3)
		// Right formula is an upside-down cubic: y = -a((x-dx)^3) + dy
		
		// You really just have to trust me on this one...
		var dy = this.deltaPx;
		var dx = this.deltaMs;
		var a = (dy/2) / lang.pow(dx/2, 3);
		
		var x = per * dx;
		var y = null;
		if( x < (dx/2) ) 		// Left formula.
			y = a*lang.pow(x, 3) ;
		else 					// Right formula.
			y = ( a*lang.pow(x-dx,3) ) + dy ;
		
		var px = lang.round(y) + this.startPx;
		var e = lang.e(this.elementID);
		if( 	"L" == this.facet ) lang.setL( e, px );
		else if("R" == this.facet ) lang.setR( e, px );
		else if("T" == this.facet ) lang.setT( e, px );
		else if("B" == this.facet ) lang.setB( e, px );
		else if("W" == this.facet ) lang.setW( e, px );
		else if("H" == this.facet ) lang.setH( e, px );
		return (per != 1);
	}
}




function AnimationSubject(){
	/*public*/ this.elementID = null;
	/*public*/ this.sequences = new Array();
	/*public*/ this.callback  = null;
	
	/*public*/ this.getSequence = function(/*string*/ facet){
		return this.sequences[facet];
	}
	
	/*public*/ this.addSequence = function(/*string*/ facet){
		var seq = new AnimationSequence( this.elementID, facet );
		this.sequences.push(seq);
		return seq;
	}
	
	/*public*/ this.clearSequences = function(){
		for( s in this.sequences ){
			for( m in this.sequences[s] )
				delete m;
			delete this.sequences[s];
		}
		delete this.sequences;
		this.sequences = new Array();
	}
	
	/*public*/ this.hasSequences = function(){
		return (i.sequences != 0) ;
	}
	
	/*public*/ this.addCallback = function(/*Object*/ clb){
		this.callback = clb;
	}
	
	// TODO:
	/*public*/ this.arrangeSequences = function(){}
	
	/*public*/ this.runSequences = function(/*int*/ msStartAnimation){
		if( ! msStartAnimation ) msStartAnimation = ani.msSequenceInterval;
		setTimeout( "ani.subjects['" + this.elementID + "'].runSequencesNow();", msStartAnimation);
	}
	
	/*private*/ this.runSequencesNow = function(){
		for( s in this.sequences )
			this.sequences[s].startFrame();
		setTimeout( "ani.subjects['" + this.elementID + "'].sequences_onTimer();" , 0);
	}
	
	/*public*/ this.sequences_onTimer = function(){
		var poll = false;
		for( s in this.sequences ){
			if( this.sequences[s].drawFrame() )
				poll = true;
		}
		
		if( poll ){
			var si = ani.msSequenceInterval;
			setTimeout( "ani.subjects['" + this.elementID + "'].sequences_onTimer();" , si);
		}
		else{
			if( this.callback )
				this.callback();
		}
	}
}




function Animation(){
	/*public*/ this.subjects = new Object();
	/*private*/ this.msSequenceInterval = 25;
	
	/*public*/ this.addSubject = function(/*Element*/ e){
		var sub = new AnimationSubject();
		var id = lang.id(e);
		sub.elementID = id;
		this.subjects[ id ] = sub;
		return sub;
	}
	
	/*public*/ this.getSubject = function(/*Element*/ e){
		var id = lang.id(e);
		if( this.subjects[id] )
			return this.subjects[id];
		else return null;
	}
	
	/*public*/ this.existSubject = function(/*Element*/ e){
		var id = lang.id(e);
		var sub = this.getSubject(e);
		if( ! sub ) sub = this.addSubject(e);
		return sub;
	}
	
	/*public*/ this.removeSubject = function(/*Element*/ e){
		var id = lang.id(e);
		if( this.getSubject(e) )
			lang.trash("ani.subjects." + id );
	}
	
	// Simple animations.
	
		/*public*/ this.runSingleSequence = function( /*Element*/ e, /*string*/ facet, /*int*/ deltaPx, /*int*/ deltaMs, /*string*/ curve, /*Object*/ callback, /*int*/ msStartAnimation){
			var sub = ani.existSubject( e );
			sub.clearSequences();
			var seq = sub.addSequence( facet );
			seq.setTravellingPath( deltaPx, deltaMs, curve);
			sub.addCallback(callback);
			sub.runSequences(msStartAnimation);
		}
		
		/*public*/ this.appearFrom = function( /*Element*/ toAppear, /*Element*/ from, /*int*/ deltaMs, /*string*/ curve, /*Object*/ callback, /*int*/ msStartAnimation ){
			var a = toAppear;
			var f = from;
			
			lang.show( a );
			a.style.overflow = "hidden";
			
			var aL = lang.getL(a);
			var aT = lang.getT(a);
			var aW = lang.getW(a);
			var aH = lang.getH(a);
			
			var fL = lang.getL(f);
			var fT = lang.getT(f);
			var fW = lang.getW(f);
			var fH = lang.getH(f);
			
			var cL = fL + (fW/2);
			var cT = fT + (fH/2);
			
			lang.setL( a, cL );
			lang.setT( a, cT );
			lang.setW( a, 0  );
			lang.setH( a, 0  );
			
			var sub = ani.existSubject( a );
			
			var seq = sub.addSequence( "L" );
			seq.setTravellingPath( aL-cL, deltaMs, curve );
			
			seq = sub.addSequence( "T" );
			seq.setTravellingPath( aT-cT, deltaMs, curve );
			
			seq = sub.addSequence( "W" );
			seq.setTravellingPath( aW, deltaMs, curve );
			
			seq = sub.addSequence( "H" );
			seq.setTravellingPath( aH, deltaMs, curve );
			
			sub.addCallback( callback );
			sub.runSequences( msStartAnimation );
		}
		
		/*public*/ this.disappearInto = function( /*Element*/ toDisappear, /*Element*/ into, /*int*/ deltaMs, /*string*/ curve, /*Object*/ callback, /*int*/ msStartAnimation ){
			var d = toDisappear;
			var i = into;
			
			lang.show( d );
			d.style.overflow = "hidden";
			
			var dL = lang.getL(d);		// toDisappear.
			var dT = lang.getT(d);
			var dW = lang.getW(d);
			var dH = lang.getH(d);
			
			var iL = lang.getL(i);		// into.
			var iT = lang.getT(i);
			var iW = lang.getW(i);
			var iH = lang.getH(i);
			
			var cL = iL + (iW/2);
			var cT = iT + (iH/2);
			
			var sub = ani.existSubject( d );
			var seq = sub.addSequence( "L" );
			seq.setTravellingPath( -(dL-cL), deltaMs, curve );
			
			seq = sub.addSequence( "T" );
			seq.setTravellingPath( -(dT-cT), deltaMs, curve );
			
			seq = sub.addSequence( "W" );
			seq.setTravellingPath( -dW, deltaMs, curve );
			
			seq = sub.addSequence( "H" );
			seq.setTravellingPath( -dH, deltaMs, curve );
			
			// HACK: Defer callback until after onDisappear().
			sub.addCallback( null ); 
			this.disappearCallback = callback;
			sub.runSequences( msStartAnimation );
			setTimeout( "ani.onDisappear( lang.e('" + lang.id(d) + "'), " + dL + ", " + dT + ", " + dW + ", " + dH + ");" , deltaMs+250 );
		}
		
		this.disappearCallback = null;
		
		/*public*/ this.onDisappear = function( /*Element*/ disappeared, /*int*/ l, /*int*/ t, /*int*/ w, /*int*/ h, /*Object*/ callback ){
			var d = disappeared;
			lang.show( d );
			lang.setL( d, l );
			lang.setT( d, t );
			lang.setW( d, w );
			lang.setH( d, h );
			lang.hide( d );
			if( this.disappearCallback )
				this.disappearCallback();
		}
		
}
var ani = new Animation();




function Timer(){
	/*public*/ this.timerID    	  = -1;
	/*public*/ this.callback   	  = null;
	/*public*/ this.msInterval 	  = -1;
	/*public*/ this.msLastStarted = -1;
	/*public*/ this.isStarted  	  = false;
	/*public*/ this.pollID		  = -1;
}




function Timers(){
	/*public*/ this.timers = new Array();
	
	/*public*/ this.addTimer = function(/*Object*/ callback, /*int*/ msInterval){
		var t = new Timer();
		var tid = this.timers.length;
		t.timerID = tid;
		t.callback = callback;
		t.msInterval = msInterval;
		this.timers[tid] = t;
		return tid;
	}
	
	/*private*/ this.isTimerReady = function(/*int*/ timerID){
		var out = false;
		var t = this.timers[timerID];
		if( t ){
			if( -1 	 != t.timerID 	 &&
				null != t.callback   &&
				-1 	 != t.msInterval ){
				out = true;
			}
		}
		return out;
	}
	
	/*public*/ this.getTimer = function(/*int*/ timerID ){
		var out = null;
		if( this.isTimerReady(timerID) )
			out = this.timers[timerID] ;
		return out;
	}
	
	/*public*/ this.start = function(/*int*/ timerID){
		var out = false;
		var t = this.getTimer(timerID);
		if( t ){
			if( ! t.isStarted ){
				t.isStarted = true;
				t.msLastStarted = lang.now();
				this.pollAfterMs( t.timerID, ++t.pollID, t.msInterval );
				out = true;
			}
		}
		return out;
	}
	
	/*public*/ this.stop  = function(/*int*/ timerID){
		var out = false;
		var t = this.getTimer(timerID);
		if( t ){
			if( t.isStarted ){
				t.isStarted = false;
				out = true;
			}
		}
		return out;
	}
	
	/*public*/ this.isStarted = function(/*int*/ timerID){
		var out = false;
		var t = this.getTimer(timerID);
		if( t ) out = t.isStarted;
		return out;
	}
	
	/*private*/ this.poll = function(/*int*/ timerID, /*int*/ pollID){
		var out = false;
		var t = this.getTimer(timerID);
		if( t ){
			if( pollID == t.pollID ){
				if( t.isStarted ){
					t.callback( timerID );
					this.pollAfterMs( timerID, pollID, t.msInterval );
				}
			}
		}
		return out;
	}
	
	/*private*/ this.pollAfterMs = function( /*int*/ timerID, /*int*/ pollID, /*int*/ ms ){
		setTimeout("timers.poll(" + timerID + ", " + pollID + ");", ms );
	}
	
	/*public*/ this.getElapsed = function(/*int*/ timerID){
		var out = -1;
		var t = this.getTimer(timerID);
		if( t ) out = lang.now() - t.msLastStarted ;
		return out;
	}
}
var timers = new Timers();




// For pica-style controls
function Control(){
	
	/*public*/ this.ieWrappingLinkFix = function(/*Element*/ parent ){
		if( lang.isIE() ){
			var a = this.getWrappingLink(parent);
			if( a && parent ){
				parent.style.cursor = "pointer";
				lang.onEvent( parent, "click", function(){control.onLinkClick(a)} );
			}
		}
	}
	
	/*private*/ this.getWrappingLink = function(/*Element*/ parent){
		var out = null;
		var p = parent;
		for(var i=0; i<4; i++){
			if( !p ) break;
			if( "A" == p.tagName ){
				out = p;
				break;
			}
			p = p.parentNode;
		}
		return out;
	}
	
	/*private*/ this.onLinkClick = function(/*Element*/ a){
		window.location = a.href;
	}
}
var control = new Control();/* Copyright (c) 2008 Akatoo, Inc. */

function IKUScale(){
	// Id.
	this.id 		= "";
	
	// Elements.
	this.rainbow	= null;
	this.blur		= null;
	this.solid		= null;
	this.pointer 	= null;
	this.parent 	= null;
	
	// State.
	this.min 	= -1;
	this.val	= -1;
	this.max	= -1;
	this.rngMin = -1;
	this.rngMax = -1;
	this.pointerWidth 	= -1;
	this.parentWidth 	= -1;
	this.pointerHeight 	= -1;
	this.parentHeight 	= -1;
	
	// An explicit constructor.
	
	
	
	
		/*public*/ this.construct = function(/*string*/ id){
			this.id 		= id;
			
			this.rainbow = new IKUBarLayer();
			this.rainbow.construct( id + ".rainbow" );
			
			this.blur = new IKUBarLayer();
			this.blur.construct( id + ".blur" );
			
			this.solid = new IKUBarLayer();
			this.solid.construct( id + ".solid" );
			
			this.pointer 		= lang.e( id + ".pointer" );
			this.pointerWidth 	= lang.getW( this.pointer );
			this.pointerHeight 	= lang.getH( this.pointer );
			
			this.parent 		= this.pointer.parentNode;
			this.parentWidth 	= lang.getW( this.parent );
			this.parentHeight 	= lang.getH( this.parent );
			
			// IE hack.
			control.ieWrappingLinkFix( this.parent );
		}
		
		
		
		
	// Events.
	
	
	
	
		/*public*/ this.onRainbowViewerClick = function(/*Element*/ a){
			window.location = a.href;
		}
		
		/*public*/ this.onBlurViewerClick = function(/*Element*/ a){
			window.location = a.href;
		}
		
		/*public*/ this.onSolidViewerClick = function(/*Element*/ a){
			window.location = a.href;
		}
		
		
		
		
	/*public*/ this.setLimits = function(/*float*/ min, /*float*/ max){
		this.min = lang.float( min );
		this.max = lang.float( max );
	}
	
	/*public*/ this.setPointer = function(/*float*/ val){
		this.val = lang.float( val );
	}
	
	/*public*/ this.setRange = function(/*float*/ min, /*float*/ max){
		this.rngMin = lang.float(min);
		this.rngMax = lang.float(max);
		// TODO: fix the limits if need be.
		if( this.rngMin < this.min ) this.min = this.rngMin;
		if( this.max < this.rngMax ) this.max = this.rngMax;
	}
	
	/*public*/ this.refresh = function(){
		if( this.min 	!= -1 &&
			this.rngMin != -1 &&
			this.val	!= -1 &&
			this.rngMax != -1 &&
			this.max	!= -1 ){
			if( this.min 	<= this.rngMin 	&&
				this.rngMin <= this.val 	&&
				this.val 	<= this.rngMax  &&
				this.rngMax	<= this.max 	){
				this.showLayers();
				this.redraw();
			}
			else{ this.hideLayers(); }
		}
	}
	
	/*private*/ this.showLayers = function(){
		lang.show( this.rainbow.viewer );
		lang.show( this.blur.viewer );
		lang.show( this.solid.viewer );
	}
	
	/*private*/ this.hideLayers = function(){
		lang.hide( this.rainbow.viewer );
		lang.hide( this.blur.viewer );
		lang.hide( this.solid.viewer );
	}
	
	/*private*/ this.redraw = function(){
		this.fitLayersToParent();
		this.positionLayers();
		this.positionPointer();
	}
	
	/*private*/ this.fitLayersToParent = function(){
		this.rainbow.fitToParent(this.parentWidth);
		this.blur.fitToParent	(this.parentWidth);
		this.solid.fitToParent	(this.parentWidth);
	}
	
	/*private*/ this.positionLayers = function(){
		this.positionLayer( this.blur, 		this.min, 	 this.rngMin );
		this.positionLayer( this.rainbow, 	this.rngMin, this.rngMax );
		this.positionLayer( this.solid, 	this.rngMax, this.max );	
	}
	
	/*private*/ this.positionLayer = function(/*IKUBarLayer*/ layer, /*int*/ from, /*int*/ to ){
		layer.view(
			this.toPx(from),
			this.toPx(to));
	}
	
	/*private*/ this.positionPointer = function(){
		lang.setL( this.pointer, 
			this.toPx(this.val) -
			( this.pointerWidth / 2 ) );
			
		lang.setT( this.pointer, 
			this.parentHeight - 
			this.pointerHeight - 1 );
	}
	
	// Returns the px position of the pointer
	/*public*/ this.getPointerLPx = function(){
		var pl = lang.getL( this.pointer ) ;
		pl += ( this.pointerWidth / 2 ) ;
		return pl ;
	}
	
	// Get the px for a number on the scale.
	/*private*/ this.toPx = function(/*int*/ num){
		var px = (num - this.min) / (this.max-this.min) ;
		px *= this.parentWidth;
		return px;
	}
	
}




function IKUBarLayer(){
	// Elements.
	this.viewer 	= null;
	this.bar		= null;
	this.left		= null;
	this.center		= null;
	this.right		= null;
	
	// An explicit constructor.
	/*public*/ this.construct = function(/*string*/ id){
		this.viewer = lang.e( id + ".viewer" );
		this.bar 	= lang.e( id + ".bar" );
		this.left	= lang.e( id + ".left" );
		this.center	= lang.e( id + ".center" );
		this.right	= lang.e( id + ".right" );
	}
	
	/*public*/ this.fitToParent = function(/*int*/ parentWidth){
		var pw = parentWidth;
		var lw = lang.getW( this.left );
		var rw = lang.getW( this.right );
		
		lang.setL( this.viewer, 0);
		lang.setW( this.viewer, pw);
		lang.setL( this.left, 0 );
		lang.setL( this.center, lw );
		lang.setW( this.center, pw-lw-rw );
		lang.setL( this.right, pw-rw );
	}
	
	
	
	/*public*/ this.view = function(/*int*/ fromPx, /*int*/ toPx){
		lang.setL( this.bar, -fromPx );
		lang.setL( this.viewer, fromPx );
		lang.setW( this.viewer, toPx - fromPx );
	}
}/* Copyright (c) 2008 Akatoo, Inc. */

function IKULightBulb(){
	// Id.
	this.id 			= "";
	
	// Elements.
	this.imgLShade0	= null;
	this.imgRShade0	= null;
	this.imgLShade1	= null;
	this.imgRShade1	= null;
	this.parent		= null;
	
	// State.
	this.IKU			= 100;
	this.colors 		= new Array();
	this.leftColor		= null;					//
	this.rightColor		= null;
	this.roundRobin		= new Array();
	
	
	/*public*/ this.construct = function(/*string*/ id){
		this.id = id;
		this.imgLShade0 = lang.e( id + ".lShade0" );
		this.imgRShade0 = lang.e( id + ".rShade0" );
		this.imgLShade1 = lang.e( id + ".lShade1" );
		this.imgRShade1 = lang.e( id + ".rShade1" );
		this.parent 	= this.imgLShade0.parentNode;
		
		this.roundRobin[0] = { left: this.imgLShade0, right: this.imgRShade0 };
		this.roundRobin[1] = { left: this.imgLShade1, right: this.imgRShade1 };

		// IE hack.
		control.ieWrappingLinkFix( this.parent );
		
		instances[id] = this;
	}
	
	/*public*/ this.addColor = function(/*int*/ IKU, /*string*/ color){
		var o = new Object();
		o.IKU = IKU;
		o.color = color;
		this.colors.push(o);
	}
	
	/*public*/ this.setIKU = function(/*float*/ IKU){
		this.IKU = lang.float( IKU );
	}
	
	/*public*/ this.refresh = function(/*bool*/ fade){
		if( null == fade ) fade = true;
		this.leftColor = null;
		this.rightColor = null;
		for( i in this.colors ){
			var c = this.colors[i];
			if( c.IKU <= this.IKU )
				this.leftColor = c;
		
			if( null == this.rightColor ){
				if( this.IKU < c.IKU ){
					this.rightColor = c;
					break;
				}
			}
		}
		this.refreshImages(fade);
	}
	
	/*private*/ this.refreshImages = function(/*bool*/ fade){
		var l = this.leftColor;
		var r = this.rightColor;
		
		if( null != l && null != r ){
			var a = this.IKU - l.IKU ;
			var b = r.IKU - this.IKU ;
			var c = r.IKU - l.IKU ;
			var rightOpacity = lang.float(a/c);
			
			this.roundRobinDown();
			this.setImageSrc();
			this.changeImages(rightOpacity, fade);
		}
	}
	
	/*private*/ this.roundRobinDown = function(){
		var rr = this.roundRobin;
		if( rr ){
			var top = rr[0];
			for( var i=1; i<rr.length; i++)
				rr[i-1] = rr[i];
			rr[i-1] = top;
		}
	}
	
	/*private*/ this.setImageSrc = function(){
		this.roundRobin[0].left.src  = "/images/controls/IKULightBulb/" + this.leftColor.color ;
		this.roundRobin[0].right.src = "/images/controls/IKULightBulb/" + this.rightColor.color ;
	}
	
	/*private*/ this.changeImages = function(/*int*/ rightOpacity, /*bool*/ fade ){
		if( lang.isIE6() ) fade = false;
		if( fade ){
			r0 = lang.getOpacity(this.roundRobin[0].right);
			r1 = lang.getOpacity(this.roundRobin[1].right);
			lang.fade( this.roundRobin[0].left, 0.0, 1.0 );
			lang.fade( this.roundRobin[0].right, r0, rightOpacity );
			lang.fade( this.roundRobin[1].left, 1.0, 0.0 );
			lang.fade( this.roundRobin[1].right, r1, 0.0 );
		}
		else{
			lang.setOpacity( this.roundRobin[0].left, 1.0 );
			lang.setOpacity( this.roundRobin[0].right, rightOpacity );
			lang.setOpacity( this.roundRobin[1].left, 0.0 );
			lang.setOpacity( this.roundRobin[1].right, 0.0 );
		}
	}
	
}
dates={_month_names:["???","Jan.","Feb.","Mar.","Apr.","May.","Jun.","Jul.","Aug.","Sep.","Oct.","Nov.","Dec."],_getMonthNameShort:function(A){var B=A.getMonth()+1;if(B<=0||B>this._month_names.length){B=0}return this._month_names[B]},formatMDY:function(F,A){var C=document.getElementById(F),D,G,E,B,H,I;if(C){D=new Date(A*1000);while(C.hasChildNodes()){C.removeChild(C.firstChild)}G=this._getMonthNameShort(D);I=D.getDate();C.appendChild(document.createTextNode(G+" "+I));switch(I){case 1:E="st";break;case 2:E="nd";break;case 3:E="rd";break;case 21:E="st";break;case 22:E="nd";break;case 23:E="rd";break;case 31:E="st";break;default:E="th";break}B=document.createElement("sup");B.appendChild(document.createTextNode(E));C.appendChild(B);H=D.getFullYear();C.appendChild(document.createTextNode(", "+H))}return C},deferFormatMDY:function(A,B){YAHOO.util.Event.onContentReady(A,function(){this.formatMDY(A,B)},this,true)},formatShortMDY:function(B,E){var F=document.getElementById(B),C,G,A,D;if(F){C=new Date(E*1000);while(F.hasChildNodes()){F.removeChild(F.firstChild)}G=C.getMonth()+1;if(G<10){G="0"+G}A=C.getDate();if(A<10){A="0"+A}D=C.getFullYear();F.appendChild(document.createTextNode(G+"."+A+"."+D))}},deferFormatShortMDY:function(A,B){YAHOO.util.Event.onContentReady(A,function(){this.formatShortMDY(A,B)},this,true)}};
