// Buscar
function buscarAcervo(formBusca){
	LayoutAguarde.showDialog();
	YAHOO.util.Connect.setForm(formBusca); 
	var transaction = YAHOO.util.Connect.asyncRequest('POST', 'buscar.php', buscar);
}


function aparecer(codigo){
	idCodigo=codigo;
	Layoutdetalhe.showDialog();
	LayoutAguarde.showDialog();
	YAHOO.util.Connect.setForm(); 
	var transaction = YAHOO.util.Connect.asyncRequest('POST', 'operacoes.php?aparecerAgora=ok&codigoID='+codigo, callbackResultado);
}

function fotoGrandeNow(id){
	idFoto=id;
	LayoutFotoGrande.showDialog();
	YAHOO.util.Connect.setForm(); 
	var transaction = YAHOO.util.Connect.asyncRequest('POST', 'operacoes.php?aparecerAgoraFoto=ok&codigoID='+id, callbackResultado);
}

function mario(){

	LayoutMario.showDialog();
	LayoutAguarde.showDialog();
	YAHOO.util.Connect.setForm(); 
	var transaction = YAHOO.util.Connect.asyncRequest('POST', 'operacoes.php?aparecerAgoraMario=ok', callbackResultado);
	
}
//---------------------------------------------------------------------------

var postData;
	var successResultadoAdmin = function(o){
		if(o.responseText !== undefined){
			
			if (o.responseText=='mostrar_produtos'){
				
			  var sUrl = 'operacoes.php?aparecer=ok&codigoID='+idCodigo;
			  var request = YAHOO.util.Connect.asyncRequest('POST', sUrl, callbacklst);
			 	
			}
			
			if (o.responseText=='mostrar_FotoGrande'){
				
			  var sUrl = 'operacoes.php?fotoGrande=ok&codigoID='+idFoto;
			  var request = YAHOO.util.Connect.asyncRequest('POST', sUrl, callbacklstFotoGrande);
			 	
			}
			
			
			  if (o.responseText=='mario_mario'){
				
			  var sUrl = 'operacoes.php?aparecerAgoraMarioExecutar=ok';
			  var request = YAHOO.util.Connect.asyncRequest('POST', sUrl, marioCallBack);
			 	
			}
			
		}//fechamento if(responseText !==
		
	}// fechamento successResultadoAdmin
	
	

//==========================================================================================
// CALLBACK Atualiza lista  :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
//==========================================================================================


	var handleSuccesslst = function(o){
		if(o.responseText !== undefined){
			div = document.getElementById('desMusicaFont');
				  document.getElementById('desMusicaFont').innerHTML = '';
  				  
			div.innerHTML = o.responseText;
			LayoutAguarde.fechar();
		}
	}
	 
	 var handleFailurelst = function(o){
	  if(o.responseText !== undefined){
		 
	  }
	 }
	 
	 var callbacklst =
	 {
	   success:handleSuccesslst,
	   failure:handleFailurelst,
	   argument:['foo','bar']
	 };


//==========================================================================================
// CALLBACK Mario  :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
//==========================================================================================


	var handleSuccesslst = function(o){
		if(o.responseText !== undefined){
			div = document.getElementById('divMario');
				  document.getElementById('divMario').innerHTML = '';
  				  
			div.innerHTML = o.responseText;
			LayoutAguarde.fechar();
			
		}
	}
	 
	 var handleFailurelst = function(o){
	  if(o.responseText !== undefined){
		 
	  }
	 }
	 
	 var marioCallBack =
	 {
	   success:handleSuccesslst,
	   failure:handleFailurelst,
	   argument:['foo','bar']
	 };

//==========================================================================================
// CALLBACK Foto Grande  :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
//==========================================================================================


	var handleSuccesslst = function(o){
		if(o.responseText !== undefined){
			div = document.getElementById('fotoGrande');
				  document.getElementById('fotoGrande').innerHTML = '';
  				  
			div.innerHTML = o.responseText;
			
		}
	}
	 
	 var handleFailurelst = function(o){
	  if(o.responseText !== undefined){
		 
	  }
	 }
	 
	 var callbacklstFotoGrande =
	 {
	   success:handleSuccesslst,
	   failure:handleFailurelst,
	   argument:['foo','bar']
	 };

//==========================================================================================
// CALLBACK cadastrar conta :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
//==========================================================================================

var failureResultadoAdmin = function(o){
		if(o.responseText !== undefined){
		 
		}
	}

	var callbackResultado = {
		success:successResultadoAdmin,
		failure:failureResultadoAdmin,
		argument:['foo','bar']
	};


