
jQuery(document).ready(function () {

	
	/* Sliders
	 ------------------------------------------------------------------------*/
	 
    /* Homepage slider */
	jQuery('#homepage-slider').RSlider({
								   delay			: 6000,
								   duration			: 1000,
								   height			: 395,
								   width			: 900,
								   slices			: 4,
								   easing			: 'easeOutExpo',
								   effect			: 'vertical'
								   });
	
	/* Medium slider */
	jQuery('.medium-slider').RSlider({
								   delay			: 5000,
								   duration			: 1000,
								   height			: 170,
								   width			: 580,
								   slices			: 2,
								   easing			: 'easeOutExpo',
								   effect			: 'horizontal',
								   pause_on_hover	: true
								   });
	
	/* Display sliders navigation */
	jQuery('.navigation .rs-nav').css({opacity : 0, display : 'block'});
    jQuery('.navigation').hover(function(){
		jQuery('.rs-nav',this).stop().animate({ opacity : 1 }, { queue: false, duration: 450});
		jQuery('.rs-next',this).stop().animate({ right : '10px'}, { queue: false, duration: 450, easing: 'easeOutQuint' });
		jQuery('.rs-prev',this).stop().animate({ left : '10px'}, { queue: false, duration: 450, easing: 'easeOutQuint' })
	}, function(){
		jQuery('.rs-nav',this).stop().animate({ opacity : 0 }, { queue: false, duration: 450});
	    jQuery('.rs-next',this).stop().animate({ right : '-68px'}, { queue: false, duration: 450, easing: 'easeOutQuint' });
	    jQuery('.rs-prev',this).stop().animate({ left : '-68px'}, { queue: false, duration: 450, easing: 'easeOutQuint' })
	})
	
}) 


;(function ($) {

    /* 
	 *  R-DYNAMIC LIST
     *  Copyright (c) 2010 Rascals Labs
	 *  http://www.rascals.eu
     *  rascals@rascals.eu
	 *  ver 1.0
     */

    jQuery.fn.RDynamicList = function(options) {
		
		return this.each(function() {		  
			var opts = jQuery.extend({
				'display_num' : 4,
				'element_height' : 65,
				'border' : 0
			}, options);
			   
			/* List variables */
			var container = $('ul', this),
				list_padding = $('li', this).css('padding-bottom').replace('px', ''),
				element_height = opts.element_height + 2*(parseInt(list_padding))+opts.border,
				list_height = opts.display_num * (element_height),
				element_num = $('li' ,this).size(),
				total = element_num - opts.display_num,
				current = 0;
			
			/* Bulid list */
			$('li' ,this).css('height', opts.element_height+'px');
			$('.dynamic-container', this).css('height', list_height+'px');
			
			/* Display navigation list */
			if (element_num > opts.display_num ) {
				
				/* Add navigation arrows */
				$(this).append('<div class="dynamic-nav"><a href="" class="nav-up"></a><a href="" class="nav-down"></a></div>');
				
				/* Bind click functions */
				$('a.nav-next', this).click(function () {
					if (current == total) current = total;
					else current++;
					container.animate({ top: (-current) * element_height }, { duration: 400, easing: 'easeOutQuart', queue: false });
					return false;
				});
				
				$('a.nav-prev', this).click(function () {
					if (current == 0) current = 0;
					else current--;
					container.animate({ top: (-current) * element_height }, { duration: 400, easing: 'easeOutQuart', queue: false });
					return false;
				});
			}
		})
    }

})(jQuery);


;(function ($) {

    /* 
	 *  R-Accordion
     *  Copyright (c) 2011 Rascals Labs
	 *  http://www.rascals.eu
     *  rascals@rascals.eu
	 *  ver 1.0
     */

    jQuery.fn.RAccordion = function(options) {
		
		return this.each(function() {		  
			var opts = jQuery.extend({
				'element' : 'li'
			}, options);
					 
			/* List variables */
			var accordion = $(this);

			/* Show active element */
			$('.active .hidden-content', accordion).show();
			
			/* Click on accordion list item */
			$(opts.element, this).click(function () {
				if (!$(this).is('.active')) {
					
					/* Hide all active items */
					$('.active', accordion).removeClass('active').find('.hidden-content').slideUp(400);
					
					/* Add active class to this item */
					$(this).addClass('active');
					$('.hidden-content', this).slideDown(400);
				} 
				return false;
			});
			
		})
    }

})(jQuery);

