var _____WB$wombat$assign$function_____=function(name){return (globalThis._wb_wombat && globalThis._wb_wombat.local_init && globalThis._wb_wombat.local_init(name))||globalThis[name];};if(!globalThis.__WB_pmw){globalThis.__WB_pmw=function(obj){this.__WB_source=obj;return this;}}{
let window = _____WB$wombat$assign$function_____("window");
let self = _____WB$wombat$assign$function_____("self");
let document = _____WB$wombat$assign$function_____("document");
let location = _____WB$wombat$assign$function_____("location");
let top = _____WB$wombat$assign$function_____("top");
let parent = _____WB$wombat$assign$function_____("parent");
let frames = _____WB$wombat$assign$function_____("frames");
let opener = _____WB$wombat$assign$function_____("opener");
/* FUNCTION TO PARSERIZE QUERY_STRING (USED FOR PRICE FILTER) */
function getQueryStrings() {
var assoc = {};
var decode = function (s) { return decodeURIComponent(s.replace(/\+/g, " ")); };
var queryString = location.search.substring(1);
var keyValues = queryString.split('&');
for(var i in keyValues) {
var key = keyValues[i].split('=');
if (key.length > 1) {
assoc[decode(key[0])] = decode(key[1]);
}
}
return assoc;
}
/*
var qs = getQueryStrings();
var myParam = qs["myParam"];
*/
/* ADDITIONAL METHOD "classadded" to know what class added to a DOM element */
(function($) {
var ev = new $.Event('classadded'),
orig = $.fn.addClass;
$.fn.addClass = function() {
$(this).trigger(ev, arguments);
return orig.apply(this, arguments);
}
})(jQuery);
/* ADDITIONAL METHOD "classadded" to know what class deleted to a DOM element */
(function($) {
var ev = new $.Event('classdeleted'),
orig = $.fn.removeClass;
$.fn.removeClass = function() {
$(this).trigger(ev, arguments);
return orig.apply(this, arguments);
}
})(jQuery);
/* FUNCTION TO FORMAT NUMBERS LIKE 1234567.789 INTO 1.234.567,789 */
function format_num(str,thousands_separator,decimals_separator){
var thousands_separator = thousands_separator == null ? '.' : thousands_separator,
decimals_separator = decimals_separator == null ? ',' : decimals_separator,
str = ''+str+''
, split_str = str.split('.')
, intero = split_str[0]
, decimale = split_str[1];
if ((new RegExp(/^\-/)).test(intero)){
var segno = '-'
, intero = intero.replace(/\-/g,'');
}else{
var segno = '';
}
if(decimale != null){
if(decimale.length == "1"){
var decimale = decimale+'0';
}else{
var decimale = decimale;
}
}else{
var decimale = '00';
}
var intero_inverse = ' '+intero.split("").reverse().join("")
, x = intero_inverse.split("")
, y = "";
for ( i= 0 ; i <= intero_inverse.length-1 ; i++ ){
if( i % 3 == 0 && i > 0 && i < intero_inverse.length-1){
var y = y + x[i]+thousands_separator;
}else{
var y = y + x[i];
}
}
numero_formattato = y.split("").reverse().join("").replace(/\s+$/,"")+decimals_separator+decimale;
return segno+numero_formattato;
}
/* function to cut off decimals with 1,2,3,4... digits eg:. tronca(2.543543,3) = 2.543 */
function left(str, n){
if (n <= 0)
return "";
else if (n > String(str).length)
return str;
else
return String(str).substring(0,n);
}
function tronca(c,d){
c = ''+c+'';
if(c.indexOf('.')>-1){
var x = c.split('.')
, y = left(x[1],d)
, c = x[0]+'.'+y;
}
return c;
}
/* FUNCTION TO UPDATE DROPDOWN CART */
function update_top_cart(){
$.ajax({
type: 'POST',
url: $('body').data('abs_client_path')+'/index.php',
success: function(data){
$header = $(data).find('.topcart li.dropdown .dropdown-toggle').html();
$body_products = $(data).find('.topcart li.dropdown ul.dropdown-menu .product-tbody-container').html();
$body_counts = $(data).find('.topcart li.dropdown ul.dropdown-menu .counts-container').html();
$('.topcart li.dropdown .dropdown-toggle').html($header);
$('.topcart li.dropdown ul.dropdown-menu .product-tbody-container').html($body_products);
$('.counts-container').html($body_counts);
}
});
}
/* FUNCTION TO UPDATE CART */
function update_cart(){
$.ajax({
type: 'POST',
url: $('body').data('abs_client_path')+'/cart.php',
success: function(data){
$product_list = $(data).find('.cart-page .product-tbody-container').html();
$report = $(data).find('.cart-page .counts-container').html();
$('.cart-page .product-tbody-container').html($product_list);
$('.cart-page .counts-container').html($report);
}
});
}
/* PLUGIN TO RESET POINTER TO CURRENT POSITION WHEN TYPING IN INPUTS OR TEXTAREAS */
$.fn.extend({
resetCursorPosition: function(begin, end) {
if (this.length == 0) return;
if (typeof begin == 'number') {
end = (typeof end == 'number') ? end : begin;
return this.each(function() {
if (this.setSelectionRange) {
this.focus();
this.setSelectionRange(begin, end);
} else if (this.createTextRange) {
var range = this.createTextRange();
range.collapse(true);
range.moveEnd('character', end);
range.moveStart('character', begin);
range.select();
}
});
} else {
if (this[0].setSelectionRange) {
begin = this[0].selectionStart;
end = this[0].selectionEnd;
} else if (document.selection && document.selection.createRange) {
var range = document.selection.createRange();
begin = 0 - range.duplicate().moveStart('character', -100000);
end = begin + range.text.length;
}
return { begin: begin, end: end };
}
}
});
/* GET THE CURRENT POSITION OF POINTER INTO AN INPUT OR TEXTAREA */
(function($) {
$.fn.getCursorPosition = function() {
var pos = 0;
var el = $(this).get(0);
// IE Support
if (document.selection) {
el.focus();
var Sel = document.selection.createRange();
var SelLength = document.selection.createRange().text.length;
Sel.moveStart('character', -el.value.length);
pos = Sel.text.length - SelLength;
}
// Firefox support
else if (el.selectionStart || el.selectionStart == '0')
pos = el.selectionStart;
return pos;
}
})(jQuery);
/*////////// STYLE REQUIRED OR NOT FIELDS ///////*/
$('input,select,textarea').livequery(function(){
/*////////// GENERATE A CONTROL GROUP FOR A FIELDS ///////*/
/*
* the array is generated by data-array attribute
* array =
* [0]row size of input (span2,3,4... max 12) OR NULL,
* [1]row size of container (span2,3,4... max 12) OR NULL,
* [2]label text
* e.g.
* it'll generate 2 input, each input have a class "span12" and wrapped in a container with class "span6"
*/
var attr = $(this).attr('data-array'),
id = $(this).attr('id')
$this = $(this);
if($(this).is('[data-array]') && attr !== false && $(this).closest('.control-group').length == 0){
var arr_input = $(this).attr('data-array').split(',');
var row_input = '',
row_container = '';
if(arr_input[0] && arr_input[0].toLowerCase() !== 'null') row_input = 'span'+arr_input[0];
if(arr_input[1] && arr_input[1].toLowerCase() !== 'null') row_container = 'span'+arr_input[1];
$(this)
.css('width','100%')
.wrap('
')
.wrap('
')
.wrap('
')
.closest('.control-group').prepend('');
if (arr_input[3] !== '0') {
$(this)
.addClass(row_input)
.attr('placeholder',arr_input[3])
.find('.input-prepend').append(' ');
}else{
$(this)
.addClass(row_input)
.attr('placeholder',arr_input[2])
.find('.input-prepend').append(' ');
}
if($(this).hasClass('required')){
$(this).closest('.control-group').addClass('');
}else if($(this).attr('least-one') == 'true'){
$(this).closest('.control-group').addClass('inverse');
}else{
$(this).closest('.control-group').addClass('');
}
$(this).on('classadded',function(ev, newClasses) {
if(newClasses == 'required'){
$(this).closest('.control-group').removeClass('inverse info warning').addClass('warning');
}
});
$(this).closest('.control-group').on('classadded',function(ev, newClasses) {
if(newClasses == 'error'){
$(this).removeClass('inverse info warning');
}
});
$(this).on('classdeleted',function(ev, newClasses) {
if(newClasses == 'required'){
if($this.attr('least-one') == 'true'){
$(this).closest('.control-group').removeClass('inverse info warning').addClass('inverse');
}else{
$(this).closest('.control-group').removeClass('inverse info warning').addClass('info');
}
}
});
}
/****************************************************/
});
/*////////// STYLE CHECKGOX AND RADIO IN A GROUP ///////*/
/*
* e.g.
CHECKBOX:
RADIO:
* for each input are important:
1) id --> must be unique
2) name --> like a normal input
3) data-label-name attribute --> this value will be the button name
4) data-additional-classes --> to choose the button color and/or size (see twitter bootstrap options)
if this atribute will be empty or undefined the button will be like a standard Bootstrap button
5) data-icon --> icon class for input checked (ATTENTION: THIS ATTRIBUTE MUST PLASE INTO DIV CONTAINER WITH CLASS "checkradio-group"
if this atribute will be empty or undefined the button will be without icon for checked status
6) checked_text --> text for checked input
if this atribute will be undefined (not EMPTY) the button label will be the same of data-label-name attribute
P.s. The script detect a checked input and show button on active status
*/
$('.checkradio-group').livequery(function(){
var type_input = $(this).find(':checkbox').length > 0 ? 'buttons-checkbox' : 'buttons-radio';
$('
');
$(this).closest('.checkradio-group').css({
'width': '0px',
'height':'0px',
'outline':'none',
'padding':'0px',
'margin':'0px',
'-moz-opacity':'0',
'filter':'alpha(opacity:0)',
'opacity':'0'
});
if($(this).is('[data-text-checked]')){
$(this).prop('checked') == true
? $('div[rel="'+id+'"] span.lcheck_cont').html(checked_text)
: $('div[rel="'+id+'"] span.lcheck_cont').html(label_name);
$(this).click(function(){
if($(this).is(':checkbox')){
$(this).prop('checked') == true
? $('div[rel="'+id+'"] span.lcheck_cont').html(label_name)
: $('div[rel="'+id+'"] span.lcheck_cont').html(checked_text);
}else{
$(this).closest('.checkradio-group').next('.btn-group').find('div.btn').each(function(){
var label = $('#'+$(this).attr('rel')).attr('data-label-name');
$(this).find('span.lcheck_cont').html(label);
});
$('div[rel="'+id+'"] span.lcheck_cont').html($(this).attr('data-text-checked'));
}
});
}
if( data_icon != ''){
if( $(this).prop('checked') == true ) $('div[rel="'+id+'"] i:first').addClass($(this).closest('.checkradio-group').attr('data-icon'));
$(this).click(function(){
if($(this).is(':checkbox')){
$(this).prop('checked') == true
? $('div[rel="'+id+'"] i:first').removeClass($(this).closest('.checkradio-group').attr('data-icon'))
: $('div[rel="'+id+'"] i:first').addClass($(this).closest('.checkradio-group').attr('data-icon'));
}else{
$(this).closest('.checkradio-group').next('.btn-group').find('div.btn i').removeClass($(this).closest('.checkradio-group').attr('data-icon'));
$(this).closest('.checkradio-group').next('.btn-group').find('div[rel="'+id+'"] i:first').addClass($(this).closest('.checkradio-group').attr('data-icon'));
}
});
}
});
});
/*////////// STYLE separated CHECKBOX ///////*/
/*
* e.g.
CHECKBOX:
* for each input are important:
1) id --> must be unique
2) name --> like a normal input
3) data-label-name attribute --> this value will be the button name
4) class "bootstyl" --> important to initialize plugin
5) data-additional-classes --> to choose the button color and/or size (see twitter bootstrap options)
if this atribute will be empty or undefined the button will be like a standard Bootstrap button
6) data-icon --> icon class for input checked
if this atribute will be empty or undefined the button will be without icon for checked status
7) checked_text --> text for checked input
if this atribute will be undefined (not EMPTY) the button label will be the same of data-label-name attribute
P.s. The script detect a checked input and show button on active status
*/
$(':checkbox.bootstyl').livequery(function(){
var id = $(this).attr('id'),
label_name = $(this).attr('data-label-name'),
active_status = $(this).prop('checked') ? ' active' : '',
checked_text = $(this).is('[data-text-checked]') ? $(this).attr('data-text-checked') : '',
data_additional_classes = $(this).is('[data-additional-classes]') ? $(this).attr('data-additional-classes') : '',
data_icon = $(this).is('[data-icon]') ? ' ' : '';
$('
'+data_icon+ ''+label_name+'
').insertAfter($(this));
$(this).css({
'width': '0px',
'height':'0px',
'outline':'none',
'padding':'0px',
'margin':'0px',
'-moz-opacity':'0',
'filter':'alpha(opacity:0)',
'opacity':'0'
});
if($(this).is('[data-text-checked]')){
$(this).prop('checked') == true
? $('div[rel="'+id+'"] span.lcheck_cont').html(checked_text)
: $('div[rel="'+id+'"] span.lcheck_cont').html(label_name);
$(this).click(function(){
$(this).prop('checked') == true
? $('div[rel="'+id+'"] span.lcheck_cont').html(label_name)
: $('div[rel="'+id+'"] span.lcheck_cont').html(checked_text);
});
}
if( data_icon != ''){
if( $(this).prop('checked') == true ) $('div[rel="'+id+'"] i:first').addClass($(this).attr('data-icon'));
$(this).click(function(){
$(this).prop('checked') == true
? $('div[rel="'+id+'"] i:first').removeClass($(this).attr('data-icon'))
: $('div[rel="'+id+'"] i:first').addClass($(this).attr('data-icon'));
});
}
});
/*////////// STYLE DROPDOWN FIELD ///////*/
/*
* e.g.
* for each input are important:
1) id --> must be unique
2) name --> must be unique like a normal select
3) data-img-before --> code for an image to put befor the option text into styled select (pay attention to singlequote and dublequote)
4) data-img-after --> code for an image to put after the option text into styled select (pay attention to singlequote and dublequote)
5) class "bootstyl" --> important to initialize plugin
6) data-additional-classes --> to choose the button color and/or size (see twitter bootstrap options)
if this atribute will be empty or undefined the button will be like a standard Bootstrap button
7) data-verse --> to align the dropdown menu. (see twitter bootstrap options) (values "left"/"right")
if this atribute will be empty or undefined it will be set on "left" option
P.s. The script detect a selected option and give it ".selected" class to underline it
*/
$('select.bootstyl').livequery(function(){
$arr_option = '';
var $name = $(this).attr('name'),
$id = $(this).attr('id'),
$data_additional_classes = $(this).is('[data-additional-classes]') ? $(this).attr('data-additional-classes') : '',
$data_verse = $(this).is('[data-verse]') ? 'pull-'+$(this).attr('data-verse') : '',
$value = $(this).val();
$('#'+$id+' option').each(function(){
var $val = $(this).val(),
$text = $(this).html(),
$img_before = $(this).is('[data-img-before]') ? $(this).attr('data-img-before') : '',
$img_after = $(this).is('[data-img-after]') ? $(this).attr('data-img-after') : '';
$arr_option += '