/**
 * This file will handle the side slideshow that appears below the menu for each page.
 * The idea is that after an accurate size is calculated, this will
 * call the flash function to make the pictures appear (passing an xml filename).
 **/


 
$(function(){

		//load the flash jquery file so that we can build the flash embed code
		$.getScript(GBL_BASE_URL+'javascript/library/jquery/plugins/jquery.swfobject.min.js', function(){
			//Get the current page
			var loc = document.location.href;
			var splloc = loc.split('/');
			var xmlurl = 'http://taoschamber.org/xml/view/Sidebar-Pictures/gallery_list_pictures/'+splloc[3];
			
			var url = GBL_BASE_URL+'flash/taoschamber/sidebar/TCCC_Sidebar.swf';
			
			
			var menu_height = $('#horMenuContent').height();
			var oInt = setInterval(function(){
				var contentHeight = $('.contentBox').height(); 

				if(contentHeight >menu_height){
					clearInterval(oInt);
					setTimeout(function(){
						var total_height = $('#contentBody').height(); 
						var sidebar_height = total_height - menu_height;

						$('#flashSidebar').height(sidebar_height-250);
						$('#flashSidebar').css('top', (menu_height+45)+'px');
						
						$('#flashSidebar').flash({
							swf: url,
							name:'flashSidebar',
							movie:'flashSidebar',
							width:$('#flashSidebar').width(),
							height:'100%',
							wmode:'transparent',
							flashvars:{xmlUrl:xmlurl}
						},{version:9});
					}, 700);
				}
			}, 100);
		});
});

