$(document).ready(function(){

$('#topSlider').css('top','-280px');

$('.specialsTab').click(function(){
	if ($('#topSlider').css("top") == '0px') {
    	hideHeader();
    } else {
    	showHeader();
    }
});

$('a.close').click(hideHeader);
	function showHeader() {
    $('#topSlider').animate({ top: '0px' }, 500 );
    $('.specialsTab').animate({ marginTop: '0px' }, 500 );
    //$('.logoLink').animate({opacity: 0}, 100 );
    //$('.info').animate({opacity: 0}, 100 ); 
    	}
	function hideHeader() {
		$('#topSlider').animate({ top: '-280px' }, 500 );
		$('.specialsTab').animate({ marginTop: '-50px' }, 700 );
		//$('.logoLink').animate({opacity: 1}, 100 );
		//$('.info').animate({opacity: 1}, 100 );
        }

//$('.specialsTab').toggle(function() {
//$('#topSlider').animate({top: 0}, 1000)}, function() {
//$('#topSlider').animate({top: -180}, 1000);});

/* the scrolling magic link */

$('a[href*=#]').click(function() {
	    if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'')
	    && location.hostname == this.hostname) {
	      var $target = $(this.hash);
	      $target = $target.length && $target
	      || $('[name=' + this.hash.slice(1) +']');
	      if ($target.length) {
	        var targetOffset = $target.offset().top;
	        $('html,body')
	        .animate({scrollTop: targetOffset}, 500);
	        
	        
			
				       
	       return false;
	      }
	    }
	 });
	 
	function gup( specials )
		{
	  	specials = specials.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
	  	var regexS = "[\\#&]"+specials+"=([^&#]*)";
	  	var regex = new RegExp( regexS );
	  	var results = regex.exec( window.location.href );
	      
	    
	    if( results == null )
	    return "";
	  	else
	    return results[1];
		}  
    
    
      
    	if ([gup('specials')] == 1 ) {
    		showHeader();
			}

});
