// JavaScript Document
function setHome() {
  if (document.all) 
  {
    document.body.style.behavior = "url(#default#homepage)";
    document.body.setHomePage('http://www.sospage.com');
  }
  else
    alert("only works in IE 4.0 or higher!");
}

function setFavorite(){
	var url = window.location.href;
	var title = document.title;
	if(document.all) // ie
	window.external.AddFavorite(url, title);
	else 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();
	}
} 
function openpopupimprimir(id_texto){
var winpops=window.open("imprimirtexto.php?imprimirtexto=1&id_texto="+id_texto,"","width=500,height=300,directories,scrollbars,resizable")
}

//relactivo a sidebar.php  / formSelection
function mudaPais(value) {
	switch (value) {
		case "2": //id de espanha
		window.location = "index.php?id_pais=" + value + "&id_distrito=0&id_concelho=0";
		break;
		case "3": //id de inglaterra
		window.location = "index.php?id_pais=" + value + "&id_distrito=0&id_concelho=0";
		break;
		case "4": //id de angola
		window.location = "http://www.sospage-angola.com/index.php";
		break;
		default:
		window.location = "index.php?id_pais=" + value + "&id_distrito=12&id_concelho=154";
	}
}

function mudaDistrito(value) {
	switch (Number(value)) { //Number(value)
		case 12: //id lisboa
		window.location = "index.php?id_pais=" + document.getElementById("pais").value + "&id_distrito=" + value + "&id_concelho=154";
		break;
		case 15: //id do porto
		window.location = "index.php?id_pais=" + document.getElementById("pais").value + "&id_distrito=" + value + "&id_concelho=191";
		break;
		// case 2: //id aveiro
		// window.location = "index.php?id_pais=" + document.getElementById("pais").value + "&id_distrito=" + value + "&id_concelho=5";
		// break;
		default:
		window.location = "index.php?id_pais=" + document.getElementById("pais").value + "&id_distrito=" + value + "&id_concelho=0";
	}
}

function mudaConcelho(value) {
	window.location = "index.php?id_pais=" + document.getElementById("pais").value + "&id_distrito=" + document.getElementById("distrito").value + "&id_concelho=" + value;
}

