// JavaScript Document
var ajax = new NS_Ajax();
window.onload = function(){
	try{
		GF.ShowZonegeo(false);
	}catch(e){}
	
	if(Start){
		Start();
	}
}
function Mappa(o){ //questa funzione permette l'uso delle mappe di oggetti anche in document XHTML 1.1
	var um = o.useMap;
	if(um.substr(0,1)!='#'){
		o.usemap=o.useMap='#'+um;
		if(l=$(um)) l.name=um;
	}
}
/*
function openBalloon(id,show){
	var o=$('BaloonRicerca'+id);
	if(show){
		o.Active=true;
		NS_fade(o,0,100,0.2);
	}else if(!show && o.Active){
		o.Active=false;
		NS_fade(o,100,0,0.2);
	}
}
*/
var openBalloon = {
	ajax: new NS_Ajax(),
	
	Show: function(id,_root,_lingua){
		this.ajax.Reset();
		this.ajax.Send("az=15&id_sr="+id+"&lang="+_lingua,_root+"_ext/scripts/ajax_services.php","post",{ callback: "Show_step2", obj: this, arg: new Array(id,0) });
	},
	Show_step2: function(id){
		var o = $('BaloonRicerca'+id);
		o.Active = true;
		o.innerHTML = this.ajax.text;
		NS_fade(o,0,100,0.2);
	},
	Hide: function(id){
		var o = $('BaloonRicerca'+id);
		if(o.Active){
			o.Active = false;
			NS_fade(o,100,0,0.2);
		}
	}
	
};
var verifySimpleSearch = {
	msg: "",//settare tramite riprendendo i dati da php
	Start: function(){
		var id_p = $('id_p').options[$('id_p').options.selectedIndex].value;
		var key = $('keyword').value;
		if(id_p=="" && key.length==0){
			alert( this.msg );
			return false;
		}
		return true;
	}
};
var setCheckDate = {
	checkin_var: null, //settare il nome della variabile di checkin (senza virgolette, dev'essere l'oggetto javascript)
	checkout_var: null, //settare il nome della variabile di checkout (senza virgolette, dev'essere l'oggetto javascript)
	base_path: "/",
	ajax: new NS_Ajax(),
	Set_CheckOut: function(checkin){
		var tmp = checkin.split("-");
		checkin = tmp[2]+"-"+tmp[1]+"-"+tmp[0];
		var checkout = $( this.checkout_var.id ).value;
		this.ajax.Reset();
		this.ajax.Send("az=12&type=setcheckout&checkin="+checkin+"&checkout="+checkout,this.base_path+"_ext/scripts/ajax_services.php","post",{obj: this, callback: "rSet_Checkout"});
	},
	rSet_Checkout: function(){
		this.checkout_var.selData(this.checkout_var.id, this.ajax.text);
	},
	Set_CheckIn: function(checkout){
		var tmp = checkout.split("-");
		checkout = tmp[2]+"-"+tmp[1]+"-"+tmp[0];
		var checkin = $( this.checkin_var.id ).value;
		this.ajax.Reset();
		this.ajax.Send("az=12&type=setcheckin&checkin="+checkin+"&checkout="+checkout,this.base_path+"_ext/scripts/ajax_services.php","post",{obj: this, callback: "rSet_CheckIn"});
	},
	rSet_CheckIn: function(){
		this.checkin_var.selData(this.checkin_var.id, this.ajax.text);
	}
};
