function runOnLoad(f) {
if (runOnLoad.loaded) f(); // If already loaded, just invoke f() now.
else runOnLoad.funcs.push(f); // Otherwise, store it for later
}
runOnLoad.funcs = []; // The array of functions to call when the document loads
runOnLoad.loaded = false; // The functions have not been run yet.
runOnLoad.run = function() {
if (runOnLoad.loaded) return; // If we've already run, do nothing
for(var i = 0; i < runOnLoad.funcs.length; i++) {
try { runOnLoad.funcs[i](); }
catch(e) { /* An exception in one function shouldn't stop the rest */ }
}
runOnLoad.loaded = true; // Remember that we've already run once.
delete runOnLoad.funcs; // But don't remember the functions themselves.
delete runOnLoad.run; // And forget about this function too!
};
if (window.addEventListener)
window.addEventListener("load", runOnLoad.run, false);
else if (window.attachEvent) window.attachEvent("onload", runOnLoad.run);
else window.onload = runOnLoad.run;
function calc_left (w) {
var left = (screen.availWidth / 2) - (w / 2);
return (left);
}
function calc_top (h) {
var top = (screen.availHeight / 2) - (h / 2);
return (top);
}
function open_popup (url, w, h, scrollbar,toolbar,status,menubar,id) {
//alert(scrollbar)
if(!scrollbar){scrollbar = 'no'}
if(!toolbar){toolbar = 'no'}
if(!status){status = 'no'}
if(!menubar){menubar = 'no'}
if(!id){id = ''}
var top = calc_top (h);
var left = calc_left (w);
popup = window.open (url,id,'width='+w+',height='+h+',left='+left+',top='+top+',screenX='+left+',screenY='+top+'status='+status+', menubar='+menubar+', toolbar='+toolbar+', scrollbars='+scrollbar);
popup.focus();
}
function updateScrollArea()
{
$('#scrollDiv').jScrollPane({showArrows:true, arrowSize: 16});
}
function showHide(divId,ramo)
{
infoTemp = ramo.split("_");
if(infoTemp[1]){livMenu = 2;}else{livMenu = 1;}
$("ul[id^='ul_'][id!='ul_"+infoTemp[0]+"']").slideUp("normal");
$("li[id^='li_'][class*='liv2']").css('background','url(/_data/comuni/img/collezioni/catLiv2_close.gif) no-repeat 0px 3px');
if(livMenu==1)
{
$("li[id^='li_'][class*='liv1']").css('background','url(/_data/comuni/img/collezioni/catLiv1_close.gif) no-repeat ');
}
else if(livMenu==2)
{
$("li[id^='li_'][class*='liv2']").css('background','url(/_data/comuni/img/collezioni/catLiv2_close.gif) no-repeat 0px 3px');
}
if ($(divId).is(":hidden")) {
$(divId).slideDown("normal");
$('#li_'+ramo).css('background-image','url(/_data/comuni/img/collezioni/catLiv'+livMenu+'_open.gif)');
} else {
$(divId).slideUp("normal");
$('#li_'+ramo).css('background-image','url(/_data/comuni/img/collezioni/catLiv'+livMenu+'_close.gif)');
}
if(livMenu==1)
{
setTimeout("updateScrollArea()",1000);
}
}
function grafico(vars)
{
$.ajax({
type: "GET",
url: vars,
success: function(msg){
$('#grafico').html(msg);
$('#grafico').css('display','block');
}
});
}
function confronta(codProd)
{
$.ajax({
type: "GET",
url: '/_data/comuni/php/setConfronta.php?codProd='+codProd,
success: function(msg){
msgTemp = msg.split('###');
if(msgTemp[1])
{
dialog(msgTemp[1],'',200,100,'txt')
//alert(msgTemp[1])
}
$('#prod'+codProd).html(msgTemp[0]);
}
});
focus(0);
}
function svuotaConfronta(codProd)
{
$.ajax({
type: "GET",
url: '/_data/comuni/php/setConfronta.php?svuota=true&codProd='+codProd,
success: function(msg){
msgTemp = msg.split('###');
if(msgTemp[1])
{
dialog(msgTemp[1],'',200,100,'txt')
}
$('#prod'+codProd).html(msgTemp[0]);
}
});
focus(0);
}
function aggiornaSelezionati(codProd)
{
for(i=0;i<=codProd.length;i++)
{
$('#prod'+codProd[i]).html('
');
}
}
function init_store_scroll()
{
$(function()
{
var $scrollmenu = $('#scrollDiv');
$scrollmenu.jScrollPane({showArrows:true, arrowSize: 16});
})
}
function citta(nazione)
{
tempTipo = nazione.split('###');
if (tempTipo[1])
if (tempTipo[1] == 'FLAG' || tempTipo[1] == 'SHOP' || tempTipo[1] == 'CORNER')
{tipo = tempTipo[1];}
else
{tipo = ''}
naz = tempTipo[0];
$.ajax({
type: "GET",
url: '/_data/comuni/php/estrai_citta.php?nazione='+naz+'&tipo='+tipo,
success: function(msg){
$('#div_detail_store').slideUp();
$('#td_negozio').slideUp();
$('#td_citta').fadeIn();
$('#td_citta').html(msg);
}
});
}
function elenco_negozi(temp_str)
{
tempTipo = temp_str.split('###');
if (tempTipo[2])
{tipo = tempTipo[2];}
else
{tipo = ''}
naz = tempTipo[1];
cit = tempTipo[0];
//alert('estrai_negozi.php?nazione='+naz+'&tipo='+tipo+'&cit='+cit);
$.ajax({
type: "GET",
url: '/_data/comuni/php/estrai_negozi.php?nazione='+naz+'&tipo='+tipo+'&cit='+cit,
success: function(msg){
$('#div_detail_store').fadeOut();
$('#td_negozio').hide();
$('#td_negozio').fadeIn();
$('#td_negozio').html(msg);
init_store_scroll();
}
});
}
function store_details(idstore)
{
//alert('dettaglio_negozi.php?id='+idstore);
$.ajax({
type: "GET",
url: '/_data/comuni/php/dettaglio_negozi.php?id='+idstore,
success: function(msg){
//$('#div_detail_store').hide(); // decommentare per evidenziare il cambiamento di selezione del negozio (Il tettaglio scompare e riappare)
$('#div_detail_store').fadeIn();
$('#div_detail_store').html(msg);
}
});
}
function div_close_description()
{
$('#div_detail_store').slideUp();
}
function div_close_list()
{
$('#div_detail_store').slideUp();
$('#td_negozio').slideUp();
}
function updatePage(url)
{
updateMenu(url);
updateProducts(url);
$('img[@src$=.png]').ifixpng();
focus(0);
}
function updateMenu(url)
{
infoTemp = url.split("?");
parametri = infoTemp[1];
pathTemp = infoTemp[0].split("/");
categoria = pathTemp[((pathTemp.length)-2)];
$.ajax({
type: "GET",
url: '/_data/comuni/inc/collezioni/'+categoria+'/menu.inc.php?'+parametri,
success: function(msg){
$("#menuCatalogo").fadeIn("fast",function(){$('#menuCatalogo').html(msg)});
$('#scrollDiv').jScrollPane({showArrows:true, arrowSize: 16});
}
});
}
function updateProducts(url)
{
infoTemp = url.split("?");
parametri = infoTemp[1];
$.ajax({
type: "GET",
url: '/_data/comuni/inc/collezioni/elenco_prodotti.inc.php?'+parametri,
success: function(msg){
$('#elencoProd').html(msg);
$('img[@src$=.png]').ifixpng();
//$("#elencoProd").fadeOut("fast",function(){$("#elencoProd").fadeIn("fast")});
}
});
updatePaginatore(url);
}
function updatePaginatore(url)
{
infoTemp = url.split("?");
parametri = infoTemp[1];
$.ajax({
type: "GET",
url: '/_data/comuni/inc/collezioni/paginatore.inc.php?'+parametri,
success: function(msg){
$('#paginatore').html(msg);
}
});
}
function dettaglio(url)
{
infoTemp = url.split("?");
parametri = infoTemp[1];
//alert(parametri);
$.ajax({
type: "GET",
url: '/_data/comuni/inc/collezioni/dettaglio.inc.php?aj=on&'+parametri,
success: function(msg){
$('#dettaglio').show();
$('#dettaglio').html(msg);
//$('#immagineProdotto').html(''+flashImmagineProdotto);
$('#catalogo').hide();
loadProdotto();
initAll(url);
}
});
}
function eliminaProd(url)
{
infoTemp = url.split("?");
parametri = infoTemp[1];
infoTemp = parametri.split("=");
$.ajax({
type: "GET",
url: url+'&aj=on',
success: function(msg){
$(".info_"+infoTemp[1]).fadeOut();
window.opener.$("#prod"+infoTemp[1]).html('
');
}
});
}
function nascondiDettaglio(url)
{
$('#dettaglio').hide();
$('#catalogo').show();
//$('#dettaglio').fadeOut('slow',function(){$('#catalogo').fadeIn('slow')});
$('#scrollDiv').show();
setTimeout("updateScrollArea()",1000);
$('img[@src$=.png]').ifixpng();
}
function openConfronta(url)
{
$.ajax({
type: "GET",
url: url+'?countProd=on&aj=on',
success: function(msg){
if(msg>0)
{
window.open(url,'confronta','width='+msg+',height=650,scrollbars=yes');
}
else
{
alert('');
}
}
});
}
function zoomImg(url)
{
$.ajax({
type: "GET",
url: url+'&dim=true',
success: function(msg){
//dialog(url,callback,width,height);
infoTemp = msg.split("||");
dialog(url,'',infoTemp[0],infoTemp[1])
// window.open(url,'zoom',msg+',scrollbars=yes');
}
});
}
function __dialog(more,callback,w,h)
{
$.ajax({
type: "GET",
url: more,
success: function(msg){
$('#ex2').html(msg);
$('#ex2').jqm().jqmShow().jqDrag();
if(callback){
setTimeout(callback,100);}
}
});
}
function dialog(content,callback,width,height,type) {
if(!type){type="url";}
$("#ex2").css("width",width+"px");
$("#ex2").css("height",height+"px");
$("#ex2").css("top","50%");
$("#ex2").css("margin-top","-"+(height/2)+"px");
$("#ex2").css("margin-left","-"+(width/2)+"px");
$("#ex2").html("
loading... |