$(document).ready(function(){

    /* google search box */
    /* Clear Search text on Focus */
    $('#searchword').focus(function(){
        $(this).val('');
    })
    
    $('#searchword').blur(function(){
        search = $(this).val();
        //trim for whitespace
        trimmedSearch = jQuery.trim(search);
        length = trimmedSearch.length;
        //if 0 add default text
        if (length == 0) {
            $(this).val('Search For...');
        }
    })
    
    /* submit the search string to google */
    $('#searchForm').submit(function(event){
        //this grabs the search string and redirects to google in new window and appends site: 
        $('#searchForm input[name="q"]').val($('#searchForm input[name="searchword"]').val() + ' site:ethernetalliance.org');
    })
		
		// add the last to element to the navigation sidebar
		$('#subpage_subnav > ul > li:last').addClass('last');
    
    /**
     * Superfish Menu
     */
    $(function(){
        jQuery('ul.sf-menu').superfish();
        
    });
    
    $(function(){
        $('#loopedSlider').loopedSlider({
            autoStart: 2500
        });
    });
    
    /********************************************************************************************************************
     SIMPLE ACCORDIAN STYLE MENU FUNCTION
     ********************************************************************************************************************/
    $('div.video_wrapper').click(function(e){
    
    
        if (!$(e.target).hasClass("videoplay")) {
            $(this).siblings().find('div.video_thumbnail').slideUp('fast');
            if ($(this).find('div.video_thumbnail').is(":hidden")) {
                $(this).siblings().find('div.video_arrow').removeClass('selected');
                $(this).find('div.video_arrow').addClass('selected');
                $(this).find('.video_thumbnail').slideDown('fast');
            }
            else {
                $('div.video_arrow').removeClass('selected');
                $(this).find('.video_thumbnail').slideUp('fast');
            }
            
        }
    });
    
    /********************************************************************************************************************
     CLOSES ALL DIVS ON PAGE LOAD
     ********************************************************************************************************************/
    $('.sidebar_container_home .video_wrapper:first-child').siblings().find('.video_thumbnail').hide();
    
    
    /**
     Colobox Light Box
     **/
    //Examples of how to assign the ColorBox event to elements
    $(".lightbox").colorbox({
        iframe: true,
        innerWidth: 330,
        innerHeight: 220
    });
    
    
    //Example of preserving a JavaScript event for inline calls.
    $("#click").click(function(){
        $('#click').css({
            "background-color": "#f00",
            "color": "#fff",
            "cursor": "inherit"
        }).text("Open this window again and this message will still be here.");
        return false;
    });
    
    jQuery(function($){
        $("img, .play_video_icon").pngfix();
    });
    
    
}); //Document Ready











