function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
function ReverseContentDisplay(d) {
	if(document.getElementById(d).style.display == "none") {
		document.getElementById(d).style.display = "";
	} else {
		document.getElementById(d).style.display = "none";
	}
}
function HideContent(d) {
document.getElementById(d).style.display = "none";
}
function ShowContent(d) {
document.getElementById(d).style.display = "";
}
function abreFotografia(clube,album,ficheiro) {
	janela=window.open('/'+clube+'/album/'+album+'/'+ficheiro,'fotografia','width=640,height=480,scrollbars=yes,resizable=yes');
	largura=screen.availWidth;
	altura=screen.availHeight;
	janela.moveTo(largura/2-320,altura/2-240);
	janela.focus()
}
function abreImagem(caminho) {
	janela=window.open('/clube/includes/imagem.asp?src='+caminho,'imagem','width=640,height=480,scrollbars=yes,resizable=yes');
	largura=screen.availWidth;
	altura=screen.availHeight;
	janela.moveTo(largura/2-320,altura/2-240);
	janela.focus()
}
function abreAjuda(id) {
	janela=window.open('/clube/registo/ajuda.asp?id='+id,'ajuda','width=400,height=400');
	largura=screen.availWidth;
	altura=screen.availHeight;
	janela.moveTo(largura/2-200,altura/2-200);
	janela.focus()
}
function abreContacto(id) {
	janela=window.open('/clube/includes/contactar.asp?id='+id,'contacto','width=400,height=400');
	largura=screen.availWidth;
	altura=screen.availHeight;
	janela.moveTo(largura/2-200,altura/2-200);
	janela.focus()
}
function eliminarRegisto() {
	if (confirm("Tem a certeza que deseja eliminar o registo?")) {
		return true
	} else {
		return false
	}
}
function eliminarJogos() {
	if (confirm("Tem a certeza que deseja eliminar os jogos/resultados/calendário existentes?")) {
		return true
	} else {
		return false
	}
}
function resetSite() {
	if (confirm("Tem a certeza que deseja efectuar um RESET ao seu site?")) {
		return true
	} else {
		return false
	}
}


/* Scroll de noticias */
var toScroll=new Array()
var ie=document.all
var dom=document.getElementById
var firstNews_obj;
var secondNews_obj;

function newsScroll(name){
  var c=this; c.name=name; c.mc=0; c.i=2;
  return this;
}

newsScroll.prototype.addItem = function(data,clube,titulo,url){
	var c = this;
	toScroll[c.mc]=data+"<br><b>"+clube+"</b><br><a href='"+url+"'>"+titulo+"</a>";
	c.mc++;
}

newsScroll.prototype.construct = function(){
  var c = this; theWidth = c.scrollerwidth; theHeight=c.scrollerheight; thebgColor = c.scrollerbgcolor; theBackground =c.scrollerbackground; theDelay=c.scrollerdelay;
  scroll_obj=eval(c.name);        
  if (ie||dom){
    document.writeln('<div id="main2" style="position:relative;width:'+theWidth+';height:'+theHeight+';overflow:hidden;background-color:'+thebgColor+' ;background-image:url('+theBackground+')">')
    document.writeln('<div style="position:absolute;width:'+theWidth+';height:'+theHeight+';clip:rect(0 '+theWidth+' '+theHeight+' 0);left:0;top:0">')
    document.writeln('<div id="firstNews" style="position:absolute;width:'+theWidth+';left:0;top:1">')
    document.write(toScroll[0])
    document.writeln('</div>')
    document.writeln('<div id="secondNews" style="position:absolute;width:'+theWidth+';left:0;top:0;visibility:hidden">')
    document.write(toScroll[dyndetermine=(toScroll.length==1)? 0 : 1])
    document.writeln('</div>')
    document.writeln('</div>')
    document.writeln('</div>')
  }
}

newsScroll.prototype.move = function(whichdiv){
  var c = this; theDelay = c.scrollerdelay; theHeight = c.scrollerheight; 
  scroll_obj=eval(c.name);
  tdiv=eval(whichdiv)

  if (parseInt(tdiv.style.top)>0&&parseInt(tdiv.style.top)<=5){
    tdiv.style.top=0+"px"
    setTimeout("scroll_obj.move(tdiv)",theDelay)
    setTimeout("scroll_obj.move2(secondNews_obj)",theDelay)
    //document.write('Got Milk?')
  return
  }
  if (parseInt(tdiv.style.top)>=tdiv.offsetHeight*-1){
    tdiv.style.top=parseInt(tdiv.style.top)-5+"px"
    setTimeout("scroll_obj.move(tdiv)",50)
  }
  else {
    tdiv.style.top=parseInt(theHeight)+"px"
    tdiv.innerHTML=toScroll[c.i]
    if (c.i==toScroll.length-1)
      c.i=0
    else
      c.i++
  }
}

newsScroll.prototype.move2 = function(whichdiv){
  var c = this; theDelay = c.scrollerdelay; theHeight= c.scrollerheight;
  scroll_obj=eval(c.name);
  tdiv2=eval(whichdiv)

  if (parseInt(tdiv2.style.top)>0&&parseInt(tdiv2.style.top)<=5){
    tdiv2.style.top=0+"px"
    setTimeout("scroll_obj.move2(tdiv2)",theDelay)
    setTimeout("scroll_obj.move(firstNews_obj)",theDelay)
    return
  }
  if (parseInt(tdiv2.style.top)>=tdiv2.offsetHeight*-1){
    tdiv2.style.top=parseInt(tdiv2.style.top)-5+"px"
    setTimeout("scroll_obj.move2(secondNews_obj)",50)
  }
  else {
    tdiv2.style.top=parseInt(theHeight)+"px"
    tdiv2.innerHTML=toScroll[c.i]
    if (c.i==toScroll.length-1)
      c.i=0
    else
      c.i++
  }
}

newsScroll.prototype.startScroll = function(){
  var c = this;
  scroll_obj=eval(c.name);        
  
  if (toScroll.length >2)
    c.i = 2;
  else
    c.i = 0;
  
  firstNews_obj=ie? firstNews : document.getElementById("firstNews")
  secondNews_obj=ie? secondNews : document.getElementById("secondNews")
  setTimeout("scroll_obj.move(firstNews_obj)",c.scrollerDelay);
  secondNews_obj.style.top=theHeight;
  secondNews_obj.style.visibility='visible'
}

/*Fim de scroll de noticias*/


