﻿
$(document).ready(function() {

    // MENU RELATED

    $('#menu ul.tabs li ul').addClass('dropdown');
    $('#menu ul.tabs ul.dropdown ul').removeClass('dropdown');
    $('#navigation').css('overflow', 'visible');

    //$('#menu ul.tabs ul.dropdown ul.big_dropdown').after('<div class="blank">&nbsp;</div>');

    var $kids = $('#menu ul.tabs ul.dropdown li').children('ul');
    $kids.parent().wrap("<div class='big_dropdown'></div>");

    $('.big_dropdown ul').addClass('big_dropdown_ul');

    $('.big_dropdown li a:first-child').addClass('drop_title');
    $('.big_dropdown_ul a').removeClass('drop_title');

    // var $find_dropdown_height = $('.big_dropdown_ul').children().length;
    //var $dropdown_height = ($find_dropdown_height * 33);
    //$('#menu ul.tabs ul.dropdown li').css('height', $dropdown_height);


    // IE 7 Z-INDEX BUG
    //$(function() {
        //if ($.browser.msie) {
           // $('div').each(function(i) {
              //  if ($(this).css('position') != 'absolute') $(this).css('zIndex', 1000 - (i * 10));
            //});
       // }
   // })
    
    //SNIPPETS

        // TESTIMONIAL SNIPPET

        $(".testimonial h2:empty").css('display', 'none');

        // CODE SNIPPET EXPAND / HIDE

        $('#code_snippet span.expand').text('Expand');
        $('#code_snippet span.hide').text('Hide');

        // CODE SNIPPET EXPAND
        $('#code_snippet span.expand').click(function() {
            $('.code_box').slideDown('slow', function() {
                $('#code_snippet span.expand').slideUp('fast', function() {
                    $('#code_snippet span.hide').slideDown('fast');
                });
            });

        });

        // CODE SNIPPET HIDE
        $('#code_snippet span.hide').click(function() {
            $('.code_box').slideUp('slow', function() {
                $('#code_snippet span.hide').slideUp('fast', function() {
                    $('#code_snippet span.expand').slideDown('fast');
                });
            });

        });

        //  search text
        $('.search_text').each(function() {

            //  remove inactive when focused
            $(this).focus(function() {
                $(this).removeClass('search_text_inactive');
                if ($(this).val() == 'Search') {
                    $(this).val('');
                }
            });

            //  add inactive when blurred
            $(this).blur(function() {
                if ($(this).val() == '') {
                    $(this).addClass('search_text_inactive');
                    $(this).val('Search');
                }
            });

        });

});

