/**
Cambia la visualizzazione dei servizi di una struttura, passando da modalità testuale ad icone e viceversa.
*/
function switchServicesView() {
var services = $('.services:first');
var oldClass = services.hasClass('icons') ? 'icons' : 'list';
var newClass = (oldClass == 'icons' ? 'list' : 'icons');
$.ajax({
type: "POST",
url: "/requests/ajax/prefs.asp",
dataType: "application/x-www-form-urlencoded",
data: "pref=servicestyle&val=" + newClass,
async: false,
success: function(){ location.reload(true); }
});
}
/**
Effettua una richiesta asincrona per aggiungere o rimuovere una struttura da 'la mia scelta'.
@param id id della struttura
@param op operazione ('add', 'remove')
*/
function myChoiceAction(id, op) {
$.ajax({
type:"POST",
url: "/requests/ajax/mychoice.asp",
dataType: "application/x-www-form-urlencoded",
data: "action=" + op + "&id=" + id,
async: false,
success: function(msg){
var cssClass = $('#mychoice-' + id).attr('class').replace('-add', '').replace('-remove', '');
$("#mychoice-" + id).replaceWith('' + msg + '');
var myChoiceCount = $('#mychoice-count');
if(op == 'add') {
myChoiceCount.html(parseInt(myChoiceCount.html()) + 1);
} else {
myChoiceCount.html(parseInt(myChoiceCount.html()) - 1);
}
}
});
return false;
}
function myChoiceMassAction(op) {
var myChoiceButtons = $('a.mychoice-' + op);
var ids = [];
myChoiceButtons.each(function() {
ids.push($(this).attr('id').replace('mychoice-', ''));
});
if(ids.length == 0) return false;
$.ajax({
type:"POST",
url: "/requests/ajax/mychoice.asp",
dataType: "application/x-www-form-urlencoded",
data: "action=" + op + "&id=" + ids.join(','),
async: false,
success: function(msg){
var i, id;
for(i=0;i' + msg + '');
}
var myChoiceCount = $('#mychoice-count');
if(op == 'add') {
myChoiceCount.html(parseInt(myChoiceCount.html()) + ids.length);
} else {
myChoiceCount.html(parseInt(myChoiceCount.html()) - ids.length);
}
}
});
return false;
}
/**
Registra un'azione (mi piace, non mi piace, non mi interessa) per una curiosità.
@param id id della curiosità
@param op operazione ('like', 'dislike', 'uninteresting')
*/
function hintsAction(id, op) {
$.ajax({
type:"POST",
url: "/requests/ajax/hints.asp",
dataType: "application/x-www-form-urlencoded",
data: "action=" + op + "&id=" + id,
async: false,
success: function(msg){ $(".hint .actions").html(msg); }
});
return false;
}
/**
Richiede la spedizione via email della vcard di una struttura.
@param id id della struttura
*/
function vCardRequest(id) {
$.ajax({
type:"POST",
url: "/requests/vcard.asp",
dataType: "application/x-www-form-urlencoded",
data: "id=" + id + "&vcard-email=" + $('#vcard-email').val(),
async: false,
success: function(msg){
$('#vcard-result').html(msg);
$('#vcard-submit').hide();
}
});
return false;
}
/**
Ottiene il numero di telefono dell'operatore che ha pubblicato l'annuncio immobiliare.
@param id id dell'annuncio
@param oid id dell'operatore
@param tel nome della colonna a db del numero di telefono che si vuole
*/
function getAdContact(id, oid, tel) {
$.ajax({
type:"POST",
url: "/requests/ajax/advertisings.asp",
dataType: "application/x-www-form-urlencoded",
data: "id=" + id + "&oid=" + oid + "&tel=" + tel,
async: false,
success: function(msg){ $('#' + tel).html(msg); }
});
return false;
}
/**
Cambia il mese di inizio del calendario disponibilità di una struttura.
@param id id della struttura
@param month mese di partenza
@param year anno di partenza
@see availabilitySwitcherEnable(), functions.js
*/
function availabilitySwitch(id, month, year) {
$.ajax({
type:"POST",
url: "/requests/ajax/availability.asp",
dataType: "application/x-www-form-urlencoded",
data: "id=" + id + "&month=" + month + "&year=" + year,
async: false,
success: function(msg){ $('#availability').html(msg); }
});
return false;
}
/**
Cambia la lista dei servizi in base al tipo di struttura nella ricerca avanzata.
@param id id del tipo di struttura
@see structureTypeServicesSwitcherEnable(), functions.js
*/
function structureTypeServicesSwitch(id) {
$.ajax({
type:"POST",
url: "/requests/ajax/structuretype-services.asp",
dataType: "application/x-www-form-urlencoded;charset=ISO-8859-1",
data: "id=" + id + "&type=base",
async: false,
success: function(msg){ $('#services').html(msg); }
});
$.ajax({
type:"POST",
url: "/requests/ajax/structuretype-services.asp",
dataType: "application/x-www-form-urlencoded;charset=ISO-8859-1",
data: "id=" + id + "&type=more",
async: false,
success: function(msg){ $('#more-services').html(msg); }
});
return false;
}
/**
Incrementa un contatore di una struttura
@param sid id della struttura
@param cid id del tipo di contatore
*/
function updateStats(sid, cid) {
$.ajax({
type:"POST",
url: "/requests/ajax/stats.asp",
dataType: "application/x-www-form-urlencoded",
data: "sid=" + sid + "&cid=" + cid,
async: false
});
return false;
};