/*
	JQUERY FUNCTIONS
*/
(function( $ ){
  
  // DIALOG
  $.fn.dialog = function() {
		var target = this;
		$(window).qtip({
		  content: {
		     text: $(target).html(),
		     title: {
		        text: 'Video Player',
		        button: true
		     }
		  },
		  position: {
		     my: 'center',
		     at: 'center',
		     target: $(window)
		  },
		  show: {
		     event: 'load',
		     ready: true,
		     solo: true,
		     modal: true
		  },
		  hide: false,
		  style: {
		  		classes: 'ui-tooltip-light ui-tooltip-shadow ui-tooltip-rounded',
		  		width: '621px'
		  }
		});
	};
})( jQuery );

/*
	CONTENT RELATED CODE
*/

$(function(){
	
	if (jQuery().lightbox) $('a.lightbox').lightbox({
		fileBottomNavCloseImage: '//assets.mdedinc.com/js/libs/lightbox/closelabel.gif',
		fileLoadingImage: '//assets.mdedinc.com/img/loading.gif'
	});
	
	if ( $.browser.msie && parseInt($.browser.version, 10) < 7) {
		// No Super Menu in IE6
	} else {
		var qtip_menubar = {
			hide: {
			   fixed: true,
			   delay: 100
			},
			style: {
			      classes: 'ui-tooltip-light ui-tooltip-shadow ui-tooltip-rounded menubar_tip',
			      width: '280px'
			},
			position: {
			      my: 'top center',
			      at: 'bottom center',
			      viewport: $(window)
			}
		};
		
		$('#menu_solutions').qtip( $.extend(true, {}, qtip_menubar,{
		   content: {
		      text: $('#menu_solutions_content')
		   }
		}));
		
		$('#menu_products').qtip( $.extend(true, {}, qtip_menubar,{
		   content: {
		      text: $('#menu_products_content')
		   }
		}));

	}
	
	$('#videos a').click( function (event) {
		event.preventDefault();
		$(this).next().dialog();
	});
	
});
