var uact="24.Fevereiro.2008"
var ver="6.25"
window.defaultStatus = "Versão "+ ver +" - "+uact;

// Janela pop-up para imagens ---------------
function openNewWindow(w,h,nav,loc,sts,menu,scroll,resize,name,url) {//v1.0 
var windowProperties=''; if(nav==false) windowProperties+='toolbar=no,'; else 
windowProperties+='toolbar=yes,'; if(loc==false) windowProperties+='location=no,'; 
else windowProperties+='location=yes,'; if(sts==false) windowProperties+='status=no,'; 
else windowProperties+='status=yes,'; if(menu==false) windowProperties+='menubar=no,'; 
else windowProperties+='menubar=yes,'; if(scroll==false) windowProperties+='scrollbars=no,'; 
else windowProperties+='scrollbars=yes,'; if(resize==false) windowProperties+='resizable=no,'; 
else windowProperties+='resizable=yes,'; if(w!="") windowProperties+='width='+w+','; 
if(h!="") windowProperties+='height='+h; if(windowProperties!="") { 
if( windowProperties.charAt(windowProperties.length-1)==',') 
windowProperties=windowProperties.substring(0,windowProperties.length-1); } 
window.open(url,name,windowProperties); 
}
// Janela pop-up para imagens ---------------

<!-- Begin
function placeFocus() {
if (document.forms.length > 0) {
var field = document.forms[0];
for (i = 0; i < field.length; i++) {
if ((field.elements[i].type == "text") || (field.elements[i].type == "textarea") || (field.elements[i].type.toString().charAt(0) == "s")) {
document.forms[0].elements[i].focus();
break;
         }
      }
   }
}
//  End -->

<!-- Begin
function ua(){
document.write(uact)
}

// Begin
function vn(field) {
//var valid = "abcdefghijklmnopqrstuvwxyz0123456789"
var valid = "0123456789"
var ok = "yes";
var temp;
for (var i=0; i<field.value.length; i++) {
temp = "" + field.value.substring(i, i+1);
if (valid.indexOf(temp) == "-1") ok = "no";
}
if (ok == "no") {
alert("Entrada inválida! Só são permitidos números positivos e inteiros!");
field.focus();
field.select();
   }
}
//  End

function be(){
window.status=" ";return true;}

function nav(u){ 
window.close();
window.opener.focus(); 
window.opener.location.href = u;
}

function openWin(xx,w,h,scroll){
LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
eval('window.open(xx,"NJ","top='+TopPosition+',left='+LeftPosition+',toolbar=0,location=0,status=0,menubar=0,scrollbars='+scroll+',resizable=0,center=1,width='+w+',height='+h+'")')
}

function modalwin(url,mwidth,mheight){
if (document.all&&window.print) //if ie5
eval('window.showModelessDialog(url,"","scroll:0; edge:sunken; unadorned:0; center:1; status:0; help:0; title:0; resizable:0; dialogWidth:'+mwidth+'px; dialogHeight:'+mheight+'px")')
else
eval('window.open(url,"","width='+mwidth+'px,height='+mheight+'px,resizable=0,status=0,scrollbars=0")')
}

function modalDialog(url,width,height)//moz
    {
    var left = screen.availWidth/2 - width/2;
    var top = screen.availHeight/2 - height/2;
    activeModalWin = window.open(url, "", "width="+width+"px,height="+height+",left="+left+",top="+top);
    window.onfocus = function(){if (activeModalWin.closed == false){activeModalWin.focus();};};
    }

function FileManager()
	{
	if(navigator.appName.indexOf('Microsoft')!=-1)
		window.showModalDialog("fmanager/assetmanager.asp",window,"dialogWidth:620px;dialogHeight:430px;edge:Raised;center:Yes;help:No;resizable:No;");
	else
		modalDialog("fmanager/assetmanager.asp", 620, 430);
	}
	
function right(e) {
var hoje = new Date();
var ano = hoje.getFullYear();
if (navigator.appName == 'Netscape' && 
(e.which == 3 || e.which == 2))
return false;
else if (navigator.appName == 'Microsoft Internet Explorer' && 
(event.button == 2 || event.button == 3 )) {
alert("Gestão de Conteúdos - GESCO "+ ver +"\n\nSINESIS - www.sinesis.pt\nRui Pires. Copyright © 2002-" + ano + ". Todos os direitos reservados.\n");
return false;
}
return true;
}
document.onmousedown=right;
if (document.layers) window.captureEvents(Event.MOUSEDOWN);
window.onmousedown=right;
// End

// ******* Mostrar data actual ********
// ************************************

