$(document).ready(function(){
// Expandable Video Gallery - as used on CPHC conference page
  //hide all the content stuff including the target container so it can animate open
  	$('div.evg_summary').hide();
  	$('div.evg_attributes').hide();
	$('div#evg_content_display').hide();
  
  //catch all rollovers on <a> tags with the proper class
  	$("a.evg_link").hover(
	<!-- set the mouse over behavior -->
	function() {
		//set a variable to the value of the href attribute, which equals the corresponding content
		var vSummary=$(this).attr("title");
		//set a variable to the html value of the specified container
		var vSummaryContent=$('div.'+vSummary+' div.evg_summary').html();
		//write that html into the specified container
		$('div#evg_summary_display').html(vSummaryContent);
		//write in a background to the summary
		$('div#evg_summary_display').css({"background-image":"url(/SiteCollectionImages/images/cphc/evg_summary_text_background.jpg)"});
		},
	<!-- set the mouse out behavior -->
	function() {
		//replace the target container html with something as the default state
		$('div#evg_summary_display').html('<p></p>');
		//write in the default background to the summary
		$('div#evg_summary_display').css({"background-image":"url(/SiteCollectionImages/images/cphc/evg_summary_background.jpg)","background-color":"#fff"});

	})
	
	// catch all the clicks on links with the proper class
	$('a.evg_link').click(
	function() {
		//set a variable to the value of the href attribute, which equals the corresponding content
		var vSummary=$(this).attr("title");
		//set a variable to the html value of the specified attributes container
		var vAttributesContent=$('div.'+vSummary+' div.evg_attributes').html();
		//set a variable to the value of the video filepath
		var vV=$('div.'+vSummary+' div.evg_video a').attr("href");
		//write the appropriate content html into the specified content container
		$('div#evg_content_display').html(vAttributesContent);
		//swap out the a tag with the correct video html
		$('div#evg_content_display div.evg_video a').replaceWith('<object CLASSID="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95" codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701" type="application/x-oleobject" width="320" height="300"><param name="fileName" value="'+vV+'"><param name="autoStart" value="true"><embed type="application/x-mplayer2" pluginspage="http://www.microsoft.com/Windows/MediaPlayer/" width="320" height="300" src="'+vV+'" autostart="true"></embed></object>');
		//make the generic container visible
		$('div#evg_content_display').show();
	})
	
	// Static video gallery player with links - as used on the CPHC testimonials video page
	// NOTE - targets a single player placeholder sitting on the page.
	// catch all the clicks on links with the proper class
	$('a.cm_video_link').click(
		function() {
			//set a varaible to the value of the video path
			var cmVideo=$(this).attr("href");
			//write the appopriate html into the appropriate container to display whatever video was selected
			$('div.cm_video_player img.cm_video_player_placeholder').replaceWith('<object CLASSID="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95" codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701" type="application/x-oleobject" width="320" height="300"><param name="fileName" value="'+cmVideo+'"><param name="autoStart" value="true"><param name="ShowStatusBar" value="1"><param name="CaptioningID" value="CC"><embed type="application/x-mplayer2" pluginspage="http://www.microsoft.com/Windows/MediaPlayer/" width="320" height="300" src="'+cmVideo+'" autostart="true" showstatusbar="1" CaptioningID="CC"></embed></object>');
		return false;
	})
	
	// Generic Click to Play Video from Thumbnail in a sidebar type box
	// catch all the clicks on links with the proper class
	$('a.cm_video_thumb').click(
		function() {
			//set a varaible to the value of the video path
			var cmVideoThumb=$(this).attr("href");
			//write the appopriate html into the appropriate container to display whatever video was selected
			$('div.highlight_box_video').replaceWith('<object CLASSID="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95" codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701" type="application/x-oleobject" width="320" height="300" style="float:right; margin:0px 0px 10px 10px;"><param name="fileName" value="'+cmVideoThumb+'"><param name="autoStart" value="true"><param name="ShowStatusBar" value="1"><param name="CaptioningID" value="CC"><embed type="application/x-mplayer2" pluginspage="http://www.microsoft.com/Windows/MediaPlayer/" width="320" height="300" src="'+cmVideoThumb+'" autostart="true" showstatusbar="1" CaptioningID="CC"></embed></object>');
			return false;
	})
	
	// Generic Click to Play Video from just any thumbnail(s)
	// set a variable to a default value so it can be incremented
	// to accommodate multiple links on the same page to different videos
	var generateID = 1;
	// catch all the clicks on links with the proper class
	$('a.cm_video_thumb_image').click(
		function() {
			//set a varaible to the value of the video path
			var cmVideoThumbImage=$(this).attr("href");
			//increment the ID of the clicked element so it's unique now
			this.id="video"+generateID++;
			//set a variable to the value of the new ID of the element
			var WhichVideo=$(this).attr('id');
			//write the appopriate html into the appropriate container to display whatever video was selected
			$('#'+WhichVideo).replaceWith('<object CLASSID="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95" codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701" type="application/x-oleobject" width="320" height="300" style="float:right; margin:0px 0px 10px 10px;"><param name="fileName" value="'+cmVideoThumbImage+'"><param name="autoStart" value="true"><param name="ShowStatusBar" value="1"><param name="CaptioningID" value="CC"><embed type="application/x-mplayer2" pluginspage="http://www.microsoft.com/Windows/MediaPlayer/" width="320" height="300" src="'+cmVideoThumbImage+'" autostart="true" showstatusbar="1" CaptioningID="CC"></embed></object>');
			return false;
	})

	
	
	// Press Release Media Player
	$('div.press_release_listing:first').css({'border-top':'1px dotted #e3dcc0'});
	// Find clicks on the correct element
	$('a.cm_media').click(
		function() {
			var href = $(this).attr("href");
			//check if the href has 
			if(href.match("mp3"))
			{
				var vMediaHeight="100";
			}
			else if(href.match("wmv"))
			{
				var vMediaHeight="300";
			}
			// set a variable to the href value
			var cmVideo=$(this).attr("href");
			// remove the player from all the previous instances of press releases in case another had been played already
			$('.cm_inline_video_container').remove();
			// insert the player wrapper and player code into this press release just before the appropriate p tag
			$(this).siblings("p:first").before('<div class="cm_inline_video_container"><DIV class="generic_rounded_corner_top_video"><IMG style="margin:-7px -7px 0px 0px;" alt="" src="http://medicalcenter.osu.edu/SiteCollectionImages/imgs/rounded_corners_generic.gif"></DIV><object CLASSID="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95" codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701" type="application/x-oleobject" width="320" height="'+vMediaHeight+'"><param name="fileName" value="'+cmVideo+'"><param name="autoStart" value="true"><param name="CaptioningID" value="CC"><embed type="application/x-mplayer2" pluginspage="http://www.microsoft.com/Windows/MediaPlayer/" width="320" height="'+vMediaHeight+'" src="'+cmVideo+'" autostart="true" CaptioningID="CC"></embed></object><div id="CC"></div><DIV class="generic_rounded_corner_bottom"><IMG style="margin:0px -7px -7px 0px;" alt="" src="http://medicalcenter.osu.edu/SiteCollectionImages/imgs/rounded_corners_generic.gif"></DIV></div>');
			// set the width so it displays correctly now that it has something in it
			$(this).siblings('.cm_inline_video_container').css({'width':'321','text-align':'left','background':'#e3dcc0'});
			$(this).siblings('.cm_inline_video_container').children('.generic_rounded_corner_top_video').css({'width':'321'});
			$(this).siblings('.cm_inline_video_container').children('.generic_rounded_corner_bottom').css({'width':'321'});
			// don't open a new window as long as javascript is enabled
			return false;
	})
	
  });