// -----------------------------------------------------------------------------------
// mc.js
// -----------------------------------------------------------------------------------

// -----------------------------------------------------------------------------------
// Source: http://www.brainerror.net/scripts_js_blendtrans.php
// Modified for use with X from cross-browser.com
function opacity(id, opacStart, opacEnd, millisec) {
	//speed for each frame
	var speed = Math.round(millisec / 100);
	var timer = 0;
	
	// determine the direction for the blending
	// if start and end are the same nothing happens
	if (opacStart > opacEnd) {
		for (i = opacStart; i >= opacEnd; i--) {
			setTimeout("xOpacity('" + id + "'," + i/100 + ")",(timer * speed));
			timer++;
		}
	} else if (opacStart < opacEnd) {
		for (i = opacStart; i <= opacEnd; i++)
		{
			setTimeout("xOpacity('" + id + "'," + i/100 + ")",(timer * speed));
			timer++;
		}
	}
}

// -----------------------------------------------------------------------------------
// change the opacity for different browsers
// Source: http://www.brainerror.net/scripts_js_blendtrans.php
// NOTE: no longer used - here for reference
function changeOpac(opacity, id) {
    var object = xGetElementById(id).style;
    object.opacity = (opacity / 100);
    object.MozOpacity = (opacity / 100);
    object.KhtmlOpacity = (opacity / 100);
    object.filter = "alpha(opacity=" + opacity + ")";
}

// -----------------------------------------------------------------------------------
function rightClick() {
	xStyle('display', 'block', 'copyrightbox');
}

// -----------------------------------------------------------------------------------
function setRightClickHandler() {
	document.oncontextmenu = function() { rightClick(); return false; };
	if(document.layers) {
		window.captureEvents(Event.MOUSEDOWN);
		window.onmousedown = function(e) {
			if (e.which > 1) {
				rightClick();
				return false;
			}
		};
	} else {
		document.onmousedown = function() { return true; }
	}
}

// -----------------------------------------------------------------------------------
function resizeTopBuffer(context) {
	newSpacerH = (xClientHeight() - tableH) / 2;
	xHeight("topSpacer", newSpacerH);
	xOpacity("wrapper", 0);
	xStyle("display", "block", "wrapper");
	opacity("wrapper", 0, 100, 1000);
}

// -----------------------------------------------------------------------------------
function pageLoaded() {
	resizeTopBuffer('page open');
	positionCopyrightBox();
}

// -----------------------------------------------------------------------------------
function windowResized() {
	resizeTopBuffer('window resize');
	positionCopyrightBox();
}

// -----------------------------------------------------------------------------------
// MAIN CODE

// break out of any frames
if (window != window.top) {
  top.location.href = location.href;
}

// set the handler for a right click
setRightClickHandler();

tableH = 540;

// end mc.js