/* Declare a namespace for the site */
var Site = window.Site || {};

/* Create a closure to maintain scope of the '$'
   and remain compatible with other frameworks.  */
(function($) {

	//same as $(document).ready();
	$(function() {

		$('.slideshow').cycle({
			fx: 'fade' // choose your transition type, ex: fade, scrollUp, shuffle, etc...
		});
		$('.content .txt').jScrollPane({
			showArrows: true,
			arrowScrollOnHover: true
		});


		$('nav ul.sf-menu').superfish({
			pathClass: 'subitem',
			delay: 0,
			speed: 'fast',
			autoArrows: false,
			dropShadows: false,
			disableHI: true,
		});

		$('.thumbs li a').click(function(){
			var imgSrc = $(this).attr('href');
			$('#big-view').attr('src',imgSrc);
			return false;
		});


		$('a.mailto').click(function(){
			var emailAddress = $(this).attr('rel')+'@'+$(this).attr('rev');
			var contactText = $(this).html();
			$.fancybox({
				'hideOnContentClick' : false,
				'overlayOpacity' : 0.5,
				'href' : '#contactForm',
				'autoDimensions' : false,
				'width' : 450,
				'height' : 150,
				'onStart' : function() {
					$('.contactForm').css({
						'display':'block',
						'position':'relative',
					});
					$('.contactForm h4').text(contactText);
					$('.contactForm #sendTo').val(emailAddress);
					$('.contactForm #alsoClick span.sendLink').html('<a href="mailto:'+emailAddress+'">click here</a>');
					$('.contactForm #alsoClick span.sendName').html('<a href="mailto:'+emailAddress+'">'+emailAddress+'</a>');
				},
				'onClosed' : function() {
					$('.contactForm').css('display','none');
				}
			});
			return false;
		});

	});

})(jQuery);
