// JavaScript Document
(function ($) {
// VERTICALLY ALIGN FUNCTION
$.fn.vAlign = function() {
	return this.each(function(i){
	var ah = $(this).height();
	var ph = $(this).parent().height();
	var mh = (ph - ah) / 2;
	$(this).css('margin-top', mh);
	});
};
})(jQuery);

$(document).ready(function(){
$(".subjects, .info").vAlign();

$('.content_fullview').hide();

$("#footer").click(function () {
	  $.scrollTo('#top', 'normal');
    });

$(".thumb").click(function () {
	$(this).parent().parent().slideToggle("slow");
});
$(".thumb").click(function () {
	$(this).parent().parent().next().slideToggle("slow");
});
$(".thumb").click(function () {
	$.scrollTo((this), 'normal');
});
$('.return').click(function () {
	$(this).parent().parent().slideToggle("slow");
    });
$('.return').click(function () {
	$(this).parent().parent().prev().slideToggle("slow");
    });
$('.full_img').click(function () {
	$(this).parent().parent().slideToggle("slow");
    });
$('.full_img').click(function () {
	$(this).parent().parent().prev().slideToggle("slow");
    });

jQuery.each(jQuery.browser, function(i) {
	if($.browser.name=='chrome' || $.browser.name=='msie'){
	$(".glow_left, .glow_right").css({opacity:"0.0"});
	
	$(".content_area").hover(function(){
		$(this).children(":first").css({opacity:"1.0"}); // This should set the opacity to 100% on hover
		$(this).children(":last").css({opacity:"1.0"}); // This should set the opacity to 100% on hover
		},function(){
			$(this).children(":first").css({opacity:"0.0"}); // This should set the opacity back to 0% on mouseout
			$(this).children(":last").css({opacity:"0.0"}); // This should set the opacity back to 0% on mouseout
		});
	$(".thumbover").css({opacity:"0.0"});
	$(".thumbover").hover(function () {
			$(this).css({opacity:"1.0"}); // This should set the opacity to 100% on hover
			},function(){
			$(this).css({opacity:"0.0"}); // This should set the opacity back to 0% on mouseout
		});
	
	if($("#web_page, #animation_page, #3d_page, #interface_page, #digital_page").is('*')) {
		$("#Digital").css({opacity:"1.0"});
		}
	else {
		$("#Digital").css({opacity:"0.0"});
		$("#Digital").hover(function () {
			$(this).css({opacity:"1.0"}); // This should set the opacity to 100% on hover
			},function(){
			$(this).css({opacity:"0.0"}); // This should set the opacity back to 0% on mouseout
			});
		}
	if($("#identity_page, #book_page, #fineart_page, #photo_page, #print_page").is('*')) {
		$("#Print").css({opacity:"1.0"});
		}
	else {
		$("#Print").css({opacity:"0.0"});
		$("#Print").hover(function () {
			$(this).css({opacity:"1.0"}); // This should set the opacity to 100% on hover
			},function(){
			$(this).css({opacity:"0.0"}); // This should set the opacity back to 0% on mouseout
			});
		}
	if($("#contact_page").is('*')) {
		$("#Contact").css({opacity:"1.0"});
		}
	else {
		$("#Contact").css({opacity:"0.0"});
		$("#Contact").hover(function () {
			$(this).css({opacity:"1.0"}); // This should set the opacity to 100% on hover
			},function(){
			$(this).css({opacity:"0.0"}); // This should set the opacity back to 0% on mouseout
			});
		}
	
	if($("#web_page").is('*')) {
		$("#Web").css({opacity:"1.0"});
		}
	else {
		$("#Web").css({opacity:"0.0"});
		$("#Web").hover(function () {
			$(this).css({opacity:"1.0"}); // This should set the opacity to 100% on hover
			},function(){
			$(this).css({opacity:"0.0"}); // This should set the opacity back to 0% on mouseout
			});
		}
	if($("#animation_page").is('*')) {
		$("#Animation").css({opacity:"1.0"});
		}
	else {
		$("#Animation").css({opacity:"0.0"});
		$("#Animation").hover(function () {
			$(this).css({opacity:"1.0"}); // This should set the opacity to 100% on hover
			},function(){
			$(this).css({opacity:"0.0"}); // This should set the opacity back to 0% on mouseout
		});
		}
	if($("#threed_page").is('*')) {
		$("#threeD").css({opacity:"1.0"});
		}
	else {
		$("#threeD").css({opacity:"0.0"});
		$("#threeD").hover(function () {
			$(this).css({opacity:"1.0"}); // This should set the opacity to 100% on hover
			},function(){
			$(this).css({opacity:"0.0"}); // This should set the opacity back to 0% on mouseout
			});
		}
	if($("#interface_page").is('*')) {
		$("#Interface").css({opacity:"1.0"});
		}
	else {
		$("#Interface").css({opacity:"0.0"});
		$("#Interface").hover(function () {
			$(this).css({opacity:"1.0"}); // This should set the opacity to 100% on hover
			},function(){
			$(this).css({opacity:"0.0"}); // This should set the opacity back to 0% on mouseout
			});
		}
		
	if($("#identity_page").is('*')) {
		$("#Identity").css({opacity:"1.0"});
		}
	else {
		$("#Identity").css({opacity:"0.0"});
		$("#Identity").hover(function () {
			$(this).css({opacity:"1.0"}); // This should set the opacity to 100% on hover
			},function(){
			$(this).css({opacity:"0.0"}); // This should set the opacity back to 0% on mouseout
			});
		}
	if($("#book_page").is('*')) {
		$("#Book").css({opacity:"1.0"});
		}
	else {
		$("#Book").css({opacity:"0.0"});
		$("#Book").hover(function () {
			$(this).css({opacity:"1.0"}); // This should set the opacity to 100% on hover
			},function(){
			$(this).css({opacity:"0.0"}); // This should set the opacity back to 0% on mouseout
			});
		}
	if($("#fineart_page").is('*')) {
		$("#FineArt").css({opacity:"1.0"});
		}
	else {
		$("#FineArt").css({opacity:"0.0"});
		$("#FineArt").hover(function () {
			$(this).css({opacity:"1.0"}); // This should set the opacity to 100% on hover
			},function(){
			$(this).css({opacity:"0.0"}); // This should set the opacity back to 0% on mouseout
			});
		}
	if($("#photo_page").is('*')) {
		$("#Photo").css({opacity:"1.0"});
		}
	else {
		$("#Photo").css({opacity:"0.0"});
		$("#Photo").hover(function () {
			$(this).css({opacity:"1.0"}); // This should set the opacity to 100% on hover
			},function(){
			$(this).css({opacity:"0.0"}); // This should set the opacity back to 0% on mouseout
			});
		}
		
	$("#to_top").css({opacity:"0.0"});
	$("#to_top").hover(function () {
		$(this).css({opacity:"1.0"}); // This should set the opacity to 100% on hover
		},function(){
			$(this).css({opacity:"0.0"}); // This should set the opacity back to 0% on mouseout
		});
	
	$(".return img").css({opacity:"0.0"});
	$(".return img").hover(function () {
		$(this).css({opacity:"1.0"}); // This should set the opacity to 100% on hover
		},function(){
			$(this).css({opacity:"0.0"}); // This should set the opacity back to 0% on mouseout
		});
}
else {
	$(".glow_left, .glow_right").stop().fadeTo("fast", 0.0);// This sets the opacity of the thumbs to fade down to 0% when the page loads
	
	$(".content_area").hover(function(){
		$(this).children(":first").stop().fadeTo("def", 1.0); // This should set the opacity to 100% on hover
		$(this).children(":last").stop().fadeTo("def", 1.0); // This should set the opacity to 100% on hover
		},function(){
			$(this).children(":first").stop().fadeTo("def", 0.0); // This should set the opacity back to 0% on mouseout
			$(this).children(":last").stop().fadeTo("def", 0.0); // This should set the opacity back to 0% on mouseout
		});
		
	$(".thumbover").stop().fadeTo("fast", 0.0);
	$(".thumbover").hover(function () {
			$(this).stop().fadeTo("fast", 1.0); // This should set the opacity to 100% on hover
			},function(){
			$(this).stop().fadeTo("fast", 0.0); // This should set the opacity back to 0% on mouseout
		});
	
	if($("#web_page, #animation_page, #3d_page, #interface_page, #digital_page").is('*')) {
		$("#Digital").stop().fadeTo("fast", 1.0);
		}
	else {
		$("#Digital").stop().fadeTo("fast", 0.0);
		$("#Digital").hover(function () {
			$(this).stop().fadeTo("fast", 1.0); // This should set the opacity to 100% on hover
			},function(){
			$(this).stop().fadeTo(1500, 0.0); // This should set the opacity back to 0% on mouseout
			});
		}
	if($("#identity_page, #book_page, #fineart_page, #photo_page, #print_page").is('*')) {
		$("#Print").stop().fadeTo("fast", 1.0);
		}
	else {
		$("#Print").stop().fadeTo("fast", 0.0);
		$("#Print").hover(function () {
			$(this).stop().fadeTo("fast", 1.0); // This should set the opacity to 100% on hover
			},function(){
			$(this).stop().fadeTo(1500, 0.0); // This should set the opacity back to 0% on mouseout
			});
		}
	if($("#contact_page").is('*')) {
		$("#Contact").stop().fadeTo("fast", 1.0);
		}
	else {
		$("#Contact").stop().fadeTo("fast", 0.0);
		$("#Contact").hover(function () {
			$(this).stop().fadeTo("fast", 1.0); // This should set the opacity to 100% on hover
			},function(){
			$(this).stop().fadeTo(1500, 0.0); // This should set the opacity back to 0% on mouseout
			});
		}
	
	if($("#web_page").is('*')) {
		$("#Web").stop().fadeTo("fast", 1.0);
		}
	else {
		$("#Web").stop().fadeTo("fast", 0.0);
		$("#Web").hover(function () {
			$(this).stop().fadeTo("fast", 1.0); // This should set the opacity to 100% on hover
			},function(){
			$(this).stop().fadeTo(1500, 0.0); // This should set the opacity back to 0% on mouseout
			});
		}
	if($("#animation_page").is('*')) {
		$("#Animation").stop().fadeTo("fast", 1.0);
		}
	else {
		$("#Animation").stop().fadeTo("fast", 0.0);
		$("#Animation").hover(function () {
			$(this).stop().fadeTo("fast", 1.0); // This should set the opacity to 100% on hover
			},function(){
			$(this).stop().fadeTo(1500, 0.0); // This should set the opacity back to 0% on mouseout
		});
		}
	if($("#threed_page").is('*')) {
		$("#threeD").stop().fadeTo("fast", 1.0);
		}
	else {
		$("#threeD").stop().fadeTo("fast", 0.0);
		$("#threeD").hover(function () {
			$(this).stop().fadeTo("fast", 1.0); // This should set the opacity to 100% on hover
			},function(){
			$(this).stop().fadeTo(1500, 0.0); // This should set the opacity back to 0% on mouseout
			});
		}
	if($("#interface_page").is('*')) {
		$("#Interface").stop().fadeTo("fast", 1.0);
		}
	else {
		$("#Interface").stop().fadeTo("fast", 0.0);
		$("#Interface").hover(function () {
			$(this).stop().fadeTo("fast", 1.0); // This should set the opacity to 100% on hover
			},function(){
			$(this).stop().fadeTo(1500, 0.0); // This should set the opacity back to 0% on mouseout
			});
		}
		
	if($("#identity_page").is('*')) {
		$("#Identity").stop().fadeTo("fast", 1.0);
		}
	else {
		$("#Identity").stop().fadeTo("fast", 0.0);
		$("#Identity").hover(function () {
			$(this).stop().fadeTo("fast", 1.0); // This should set the opacity to 100% on hover
			},function(){
			$(this).stop().fadeTo(1500, 0.0); // This should set the opacity back to 0% on mouseout
			});
		}
	if($("#book_page").is('*')) {
		$("#Book").stop().fadeTo("fast", 1.0);
		}
	else {
		$("#Book").stop().fadeTo("fast", 0.0);
		$("#Book").hover(function () {
			$(this).stop().fadeTo("fast", 1.0); // This should set the opacity to 100% on hover
			},function(){
			$(this).stop().fadeTo(1500, 0.0); // This should set the opacity back to 0% on mouseout
			});
		}
	if($("#fineart_page").is('*')) {
		$("#FineArt").stop().fadeTo("fast", 1.0);
		}
	else {
		$("#FineArt").stop().fadeTo("fast", 0.0);
		$("#FineArt").hover(function () {
			$(this).stop().fadeTo("fast", 1.0); // This should set the opacity to 100% on hover
			},function(){
			$(this).stop().fadeTo(1500, 0.0); // This should set the opacity back to 0% on mouseout
			});
		}
	if($("#photo_page").is('*')) {
		$("#Photo").stop().fadeTo("fast", 1.0);
		}
	else {
		$("#Photo").stop().fadeTo("fast", 0.0);
		$("#Photo").hover(function () {
			$(this).stop().fadeTo("fast", 1.0); // This should set the opacity to 100% on hover
			},function(){
			$(this).stop().fadeTo(1500, 0.0); // This should set the opacity back to 0% on mouseout
			});
		}
		
	$("#to_top").stop().fadeTo("fast", 0.0);
	$("#to_top").hover(function () {
		$(this).stop().fadeTo("fast", 1.0); // This should set the opacity to 100% on hover
		},function(){
			$(this).stop().fadeTo(1500, 0.0); // This should set the opacity back to 0% on mouseout
		});
	
	$(".return img").stop().fadeTo("fast", 0.0);
	$(".return img").hover(function () {
		$(this).stop().fadeTo("fast", 1.0); // This should set the opacity to 100% on hover
		},function(){
			$(this).stop().fadeTo("fast", 0.0); // This should set the opacity back to 0% on mouseout
		});
	}
	});
});
