function preloadImgs(){
  for(var i=0;i<imgs.length;i++){
    MM_preloadImages(imgs[i]);
  }
}
// Copyright 2003, Marja Ribbers-de Vroed, FlevOOware (www.STI1.nl/dreamweaver/)
function flvFSTI3(v1,v2){//v1.01
var v3;if (v1.filters[0]&&v1.filters[0].status==2){v1.filters[0].Stop();}if (v2==0){v3="blendTrans(Duration="+v1.STI8+")";}else {v3="revealTrans(Duration="+v1.STI8+",Transition="+(v2-1)+")";}v1.style.filter=v3;}

function flvFSTI1(){//v1.01
var v1=arguments,v2=document,v3;v2.STI4=new Array();v2.STI7=(navigator.userAgent.toLowerCase().indexOf("mac")!=-1);for (var v4=0;v4<v1.length-2;v4+=5){v3=MM_findObj(v1[v4]);if (v3){v3.STI5=v3.src;v3.STI6=v1[v4+1];v3.STI2=v1[v4+2];v3.STI3=v1[v4+3];v3.STI8=v1[v4+4];v2.STI4[v2.STI4.length]=v3;if (v3.filters&&!v2.STI7){flvFSTI3(v3,v3.STI2);v3.onfilterchange=flvFSTI4;v3.filters[0].Apply();}v3.src=v3.STI6;if (v3.filters&&!v2.STI7){v3.filters[0].Play();}}}}

function flvFSTI2(){//v1.01
var v1,v2=document,v3=v2.STI4,v4;for (v4=0;v3&&v4<v3.length&&(v1=v3[v4])&&v1.STI5;v4++){if (v1.filters&&!v2.STI7){flvFSTI3(v1,v1.STI3);v1.filters[0].Apply();}v1.src=v1.STI5;if (v1.filters&&!v2.STI7){v1.filters[0].Play();}}}
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 flvFSTI4(){//v1.01
this.style.filter="";}
//-------------------------------------------------------------------------------------------------------------------------------------------------------
function checkMail(str) {	
	var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	return filter.test(str);
}

function isNumberFloat(inputString)
{
  return (!isNaN(parseFloat(inputString))) ? true : false;
}	

function trim(value) {
	return value.replace(/^[ ]+|[ ]+$/gm,"").replace(/[ ]{2,}/gm," ")
}

function ValidateForm(){
	switch (document.getElementById("botao").value) {
		case "inserir":
			if(trim(document.getElementById("txtNome").value)=="") {
				alert("Por favor introduza o nome.");
				return false;
			}
			if(!isNumberFloat(document.getElementById("txtPreco").value)) {
				alert("Por favor introduza o preço.");
				return false;
			}
			return true;		

		case "anexar": return ValidaFich();		
	
		default: return true
	}
}


function ValidaFich(){	
	if(document.getElementById('foto').value=="") {
		alert("Por favor indique o nome do ficheiro.");
		return false;
	}
	return true;
}

function LimpaForm(){
	if(confirm("Deseja limpar todos os campos?"))
		for(i=0; i < document.forms[0].elements.length; i++) {
			elemento=document.forms[0].elements[i]
				if(elemento.type == "text" || elemento.type == "textarea")
					elemento.value="";
		}
	return false;
}

function valInt(){
	var tecla=window.event.keyCode;
	if((tecla!=8)&&(tecla!=46))
		if((tecla<48)||(tecla>57))
			if((tecla<96)||(tecla>105))
				event.returnValue= false;
}
<!-- Menus
	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_nbGroup(event, grpName) { //v6.0
	  var i,img,nbArr,args=MM_nbGroup.arguments;
	  if (event == "init" && args.length > 2) {
		if ((img = MM_findObj(args[2])) != null && !img.MM_init) {
		  img.MM_init = true; img.MM_up = args[3]; img.MM_dn = img.src;
		  if ((nbArr = document[grpName]) == null) nbArr = document[grpName] = new Array();
		  nbArr[nbArr.length] = img;
		  for (i=4; i < args.length-1; i+=2) if ((img = MM_findObj(args[i])) != null) {
			if (!img.MM_up) img.MM_up = img.src;
			img.src = img.MM_dn = args[i+1];
			nbArr[nbArr.length] = img;
		} }
	  } else if (event == "over") {
		document.MM_nbOver = nbArr = new Array();
		for (i=1; i < args.length-1; i+=3) if ((img = MM_findObj(args[i])) != null) {
		  if (!img.MM_up) img.MM_up = img.src;
		  img.src = (img.MM_dn && args[i+2]) ? args[i+2] : ((args[i+1])? args[i+1] : img.MM_up);
		  nbArr[nbArr.length] = img;
		}
	  } else if (event == "out" ) {
		for (i=0; i < document.MM_nbOver.length; i++) {
		  img = document.MM_nbOver[i]; img.src = (img.MM_dn) ? img.MM_dn : img.MM_up; }
	  } else if (event == "down") {
		nbArr = document[grpName];
		if (nbArr)
		  for (i=0; i < nbArr.length; i++) { img=nbArr[i]; img.src = img.MM_up; img.MM_dn = 0; }
		document[grpName] = nbArr = new Array();
		for (i=2; i < args.length-1; i+=2) if ((img = MM_findObj(args[i])) != null) {
		  if (!img.MM_up) img.MM_up = img.src;
		  img.src = img.MM_dn = (args[i+1])? args[i+1] : img.MM_up;
		  nbArr[nbArr.length] = img;
	  } }
	}	
//Document title scroller- By Graeme Robinson (me@graemerobinson.co.uk)
//Exlusive permission granted to Dynamic Drive to include this script in their DHTML archive.
var repeat=0 //enter 0 to not repeat scrolling after 1 run, othersise, enter 1
var title=document.title
var leng=title.length
var start=1
function titlemove() {
  titl=title.substring(start, leng) + title.substring(0, start)
  document.title=titl
  start++
  if (start==leng+1) {
    start=0
    if (repeat==0)
    return
  }
  setTimeout("titlemove()",140)
}
//------- Cross browser Marquee script- © Dynamic Drive (www.dynamicdrive.com)
function populate(){
	if (iedom){
		cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
		cross_marquee.style.left=parseInt(marqueewidth)+8+"px"
		cross_marquee.innerHTML=marqueecontent
		actualwidth=document.all? temp.offsetWidth : document.getElementById("temp").offsetWidth
	}
	else if (document.layers){
		ns_marquee=document.ns_marquee.document.ns_marquee2
		ns_marquee.left=parseInt(marqueewidth)+8
		ns_marquee.document.write(marqueecontent)
		ns_marquee.document.close()
		actualwidth=ns_marquee.document.width
	}
	lefttime=setInterval("scrollmarquee()",20)
}

function scrollmarquee(){
	if (iedom){
		if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
		cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed+"px"
	else
		cross_marquee.style.left=parseInt(marqueewidth)+8+"px"				
	}else if (document.layers){
		if (ns_marquee.left>(actualwidth*(-1)+8))
			ns_marquee.left-=copyspeed
		else
			ns_marquee.left=parseInt(marqueewidth)+8
	}
}

