
function navOver(elm, c1, c2) {
	if(c1 != 'sty')
		addClassName(elm, c1);
	if(c2 != 'sty')
		addClassName(elm.firstChild, c2);
}

function navOut(elm, c1, c2) {
	if(c1 != 'sty')
		removeClassName(elm, c1);
	if(c2 != 'sty')
		removeClassName(elm.firstChild, c2);
}

function navClick(elm, e) {
	e = e || window.event;

	if(e.srcElement && e.srcElement.tagName.toUpperCase() == 'A')
		return;
	if(e.target && e.target.tagName.toUpperCase() == 'A')
		return;

	var href = elm.firstChild.href;
	var target = elm.firstChild.target;
	if(e.shiftKey)
		target = '_blank';
	if(target.length == 0)
		target = '_self';

	window.open(href, target);
}

function trim(s) {
	return s.replace(/^\s+|\s+$/, "");
}

function addClassName(elm, className) {
	if(elm) {
		removeClassName(elm, className);
		elm.className = trim(elm.className + " " + className);
	}
}

function removeClassName(elm, className) {
	if(elm)
		elm.className = trim((" " + elm.className + " ").replace(" " + className + " ", ""));
}

function bookmarkPage() {
	if(window.sidebar)
		window.sidebar.addPanel(document.title, window.location.href, '');
	else if(window.external)
		window.external.AddFavorite(window.location.href, document.title);
}
function closeWindow() {
	window.close();
}

function openPrinterFriendly() {
	var sep = window.location.href.indexOf('?') == -1 ? '?' : '&';
	window.open(window.location.href + sep + 'bPrinterFriendly=1');
}

var sendToAFriend_Popup;
function sendToAFriend() {
	if(sendToAFriend_Popup && !sendToAFriend_Popup.closed)
		sendToAFriend_Popup.focus();
	else
		sendToAFriend_Popup = window.open('/rex/send-to-a-friend?iSubMenuItemId=896174', '_blank', 'width=550,height=450,location=no,menubar=no,resize=yes,scrollbars=no,status=yes,toolbar=no');
}

function windowPrint() {
	if(window)
		window.print();
}
