// JavaScript Document


// hide/display left column
function toggleLeftCol() {

	// detect if IE browser (necessary b/c IE does not support 'table-cell' css display property)
	var browser = navigator.appName;
	var iePosition = browser.indexOf('Internet Explorer');	
	
	if( browser.indexOf('Internet Explorer') > -1) {
		var ieBrowswer = 1;
	}

	// start show/hide left column
	var h_table = $('tb-cols').getHeight(); // get height of container table
	var h_table = h_table - 100; // hack to remove extra space that gets added at bottom of right col when left col closed
	
	if ( $("col-left").style.display != 'none' ) { // hide left column
		
		$("tb-cols").style.height = h_table + 'px'; // reset table height
		$("col-left").style.display = 'none'; // hide left col
		$("col-right").style.width = '802px'; // increase width of right column
		
		$("toggle-left").style.backgroundImage = 'url(/images/arrow_open_2.gif)'; // change icon to open arrow
	
	} else { // display left column
		
		$("tb-cols").style.height = h_table + 'px'; // reset table height
		//$("tb-row").style.height = h_table + 'px'; // reset table height
		
		if( ieBrowswer == 1) {
			$("col-left").style.display = 'inline-block'; // display left col in IE
		} else {
			$("col-left").style.display = 'table-cell'; // display left col in compliant browswers (not IE)
		}

		$("col-right").style.width = '590px'; // reduce width of right column
		$("toggle-left").style.backgroundImage = 'url(/images/arrow_close_2.gif)'; // change icon to close arrow
	
	} // end if-else

} //end toggleLeftCol()




// highlight menu items and show/hide search bar on click of menu item
function navHighlight(button) {

	var menu_item = button;

	switch (menu_item) {

		case "select": 
		$("nav-select").style.background = 'url(/images/icon_on.png) center right no-repeat';						
		$("nav-add").style.background = 'none';			
		$("nav-create").style.background = 'none';	
		$("nav-list").style.background = 'none';					
		break;
		
		case "list": 
		$("nav-list").style.background = 'url(/images/icon_on.png) center right no-repeat';						
		$("nav-add").style.background = 'none';			
		$("nav-create").style.background = 'none';		
		$("nav-select").style.background = 'none';		
		break;
		
		case "add": 
		$("nav-list").style.background = 'none';					
		$("nav-add").style.background = 'url(/images/icon_on.png) center right no-repeat';			
		$("nav-create").style.background = 'none';	
		$("nav-select").style.background = 'none';				
		break;
													
		case "create": 
		$("nav-select").style.background = 'none';		
		$("nav-list").style.background = 'none';			
		$("nav-add").style.background = 'none';			
		$("nav-create").style.background = 'url(/images/icon_on.png) center right no-repeat';			
		break;
		
		default: 
		$("nav-list").style.background = 'url(/images/icon_on.png) center right no-repeat';			
		$("nav-add").style.background = 'none';			
		$("nav-create").style.background = 'none';	
		$("nav-select").style.background = 'none';				
		break;

	} //end switch

} //end function 







