/**
 * cttb events
 */
 
var CttbEvents = {
     Version: '1.0.0.1',
	cO: 'contentDetails',
	hO: 'holdingArea',
	homeCols: [
		'homeleftcol', 
		'homerightcol' 
	],
	prodCols: [ 
		'prodleftcol' 
	],
	contCols: [ 
		'contleftcol' 
	],
	sourCols: [ 
		'sourleftcol' 
	],
	holCols: [ 
		'holleftcol' 
	],
	_add: function(div, o, hide) {
		o.each( function(item) {
			try {
				$(div).appendChild($(item));
				if (hide) {
					$(item).childElements().each( function(e) {
						e.hide();
					});
				} else {
					$(item).childElements().each( function(e) {
						e.show();
					});
				}
			} catch (e) {}
		});
	},
	_hideAll: function() {
		this._add(this.hO, this.homeCols, true);
		this._add(this.hO, this.prodCols, true);
		this._add(this.hO, this.sourCols, true);
		this._add(this.hO, this.contCols, true);
		this._add(this.hO, this.holCols, true);
	},
	_show: function(o) {
		this._add(this.cO, o, false);
	},
	show: function(col) {
		this._hideAll();
		switch(col) {
			case 0: 
				this._show(this.homeCols);
				break;
			case 1:
				this._show(this.prodCols);
				break;
			case 2:
				this._show(this.contCols);
				break;
			case 3:
				this._show(this.sourCols);
				break;
			case 4:
				this._show(this.holCols);
				break;
		}
	}
};

function window_onload() {
	var toDay = new Date();
	var sDay = toDay.getDay().toString();
	var aShow = { hours: $('hrs' + sDay).innerHTML };
	var hoursTemplate = new Template('<strong><font color="#BB1319">#{hours}</font></strong>');
	$('day' + sDay).update('<font color="#BB1319">Today:</font>');
	var tHours = $('hrs' + sDay).innerHTML;
	$('hrs' + sDay).update(hoursTemplate.evaluate(aShow));
	CttbEvents.show(0);
}


