$(function()
{
if ( $('#mycarousel').length > 0 ) $('#mycarousel').jcarousel({ scroll: 4 });
$('.imgsmall').click(function()
{
var strImgL = $(this).attr('href');
var strImgXL = $(this).attr('name');
var strTitolo = $(this).attr('title');
$('.imgmain > img').hide();
$('#zoomloader').html(' Caricamento dettagli...');
$('.imgmain > div').remove();
$('.mojozoom_imgctr').remove();
$('.ingrandisci > a').attr('href','javascript:void(0);');
var img = new Image();
$(img).load(function()
{
$('.imgmain > img').attr( 'src', strImgL );
$('.imgmain > img').attr( 'alt', strTitolo );
$('.imgmain > img').attr( 'data-zoomsrc', strImgXL );
$('.imgmain > img').show();
var imgXL = new Image();
$(imgXL).load(function()
{
MojoZoom.init();
$('#zoomloader').html( 'Muovi il mouse sulla foto per i dettagli.' );
}).attr('src', strImgXL);
}).attr('src', strImgL);
$('.ingrandisci > a').attr('href',strImgXL);
return false;
});
fCostruisciProdottiCorrelati();
});
function fCaricaPrimaImmagine( pstrImgL, pstrImgXL )
{
$('#zoomloader').html(' Caricamento dettagli...');
var img = new Image();
$(img).load(function()
{
$('.imgmain > img').show();
var imgXL = new Image();
$(imgXL).load(function()
{
MojoZoom.init();
$('#zoomloader').html( 'Muovi il mouse sulla foto per i dettagli.' );
}).attr('src', pstrImgXL);
}).attr('src', pstrImgL);
}
// estrai html varianti in base al magazzino
function fCheckMagazzino( pstrID_Prodotto, pstrID_Taglia )
{
$('#preloadAcquista').html( '' );
$.ajax({
type: "POST",
async: false,
dataType: "json",
url: "/tpl/default/ajax/getProdottoMagazzino.php",
data: "action=getVarianti&pstrID_Lingua=it&pstrID_Prodotto="+pstrID_Prodotto+"&pstrID_Taglia="+pstrID_Taglia,
success: function(data){
strHTMLTaglie = data.html_taglie;
strHTMLColori = data.html_colori;
strTmp = data.status;
if ( data.status == 'ok' )
{
$('#boxTaglie').html( strHTMLTaglie ).buttonset();
$('#boxColori').html( strHTMLColori ).buttonset();
} else {
alert("Ricerca movimento non riuscita.");
}
},
error: function(data){
alert("errore: " + data);
}
});
$('#preloadAcquista').html( '' );
}
// crea html prodotti correlati
function fCostruisciProdottiCorrelati()
{
if ( $("#id_prodotto").val() != '' )
{
var strHTML = '';
$.ajax({
type: "POST",
async: false,
dataType: "json",
url: "/tpl/default/ajax/getProdottiCorrelati.php",
data: "action=getProdottiCorrelati"
+ "&pstrID_Lingua=it"
+ "&pstrID_Prodotto=" + $("#id_prodotto").val(),
success: function(data)
{
strHTML = data.html_correlati;
if ( data.status == 'ok' )
{
$('#prodotti_correlati_area').removeClass('pc_loader').html( data.html_correlati );
$('#prodotti_correlati').bxSlider({
mode: 'horizontal',
auto: true,
autoControls: false,
displaySlideQty: 6,
moveSlideQty: 1,
autoHover: true,
easing: 'swing'
});
} else {
alert("Ricerca prodotti non riuscita.");
}
},
error: function(data){
alert("errore: " + data);
}
});
$('#prodotti_correlati_area').removeClass('pc_loader');
}
else
{
$('#prodotti_correlati_area').hide();
}
}