function haveFlash(){var n=navigator;
if(n.plugins && n.plugins.length){for(var i=0;i<n.plugins.length;i++){
if(n.plugins[i].name.indexOf('Shockwave Flash')!=-1)return true;}}else if(window.ActiveXObject){for(var i=10;i>=2;i--){try{if(eval("new ActiveXObject('ShockwaveFlash.ShockwaveFlash."+i+"');"))return true;
}catch(e){}}}return false;}

function popup(url, x, y)
{
	window.open(url, '', 'scrollbars=no,width=' + (x + 18) + ',height=' + (y + 18));
}

var showing = null;

function hide(){
if (showing != null) {
showing.visibility = 'hidden';
showing = null;
}
}

function show(name){
hide();
if (name != null) {
	showing = document.getElementById(name).style;
	showing.visibility = 'visible';
}
}

function getPosition(obj)
{
	var left = 0;
	var top = 0;

	if (obj.offsetParent)
	{
		left = obj.offsetLeft;
		top = obj.offsetTop;
		while (obj = obj.offsetParent)
		{
			left += obj.offsetLeft;
			top  += obj.offsetTop;
		}
	}
	return [left, top];
}

function alignMenu(name0, name1, offsetx, offsety)
{
	element1 = document.getElementById(name1);
	if (element1 == null) return;
	element0 = document.getElementById(name0);

	pos = getPosition(element0);
	width = element0.offsetWidth;
	height = element0.offsetHeight;

	element1.style.left = pos[0] + offsetx + "px";
	element1.style.top  = (pos[1] + offsety + height) + "px";

	if (width < 120) width = 120;
	if (width > element1.offsetWidth)
	{
		element1.style.width  = width + "px";
	}
}

function alignMenus()
{
alignMenu('storage0', 'storage1', -1, 4);
alignMenu('about0', 'about1', -1, 4);
alignMenu('casestudies0', 'casestudies1', -1, 4);
alignMenu('downloads0', 'downloads1', -1, 4);
alignMenu('contact0', 'contact1', -1, 4);
alignMenu('role0', 'role1', -1, 4);
}

window.onresize = alignMenus;
window.onload = alignMenus;

