$(document).ready(function() {
	// 
	// preload hover/click state dropshadow images for homepage slider
	//
	$(document.createElement("img")).attr("src", '/design/site/images/bg_slide-dropshadow-clicked2.gif');
	$(document.createElement("img")).attr("src", '/design/site/images/bg_slide-dropshadow-hover2.gif');
	
	$('#primary-nav > li.menuItem > a').hover(
		function() {
			var tab = $("#"+this.id);
			var position = tab.position();
			var get_id = this.id.split("_");
			var nav_id = get_id[1];
			$('#dropMenu_'+nav_id).removeClass('hide');
			$('#dropMenu_'+nav_id).css('left', position.left+'px');
			
			if ($.browser.msie == true && $.browser.version == "6.0") {
				$('#dropMenu_'+nav_id).bgiframe();
			}
		},
		function() { 
			var get_id = this.id.split("_");
			var nav_id = get_id[1];
			$('#dropMenu_'+nav_id).addClass('hide');
		}
	);
	
	$('div.drop-menu-shadow').hover(
		function() { 
			var get_id = this.id.split("_");
			var nav_id = get_id[1];

			$('#tabIndex_' + nav_id).parent().addClass('dropmenu-hover');

			var dropdown = $("#"+this.id);
			dropdown.removeClass('hide');
		},
		function() { 
			$(this).addClass('hide');
			$('#primary-nav').children('li').removeClass('dropmenu-hover');
		}
	);

	/*
	 * home callout - regions - map region switcher
	 */
	$(".regions-list > ul > li > a").hover(
		function() {
			var get_id = this.id.split("_");
			var tab_id = get_id[1];

			$("#regions-map > div").addClass("mapSlice_" + tab_id);
		},

		function() {
			var get_id = this.id.split("_");
			var tab_id = get_id[1];

			$("#regions-map > div").removeClass("mapSlice_" + tab_id);							
		}
	);
});

/*
 * function to call thickbox for videos
 */
function showVideo(main_node_id, height, width, title) {
	if (title == "undefined" || title == "") { title = "Video"; }
	
	(height == "undefined" || height == '') ? height = 480 : height = (parseInt(height) + 15);
	(width == "undefined" || width == '') ? width = 640 : width = (parseInt(width));

	var url = '/content/view/popup/' + main_node_id + '?height=' + height + '&width=' + width;
	tb_show(title, url);
}
