$(document).ready(function() {
 
//Make entire div clickable
$(".featured").click(function(){
  window.location=$(this).find("a").attr("href"); return false;
});

$('.products').hover(
       function(){ $('.learnmore-icon span').addClass('hover') },
       function(){ $('.learnmore-icon span').removeClass('hover')
    });
    $('.apps').hover(
       function(){ $('.apps-icon span').addClass('hover') },
       function(){ $('.apps-icon span').removeClass('hover')
    });
    $('.where').hover(
       function(){ $('.where-icon span').addClass('hover') },
       function(){ $('.where-icon span').removeClass('hover')
    });

/********************************************************************************************************************
ACCORDION
********************************************************************************************************************/
//ACCORDION BUTTON ACTION (ON CLICK DO THE FOLLOWING)
$('.accordionButton').click(function() {

//REMOVE THE ON CLASS FROM ALL BUTTONS
$('.accordionButton').removeClass('on');
  
//NO MATTER WHAT WE CLOSE ALL OPEN SLIDES
 $('.accordionContent').slideUp('normal');
   
//IF THE NEXT SLIDE WASN'T OPEN THEN OPEN IT
if($(this).next().is(':hidden') == true) {

//ADD THE ON CLASS TO THE BUTTON
$(this).addClass('on');
  
//OPEN THE SLIDE
$(this).next().slideDown('normal');
 } 
  
 });
  

/*** REMOVE IF MOUSEOVER IS NOT REQUIRED ***/

//ADDS THE .OVER CLASS FROM THE STYLESHEET ON MOUSEOVER 
$('.accordionButton').mouseover(function() {
$(this).addClass('over');

//ON MOUSEOUT REMOVE THE OVER CLASS
}).mouseout(function() {
$(this).removeClass('over');
});

/*** END REMOVE IF MOUSEOVER IS NOT REQUIRED ***/


//CLOSES ALL S ON PAGE LOAD
$('.accordionContent').hide();

//REMOVES EMPTY BUTTONS
$(".accordionButton span:empty").remove();
$(".accordionButton:empty").remove();

//REMOVES EMPTY CONTENT
$(".accordionContent span:empty").remove();
$(".accordionContent:empty").remove();

/********************************************************************************************************************
TABS
********************************************************************************************************************/

//Default Action
$('.tab_content').hide(); //Hide all content
if(location.hash != '') {
var target = location.hash.split('#')[1]
$(location.hash).show(); //Show first tab content
$('ul.tabs li:has(a[rel='+target+'])').addClass('active').show();;
} else {
$('ul.tabs li:first').addClass('active').show(); //Activate first tab
$('.tab_content:first').show(); //Show first tab content
}

//On Click Event
$('ul.tabs li').click(function() {
$('ul.tabs li').removeClass('active'); //Remove any ÒactiveÓ class
$(this).addClass('active'); //Add ÒactiveÓ class to selected tab
$('.tab_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;
});

/*
//When page loads...
$(".tab_content").hide(); //Hide all content
$("ul.tabs li:first").addClass("active").show(); //Activate first tab
$(".tab_content:first").show(); //Show first tab content

//On Click Event
$("ul.tabs li").click(function() {

$("ul.tabs li").removeClass("active"); //Remove any "active" class
$(this).addClass("active"); //Add "active" class to selected tab
$(".tab_content").hide(); //Hide all tab content

var activeTab = $(this).find("a").attr("href"); //Find the href attribute value to identify the active tab + content
$(activeTab).fadeIn(); //Fade in the active ID content
return false;
});
*/

/********************************************************************************************************************
SECONDARY TABS, Only to allow multiple tabs/page
********************************************************************************************************************/
//When page loads...
$(".tab_content2").hide(); //Hide all content
$("ul.tabs2 li:first").addClass("active").show(); //Activate first tab
$(".tab_content2:first").show(); //Show first tab content

//On Click Event
$("ul.tabs2 li").click(function() {

$("ul.tabs2 li").removeClass("active"); //Remove any "active" class
$(this).addClass("active"); //Add "active" class to selected tab
$(".tab_content2").hide(); //Hide all tab content

var activeTab = $(this).find("a").attr("href"); //Find the href attribute value to identify the active tab + content
$(activeTab).fadeIn(); //Fade in the active ID content
return false;
});

});




                    
