/*-----FUNCTIONS FOR SITE------*/

/* PURE JAVASCRIPT SECTION
------------------------*/

//MENU FUNCTION
// Toggle display Products menu
function toggleProductsMenu() {
  if(document.getElementById("nav-menu-product").style.display == "block" ) {
    document.getElementById("nav-menu-product").style.display = "none";
  }
  else {
    document.getElementById("nav-menu-product").style.display = "block";
  }
}

// Show Products menu
function showProductsMenu() {
    document.getElementById("nav-menu-product").style.display = "block";
}
// Hide Products menu
function hideProductsMenu() {
    document.getElementById("nav-menu-product").style.display = "none";
}

// Show Download menu
function showDownloadMenu() {
    document.getElementById("nav-menu-download").style.display = "block";
}
// Hide Products menu
function hideDownloadMenu() {
    document.getElementById("nav-menu-download").style.display = "none";
}

/* jQUERY SCRIPT SECTION
------------------------*/
$(document).ready(function() {
// IE7 z-index FIX
$(function() {
	if($.browser.msie){
	$('div').each(function(i) {
	if($(this).css('position')!='absolute') $(this).css('zIndex', 1000 - (i * 10));
	});
	}
})

// Auto display scroll buttons when content is long
	function detectScroll() {
		var actualHeight = $("#content-scroll").height();
		if (actualHeight>398) {
			$("#scroll").show();
		}else{
			$("#scroll").hide();
			$("#scroller").css("top",'0');   //Scroll to top
		}
	}	
			
	detectScroll(); // Auto detect scroll on load
	
	$("#content").click(detectScroll);
	
// Expand/Collapse function
	$("dl.expandable dt").click(function () {
		//Hide current expanding section
		$("dl.expandable dd").hide();
		
		//Toogle Expand/collapse
		var itemID = $(this).attr("class");
		//$("dl.expandable dd."+itemID).toggle();
		
		//Toogle text color
		if ($(this).is('.expanding')) {
			$("dl.expandable dd."+itemID).hide();
			$(this).removeClass('expanding');
		} else {
			$("dl.expandable dt.expanding").removeClass('expanding');
			$("dl.expandable dd."+itemID).show();
			$(this).addClass('expanding');
		}

	});
	        
});
