$(document).ready(function(){
	if($.browser.msie && ($.browser.version < 7)){
		$("body").addClass("ie");
	}
		
	$('ul.sf-menu').superfish({ pathClass: 'current' });
	$('a').click(function(){
		$(this).blur();
	});
	
	$('#flashHome').flash({ src: '/swf/flash.swf', width: 564, height: 315, wmode: 'opaque' }, {version: '8'} );
	
	$('#flashColetiva').flash({ src: 'http://static.livestream.com/grid/PlayerV2.swf?version=303', width: 960, height: 460, wmode: 'transparent', flashvars: {
		version: '2515',
		backgroundColor: '#ffffff',
		allowFullScreen: true,
		allowScriptAccess: 'always',
		channel: 'souoon',
		chatInputGlossEnabled: false,
		chromeColor: '0x333333',
		chatEnabled: true,
		layout: 'channelPage',
		backgroundAlpha: '1',
		uiWhite: true,
		backgroundGradientStrength: '30',
		bannerText: 'souOOn',
		playerAspectWidth: '4',
		playerAspectHeight: '3',
		userName: 'souoon'
	}}, {version: '8'} );
	
	/*
	$('.video1').flash({ src: 'http://vimeo.com/moogaloop.swf?clip_id=7056461&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1', width: 674, height: 374, wmode: 'transparent' });
	$('.video2').flash({ src: 'http://vimeo.com/moogaloop.swf?clip_id=7059140&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1', width: 674, height: 374, wmode: 'transparent' });
	$('.video3').flash({ src: 'http://vimeo.com/moogaloop.swf?clip_id=7058293&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1', width: 674, height: 374, wmode: 'transparent' });
	$('.video4').flash({ src: 'http://vimeo.com/moogaloop.swf?clip_id=7057118&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1', width: 674, height: 374, wmode: 'transparent' });
	$('.video5').flash({ src: 'http://vimeo.com/moogaloop.swf?clip_id=7059175&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1', width: 674, height: 374, wmode: 'transparent' });
	$('.video6').flash({ src: 'http://vimeo.com/moogaloop.swf?clip_id=7058892&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1', width: 674, height: 374, wmode: 'transparent' });
	$('.video7').flash({ src: 'http://vimeo.com/moogaloop.swf?clip_id=7071125&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1', width: 674, height: 374, wmode: 'transparent' });
	$('.video8').flash({ src: 'http://vimeo.com/moogaloop.swf?clip_id=7057901&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1', width: 674, height: 374, wmode: 'transparent' });
	$('.video9').flash({ src: 'http://vimeo.com/moogaloop.swf?clip_id=7058231&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1', width: 674, height: 374, wmode: 'transparent' });
	$('.video10').flash({ src: 'http://vimeo.com/moogaloop.swf?clip_id=7058010&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1', width: 674, height: 374, wmode: 'transparent' });
	*/
	
	$("#flashVideocasts").flash({ width: "674", height: "374", bgcolor: "#FFFFFF", wmode: "transparent" }, { version: 9 }, function(htmlOptions){
		htmlOptions.src = 'http://www.youtube.com/v/' + $(this).attr('rel') + '&autoplay=0';
		$(this).html($.fn.flash.transform(htmlOptions));
	});
	
	$('ul.listVideos li:odd').find('h4').addClass('green2');
	$('ul.listVideos li a').prepend('<span><img src="/img/bg-videosHover.png" alt="" width="48" height="63" border="0" class="fix"></span>');
	$('ul.listVideos li a').hover(function(){
		$(this).addClass('over');
	}, function(){
		$(this).removeClass('over');
	});
	$('.ie ul.listVideos li a img.fix').click(function(){
		window.location = $(this).parents('a').attr('href');
	})
	
	$oValidator = $('#formTrabalhe').validate({ errorContainer: $(".msgTrabalheError"), errorLabelContainer: $(".msgError") });
	$("#formTrabalhe").ajaxForm({
		contentType: 'application/x-www-form-urlencoded; charset=UTF-8',
		url: '/inc/trabalheInsere.php',
		dataType:  'json',
		success: function(data) {
			if(data.msg == 'OK'){
				$(".msgTrabalheSuccess").html("Seu currículo foi enviado com sucesso.");
				$("#formTrabalhe").fadeOut();
				$(".msgTrabalheSuccess").fadeIn();
			}
			else if(data.msg == 'curriculo'){
				$(".msgError").html("<p>Ocorreu um erro ao anexar o arquivo.<br />Por favor, Tente outra vez.</p>");
				$(".msgError").fadeIn();
			}
			else {
				$(".msgError").html("Preencha corretamente os campos marcados.");
				$(".msgError").fadeIn();
			}
		},
		beforeSubmit: function() {
			return $oValidator.valid();
		}
	});

	$('input.file').filestyle({ image: '/img/btn-procurar.gif', imagewidth : 83, imageheight : 27, width : 192 });

	$('.select').click(function(){
		if ( $(this).parent().find('ul.selectOptions').is(':visible') ){
			$(this).parent().find('ul.selectOptions').fadeOut('fast');
			$(this).removeClass('hover');
		}
		else{
			$(this).parent().find('ul.selectOptions').fadeIn('fast');
			$(this).addClass('hover');
			
			if ( $(".select").hasClass("error") ){
				$(this).parent().find('ul.selectOptions').addClass("error");
			}
			else{
				$(this).parent().find('ul.selectOptions').removeClass("error");
			}
		}
	});
	$('ul.selectOptions li').hover(function(){
		$(this).addClass('hover');
	}, function(){
		$(this).removeClass('hover');
	}).click(function(){
		$('.select').val($(this).html()).removeClass('hover');
		$(this).parent().fadeOut('fast');
	});
	
	$('.ga').click(function(){
		pageTracker._trackPageview($(this).attr('rel'));
	});	
	
	$(".tel").mask("(99)9999-9999");

	$('.fix').ifixpng();
});
