﻿/* http://compressor.ebiene.de/ */

//  Quando o componente é renderizado estando dentro de uma MasterPage, seu ID é
//substituído por ctl00$cphMaster$ + ID do componente. Por isso foi criado essa função.
function resolverIdComp(id) {
  return "ctl00_cphConteudo_" + id;
}

function pegarComp(id) {
  return document.getElementById(resolverIdComp(id));
}

function pegarCompParent(id) {
  return window.opener.document.getElementById(resolverIdComp(id));
}

function FazerPostBack(eventtarget,eventargument) {
  __doPostBack(eventtarget, eventargument);
}

//  Faz uma chamada ao ajax especificando o panel, para no caso de ter um
//panel dentro do outro ou ter vários panels
function FazerPostBackAjax(idpanelajax,eventtarget,eventargument) {
  __doPostBack(idpanelajax,eventtarget + "$" +  eventargument);
}

function Paginar(NomeComp,NomePanelAjax,Pagina) {
  FazerPostBackAjax(resolverIdComp(NomePanelAjax),'paginacao',NomeComp + "-" + Pagina);
}

function AbrirPopUp(Titulo,Link,largura,altura) {
    return window.open(Link,Titulo,'status=no,scrollbars=yes,width=' + largura + ',height=' + altura,'');
}

function MostrarProgresso() {
  var comp = document.getElementById("carregando");
  comp.style.display = "block";
  /*if (navigator.appName == "Netscape") {
    comp.style.top = window.pageYOffset;
    comp.style.left = 0;
  }
  else {
    comp.style.top = document.body.scrollTop;
    comp.style.left = 0;
  } */
}

function EsconderProgresso() {
  var comp = document.getElementById("carregando");
  comp.style.display = "none";
}

/**
 * Adiciona método trim() à classe String.
 * Elimina brancos no início e fim da String.
 */
String.prototype.trim = function()
{
	return this.replace(/^\s*/, "").replace(/\s*$/, "");
} //String.trim

function AbrirPopUpRadio() {
    AbrirPopUp('Popup_Radio','player.aspx?Modo=0', '338', '385');
}

function AbrirPopUpPlayList() {
    return AbrirPopUp('Popup_Radio','player.aspx?Modo=1', '338', '385');
}

/*function posiciona_caregando() {
  var comp = $('carregando');
  if (comp != null) {
    comp.style.left = (document.body.clientWidth - 120) / 2;
    comp.style.top = (document.body.clientWidth - 120) / 2;
  }
}*/
