// We'll add back the closure and makeit a real object soon
// do not add the closure, the myplate uses this file and dynamically loads and calls its functions.
// (function(){

	var siteWidth = 1021; // 990;
	var headerHeight = 140;
	var mainArea = document.getElementById('main');
	var contentContainer = document.getElementById('ContentContainer');

	var originalOnLoad = window.onload;
	window.onload = function() {
		if(typeof originalOnLoad == "function") {
			originalOnLoad();
		}
		document.onclick = sidesClickable;
		if (mainArea) {
			mainArea.onmousemove = sidesClickableCursor;
		}
		else if (contentContainer) {
			contentContainer.onmousemove = sidesClickableCursor;
		}
	}

	function sidesClickable(e) {
		if(detect(e)) {
			// document.location = takeover_link;
			window.open (takeover_link);
		}
	}

	function sidesClickableCursor(e) {
		if(detect(e)) {
			document.body.style.cursor = "pointer";
		} else {
			document.body.style.cursor = "default";
		}
	}

	function detect(e) {
		if (!e) var e = window.event;

		var windowWidth = document.body.clientWidth;
		var marginWidth = (windowWidth - siteWidth) / 2;

		if(
			(
				(e.clientX > 0 && e.clientX < marginWidth)
				||
				(e.clientX > siteWidth+marginWidth && e.clientX < windowWidth)
			)
			&& 
			(
				(e.clientY > headerHeight)
			)
		) {
			return(true);
		}

		return(false);
	}

// })();

