// JavaScript Document
function vBuscaNoticias(){
	doc = document.fBuscaNoticias;
	if(doc.busca.value.length<3){
		alert("A palavra deverá conter no mínimo 3 caracteres!");
		doc.busca.focus();
		return false;
	}
	return true;
}
function vBuscaVideos(){
	doc = document.fBuscaVideos;
	if(doc.buscaVideos.value.length<3){
		alert("A palavra deverá conter no mínimo 3 caracteres!");
		doc.buscaVideos.focus();
		return false;
	}
	return true;
}

function damaris(){
	window.location.href="damaris";
}

function formIsValid() {
	// check to make sure a valid username has been entered
	if ( document.login.username.value == "" ) {
		alert('Favor digitar seu apelido!');
		return false;
	}

	return true;
}

// a small poupup window to show who's in the chat at the current time
function showInfo() {
	// the size of the popup window
	var width = 400;
	var height = 300;

	// the x,y position of the popup window
	// NOTE: this formula will auto-center the popup on the screen
	var y = (screen.height - height) / 2;
	var x = (screen.width - width) / 2;

	var url = "info.php";
	var options = "width=" + width + ",height=" + height + ",top=" + y + ",left=" + x + ",resizable";

	// open the info window as a popup, instead of embedded in webpage
	window.open( url, "info", options );
}

function basicLogin() {
	if (formIsValid()) document.login.submit();
}

function popupLogin() {
	// check to make sure a valid username has been entered
	if (!formIsValid()) return;

	var username = document.login.username.value;
	var password = document.login.password.value;
	var lang = document.login.lang.value;

	// the size of the popup window
	var width = 800;
	var height = 600;

	// the x,y position of the popup window
	// NOTE: this formula will auto-center the popup on the screen
	var y = (screen.height - height) / 2;
	var x = (screen.width - width) / 2;

	var url = "chat/flashchat.php?username=" + username + "&password=" + password + "&lang=" + lang;
	var options = "width=" + width + ",height=" + height + ",top=" + y + ",left=" + x + ",resizable";

	// open the chat window as a popup, instead of embedded in webpage
	window.open( url, "chat", options );
}

//	SHOW VIDEOS
function videos(S,W,H){
   document.write('<embed type="application/x-mplayer2" pluginspage="http://www.microsoft.com/windows/windowsmedia/download/" src='+S+' width='+W+' height='+H+' AutoStart="false" filename='+S+' showcontrols="True" showstatusbar="False" showdisplay="True" autorewind="True"></embed>\n');
}
//

function popUp(P,I,W,H,R){
	window.open(P+"?id="+I,"POPUP","toolbar=0,location=0,directories=0,scrollbars="+R+",width="+W+",height="+H+",left=10,top=10");
}
function popUpS(P,W,H,R){
	window.open(P,"POPUP","toolbar=0,location=0,directories=0,scrollbars="+R+",width="+W+",height="+H+",left=10,top=10");
}
function coberturas(I,W,H,R){
	window.open("coberturasview.php?id="+I,"POPUP","toolbar=0,location=0,directories=0,scrollbars="+R+",width="+W+",height="+H+",left=10,top=10");
}

/*
<!-- BE
function blockError(){return true;}
window.onerror = blockError;
//-->

<!-- DS
function disableselect(e){
return false
}
function reEnable(){
return true
}
document.onselectstart=new Function ("return false")

if (window.sidebar){

document.onmousedown=disableselect

document.onclick=reEnable
}
//-->

<!-- BD
if (window.Event) 
document.captureEvents(Event.MOUSEUP); 

function nocontextmenu() 
{ 
event.cancelBubble = true 
event.returnValue = false; 

return false; 
} 

function norightclick(e) 
{ 
if (window.Event) 
{ 
if (e.which == 2 || e.which == 3) 
return false; 
} 
else 
if (event.button == 2 || event.button == 3) 
{ 
event.cancelBubble = true 
event.returnValue = false; 
return false; 
} 

} 
if (document.layers) { 
document.captureEvents(Event.MOUSEDOWN); 
} 
document.oncontextmenu = nocontextmenu; 
document.onmousedown = norightclick; 
document.onmouseup = norightclick; 
//-->
*/

//	RADIO
<!--
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;
    }
}
//
//	SHOW VIDEOS
function videos(S,W,H){
   document.write('<object classid="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95" width='+W+' height='+H+' id="mediaplayer1">\n');
   document.write('<param name="FileName" value='+S+' /><param name="AutoStart" value="false"><param name="ShowControls" value="True" /><param name="ShowStatusBar" value="True" /><param name="ShowDisplay" value="False" /><param name="AutoRewind" value="True" />\n');
   document.write('<embed type="application/x-mplayer2" pluginspage="http://www.microsoft.com/windows/windowsmedia/download/" src='+S+' width='+W+' height='+H+' AutoStart="false" filename='+S+' showcontrols="True" showstatusbar="False" showdisplay="True" autorewind="True"></embed>\n');
   document.write('</object>\n');
}
//

function popUp(P,I,W,H,R){
	window.open(P+"?id="+I,"POPUP","toolbar=0,location=0,directories=0,scrollbars="+R+",width="+W+",height="+H+",left=10,top=10");
}
function popUpS(P,W,H,R){
	window.open(P,"POPUP","toolbar=0,location=0,directories=0,scrollbars="+R+",width="+W+",height="+H+",left=10,top=10");
}
function coberturas(I,W,H,R){
	window.open("coberturasview.php?id="+I,"POPUP","toolbar=0,location=0,directories=0,scrollbars="+R+",width="+W+",height="+H+",left=10,top=10");
}

