// Funzione per l'indirizzamento su Motori di ricerca

function redirectSearchEngineForm() {
	if (document.searchform.radio[1].checked) {
		document.searchform.action='http://it.search.yahoo.com/search';
		document.searchform[0].name='p';
	} else if (document.searchform.radio[2].checked) {
		document.searchform.action= 'http://www.bing.com/search';
  		document.searchform[0].name='q';
  	} else if (document.searchform.radio[0].checked) {
		document.searchform.action= 'http://www.google.it/custom';
		document.searchform[0].name='q';
		document.searchform.submit.name='sa';
		var nf = document.createElement("INPUT");
		nf.type="hidden"; nf.name="domains"; nf.value="oneonline.it";
		document.searchform.appendChild(nf);
		var nf = document.createElement("INPUT");
		nf.type="hidden"; nf.name="channel"; nf.value="1089271529";
		document.searchform.appendChild(nf);
		var nf = document.createElement("INPUT");
		nf.type="hidden"; nf.name="sitesearch"; nf.value="";
		document.searchform.appendChild(nf);
		var nf = document.createElement("INPUT");
		nf.type="hidden"; nf.name="client"; nf.value="pub-4071148389408159";
		document.searchform.appendChild(nf);
		var nf = document.createElement("INPUT");
		nf.type="hidden"; nf.name="forid"; nf.value="1";
		document.searchform.appendChild(nf);
		var nf = document.createElement("INPUT");
		nf.type="hidden"; nf.name="ie"; nf.value="ISO-8859-1";
		document.searchform.appendChild(nf);
		var nf = document.createElement("INPUT");
		nf.type="hidden"; nf.name="oe"; nf.value="ISO-8859-1";
		document.searchform.appendChild(nf);
		var nf = document.createElement("INPUT");
		nf.type="hidden"; nf.name="cof"; nf.value="GALT:#008000;GL:1;DIV:#000099;VLC:FFFFFF;AH:center;BGC:FFFFFF;LBGC:FFFFFF;ALC:0000FF;LC:0000FF;T:000000;GFNT:0000FF;GIMP:0000FF;LH:50;LW:123;L:http://www.oneonline.it/immagini/one-search.gif;S:http://www.oneonline.it;FORID:1;";
		document.searchform.appendChild(nf);
		var nf = document.createElement("INPUT");
		nf.type="hidden"; nf.name="hl"; nf.value="it";
		document.searchform.appendChild(nf);
  	} else if (document.searchform.radio[3].checked) {
  		document.searchform.action= 'http://www.altavista.com/cgi-bin/q';
  		document.searchform[0].name='q';
  	}
}

// Funzione per il redirect del menų a discesa dei comuni cilentani
function redirectSelectComuniCilentani(){
	PageIndex2=document.cilento.comuni.selectedIndex
	if (document.cilento.comuni.options[PageIndex2].value != "none") {
		document.location = document.cilento.comuni.options[PageIndex2].value
	}
}

function checkTextField(field) {
	if (!field || !field.value || trim(field.value) == '') {
		field.value = '';
		field.focus();
		return false;
	}
	return true;
}

function trim(str) {
	return str.replace(/^\s*|\s*$/g,"");
}

// Funzioni per la visualizzazione della guida al contesto sui menų (non pių attive)
function popupHelperMsg(msg,bak){
	return;
}
function closePopupHelper(){
	return;
}

function getElement(id) {
	if (!id) return;
	if(document.all) {
		return eval("document.all['" + id + "']");
	} else {
		return document.getElementById(id);
	}
}

function displayBlock(id) {
	if (!id) return;
	var obj = getElement(id);
	if (!obj) return;
	obj.style.display = 'block';
}function displayDefault(id) {	if (!id) return;	var obj = getElement(id);	if (!obj) return;	obj.style.display = '';}

function displayNone(id) {
	if (!id) return;
	var obj = getElement(id);
	if (!obj) return;
	obj.style.display = 'none';
}

function switchDisplay(id) {
	if (!id) return;
	var obj = getElement(id);
	if (!obj) return;
	if (obj.style.display == 'none') {
		obj.style.display = 'block';
	} else {
		obj.style.display = 'none';
	}
}
