$.sitevars = {};
$.sitevars.divOnViewByGallery = null;
window.processGalleries = function() {
$('.photogallery:not(.processed)').each(function() {
var context = $(this),
contLeft = $('.container-left', context),
contRight = $('.container-right', context),
remember;
context.addClass('processed');
context.prev('a:first').click(function(E){
E.preventDefault();
context.show();
//context.css("z-index","40000");
//var toClick=($('.gallery > img', context)[0].id);
var toClick=((($('.gallery > img', context)[0] && $('.gallery > img', context)[0].id)?($('.gallery > img', context)[0].id):($('.related-prod > img', context)[0].id)));
$('#'+toClick).click();
//remember = $('.ul-wrap.active').hide()[0].id;
if($('.ul-wrap.active')[0])
{
remember = $('.ul-wrap.active')[0].id;
$('#'+remember).css("z-index","-10");
}
//$('#'+remember+" > div").css("z-index","-10");
$.sitevars.divOnViewByGallery = remember;
var scrollpane = $('.ayilu-scrollpane', context);
if (scrollpane.outerHeight() > 0) {
scrollpane.jScrollPane({
showArrows: true,
scrollbarWidth: 10,
dragMaxHeight: 73,
height: 150
});;
}
});
var gallery_title = context.parents('ul:first')
.prev('h2:first').clone()
.addClass('prev-title');
var imgs = contLeft.find('img').click(function(E) {
var idstr = new String(this.id);
var id_p = idstr.substring(7,8);
var tmp_start_str_id = idstr.substring(7);
id_p = tmp_start_str_id;
var first_minus_pos = tmp_start_str_id.search("-");
if(first_minus_pos && first_minus_pos != -1)
{
id_p = tmp_start_str_id.substring(0,first_minus_pos);
}
var str_pic_pos = idstr.search("pic");
var current_img_index = 1;
if(str_pic_pos && str_pic_pos != -1)
{
current_img_index = idstr.substring(parseInt(str_pic_pos)+3);
}
var product = getProductDataById(id_p,productsData);
//imgs.removeClass('active');
//var self = $(this).addClass('active');
imgs.removeClass('active');
var self = $(this).addClass('active'),
big = self.attr('data-big'),
title = self.attr('data-title')
author_img = self.attr('data-author-img'),
author_name = self.attr('data-author-name'),
dwg = self.attr('data-DWG'),
file_scarica = self.attr('data-File-scarica'),
sfoglia = self.attr('data-Sfoglia'),
sfoglia_dim = self.attr('data-Sfoglia-dim'),
prod_correlato_id = self.attr('data-prod-correlato-id'),
prod_correlato_chk = self.attr('data-prod-correlato-chk');
/*
var bigImage = $('').attr({
src: big,
title: title
});
contRight.html('')
.append(gallery_title)
.append($('

'+author_name+' |
'+author_name+' |
'+author_name+' |
'+((author_name && author_name != "undefined")?(author_name):(" "))+' |