// JavaScript Document
var videos = new Array();
//var readyvideos = new Array();
videos[0] = "http://media.mededarchitects.com/video/MEA_Company_2011.flv";
videos[1] = "http://media.mededarchitects.com/video/MEA_Healthcare.flv";
videos[2] = "http://media.mededarchitects.com/video/MEA_Education.flv";
videos[3] = "http://media.mededarchitects.com/video/MEA_Corporate.flv";
videos[4] = "http://media.mededarchitects.com/video/MEA_Studio_2011.flv";
videos[5] = "http://media.mededarchitects.com/video/MEA_Webcast_2011.flv";
videos[6] = "http://media.mededarchitects.com/video/MEA_Podcast_2011.flv";
videos[7] = "http://media.mededarchitects.com/video/MEA_Event_Capture_2011.flv";
videos[8] = "http://media.mededarchitects.com/video/MEA_Patient_Cases_2011.flv";
videos[9] = "http://media.mededarchitects.com/video/MEA_Animation_2011.flv";
videos[10] = "http://media.mededarchitects.com/video/MEA_Consumer_2011.flv";
videos[11] = "http://media.mededarchitects.com/video/03.dynamix-education-aafp.flv";
videos[12] = "http://media.mededarchitects.com/video/02.dynamix-healthcare-ngu.flv";
videos[13] = "http://media.mededarchitects.com/video/02.dynamix-healthcare-ssu.flv";
videos[14] = "http://media.mededarchitects.com/video/03.dynamix-education-stmary.flv";
videos[15] = "http://media.mededarchitects.com/video/03.dynamix-education-hopkins.flv";
videos[16] = "http://media.mededarchitects.com/video/05.dynamix-corporate-wright.flv";
videos[17] = "http://media.mededarchitects.com/video/05.dynamix-corporate-planmeca.flv";
videos[18] = "http://media.mededarchitects.com/video/04.dynamix-drtv-stmary.flv";
videos[19] = "http://media.mededarchitects.com/video/aafp demo 2010 - final.flv";
videos[20] = "http://media.mededarchitects.com/video/MEA.SCU.demo.flv";

videos[21] = "http://media.mededarchitects.com/video/2_studio.flv";
videos[22] = "http://media.mededarchitects.com/video/4_web.flv";
videos[23] = "http://media.mededarchitects.com/video/8_podcasts.flv";
videos[24] = "http://media.mededarchitects.com/video/5_eventcapture.flv";
videos[25] = "http://media.mededarchitects.com/video/3_patientcases.flv";
videos[26] = "http://media.mededarchitects.com/video/6_animation.flv";
videos[27] = "http://media.mededarchitects.com/video/1_consumer.flv";
/*readyvideos[0] = '<div class="swf_holder" style="width: 100%; height: 100%;" id="vimeo_swfe4d5092bc01287aec336951a175208d0"><object width="100%" height="100%"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=10931756&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1" /><embed src="http://vimeo.com/moogaloop.swf?clip_id=10931756&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="100%" height="100%"></embed></object><p><a href="http://vimeo.com/10931756">Dynamix Productions Demo</a> from <a href="http://vimeo.com/user3464347">Greg Steinbrecher</a> on <a href="http://vimeo.com">Vimeo</a>.</p></div>';*/
	  
var player_path = "player/";
var nnn = player_path+'player.swf';

$(document).ready(function(){
	$("a#contact-us").fancybox({  frameWidth: 664,   frameHeight: 280, overlayShow:true, hideOnContentClick:false});
	/* Main Menu popup */					   
	$('.main-menu li').hover(function(){
		$(this).find('.drop-down-menu').show();
	},function(){
		$(this).find('.drop-down-menu').hide();
	});
	if( /MSIE (5\.5|6\.)/.test(navigator.userAgent) ){
		$('.drop-down-menu').each(function(){
			var width = $(this).width() - 25;
			$(this).find('a').width( width );
		});
	}
	
	if ( $('body').height() > $(document).height() ){
		var height = $('body').height();
	} else {
		var height = $(document).height();
	}
	$('.overlay').css('opacity','0.3').height( height );
	
	$('.overlay').click( function(){
		if( !$(this).hasClass('popup-video-overlay') ){
			close_popups();
		} else {
			$(this).removeClass('popup-video-overlay');
			$('#video-box').empty();
			$('.video-popup').hide();
		}
	});
	
	/* Video for icons */
	$('.services li .service-item, .sample-content .sample a').each(function(index) {
		$(this).click(function() {
			showVideo(parseInt($(this).attr("videoID")));
		});
	});
	
	/* Video for icons */
	$('.services li .service-item, .sample-content .sample-new a').each(function(index) {
		$(this).click(function() {
			showVideo(parseInt($(this).attr("videoID")));
		});
	});
	
	/*Black popups for services*/
//
//	$('.services li').hover(function(){
//		$('.black-bubble').hide();
//		var margintop = $(this).find('.black-bubble').height()-10;
//		$(this).find('.black-bubble').css('margin-top', "-"+margintop+"px" );
//		$(this).find('.black-bubble').fadeIn('normal');
//		/* for IE lt 7 ONLY - width for black bubble block */
//		if ( navigator.appName == "Microsoft Internet Explorer" && parseFloat(navigator.appVersion) <= 7.0 ){
//			if ( $(this).find('.black-bubble-top').css('width') == 'auto' ){
//				$(this).find('span').css('text-align','center');
//				$(this).find('.black-bubble-top').width( $(this).find('.black-bubble-content').width() - 10 );
//				$(this).find('.black-bubble-bottom').width( $(this).find('.black-bubble-top').width() - 38 );
//			}
//		}
//	}, function(){
//		$(this).find('.black-bubble').hide();
//	});
	
});
function show_glow(what){
	if ( $('body').height() > $(document).height() ){
		var height = $('body').height();
	} else {
		var height = $(document).height();
	}
	$('.overlay').css('opacity','0.3').height( height );
	$('.overlay').fadeIn('normal',function(){ 
		$('#'+what).show();
		$('#'+what+' .glow-block-center').height( $('#'+what+' .glow-box-content').height() - 99 );
	});
}
function close_popups(){
	$('.popup-block').hide();
	$('#video-box').empty();
	$('.overlay').fadeOut();
}

function showVideo(n) {
	if ( $('body').height() > $(document).height() ){
		var height = $('body').height();
	} else {
		var height = $(document).height();
	}
	$('.overlay').css('opacity','0.3').height( height );
	if ( $('.overlay').css('display') == 'block' ){
		$('.overlay').addClass('popup-video-overlay');
		$('.video-popup').show();
	} else {
	$('.overlay').fadeIn('normal',function(){ $('.video-popup').show(); });
	}
	
	flashembed("video-box", {src:nnn, version:[8,0], scale:"noscale", wmode:"transparent", allowFullScreen:"false"}, {path:videos[n]});
	$('#video-box').css({ width: '670px', height: '440px', background: 'transparent' });
}
function closePlayer() {
	$("#video-box").hide();
	if ( $(".overlay").hasClass('popup-video-overlay') ){
		$(".overlay").removeClass('popup-video-overlay');
	} else {
		$(".overlay").fadeOut();
	}
}

