function openSlider(current_item, amount) {
    jQuery("#"+current_item.attr('id')).stop().animate({top: "-"+amount+"px"}, {duration: "fast" });
}


function closeSlider(current_item, amount) {
    jQuery("#"+current_item.attr('id')).stop().animate({top: "-"+amount+"px"}, {duration: "slow" });
}

jQuery(document).ready(function(){
    jQuery(function() { 
        // initialize scrollable 
        jQuery("div.scrollable").scrollable({size: 7, speed: 3000}).circular().autoscroll({steps: 3, interval: 5000});
    });
    
    
    //quicklinks
    jQuery("#quicklinks").mouseover(function(){
	openSlider(jQuery(this), 0)
	});
    
    
    jQuery("#quicklinks").mouseout(function() {
	closeSlider(jQuery(this), 30);
	});
    
    //contact
    //Contact Form
    jQuery("a[href='http://mcin.org/contact-us/']").click(function() {
	jQuery('#contactUs').css({
	      left: (jQuery(window).width()/2 - jQuery('#contactUs').width()/2)
	    });	
	
	jQuery('#overlay').fadeIn("fast", function(){jQuery('#contactUs').slideDown("medium")});
	return false;
	});    

    jQuery(".closeContact").click(function() {
	    jQuery('#contactUs').slideUp("medium",
						function(){
							    jQuery('#overlay').fadeOut("fast")
							    });
	});

    jQuery(document).keyup(function(event){
	if (event.keyCode == 27) {
	    jQuery('#contactUs').slideUp("medium", function(){jQuery('#overlay').fadeOut("fast")});
	}
    });
    
});