  $(document).ready(function(){
		$(document).pngFix();
		
		jQuery('#jcarousel-product-pictures').jcarousel({
			scroll: 4,
			wrap: 'last'
		});

		$('#secondary-links li').hover(
			function() { $('ul', this).show(); $(this).addClass("active"); },
			function() { $('ul', this).hide(); $(this).removeClass("active"); });
	});


this.tooltip = function(){	
	xOffset = 140;
	yOffset = 5;	
	$(".block-popular li li a").hover(function(e){	
		var rel = this.rel;
		this.t = $('#'+rel).html();
		//this.t = $(this).html();
		this.title = "";
		$("body").append("<div id='tooltip'>"+ this.t +"</div>");
		$(document).pngFix();
		$("#tooltip")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px")
			.fadeIn("fast");
    },
	function(){
		this.title = this.t;
		$("#tooltip").remove();
    });	
	$(".block-popular li li a").mousemove(function(e){
		$("#tooltip")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px");
	});
};

this.tooltip2 = function(){	
	xOffset = 140;
	yOffset = 5;	
	$("ul.cover-view li a").hover(function(e){	
		var rel = this.rel;
		this.t = $('#'+rel).html();
		this.title = "";									  
		$("body").append("<div id='tooltip'>"+ this.t +"</div>");
		$(document).pngFix();
		$("#tooltip")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px")
			.fadeIn("fast");		
    },
	function(){
		this.title = this.t;		
		$("#tooltip").remove();
    });	
	$("ul.cover-view li a").mousemove(function(e){
		$("#tooltip")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px");
	});			
};

  $(document).ready(function(){
		$(document).pngFix();
		
		$('#secondary-links li').hover(
			function() { $('ul', this).show(); $(this).addClass("active"); },
			function() { $('ul', this).hide(); $(this).removeClass("active"); });
		
		tooltip();
                tooltip2();
		if (template_name == 'benih_shop') {
            jQuery('.block-popular ul').Accordion({
                active: 'h3.selected',
                header: 'h3.head',
                alwaysOpen: false,
                animated: true,
                showSpeed: 300,
                hideSpeed: 300
            });
        }
		jQuery('.block-popular ul').activate();
	});

    function subscribe_newsletter()
    {
      $.ajax({
        type: 'post',
        dataType: 'json',
        url: 'account/newsletter',
        data: { email: $('#newsletter-email').val() },
        success: function(data) {
          if(data.success) $('#newsletter-popup').html('<div class="message success">Successfully subscribed to newsletter</div>');
          else $('#newsletter-popup').html('<div class="message error">Failed to subscribe to newsletter</div>');
          display_popup('newsletter-popup');
          setTimeout('$("#newsletter-popup").jqmHide()', 3000);
        }
      });
    }


function get_latest_cart() {
    $.post(config_siteurl+'cart/latest', {}, function (data) {
        if ($('#cart-list').length) {
            $('#cart-list').empty();
            for (i in data) {
                $('#cart-list').append('<li>' + 
                    '<div class="product-img frame 40"><img src="'+config_siteurl+'files/' + data[i].product_id + '/mini/' + data[i].picture_path + '" title="' + data[i].name + '" alt="'+data[i].name+'" border="0" height="40"/></div>' +
                    '<div class="product-info">' +
                    '<strong>' + data[i].name + '</strong><br/>' + data[i].quantity + 'x ' + data[i].format + ' - IDR ' + data[i].price + '</li>');
            }
        } else {
            var html = '<ul id="cart-list">'
            for (i in data) {
                html += '<li>' + 
                    '<div class="product-img frame 40"><img src="'+config_siteurl+'files/' + data[i].product_id + '/mini/' + data[i].picture_path + '" title="' + data[i].name + '" alt="'+data[i].name+'" border="0" height="40"/></div>' +
                    '<div class="product-info">' +
                    '<strong>' + data[i].name + '</strong><br/>' + data[i].quantity + 'x ' + data[i].format + ' - IDR ' + data[i].price +
                    '</li>';
            }
            html += '</ul>';
            $('#cart').append(html);
        }
    }, 'json');
    t = setTimeout('get_latest_cart()', 10000);
}
get_latest_cart();


var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));

try {
var pageTracker = _gat._getTracker("UA-8467228-1");
pageTracker._trackPageview();
} catch(err) {}

