// JavaScript Document
$(function() {
	$('#secondary').masonry({
		columnWidth: 172,
		itemSelector: '.box',
		animate: 'true'
	});
	$("a.fol_img").fancybox({
		'titleFromAlt': true,
		'titleShow': true,
		'opacity': true,
		'overlayOpacity': 1,
		'overlayColor': "",

		'overlayShow': true,
		'transitionIn': 'elastic',
		'transitionOut': 'none',
		'hideOnContentClick': true,
		'showCloseButton': true,
		'titlePosition': 'inside',
		'titleFormat': function(title, currentArray, currentIndex, currentOpts) {

			if (currentArray.length == 1) {
				return '<span id="fancybox-title-over">' + (title.length ? '' + title : '') + '</span>';
			}
			else {
				return '<span id="fancybox-title-over"><span class="floatRight">Image ' + (currentIndex + 1) + ' / ' + currentArray.length + '</span>' + (title.length ? '' + title : '') + '</span>';
			}

			// return '<span id="fancybox-title-over">Image ' + (currentIndex + 1) + ' / ' + currentArray.length + (title.length ? '   ' + title : '') + '</span>';
		}

	});
	$(".iframe").fancybox({
		'width': 700,
		'overlayOpacity': 1,
		'overlayColor': "",
		'height': 396,
		'type': 'iframe'
	}


	);
	//contact buttons
	$(document).ready(function() {
		$("#aboutBtn").toggleClass("btnOff", true);
		$("#contactBtn").toggleClass("btnOff", true);;
		//
		$("#aboutBtn").click(function() {
			_gaq.push(['_trackEvent', 'Buttons', 'Clicked', 'About']);
			if ($(this).is(".btnOff")) {
				$("#dimmer").css("height", $(document).height());
				//$("#dimmer").fadeIn("2000", "linear");
				$("#aboutWrapper, #dimmer").fadeIn("2000", "linear");
				$("#contactWrapper").fadeOut("2000", "linear");
				$(this).toggleClass("btnOff", false);
			} else {
				$("#contactBtn").toggleClass("btnOff", true);
				$("#aboutBtn").toggleClass("btnOff", true);
				$("#aboutWrapper").fadeOut("2000", "linear");
				$("#contactWrapper").fadeOut("2000", "linear");
				$("#dimmer").fadeOut("2000", "linear");
			};
		});
		$("#contactBtn").click(function() {
			_gaq.push(['_trackEvent', 'Buttons', 'Clicked', 'Contact']);
			if ($(this).is(".btnOff")) {
				$("#dimmer").css("height", $(document).height());
				//$("#dimmer").fadeIn("2000", "linear");
				$("#contactWrapper, #dimmer").fadeIn("2000", "linear");
				$("#aboutWrapper").fadeOut("2000", "linear");
				$(this).toggleClass("btnOff", false);
			} else {
				$("#contactBtn").toggleClass("btnOff", true);
				$("#aboutBtn").toggleClass("btnOff", true);
				$("#aboutWrapper").fadeOut("2000", "linear");
				$("#contactWrapper").fadeOut("2000", "linear");
				$("#dimmer").fadeOut("2000", "linear");
			};
		});
		$("#dimmer").click(function() {
			$("#contactBtn").toggleClass("btnOff", true);
			$("#aboutBtn").toggleClass("btnOff", true);
			$("#aboutWrapper").fadeOut("2000", "linear");
			$("#contactWrapper").fadeOut("2000", "linear");
			$("#dimmer").fadeOut("2000", "linear");
			$("#logWrapper").fadeOut("2000", "linear");
			$(".btnHolder").fadeIn("2000", "linear");
		});
	});


	//login
	$(window).jkey('shift+l', function() {

		$("#dimmer").css("height", $(document).height());
		//$("#dimmer").fadeIn("2000", "linear");
		$("#logWrapper, #dimmer").fadeIn("2000", "linear");
		$("#contactWrapper").fadeOut("2000", "linear");
		$(".btnHolder").fadeOut("2000", "linear");
		$(this).toggleClass("btnOff", false);
	});

	//img rollover
	$("a.fol_img").hover(function() {
		
		//vertically position
		//var dh = this.height();
	
		
		
		//alert($("a.fol_img").height());
		//
		$(".imgRollover", this).stop().animate({
			top: "60%"
		}, {
			queue: false,
			duration: 1000,
			easing: 'easeOutBack'
		});
	},

	function() {
		$(".imgRollover", this).stop().animate({
			top: "-50%"
		}, {
			queue: false,
			duration: 1000
		});
	});
	//$('#container').vAlign();

	

});
