
/***********************************************
* Bookmark site script- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/
function bookmarksite(title,url){
	if (window.sidebar) // firefox
		window.sidebar.addPanel(title, url, "");
	else if(window.opera && window.print){ // opera
		var elem = document.createElement('a');
		elem.setAttribute('href',url);
		elem.setAttribute('title',title);
		elem.setAttribute('rel','sidebar');
		elem.click();
	} 
	else if(document.all)// ie
		window.external.AddFavorite(url, title);
}

function confirma (url){
	var answer = confirm ("Quer abandonar esta página?\nAo confirmar esta operação estará a abandonar esta página e perderá qualquer alteração que tenha feito.");
	if (answer) {
		window.location=url;
	}
	else {
		alert ("Esta operação foi cancelada.");
	}
}

function findFilename( origem, destino ) {
  var elem, str;
  if( document.getElementById ) // this is the way the standards work
    elem = document.getElementById( origem );
  else if( document.all ) // this is the way old msie versions work
      elem = document.all[origem];
  else if( document.layers ) // this is the way nn4 works
    elem = document.layers[origem];

  if (elem.value) {
	str = elem.value.substr(elem.value.lastIndexOf('\\')+1);
	document.getElementById( destino ).value = str;
  }
}
