// main layout
function onLoadImpl() {
	hideWorking();
}

function onUnLoadImpl() {
	close_popup();
}

function onResizeImpl() {
	var bodyWidth;
	var bodyHeight;
	if (getNS() == true) {
		bodyWidth = innerWidth;
		bodyHeight = innerHeight;
		document.getElementById('content-scroll').style.left = 5;
		document.getElementById('content-scroll').style.top = 25;		
		if (bodyWidth > 15) {
			document.getElementById('content-scroll').style.width = bodyWidth - 15;
		} else {
			document.getElementById('content-scroll').style.width = 0;
		}
		if (bodyHeight > 18) {
			document.getElementById('content-scroll').style.height = bodyHeight - 18;
		} else {
			document.getElementById('content-scroll').style.height = 0;
		}		
	} else {
		bodyWidth = document.body.clientWidth;
		bodyHeight = document.body.clientHeight;
		
		if (bodyWidth > 6) {
			document.getElementById('content-scroll').style.width = bodyWidth - 6;
		} else {
			document.getElementById('content-scroll').style.width = 0;
		}
		if (bodyHeight > 33) {
			document.getElementById('content-scroll').style.height = bodyHeight - 33;
		} else {
			document.getElementById('content-scroll').style.height = 0;
		}		
	}
}

// working
function hideWorking() {
	if (document.getElementById('working')) {
		document.getElementById('working').style.visibility='hidden';
	}
}
	
function showWorking() {
	if (document.getElementById('working')) {
		document.getElementById('working').style.visibility='visible';
	}
}

// misc
function defaultInput(name) {
	if (document.form) {
		if (document.form.elements[name]) {
			document.form.elements[name].focus();
			document.form.elements[name].select();
		}
	}
}

// contains all windows opened by this document.
var popups = new Array();

// opens a new popup window
function open_popup(link,width,height) {
	d = new Date();
    newWindow = window.open(link,d.getTime(),'dependent=yes,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width='+width+',height='+height);
	popups[popups.length] = newWindow;
	return newWindow;
}

// closes popup windows opened by this document
function close_popup() {
	for( var i=0 ; i < popups.length ; i++ ) {
		popups[i].close();
	}
}

/*----- Popup Boxes -----*/
function listPropertyNames(obj)
{
 var names = "";
 for(var i in obj) names += i + "\n";
 alert (names);
}


/*+++++ Table functions +++++*/
var dt_rhl_lastRowBgColor;
function dt_rhl(element, higlight) {
	if (higlight) {
		dt_rhl_lastRowBgColor = element.style.backgroundColor;
		element.style.backgroundColor = '#DCDCDC';
		
	} else {
		element.style.backgroundColor = dt_rhl_lastRowBgColor;
	}
}
