/*********************************************************
      Versao: 2007.1
     Projeto: Solucionator
  Criado por: alex.sevilla@gmail.com
Data criacao: 10/06/2007
Alterado por: 
   Descricao: basicos do javascript
     Métodos: 
*********************************************************
                 http://www.solucionator.com
*********************************************************/
// basico
var Basico = Class.create();
Basico.prototype = {
  initialize: function() {
  },
  setContent: function(oID, sUrl, pars){
    //var pars = '';
    var content = new Ajax.Updater(
		{success: oID},
		sUrl,
		{method: 'get',
		 parameters: pars,
		 onFailure: function(oReq){
		   Basico.reportError(oReq);
		 }});
  },
  reportError: function(oReq){
    alert("Não deu!");
  },
  goURL: function(url){
    window.location = url;
  }
}
/*                              
  class lookUp
  Serve de base para buscas no banco


*/
var lookUp = Class.create();
lookUp.prototype = {
  initialize: function(sID, sUrl, sFile) {
    this.sID = sID;
	this.sUrl = sUrl;
	this.sFile = sFile;
  },
  look: function(filtro){
    var content = new Ajax.Updater(
		{success: this.sID},
		this.sUrl + this.sFile,
		{method: 'post',
		 parameters: this.setPost(filtro),
		 onFailure: function(oReq){
		   Basico.reportError(oReq);
		 }});
	this.toogle(true);
  },
  setPost: function(filtro){
    var toPost = '';
    toPost += 'sFiltro=' + filtro;
    return toPost;
  },
  toogle: function(state){
    if(state === false){
      $(this.sID).style.display = 'none';
	} else {
	  $(this.sID).style.display = 'block';
	}
  },
  reportError: function(oReq){
    alert("Não deu!");
  }
}

var o = new Basico;
var popAoVivo = 0;
function toggleLinksAoVivo(bBool){
	var sBool = document.getElementById('escutar').style.display;
	if(sBool == 'block' || bBool == false){
	  document.getElementById('escutar').style.display = 'none';
	} else {
	  document.getElementById('escutar').style.display = 'block';
	}
}
function abreAoVivo(emissora){
  var URLStr = 'aoVivo_' + emissora + '.php';
	var left = 250;
	var top = 250;
	var width = 400;
	var height = 295;
  if(popAoVivo){
    if(!popAoVivo.closed) popAoVivo.close();
  }
  popAoVivo = open(URLStr, 'popAoVivo', 'status=no, width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+'');
}
