/* LOADER AJAX: */
function loader(id)
{
document.getElementById(id).innerHTML = '<div style="padding:15px 0;"><img src="http://www.uema.com.br/imagens/carregando.gif" width="16" height="16" hspace="5" style="float:left" /><font size="2" face="Arial"><b>Carregando...</b></font></div>';
}

/* POP-UP: */
function popup(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,width=500,height=300');");
}

/* POP-UP LIVROS (POUCO MAIS ALTA): */
function popup_livro(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,width=500,height=450');");
}

/* POP-UP GOTAS: */
function popup_gotas(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=350,height=115');");
}

/* FORMATA CAMPOS: */
function Formata_Campo(e,src,mask) {
    if(window.event) { _TXT = e.keyCode; }
    else if(e.which) { _TXT = e.which; }
    if(_TXT > 47 && _TXT < 58) {
 var i = src.value.length; var saida = mask.substring(0,1); var texto = mask.substring(i)
 if (texto.substring(0,1) != saida) { src.value += texto.substring(0,1); }
    return true; } else { if (_TXT != 8) { return false; }
 else { return true; }
    }
}

/* FUNCOES GOTAS DE LUZ: */
function RegisterEventObservers() 
{ 
    var plugin = document.WMPlay;
    document.appObs.setByProxyDSNewStreamObserver(plugin, true); 
    troca();
    numero = numero - 1;
}
function OnDSNewStreamEvt(oldstate, newstate)
{
    setTimeout('troca();',1000);
}         
function PlayClick()
{
    document.WMPlay.Play();
}
function StopClick()
{
    numero = 1;
    document.WMPlay.Stop();
    if (navigator.appName.indexOf('Netscape') != -1) {
        document.WMPlay.SetCurrentPosition(0);
    } else {
        document.WMPlay.CurrentPosition = 0;
    }
}
function PauseClick()
{
    if (navigator.appName.indexOf('Netscape') != -1) {
        estado=document.WMPlay.GetPlayState();
    } else {
        estado=document.WMPlay.PlayState;
    }

    if (estado==1) {
        document.WMPlay.Play();
    } else if (estado==2) {
        document.WMPlay.Pause();
    }
}
function FowardClick()
{
    document.WMPlay.Next();
}
function BackClick()
{
    numero = numero - 2;
    document.WMPlay.Previous();
}
function UpVolumeClick()
{
    if (document.WMPlay.Volume <= -300) {
        document.WMPlay.Volume = document.WMPlay.Volume + 300;
    }
}
function DownVolumeClick()
{
    if (document.WMPlay.Volume >= -8000) {
        document.WMPlay.Volume = document.WMPlay.Volume - 300;
    }
}