var ox = {};

// Window Object
// =============
ox.window = {
	win: self
};
ox.window.setSize = function (props) { //CALL ox.window.setSize( {width:[x],height:[x],left:[x],top:[x],target:[x]} )
	if (!props || !props.height || !props.width) return;
	if (props.target) this.win = props.target;
	// try and set window to a window size
	this.win.resizeTo(props.width,props.height);
	// get document size after rough resize
	var inner = this.docSize();
	// adjust window to get correct document size
	var dw = props.width-inner[0];
	var dh = props.height-inner[1];
	this.win.resizeTo(props.width+dw, props.height+dh);	
	// position and focus window
	if (props.left && props.top) this.win.moveTo(props.left,props.top);
	this.win.focus();
}
ox.window.docSize = function () {
	var w,h;
	if (this.win.innerHeight) { // all except Explorer
		w = this.win.innerWidth;
		h = this.win.innerHeight;
	}
	else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
		w = this.win.document.documentElement.clientWidth;
		h = this.win.document.documentElement.clientHeight;
	}
	else if (document.body) { // other Explorers
		w = this.win.document.body.clientWidth;
		h = this.win.document.body.clientHeight;
	}
	return [w,h];
}
// Eye Candy
// ==========
ox.showZebraTables = function () {
	var tables = document.getElementsByTagName("table");
	for ( var t = 0; t < tables.length; t++ ) {
		if (tables[t].className.indexOf("zebra") != -1) {
		var rows = tables[t].getElementsByTagName("tr");
		for ( var i = 1; i < rows.length; i += 2 ) {
			if ( rows[i].className.indexOf("oddrow") == -1 )
				rows[i].className += " oddrow";
		}
		var hasTH = (tables[t].getElementsByTagName("th").length > 0);
		if (!hasTH) rows[0].className = "headerRow";
		}
	}
}
