﻿Cufon.replace('h2');
Cufon.replace('h3');
var currentTab = 0;
//Open tab of products
function openTab(clickedTab) {
    var thisTab = $(".tabsCont ul li h2 a").index(clickedTab);
    $(".tabsCont ul li h2 a").removeClass("active");
    $(".tabsCont ul li h2 a:eq(" + thisTab + ")").addClass("active");
    $(".tabsCont").removeClass("tab0 tab1 tab2 tab3");
    $(".tabsCont").addClass("tab" + thisTab);
    $(".homeTileBlock").hide();
    $(".homeTileBlock:eq(" + thisTab + ")").show();
    currentTab = thisTab;
    Cufon.replace('h2');
}
//Open or close drop down menu and flip arrow bg
function openDrop(clickedDrop) {
    var thisDrop = $(".dropDown").index(clickedDrop);
    if ($(".dropDown ul:eq(" + thisDrop + ")").is(":hidden")) {
        $(".dropDown ul:eq(" + thisDrop + ")").slideDown("slow");
        $(".dropDown span:eq(" + thisDrop + ")").addClass("switch");
        $(".dropDown ul:eq(" + thisDrop + ")").css('z-index', '9999');
        $(".dropDown ul:eq(" + thisDrop + ")").css('position', 'absolute');
    }
}
//Close drop down menu and flip arrow bg
function closeDrop(clickedDrop) {
    $(".dropDown ul").slideUp("slow");
    $(".dropDown span").removeClass("switch");
}
//Add class to body to check if JS on
$("body").addClass("js");
$(document).ready(function() {
    $(".tabsCont ul li h2 a").click(function() {
        openTab($(this)); return false;
    });    
    function onMenu() {
        openDrop($(this));
    }
    function offMenu() {
        closeDrop($(this));
    }
    //config hoverIntent plugin
    var menuConfig = {
        interval: 0,
        sensitivity: 4,
        over: onMenu,
        timeout: 0,
        out: offMenu
    };
    //call to config for hoverIntent
    $(".dropDown").hoverIntent(menuConfig);    
});
