// JavaScript Document
var navItems =  new Array('About_BU','Admissions','Academics','Tuition','Online_Learning','Community');
var navActive = '';
	function init_nav(mainNavId){
		if(navActive != ''){
			for(var i = 0; i < navItems.length; i++){
				subnav_div = "subNav"+navItems[i]
				nav_div = "mainNav"+navItems[i].replace("_","")
				//alert(subnav_div)
				//document.getElementById(subnav_div).style.display = 'none';
				//document.getElementById(nav_div).style.background = ''
			}
			
			subnav_div = navActive;
			left_pos = findPosX(mainNavId) + 110
			top_pos = findPosY(mainNavId) + 10
			document.getElementById(subnav_div).style.top = top_pos+'px';
			document.getElementById(subnav_div).style.left = left_pos+'px';
			document.getElementById(subnav_div).style.display = 'block';
			document.getElementById(mainNavId).style.background = 'url(webroot/images/layout/'+mainNavId+'Over.jpg) no-repeat'
			//set background to over state
		}else{
			for(var i = 0; i < navItems.length; i++){
				subnav_div = "subNav"+navItems[i]
				nav_div = "mainNav"+navItems[i].replace("_","")
				document.getElementById(subnav_div).style.display = 'none';
				document.getElementById(nav_div).style.background = ''
			}
		}
	}

	function init_sub_nav(navId,SubNavId){
		cur_state = document.getElementById(SubNavId).style.display
		if(cur_state == 'none'){
			top_pos = 10
			document.getElementById(SubNavId).style.top = top_pos+'px';
			document.getElementById(SubNavId).style.left = 120+'px';
			document.getElementById(SubNavId).style.display = 'block';
		}else{
			document.getElementById(SubNavId).style.display = 'none';
		}
	}
	
	function findPosX(id){
		var curleft = 0;
		obj = document.getElementById(id)
		if(obj.offsetParent)
			while(1) 
			{
			  curleft += obj.offsetLeft;
			  if(!obj.offsetParent)
				break;
			  obj = obj.offsetParent;
			}
		else if(obj.x)
			curleft += obj.x;
		return curleft;
		alert(curleft)
	}
	
	function findPosY(id){
		var curtop = 0;
		obj = document.getElementById(id)
		if(obj.offsetParent)
			while(1)
			{
			  curtop += obj.offsetTop;
			  if(!obj.offsetParent)
				break;
			  obj = obj.offsetParent;
			}
		else if(obj.y)
			curtop += obj.y;
		return curtop;
	}


function horiz_nav_over(id,content_str){
	
	for(var i=0;i<nav_ids.length;i++){
		document.getElementById(nav_ids[i]).style.background = 'url(none)';
	}
	document.getElementById(id).style.background = 'url(webroot/images/layout/navOver.gif) no-repeat top center'
	document.getElementById('subNavContent').innerHTML = content_str
}

function horiz_nav_out(id){
	
}

function nav_out(){
	document.getElementById('subNavContent').innerHTML = current_page;	
}

function init_submenu(id,aHrefId){
	//set all subs to display:none
	for(var i=0;i<subArrayIds.length;i++){
		document.getElementById(subArrayIds[i]).style.display = 'none';
		linkId = subArrayIds[i]+"A"
		document.getElementById(linkId).style.color = '#939292';
	}
	if(id != ''){
		document.getElementById(id).style.display = 'block';
	}
	if(aHrefId != ''){
		document.getElementById(aHrefId).style.color = '#000000';
	}
	init_subsubmenu('')
}


function init_subsubmenu(id){
	//set all subs to display:none
	/*if(id == ''){
		for(var i=0;i<subSubArrayIds.length;i++){
			document.getElementById(subSubArrayIds[i]).style.display = 'none';
		}
	}else{
		for(var i=0;i<subSubArrayIds.length;i++){
			document.getElementById(subSubArrayIds[i]).style.display = 'none';
		}
		document.getElementById(id).style.display = 'block';
		//set active one to display:block;
	}*/
}