/**
 * @author Josemar Davi Luedke
 */
function noNumbers(e, bloq) {
	var tecla=new Number();
	var e = e || event;
	var k = e.keyCode || e.which;
	if (!k > 47 && k < 58) {
		window.event.keyCode = 0;
	}
	
	if (k == 13) {	}
	else {
		if (window.event) {
			tecla = e.keyCode;
		}
		else 
			if (e.which) {
				tecla = e.which;
			}
			else {
				return true;
			}
		if (((tecla < 48) || (tecla > 57)) && (tecla != 8)) {
			return false;
		}
	}

}
function ValUser(){
		if (document.getElementById('login').value.length <  3){
			$('#loading-area').css("width","280px");
			$('#loading-area').css("margin-left","-130px");
			$('#message-area-inner').html('Digite um usu&aacute;rio valido, m&iacute;nimo 3 caracteres.');
	        $('#loading-area').show();
			document.getElementById('msgLogin').className = 'msgError';
			document.getElementById('login').focus();
			setTimeout(hideError, 4000);
			return false;
		}
		else {
			$('#loading-area').hide();
			document.getElementById('msgLogin').className = 'msgYes';
			return true;
		}
}
function ValPass(){
		if (document.getElementById('senha').value.length < 2){
			$('#loading-area').css("width","280px");
			$('#loading-area').css("margin-left","-130px");
			$('#message-area-inner').html('Digite uma senha valida, m&iacute;nimo 2 caracteres.');
	        $('#loading-area').show();
			document.getElementById('msgSenha').className = 'msgError';
			document.getElementById('senha').focus();
			setTimeout(hideError, 4000);
			return false;
		}
		else {
			$('#loading-area').hide();
			document.getElementById('msgSenha').className = 'msgYes';
			return true;
		}
}
function ValInst() {
		if (document.getElementById('inst').value.length < 4){
			$('#loading-area').css("width","300px");
			$('#loading-area').css("margin-left","-150px");
			$('#message-area-inner').html('Digite uma institui&ccedil;&atilde;o valida, m&iacute;nimo 4 caracteres.');
	        $('#loading-area').show();
			document.getElementById('msgInst').className = 'msgError';			
			document.getElementById('inst').focus();
			setTimeout(hideError, 4000);
			return false;
		}
		else {
			$('#loading-area').hide();
			document.getElementById('msgInst').className = 'msgYes';
			return true;
		}
}

function ValFormLogin() {
		if (ValUser() == false) {
			$('#loading-area').css("width","280px");
			$('#loading-area').css("margin-left","-130px");
			$('#message-area-inner').html('Digite um usu&aacute;rio valido, m&iacute;nimo 3 caracteres.');
	        $('#loading-area').show();
			document.getElementById('msgLogin').className = 'msgError';
			document.getElementById('login').focus();
			setTimeout(hideError, 4000);
			return false;
		}	
		else if(ValPass() == false) {
			$('#loading-area').css("width","280px");
			$('#loading-area').css("margin-left","-130px");
			$('#message-area-inner').html('Digite uma senha valida, m&iacute;nimo 2 caracteres.');
	        $('#loading-area').show();
			document.getElementById('msgSenha').className = 'msgError';
			document.getElementById('senha').focus();
			setTimeout(hideError, 4000);
			return false;
		} else if (document.getElementById('inst').value.length < 4){
			$('#loading-area').css("width","300px");
			$('#loading-area').css("margin-left","-150px");
			$('#message-area-inner').html('Digite uma institui&ccedil;&atilde;o valida, m&iacute;nimo 4 caracteres.');
	        $('#loading-area').show();
			document.getElementById('msgInst').className = 'msgError';			
			document.getElementById('inst').focus();
			setTimeout(hideError, 4000);
			return false;
		} else {
			return 'OK';
		}	
}
function loading(){
	$('#loading-area').css("width","100px");
	$('#loading-area').css("margin-left","-40px");
	$('#message-area-inner').html('<img src="imagens/bg/load.gif" width="15" align="texttop" /> Carregando...');
    $('#loading-area').show();
}
function errorPagNotfound(){
	$('#loading-area').css("width","230px");
	$('#loading-area').css("margin-left","-100px");
    $('#message-area-inner').html('A p&aacute;gina solicitada n&atilde;o foi encontrada!');
	$('#loading-area').show();
}
function error(){
	$('#loading-area').css("width","230px");
	$('#loading-area').css("margin-left","-100px");
    $('#message-area-inner').html('N&atilde;o foi possivel efetuar sua a&ccedil;&atilde;o!');
	$('#loading-area').show();	
}

function hideError(){
	$('#loading-area').hide();
}

function FlashBanner(swf, width, height)
{
	if (navigator.appName.indexOf("Microsoft") != -1)
	{
		document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=version=8,0,0,0" width="'+width+'" height="'+height+'"><param name="movie" value="'+swf+'"/><param name="quality" value="best"/><param name="bgcolor" value="#FFFFFF"/><param name="menu" value="false"/><param name="salign" value="LT"/><param name="wmode" value="opaque"/><param name="allowScriptAccess" value="sameDomain"/></object>');
	}
	else
	{
		document.write('<embed src="'+swf+'" quality="best" bgcolor="#FFFFFF" width="'+width+'" height="'+height+'" menu="false" salign="LT" wmode="opaque" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"></embed>');
	}
}

function openWindow(largura, altura, link) {
	janela_largura_x = largura ;
	janela_altura_y = altura;
	posx = (window.screen.width/2)-(janela_largura_x/2);
	posy = (window.screen.height/2)-(janela_altura_y/2);	
	window.open(link,'','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,left='+posx+',top='+posy+',width='+janela_largura_x+',height='+janela_altura_y);
}

function mouseOver(id, bg, colorBg, bd, colorBd){
	if (bg){
		id.style.backgroundColor=colorBg;	
	}
	if (bd){
		id.style.borderColor=colorBd;	
	}
}
function mouseOut(id, bg, colorBg, bd, colorBd){
		id.style.backgroundColor=colorBg;
}

function validaSugestao(){
		if ($('#nome').val() == ''){
            alert("Você deve preencher seu nome!");
            $('#nome').focus();
            return false;
        }
        if ($('#email').val() == ''){
            alert("Você deve preencher seu email!");
            $('#email').focus();
            return false;
        }
        if ($('#telefone').val() == ''){
            alert("Você deve preencher o telefone!");
            $('#telefone').focus();
            return false;
        }
        if ($('#sugestao').val() == ''){
            alert("Você deve preencher a sugestão!");
            $('#sugestao').focus();
            return false;
        }
    }