$(document).ready(function(){
    var $postal_code = $('#postal_code');
    if ($postal_code.length > 0) {
        $postal_code.postalLocater();
    }

    var $cs = $('#course_select');
    if ($cs.length > 0) {
        $('#course_select').chosen();
    }

/* Registered Users / Show Registered Events
--------------------------------------------------------------------------------------- */
    $('.edit_user').click(function() {
        $(this).parent().parent().children('.player_events').slideToggle("fast");
    });

/* Zebra Strips Tables
--------------------------------------------------------------------------------------- */
    //$('tbody').find('tr:odd').addClass("alt_orange");

    $('.player_wrap:odd').addClass("alt_orange");

    $('.login_event_list li:even').addClass("alt");

/* Zebra Strips Tables
--------------------------------------------------------------------------------------- */
    /*$("#demovideo").fancybox({
        'speedIn'       :   600,
        'speedOut'      :   200
    });*/

/* Zebra Strips Tables
--------------------------------------------------------------------------------------- */
    $(".help_btn").qtip({
        content: 'This is an example of the tooltip content. Content can be dynamic per page.',
        position: {
            corner: {
                target: 'topMiddle',
                tooltip: 'bottomMiddle'
            }
        },
        style: {
            width: 350,
            padding: 8,
            background: '#222',
            color: 'white',
            textAlign: 'left',
            border: {
                width: 5,
                radius: 4,
                color: '#3c79c9'
            },
            tip: 'bottomMiddle',
            name: 'blue'
        }
});

/* Form Scripts

** Label is required for inputs with placeholder text and a matching id. **
--------------------------------------------------------------------------------------- */
    $('.search_wrap').find('label').live('click', function() {
        $(this).siblings('input').focus();
    });
    $('.search_wrap').find('input').live('focus', function() {
        var $this = $(this), className = $this.attr('name');
        if($this.attr("type") !== "file" && $this.attr("type") !== "textarea") {
            $('label[for="'+className+'"]').hide();
        }
        $this.addClass("over");
    }).live('blur', function() {
        var $this = $(this);
        if($this.val() === "") {
            if($this.attr("type") !== "file" || $this.attr("type") !== "textarea") {
                var className = $this.attr('name');
                $('label[for="'+className+'"]').show();
            }
        }
        $this.removeClass("over");
    });

});

