$(document).ready(function() {
	$("ul#produtos").idTabs();
	$(".fadeImg img").animate({opacity: "0.3"}, "fast");
	$(".fadeImg img").hover(function() { $(this).animate({opacity: "1.0"}, "fast"); }, function() { $(this).animate({opacity: "0.3"}, "fast"); });
	$(".flashCarrosel203").flash({ src: '/Content/swf/carrossel_clientes_150x95.swf', width: 150, height: 95, wmode: 'transparent' }, { version: 8 });
	$(".flashCarrosel270x90").flash({ src: '/Content/swf/carrossel_clientes_270x90.swf', width: 270, height: 90, wmode: 'transparent' }, { version: 8 });
	$(".tvflash").flash({ src: '/Content/swf/tvflash.swf', width: 897, height: 190, wmode: 'transparent' }, { version: 8 });
	
	/*
	$('#playerEquipeGravacao').flash({ src: 'http://www.youtube.com/v/exFi3WfOpa8&hl=pt-br&fs=1&', width: 285, height: 238, wmode: 'transparent' });
	$('#playerOperacaoEquipamentos').flash({ src: 'http://www.youtube.com/v/zaHIebdxOHQ&hl=pt-br&fs=1&', width: 285, height: 238, wmode: 'transparent' });
	$('#playerBureauIndex').flash({ src: 'http://www.youtube.com/v/UgDE0ZqokIQ&hl=pt-br&fs=1&', width: 285, height: 238, wmode: 'transparent' });
	$('#playerLocacoesDiferenciais').flash({ src: 'http://www.youtube.com/v/WJIYLG1LEac&hl=pt-br&fs=1&', width: 352, height: 289, wmode: 'transparent' });
	$('#playerServicosEdicoesEFinalizacao').flash({ src: 'http://www.youtube.com/v/I0d1lOsGckY&hl=pt-br&fs=1&', width: 285, height: 238, wmode: 'transparent' });
	$('#playerServicosSuporteTecnico').flash({ src: 'http://www.youtube.com/v/WJIYLG1LEac&hl=pt-br&fs=1&', width: 285, height: 238, wmode: 'transparent' });
	*/
	
	$('#playerEquipeGravacao').flash({ src: 'http://vimeo.com/moogaloop.swf?clip_id=7572466&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1', width: 285, height: 238, wmode: 'transparent' });
	$('#playerOperacaoEquipamentos').flash({ src: 'http://vimeo.com/moogaloop.swf?clip_id=7547929&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1', width: 285, height: 238, wmode: 'transparent' });
	$('#playerBureauIndex').flash({ src: 'http://vimeo.com/moogaloop.swf?clip_id=7575483&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1', width: 285, height: 238, wmode: 'transparent' });
	$('#playerLocacoesDiferenciais').flash({ src: 'http://vimeo.com/moogaloop.swf?clip_id=7559270&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1', width: 352, height: 289, wmode: 'transparent' });
	$('#playerServicosEdicoesEFinalizacao').flash({ src: 'http://vimeo.com/moogaloop.swf?clip_id=7572363&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1', width: 285, height: 238, wmode: 'transparent' });
	$('#playerServicosSuporteTecnico').flash({ src: 'http://vimeo.com/moogaloop.swf?clip_id=7559270&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1', width: 285, height: 238, wmode: 'transparent' });
		
	/* Embed de videos do Youtube no Thickbox de detalhes */
	$("#mainVideo a[@href^='http://br.youtube.com'], #mainVideo a[@href^='http://www.youtube.com'], #mainVideo a[@href^='http://youtube.com']").flash({ width: 350, height: 289, wmode: 'opaque' }, { version: 8 },
		function(htmlOptions) {
			$this = $(this);
			var watch = $this.attr('href').split('watch?v=')[1];
			if (watch){
				var idVideo = watch.substr(0,11);
				htmlOptions.src = 'http://www.youtube.com/v/' + idVideo;
			}else{
				htmlOptions.src = $this.attr('href');
			}
			$this.before($.fn.flash.transform(htmlOptions));						
		}
	);
	/* Embed de videos do Youtube no Thickbox de detalhes */
	/*$("h2#ondeEncontrar").click(function () {
      $(".enderecoBureau").slideToggle();
    });*/
	
	/*Monta carrossel*/
	$(".carrosselVideos ul").jcarousel({ scroll: 1 });
	/*Monitora lista de video*/
	$(".carrosselVideos ul li a").click(function(){
    	$idVideo = $(this).attr("href").split("#")[1];
		$("#areaVideo").flash({ width: "603", height: "337", wmode: "transparent" }, { version: 9 },
	        function(htmlOptions) {
	            htmlOptions.src = 'http://vimeo.com/moogaloop.swf?clip_id=' + $idVideo + '&server=vimeo.com&show_title=1&show_byline=1&show_portrait=0&color=&fullscreen=1&autoplay=0';
	            $(this).html($.fn.flash.transform(htmlOptions));
	        }
	    );
		return false;
    });
	/*Monitora clique da lista e apresenta video*/
	$("#areaVideo").each(function() {
		$idVideo = $(this).find("a").attr("href").split("#")[1];
		$(this).flash({ width: "603", height: "337", wmode: "transparent" }, { version: 9 },
	        function(htmlOptions) {
				htmlOptions.src = 'http://vimeo.com/moogaloop.swf?clip_id=' + $idVideo + '&server=vimeo.com&show_title=1&show_byline=1&show_portrait=0&color=&fullscreen=1&autoplay=0';
	            $(this).html($.fn.flash.transform(htmlOptions));
	        }
	    );
	});
	
	var i = 0;
	$(".carrosselVideos ul li a").each(function(){
		$idVideo = $(this).attr("href").split("#")[1];
		$.getJSON("http://vimeo.com/api/oembed.json?url=http://vimeo.com/"+ $idVideo +"&callback=?", function(json){
			$(".carrosselVideos ul li:eq("+ i +") a").find("img").attr("src", json.thumbnail_url);
			i++;
		});
	});
	
	
	$("#form1 input:text").hint();
	$("#nome, .focus").focus();
	$("usuario.nome").focus();
	$("login").focus();
	
	$(".accor span.accor").click(function(){
		window.open("http://lojas.netstore.com.br/cameradv/vitrine.aspx");
	});	
});

function checkLen(x,y) {
	if (y.length==x.maxLength) {
		var next=x.tabIndex
		if (next<document.forms['0'].length) {
			document.forms['0'].elements[next].focus()
		}
	}
}