// POP-UP FUNCTIONS USED BY CMS
// ---------------------------------------------------------------------------------------

function open_in_popup_window(url, name, width, height) {
	window.open(url.href,name,'width=' + width + ',height=' + height + ',toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes');
	return false;
}
function open_in_new_window(url) {
	window.open(url.href,'external_link','toolbar=yes,location=yes,directories=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes');
	return false;
}

// CODE FOR DROP-DOWN MENU SUPPORT IN IE6
// ---------------------------------------------------------------------------------------

//sfHover = function() {
//	var sfEls = document.getElementById("main_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);


// JQUERY SCRIPTS FOR LIGHTBOX AND SLIDING PANELS
// ---------------------------------------------------------------------------------------
$(function() {
// REGISTER FLASH OBJECT
// ---------------------------------------------------------------------------------------
	//swfobject.registerObject("home_flash", "9.0.115", "/flash/home-flash.swf");

	//apply behaviours to lightbox links
	//$(".lightbox").lightbox();
	
	/* OLD FUNCTIONALITY //slides the element with class "slide_panel" when mouse is over the h3
	$("#sliding_panels h3").click(function()
	{
   		$(this).next("div.slide_panel").slideDown(500).siblings("div.slide_panel").slideUp(500).siblings('h3').removeClass("current");
		$(this).addClass("current");
	});
	*/
	
	//slides the element with class "slide_panel" when mouse is over the h3
//	$("#sliding_panels h3").click(function() {
//   		$(this).next("div.slide_panel").slideToggle(500);
//		$(this).toggleClass("current");
//	});

	$('#sidebar .primary-nav li ul').hide();
	
	$('#sidebar .primary-nav li').hover(function(){
		$(this).children('ul').show();
	},function(){
		$(this).children('ul').hide();
	});
	//external links
	$('a[rel="external"]').each(function(){
		$(this).click(function(){
			window.open($(this).attr('href'));
			return false;
		});
	});
});