var xPos;
var yPos;

function resizeBoxes() {
	var nav = $('navigation').clientHeight;
	var cont = $('content').clientHeight;
	if ((nav-32) > cont) {
		$('content').style.height = (nav-32)+"px";
	}
}

function toggleBookmarks() {
	if ($('bookmarks').style.display == "none") {
		$('bookmarks').show();
	}
	else {
		$('bookmarks').hide();
	}
}

function showVideoBox(text) {
	html = '<object width="425" height="344">';
	html+= '<param name="movie" value="' + text + '"></param>';
	html+= '<param name="allowFullScreen" value="false"></param>';
	html+= '<embed src="' + text + '" type="application/x-shockwave-flash" allowfullscreen="false" width="425" height="344">';
	html+= '</embed>';
	html+= '</object>';

	$('VideoBoxTube').innerHTML = html;
	$('VideoBox').style.left = (xPos-400)+"px";
	$('VideoBox').style.top = (yPos-100)+"px";
	$('VideoBox').show();
}

function closeVideoBox() {
	$('VideoBox').hide();
}

var movingObject;
var movingPosX;
var movingPosY;

function startMoveYumeWindow(id) {
	movingObject = true;
	movingPosX = xPos - parseInt($(id).style.left);
	movingPosY = yPos - parseInt($(id).style.top);
}

function moveYumeWindow(id) {
	if (movingObject) {
		console.log(parseInt($(id).style.top) + " " + yPos + " " + movingPosY);
		$(id).style.top = (yPos - movingPosY) + "px";
		$(id).style.left = (xPos - movingPosX) + "px";
	}
}

function stopMoveYumeWindow(id) {
	movingObject = false;
}

function init_mousemove() {
	if (document.layers) { document.captureEvents(Event.MOUSEMOVE); }
	document.onmousemove = dpl_mouse_pos;
}

function dpl_mouse_pos(e) {
	xPos = (e) ? (e.pageX) : (window.event.x);
	yPos = (e) ? (e.pageY) : (window.event.y);
	if ((document.all) && (!document.captureEvents)) {
		xPos+= document[docEl].scrollTop;
		yPos+= document[docEl].scrollTop;
	}
	if (document.layers) { routeEvent(e); }
}

init_mousemove();
