function scrollHeight(titleSpacing) {
	var height;
	if (window.innerHeight) {
		height = window.innerHeight - (45 + titleSpacing);
	}
	else if (document.body.clientHeight) {
		var adjust = 50 + titleSpacing;
		var isMac = navigator.userAgent.indexOf('Mac') != -1;
		if (isMac) {
			adjust = adjust - 10;
		} 
		height = document.body.clientHeight - adjust;
	}
//				alert(height);
	return height;
} 

function scrollWidth() {
	var width;
	var sidebarWidth = 120;
	if (window.innerWidth) {
		width = window.innerWidth - sidebarWidth;
	}
	else if (document.body.clientWidth) {
		width = document.body.clientWidth - sidebarWidth;
	}
	return width;
} 

function showNews(name, title) {
	Modalbox.show($(name), {title:title, width: 600});
}

function sidebarLine(name, title, button) {
	var file = name;
	if (name=="mission") {
		file = "index";
	}
	var line = "<li class='sidebarLine' id='" + name + "Button'>"
	+ "<a href='" + file + ".html'";
	if (name==button) {
		line += " class='selected'";
	}
	line += ">" + title + "</a></li>";
	return line;
}
function writeSidebar(button) {
	document.write("<div id='sidebar' style='height:" + scrollHeight(20) + "'>"
	+ "<ul>"
	+ sidebarLine('mission', 'Mission', button)
	+ sidebarLine('optischedule', 'Opti-Schedule', button)
	+ sidebarLine('golfmaster', 'Golfmaster', button)
	+ sidebarLine('ladygolfmaster', 'Lady Golfmaster', button)
	+ sidebarLine('ecosnoop', 'EcoSnoop', button)
	+ sidebarLine('planetradio', 'PlanetRadio.us', button)
	+ sidebarLine('kqqx93', 'KQQX93', button)
	+ sidebarLine('klpw101', 'KLPW101', button)
	+ sidebarLine('keeptiming', 'KeepTiming', button)
	+ sidebarLine('custom', 'Custom', button)
	+ sidebarLine('technology', 'Technology', button)
	+ sidebarLine('news', 'News', button)
	+ sidebarLine('contact', 'Contact us', button)
	+ "</ul>"
	+ "</div>");
}


function showNews(name, title) {
	Modalbox.show($(name), {title:title, width: 600});
}

function googleTrack() {
	try {
		var pageTracker = _gat._getTracker("UA-13080546-1");
		pageTracker._trackPageview();
	} catch(err) {}
}