	var Timer=function(container) {
		this.container=document.getElementById(container);
		this._date=['Sun','Mon','Tue','Wed','Thu','Fri','Sat'];
		this._month=['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'];
	}
	
	Timer.prototype.run=function() {
		var self=this;
		this._show();
		window.setTimeout(function() {self.run();},1000);
	}
	
	Timer.prototype._show=function() {
		var date=new Date();
		var str="{dd}&nbsp;&nbsp;&nbsp;{MM} {DD} {YYYY}&nbsp;&nbsp;&nbsp;{hh}:{mm}:{ss}";
		str=str.replace('{YYYY}',date.getFullYear().toString()).
				replace('{MM}',this._month[date.getMonth()]).
				replace('{DD}',date.getDate().toString()).
				replace('{dd}',this._date[date.getDay()]).
				replace('{hh}',this._format(date.getHours(),2)).
				replace('{mm}',this._format(date.getMinutes(),2)).
				replace('{ss}',this._format(date.getSeconds(),2));
		this.container.innerHTML=str;		
	}
	
	Timer.prototype._format=function(number,count) {
		var _num=number.toString();
		for (;_num.length<count;) {
			_num='0'+_num;
		}
		return _num;
	}

	var Categories=function(container) {
		Categories.container=$(container);
		this.container=$(container);
	}
	
	Categories.current=null;
	
	Categories.click=function(idx) {
		var oDivs=this.container.getElementsBySelector('.category');
		Element.classNames(oDivs[idx]).set('category expand');
	}

	
	Categories.prototype={
		init:function() {
			var oDivs=this.container.getElementsBySelector('.category');
			for (var i=0;i<oDivs.length;i++) {
				var oDiv=oDivs[i];
				Element.classNames(oDiv).set('category expand');
				Event.observe(oDiv.getElementsBySelector('span')[0],'click',this.toggle.bindAsEventListener(this));
			}
		},
		
		load:function(e) {
			var o=Event.element(e);
			var src=o.getAttribute('src') || o.src;
			var index=o.index;
			if (src) {
				Iframe.setUrl(src);
				location.href='#src='+src;
			}
			
		},
		
		toggle:function(e) {
			var oDiv=Event.findElement(e,'div');
			if (Element.hasClassName(oDiv,'collapse')) {
				Element.classNames(oDiv).set('category expand');
				this.load(e);
			} else {
				Element.classNames(oDiv).set('category collapse');
			}
		}
	}
	

	var Iframe=new Object();
	
	Iframe={
		getFrame:function() { return window.content;},
		getObj:function() { return $('f_content');},
		
		setUrl:function(src) {
			if (this.getObj().src.indexOf(src)<0) {
				this.getObj().src=src;
			}
		},
		
		setSize:function(w,h) {
			this.getObj().setStyle({height:h+'px'});
		}
	}
		
	var Preload=function() {
		this._src=location.href.match(/(#src=([^&]*))/);
		this._index=location.href.match(/(index=([^&]*))/);
	}
	
	Preload.prototype={
		load:function() {
			if (this._src && this._src[2]) {
				var src=this._src[2];
				Iframe.setUrl(src);
			}
			if (this._index && this._index[2]) {
				Categories.click(parseInt(this._index[2]));
			}
		}
	}
		
		
		
		
		
		
		
		