
	$(document).ready(function(){

		var hide = false;
		
		var obj;
		var menu;
		
		$("#main a").hover(function(){
			if (!$(this).parent().is('.set')){
				if (hide) clearTimeout(hide);
				m = this.id;
				menu = m.substr(5,7);
				obj = $(this);
				_showPopup();
			}
			
        }, function(){
			if (!$(this).parent().is('.set')){
				hide = setTimeout(function(){_hidePopup();}, 50);
			}
        });	

		$("#hotspot").hover(function(){
			if (hide) clearTimeout(hide);
        }, function(){
			_hidePopup();
        });
		
		function _showPopup()
		{
			$("#main a").each(function(i){
				if (!$(this).parent().is('.set')){
					$(this).parent().removeClass('rollover');
				}
			});
			
			$('#menu-1, #menu-2, #menu-3').hide();
			
			obj.parent().addClass('rollover');
			$('.nav-index').addClass('bg-rollover');
			$('#overlay h2').hide();
			$('#nav-index-popup, #hotspot, #'+menu).show();
			
			image = menu.split('-');
			showImg = image[1]-1;
			$('#img-holder').html('<img src="' + images[showImg] + '" />');
		}
		
		function _hidePopup()
		{
			$("#main a").each(function(i){
				if (!$(this).parent().is('.set')){
					$(this).parent().removeClass('rollover');
				}
			});
			
			$('#nav-index-popup, #hotspot').hide();			
			
			if(pageType == 'home'){ //set inline (index.html)
				$('.nav-index').removeClass('bg-rollover');
				$('#overlay h2').show();
			}
			
		}		
	
	});