function print_div(termo,divNome)
{
	var w = screen.width / 2 - 200;
	var h = screen.height / 2 - 200;
	var a = window.open('','','scrollbars=yes,width=400,height=400,left=' + w + ',top=' + h + '');
	a.document.open("text/html");
	a.document.write('<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /><title>CAF</title>');
	a.document.write('<link rel="stylesheet" href="css/print.css" type="text/css" /></head><body>');
	a.document.write('<h2>'+ termo +'</h2>');
	a.document.write(document.getElementById(divNome).innerHTML);
	a.document.write('<br /></body></html>');
	a.document.close();
	a.print();
	if (a != "") a.close();
}

function addfavorits(e){	

var titulo = "CAF";
var url = "http://www.dgaep.gov.pt/caf";

		if (e.type == "keydown"){
		var key=e.keyCode || e.which;
		
			if (key==13){//enter
				if (document.all){//IE
					window.external.AddFavorite(url,titulo);
				}else if (window.sidebar){ //FireFox
					window.sidebar.addPanel(titulo, url,"");
				};
			};
	}else if (e.type == "mousedown"){
		if (document.all){//IE
			window.external.AddFavorite(url,titulo);
		}else if (window.sidebar){ //FireFox
			window.sidebar.addPanel(titulo, url,"");
		};
	};	
};

//SHOW HIDE DIVS////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/*
Highlight Image Script- 
© Dynamic Drive (www.dynamicdrive.com)
For full source code, installation instructions,
100's more DHTML scripts, and Terms Of
Use, visit dynamicdrive.com
*/

function makevisible(cur,which){
if (which==0)
	cur.filters.alpha.opacity=75
else
	cur.filters.alpha.opacity=100
}


/* Show / Hide */
if (parseInt(navigator.appVersion) > 3) {
	if (navigator.appName == "Netscape") {
		layerVar="document.layers";
		styleVar="";
	}else{
		layerVar="document.all";
		styleVar=".style";
	}
}

function skf_ShowHideLayer(TheLayer,TheAttrib) {
	if (parseInt(navigator.appVersion) > 3) {
		eval(layerVar + '["' + TheLayer + '"]' + styleVar + '.display = "' + TheAttrib + '"');
	}
}

function hideAll(){
//	skf_ShowHideLayer('layer1','none');
//	skf_ShowHideLayer('layer1a','none');
//	skf_ShowHideLayer('layer2','none');
//	skf_ShowHideLayer('layer2a','none');
//	skf_ShowHideLayer('layer3','none');
//	skf_ShowHideLayer('layer3a','none');
//	skf_ShowHideLayer('layer5','none');
//	skf_ShowHideLayer('layer5a','none');
//	skf_ShowHideLayer('layer6','none');
//	skf_ShowHideLayer('layer6a','none');
//	skf_ShowHideLayer('layer7','none');
//	skf_ShowHideLayer('layer7a','none');
//	skf_ShowHideLayer('layer8','none');
//	skf_ShowHideLayer('layer8a','none');
	hideallids();
}

//here you place the ids of every element you want.
var ids=new Array('layer1','layer2','layer3','layer4','layer5','layer6','layer7');

function switchid(id){	
	hideallids();
	showdiv(id);
}

function hideallids(){
	//loop through the array and hide each element by id
	for (var i=0;i<ids.length;i++){
		hidediv(ids[i]);
	}		  
}

function hidediv(id) {
	//safe function to hide an element with a specified id
	if (document.getElementById) { // DOM3 = IE5, NS6
		document.getElementById(id).style.display = 'none';
	}
	else {
		if (document.layers) { // Netscape 4
			document.id.display = 'none';
		}
		else { // IE 4
			document.all.id.style.display = 'none';
		}
	}
}

function showdiv(id) {
	//safe function to show an element with a specified id
		  
	if (document.getElementById) { // DOM3 = IE5, NS6
		document.getElementById(id).style.display = 'block';
	}
	else {
		if (document.layers) { // Netscape 4
			document.id.display = 'block';
		}
		else { // IE 4
			document.all.id.style.display = 'block';
		}
	}
}


//function toggle(target)
//{
   //obj=(document.all) ? document.all[target] : document.getElementById(target);
   //obj.style.display=(obj.style.display=='none') ? 'inline' : 'none';
//}

// toggle visibility 
function toggle(targetId){ 

  if (document.getElementById){ 
        target = document.getElementById( targetId ); 
           if (target.style.display == "none"){ 
              target.style.display = ""; 
           } else { 
              target.style.display = "none"; 
           } 
     } 
} 

