﻿
// Menu bounce
$(document).ready(function() {
	$("#servicesLI").hoverIntent(
		function() {
			$(".servicesMenu").stop().animate({
				width: '125px',
				height: '200px'
			}, 500);
		},
		function() {
			$(".servicesMenu").hide();
			$(".servicesMenu").css({
				width: '125px',
				height: '0px'
			});
		}
	);

	// menu rollover
	$(".menuImage").each(function() {
		var t = $(this);
		var src1 = t.attr('src');
		var newSrc = src1.substring(src1.lastIndexOf('/'), src1.lastIndexOf('.'));
		var originalStart = src1.substring(0, src1.lastIndexOf('/'));

		t.hover(function() {
			$(this).attr('src', originalStart + newSrc + '-hover.' + /[^.]+$/.exec(src1));
		}, function() {
			$(this).attr('src', src1);
		});
	});
});


//	PORTFOLIO SCRIPT

$(document).ready(function() {
	$("#portfolioInfo").stop().fadeTo('fast', '0.8');
	$("#portfolioContainerDiv").hover(
		function() {
			$("#portfolioInfo").stop().fadeOut();
		},
		function() {
			$("#portfolioInfo").stop().fadeTo('slow', '0.8');

		}
	);

	$(".portfolioDiv").hover(
		function() {
			$(this).stop().animate({
				marginTop: '40px'
			}, 50);
			$(this).stop().animate({
				marginTop: '0px'
			}, 250);
		},
		function() {
			$(this).stop().animate({
				marginTop: '40px'
			}, 250);
		}
	);

	$(".portfolioDiv").click(
		function() {
			var cid = $(this).attr("id");
			var src = $(this).attr("src");
			var path = src.substring(0, src.lastIndexOf('/'));
			//alert(src);

			$("#portfolioZoom").css({ display: 'block' });
			$('#imageZoom').attr('src', path + "/" + cid + '.jpg');
			$("#imageZoom").fadeIn(600);
		}
	);

	$("#imageZoom").click(
		function() {
			$('#imageZoom').attr('src', '');
			$("#imageZoom").css({ display: 'none' });
			$("#portfolioZoom").css({ display: 'none' });
		}
	);
});



