//Caso sucesso -------------------------------------------------------------------------------------------------------
function caseSucess(msg,tmp){	

    if (typeof(TmpOut) != 'undefined') {
          clearTimeout(TmpOut);
      }

	$("#carregando").css('display','block');
	$("#carregando").addClass('sucess');
	$("#carregando").html(msg);	
	
	TmpOut = window.setTimeout(function(){
		caseReset();
	},tmp);
	
}











//Caso erro de dados-------------------------------------------------------------------------------------------------------
function caseError(msg,tmp){
	

	   if (typeof(TmpOut) != 'undefined') {
          clearTimeout(TmpOut);
      }
	  
	$("#carregando").css('display','block');  
	$("#carregando").addClass('error');
	$("#carregando").html(msg);	
	
		
	TmpOut =  window.setTimeout(function(){
		caseReset();
	},tmp);
	
}






//Caso erro no sistema -------------------------------------------------------------------------------------------------------
function caseErrorStop(msg,tmp,error){

	 if (typeof(TmpOut) != 'undefined') {
          clearTimeout(TmpOut);
      }
	
	$("#carregando").addClass('error');
	$("#carregando").html(msg);		
		
	TmpOut =  window.setTimeout(function(){
		caseReset();
	},tmp);
	
}








//Caso loading-------------------------------------------------------------------------------------------------------
function caseLoading(msg){

	 if (typeof(TmpOut) != 'undefined') {
          clearTimeout(TmpOut);
      }
	
	caseReset();		  
	  
	$("#carregando").css('display','block');
	$("#carregando").html(msg);	
	
		
	TmpOut =  window.setTimeout(function(){
		$("#carregando").html("Ainda carregando...");	
		
	},9000);
	
	
}





//RESET-------------------------------------------------------------------------------------------------------
function caseReset(){		
		$("#carregando").html("Carregando...");	
		$("#carregando").css('display','none');
		$("#carregando").removeClass('error');
			$("#carregando").removeClass('sucess');
		
			 if (typeof(TmpOut) != 'undefined') {
        		  clearTimeout(TmpOut);
    	  }
	  
	  
}











function face_open(caminho)
{

  	var docHeight = document.height;
	var aleat = new Date().getTime();
	$("#facebox").css('display','block');
	$("#msg_facebox").css('display','block');
	$("#facebox").css('height',docHeight);
	caseLoading("Carregando");	
		

	$("#msg_facebox").load(caminho+"&uid="+aleat,function()
		{
			caseReset(); 
			
		});
	
	return false;
}






/*------------*/
function face_Close(acao)
{	

		$("#facebox").css('display','none');
		$("#msg_facebox").css('display','none');
		$("#msg_facebox").empty();								   
									   
		switch(acao)
		{			
				
				
				
				
				
		}//fim switch
 return false;
}




