function gotoLink(o) {
window.location.href = jQuery(o).attr('href');
}
function showvalue(arg) {
alert(arg);
//arg.visible(false);
}
var j = jQuery.noConflict();
jQuery(document).ready(function($) {
$('.filtrMoreLess a.more').bind("click",function(e){e.preventDefault();$(this).hide().next().show();$(this).parent().prev().find('.hide').slideToggle()});
$('.filtrMoreLess a.less').bind("click",function(e){e.preventDefault();$(this).hide().prev().show();$(this).parent().prev().find('.hide').slideToggle();});
$('a[title]').qtip({
position: {
my: 'top center',
at: 'bottom center'
},
style: {
classes: 'qtip-light qtip-shadow qtip-padda'
} });
$('img').qtip({
position: {
my: 'top center',
at: 'bottom center'
},
style: {
classes: 'qtip-light qtip-shadow qtip-padda'
}
});
$('#quick_cart_trigger').bind("click",function(e){e.preventDefault();$('#quick_cart').slideToggle();});
$(".slide_likebox").hover(function(){
$(".slide_likebox").stop(false, true).animate({left:"0"},"medium");
},function(){
$(".slide_likebox").stop(false, true).animate({left:"-300"},"medium");
},1000
);
//----------------
$('#removeAll').bind("click",function(e){
e.preventDefault();
$( "#dialog-confirm" ).dialog({
resizable: false,
height:190,
width: 370,
modal: true,
buttons: {
"Wyczyść koszyk": function() {
window.location.href = 'shopping_cart.php?action=remove_cart';
},
"Anuluj": function() {
$( this ).dialog( "close" );
}
}
});
});
/* -- */
var stack_bar_bottom = {"dir1": "up", "dir2": "right", "spacing1": 0, "spacing2": 0};PNotify.prototype.options.styling = "jqueryui";
function show_stack_bar_bottom(type, what, howmuch, tooltip) {
var opts = {
title: "ANNAPOL",
text: "Witamy w naszym sklepie firmowym .",
addclass: "stack-bar-bottom",
cornerclass: "",
width: "60%",
history: {
maxonscreen: 3,
},
stack: stack_bar_bottom
};
switch (type) {
case 'error':
opts.title = "Ojejku";
opts.text = "Nie udało się dodać do koszyka "+howmuch+"szt. "+what;
opts.type = "error";
break;
case 'info':
opts.title = "Niepoprawne dane";
opts.text = what + " » wpisz ile sztuk chcesz kupić";
opts.type = "info";
break;
case 'success':
opts.title = "Dodano do koszyka";
/* opts.text = "Dodano do koszyka "+howmuch+" szt. "+what+' » zobacz koszyk «';
opts.text = "Dodano do koszyka "+what+' » zobacz koszyk «';
*/
opts.text = tooltip;
opts.type = "success";
break;
}
new PNotify(opts);
}
/* -- */
$(".addNice").click(function(e){
e.preventDefault();
$(this).slideToggle();
products_id = $(this).attr('rel');
products_name = $(this).attr('title');
products_name = products_name.replace('Dodaj do koszyka ','');
products_name = products_name.replace(' (',' (');
products_name = products_name.replace(')',')');
products_qty = $('form[name=product_'+products_id+']').find('input[name=\"cart_quantity\"]').val();
products_qty_field = $('form[name=product_'+products_id+']').find('input[name=\"cart_quantity\"]');
if($.isNumeric(products_id) && $.isNumeric(products_qty) && products_qty > 0 && products_id > 0) {
$.ajax({
type: 'POST',
url: encodeURI($('form[name=product_'+products_id+']').attr('action')) + '&ajax_cart=1',
data: $('form[name=product_'+products_id+']').serialize(),
async:false,
dataType: 'json',
success: function(data) {
console.log(data);
$('#topCartContent').html(data['cart']);
products_qty_field.removeClass('qtyNotInCart');
products_qty_field.addClass('qtyInCart');
show_stack_bar_bottom('success',products_name,products_qty,data['tooltip']);
},
fail: function(data) {
show_stack_bar_bottom('error',products_name,products_qty);
}
});
} else {
show_stack_bar_bottom('info',products_name);
}
$(this).slideToggle();
});
//----------------
function slide() {
var item_width = $('#manu_slider_ul li').outerWidth( true );
var left_indent = 0 - item_width;
$( '#manu_slider_ul' ).animate( {'left' : left_indent}, 2000, 'linear', function() {
$( '#manu_slider_ul li:last' ).after( $('#manu_slider_ul li:first') );
$( '#manu_slider_ul' ).css( {'left' : '0px'} );
slide();
});
}
$( '#manu_slider_ul li img' ).hover(
function( e ) {
$( '#manu_slider_ul' ).pause();
}, function( e ) {
$( '#manu_slider_ul' ).resume();
}
);
slide();
})
function showHide(tag){
var whos = '#'+tag;
j(whos).find('.filtrSCB').removeClass('hide');
j(whos).next('.filtrMore').toggle();
j(whos).find('.filtrSCB').addClass('show');
j(whos).next('.filtrLess').toggle();
return false;
}
function showCB(tag){
var whos = '#'+tag;
j(whos).find('.filtrSCB').addClass('hide');
j(whos).find('.persistent').removeClass('hide').addClass('show');
j(whos).next('.filtrMore').toggle();
j(whos).next('.filtrLess').toggle();
return false;
}
/* obsluga porownan */
function compare_click(element, pID) {
if(j(element).is('.checked')) {
ajax_compare(element, 'discard', pID);
} else {
ajax_compare(element, 'add', pID);
}
}
function compare_toggle(element) {
if(j(element).is('.checked')) {
j(element).removeClass('checked');
} else {
j(element).addClass('checked');
}
}
function ajax_compare(element, action, pID) {
advAJAX.get({
url : "ajax_compare.php",
timeout : 5000,
retry: 2,
retryDelay: 2000,
parameters : { "action" : action,
"pID" : pID},
onLoading: function(obj) {
j(element).html('
');
j('#countPorownanie').html('
');
// j('#countPorownanieIndex').html('
');
},
onSuccess : function(obj) {
switch(obj.responseText.substring(0,3)) {
case 'ERR':
/* j(element).html(obj.responseText);*/
j(element).html(' ');
break;
case 'OK-':
j(element).html(' ');
// j('#countPorownanie').html(' ');
j('#countPorownanieIndex').hide();
compare_toggle(element);
break;
case 'OK+':
j(element).html(' ');
// j('#countPorownanie').html('porównaj wybrane produkty »');
j('#countPorownanieIndex').show();
compare_toggle(element);
break;
}
},
onError : function(obj) { alert("Error: " + obj.status); j(element).html(' ');}
});
}
/* obsluga schowka */
function wishlist_click(element, pID) {
if(j(element).is('.checked')) {
ajax_wishlist(element, 'remove_wishlist', pID);
} else {
ajax_wishlist(element, 'add_wishlist', pID);
}
}
function wishlist_toggle(element) {
if(j(element).is('.checked')) {
j(element).removeClass('checked');
} else {
j(element).addClass('checked');
}
}
function ajax_wishlist(element, action, pID) {
advAJAX.get({
url : "ajax_wishlist.php",
timeout : 5000,
retry: 2,
retryDelay: 2000,
parameters : { "action" : action,
"products_id" : pID},
onLoading: function(obj) { j(element).html('
'); },
onSuccess : function(obj) {
switch(obj.responseText.substring(0,3)) {
case 'ERR':
/* j(element).html(obj.responseText);*/
j(element).html(' ');
break;
case 'OK:':
j(element).html(' ');
wishlist_toggle(element);
break;
}
},
onError : function(obj) { alert("Error: " + obj.status); j(element).html(' ');}
});
}