// JavaScript Document
$(document).ready(function() {
	var dh = 0;

	$('.single-accent').each(function() {
		if( dh < $(this).height() ) {
			dh = $(this).height();
		}
	});
	$('.single-accent').css('height', dh+'px');
	
	$('.cat-apple').mouseenter(function (){ hoverOn(1) }).mouseleave(function (){ hoverOff(1) });
	$('.apple-accent').mouseenter(function (){ hoverOn(1) }).mouseleave(function (){ hoverOff(1) });
	$('.cat-service').mouseenter(function (){ hoverOn(2) }).mouseleave(function (){ hoverOff(2) });
	$('.service-accent').mouseenter(function (){ hoverOn(2) }).mouseleave(function (){ hoverOff(2) });
	$('.cat-color').mouseenter(function (){ hoverOn(3) }).mouseleave(function (){ hoverOff(3) });
	$('.color-accent').mouseenter(function (){ hoverOn(3) }).mouseleave(function (){ hoverOff(3) });
	$('.cat-print').mouseenter(function (){ hoverOn(4) }).mouseleave(function (){ hoverOff(4) });
	$('.print-accent').mouseenter(function (){ hoverOn(4) }).mouseleave(function (){ hoverOff(4) });
});

function hoverOn(a){
	if(a==1){
		$('.cat-apple').css('background-position', '-220px 0px');
		$('.cat-accents').css('background-position', '-880px bottom');
	}
	if(a==2){
		$('.cat-service').css('background-position', '-220px 0px');
		$('.cat-accents').css('background-position', '-1760px bottom');
	}
	if(a==3){
		$('.cat-color').css('background-position', '-220px 0px');
		$('.cat-accents').css('background-position', '-2640px bottom');
	}
	if(a==4){
		$('.cat-print').css('background-position', '-220px 0px');
		$('.cat-accents').css('background-position', '-3520px bottom');
	}
}

function hoverOff(a){
	if(a==1){
		$('.cat-apple').css('background-position', '');
		$('.cat-accents').css('background-position', '0px bottom');
	}
	if(a==2){
		$('.cat-service').css('background-position', '');
		$('.cat-accents').css('background-position', '0px bottom');
	}
	if(a==3){
		$('.cat-color').css('background-position', '');
		$('.cat-accents').css('background-position', '0px bottom');
	}
	if(a==4){
		$('.cat-print').css('background-position', '');
		$('.cat-accents').css('background-position', '0px bottom');
	}
}
