$ = jQuery.noConflict();

$(document).ready(function() {

	function megaHoverOver(){
		$(this).find(".sub").stop().fadeTo('fast', 1).show();
			
		//Calculate width of all ul's
		(function($) { 
			jQuery.fn.calcSubWidth = function() {
				rowWidth = 0;
				//Calculate row
				$(this).find("ul").each(function() {					
					rowWidth += $(this).width(); 
				});	
			};
		})(jQuery); 
				
		$(this).calcSubWidth();
		//Set Width
		$(this).find(".sub").css({'width' : rowWidth});
	}
	
	function megaHoverOut(){ 
	  $(this).find(".sub").stop().fadeTo('fast', 0, function() {
		  $(this).hide(); 
	  });
	}
 
	var config = {    
		 sensitivity: 2, // number = sensitivity threshold (must be 1 or higher)    
		 interval: 100, // number = milliseconds for onMouseOver polling interval    
		 over: megaHoverOver, // function = onMouseOver callback (REQUIRED)    
		 timeout: 500, // number = milliseconds delay before onMouseOut    
		 out: megaHoverOut // function = onMouseOut callback (REQUIRED)    
	};
 
	$("ul#menu li .sub").css({'opacity':'0'});
	$("ul#menu li").hoverIntent(config);
 
});
 
function exit_busca(elemento, valor) {
	if (elemento.value == '') {
		elemento.value = valor;
	}
}
function limpa_busca(elemento, valor) {
	if (elemento.value = valor) {
		elemento.value = '';
	}
}

function validar_email_login() {
	if (document.frmlogin.n_usuario.value == 'Usuario') {
		alert('Informe seu usuario !!!');
		document.frmlogin.n_usuario.focus();
		return false;
	}

	if (document.frmlogin.n_senha.value == 'Senha') {
		alert('Informe sua Senha !!!');
		document.frmlogin.n_senha.focus();
		return false;
	}
	return true;
}


function validar_email() {
	if (document.frmemail.n_nome.value == 'Informe seu nome') {
		alert('Favor informar o seu nome !!!');
		document.frmemail.n_nome.focus();
		return false;
	}

	if (document.frmemail.n_email.value == 'Informe seu e-mail') {
		alert('Favor informar seu e-mail corretamente !!!');
		document.frmemail.n_email.focus();
		return false;
	}
	return true;
}

function abrevideo() {
	window.open('http://www.blueville.com.br/video.html', 'video','location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,menubar=no,width=400,height=370'); 
}