//==========================================================================================
// CALLBACK buscar:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
//==========================================================================================


	var handleSuccesslst = function(o){
		if(o.responseText !== undefined){
			div = document.getElementById('centro_d');
				  document.getElementById('centro_d').innerHTML = '';		
			div.innerHTML = o.responseText;
			LayoutAguarde.fechar();
		}
	}
	 
	 var handleFailurelst = function(o){
	  if(o.responseText !== undefined){
		 
	  }
	 }
	 
	 var buscar =
	 {
	   success:handleSuccesslst,
	   failure:handleFailurelst,
	   argument:['foo','bar']
	 };
	 

//==========================================================================================
// CALLBACK buscar a letra antes::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
//==========================================================================================

	function lookup(inputString) {
		if(inputString.length == 0) {
			// Hide the suggestion box.
			$('#suggestions').hide();
		} else {
			$.post("letras.php", {queryString: ""+inputString+""}, function(data){
				if(data.length >0) {
					$('#suggestions').show();
					$('#autoSuggestionsList').html(data);
				}
			});
		}
	} // lookup
	
	function fill(thisValue) {
		$('#inputString').val(thisValue);
		setTimeout("$('#suggestions').hide();", 200);
	}
	
	
//==========================================================================================
// Janela mostrando mensagem de aguarde :::::::::::::::::::::::::::::::::::::::::::::::::::::
//==========================================================================================
var LayoutAguarde = function(){
    var dialog, showBtn;
    return {
        init : function(){

        },
        showDialog : function(){
            if(!dialog){ 
				dialog = new Ext.BasicDialog("aguardeDIV-dlg", { 
					modal:true,
					autoTabs:false, 
					width:170, 
					height:100, 
					shadow:false, 
					minWidth:175, 
					minHeight:100, 
					proxyDrag: true
				});
                //dialog.addKeyListener(27, dialog.hide, dialog);
            }
            dialog.show();
        },
		fechar : function () {
			dialog.hide();
		}		
    };
}();
Ext.onReady(LayoutAguarde.init, LayoutAguarde, true);


//==========================================================================================
// Janela mostrando mensagem de aguarde :::::::::::::::::::::::::::::::::::::::::::::::::::::
//==========================================================================================
var Layoutdetalhe = function(){
    var dialog, showBtn;
    return {
        init : function(){

        },
        showDialog : function(){
            if(!dialog){ 
				dialog = new Ext.BasicDialog("detalhe-dlg", { 
					modal:true,
					autoTabs:false, 
					width:800, 
					height:650, 
					shadow:false, 
					minWidth:800, 
					minHeight:650, 
					proxyDrag: true
				});
                //dialog.addKeyListener(27, dialog.hide, dialog);
            }
            dialog.show();
        },
		fechar : function () {
			dialog.hide();
		}		
    };
}();
Ext.onReady(Layoutdetalhe.init, Layoutdetalhe, true);


//==========================================================================================
// FotoGrande :::::::::::::::::::::::::::::::::::::::::::::::::::::
//==========================================================================================
var LayoutFotoGrande = function(){
    var dialog, showBtn;
    return {
        init : function(){

        },
        showDialog : function(){
            if(!dialog){ 
				dialog = new Ext.BasicDialog("fotoGrande-dlg", { 
					modal:true,
					autoTabs:false, 
					width:325, 
					height:315, 
					shadow:false, 
					minWidth:325, 
					minHeight:315, 
					proxyDrag: true
				});
                //dialog.addKeyListener(27, dialog.hide, dialog);
            }
            dialog.show();
        },
		fechar : function () {
			dialog.hide();
		}		
    };
}();
Ext.onReady(LayoutFotoGrande.init, LayoutFotoGrande, true);


//==========================================================================================
// Mario :::::::::::::::::::::::::::::::::::::::::::::::::::::
//==========================================================================================
var LayoutMario = function(){
    var dialog, showBtn;
    return {
        init : function(){

        },
        showDialog : function(){
            if(!dialog){ 
				dialog = new Ext.BasicDialog("mario-dlg", { 
					modal:true,
					autoTabs:false, 
					width:800, 
					height:650, 
					shadow:false, 
					minWidth:800, 
					minHeight:650, 
					proxyDrag: true
				});
                //dialog.addKeyListener(27, dialog.hide, dialog);
            }
            dialog.show();
        },
		fechar : function () {
			dialog.hide();
		}		
    };
}();
Ext.onReady(LayoutMario.init, LayoutMario, true);