/**
 * @author samuelme
 */
var substanPage = function(){
	//private vars
	
	//public methods
	return{
		
		init : function(){
			
		},
		show : function(){
			$.ajax({
					  url: "substantiation.php",
					  cache: false,
					  success: function(html){
					  	$('#videoHolder').hide();
					    var $subs = $(html).find('#subHolder');
						$subs.css({display:'none'}).appendTo('#contentHolder');
						
						$subs.fadeIn('slow');
						//home button
						$subs.find('h1 a').bind("click",function(){
							 SWFAddress.setValue("?p=facility");
							 $(this).fadeTo("fast", 0);
							return false;
						});
						 $("img").pngfix();
						setupSubPage();
						
					  }
					});
				
				
				 SWFAddress.setTitle("Reality: THE SCIENCE BEHIND THE FACTS");
		},
		remove : function(){
			
		}
	}
	
	//private methods
	function setupSubPage(){
		
			
		
		//quick nav
		$('.quicknav li a').each(function(){
			$(this).bind('click',function(event){
				var id = $(this).attr('href');
				if($.browser.msie){
					var s = id.lastIndexOf('/')+1;
					id = id.substring(s,id.length);
				}

				$('#contentHolder').scrollTo( id, 500 );
				
				event.preventDefault();
			});
		});
		
		//back to top
		
		$('a.btt').each(function(){
			$(this).bind('click',function(event){
				
				var id = $(this).attr('href');
				if($.browser.msie){
					var s = id.lastIndexOf('/')+1;
					id = id.substring(s,id.length);
				}
				
				$('#contentHolder').scrollTo( id, 500 );
				
				event.preventDefault();
			});
		});
		
		$('a.return').bind('click',function(){
			 SWFAddress.setValue("?p=facts");
			
			return false;
		});
	}
	
	function debug($obj) {
		if (window.console && window.console.log)
			window.console.log($obj);
	};
	
}()
