//functions.js

//absolute positioning - cross-browser
var newer = (document.getElementById) ? 1 : 0;
var NS4 = (document.layers) ? 1 : 0;
var IE4 = (document.all) ? 1 : 0;

function moveIt(id, x, y, height) {
  if (NS4) {
  	var thisdiv = document[id];
    document[id].left += x;
    document[id].top += y;
  } else if (IE4) {
  	var thisdiv = document.all[id];
    document.all[id].style.left += x;
    document.all[id].style.top += y;
  } else {
	var thisdiv = document.getElementById(id);
	thisdiv.style.left = x + "px";
	thisdiv.style.top = y + "px"; //move content div up the amount the menus push it down
	/*
	if (x < -100){ 
		var height = "50"; 
	}else{ 
		var height = x; 
	}
	*/
	
	//find out height of content	
	if(height==null){
		height=0;
	}
	
	var objHeight = null;
	if(document.implementation.hasFeature("CSS", "2.0")) {
		objHeight = document.defaultView.getComputedStyle(thisdiv,
		null).getPropertyCSSValue("height").getFloatValue(5);
	}else if(thisdiv.clientHeight!=null) {
		objHeight = thisdiv.offsetHeight;
	}
	
	objHeight -= height;
	if(objHeight<0){
		objHeight = 0;
	}
	
	
	//thisdiv.style.height = "80px";
	//thisdiv.style.height += height + "px"; //kill the extra whitespace
	
	thisdiv.style.height += objHeight + "px";
	thisdiv.style.pixelHeight += objHeight + "px";	
	
	document.all[id].content_pos.style.height += objHeight;
	document.all[id].paragraph.style.height += objHeight;
	document.all[id].inner.style.height += objHeight;
  }
}




//menu mouseovers
sfHover = function() {
var sfEls = document.getElementById("nav").getElementsByTagName("LI");
for (var i=0; i<sfEls.length; i++) {
sfEls[i].onmouseover=function() {
this.className+=" sfhover";
}
sfEls[i].onmouseout=function() {
this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
}
}
}
if (window.attachEvent) window.attachEvent("onload", sfHover);


//image swaps
function swap_over() {
		for (var i=0; i<swap_over.arguments.length; i++) {
			var over = "images/menu/over/"+swap_over.arguments[i]+".gif";
			document[swap_over.arguments[i]].src = over;
		}
}

function swap_back() {
	for (var i=0; i<swap_back.arguments.length; i++) {
		var orig = "images/menu/"+swap_back.arguments[i]+".gif";
		document[swap_back.arguments[i]].src = orig;
	}
}

function swap() {
		for (var i=0; i<swap.arguments.length; i+=2) {
			document[swap.arguments[i]].src = "images/menu/"+swap.arguments[i+1]+".gif";
		}
}
