function correctSize(){
	var w,h;
	var targetWidth = 1000;
	if(isFlash){
		var targetHeight = 920;
	} else {
		var targetHeight = 0;
	}
	var o = document.getElementById('outer').style;
	var dims = document.viewport.getDimensions();
	w = dims.width;
	h = dims.height;
	if(w<targetWidth){
		w = targetWidth;
		o.width = targetWidth+"px";
	}else{
		o.width = "100%";
	}
	if(h<targetHeight){
		h = targetHeight;
		o.height = targetHeight+"px";
	}else{
		o.height = h+"px";
	}
	var o2 = document.getElementById('flcontent');
	o2.style.height = o.height;
}
var volumeSetting = '';//set to '_f2' for low volume overlay
function volumeToggleInfo(){
	//var va = $('volumeSwitch');
	var va = document.getElementById('volumeSwitch');
	va.style.top = va.style.top == '-243px' ? '0' : '-243px';
}
function volumeOver(opt){
	var va = document.getElementById('volumeAbout').src;
	if(va.indexOf("_f2")>0){
		volumeSetting = "_f2";
	}
	var vl = document.getElementById('volumeLabel');
	
	vl.src = 'images/volume_'+opt+volumeSetting+'.gif';
}
function volumeOut(){
	var va = document.getElementById('volumeAbout').src;
	if(va.indexOf("_f2")>0){
		volumeSetting = "_f2";
	}
	var vl = document.getElementById('volumeLabel');
	vl.src = 'images/volume_default'+volumeSetting+'.gif';
}

var flashVersion = swfobject.getFlashPlayerVersion();
isFlash = flashVersion['major'] >= 10;
flashOn = false;
function buildFlash(){
	if(isFlash){
		var flashvars = {};
		var params = {};
		params.bgcolor = "000000";
		params.allowFullScreen = true;
		params.wmode = 'opaque';
		params.allowScriptAccess = 'always';
		params.scale = 'noscale';
		params.salign = 't';
		params.align = 'middle';
		var attributes = {};
		attributes.id = "flcontent";
		swfobject.embedSWF(srcF, "flcontent", "100%", "100%", "10.0.0", false, flashvars, params, attributes);
		flashOn = true;
	}else{
		flashOn = false;
	}
	volumeInit();
	correctSize();
}

function volumeInit(basic){
	if(!isFlash){
		$('warnings').innerHTML = 'To fully expericance this website you need the latest <strong>Adobe Flash Player</strong> installed.<br/><a href="http://www.adobe.com/go/EN_US-H-GET-FLASH" target="_blank"><img src="images/no-flash.png" style="margin-left:-5px" alt="get flash here" border="0"/></a>';
		return;
	}else{
		$('warnings').hide();
	}
	//$('addthis_tl').style.left = '194px';
	var htmlstr;
    var append ='';
	
	if(flashOn==true){
		htmlstr = '<a onMouseOver="volumeOver(\'help\');" onMouseOut="volumeOut();" href="javascript:volumeToggleInfo()"><img src="images/volume_about.gif" alt="select the graphics level here, the high graphics version requires a plugin and may run slowly on some machines, whereas the low graphics version requires no plugins and contains the same information. You are currently viewing the high graphics version. " name="volumeAbout" width="218" height="243" border="0" usemap="#volumeAboutMap" id="volumeAbout"/></a><img src="images/volume_default.gif" width="218" height="24" border="0" usemap="#Map" id="volumeLabel" alt=""/><map name="Map"><area onMouseOver="volumeOver(\'over\');" onMouseOut="volumeOut();" shape="poly" coords="126,0,181,0,157,24,102,24,126,0" href="javascript:doSwitch()" alt="toggle volume"><area onMouseOver="volumeOver(\'help\');" onMouseOut="volumeOut();" shape="poly" coords="183,0,217,0,193,25,159,24,183,0" href="javascript:volumeToggleInfo();" alt="what\'s this?"></map><map name="volumeAboutMap"><area onMouseOver="volumeOver(\'over\');" onMouseOut="volumeOut();" shape="rect" coords="5,210,133,229" alt="switch graphics settings" href="javascript:doSwitch()"></map>';
	}else{
		htmlstr = '<a onMouseOver="volumeOver(\'help\');" onMouseOut="volumeOut();" href="javascript:volumeToggleInfo()"><img src="images/volume_about_f2.gif" alt="select the graphics level here, the high graphics version requires a plugin and may run slowly on some machines, whereas the low graphics version requires no plugins and contains the same information. You are currently viewing the low graphics version." name="volumeAbout" width="218" height="243" border="0" id="volumeAbout"/></a><img src="images/volume_default_f2.gif" width="218" height="24" border="0" usemap="#Map" id="volumeLabel" alt=""/><map name="Map"><area onMouseOver="volumeOver(\'over\');" onMouseOut="volumeOut();" shape="poly" coords="126,0,181,0,157,24,102,24,126,0" href="javascript:doSwitch()" alt="toggle volume" id="volSwitch1"/><area onMouseOver="volumeOver(\'help\');" onMouseOut="volumeOut();" shape="poly" coords="183,0,217,0,193,25,159,24,183,0" href="javascript:volumeToggleInfo();" alt="what\'s this?" /></map><map name="volumeAboutMap"><area onMouseOver="volumeOver(\'over\');" onMouseOut="volumeOut();" shape="rect" coords="5,210,133,229" alt="switch graphics settings" href="javascript:doSwitch()" id="volSwitch2"/></map>';
	}
	document.getElementById('volumeSwitch').innerHTML = htmlstr+append;
}


function doSwitch(){
	var uri = document.location.href;
	var lnk = '';
	if(flashOn){
		//flash->xhtml
		if(uri.indexOf('#')>0){
			lnk = uri.substr(uri.lastIndexOf('#')+2);
		}else{
			lnk = '/?type=xhtml';
		}
	}else{
		//xhtml->flash
		var path = uri.substr(uri.lastIndexOf("/"));
		lnk = '#'+uri.substr(uri.lastIndexOf("/"));
	}
	document.location.href = lnk;
	
}
function initVolumeSwitch(vol){
	var sym = document.getElementById(vol);
	try{
		sym.href = 'javascript:doSwitch()';
	}catch(e){
		console.info(e);
	}
}
var pageTracker = _gat._getTracker("UA-9739632-1");
function webeTrackInteraction(category, action, optional_label, optional_value){
	try{
		pageTracker._trackEvent(category, action, optional_label, optional_value);
	}catch(err){
		//console.info(err);
		//console.info("webeTrackInteraction",category, action, optional_label, optional_value);
	};
}
function webeTrackPage(pg){
	try{
		pageTracker._trackPageview(pg);
	}catch(err){};
}
