/* pull down */

$(function() {
	$("#pull-down ul").css({display: "none"});
	$('#pull-down').droppy({speed: 300});
});

/* page scroll */

jQuery.easing.quart = function (x, t, b, c, d) {
	return -c * ((t=t/d-1)*t*t*t - 1) + b;
};

jQuery(document).ready(function(){
	if (! $.browser.opera) {
		jQuery('a[href*=#]').click(function() {
			if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) {
				var $target = jQuery(this.hash);
				$target = $target.length && $target || jQuery('[name=' + this.hash.slice(1) +']');
				if ($target.length) {
					var targetOffset = $target.offset().top;
					jQuery('html,body').animate({ scrollTop: targetOffset }, 1000, 'quart');
					return false;
				}
			}
		});
	}
});

/* image viewer */

$(document).ready(function(){
	$("a[rel^='prettyPhoto']").prettyPhoto({
		animationSpeed: 'normal', /* fast/slow/normal */
		padding: 40, /* padding for each side of the picture */
		opacity: 0.35, /* Value betwee 0 and 1 */
		showTitle: true, /* true/false */
		allowresize: true, /* true/false */
		counter_separator_label: '/', /* The separator for the gallery counter 1 "of" 2 */
		theme: 'dark_rounded', /* light_rounded / dark_rounded / light_square / dark_square */
		callback: function(){}
	});
});

/* roll over */
$(function() {
  $("img.rollover")
    .each(function() {
      var baseImage = $(this).attr("src");
      var ext = baseImage.substring(baseImage.lastIndexOf('.'), baseImage.length);
      var overImage = baseImage.replace(ext, '_over' + ext);
      new Image().src = overImage;
      $(this).attr({basesrc: baseImage, oversrc: overImage});
    })
    .hover(function() {
        $(this).attr({src: $(this).attr("oversrc")});
      },
      function() {
        $(this).attr({src: $(this).attr("basesrc")});
    }
  );
});
