// JavaScript Document

	function popup(str,w,h) {
	var le = (screen.availWidth - w) /2;
	var he = (screen.availHeight -h+10) /2;
        searchWin = window.open(str,'NewWin','scrollbars=yes,resizable=no,width='+w+',height='+h+',left='+le+',top='+he+',status=no,location=no,toolbar=no');

//        searchWin.refer = self;

}



	function changecategorie(){
var sito = document.formcategorie.cat.options;
//indica l'indice dell'opzione selezionata nella selectbox.
if ((sito[document.formcategorie.cat.selectedIndex].value != "")){
document.formcategorie.submit();}}

	function changecontratto(){
var sito = document.formcontratto.cat.options;
//indica l'indice dell'opzione selezionata nella selectbox.
if ((sito[document.formcontratto.cat.selectedIndex].value != "")){
//location.href="Default.asp?sezione=contratto&cat="+sito[document.formcontratto.contratto.selectedIndex].value;
document.formcontratto.submit();
}
}
	function changetipologia(){
var sito = document.formtipologia.cat.options;
//indica l'indice dell'opzione selezionata nella selectbox.
if ((sito[document.formtipologia.cat.selectedIndex].value != "")){
document.formtipologia.submit();}
}
	function changeprov(){
var sito = document.sprov.regid.options;
//indica l'indice dell'opzione selezionata nella selectbox.
if ((sito[document.sprov.regid.selectedIndex].value != "")){
location.href="?reg="+sito[document.sprov.regid.selectedIndex].value;
}}


function display_menu() {
		document.getElementById('menu').style.display = "block";
	}function display_immobili() {
		document.getElementById('immobili').style.display = "block";
	}
//	function changemaschera(){
//		
//var contratto=document.form1.contratto.options;	
//var categoria=document.form1.categoria.options;	
//
////alert(contratto[document.form1.contratto.selectedIndex].text)
//if ((contratto[document.form1.contratto.selectedIndex].text == "Affitto") ||(categoria[document.form1.categoria.selectedIndex].text == "Casa Vacanza")){
//
//document.form1.button2.disabled=false;
//document.form1.button1.disabled="disabled";
//	}
//	else{
//
//document.form1.button2.disabled="disabled";
//	document.form1.button1.disabled=false;	}
//	}
//		
//			function changemodmaschera(){
//		
//var contratto=document.form1.contratto.options;	
//var categoria=document.form1.categoria.options;	
//
//if ((contratto[document.form1.contratto.selectedIndex].text == "Affitto")){
//document.form1.button2.disabled=false;
//document.form1.button1.disabled=false;
//document.form1.categoria.focus();
//}
//else if ((contratto[document.form1.contratto.selectedIndex].text == "Vendita")){
//document.form1.button1.disabled=false;	
//document.form1.button2.disabled="disabled";
//document.form1.categoria.focus();
//}
//	else{
//document.form1.button2.disabled="disabled";
//document.form1.button1.disabled="disabled"		
//
//}
//		}
		
		
		
		
		function selectmaschera(){
		
var contratto=document.form1.contratto.value;	
 var s=new String;
		 var out = new String;
		 var nomi = new Array();
		 s=document.form1.contratto.value;
		 nomi = s.split(",");
		// for (i=0;i<nomi.length;i++) {
//		 	 out += i + ") " + nomi[i] + "\n";
//			 };		
if ((nomi[1]== "Affitto")){

document.form1.categoria.focus();
	document.getElementById('button1').disabled =false;
	//	document.getElementById('button2').disabled =false;
	document.getElementById('buttonaffitto').style.display="block"
	document.getElementById('buttonvendita').style.display="none"
	}
	else{
		document.form1.categoria.focus();
		document.getElementById('buttonaffitto').style.display="none"
	document.getElementById('buttonvendita').style.display="block"
		//document.getElementById('button1').disabled =false;
		//document.getElementsByName('button2').style.visibility = "hidden";
//alert("OK");

}
	}
		
			function changemodmaschera(){
		
var contratto=document.form1.contratto.options;	
var categoria=document.form1.categoria.options;	

if ((contratto[document.form1.contratto.selectedIndex].text == "Affitto")){
	
document.form1.categoria.focus();	
	document.getElementById('button1').disabled =false;
		document.getElementById('button2').disabled =false;

}
else if ((contratto[document.form1.contratto.selectedIndex].text == "Vendita")){
	document.form1.categoria.focus();
document.getElementById('button1').disabled =false;
		document.getElementById('button2').disabled =true;
}
	else{
		document.getElementById('button1').disabled =true;
		document.getElementById('button2').disabled =true;	

}
		}
			
		
function Tariffa(ID,cod){
document.form2.id.value =ID;
document.form2.cod.value =cod;
document.form2.action="AnnuncioStagionale.asp";
document.form2.submit();
}		
	
	//	location.href='InserisciAnnuncio.asp?messaggio=scelta&cat='+document.form1.contratto.value;
function changemodulo(){
var contratto=document.forma.cat.options;
if ((contratto[document.forma.cat.selectedIndex].value != "")){

		
document.forma.submit();	
	}
}	

		function creannuncio(){
document.form1.action="../sql.asp?messaggio=iimmobile"
document.form1.submit();
}		function creannunciostagionale(){
document.form1.action="?messaggio=periodo"
document.form1.submit();
}		function modannuncio(){
document.form1.action="../sql.asp?messaggio=mimmobile"
document.form1.submit();
}		function modannunciostagionale(){
document.form1.action="?messaggio=periodo"
document.form1.submit();
}function url(link,str) {
location.href=link+"?id="+str
}

function goricercavacanza()
{
document.form_vetrina.action='trovavacanze.asp';
document.form_vetrina.submit();
}		
function Vai(Limit){
document.form1.limit.value = Limit;
//alert(document.form1.limit.value)
document.form1.submit();
}
											
											
											
											
function goricercaffitti()
{

document.formricerca.submit();
}		
function goricercannunci()

{
var tblname=document.SearchInfo.TblName.options;	
document.SearchInfo.action="RisultatiAnnunci.asp?Mode=Risultati&q="+document.SearchInfo.q.value+"&tblName="+tblname[document.SearchInfo.TblName.selectedIndex].value;
document.SearchInfo.submit();
}
function anteprimanewsletter()

{
document.getElementById('myform').action="anteprima.asp?action=send";
document.getElementById('myform').target="_blank";
document.getElementById('myform').submit();

}
function inviarchivio()

{
document.getElementById('myform').action="process.asp?action=send";
document.getElementById('myform').submit();
}

function anteprimannunci()

{
document.getElementById('form1').action="anteprima.asp?action=sendannuncio";
document.getElementById('form1').target="_blank";
document.getElementById('form1').submit();
}
function inviannuncinewsletter()

{
document.getElementById('form1').action="process.asp?action=sendannuncio";
document.getElementById('form1').submit();
}
function anteprimanormal()

{
document.getElementById('myform1').action="anteprima.asp?action=sendnormal";
document.getElementById('myform1').target="_blank";
document.getElementById('myform1').submit();
}
function invianewsletternormal()

{
document.getElementById('myform1').action="process.asp?action=sendnormal";
document.getElementById('myform1').submit();
}