$(document).ready(function(){
	
	/**
     * Scene View Code
     * Hides the detail block, shows the video container,
     * loads a player in it with ajax, and toggles the hide video button
     */    
    $('.view_link').click(function() { 
        
        // Video container showing
        //$('.videoContainer').slideUp();
        var cont = '.videoContainer:first';
        $(cont).slideDown();
        $(cont).text('Loading Video');
        $(cont).load(this.href + '&ajax=1');
        
        return false; 
    
    });
    
    /**
     * This block is for the Hide video button
     * It removes the video player from the container, 
     * hides the container, reveals the detail block, and toggles the show video button
     */
    $('.view_form input[type="button"]').click(function() { 
    
        var num = this.form.scene.value;
        var scene = '#scene' + num;
        var detail = '#detail' + num;
        $(detail).slideDown();
        $('.videoContainer').text('');
        $('.videoContainer').slideUp();
        $(scene).find('.view_form input').toggle();
        
    });    
	
});