﻿$(document).ready(function(){
		$('div.catinfo_toggle').toggleElements( );
	
	
		
		
	});
	
	
	
function doOnClick() {
	alert('callback: onClick');
}
function doOnHide() {
	alert('callback: onHide');
}
function doOnShow() {
	alert('callback: onShow');
}



(function($) {
	$.extend({
		add2cart: function(source_id, target_id, callback) {
   
      var source = $('#' + source_id );
      var target = $('#' + target_id );
      var shadow = $('#' + source_id + '_shadow');
      if( !shadow.attr('id') ) {
		  var htmlStr = $('#' + source_id).html();
		 $('#' + source_id).prepend('<div id="'+source.attr('id')+'_shadow" style="background:#fff; border:1px solid #ccc; z-index:5000;"> '+htmlStr+'</div>');
		  var shadow = $('#'+source.attr('id')+'_shadow');
		  document.forms['cart_quantity'].reset();
		  $('#buyinfo').fadeIn('fast').html;
		  $('#buyinfo').delay(400).fadeOut(400);

      }
	  
      if( !shadow ) {
          alert('Cannot create the shadow div');
      }

      shadow.width(source.css('width')).height(source.css('height')).css('top', source.offset().top).css('left', source.offset().left).css('opacity', 50).show();
      shadow.css('position', 'absolute');
      shadow.animate( { width: target.innerWidth(), height: target.innerHeight(), top: target.offset().top, left: target.offset().left }, { duration: 800 } )
      .animate( { opacity: 0 }, { duration: 0, complete: callback } );
	$('#' + source_id + '_shadow').fadeOut('fast').html;
	
	
		}
	
	});
})(jQuery);





$(document).ready(function(){	
						   
$("a[rel=group]").fancybox({
				'transitionIn'		: 'elastic',
				'transitionOut'		: 'elastic',
				'titlePosition' 	: 'over'
			});


$("a#zoom").fancybox({
				'titleShow'     : false,
				'transitionIn'	: 'elastic',
				'transitionOut'	: 'elastic'
			});


$("div.infotablerow").hover(function() {
	/*$(this).css({'z-index' : '100'}); /*Add a higher z-index value so this image stays on top*/ 
	$(this).find('div.inner').css({'z-index' : '100'});
	
	$(this).find('.vrowinfo1 img').addClass("hover").stop() /* Add class of "hover", then stop animation queue buildup*/
		.animate({
			marginTop: '-75px', /* The next 4 lines will vertically align this image */ 
			marginLeft: '-148px',
			top: '50%',
			left: '50%',
			width: '150px', /* Set new width */
			height: '150px', /* Set new height */
			padding: '20px'
			
		}, 200); /* this value of "200" is the speed of how fast/slow this hover animates */

	} , function() {
	/*$(this).css({'z-index' : '0'});  Set z-index back to 0 */
	$(this).find('div.inner').css({'z-index' : '0'});
	$(this).find('.vrowinfo1 img').removeClass("hover").stop()  /* Remove the "hover" class , then stop animation queue buildup*/
		.animate({
			marginTop: '0', /* Set alignment back to default */
			marginLeft: '0',
			top: '0',
			left: '0',
			width: '40px', /* Set width back to default */
			height: '40px', /* Set height back to default */
			padding: '2px'
		}, 200);
});

	}); 

function mycarousel_initCallback(carousel)
{
    // Disable autoscrolling if the user clicks the prev or next button.
    carousel.buttonNext.bind('click', function() {
        carousel.startAuto(0);
    });
 
    carousel.buttonPrev.bind('click', function() {
        carousel.startAuto(0);
    });
 
    // Pause autoscrolling if the user moves with the cursor over the clip.
    carousel.clip.hover(function() {
        carousel.stopAuto();
    }, function() {
        carousel.startAuto();
    });
};
 
jQuery(document).ready(function() {
    jQuery('#FPcarousel').jcarousel({
        auto: 10,
        wrap: 'last',
        initCallback: mycarousel_initCallback
    });
});

$(function () {
    $('ul.spy').simpleSpy();
});

(function ($) {
    
$.fn.simpleSpy = function (limit, interval) {
    limit = limit || 4;
    interval = interval || 4000;
    
    return this.each(function () {
        // 1. setup
            // capture a cache of all the list items
            // chomp the list down to limit li elements
        var $list = $(this),
            items = [], // uninitialised
            currentItem = limit,
            total = 0, // initialise later on
            height = $list.find('> li:first').height();
            
        // capture the cache
        $list.find('> li').each(function () {
            items.push('<li>' + $(this).html() + '</li>');
        });
        
        total = items.length;
        
        $list.wrap('<div class="spyWrapper" />').parent().css({ height : height * limit });
        
        $list.find('> li').filter(':gt(' + (limit - 1) + ')').remove();

        // 2. effect        
        function spy() {
            // insert a new item with opacity and height of zero
            var $insert = $(items[currentItem]).css({
                height : 0,
                opacity : 0,
                display : 'none'
            }).prependTo($list);
                        
            // fade the LAST item out
            $list.find('> li:last').animate({ opacity : 0}, 1000, function () {
                // increase the height of the NEW first item
                $insert.animate({ height : height }, 1000).animate({ opacity : 1 }, 1000);
                
                // AND at the same time - decrease the height of the LAST item
                // $(this).animate({ height : 0 }, 1000, function () {
                    // finally fade the first item in (and we can remove the last)
                    $(this).remove();
                // });
            });
            
            currentItem++;
            if (currentItem >= total) {
                currentItem = 0;
            }
            
            setTimeout(spy, interval)
        }
        
        spy();
    });
};




    
})(jQuery);



if ( top.location != self.location ) { top.location = self.location; }



