function getViewPortHeight() {
	var viewportheight;
 
	 // the more standards compliant browsers (mozilla/netscape/opera/IE7) use window.innerWidth and window.innerHeight
	 if (typeof window.innerWidth != 'undefined')
	 {
	      viewportheight = window.innerHeight
	 }
	 
	// IE6 in standards compliant mode (i.e. with a valid doctype as the first line in the document)
	 else if (typeof document.documentElement != 'undefined'
	     && typeof document.documentElement.clientWidth !=
	     'undefined' && document.documentElement.clientWidth != 0)
	 {
	       viewportheight = document.documentElement.clientHeight
	 }
	 
	 // older versions of IE	 
	 else
	 {
	       viewportheight = document.getElementsByTagName('body')[0].clientHeight
	 }
	
	return viewportheight;
}

function f_scrollTop() {
	return f_filterResults (
		window.pageYOffset ? window.pageYOffset : 0,
		document.documentElement ? document.documentElement.scrollTop : 0,
		document.body ? document.body.scrollTop : 0
	);
}
function f_filterResults(n_win, n_docel, n_body) {
	var n_result = n_win ? n_win : 0;
	if (n_docel && (!n_result || (n_result > n_docel)))
		n_result = n_docel;
	return n_body && (!n_result || (n_result > n_body)) ? n_body : n_result;
}

function growApp() {
	/*
	var app = document.getElementById('wheaties_evolution');
	var newHeight = getViewPortHeight();	
	if(newHeight < 1250)
		newHeight = 1250;
	app.style.height = newHeight + 'px';
	app.setViewPortHeight(f_scrollTop()+getViewPortHeight());
	*/
}

/* flash resize */

var defaultMovieId = 'wheaties_evolution';

function setFlashWidth(newW, movieId){
	if(!movieId)
		movieId = defaultMovieId;
	document.getElementById(movieId).style.width = newW+"px";
}

function setFlashHeight(newH, movieId){
	if(!movieId)
		movieId = defaultMovieId;
	document.getElementById(movieId).style.height = newH+"px";		
}

function setFlashSize(newW, newH, movieId){
	if(!movieId)
		movieId = defaultMovieId;
	setFlashWidth(movieId, newW);
	setFlashHeight(movieId, newH);
}

function testSize() {
	if(console) {
		console.log("test size = " + document.getElementById("wheaties_evolution").style.height);
	}
}

function testDeployment(deploymentMessage) {
	if(console) {
		console.log("test deployment = " + deploymentMessage);
	}
}


function getBasePath() {
	base = document.location.href;
	lastAnchorSolidusIndex = base.lastIndexOf('#/');
	lastSolidusIndex = base.lastIndexOf('/') + 1;
	base = lastAnchorSolidusIndex != -1 ? base.substring(0, lastAnchorSolidusIndex) : base.substring(0, lastSolidusIndex);
	return base;
}
