//Criado por Marcelo Costa 
//12-06-09
$(function(){
	$("#btbuscok").click(function(){
			//verificando se foi digitado algo
			   $("#rspbuscar")
			   .empty()
			   .html("Aguarde reunindo informa&ccedil;&otilde;es...")
			   .css({"width":"200px", "height":"10px", "background-color":"yellow", "color":"blue","z-index":"999","padding":"10px","margin":"5px"})
			   .show("fast");
			
			
			var scod = $("#txtcod").val();
			var ssen = $("#txtsenha").val();
			if (scod == "" || ssen == "") {
			   $("#rspbuscar")
			   .empty()
			   .html("POR FAVOR, INFORME O C&Oacute;DIGO/SENHA CORRETAMENTE")
			   .css({"width":"200px", "background-color":"red", "color":"white","z-index":"999","padding":"10px","margin":"5px"})
			   .show("fast")
			   .slideUp(7000);	
			 	return;
			}
            $.post('php/creexiste.php', {ttcod: scod, ttsen: ssen},
	            function(data){
	     			if (data.tipo == 'ERRO'){
					   $("#rspbuscar")
					   .empty()
					   .html(data.message)
					   .css({"width":"200px", "background-color":"red", "color":"white","z-index":"100","padding":"10px","margin":"5px"})
					   .show("fast")
					   .slideUp(9000);	
						return;
		 			} else {
                        //var ifr = "";
						$("#rspbuscar").hide();
						open('php/fmdadoscre.php?ttcod='+scod+'&ttsen='+ssen, 'dados');
						/*
					   $("#dvcontent").attr('src', 'php/fmdadoscre.php?ttcod='+scod+'&ttsen='+ssen)
					   .animate({height: 'show', width: 'show', opacity: 'show'}, 'slow')
					   //.css({"z-index":"9999999999999999"})
					   .show();
					   */
			    	}		
              }, "json");
								 
								 })//botok	   
		   
		   
		   });//jq