var isIE=(function(){
		var av=navigator.appVersion;
		var ua=navigator.userAgent.toLowerCase();
		var isIE=((typeof window.ActiveXObject!="undefined") && (av.indexOf('MSIE')!=-1));
		return isIE;
	})();	
	

	Xpander.Utils.addEvent(window,'load', function() {
		var nds=['monday','tuesday','wednesday','thursday','friday'];
		for(var x=0; x<nds.length; x++){
			new Xpander('pod-'+nds[x], isIE?77:75, 300, 'images/bt_close.gif','images/bt_expand_for_more.gif');
		}
		var imgs=[
			"images/but_home.gif",
			"images/but_parents.gif",
			"images/but_educators.gif",
			"images/but_kids.gif",
			"images/but_about_mww.gif",
			"images/but_gaw_over.gif",
			"images/but_blog.gif",
			"images/but_join.gif",
			"images/but_test_global_iq.gif",
			"images/but_games.gif",
			"images/but_spread_word.gif",
			"images/but_notify.gif",
			"images/but_media.gif"
		];
		for(var x=0; x<imgs.length; x++){
			var a=new Image();
			a.src=imgs[x];
			var b=new Image();
			b.src=imgs[x].replace(".gif","_over.gif");
			plImg.push(a,b);
		}
	 });  
	function swapIn(el){
		el.src=el.src.replace(".gif","_over.gif");
	}
	function swapOut(el){
		el.src=el.src.replace("_over.gif",".gif");
	}
	var clipVal="rect(0px 401px 100px 0px)";
	var plImg=[];
	if(isIE){
		Xpander.prototype._step=function() {		
			var time  = (new Date).getTime();
				if (time >= this.duration + this.startTime) {
					this.now = this.to;
					clearInterval (this.timer);
					this.timer = null;
					this._setToggleImg();
				} else {
					var pos = (time - this.startTime) / (this.duration);
					this.now = this._sine(pos) * (this.to-this.from) + this.from;
				}
			this.clipDiv.style.height = this.now+'px';
			this.expImg.style.position='static';
			this.expImg.style.position='absolute';
			this.colImg.style.position='static';
			this.colImg.style.position='absolute';
		}
		Xpander.prototype._init=function() {
			// Set the default state 
			this.xpanded = false;
			
			// Create clipping div
			this.clipDiv = this.elm.parentNode.insertBefore(document.createElement('div'), this.elm);
			this.clipDiv.appendChild(this.elm);
			this.clipDiv.className = 'XpanderClip';
			this.clipDiv.style.overflow = 'hidden';
	
			
			// Create container div 
			this.containerDiv = this.clipDiv.parentNode.insertBefore(document.createElement('div'), this.clipDiv);
			this.containerDiv.className = 'XpanderContainer'
			this.containerDiv.appendChild(this.clipDiv);
			
			// Append toggle button
			if(this.colImg && this.expImg) this.containerDiv.appendChild(this.colImg);
			
			// Attach events to buttons
			var me = this;
			if(this.colImg) Xpander.Utils.addEvent(this.colImg,'click', function() { me.toggle(); })
			if(this.expImg) Xpander.Utils.addEvent(this.expImg,'click', function() { me.toggle(); })
		
			
			// recalulate clipping height (accounts for padding and any images)
			this.clip = this.clip - (this.containerDiv.offsetHeight - this.clipDiv.offsetHeight);
			this.clipDiv.style.height = this.clip;			
			this.expImg.style.position='static';
			this.expImg.style.position='absolute';
			this.colImg.style.position='static';
			this.colImg.style.position='absolute';
		
		};
	}