<!--//


    function initEditor() 
{

       var config = new HTMLArea.Config();

       config.toolbar = [
       [ "bold", "italic", "underline", "strikethrough", "separator",
         "subscript", "superscript", "separator",
         "copy", "cut", "paste", "clean", "separator", "undo", "redo" ],
       [ "justifyleft", "justifycenter", "justifyright", "justifyfull", "separator",
         "lefttoright", "righttoleft", "separator", 
         "insertorderedlist", "insertunorderedlist", "outdent", "indent", "separator",
         "forecolor", "hilitecolor", "textindicator", "separator",
         "inserthorizontalrule", "createanchor", "createlink", "unlink", "nolink", "separator", 
         "insertimage", "inserttable", "insertchar", "search_replace", "separator", 
         "htmlmode"]
       ];
       config.pageStyle =
         'body { background-color:white; color:black; font-family:verdana,sans-serif; font-size:10; } ' +
         'p { font-width:bold; } ';

       HTMLArea.replace('resumo', config);
 
       return false;
}


       function TestarLink()
{ 
       var str=document.form2.url1.value

       if (str.length > 0) {
          menuWindow = window.open(document.form2.url1.value)
       }
}

       function TestarImagem()
{
       var str=document.form2.imagem1.value
       if (str.length > 0) {
          document.form2.grafico1.src=str;
       }
}


       function Validacao()
{

       if (document.form2.destaque1.value.length <= 0) {
          alert('Insira o título da notícia.');
          return false;
       }
       if (document.form2.titulo1.value.length <= 0) {
          alert('Insira o sub-título da notícia.');
          return false;
       }
       if (! isValidDate(document.form2.data1.value)) {
          alert('A data foi inserida incorrectamente.');
          document.form2.data1.value="";
          return false;
       }
       if (document.form2.data1.value.length <= 0) {
          alert('Insira a data da notícia.');
          return false;
       }

       return true;
}

       function hideshow(which,opcao)
{

       if (!document.getElementById)
          return

       if (opcao == "1") {
          which.style.display="block";
          document.form1.veravancado.value="sim";
       }
       else {
          which.style.display="none";
          document.form1.veravancado.value="nao";
       }

}

       function hide(which)
{

       which.style.display="none";

}

       function show(which)
{

       which.style.display="block";

}

   function abrirmapa()
{
   window.open("/georoteiros/apagina/RV_mapas.aspx?t1=1&t2=1", "Mapas", "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=700,height=630,top=50,left=350"); 
}

   function MM_preloadImages() { //v3.0
      var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
      var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
      if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
   }

   function MM_findObj(n, d) { //v4.01
      var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
      d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
      if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
      for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
      if(!x && d.getElementById) x=d.getElementById(n); return x;
   }

   function MM_swapImgRestore() { //v3.0
      var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
   }

   function MM_swapImage() { //v3.0
      var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
      if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
   }


function abrejanela(url,nome,tamhor,tamver,scrollyn,usesize,resize,xLeft,yTop) 
{
  if(resize=='')
    {
    resize='no'
    }
  if (xLeft != null)
		{
		x = xLeft;
		}
	else
		{
		x=(screen.availWidth/2)-(tamhor/2)
		}
	if (yTop != null)
		{
		y = yTop;
		}
	else
		{
		y=(screen.availHeight/2)-(tamver/2)-20
		}
  
  if (navigator.appName=='Netscape')
    {
    if (usesize=='1')
      {
      outsidewd = window.open (url,nome,'toolbar=yes,location=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes,hotkeys=no')
      }
    else if (usesize!='1')
      {
      outsidewd = window.open(url,nome,"screenX=0,resizable="+resize+",hotkeys=no,scrollbars=" + scrollyn + ",screenY=0,outerWidth=" + tamhor + ",outerHeight=" + tamver+ ",left=" + x + ",top=" + y)
      }
    }
  else if (navigator.appName=='Microsoft Internet Explorer')
    {
    if (usesize=='1')
      {
	  outsidewd = window.open (url,nome,'toolbar=yes,location=yes,hotkeys=no,status=yes,menubar=yes,scrollbars=yes,resizable='+resize)
	  }
	else if (usesize!='1')
	  {
	  outsidewd = window.open(url,nome,'resizable='+resize+',hotkeys=no,scrollbars=' + scrollyn + ',Width=' + tamhor + ',Height=' + tamver + ',left=' + x + ',top=' + y + ' ')
      }
  }
}


