
$(document).ready(function(){

	$("#navi a").hover(function() {
		$(this).animate({ color: "#372064" }, 160);
	},function() {
		$(this).animate({ color: "#FFFFFF" }, 160);
	});



	$("#linkwhoweare").click(function() {
		$('html, body').animate({ scrollTop: 692 }, 'slow');
		$('#wh').delay(200).fadeIn('slow');
		document.title = 'Who we are - Illuvium - Digital Marketing';
		_gaq.push(['_trackPageview', '#who-we-are']);
	});

	$("#linkwhatwedo").click(function() {
		$('html, body').animate({ scrollTop: 1085 }, 'slow');
		$('#wt').delay(200).fadeIn('slow');
		document.title = 'What we do - Illuvium - Digital Marketing';
		_gaq.push(['_trackPageview', '#what-we-do']);
	});

	$("#linkproducts").click(function() {
		$('html, body').animate({ scrollTop: 1384 }, 'slow');
		$('#pr').delay(200).fadeIn('slow');
		document.title = 'Products - Illuvium - Digital Marketing';
		_gaq.push(['_trackPageview', '#products']);
	});

	$("#linkcontactus").click(function() {
		$('html, body').animate({ scrollTop: 1705 }, 'slow');
		$('#ct').delay(200).fadeIn('slow');
		$('#ct').css('margin-top', '-71px');
		$('#ct').css('margin-right', '-8px');
		document.title = 'Contact us - Illuvium - Digital Marketing';
		_gaq.push(['_trackPageview', '#contact']);
	});

	$('.gotop').click(function(){
		$('html, body').animate({ scrollTop: 0 }, 'slow');
		$(this).fadeOut('fast');
		document.title = 'Illuvium - Digital Marketing';
		_gaq.push(['_trackPageview', '#top']);
	})
	
	$('#slider').hide();
	$('.gotop').hide();
	// $('#productsby').hide();

	$('#works').click(function(){
		$('#productsby').fadeOut('fast');
		$('#slider').delay(500).fadeIn('fast');
		document.title = 'Works - Illuvium - Digital Marketing';
		_gaq.push(['_trackPageview', '#works']);
	});
	
	$('#pr4a5d0').click(function(){
		$('#slider').fadeOut('fast');
		$('#productsby').delay(500).fadeIn('fast');
		document.title = 'Products - Illuvium - Digital Marketing';
		_gaq.push(['_trackPageview', '#products']);
	});
	
/*

_gaq.push(['_trackEvent', 'Go To', 'To', '4']);

	var elem = window.location.hash;
	$('a[href$="' + elem + '"]').click();
	$('a[href$="' + elem + '"]').css('border','1px solid red');
	alert(0);

	var hash = window.location.hash;

	var elem = $(location.hash);

	if( elem.length > 0 ) {
		elem.click();
	}
*/
	var p = $('#view').position();

	$('#maps').css('margin-left', (( p.left/2.5 ) + 71) + 'px');
	$('#maps').css('margin-top', '-' + p.top/11 + 'px');
	$('#maps').hide();

	$('#view').hover(
		function() {
			$('#maps').fadeIn('fast');
			_gaq.push(['_trackEvent', 'Maps', 'View Map', 'ok']);
		},
		function() {
			$('#maps').delay(1000).fadeOut('slow');
			_gaq.push(['_trackEvent', 'Maps', 'View Map', 'bye']);
		}
	)
	$(".scrollable").scrollable({circular: true});
/*
	$(".scrollable").scrollable({circular: true}).navigator().autoscroll({autoplay: true, interval:6000});
*/

	$('#send').click(function(){
		$.ajax({
			type: 'POST',
			url: $('#newsletter').attr('action'),
			data: $('#newsletter').serialize(),
			success: function(data) {
				if (data) {
					$('#errordiv').css('display', 'block');
					$('#errordiv').html(data);
				} else {
					$('#errordiv').css('display', 'block');
					$('#errordiv').html('Error, contact at info@illuvium.com');
				}
			}
		});
		return false;
	});
});



















