var currentLocation = window.location.href;


function classChange(styleChange,item) {
	item.className = styleChange;
}


function changeURL(url) {
	window.location = url + "?url=" + currentLocation;
}


function openNewWindow(url, winName) {
	window.open(url, winName, "height=500,width=790, top=0,left=0, directories=no, location=no, menubar=no, scrollbars=yes, status=no, toolbar=no, resizable=no");
}


function openMenuWindow(url, winName) {
	window.open(url, winName, "height=500,width=780, top=0,left=0, directories=no, location=no, menubar=yes, scrollbars=yes, status=no, toolbar=no, resizable=no");
}


function openFSWindow(url, winName) {
	params  = 'top=0, left=0';
	params  = ', directories=no, location=no, menubar=no, scrollbars=yes, status=no, toolbar=no, resizeable=no';
	params += ', width=' + screen.width;
	params += ', height=' + screen.height;
	params += ', fullscreen=yes'; // fullscreen parameter is supported by IE Only
	newWin = window.open(url, winName, params);
	if ( window.focus ) {
		newWin.focus();
	}
}


function closeWindow() {
	/* check if disableOnbeforeunload exist */
	if ( parent.disableOnbeforeunload != undefined ) {
		parent.disableOnbeforeunload();
	}
	/* check if in authen page */
	if ( parent.closeAuthWindow != undefined ) {
		parent.closeAuthWindow();
	} else {
		window.parent.close();
	}
}


/** Block Right Click **/
am = "Right click is disabled.";
bV  = parseInt(navigator.appVersion)
bNS = navigator.appName=="Netscape"
bIE = navigator.appName=="Microsoft Internet Explorer"

function nrc(e) {
	if (bNS && e.which > 1){
		alert(am);
		return false;
	} else if (bIE && (event.button >1)) {
		alert(am);
		return false;
	}
}


var message="OLS-E-0001 - Right click function is disabled";

function clickIE4() {
	if ( event.button == 2 ) {
		//alert(message);
		return false;
	}
}

function clickNS4(e) {
	if (document.layers||document.getElementById&&!document.all) {
		if (e.which==2||e.which==3) {
			//alert(message);
			return false;
		}
	}
}


if (document.layers) {
	document.captureEvents(Event.MOUSEDOWN);
	document.onmousedown=clickNS4;
} else if (document.all&&!document.getElementById) {
	document.onmousedown=clickIE4;
}


//document.oncontextmenu=new Function("alert(message);return false");
document.oncontextmenu=new Function("return false");


// disaply a confirmation box before unloading the window
// insert function call "setBunload(false)" in pages to disable the dialogue
/*function unloadMess(evt) {
	msg = '';
	return msg;
}

function setBunload(on) {
	window.onbeforeunload = (on) ? unloadMess : null;
}

setBunload(true);
*/
