(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') ) {
          $('body').prepend('<div id="'+source.attr('id')+'_shadow" style="display: none; background-color: #0e85f4; border: solid 1px #0e85f4; position: static; top: 0px; z-index: 100000;">&nbsp;</div>');
      var shadow = $('#'+source.attr('id')+'_shadow');
	 $('#newp').slideDown();
      
      }
      
      if( !shadow ) {
          alert('Cannot create the shadow div');
      }
      $('#newp').slideDown();
      shadow.width(source.css('width')).height(source.css('height')).css('top', source.offset().top).css('left', source.offset().left).css('opacity', 0.5).show();
      shadow.css('position', 'absolute');
      
      shadow.animate( { width: target.innerWidth(), height: target.innerHeight(), top: target.offset().top, left: target.offset().left }, { duration: 200 } )
        .animate( { opacity: 0 }, { duration: 100, complete: callback } );
        
		}
	});
})(jQuery);

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);
    });
	
	  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('.jcarousel-control a').bind('click', function() {
        carousel.scroll(jQuery.jcarousel.intval(jQuery(this).text()));
        return false;
    });

    jQuery('.jcarousel-scroll select').bind('change', function() {
        carousel.options.scroll = jQuery.jcarousel.intval(this.options[this.selectedIndex].value);
        return false;
    });
};

function pcarousel_initCallback(carousel) {
    jQuery('.jcarousel-control a').bind('click', function() {
        carousel.scroll(jQuery.jcarousel.intval(jQuery(this).text()));
        return false;
    });

    jQuery('.jcarousel-scroll select').bind('change', function() {
        carousel.options.scroll = jQuery.jcarousel.intval(this.options[this.selectedIndex].value);
        return false;
    });

    jQuery('#producttabs-next').bind('click', function() {
        carousel.next();
        return false;
    });

    jQuery('#producttabs-prev').bind('click', function() {
        carousel.prev();
        return false;
    });
};

 
jQuery(document).ready(function() {
    jQuery('#sMS1').jcarousel({
        auto: 2,
        wrap: 'last',
        initCallback: mycarousel_initCallback
    });
});

jQuery(document).ready(function() {
    jQuery('#sMS2').jcarousel({
        auto: 2,
        wrap: 'last',
        initCallback: mycarousel_initCallback
    });
});

jQuery(document).ready(function() {
    jQuery('#bMS').jcarousel({
        auto: 2,
        wrap: 'last',
        initCallback: mycarousel_initCallback
    });
});




  
  
  
  




$(document).ready(function() {
						   
						   
	
	function megaHoverOver(){
		$(this).find(".sub").stop().fadeTo('fast', 1).show();
		//$(this).find(".sub").css({'width' : 450});
		$(this).find(".mainlevel").css("background", "#fff").css("color", "#000");
		
		
		$(this).find(".subl").stop().fadeTo('fast', 1).show();
		//$(this).find(".subl").css({'width' : 450});
		$(this).find(".mainlevel").css("background", "#fff").css("color", "#000");
	}
	
	function megaHoverOut(){ 
	    $(this).find(".sub").stop().fadeTo('fast', 0, function() { $(this).hide(); });
		$(this).find(".subl").stop().fadeTo('fast', 0, function() { $(this).hide(); });
	  	$(this).find(".mainlevel").css("background", "transparent").css("color", "#fff");}
		var config = {    
		 sensitivity: 2, 
		 interval: 10, 
		 over: megaHoverOver, 
		 timeout: 0,
		 out: megaHoverOut     
		};

	$("ul#topnav li .sub").css({'opacity':'0'});
	$("ul#topnav li .subl").css({'opacity':'0'});
	$("ul#topnav li").hoverIntent(config);
	// $("ul#topnav li a.mainlevel").hoverIntent(config);
});


(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:#efefef; border:1px solid #efefef; z-index:5000;"> '+htmlStr+'</div>');
		  var shadow = $('#'+source.attr('id')+'_shadow');
	
		 
		 

					

      }

      if( !shadow ) {
          alert('Cannot create the shadow div');
      }
       $('#newp').slideUp();
      $('#newp').slideDown();
      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').slideUp('fast').html;

        
		}
	});
	
	
	
})(jQuery);


$().ready(function() {
       $('#coda-slider-1').codaSlider({
           dynamicArrows: false,
		   autoHeightEaseDuration: 800,
			 autoHeightEaseFunction: "easeInBounce",
        slideEaseDuration: 800,
 			slideEaseFunction: "easeInBounce"
           
       });
   });

jQuery(document).ready(function() {
    jQuery('.mycarousel').jcarousel({
        easing: 'BounceEaseOut',
        animation: 1000
    });
$(".newpinfoclose").click( function()
		 {
	 $('#newp').slideUp();
		});	
	
	
});
jQuery(document).ready(function() {
    jQuery('#producttabs').jcarousel({
          
        initCallback: mycarousel_initCallback,
		visible: 1,
        // This tells jCarousel NOT to autobuild prev/next buttons
        buttonNextHTML: null,
        buttonPrevHTML: null

    });
});

$(window).load(function() {
 $('#slider').nivoSlider();
});

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


         $(function(){
             $('.slide-out-div').tabSlideOut({
                 tabHandle: '.handle',                             
                 pathToTabImage: 'templates/ms/img/cart_tab.png',     
                 imageHeight: '150px',                             
                 imageWidth: '50px',                                 
                 tabLocation: 'left',                             
                 speed: 300,                                      
                 action: 'click',                                  
                 topPos: '198px',                                   
                 fixedPosition: true                            
             });
         });


$(document).ready(
				function(){
					$('ul#smallslidebox').animatedinnerfade({
						speed: 1000,
						timeout: 5000,
						type: 'sequence',
						containerheight: '220px'
					});
});
