/*//////////////////////////////////////////////////////////////////////////////////////////////////////////
		CUSTOM JAVASCRIPT EFFECTS  
//////////////////////////////////////////////////////////////////////////////////////////////////////////*/


/****************************************************************************
	BANNER - Customising the home page banner 
****************************************************************************/

<!-- temporarily removed for launch -->




/****************************************************************************
	SCROLL TO TOP
****************************************************************************/

$(function ()
{
    $.fn.scrollToTop = function (options)
    {
        if (options)
        {
            var speed = options.speed;
            var ease = options.ease;
        }
        else
        {
            var speed = "slow";
            var ease = "jswing";
        }
        var scrollDiv = $(this);
        $(this).hide().removeAttr("href");
        if ($(window).scrollTop() != "0")
        {
            $(this).fadeIn("slow");
        }
        $(window).scroll(function ()
        {
            if ($(window).scrollTop() == "0")
            {
                $(scrollDiv).fadeOut("slow");
            }
            else
            {
                $(scrollDiv).fadeIn("slow");
            }
        });
        $(this).click(function (event)
        {
            $("html, body").animate(
            {
               scrollTop: "0px"
            }, speed, ease);
        });
    }
}); 


/* --- ADDITIONAL CODE FOR 'SCROLL TO TOP' EFFECT --- */

$(function() {
	$(".toTop").scrollToTop({speed:1200,ease:"easeInOutCubic"});
});




/***************************************************
		TABS JAVASCRIPT
***************************************************/

jQuery(document).ready(function($){
	// PRODUCT switcher tabs
	$(".switch-content").hide(); //Hide all content
	$("ul.tab-switcher li:first").addClass("active").show(); //Activate first tab
	$(".switch-content:first").show(); //Show first tab content
	
	
	//On Click Event for PRODUCT Switcher
	$("ul.tab-switcher li").click(function() {
		$("ul.tab-switcher li").removeClass("active"); //Remove any "active" class
		$(this).addClass("active"); //Add "active" class to selected tab
		$(".switch-content").hide(); //Hide all tab content
		var activeTab = $(this).find("a").attr("href"); //Find the rel attribute value to identify the active tab + content
		$(activeTab).fadeIn(); //Fade in the active content
		return false;
	});	
	
	
	// IMAGE switcher tabs
	$(".switch-image").hide(); //Hide all content
	$("ul.image-switcher li:first").addClass("active").show(); //Activate first tab
	$(".switch-image:first").show(); //Show first tab content
	
	
	//On Click Event for IMAGE switcher
	$("ul.image-switcher li").click(function() {
		$("ul.image-switcher li").removeClass("active"); //Remove any "active" class		
		$(this).addClass("active"); //Add "active" class to selected tab
		$(".switch-image").hide(); //Hide all tab content
		var activeTab = $(this).find("a").attr("href"); //Find the rel attribute value to identify the active tab + content
		$(activeTab).fadeIn(); //Fade in the active content
		return false;
	});

})


/***************************************************
		PDF PREVIEW FADE
***************************************************/

jQuery(document).ready(function($){
	$("a.pdf-preview").hover(
		function() {
		$(".pdfthumb").stop().animate({"opacity": "1"}, "medium");
		},
		function() {
		$(".pdfthumb").stop().animate({"opacity": "0"}, "medium");
	});
 
});



/***************************************************
		NEWS TICKER FADE
***************************************************/

$.fn.fadeystuff = function(options) {
    var defaultOptions = {
        childSelector: '.item',
        fadeSpeed: 1000,
        lingerTime: 8000
    }

    var o = $.merge(options, defaultOptions);

    var children = this.children(o.childSelector);
    $(children[0]).show();

    if (children.length > 1) {
        var current = $(children[0]);
        var infiniteLoopOfDeath = function() {
            current.fadeOut(o.fadeSpeed, function() {
                current = current.next();
                if (current.length === 0) {
                    current = $(children[0]);
                }

								$('.indicators span').removeClass('active').eq(current.index()).addClass('active');
								
                current.fadeIn(o.fadeSpeed, function() {
                    setTimeout(infiniteLoopOfDeath, o.lingerTime);
                });
            });
        }

        setTimeout(infiniteLoopOfDeath, o.lingerTime);
    }
}

$(document).ready(function() {
    $('.items').fadeystuff({
        childSelector: '.item',
        fadeSpeed: 1000,
        lingerTime: 6000
    });

		$('.indicators span').eq(0).addClass('active');
	
});
























