function showVideo(url) {
		Shadowbox.open({
        content:    url,
        player:     'iframe',
        height:     350,
        width:      615
    });
    
    /*
    jQuery.fn.colorbox({
			open: true,
			opacity: 0.5,
			scrollbars: false,
			href: url,
      iframe: true,
      width: 665,
      height: 425
		});
    */
	}
	

// converts the home page into an internal page
function animToInternalPage() {
	jQuery('#pictureCycleWrapper').cycle('stop').hide();
  jQuery("#bigLogo").hide();
  jQuery("#mainContent").addClass("mainContentInternal");
  
	jQuery("#smallLogo").fadeIn(350); // lateral small logo appears
	jQuery("#textLaurenBattSmall").fadeIn(350); // small lauren battistini image text appears
	internalPage = true;
}

function animPullOut(jqsLink) {
	jqsLink.animate({width: 160}, 150);
}
function animPushIn(jqsLink) {
	jqsLink.animate({width: 145}, 150);
}

jQuery(document).ready(function() {
	// prepare animation events for vertical side menu elements
	jQuery('#verticalMenu a').mouseenter(function() {
		if(!jQuery(this).hasClass('selected')) {
			animPullOut(jQuery(this));
		}
	});
	jQuery('#verticalMenu a').mouseleave(function() {
		if(!jQuery(this).hasClass('selected')) {
			animPushIn(jQuery(this));
		}
	});

	jQuery('#verticalMenu a, #mainLinkContact, #mainLinkJoin, #lnkSocNewsletter, #lnkSocTV').click(function(e) {
		// load the content with AJAX
		e.preventDefault();
		var destination = jQuery(this).attr('href');
		jQuery('#mainContent').load("templates/" + destination + ".tpl.php");


		// switch the page to internal mode when clicking any link from home
		if(!internalPage) {
			animToInternalPage();
		}

	});

	// remove the "selected" class when a different option is selected
	jQuery('#mainLinkContact, #mainLinkJoin, #lnkSocNewsletter, #lnkSocTV').click(function() {
		animPushIn(jQuery('#verticalMenu a.selected'));
		jQuery('#verticalMenu a').removeClass('selected');
	});

	// give the "selected" class to the corresponding link
	jQuery('#verticalMenu a').click(function() {
		jQuery('#pictureCycleWrapper').hide();
    jQuery('#bigLogo').hide();
    animPushIn(jQuery('#verticalMenu a.selected'));
		jQuery('#verticalMenu a').removeClass('selected');
		jQuery(this).addClass('selected');
	});

	jQuery('#pictureCycleWrapper').cycle({
		fx: 'fade',
		speed: 500, 
		timeout: 5000,
		random: 1,
		pause: 0
	});
  
  // Set the actual browser viewport height for the image cycle container
  var viewportHeight = jQuery(window).height() - 112;
  jQuery('#cycleContainer').height(viewportHeight);
  jQuery('#pictureCycleWrapper img').height(viewportHeight);
});

jQuery(window).load(function() {
	// initial animation for the vertical side menu
	jQuery('#vmLink1 a').animate({'margin-left': 160}, 150, function(){
		jQuery('#vmLink2 a').animate({'margin-left': 160}, 150, function(){
			jQuery('#vmLink3 a').animate({'margin-left': 160}, 150, function(){
				jQuery('#vmLink4 a').animate({'margin-left': 160}, 150);
			});
		});
	});
});
