function openExternalLink(url) {
	window.open(url);
}

function showCreationsMenu() {
	var menu = document.getElementById("submenuCreations");
	menu.style.display="block";
}

function hideCreationsMenu() {
	var menu = document.getElementById("submenuCreations");
	menu.style.display="none";
}

function toggleLayer(divID) {
	if (document.getElementById) {
		var style = document.getElementById(divID).style;
		style.display = style.display ? "" : "block";
	} else if (document.all) {
		var style = document.all[divID].style;
		style.display = style.display ? "" : "block";
	} else if (document.layers) {
		var style = document.layers[divID].style;
		style.display = style.display ? "" : "block";
	}
}

function windowResize() {
	// Get access to styles
	var bodyStyle = document.body.style;
	
	if (document.getElementById) {
		var pageStyle = document.getElementById("page").style;
	} else if (document.all) {
		var pageStyle = document.all["page"].style;
	} else if (document.layers) {
		var pageStyle = document.layers["page"].style;
	}
	
	if ((getBrowserWidth() > 900) && (getBrowserHeight() > 540)) {
		bodyStyle.textAlign = 'center';
	
		pageStyle.top = '50%';
		pageStyle.left = '50%';
		pageStyle.marginTop = '-270px';
		pageStyle.marginLeft = '-450px';
	} else {
		bodyStyle.textAlign = 'left';
		
		pageStyle.top = 0;
		pageStyle.left = 0;
		pageStyle.marginTop = '0px';
		pageStyle.marginLeft = '0px';	
	}
}

function updateFlash(tag, page) {
	var so = new SWFObject("/swfs/photoFrame04-28-10.swf", "photoFrame", "450", "370", "7", "#F2EECE");
	so.addVariable("tag", tag);
	so.addVariable("page", page);
	so.addParam("wmode", "transparent");
	so.write("photos");
}

/* Helper functions */

function getBrowserWidth() {
	if (window.innerWidth) {
		return window.innerWidth;
	} else if (document.documentElement && document.documentElement.clientWidth != 0) {
		return document.documentElement.clientWidth;
	} else if (document.body) {
		return document.body.clientWidth;
	}
	return 0;
}

function getBrowserHeight() {
	if (window.innerHeight) {
		return window.innerHeight;
	} else if (document.documentElement && document.documentElement.clientHeight != 0) {
		return document.documentElement.clientHeight;
	} else if (document.body) {
		return document.body.clientHeight;
	}
	return 0;
}