
var ie4 = document.all;
var ns6 = document.getElementById && !document.all;
var windowWidth = 0;
var windowHeight = 0;
var weekDays = new Array("Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday");


// returns an object, retreived by its ID which shall be unique
function getObject(id) {
	if (ie4) {
		return document.all[id];
	} else if (ns6) {
		return document.getElementById(id);
	}
}


// writes on the current document a table row
// made of a dashed border
// the parameter of the method is the column
// number making the table
function insertDashedRow(cols) {
	document.writeln("<tr>");
	document.writeln("<td colspan=\"" + cols + "\" style=\"font-size: 1px; \">&nbsp;</td>");
	document.writeln("</tr>");
	document.writeln("<tr>");
	document.writeln("<td colspan=\"" + cols + "\" style=\"border-top-style: dashed; border-top-width: 1px; font-size: 1px; \">&nbsp;</td>");
	document.writeln("</tr>");
}


// shows the cursor as if the current zone is a Link
function showHandCursor(caller) {
	caller.style.cursor = "pointer";
}

// shows the default cursor
function showDefaultCursor(caller) {
	caller.style.cursor = "auto";
}


/**
 * Computes the available window's size and stores it in global vars
 * Also computes the height of the table containing ZoomIt menu to take
 * all the space available in the browser
 */
function computeWindowSize() {
	if (typeof(window.innerWidth) == 'number' ) {
		// Non-IE
		windowWidth = window.innerWidth;
		windowHeight = window.innerHeight;
	} else if (document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)) {
		// IE 6+ in 'standards compliant mode'
		windowWidth = document.documentElement.clientWidth;
		windowHeight = document.documentElement.clientHeight;
	} else if (document.body && (document.body.clientWidth || document.body.clientHeight)) {
		// IE 4 compatible
		windowWidth = document.body.clientWidth;
		windowHeight = document.body.clientHeight;
	}
}


function resetIframeHeight() {
	window.top.document.getElementById('contentIFrame').style.height = '420px';
}


function arraysRandomizer() {
	return Math.floor(Math.random() * 3) - 1;
}


/**
 * Return the week day in letter from a given Date object
 */
function weekDay(dateObj) {
	return weekDays[dateObj.getDay()];
}
