jQuery(function( $ ){
		var username = 'danielkemeny';		
	// TOOLTIP AREA
	var timer;
	var activeitem=1;

function mouseoverActiontooltip(event)
{
$("body").append("<p id='tooltip'>"+ this.rel + "</p>");
$("#tooltip").css("left",(event.pageX - 30) + "px");
$("#tooltip").css("top",(event.pageY - 60) + "px");
}

function mouseoutActiontooltip(event)
{
$("#tooltip").remove();
}

function mousemoveActiontooltip(event)
{
$("#tooltip").css("left",(event.pageX - 30) + "px");
$("#tooltip").css("top",(event.pageY - 60) + "px");
}

function mouseoverActiontooltip_twitter(event)
{


$.getScript('http://twitter.com/statuses/user_timeline/' + username + '.json?callback=twitterCallback2&count=1');	


$("body").append("<p id='tooltip_twitter'>"+ this.rel + "<br /><br /><img style='margin-left:55px;' src='./images/lightbox-ico-loading_black.gif' alt='loading' /><br /><br />If you can't wait, then CLICK!</p>");
$("#tooltip_twitter").css("left",(event.pageX - 30) + "px");
$("#tooltip_twitter").css("top",(event.pageY - 130) + "px");
}

function mouseoutActiontooltip_twitter(event)
{
	$("#tooltip_twitter").remove();
}

function mousemoveActiontooltip_twitter(event)
{
$("#tooltip_twitter").css("left",(event.pageX - 30) + "px");
$("#tooltip_twitter").css("top",(event.pageY - 130) + "px");
}

function mouseoverActiontooltipImage(event)
{
$("body").append("<p id='tooltip'><img src="+ this.rel + "></img></p>");
$("#tooltip").css("left",(event.pageX + 20) + "px");
$("#tooltip").css("top",(event.pageY - 10) + "px");
}

function mouseoutActiontooltipImage(event)
{
$("#tooltip").remove();
}

function mousemoveActiontooltipImage(event)
{
$("#tooltip").css("left",(event.pageX + 20) + "px");
$("#tooltip").css("top",(event.pageY - 10) + "px");
}

$('.tooltip').bind('mouseenter', mouseoverActiontooltip);

$('.tooltip').bind('mouseleave', mouseoutActiontooltip);

$('.tooltip').bind('mousemove', mousemoveActiontooltip);

$('.leftbtn').bind('mouseenter', mouseoverActiontooltip);

$('.leftbtn').bind('mouseleave', mouseoutActiontooltip);

$('.leftbtn').bind('mousemove', mousemoveActiontooltip);

$('.rightbtn').bind('mouseenter', mouseoverActiontooltip);

$('.rightbtn').bind('mouseleave', mouseoutActiontooltip);

$('.rightbtn').bind('mousemove', mousemoveActiontooltip);

$('.tooltip_twitter').bind('mouseenter', mouseoverActiontooltip_twitter);

$('.tooltip_twitter').bind('mouseleave', mouseoutActiontooltip_twitter);

$('.tooltip_twitter').bind('mousemove', mousemoveActiontooltip_twitter);

$('.tooltipImage').bind('mouseover', mouseoverActiontooltipImage);

$('.tooltipImage').bind('mouseout', mouseoutActiontooltipImage);

$('.tooltipImage').bind('mousemove', mousemoveActiontooltipImage);



	// END OF TOOLTIP AREA
				
	/**
	 * Demo binding and preparation, no need to read this part
	 */

	$.easing.elasout = function(x, t, b, c, d) {
		var s=1.20158;var p=0;var a=c;
		if (t==0) return b;  if ((t/=d)==1) return b+c;  if (!p) p=d*.3;
		if (a < Math.abs(c)) { a=c; var s=p/4; }
		else var s = p/(2*Math.PI) * Math.asin (c/a);
		return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b;
	};
	
	$('#menu a').fadeTo("slow", 0.5);
	$('#footer a').fadeTo("slow", 0.5);
	
	$('#page1').fadeTo("500", 1);

	//$('.mainimage').fadeTo("slow", 0.8);
	
	$('#page1').hover(
	  function () {
        $(this).fadeTo("500", 1);
      }, 
      function () {
		  if (activeitem!=1) $(this).fadeTo("500", 0.5);
      }
	);
	
	$('#page2').hover(
	  function () {
        $(this).fadeTo("500", 1);
      }, 
      function () {
        if (activeitem!=2) $(this).fadeTo("500", 0.5);
      }
	);
	
	$('#page3').hover(
	  function () {
        $(this).fadeTo("500", 1);
      }, 
      function () {
        if (activeitem!=3) $(this).fadeTo("500", 0.5);
      }
	);
	
	$('#page4').hover(
	  function () {
        $(this).fadeTo("500", 1);
      }, 
      function () {
        if (activeitem!=4) $(this).fadeTo("500", 0.5);
      }
	);
	
	$('#footer a').hover(
	  function () {
        $(this).fadeTo("500", 1);
      }, 
      function () {
        $(this).fadeTo("500", 0.5);
      }
	);
	
	$('.images img').hover(
	  function () {
        $(this).fadeTo("500", 1);
      }, 
      function () {
        $(this).fadeTo("500", 0.7);
      }
	);
	
	// Reset the screen to (0,0)
	$('#s_content').scrollTo( 0 );
	$('#gallery_webdesign').scrollTo( {top:0,left:0} , 0 );
	$('#gallery_printed_media').scrollTo( {top:0,left:0} , 0 );	
	$('#gallery_illustrations').scrollTo( {top:0,left:0} , 0 );	
	
	$('.page1').click(function page1(){
		$('#s_content').stop(true).scrollTo( {top:0,left:0} , 200 );
		activeitem=1;
		$('#page1').fadeTo("500", 1);
		$('#page2').fadeTo("500", 0.5);
		$('#page3').fadeTo("500", 0.5);
		$('#page4').fadeTo("500", 0.5);
	});
	$('.page2').click(function page2(){
		$('#s_content').stop(true).scrollTo( {top:430,left:0} , 1700, { easing:'elasout' } );
		activeitem=2;
		$('#page1').fadeTo("500", 0.5);
		$('#page2').fadeTo("500", 1);
		$('#page3').fadeTo("500", 0.5);
		$('#page4').fadeTo("500", 0.5);
	});
	$('.page3').click(function(){
		$('#s_content').stop(true).scrollTo( {top:860,left:0} , 1700, { easing:'elasout' } );
		activeitem=3;
		$('#page1').fadeTo("500", 0.5);
		$('#page2').fadeTo("500", 0.5);
		$('#page3').fadeTo("500", 1);
		$('#page4').fadeTo("500", 0.5);
	});
	$('.page4').click(function(){
		$('#s_content').stop(true).scrollTo( {top:1290,left:0} , 1700, { easing:'elasout' } );
		activeitem=4;
		$('#page1').fadeTo("500", 0.5);
		$('#page2').fadeTo("500", 0.5);
		$('#page3').fadeTo("500", 0.5);
		$('#page4').fadeTo("500", 1);
	});
	$('#leftbtn_01').click(function(){
		$('#gallery_webdesign').stop(true).scrollTo( {top:0,left:'-=485'} , 200 );
	});	
	$('#rightbtn_01').click(function(){
		$('#gallery_webdesign').stop(true).scrollTo( {top:0,left:'+=485'} , 200 );
	});	
	$('#leftbtn_02').click(function(){
		$('#gallery_printed_media').stop(true).scrollTo( {top:0,left:'-=485'} , 200 );
	});	
	$('#rightbtn_02').click(function(){
		$('#gallery_printed_media').stop(true).scrollTo( {top:0,left:'+=485'} , 200 );
	});
	$('#leftbtn_03').click(function(){
		$('#gallery_illustrations').stop(true).scrollTo( {top:0,left:'-=485'} , 200 );
	});	
	$('#rightbtn_03').click(function(){
		$('#gallery_illustrations').stop(true).scrollTo( {top:0,left:'+=485'} , 200 );
	});
 
 
});