function changeClass(theId,theClass){
	document.getElementById(theId).className = theClass
}

function updateDem(obj,toThis){
	obj = $(obj)
	toThis = $(toThis)
	if(!ie){
		obj.style.minWidth = parseInt(toThis.offsetWidth) + 'px'
		obj.style.minHeight = parseInt(toThis.offsetHeight) + 'px'
	}else{
		var spacer = document.createElement('div')
		spacer.style.width = parseInt(toThis.offsetWidth) + 'px'
		spacer.style.height = parseInt(toThis.offsetHeight) + 'px'
		obj.appendChild(spacer)
	}
}

function sizeGut(){
	$('gutRemainder').style.height = parseInt($('guts').offsetHeight) - 105 + 'px'
}

function sizeGut2(){
	var gutsHeight = parseInt($('guts').offsetHeight) - 105
	var navHeight = parseInt($('lNavMiddle').offsetHeight)
	var curNavHeight = parseInt($('topNavSection').offsetHeight)
	
	$('gutRemainder').style.height = gutsHeight + 'px'
	$('navFillBottom').style.height = gutsHeight - navHeight + 68 + 'px'
	$('navFillTop').style.height = curNavHeight -68 + 16 + 'px'
	if((curNavHeight -68 + 16)<2){
		$('navFillTop').parentNode.removeChild($('navFillTop'));
	}
}

function sizeGut3(){
	var gutsHeight = parseInt($('guts').offsetHeight) - 105 - 207
	var navHeight = parseInt($('lNavMiddle').offsetHeight)
	var curNavHeight = parseInt($('topNavSection').offsetHeight)
	
	$('gutRemainder').style.height = gutsHeight + 'px'
	$('navFillBottom').style.height = gutsHeight - navHeight + 68 + 'px'
	$('navFillTop').style.height = curNavHeight -68 + 16 + 'px'
	if((curNavHeight -68 + 16)<2){
		$('navFillTop').parentNode.removeChild($('navFillTop'));
	}
}

function sizeGut4(){
	var gutsHeight = parseInt($('guts').offsetHeight) - 105 - 266
	var navHeight = parseInt($('lNavMiddle').offsetHeight)
	var curNavHeight = parseInt($('topNavSection').offsetHeight)
	
	$('gutRemainder').style.height = gutsHeight + 'px'
	$('navFillBottom').style.height = gutsHeight - navHeight + 68 + 'px'
	$('navFillTop').style.height = curNavHeight -68 + 16 + 'px'
	if((curNavHeight -68 + 16)<2){
		$('navFillTop').parentNode.removeChild($('navFillTop'));
	}
}

function sizeGut5(){
	var gutsHeight = parseInt($('guts').offsetHeight) - 105 -21
	var navHeight = parseInt($('lNavMiddle').offsetHeight)
	var curNavHeight = parseInt($('topNavSection').offsetHeight)
	
	$('gutRemainder').style.height = gutsHeight + 'px'
	$('navFillBottom').style.height = gutsHeight - navHeight + 68 + 'px'
	$('navFillTop').style.height = curNavHeight -68 + 16 + 'px'
	if((curNavHeight -68 + 16)<2){
		$('navFillTop').parentNode.removeChild($('navFillTop'));
	}
}

function setNav(){
	var nav = $('nav')
	var navBackArea = $('navBackArea')
	//size the nav area
	var height = parseInt($('align').offsetHeight) -112 
	navBackArea.style.height = height + 'px'
	
	//build the shadow
	var shadow = document.createElement('div')
	shadow.id = "navShadow"
	navBackArea.appendChild(shadow)
	
	//build back pattern
	var pattern = document.createElement('div')
	pattern.style.position = "absolute"
	pattern.style.width = "25px"
	pattern.style.height = height + 'px'
	var repeat = Math.floor(height/78)
	var labelHeight = repeat*78
	for(var i=0; i<repeat; i++){
		var node = document.createElement('div')
		node.className = 'navBackArea'
		//move the nav
		Event.observe(node, 'mousemove', function(e){
			var goTo = parseInt(Event.pointerY(e)) - 71
			if(goTo>=70 && goTo<=(labelHeight-70)){
				shadow.style.top = goTo - 70 + 'px'
				nav.style.top = goTo - 70 + 46 + 'px'
			}else if(goTo<70){
				shadow.style.top = 0 + 'px'
				nav.style.top = 46 + 'px'
			}else{
				shadow.style.top = (labelHeight-140) + 'px'
				nav.style.top = (labelHeight-140 + 46) + 'px'
			}
		}, false) 
		pattern.appendChild(node)
	}
	navBackArea.appendChild(pattern)
	
	//position nav bar
	nav.style.display = 'block'
	nav.onmousemove = function(){
		Size.grow(nav,{maxWidth:691,maxHeight:'same',skip:60,pause:40})
	}
	nav.onmouseout = function(){
		Size.shrink(nav,{minWidth:30,minHeight:'same',skip:60,pause:40}) 
	}
	
	//set overstates for nodes
	var nodes = $('submenu').getElementsByTagName('a')
	for(var i=0; i<nodes.length; i++){
		nodes[i].onmouseover = function(){
			this.style.backgroundImage = 'url(../frontEnd/i/nav'+this.name+'A.gif)'
			/*if(ie){
				this.filters.alpha.opacity = 100
			}else{
				this.style.opacity = 1
			}*/
			
		}
		nodes[i].onmouseout = function(){
			this.style.backgroundImage = 'url(../frontEnd/i/nav'+this.name+'On.gif)'
			setTimeout("goOut("+this.name+")",500)
		}
	}
}

function goOut(num){
	var obj = $('nav'+num)
	var temp = obj.getElementsByTagName('a')
	
	temp[0].style.backgroundImage = ''
	/*var timer = new String().uId()
	Opacity.minus(temp[0],{timerVar:timer,skip:.03,pause:60})*/
}

function updateFill(){
	var r = parseInt($('bodyRecs').offsetHeight);
	var c = parseInt($('rightColl').offsetHeight);
	if((c-r)>0){
		var f = $('bodyFill');
		f.style.display = 'block';
		f.style.height = (c-r) + 'px';
	}
}

function buildSlideShow(i){
	if(rotator){
		if(!i)i=0
			
		var ele = $('whichImage')
		var over = $('sectionOverlay')
		var goTo = $('locationLink')
		
		
		if(rotator[i].type){
			if(rotator[i].type == 2){
				ele.style.backgroundImage = ''
				var html ='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="552" height="236" >'
				html +=  		'<param name="movie" value="'+ rotator[i].img +'">'
				html += 		'<param name="quality" value="high">'
				html +=  		'<param name="wmode" value="transparent">'
				html +=  		'<embed src="'+ rotator[i].img +'" quality="high" wmode="transparent" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="552" height="236" ></embed>'
				html += '</object>';
				ele.innerHTML = html
					 
			}else{
				ele.style.backgroundImage = 'url("' + rotator[i].img + '")';
				ele.innerHTML = '';
			}
		}else{
			ele.style.backgroundImage = 'url("' + rotator[i].img + '")';
			ele.innerHTML = '';
		}
		
		if(!ie){
			if(rotator[i].overlay){
				over.style.backgroundImage = 'url("' + rotator[i].overlay + '")';
			}else{
				over.style.backgroundImage = ''
			}
		}
		
		if(rotator[i].link){
			goTo.href = rotator[i].link
		}else{
			goTo.href = ".";
		}
		
		if(rotator[i+1]){
			i++
		}else{
			i = 0
		}
		
		var t = setTimeout(function(){buildSlideShow(i)},slideShowTimer)
	}
}













