$(document).ready(function() {
	$("#mainNav").superfish({ pathClass: 'current', hoverClass: 'sfHover', animation: {opacity:'show'}, delay: 800, speed: 'fast' });
	$("#produtosMenu").flash({ src: '../swf/produtosMenu.swf', width: 980, height: 380, wmode: 'transparent' }, { version: 8 });
	$("#flashHome").flash({ src: '../swf/home.swf', width: 980, height: 435 }, { version: 8 });
	$("#flashConheca").flash({ src: '../swf/history.swf', width: 750, height: 450 }, { version: 8 });
	$("#cozinhaCompleta").flash({ src: '../swf/cozinha_completa.swf', width: 980, height: 300 }, { version: 8 });
	$("ul#listTabsInfo").idTabs();
	$("ul#listTabsProd").idTabs();
	$("table.dados tr:even td").addClass('even');
	$("table.dados tr:odd td").addClass('odd');
	$("table.dados td:odd").addClass('txtRight');
	$("table.download td:even").css('padding', '0px 15px');
	$("table.download td:odd").addClass('btnDownload');
	$("h2, h3.imprensa, h4.acessorio").flash({ src: '../swf/futura.swf', wmode: 'transparent', flashvars: {css: ['* { color: #E12F3D; }'].join(' ')} }, { version: 8 },
		function(htmlOptions) {
			htmlOptions.flashvars.txt = this.innerHTML;
			this.innerHTML = '<span>'+this.innerHTML+'</span>';
			var $alt = $(this.firstChild);
			htmlOptions.height = $alt.height();
			htmlOptions.width = $alt.width();
			$alt.addClass('alt');
			$(this)
				.addClass('flash-replaced')
				.prepend($.fn.flash.transform(htmlOptions));
		}
	);
	$('input:text').hint();
});

/* Zoom para a foto dos produtos */
function zoomProduto(ID,idFoto){
	TB_show('', '/msg/tbProdutoDetalhe.html?idProd=' + ID + '&idFoto=' + idFoto + '&keepThis=true&TB_iframe=true&width=614&height=517', false);
}

function ShowHide(ID){
	var target = document.getElementById(ID);
	if(target.style.display == 'none'){
		target.style.display = '';
	}else{
		target.style.display = 'none';
	}
}

jQuery.fn.hint = function() {
	return this.each(function(){
		var t = $(this);
		var title = t.attr('title');
		if (title) {
			t.focus(function(){
				if (t.val() == title) {
				  t.val('');
				  t.removeClass('blur');
				}
			})
			t.blur(function(){
				if (t.val() == '') {
				  t.val(title);
				  t.addClass('blur');
				}
			})
			t.parents('form:first()').submit(function(){
				if (t.val() == title) {
					t.val('');
					t.removeClass('blur');
				}
			});
			t.blur();
		}
	})
}
