function change_type(id){
	if (id=="txtPassword"){
		if (document.getElementById(id).value == "Password"){
			var obj = document.getElementById(id);
			var newO = document.createElement('input');
			newO.setAttribute('type','password');
			newO.setAttribute('name','txtPassword');
			newO.setAttribute('id',id);
			newO.setAttribute('value','');
			newO.setAttribute('onblur','reset_type(this.id);');
			obj.parentNode.replaceChild( newO , obj);
			setTimeout("focus_on('"+id+"');", 10);
		}
	} else {
		if (document.getElementById(id).value == "Username"){
			document.getElementById(id).value = "";
		}
	}
}
function focus_on(id){
	document.getElementById(id).focus();
}
function reset_type(id){
	if (id=="txtPassword"){
		if (document.getElementById(id).value == ""){
			var obj = document.getElementById(id);
			var newO=document.createElement('input');
			newO.setAttribute('type','text');
			newO.setAttribute('name','txtPassword');
			newO.setAttribute('id',id);
			newO.setAttribute('value','Password');
			newO.setAttribute('onfocus','change_type(this.id);');
			obj.parentNode.replaceChild(newO,obj);
		}
	} else {
		if (document.getElementById(id).value == ""){
			document.getElementById(id).value = "Username";
		}
	}
}

var showFaq = {
	init: function() {
		var my_section_box = document.getElementById("corpo_pagina");
		if (my_section_box){
		var my_single_box = my_section_box.getElementsByTagName("div");
			for(i=0; i < my_single_box.length; i++){
				my_single_box[i].style.display = "none";
			}
		}
	},
	faq: function() {
		var my_section_box = document.getElementById("corpo_pagina");
		if (my_section_box){
			var my_single_box = my_section_box.getElementsByTagName("div");
			for(i=0; i < my_single_box.length; i++){
				my_single_box[i].style.display = "block";
			}
		}
	},
	single: function(myId) {
		var my_section_box = document.getElementById("corpo_pagina");
		if (my_section_box){
			var my_single_box = my_section_box.getElementsByTagName("div");
			for(i=0; i < my_single_box.length; i++){
				if (my_single_box[i].id == myId){
					my_single_box[i].style.display = (my_single_box[i].style.display == "none") ? "block" : "none" ;
				}
			}
		} else {
			alert("Errore: non esiste l'id " + myId);
		}
	}
}

function position(value){
	if (value!=0){
		if (value.split(",")[2] != 0){
			if ((value.split(",")[2]).length == 2){
				include_page('/assets/option_city.php?id='+ value.split(",")[2], 'option_city');
				campo_cerca = value.split(",")[2];
			} else {
				campo_cerca = value.split(",")[2];
			}
		}
		loads(campo_cerca);
	} else {
		include_page('/assets/option_city.php?id=0', 'option_city');
		loads();
	}
}

function callApp(indirizzo){
  if (screen.width < 1024 || screen.height < 768) {
      pop = window.open(indirizzo,'','menubar=no,toolbar=no,status=yes,resizable=yes');
  } else {
      pop = window.open(indirizzo,'','menubar=no,toolbar=no,status=yes,scrollbars=no,resizable=no,width=1014,height=678,top=0,left=0');
  }
}