$(document).ready(function() {
	
/*

this function makes the call to shadowbox for all videos that have the a.video_window_link

*/


	var sb_title = '';
	var sb_title_save = '';
	var sb_content = '';
	
	Shadowbox.init({overlayOpacity: 0.7 });
	
 	$('a.video_window_link').each(function(arr) {
		$(this).click(
			function() {
				//alert('video_window_link click! -- number: ' + arr);
				/* 
				using the ID attribute in the <a> element to hold the ACTUAL title to pass to shadowbox.  Do this
				to prevent the long link from being displayed as a browser tooltip (the title contains both the track name
				AND the "add_to_cart" link).  to get this to work as expected using the "this" car, it was necessary to temporarily
				set the actual TITLE attribute to the ID attribute, the call to shadowbox then uses the TITLE attribute to set
				the shadowbox CAPTION.  The actual TITLE attribute is then reset to it;s original value to preserve the shortened
				tooltip
				*/
				sb_title=$(this).attr('id');
				sb_content=$(this).attr('href');
				sb_title_save=$(this).attr('title');
				$(this).attr('title', sb_title)
				//alert('id attribute: ' + sb_title + ' -- href: ' + sb_content);
				
				/*
				this is the shadowbox code notation needed to set-up each a.video_window_link that shares COMMON attributes.
				Atrributes like TITLE which are unique to each link cannot be set using setup and instead a separate call is made
				for each link "click" to Shadowbox.open passing the actual <a> LINK and it's attributes.
				*/
				Shadowbox.setup('a.video_window_link',{
						height: 380,
						width: 640,
						autoplayMovies: true
				});
				Shadowbox.open(this);
				$(this).attr('title', sb_title_save)
				
				//Shadowbox.open(sb_options);
				
				/*Shadowbox.open(this, {
					title: (sb_title),
					height: 380,
					width: 640,
					autoplayMovies: true
				} );*/
				
				return false;
			}
		); // end click
		
	}); // end each
  
}); // end ready
