function apri(url, w, h)
{
  var windowprops = "width=" + w + ",height=" + h;
  popup = window.open(url,'remote',windowprops+',scrollbars=yes,resizable=no,location=no,menubar=no,status=yes');
}


function MM_showHideLayers()
{ //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}

function MM_findObj(n, d)
{ //v4.0
  var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}

function lookup(inputString) {
  if(inputString.length == 0) {
    // Hide the suggestion box.
    $('#suggestions').hide();
  } else {
    $.post("citta.php", {queryString: ""+inputString+""}, function(data){
    if (data.length >0)
    {
      $('#suggestions').show();
      $('#autoSuggestionsList').html(data);
    }
  });
                }
}

function fill(thisValue)
{
  $('#inputString').val(thisValue);
  setTimeout("$('#suggestions').hide();", 200);
}

$(document).ready(function(){
 //$("#cercacerca").attr("disabled", true);
 $('#nazione0').change(function(event) {
     var cosa=$('#nazione0').val();
     $.ajax({
            type: "GET",
            url: "ajax_citta.php",
            data: "ajax=ok&id_n="+cosa,
            success: function(msg){
            $('#blocco').html(msg);
            //$("#cercacerca").removeAttr("disabled");
         }
     });
    });
});

function nuovadata(aaa)
{
  var dateArray = aaa.split('/');
  var textBoxMonth = dateArray[1];
  var textBoxDay = parseInt(dateArray[0]);
  var textBoxYear = dateArray[2];
  textBoxDay = textBoxDay +1;

  $("#data_arrivo").val(textBoxDay+'/'+textBoxMonth+'/'+textBoxYear);

}

function nuovadata2(aaa)
{
  var dateArray = aaa.split('/');
  var textBoxMonth = dateArray[1];
  var textBoxDay = parseInt(dateArray[0]);
  var textBoxYear = dateArray[2];
  textBoxDay = textBoxDay +1;

  $("#data_arrivo2").val(textBoxDay+'/'+textBoxMonth+'/'+textBoxYear);

}

function caricapersone(url,uno,due,tre,quantecamere,id)
{
  document.location.href=url+'?datap='+due+'&dataa='+tre+'&c='+uno+'&quantec='+quantecamere+'&id='+id+'#pr';
}

function caricapersone2(url,uno,due,tre,tipocamera1,quantecamere,id)
{
document.location.href=url+'?datap='+due+'&dataa='+tre+'&c2='+uno+'&c='+tipocamera1+'&quantec='+quantecamere+'&id='+id+'#pr';
}

function caricapersone3(url,uno,due,tre,tipocamera1,tipocamera2,quantecamere,id)
{
  document.location.href=url+'?datap='+due+'&dataa='+tre+'&c3='+uno+'&c='+tipocamera1+'&c2='+tipocamera2+'&quantec='+quantecamere+'&id='+id+'#pr';
}

function mostracamere(valore)
{
  if(valore==1){
    MM_showHideLayers('Layer2','','hide','Layer3','','hide','Layer4','','hide');
  }
  if(valore==2){
    MM_showHideLayers('Layer2','','show','Layer3','','hide','Layer4','','hide');
  }
  if(valore==3){
    MM_showHideLayers('Layer2','','show','Layer3','','show','Layer4','','hide');
  }
}

function scrivi(dove,valore){
  document.getElementById(dove).innerHTML=valore+' eur';
}

function validate()
{
        if(document.theform.dataP.value == '')
        {
                alert('Prego inserisci data arrivo');
                document.theform.dataP.focus();
                return false;
        }
        if(document.theform.dataA.value == '')
        {
                alert('Prego inserisci data partenza');
                document.theform.dataA.focus();
                return false;
        }
        if(document.theform.nome.value == '')
        {
                alert('Prego inserisci nome');
                document.theform.nome.focus();
                return false;
        }
        if(document.theform.cognome.value == '')
        {
                alert('Prego inserisci cognome');
                document.theform.cognome.focus();
                return false;
        }
        if(document.theform.citta.value == '')
        {
                alert('Prego inserisci citta');
                document.theform.citta.focus();
                return false;
        }
        if(document.theform.email.value == '')
        {
                alert('Prego inserisci email');
                document.theform.citta.focus();
                return false;
        }
        if(document.theform.numerocamere.value == '')
        {
                alert('Prego inserisci numero camere');
                document.theform.citta.focus();
                return false;
        }
        if(document.theform.adulti.value == '')
        {
                alert('Prego inserisci numero adulti');
                document.theform.citta.focus();
                return false;
        }
        if(document.theform.bambini.value == '')
        {
                alert('Prego inserisci numero bambini');
                document.theform.citta.focus();
                return false;
        }

        return true;
}

function lookup(inputString) {
                if(inputString.length == 0) {
                        // Hide the suggestion box.
                        $('#suggestions').hide();
                } else {
                        $.post("citta.php", {queryString: ""+inputString+""}, function(data){
                                if(data.length >0) {
                                        $('#suggestions').show();
                                        $('#autoSuggestionsList').html(data);
                                }
                        });
                }
        } // lookup

        function fill(thisValue) {
                $('#inputString').val(thisValue);
                setTimeout("$('#suggestions').hide();", 200);
        }

function setta(cosa){
  document.getElementById('slideShow1').innerHTML='<img src='+cosa+'>';
}

function v_caricapersone(uno,due,tre,quantecamere,id){
document.location.href='/html/vedi_hotel.php?datap='+due+'&dataa='+tre+'&c='+uno+'&quantec='+quantecamere+'&id='+id+'#pr';
}

function v_caricapersone2(uno,due,tre,tipocamera1,quantecamere,id,personen){
document.location.href='/html/vedi_hotel.php?datap='+due+'&dataa='+tre+'&c2='+uno+'&c='+tipocamera1+'&quantec='+quantecamere+'&id='+id+'&personen='+personen+'#pr';
}

function v_caricapersone3(uno,due,tre,tipocamera1,tipocamera2,quantecamere,id,personen,personen2){
document.location.href='/html/vedi_hotel.php?datap='+due+'&dataa='+tre+'&c3='+uno+'&c='+tipocamera1+'&c2='+tipocamera2+'&quantec='+quantecamere+'&id='+id+'&personen='+personen+'&personen2='+personen2+'#pr';
}
