$(document).ready(function()
{

$('.interior').hide();
$('.interior').delay(300).fadeIn();

var $marginLefty = $('#image1');
 $('#header1').hide();
 
 $marginLefty.hide().animate({
marginLeft: parseInt($marginLefty.css('marginLeft'),10) == 0 ?
$marginLefty.outerWidth() : 0
});

  //$('#image1').hide();
  //$('#image1').hide().animate({marginLeft: "500px"});
 //var $marginLefty = $('#image1');
 //$('.slides img:first').css({ height: "1px",width: "627px"});
 // $('.slides img:first').show();
  //$('.slides img:second').show();
  //$('.slides img:first').animate({ height: "370px"},10000);
  //$('.slides img:first').slideDown('slow');
 $('#header1').animate({width: 'toggle'},500); 
//$('#image1').animate({width: 'toggle'},500)();

//$('#image1').delay(1400).animate({width: 'toggle', marginLeft: "0px"},500);

$marginLefty.animate({width:"show",
marginLeft: parseInt($marginLefty.css('marginLeft'),10) == 621 ?
$marginLefty.outerWidth() : 0
});


  

          
       

   
   
	//slide("#navlist", 55, 0, 150, .8);
$('a').click(function(){
	// Get the url of the link
		var toLoad = $(this).attr('href');

	$marginLefty.animate({width:"hide",
marginLeft: parseInt($marginLefty.css('marginLeft'),10) == 0 ?
$marginLefty.outerWidth() : 0
});

var $marginLeftySub = $('.subimage');
	$marginLeftySub.animate({width:"hide",
marginLeft: parseInt($marginLeftySub.css('marginLeft'),10) == 0 ?
$marginLeftySub.outerWidth() : 0
});

 $('#header1').animate({width: 'toggle'},500); 
 $('.subheader').animate({width: 'toggle'},500); 
	 // Wait 700ms before loading the url
		$(this).delay(1000, function(){
			window.location = toLoad;
		});

        // Don't let the link do its natural thing
		return false;
	});

});

function slide(navigation_id, pad_out, pad_in, time, multiplier)
{
	// creates the target paths
	var list_elements = navigation_id + " li.sliding-element";
	var link_elements = list_elements + " a";
	
	// initiates the timer used for the sliding animation
	var timer = 0;
	
	// creates the slide animation for all list elements 
	$(list_elements).each(function(i)
	{
		// margin left = - ([width of element] + [total vertical padding of element])
		$(this).css("margin-right","-180px");
		// updates timer
		timer = (timer*multiplier + time);
		$(this).animate({ marginRight: "0" }, timer);
		$(this).animate({ marginRight: "15px" }, timer);
		$(this).animate({ marginRight: "0" }, timer);
	});





	// creates the hover-slide effect for all link elements 		
	$(link_elements).each(function(i)
	{
	
		
		$(this).hover(
		function()
		{
			$(this).animate({ paddingRight: pad_out }, 150);
		},		
		function()
		{
			$(this).animate({ paddingRight: pad_in }, 150);
		});
	});
}
