$(function(){
	// Video da área assista
	// Gera o número do video de forma randomica
	var num_video = Math.ceil(Math.random() * 4);
			
	video += '<style type="text/css"> @import url("css/video-js.css");</style>';
			
	if($('html').hasClass('firefox') || $('html').hasClass('opera')){
		var video = '<object id="flash_fallback_1" class="vjs-flash-fallback" width="290" height="193" type="application/x-shockwave-flash"';
		video += 'data="http://releases.flowplayer.org/swf/flowplayer-3.2.1.swf">';
		video += '<param name="movie" value="http://releases.flowplayer.org/swf/flowplayer-3.2.1.swf" />';
		video += '<param name="allowfullscreen" value="true" />';
		video += '<param name="flashvars" value=\'config={"playlist":["http://www.hasp.org.br/img/video-splash.png", {"url": "http://www.hasp.org.br/videos/video'+num_video+'.mp4","autoPlay":false,"autoBuffering":true}]}\' />';
		video += '</object>';
	}else{
		var video = '<link href="css/video-js.css" rel="stylesheet" type="text/css" />';
		video += '<div class="video-js-box">';
		video += '<video class="video-js" width="290" height="193" controls="controls" preload="auto">';
		video += '<source src="videos/video'+num_video+'.mp4" type=\'video/mp4; codecs="avc1.42E01E, mp4a.40.2"\' />';
		video += '<source src="videos/video'+num_video+'.webm" type=\'video/webm; codecs="vp8, vorbis"\' />';
		video += '<source src="videos/video'+num_video+'.ogv" type=\'video/ogg; codecs="theora, vorbis"\' />';
		video += '<!-- Flash Fallback. Use any flash video player here. Make sure to keep the vjs-flash-fallback class. -->';
		video += '<object id="flash_fallback_1" class="vjs-flash-fallback" width="290" height="193" type="application/x-shockwave-flash"';
		video += 'data="http://releases.flowplayer.org/swf/flowplayer-3.2.1.swf">';
		video += '<param name="movie" value="http://releases.flowplayer.org/swf/flowplayer-3.2.1.swf" />';
		video += '<param name="allowfullscreen" value="true" />';
		video += '<param name="flashvars" value=\'config={"playlist":["http://www.hasp.org.br/img/video-splash.png", {"url": "http://www.hasp.org.br/videos/video'+num_video+'.mp4","autoPlay":false,"autoBuffering":true}]}\' />';
		video += '</object>';
		video += '</video>';
		video += '</div>';
	}
	
	// Insere o video da inauguração do Centro Cirúrgico
	video_cc += '<style type="text/css"> @import url("css/video-js.css");</style>';
	
	if($('html').hasClass('firefox') || $('html').hasClass('opera')){
		var video_cc = '<object id="flash_fallback_1" class="vjs-flash-fallback" width="290" height="193" type="application/x-shockwave-flash"';
		video_cc += 'data="http://releases.flowplayer.org/swf/flowplayer-3.2.1.swf">';
		video_cc += '<param name="movie" value="http://releases.flowplayer.org/swf/flowplayer-3.2.1.swf" />';
		video_cc += '<param name="allowfullscreen" value="true" />';
		video_cc += '<param name="flashvars" value=\'config={"playlist":["http://www.hasp.org.br/img/inauguracao-cc.jpg", {"url": "http://www.hasp.org.br/videos/inauguracao_cc.flv","autoPlay":false,"autoBuffering":true}]}\' />';
		video_cc += '</object>';
	}else{
		var video_cc = '<link href="css/video-js.css" rel="stylesheet" type="text/css" />';
		video_cc += '<div class="video-js-box">';
		video_cc += '<video class="video-js" width="290" height="193" controls="controls" preload="auto">';
		video_cc += '<source src="videos/inauguracao_cc.mp4" type=\'video/mp4; codecs="avc1.42E01E, mp4a.40.2"\' />';
		video_cc += '<source src="videos/inauguracao_cc.webm" type=\'video/webm; codecs="vp8, vorbis"\' />';
		video_cc += '<source src="videos/inauguracao_cc.ogv" type=\'video/ogg; codecs="theora, vorbis"\' />';
		video_cc += '<!-- Flash Fallback. Use any flash video player here. Make sure to keep the vjs-flash-fallback class. -->';
		video_cc += '<object id="flash_fallback_1" class="vjs-flash-fallback" width="290" height="193" type="application/x-shockwave-flash"';
		video_cc += 'data="http://releases.flowplayer.org/swf/flowplayer-3.2.1.swf">';
		video_cc += '<param name="movie" value="http://releases.flowplayer.org/swf/flowplayer-3.2.1.swf" />';
		video_cc += '<param name="allowfullscreen" value="true" />';
		video_cc += '<param name="flashvars" value=\'config={"playlist":["http://www.hasp.org.br/img/inauguracao-cc.jpg", {"url": "http://www.hasp.org.br/videos/inauguracao_cc.flv","autoPlay":false,"autoBuffering":true}]}\' />';
		video_cc += '</object>';
		video_cc += '</video>';
		video_cc += '</div>';
	}
	
	// Insere o video da área assista
	$('#video').html(video);
	// Insere o video da inauguração do cc
	//$('#video-cc').html(video_cc);
});