function isValidDate(dateStr) {

// Checks for the following valid date formats:
// MM/DD/YY   MM/DD/YYYY   MM-DD-YY   MM-DD-YYYY
// Also separates date into month, day, and year variables

var datePat1 = /^(\d{1,2})(\/|-)(\d{1,2})(\/|-)(\d{2}|\d{4})$/;

var matchArray = dateStr.match(datePat1); // is the format ok?
if (matchArray == null) {
   //alert("Date is not in a valid format.")

   return false;
}

day = matchArray[1];
month = matchArray[3]; // parse date into variables
year = matchArray[5];

//alert("Day must be between 1 and 31.");

if (day < 1 || day > 31) {
   // alert("Day must be between 1 and 31.");
   return false;
}

if (month < 1 || month > 12) { // check month range
   //alert("Month must be between 1 and 12.");
   return false;
}
if ((month==4 || month==6 || month==9 || month==11) && day==31) {
   // alert("Month "+month+" doesn't have 31 days!")
   return false
}
if (month == 2) { // check for february 29th
   var isleap = (year % 4 == 0 && (year % 100 != 0 || year % 400 == 0));
   if (day>29 || (day==29 && !isleap)) {
      // alert("February " + year + " doesn't have " + day + " days!");
      return false;
   }
}

return true;  // date is valid
}


function isValidDateandTime(dateStr) {
// Checks for the following valid date formats:
// MM/DD/YY   MM/DD/YYYY   MM-DD-YY   MM-DD-YYYY
// Also separates date into month, day, and year variables

var datePat1 = /^(\d{1,2})(\/|-)(\d{1,2})(\/|-)(\d{2}|\d{4})( )(\d{1,2})(:)(\d{1,2})$/;
var datePat2 = /^(\d{1,2})(\/|-)(\d{1,2})(\/|-)(\d{2}|\d{4})$/;

// To require a 4 digit year entry, use this line instead:
// var datePat = /^(\d{1,2})(\/|-)(\d{1,2})\2(\d{4})$/;

var matchArray = dateStr.match(datePat1); // is the format ok?
if (matchArray == null) {
   //alert("Date is not in a valid format.")

   var matchArray2 = dateStr.match(datePat2); // is the format ok?
   if (matchArray2 == null) {
      return false;
   }
}

day = matchArray[1];
month = matchArray[3]; // parse date into variables
year = matchArray[5];
hour = matchArray[7];
minute = matchArray[9];

alert("Day must be between 1 and 31.");

if (day < 1 || day > 31) {
   // alert("Day must be between 1 and 31.");
   return false;
}
if (month < 1 || month > 12) { // check month range
   //alert("Month must be between 1 and 12.");
   return false;
}
if ((month==4 || month==6 || month==9 || month==11) && day==31) {
   // alert("Month "+month+" doesn't have 31 days!")
   return false
}
if (month == 2) { // check for february 29th
   var isleap = (year % 4 == 0 && (year % 100 != 0 || year % 400 == 0));
   if (day>29 || (day==29 && !isleap)) {
      // alert("February " + year + " doesn't have " + day + " days!");
      return false;
   }
}
if (hour < 0 || hour > 23) {
   // alert("Day must be between 1 and 31.");
   return false;
}
if (minute < 0 || minute > 59) {
   // alert("Day must be between 1 and 31.");
   return false;
}

return true;  // date is valid
}

function Minimize() 
{
window.innerWidth = 100;
window.innerHeight = 100;
window.screenX = screen.width;
window.screenY = screen.height;
alwaysLowered = true;
}

function Maximize() 
{

window.resizeTo(screen.width,screen.height);
window.moveTo(0,0);

}



/***********************************************
* Pop-it menu para Leonor Ramalho
***********************************************/

var defaultMenuWidth="170px" //set default menu width.

var linkset=new Array()
//SPECIFY MENU SETS AND THEIR LINKS. FOLLOW SYNTAX LAID OUT

linkset[0]='&nbsp;&nbsp;<b>Martelo de ge&oacute;logo</b>'
linkset[0]+='<hr>' //Optional Separator
linkset[0]+='&nbsp;&nbsp;Filmes:<a href="#" onclick=window.open("http://www.georoteiros.pt/georoteiros/apagina/A_licoesdetalhe.aspx?IDlicao=40&capitulo=181&pLetra=&ACTIVO=%203&TITULO=&TIPO_tema=Ensino%20da%20Geologia&lista=","teste","scrollbars=yes,width=1024,height=680")> - Vantagens e desvantagens, tipos de martelos</a><a href="#" onclick=window.open("http://www.georoteiros.pt/georoteiros/apagina/A_licoesdetalhe.aspx?IDlicao=40&capitulo=182&pLetra=&ACTIVO=%203&TITULO=&TIPO_tema=Ensino%20da%20Geologia&lista=","teste","scrollbars=yes,width=1024,height=680")> - Atitudes erradas no manuseamento</a><a href="#" onclick=window.open("http://www.georoteiros.pt/georoteiros/apagina/A_licoesdetalhe.aspx?IDlicao=40&capitulo=183&pLetra=&ACTIVO=%203&TITULO=&TIPO_tema=Ensino%20da%20Geologia&lista=","teste","scrollbars=yes,width=1024,height=680")> - Utiliza&ccedil;&atilde;o correcta</a>'

