$(function(){
$('.pending').click(function(){
jAlert('Esta sección se encuentra en desarrollo en estos momentos.','Próximamente');
return false;
});
// SEARCH
if ($('#search_box').length){
$('#search_box').labelify({ labelledClass: "labelify" });
$('#search_box').autocomplete('/search_suggest',{
'cacheLength' : 1,
'minChars' : 2,
'width' : '310px',
'max' : 100,
'highlight': function(value, term) {
words = term.split(' ');
for (w in words){
value = value.replace(new RegExp("(?![^&;]+;)(?!<[^<>]*)(" + words[w].replace(/([\^\$\(\)\[\]\{\}\*\.\+\?\|\\])/gi, "\\$1") + ")(?![^<>]*>)(?![^&;]+;)", "gi"), "$1");
}
return value;
}
}).result(function(event, data, formatted){
$('#search_box').val('');
if (data[1]) window.location = '/producto/'+data[1];
return false;
});
}
$(window).ajaxComplete(initPromoTooltips);
function initPromoTooltips(){
$('img.promo_info').css('cursor','pointer').tooltip({
'html' : '
'
});
}
initPromoTooltips();
if ($.browser.msie && $.browser.version <= 6){
function hin(){ $(this).addClass('hover'); }
function hout(){ $(this).removeClass('hover'); }
$('#toolbar a').hover(hin,hout).removeClass('ie6');
}
// LOGIN
$('#login_link span.r').each(function(){ $(this).html(''); });
if ($.browser.msie){
$('#login_link span.r').css('padding-bottom','15px');
$('#options input').css('padding-top','0px');
}
$('#login_link').click(function(){
var pop = $('#login_pop');
if (!pop.length) return true;
if ($(this).hasClass('selected')){
$(this).removeClass('selected');
$('span.r img',this).attr('src',$('span.r img',this).attr('rev'));
pop.slideUp('fast');
return false;
}
if (pop.width()<120){
pop.width(120);
}
var position = $(this).position();
var _top = ($.browser.msie && $.browser.version < 8) ? 2 : 2;
var _left = ($.browser.msie && $.browser.version < 8) ? 6 : 6;
pop
.css('top',position.top+$(this).outerHeight()+_top)
.css('left',position.left-pop.outerWidth()+$(this).outerWidth()+_left)
.slideDown('fast')
;
$(this).addClass('selected');
$('span.r img', this)
//.attr('rev', $('span.r img', this).attr('src'))
.attr('src', '/style/user/color=FFFFFF&background-color=a7a9ac?q='+$('span.r img', this).attr('rel')+' ');
return false;
});
});
var minicart = new BB_AppTool($('#minicart'),{
'onInit': function(tool){
$('div.tooltip', tool)
.tooltip({
'html' : '',
'yOffset': -3
})
.css('cursor', 'default');
}
});
function minicartLoad(){
$('#minicart').load('/checkout/minicart', {'v' : minicart.visible()}, function(){
minicart.init();
});
}