

$sliding = false;

function closePage (refURL)
		{
			$url = refURL;

			$("#pagebody").stop(true);
			$("#prefooter-fill").stop(true);
			
			$('html').scrollTop() ? $sTime=750 : $sTime=0;
			
				$('html, body').animate({scrollTop:0}, $sTime, 
				function(){  //scroll to top
					$("#loading").fadeTo(500, 1);
					$("#prefooter-fill").slideUp(1000);
					$("#presentation").fadeTo(700, 1, function(){$(this).html('')});
					$("#pagebody").animate({'height': 0}, 1125, function(){$(this).hide(), document.location = $url;});
					return false; //pause for scroll, slide up & go to url of link				
				});
			

		}
		
function slidePage ()
		{
			
			$sliding = true;
			$("#pagebody").stop(true);
			$("#prefooter-fill").stop(true);

			$('html').scrollTop() ? $sTime=750 : $sTime=0;
			
				$('html, body').animate({scrollTop:0}, $sTime, 
				function(){  //scroll to top

				$sliding = false;	
					return false; //pause for scroll, slide up & go to url of link				
				});
			

		}


	$(document).ready(function(){
	
	
		if (!jQuery.browser.msie) {$("#tab").css({opacity: '0'}).animate({opacity: '1'}, 500);}
		
		$("#prefooter-fill").hide().animate({top: '0px'}, 1000).slideToggle(1000);
		$("#pagebody").hide().animate({top: '0px'}, 1000).slideToggle(2500);
		
		$(".showprofile").css("display", "inline");
		$(".myprofile").hide();

		if(!jQuery.browser.msie) {		
		
		$("#menuItems").animate({marginRight:'100px', opacity: 0.01},1).fadeTo(4000, 0).animate({marginRight:'164px',  opacity: 1}, {"duration":1500});
		
		}
		
		$("#loading").show().fadeTo(750, 0);
		
		
		
		//On link/slider click...
		
		$(".slider").click(function(ev){
			closePage($(this).attr("href"));
			ev.preventDefault();
		});
		
		$(".slideUp").click(function(ev){
			slidePage();
			ev.preventDefault();
		})
		
		$(".expand").click(function(ev){
			//ev.preventDefault();			
		
			var pro = $(this).parents('.entry').find(".myprofile")
			var path = $(this).parents('.entry').find(".showprofile").find(".showhide");
			
			if(pro.is(":visible")){
				pro.slideUp(500);
				path.text("Open Profile");
			} else {
				var scrollto = $(this).parents('.entry');
				
				$(".myprofile").slideUp(500)
				$(".showprofile").find(".showhide").text("Open Profile");
				
				path.text("Close Profile");
				
				pro.slideDown(500, function(){$('html, body').animate({scrollTop: scrollto.offset().top - 20}, 750);});
			}
			
			
		});
		
		$(".linkFader").click(function(ev){
			ev.preventDefault();
		});
		
		
		//alert($flashVrr);
		$tempHTML = '<object id="flashHeader" width="1004" height="184"><param name="movie" value="/wp-content/themes/AboveStated2/images/temp.swf"><param name="wmode" value="transparent"><param name="allowScriptAccess" value="always"><embed name="flashHeader" swliveconnect="true" src="/wp-content/themes/AboveStated2/images/temp.swf" type="application/x-shockwave-flash" wmode="transparent" width="1004" height="184"></object>';
			
		$("#presentation").animate({top: '0px'}, 1000, function(){$(this).html($tempHTML)});
		
		
		
		
		
		
		/*$(function() {
        	$('.gallery a').lightBox();
    	}); */
		
		$(function(){
			$(".gallery a[rel^='prettyPhoto']").prettyPhoto({theme:'facebook'});
		});
		
		
	
		
	});