linkset[1]='&nbsp;&nbsp;<b>Sacos e etiquetas</b>'
linkset[1]+='<hr>'
linkset[1]+='&nbsp;&nbsp;Sacos de pl&aacute;stico'
linkset[1]+='<hr>'
linkset[1]+='&nbsp;&nbsp;Etiquetas:<a href="#" onclick=window.open("http://www.georoteiros.pt/georoteiros/apagina/A_licoesdetalhe.aspx?IDlicao=40&capitulo=169&pLetra=&ACTIVO=%203&TITULO=&TIPO_tema=Ensino%20da%20Geologia&lista=","teste","scrollbars=yes,width=1024,height=680")> - Foto c/ par&acirc;metros</a><a href="#" onclick=window.open("http://www.georoteiros.pt/georoteiros/apagina/A_licoesdetalhe.aspx?IDlicao=40&capitulo=168&pLetra=&ACTIVO=%203&TITULO=&TIPO_tema=Ensino%20da%20Geologia&lista=","teste","scrollbars=yes,width=1024,height=680")> - Para rochas fri&aacute;veis</a><a href="#" onclick=window.open("http://www.georoteiros.pt/georoteiros/apagina/A_licoesdetalhe.aspx?IDlicao=40&capitulo=180&pLetra=&ACTIVO=%203&TITULO=&TIPO_tema=Ensino%20da%20Geologia&lista=","teste","scrollbars=yes,width=1024,height=680")> - Para rochas consolidadas</a>'

linkset[2]='&nbsp;&nbsp;<b>Livro de Campo</b>'
linkset[2]+='<hr>'
linkset[2]+='<a href="#" onclick=window.open("http://www.georoteiros.pt/georoteiros/apagina/A_licoesdetalhe.aspx?IDlicao=40&capitulo=184&pLetra=&ACTIVO=%203&TITULO=&TIPO_tema=Ensino%20da%20Geologia&lista=","teste","scrollbars=yes,width=1024,height=680")> - O que &eacute;, para que serve</a>'

linkset[3]='&nbsp;&nbsp;<b>B&uacute;ssola de Ge&oacute;logo</b>'
linkset[3]+='<hr>'
linkset[3]+='<a href="#" onclick=window.open("http://www.georoteiros.pt/georoteiros/apagina/A_licoesdetalhe.aspx?IDlicao=40&capitulo=185&pLetra=&ACTIVO=%203&TITULO=&TIPO_tema=Ensino%20da%20Geologia&lista=","teste","scrollbars=yes,width=1024,height=680")> - Medi&ccedil;&atilde;o da direc&ccedil;&atilde;o</a><a href="#" onclick=window.open("http://www.georoteiros.pt/georoteiros/apagina/A_licoesdetalhe.aspx?IDlicao=40&capitulo=188&pLetra=&ACTIVO=%203&TITULO=&TIPO_tema=Ensino%20da%20Geologia&lista=","teste","scrollbars=yes,width=1024,height=680")> - Medi&ccedil;&atilde;o da inclina&ccedil;&atilde;o</a>'

linkset[4]='&nbsp;&nbsp;<b>Lupa de Bolso</b>'
linkset[4]+='<hr>'
linkset[4]+='<a href="#" onclick=window.open("http://www.georoteiros.pt/georoteiros/apagina/A_licoesdetalhe.aspx?IDlicao=40&capitulo=189&pLetra=&ACTIVO=%203&TITULO=&TIPO_tema=Ensino%20da%20Geologia&lista=","teste","scrollbars=yes,width=1024,height=680")> - Sua utiliza&ccedil;&atilde;o</a>'

linkset[5]='&nbsp;&nbsp;<b>&Aacute;cido Clor&iacute;drico</b>'
linkset[5]+='<hr>'
linkset[5]+='<a href="#" onclick=window.open("http://www.georoteiros.pt/georoteiros/apagina/A_licoesdetalhe.aspx?IDlicao=40&capitulo=190&pLetra=&ACTIVO=%203&TITULO=&TIPO_tema=Ensino%20da%20Geologia&lista=","teste","scrollbars=yes,width=1024,height=680")> - Regras de Seguran&ccedil;a</a><a href="#" onclick=window.open("http://www.georoteiros.pt/georoteiros/apagina/A_licoesdetalhe.aspx?IDlicao=40&capitulo=191&pLetra=&ACTIVO=%203&TITULO=&TIPO_tema=Ensino%20da%20Geologia&lista=","teste","scrollbars=yes,width=1024,height=680")> - Reac&ccedil;&atilde;o das rochas</a>'


