$(document).ready(function(){

    $('#tabs').tabs();

    // ****** pop up dialog box ******

	$('[id^="detailbox"]').click(function() {
		var buttonId = $(this).attr("id");
		var detail_type = buttonId.substr(10, (buttonId.length-10));

		$('#details_dialog').dialog('destroy');
		$('#details_dialog').dialog({ autoOpen:false, resizable:false, modal: true,  width:  450, 
			close: function() {
				$('#details_dialog').dialog('destroy');
                $('#details_dialog').html('<p></p>');		
			}
		});

        // switch on the name of the content to put a title on the box
		switch(detail_type) {
            case 'workbooks':
                $("#details_dialog").dialog('option', 'title', "Schweser Class Workbooks, Volume 1 &amp; 2");
                break;
            case 'faculty':
                $("#details_dialog").dialog('option', 'title', "Faculty Email Access");
                break;
        }

        // get the content from the hidden div and open the pop up
        $('#details_dialog p').html($("#"+detail_type).html());
        $('#details_dialog').dialog('open');
        $('#details_dialog').dialog('option', 'position', 'center');        
	});	

    // ****** end pop up dialog box ******

	$("a[id^='showSchweserLibrary']").dialog_box( 350, 100, "Schweser Library (full access)" );

	var video_array = new Array();
	
	video_array['cfa1'] = new Array();
	video_array['cfa1']['flv'] 	= 'flashmedia/kaplan_demos/CFA/16-Week_Level1.flv';
	video_array['cfa1']['image']	= '';
	video_array['cfa1']['title']	= 'Quantitative Methods Demo';
	video_array['cfa1']['vid_width'] = 490;
	video_array['cfa1']['vid_height'] = 384;
	video_array['cfa1']['pop_width'] = 520;
	video_array['cfa1']['pop_height'] = 450;
 	
	video_array['cfa2'] = new Array();
	video_array['cfa2']['flv'] 		= 'flashmedia/kaplan_demos/CFA/16-Week_Level2.flv';
	video_array['cfa2']['image']	= '';
	video_array['cfa2']['title']	= 'Corporate Finance Demo';
	video_array['cfa2']['vid_width'] = 490;
	video_array['cfa2']['vid_height'] = 384;
	video_array['cfa2']['pop_width'] = 520;
	video_array['cfa2']['pop_height'] = 450;
	
	video_array['cfa3'] = new Array();
	video_array['cfa3']['flv'] 	= 'flashmedia/kaplan_demos/CFA/16-Week_Level3.flv';
	video_array['cfa3']['image']	= '';
	video_array['cfa3']['title']	= 'Execution of Portfolio Decisions Demo';
	video_array['cfa3']['vid_width'] = 490;
	video_array['cfa3']['vid_height'] = 384;
	video_array['cfa3']['pop_width'] = 520;
	video_array['cfa3']['pop_height'] = 450;
	
	$(this).show_multiple_video_popup(
		"demo_link",
		video_array,
		"homepageflash1", 
		"display_demo", 
		"rtmp://cp72569.edgefcs.net/ondemand/", "rtmp", 
		"homepageflash"
	);
	
	return false;

});
