init = function() {
	doStuff();
	
	window.onresize = doStuff;
	
	function doStuff() {
		setStyle('content','height',getHeight() - 136 + 'px');
	}

	flashEmbed('lifeStyleMovie','lifestyle_pics-r1',330,385);
	
	flashEmbed('nav','nav',406,136);
	
	$('late1').onclick = function(){getPage('late','latest1.cfm');}
	$('late').onclick = function(){getPage('late','latest.cfm');}
	$('what').onclick = function(){getPage('what','whatis.cfm');}
	$('proj').onclick = function(){getPage('proj','projects.cfm');}
	$('comm').onclick = function(){getPage('comm','communications.cfm');}
	$('cont').onclick = function(){getPage('cont','contact.cfm');}
	
	var myAjax = new Ajax.Updater(
		'content',
		'latest.cfm', 
		{
			method: 'get'
		}
	);

	/*
	d = browserDetect();
	if (d != "Internet Explorer" && d != "Netscape Navigator"){
		$('bDetect').style.display = 'block';
	}
	*/
}

function openWindow(theURL,features) {
	gMaps = window.open('pop.cfm?URLtoGet='+URLenc(theURL),'mapData',features);
}

//function to get a particular page and dump it to the content div
function getPage(navVar,page){
	if(navVar.length > 0) {
		th = window.document.nav;
		th.SetVariable('/:whereTo',navVar);
		th.TCallFrame('/', 1);
	}
	var myAjax = new Ajax.Updater(
		'content',
		page, 
		{
			method: 'get', 
			parameters: {}, 
			evalScripts: true
		}
	);
}

function URLenc(inputString)
	{
		var encodedInputString=escape(inputString);
		encodedInputString=encodedInputString.replace("+", "%2B");
		encodedInputString=encodedInputString.replace("/", "%2F");        
		return encodedInputString;
	}
	
function URLdec(encodedInputString)
	{
		return unescape(encodedInputString);
	}  

//function to toggle commissioner info
function toggleCommInfo(objID){
	if ($('commBox').style.display == 'block' || $('commBox').style.display == ''){
		$('togImg').src = "assets/show.gif";
		setStyle('commBox','display','none');
		setStyle(objID,'width','15px');
		setStyle(objID,'left','745px');
	} else if ($('commBox').style.display == 'none'){
		$('togImg').src = "assets/hide.gif";
		setStyle('commBox','display','block');
		setStyle(objID,'width','156px');
		setStyle(objID,'left','604px');
	}
}

//function to embed flash
function flashEmbed(obj,swf,w,h){
	swf = 'swf/'+swf+'.swf';
	var fo = new FlashObject(swf, obj, w, h, "8", "#ffffff");
	//fo.addParam("wmode", "transparent");
	fo.addParam("quality", "BEST");
	fo.addParam("menu", "false");
	fo.write(obj);
}


//function to update the page using Prototype library
function ajaxMe(url,obj,fo,swf,w,h)
	{
		var myObj = document.getElementById(obj);
		var myAjax = new Ajax.Updater(
			{success: myObj}, 
			url, 
			{
				method: 'get',
				onComplete: function()
					{
						if (fo)
							flashEmbed(fo,swf,w,h)
					}
				//parameters: pars
				//onFailure: reportError
			});
	}


// function to set the style of an object
//***************************************

function setStyle(objId, style, value){
   document.getElementById(objId).style[style]= value;
}
/* USAGE:
 * objId    = element id.
 * style    = the style to be changed.
 * value    = the value assigned to the style.
*/ 

// function to get the size of the browser window
//***********************************************
function getHeight() {
  var myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myHeight = window.innerHeight - 20;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myHeight = document.documentElement.clientHeight - 20;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myHeight = document.body.clientHeight - 20;
  }
  return myHeight;
}

function getWidth() {
  var myWidth = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth - 20;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth - 20;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth - 20;
  }
  return myWidth;
  alert(myWidth);
}

//function to detect browser
//**************************

function browserDetect() {
	var detect = navigator.userAgent.toLowerCase();
	var OS,browser,version,total,thestring;
	
	if (checkIt('konqueror'))
	{
		browser = "Konqueror";
		OS = "Linux";
	}
	else if (checkIt('safari')) browser = "Safari"
	else if (checkIt('omniweb')) browser = "OmniWeb"
	else if (checkIt('opera')) browser = "Opera"
	else if (checkIt('webtv')) browser = "WebTV";
	else if (checkIt('icab')) browser = "iCab"
	else if (checkIt('msie')) browser = "Internet Explorer"
	else if (!checkIt('compatible'))
	{
		browser = "Netscape Navigator"
		version = detect.charAt(8);
	}
	else browser = "An unknown browser";
	
	if (!version) version = detect.charAt(place + thestring.length);
	
	if (!OS)
	{
		if (checkIt('linux')) OS = "Linux";
		else if (checkIt('x11')) OS = "Unix";
		else if (checkIt('mac')) OS = "Mac"
		else if (checkIt('win')) OS = "Windows"
		else OS = "an unknown operating system";
	}
	
	function checkIt(string)
	{
		place = detect.indexOf(string) + 1;
		thestring = string;
		return place;
	}
	
	return browser;
}

function doFormSubmit(theForm,thePagePart,thePage)
	{
		var pars = Form.serialize(theForm);

		//alert(pars);
		
		var myAjax = new Ajax.Updater (
			thePagePart,
			thePage, 
			{
				method: 'get',
				parameters: pars,
				evalScripts: true/*,
				onComplete: showResponse*/
			});
	
	}
	
function getPagePart(thePagePart,thePage)
	{
		var myAjax = new Ajax.Updater (
			thePagePart,
			thePage,
			{
				method: 'get',
				evalScripts: true
			});
	
	}