function setDropdownNav(){
    if (!$('ul.dropdown').length) {
        return;
    }
    $('ul.dropdown li.dropdown-trigger').hover(function(){
        $(this).find('ul').fadeIn(100);
    }, function(){
        $(this).find('ul').fadeOut(100);
    });
}

function setToggle(){
    $('#fac-nav ul li span').click(function(){
        $(this).next().toggle();
        return false;
    }).next().show();
}


// load all jquery functionality
$(document).ready(function(){

    setDropdownNav();
    setDefaultInputText();
    //setToggle()
    
    // make entire div clickable
    $("div.clickable").click(function(event){
        event.preventDefault();
        window.location = $(this).attr("url");
    });
    
    // slideshow
    $.featureList($("#feature-tabs li a"), $("#output li"), {
        start_item: 0
    });
    
    // tooltip
    $("#nav-sub a[title]").tooltip({
        tip: '#tip',
        position: "bottom center"
    });
    
    // create tabs on product page
    var $tabs = $('#product-tabs').tabs()
    
    // create tabs on homepage
    var myTabs = $('#home-promo').tabs();
    myTabs.tabs( 'rotate' , 6000 , false );

    // check availability  select tab
    $('a.checkavail').click(function(){
        $tabs.tabs('select', 1);
        return false;
    });
      
    // lightbox zoom on product photo
    $("a#zoom").fancybox({
        'titleShow': false,
        'transitionIn': 'fade',
        'transitionOut': 'fade'
    });
    
    // lightbox dialog
    $("a#dialog").fancybox({
        'width': 750,
        'height': 550
    });

    // lightbox dialog
    $("a#dialog-med").fancybox({
        'width': 600,
        'height': 325
    });
    
    // lightbox dialog
    $("a#dialog-small").fancybox({
        'width': 400,
        'height': 325
    });
    
    
    $('.zebra-rows tr:even').addClass('alt');
    
    // fix selector issues in old browsers
    //$("li:first-child").addClass('woodytestclass');
    
    $('a.gotoreviews').click(function(){
        $tabs.tabs('select', 2);
        return false;
    });
    
    $(".scrollable").scrollable({ vertical: false, mousewheel: true }).mousewheel();

    
});

