function LimparForm(){}

var strLoadHTML = '<table width="106" height="34" border="0" align="center" cellpadding="0" cellspacing="0"  id="load" style="float:left">' +
                    '<tr>' +
                      '<td width="19" height="34" align="center" valign="middle"><img src="imagens/load.gif" width="16" height="16" alt="Carregando cidades" /></td>' +
                      '<td width="87" align="center" valign="middle" style="font-size:10px;">CARREGANDO...</td>' +
                    '</tr>' +
                  '</table>';
									 
$(document).ready(function(){
	
	$("input[name*='mail']").css('textTransform','lowercase');
					
	$("#btn_cadastro, #btn_contato").hover(
		function(){
			$(this).css({background: "url(imagens/botao_cadastrar.jpg) right no-repeat"});
		},
		function(){
		 $(this).css({background: "url(imagens/botao_cadastrar.jpg) left no-repeat"});
		});
	
	$("#btn_login").hover(
		function(){
			$(this).css({background: "url(imagens/botao_logar.jpg) right no-repeat"});
		},
		function(){
		 $(this).css({background: "url(imagens/botao_logar.jpg) left no-repeat"});
		});
		
		$(".menu tr td").not('.nenhum').hover(
		function(){
			$(this).css({background:'#F8F8F8'});
		},
		function(){
		 $(this).css({background:'#fff'});
		});	
		
		$(".conteudo_admin_center table tr td img").not('.nenhum').css({opacity: 0.5});
		
		$(".conteudo_admin_center table tr td img").not('.nenhum').hover(
		function(){
			$(this).css({background:'#fff', border:'2px solid #E2E2E2', padding:'5px', opacity: 1});
		},
		function(){
		 $(this).css({background:'#fff', border:'0px', padding:'0px', opacity: 0.5});
		});	
		
		$("input:text, textarea").bind('focus', function(){
				 if( $(this).val() == 'Digite sua confirmação de e-mail' || 
						 $(this).val() == 'Digite uma URL' || 
						 $(this).val() == 'Digite um apelido para a URL' || 
						 $(this).val() == 'Digite sua mensagem' || 
						 $(this).val() == 'Digite seu nome' || 
						 $(this).val() == 'Digite um nome' || 
						 $(this).val() == 'Digite seu e-mail' || 
						 $(this).val() == 'Digite sua Emp. ou Inst. de Ensino' || 
						 $(this).val() == 'Digite um apelido' || 
						 $(this).val() == 'Digite seu assunto')
				 
				 	$(this).val('');
		});
	
		$("input:text, textarea").bind('blur', function(){
			 
			 if($(this).attr('id') == 'emp_ensi' && $(this).val() == '' )
				$(this).val('Digite sua Emp. ou Inst. de Ensino');
				
			 if($(this).attr('id') == 'apelido' && $(this).val() == '' )
				$(this).val('Digite um apelido');
				
			 if($(this).attr('id') == 'conf_email' && $(this).val() == '' )
				$(this).val('Digite sua confirmação de e-mail');
				
			 if($(this).attr('id') == 'apelido_url' && $(this).val() == '' )
				$(this).val('Digite um apelido para a URL');
			
			if($(this).attr('id') == 'url' && $(this).val() == '' )
				$(this).val('Digite uma URL');
				
			 if(( $(this).attr('id') == 'email' || $(this).attr('id') == 'email_1') && $(this).val() == '' )
				$(this).val('Digite seu e-mail');
			 
			 if($(this).attr('id') == 'senha' && $(this).val() == '' )
				$(this).val('Digite sua senha');
				
			 if($(this).attr('id') == 'assunto' && $(this).val() == '' )
				$(this).val('Digite seu assunto');	

			 if($(this).attr('id') == 'nome' && $(this).val() == '' )
				$(this).val('Digite seu nome');	
				
				if($(this).attr('id') == 'nome_sf' && $(this).val() == '' )
				$(this).val('Digite um nome');	
			
			 if($(this).attr('id') == 'mensagem' && $(this).val() == '' )
				$(this).val('Digite sua mensagem');
	
		});
		
		$("input, select, textarea").bind('click keypress', function(){
			if ( $('#mensagem_alerta').css('display') != 'none' )
			EsconderAlerta();
		});

})

function MostrarAlerta(strMensagem,strClass)
{
  $('#mensagem_alerta').hide().text(strMensagem).addClass('mensagem_alerta').addClass(strClass).show();
};

function EsconderAlerta()
{
	$('#mensagem_alerta').hide().attr('class','').addClass('mensagem_alerta');	
};

function GetCidade()
{
	var parametros = 'opcao=get_cidade&uf='+$('#uf').val();
	$.ajax
	({
	type: 'POST',
	url: 'scripts/processa.php',
	data: parametros,
	beforeSend: function()
	{
		$('#recipiente_cidades').empty();
		$('#recipiente_cidades').append(strLoadHTML).show('slow');
	},
	success: function(resposta){
		$('body').append(resposta);
	}
	})
}


function Sair(strOpcao)
{
	if (strOpcao == 'sair')
	var parametros = 'opcao=' + strOpcao;
	$.ajax
	({
	type: 'POST',
	url: 'scripts/processa.php',
	data: parametros,
	success: function(resposta){
		$('body').append(resposta);
	}
	})
}

function CadDwonload(intCodDownload,intCodUsuario,strArquivo)
{
	var parametros = 'opcao=cad_download&cod_down=' + intCodDownload + '&cod_usuario=' + intCodUsuario + '&arquivo=' +strArquivo ;
	$.ajax
	({
	type: 'POST',
	url: 'scripts/processa.php',
	data: parametros,
	success: function(resposta){
		$('body').append(resposta);
	}
	})
}

function DownloadRelatorio(strOpcao, strArquivo)
{
	var parametros = 'opcao=' + strOpcao + '&arquivo=' + strArquivo;
	$.ajax
	({
	type: 'POST',
	url: '../scripts/processa.php',
	data: parametros,
	success: function(resposta){
		$('body').append(resposta);
	}
	})
}

function SalvarOrdem(strOpcao)
{
	var itens = $('.ordenar').get();	
	var querystring = '';
	
	$.each(itens,function(){
		querystring += 'cod[]=' + this.id +  '&ordem[]=' + this.value + '&';
	});
	
	var parametros = 'opcao=' + strOpcao + '&opcao_frm=ordenar&' + querystring;
	
	$.ajax
	({
	type: 'POST',
	url: '../scripts/processa.php',
	data: parametros,
	success: function(resposta){
	$('body').append(resposta);
	}
	})
}


