var isIE6= false;
var isSafari= false;
var blankContainer, blankTop, blankLeft, blankBottom, blankRight;

function track(obj, e)
{
	var parent = obj.parentNode;
	var spanObj = obj.parentNode.firstChild.firstChild;
	
	if (e=="mouseover")
	{
		spanObj.className = "arrow-up";
		if (isSafari){
			blankContainer.style.display = "none";
		}
		
	}
	else if (e=="mouseout")
	{
		spanObj.className = "arrow";
	}

	if (obj.className=="nav-wrapper" && isSafari)
	{
		drawDivs(obj);
	}
}

function getHeight()
{
	var height;
	if (document.body.clientHeight) {
		height = document.body.clientHeight;
	} else if (typeof window.innerWidth == "number") {
		height = window.innerHeight;
	} else if (document.documentElement &&
		(document.documentElement.clientWidth ||
		document.documentElement.clientHeight)) {
		height = document.documentElement.clientHeight;
	}
	return height-20;
}

function getWidth()
{
	var width;
	if (typeof window.innerWidth == "number") {
		width = window.innerWidth;
	} else if (document.documentElement &&
		(document.documentElement.clientWidth ||
		document.documentElement.clientHeight)) {
		width = document.documentElement.clientWidth;
	}
	return width-20;
}

function getY( oElement )
{
	var iReturnValue = 0;
	while( oElement != null ) {
		iReturnValue += oElement.offsetTop;
		oElement = oElement.offsetParent;
	}
	return iReturnValue;
}

function getX( oElement )
{
	var iReturnValue = 0;
	while( oElement != null ) {
		iReturnValue += oElement.offsetLeft;
		oElement = oElement.offsetParent;
	}
	return iReturnValue;
}

function drawDivs(obj){	
	blankTop.style.width = getWidth()+"px";
	
	blankLeft.style.width = getX(obj)+"px";
	blankLeft.style.height = (getHeight()-209)+"px";

	blankRight.style.left = (getX(obj)+obj.offsetWidth)+"px";
	blankRight.style.height = (getHeight()-209)+"px";
	blankRight.style.width = (getWidth()-getX(obj)-obj.offsetWidth)+"px";
	
	blankBottom.style.left = (getX(obj))+"px";
	blankBottom.style.top = (209+obj.offsetHeight)+"px";
	blankBottom.style.width = (obj.offsetWidth)+"px";
	blankBottom.style.height = (getHeight()-209-obj.offsetHeight)+"px";
	
	blankContainer.style.display = "block";
}

function hideDivs(){
	if (isSafari){
		blankContainer.style.display = "none";
	
		var nav = $("nav-bar");
		var list = nav.getElementsByTagName("a");
		for(var i =0; i<list.length; i++){
			if(list[i].firstChild.className == "arrow-up"){
				list[i].firstChild.className = "arrow";
			}
		}
	}
}

window.onresize = hideDivs;