function display_todays_date()
{

var today = new Date();
var numerical_day=today.getDay();
var numerical_month=today.getMonth();
var date=today.getDate();
var year=today.getFullYear();

if (date <= 9) date = "0" + date;

var weekday_array = new Array('Domingo','Segunda-feira','Terça-feira','Quarta-feira','Quinta-feira','Sexta-feira','S&aacute;bado');
var day_of_the_week = weekday_array[numerical_day];

var month_array = new Array('Janeiro','Fevereiro','Março','Abril','Maio','Junho','Julho','Agosto','Setembro','Outubro','Novembro','Dezembro');
var month_name = month_array[numerical_month];

var date_string = day_of_the_week + ', ' + date + '.' + month_name + '.' +year;
document.write(date_string);

}
// ********** Relógio normal **********
// ************************************
function clock()
{
var digital = new Date();
var hours = digital.getHours();
var minutes = digital.getMinutes();
var seconds = digital.getSeconds();
var amOrPm = "AM";
if (hours <= 9) hours = "0" + hours;
if (minutes <= 9) minutes = "0" + minutes;
if (seconds <= 9) seconds = "0" + seconds;
dispTime = hours + ":" + minutes + ":" + seconds;
pendulo.innerHTML = dispTime;
setTimeout("clock();", 1000);
}
// **** Relógio na barra de estado ****
// ************************************
// **** Relógio na barra de estado ****
// ************************************

var timerID = null;
var timerRunning = false;
function startclock () 
   {
   stopclock();
   time();
   }

function stopclock ()
   {
   if(timerRunning)
      clearTimeout(timerID);
   timerRunning = false;
   }

function time ()
   {
   var now = new Date();
   var yr = now.getYear();
   var mName = now.getMonth() + 1;
   var dName = now.getDay() + 1;
   var dayNr = ((now.getDate()<10) ? "0" : "")+ now.getDate();
   var ampm = (now.getHours() >= 12) ? "PM" : "AM"
   var hours = now.getHours();
         hours = ((hours > 12) ? hours - 12 : hours);
   var minutes = ((now.getMinutes() < 10) ? ":0" : ":") + now.getMinutes();
   var seconds = ((now.getSeconds() < 10) ? ":0" : ":") + now.getSeconds();

   if(dName==1) Day = "Domingo";
   if(dName==2) Day = "Segunda-feira";
   if(dName==3) Day = "Terça-feira";
   if(dName==4) Day = "Quarta-feira";
   if(dName==5) Day = "Quinta-feira";
   if(dName==6) Day = "Sexta-feira";
   if(dName==7) Day = "Sabado";

   if(mName==1) Month="Janeiro";
   if(mName==2) Month="Fevereiro";
   if(mName==3) Month="Março";
   if(mName==4) Month="Abril";
   if(mName==5) Month="Maio";
   if(mName==6) Month="Junho";
   if(mName==7) Month="Julho";
   if(mName==8) Month="Agosto";
   if(mName==9) Month="Setembro";
   if(mName==10) Month="Outubro";
   if(mName==11) Month="Novembro";
   if(mName==12) Month="Dezembro";

   var DayDateTime=(" "
       + Day
       + ", "
       + dayNr
       + "."
       + Month
       + "."
       + ""
       + ""
       + yr
       + " - "
       + hours
       + minutes
       + seconds
       + " "
       + ampm
        );

   window.status=DayDateTime;
   timerID = setTimeout("time()",1000);
   timerRunning = true;
   }

function clearStatus()
   {
   if(timerRunning)
      clearTimeout(timerID);
   timerRunning = false;
   window.status=" ";   
   }

function shl() { //v2.0
// Usar 3 argumentos 1. NS - 2. IE - 3. Estado
  var i, visStr, args, theObj;
  args = shl.arguments;
  for (i=0; i<(args.length-2); i+=3) { //with arg triples (objNS,objIE,visStr)
    visStr   = args[i+2];
    if (navigator.appName == 'Netscape' && document.layers != null) {
      theObj = eval(args[i]);
      if (theObj) theObj.visibility = visStr;
    } else if (document.all != null) { //IE
      if (visStr == 'show') visStr = 'visible'; //convert vals
      if (visStr == 'hide') visStr = 'hidden';
      theObj = eval(args[i+1]);
      if (theObj) theObj.style.visibility = visStr;
  } }
}

var refer=true;
function show(n) { //Mostra e esconde a layer
var Layer=document.all(n);
if (refer) {
  Layer.style.visibility="visible";
  refer=false;
}
else {
  Layer.style.visibility="hidden";
  refer=true;
}
}

function btnHL(ImgName)
{
	source=event.srcElement;
	source.src="imgs/ImgName";
	return;
}

function abrir(a)
{
parent.central.location.href=a;
}
//  End -->