');
$('#lightbox_gallery').die('mouseenter');
$('#lightbox_gallery').live('mouseenter', function()
{
if(fb)console.log('#lightbox_gallery mouseenter');
t_close_lightbox = false;
});
$('#lightbox_gallery').die('mouseleave');
$('#lightbox_gallery').live('mouseleave', function()
{
if(fb)console.log('#lightbox_gallery mouseleave');
t_close_lightbox = true;
});
$('body').click(function()
{
if(t_close_lightbox && typeof(gm_style_edit_mode_running) == 'undefined')
{
gmLightBox.close_box();
}
});
// centering thumbnails
var t_thumbnails_width = 0;
var t_thumbnail_width = Number($('#lightbox_gallery .thumbnail').css('width').replace('px', ''))
+ Number($('#lightbox_gallery .thumbnail').css('margin-right').replace('px', ''))
+ Number($('#lightbox_gallery .thumbnail').css('padding-left').replace('px', ''))
+ Number($('#lightbox_gallery .thumbnail').css('padding-right').replace('px', ''))
+ Number($('#lightbox_gallery .thumbnail').css('border-left-width').replace('px', ''))
+ Number($('#lightbox_gallery .thumbnail').css('border-right-width').replace('px', ''));
var t_gallery_width = Number($('#lightbox_gallery').css('width').replace('px', ''));
t_thumbnails_width = $('#lightbox_gallery .thumbnail').length * t_thumbnail_width;
if(t_gallery_width < t_thumbnails_width)
{
var t_thumbnails_per_row = Math.floor(t_gallery_width / t_thumbnail_width);
t_thumbnails_width = t_thumbnails_per_row * t_thumbnail_width;
}
$('#lightbox_gallery_thumbnails').css('width', t_thumbnails_width + 'px');
var t_active_image = 0;
var count_thumbnails = 0;
$('.gallery .thumbnails .button_product_images').each(function()
{
if($(this).attr('class').search('active_thumbnail') != -1)
{
t_active_image = count_thumbnails;
}
count_thumbnails++;
});
$('#lightbox_gallery_main').css('background-image', 'url(' + $('#lightbox_gallery .thumbnail a').eq(t_active_image).attr('href') + ')');
$('#lightbox_gallery .thumbnail').eq(t_active_image).addClass('lightbox_thumbnail_active');
$('#lightbox_gallery .thumbnail a').die('click');
$('#lightbox_gallery .thumbnail a').live('click', function()
{
if(fb)console.log('#lightbox_gallery .thumbnail a click');
$('#lightbox_gallery .thumbnail').removeClass('lightbox_thumbnail_active');
$(this).parent().addClass('lightbox_thumbnail_active');
var t_popup_image_url = $(this).attr('href');
$('#lightbox_gallery_main').css('background-image', 'url(' + t_popup_image_url + ')');
coo_this.update_navigation(true);
return false;
});
$('#lightbox_gallery .lightbox_gallery_left, #lightbox_gallery .lightbox_gallery_left a').unbind('click');
$('#lightbox_gallery .lightbox_gallery_left, #lightbox_gallery .lightbox_gallery_left a').click(function()
{
if(fb)console.log('#lightbox_gallery .lightbox_gallery_left, #lightbox_gallery .lightbox_gallery_left a click');
var t_current_image = $('#lightbox_gallery_main').css('background-image').replace('url("', '').replace('")', '');
var t_previous_image = '';
var t_previous_element = null;
var t_updated_image = false;
$('#lightbox_gallery .thumbnail a').each(function()
{
if(t_current_image.search($(this).attr('href')) != -1)
{
if(t_previous_image != '')
{
$('#lightbox_gallery_main').css('background-image', 'url(' + t_previous_image + ')');
$('#lightbox_gallery .thumbnail').removeClass('lightbox_thumbnail_active');
$(t_previous_element).parent().addClass('lightbox_thumbnail_active');
t_updated_image = true;
}
}
else
{
t_previous_image = $(this).attr('href');
t_previous_element = this;
}
});
if(t_updated_image == false)
{
$('#lightbox_gallery_main').css('background-image', 'url(' + $('#lightbox_gallery .thumbnail a').eq($('#lightbox_gallery .thumbnail a').length - 1).attr('href') + ')');
$('#lightbox_gallery .thumbnail').removeClass('lightbox_thumbnail_active');
$('#lightbox_gallery .thumbnail a').eq($('#lightbox_gallery .thumbnail a').length - 1).parent().addClass('lightbox_thumbnail_active');
}
coo_this.update_navigation(true);
return false;
});
$('#lightbox_gallery .lightbox_gallery_right, #lightbox_gallery .lightbox_gallery_right a').unbind('click');
$('#lightbox_gallery .lightbox_gallery_right, #lightbox_gallery .lightbox_gallery_right a').click(function()
{
if(fb)console.log('#lightbox_gallery .lightbox_gallery_right, #lightbox_gallery .lightbox_gallery_right a click');
var t_current_image = $('#lightbox_gallery_main').css('background-image').replace('url("', '').replace('")', '');
var t_current_image_reached = false;
var t_updated_image = false;
$('#lightbox_gallery .thumbnail a').each(function()
{
if(t_current_image_reached == true)
{
$('#lightbox_gallery_main').css('background-image', 'url(' + $(this).attr('href') + ')');
$('#lightbox_gallery .thumbnail').removeClass('lightbox_thumbnail_active');
$(this).parent().addClass('lightbox_thumbnail_active');
t_current_image_reached = false;
t_updated_image = true;
}
if(t_current_image.search($(this).attr('href')) != -1)
{
t_current_image_reached = true;
}
});
if(t_updated_image == false)
{
$('#lightbox_gallery_main').css('background-image', 'url(' + $('#lightbox_gallery .thumbnail a').eq(0).attr('href') + ')');
$('#lightbox_gallery .thumbnail').removeClass('lightbox_thumbnail_active');
$('#lightbox_gallery .thumbnail a').eq(0).parent().addClass('lightbox_thumbnail_active');
}
coo_this.update_navigation(true);
return false;
});
var t_right_mouseover = false;
// BOF previous image
$('#lightbox_gallery .lightbox_gallery_left').die('mouseover');
$('#lightbox_gallery .lightbox_gallery_left').live('mouseover', function()
{
if(fb)console.log('#lightbox_gallery .lightbox_gallery_left mouseover');
if(!t_right_mouseover)
{
$('.icon_gallery_back').addClass('icon_gallery_back_active');
$('.icon_gallery_next').removeClass('icon_gallery_next_active');
}
});
$('#lightbox_gallery .lightbox_gallery_left').die('mouseout');
$('#lightbox_gallery .lightbox_gallery_left').live('mouseout', function()
{
if(fb)console.log('#lightbox_gallery .lightbox_gallery_left mouseout');
$('.icon_gallery_back').removeClass('icon_gallery_back_active');
});
// EOF previous image
// BOF next image
$('#lightbox_gallery .lightbox_gallery_right').die('mouseover');
$('#lightbox_gallery .lightbox_gallery_right').live('mouseover', function()
{
if(fb)console.log('#lightbox_gallery .lightbox_gallery_right mouseover');
t_right_mouseover = true;
$('.icon_gallery_next').addClass('icon_gallery_next_active');
$('.icon_gallery_back').removeClass('icon_gallery_back_active');
});
$('#lightbox_gallery .lightbox_gallery_right').die('mouseout');
$('#lightbox_gallery .lightbox_gallery_right').live('mouseout', function()
{
if(fb)console.log('#lightbox_gallery .lightbox_gallery_right mouseout');
t_right_mouseover = false;
$('.icon_gallery_next').removeClass('icon_gallery_next_active');
});
// EOF next image
// BOF close
$('#lightbox_gallery .icon_lightbox_close').die('click');
$('#lightbox_gallery .icon_lightbox_close').live('click', function()
{
if(fb)console.log('#lightbox_gallery .icon_lightbox_close click');
gmLightBox.close_box();
return false;
});
// EOF close
coo_this.update_navigation(true);
}
this.update_navigation = function(p_loop)
{
if(p_loop == false)
{
if($('#lightbox_gallery_main').css('background-image').replace('url("', '').replace('")', '').search($('#lightbox_gallery .thumbnail a').eq(0).attr('href')) != -1)
{
$('#lightbox_gallery .lightbox_gallery_left').css('visibility', 'hidden');
}
else
{
$('#lightbox_gallery .lightbox_gallery_left').css('visibility', 'visible');
}
if($('#lightbox_gallery_main').css('background-image').replace('url("', '').replace('")', '').search($('#lightbox_gallery .thumbnail a').eq($('#lightbox_gallery .thumbnail a').length-1).attr('href')) != -1)
{
$('#lightbox_gallery .lightbox_gallery_right').css('visibility', 'hidden');
}
else
{
$('#lightbox_gallery .lightbox_gallery_right').css('visibility', 'visible');
}
}
else
{
if($('#lightbox_gallery_thumbnails .thumbnail').length > 1)
{
$('#lightbox_gallery .lightbox_gallery_left, #lightbox_gallery .lightbox_gallery_right').css('visibility', 'visible');
}
else
{
$('#lightbox_gallery_thumbnails').hide();
}
}
}
this.preload = function()
{
var t_images = new Array();
var count_thumbnails = 0;
$('#lightbox_gallery .thumbnail a').each(function()
{
t_images[count_thumbnails] = new Image();
t_images[count_thumbnails].src = $(this).attr('href');
count_thumbnails++;
});
}
this.init_binds();
}
/**/
/* ButtonDetailsAddCartHandler.js */
/**/
function ButtonDetailsAddCartHandler()
{
if(fb)console.log('ButtonDetailsAddCartHandler ready');
this.init_binds = function()
{
if(fb)console.log('ButtonDetailsAddCartHandler init_binds');
$('.button_details_add_cart').die('click');
$('.button_details_add_cart').live('click', function(event)
{
if(fb)console.log('.button_details_add_cart click');
gm_qty_check = new GMOrderQuantityChecker();
if(gm_qty_check.check())
{
var t_operation_form = $(this).closest('form');
coo_cart_control.submit_buy_now_form(t_operation_form);
}
return false;
});
$('.button_details_add_cart').closest('form').submit(function()
{
gm_qty_check = new GMOrderQuantityChecker();
if(gm_qty_check.check())
{
coo_cart_control.submit_buy_now_form(this);
}
return false;
});
}
this.init_binds();
}
/**//* CombiStatusCheck.js */
/**/
function CombiStatusCheck()
{
$(document).ready(
function()
{
if(fb)console.log('CombiStatusCheck ready');
}
);
this.last_result_json = false;
this.get_combi_status_by_ext_products_id = function(p_extended_products_id, p_need_qty)
{
if(fb)console.log('CombiStatusCheck get_combi_status_by_ext_products_id '+ p_extended_products_id);
var coo_this = this;
var t_sep_found = p_extended_products_id.search(/x/);
if(t_sep_found == -1)
{
if(fb)console.log('t_sep_found -1');
// no seperator found. unextended products_id
return false;
}
if(fb)console.log('t_sep_found TRUE');
var t_id_array = p_extended_products_id.split('x');
var t_combis_id = t_id_array[1];
var t_transfer_data = [];
t_transfer_data.push('module=properties_combis_status_by_combis_id');
t_transfer_data.push('combis_id=' + escape(t_combis_id));
t_transfer_data.push('need_qty=' + escape(p_need_qty));
$.ajax({
url: 'request_port.php',
data: t_transfer_data.join('&'),
dataType: 'json',
async: false,
success: function(p_data)
{
if(fb)console.log('CombiStatusCheck get_combi_status_by_ext_products_id: ' + p_data['STATUS_CODE'] +' '+ p_data['STATUS_TEXT']);
coo_this.last_result_json = p_data;
}
});
}
this.get_combi_status = function(p_products_id, p_properties_values_id_array, p_need_qty)
{
if(fb)console.log('CombiStatusCheck get_combi_status');
var coo_this = this;
var send_ajax_request = true;
var t_transfer_data = [];
t_transfer_data.push('module=properties_combis_status');
t_transfer_data.push('products_id=' + escape(p_products_id));
t_transfer_data.push('need_qty=' + escape(p_need_qty));
if(typeof p_properties_values_id_array != 'object')
{
if(fb)console.log('ERROR CombiStatusCheck get_combi_status: p_properties_values_id_array not an Array!');
send_ajax_request = false;
}
else
{
for(var i=0; i
0) {
var t_need_qty = $('#gm_attr_calc_qty').val();
// get combi status and write to page
coo_combi_status_check.get_combi_status(t_products_id, t_value_ids_array, t_need_qty);
// $('#properties_info_text').html(t_status_json['STATUS_TEXT']);
}
}
}
/**/
/* ButtonDetailsAddWishlistHandler.js */
/**/
function ButtonDetailsAddWishlistHandler()
{
if(fb)console.log('ButtonDetailsAddWishlistHandler ready');
this.init_binds = function()
{
if(fb)console.log('ButtonDetailsAddWishlistHandler init_binds');
if($('#gm_gprint').length == 0)
{
$('.button_details_add_wishlist').die('click');
$('.button_details_add_wishlist').live('click', function(event)
{
if(fb)console.log('.button_details_add_wishlist click');
document.cart_quantity.submit_target.value = "wishlist";
document.cart_quantity.submit();
return false;
});
}
}
this.init_binds();
}
/**/