linkset[7]='&nbsp;&nbsp;<b>Carta Geol&oacute;gica</b>'
linkset[7]+='<hr>'
linkset[7]+='<a href="#" onclick=window.open("http://www.georoteiros.pt/georoteiros/apagina/A_licoesdetalhe.aspx?IDlicao=40&capitulo=193&pLetra=&ACTIVO=%203&TITULO=&TIPO_tema=Ensino%20da%20Geologia&lista=","teste","scrollbars=yes,width=1024,height=680")> - Aplica&ccedil;&otilde;es e Informa&ccedil;&otilde;es</a>'

linkset[8]='&nbsp;&nbsp;<b>Carta Topogr&aacute;fica</b>'
linkset[8]+='<hr>'
linkset[8]+='<a href="#" onclick=window.open("http://www.georoteiros.pt/georoteiros/apagina/A_licoesdetalhe.aspx?IDlicao=40&capitulo=192&pLetra=&ACTIVO=%203&TITULO=&TIPO_tema=Ensino%20da%20Geologia&lista=","teste","scrollbars=yes,width=1024,height=680")> - Aplica&ccedil;&otilde;es e Informa&ccedil;&otilde;es</a>'

linkset[9]='&nbsp;&nbsp;<b>Multim&eacute;dia</b>'
linkset[9]+='<hr>'
linkset[9]+='<a href="#" onclick=window.open("http://www.georoteiros.pt/georoteiros/apagina/A_licoesdetalhe.aspx?IDlicao=40&capitulo=194&pLetra=&ACTIVO=%203&TITULO=&TIPO_tema=Ensino%20da%20Geologia&lista=","teste","scrollbars=yes,width=900,height=500")> - Fotografia e V&iacute;deo</a>'

////No need to edit beyond here

var ie5=document.all && !window.opera
var ns6=document.getElementById

if (ie5||ns6)
document.write('<div id="popitmenu" onMouseover="clearhidemenu();" onMouseout="dynamichide(event)"></div>')

function iecompattest(){
return (document.compatMode && document.compatMode.indexOf("CSS")!=-1)? document.documentElement : document.body
}

function showmenu(e, which, optWidth){
if (!document.all&&!document.getElementById)
return
clearhidemenu()
menuobj=ie5? document.all.popitmenu : document.getElementById("popitmenu")
menuobj.innerHTML=which
menuobj.style.width=(typeof optWidth!="undefined")? optWidth : defaultMenuWidth
menuobj.contentwidth=menuobj.offsetWidth
menuobj.contentheight=menuobj.offsetHeight
eventX=ie5? event.clientX : e.clientX
eventY=ie5? event.clientY : e.clientY
//Find out how close the mouse is to the corner of the window
var rightedge=ie5? iecompattest().clientWidth-eventX : window.innerWidth-eventX
var bottomedge=ie5? iecompattest().clientHeight-eventY : window.innerHeight-eventY
//if the horizontal distance isn't enough to accomodate the width of the context menu
if (rightedge<menuobj.contentwidth)
//move the horizontal position of the menu to the left by it's width
menuobj.style.left=ie5? iecompattest().scrollLeft+eventX-menuobj.contentwidth+"px" : window.pageXOffset+eventX-menuobj.contentwidth+"px"
else
//position the horizontal position of the menu where the mouse was clicked
menuobj.style.left=ie5? iecompattest().scrollLeft+eventX+"px" : window.pageXOffset+eventX+"px"
//same concept with the vertical position
if (bottomedge<menuobj.contentheight)
menuobj.style.top=ie5? iecompattest().scrollTop+eventY-menuobj.contentheight+"px" : window.pageYOffset+eventY-menuobj.contentheight+"px"
else
menuobj.style.top=ie5? iecompattest().scrollTop+event.clientY+"px" : window.pageYOffset+eventY+"px"
menuobj.style.visibility="visible"
return false
}

function contains_ns6(a, b) {
//Determines if 1 element in contained in another- by Brainjar.com
while (b.parentNode)
if ((b = b.parentNode) == a)
return true;
return false;
}

function hidemenu(){
if (window.menuobj)
menuobj.style.visibility="hidden"
}

function dynamichide(e){
if (ie5&&!menuobj.contains(e.toElement))
hidemenu()
else if (ns6&&e.currentTarget!= e.relatedTarget&& !contains_ns6(e.currentTarget, e.relatedTarget))
hidemenu()
}

function delayhidemenu(){
delayhide=setTimeout("hidemenu()",500)
}

function clearhidemenu(){
if (window.delayhide)
clearTimeout(delayhide)
}

if (ie5||ns6)
document.onclick=hidemenu


