function openPopup(id){
	$('.popup-img').css('display', 'none');
	
	if(id == 'video'){
		$('#facebox').addClass('facebox-video');
		$('#popup-video').css('display', '');
		$('#facebox').find('iframe').attr('src', 'http://player.vimeo.com/video/14402500?title=0&;byline=0&portrait=0&color=ffffff&autoplay=1');
	}else{
		$('#facebox').removeClass('facebox-video');
		$('#popup-img'+id).css('display', '');
		$('#facebox').find('iframe').attr('src', '');
	}
	
	$('#facebox').overlay(
		{	
			top: 100,	
			expose: {
				color: '#000', 
				loadSpeed: 200,	
				opacity: 0.7
			}, 
			closeOnClick: false,	
			api: true
		}).load(); 

	$(".close-btn").click(function(){
		$('#facebox').find('iframe').attr('src', 'http://player.vimeo.com/video/14402500?title=0&;byline=0&portrait=0&color=ffffff&autoplay=1');
	});
		
		
	return false;
}

$(document).ready(function(){

	$("ul.topnav li.main").mouseover(function() { //When trigger is clicked...

		//Following events are applied to the subnav itself (moving subnav up and down)
		$(this).find("ul.subnav").slideDown('fast').show(); //Drop down the subnav on click
		$(this).find("a").addClass('over');
		if(!$(this).hasClass('main-selected')){
			//$(this).find("img").attr('src', '/images/subnav-selected.gif');
		}

		$(this).hover(function() {
		}, function(){
			$(this).parent().find("ul.subnav").slideUp('slow'); //When the mouse hovers out of the subnav, move it back up
			if(!$(this).hasClass('main-selected')){
				//$(this).find("img").attr('src', '/images/subnav.gif');
			}
			$(this).find("a").removeClass('over');
		});

		//Following events are applied to the trigger (Hover events for the trigger)
		}).hover(function() {
			$(this).addClass("subhover"); //On hover over, add class "subhover"
		}, function(){	//On Hover Out
			$(this).removeClass("subhover"); //On hover out, remove class "subhover"
	});
	

});
