function LoadGoogleAnalytics(accountId)
{	
	if(!accountId)
		return;
	
	var gaJsHost = ('https:' == document.location.protocol) ? 'https://ssl.' : 'http://www.';
	document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
	
	var pageTracker;
	if('object' == typeof(_gat))
	{
		pageTracker = _gat._getTracker(accountId);
		pageTracker._initData();
		pageTracker._trackPageview();
	}
}


//because IE7 and lower is a b!tch and doesn't have string.indexOf built in...
if('undefined' == Array.indexOf || !Array.indexOf)
{
	Array.prototype.indexOf = function(obj)
		{
			for(var i=0; i<this.length; i++)
			{
				if(this[i] == obj)
				{
					return i;
				}
			}
			return -1;
		}
}


//<a href='#' onclick='return OpenNewWindow();'>...</a>
function OpenNewWindow()
{
	element.title += 'Link opens in new window';
	element.onclick = function ()
	{ 
		window.open(this.href);
		return false;
	}
}


function PopImage(thumbImage, originalImage, originalWidth, originalHeight)
{
	return;
	
	var pop = document.createElement('div');
	pop.id = 'dynamicPopImage';
	pop.style.position = 'absolute';
	// set image element into div
	pop.innerHTML = "<img src='" + originalImage + "' width='" + originalWidth + "' height='" + originalHeight + "' />";
	// position relative to thumbnail... top for popup image 10 pixels below corresponding
	pop.style.top = (10 + thumbImage.offsetHeight + thumbImage.offsetTop) + 'px';
	// left for popup image is aligned with left of thumbnail
	pop.style.left = thumbImage.offsetLeft + 'px';
	// show the div and its image
	pop.style.display = 'block';
	document.body.appendChild(pop);
}

//menu related functions for showing/hiding blocks
//usage: var menu = new Array('block1', 'block2');
//InitMenu(menu, menu[0]);
//<a href='#block1' onclick='return ToggleMenuItem(this.href)'>
var pageMenuItems = new Array();
function InitMenu(menuItems, defaultMenuItem)
{
	pageMenuItems = menuItems;
	ResetMenu();
	
	var item = document.getElementById(defaultMenuItem);
	if(item)
	{
		item.style.display = 'block';
	}
}
function ResetMenu()
{
	for(var i=0; i < pageMenuItems.length; i++)
	{
		var item = document.getElementById(pageMenuItems[i]);
		if(item)
		{
			item.style.display = 'none';
		}
	}
}
function ToggleMenuItem(href)
{
	var id = href.substring(href.indexOf('#') + 1);
	ResetMenu();
	return ToggleElement(id);
}
function ToggleElement(elementId)
{
	var element = document.getElementById(elementId);
	if(element)
	{
		element.style.display = ('none' == element.style.display) ? 'block' : 'none';
	}
	return false;
}