// JavaScript Document

$(document).ready(function() {
	

	/*$('a', '.btn-unites').mouseenter(function(){
		$($(this).parents('div')[0]).removeClass().addClass($(this).parents('li').attr('class').replace('unite', 'btn-unites'));
	}).mouseleave(function(){
		$($(this).parents('div')[0]).removeClass().addClass('btn-unites');
	});*/
	

	$('#splashimg').mousemove(function(event) {
		var x = event.pageX - $(this).offset().left;
		var y = event.pageY - $(this).offset().top;
		//
		//console.log("Current mouse position: " + x + ", " + y );
		
		if( x > 29 && x < 269 && y > 120 && y < 301 ){
			$(this).css({'background-position':'0px -366px'});
		}
		if( x > 272 && x < 466 && y > 69 && y < 313 ){
			$(this).css({'background-position':'0px -732px'});
		}
		if( x > 489 && x < 673 && y > 33 && y < 296 ){
			$(this).css({'background-position':'0px -1098px'});
		}
		if( x > 712 && x < 850 && y > 85 && y < 330 ){
			$(this).css({'background-position':'0px -1464px'});
		}
		
		
	}).mouseenter(function(event) {
		$(this).css({'cursor':'pointer'}); 
	}).mouseleave(function(event) {
	 	$(this).css({'background-position':'left top'}); 
	}).click(function(event) {
		var x = event.pageX - $(this).offset().left;
		var y = event.pageY - $(this).offset().top;
		//
		//alert("Current mouse position: " + x + ", " + y );
		
		if( x > 29 && x < 269 && y > 120 && y < 301 ){ document.location = $('a','#header').eq(0).attr('href'); }
		if( x > 272 && x < 466 && y > 69 && y < 313 ){ document.location = $('a','#header').eq(1).attr('href'); }
		if( x > 489 && x < 673 && y > 33 && y < 296 ){ document.location = $('a','#header').eq(2).attr('href'); }
		if( x > 712 && x < 850 && y > 85 && y < 330 ){ document.location = $('a','#header').eq(3).attr('href'); }
		
		
	});
	
	

});
