$(document).ready(function () {	
	
	//var browserHeight = $(window).height() + "px";
	//$(".content-page").css({"height":browserHeight});
	
	$("#mainMenu a").delay(2000).animate({top: "35px",opacity: 1}, 400);
	$(".oneliner").css({"width":"0"});
	$("#header").delay(1000).fadeIn(1000);
	$("#wrapper").delay(500).animate({"padding-top":"50px", opacity:1}, 1000);
	$(".oneliner").delay(1500).animate({"width":"100%"}, 300);
	
	$.scrollTo( $('#about'), 100,  {offset:-70} );
	$(".gotoAbout a").addClass("current").animate({opacity: 0.3}, 400);
	
	$(".gotoPortfolio a, .gotoPort").click(function(){
		$(window).scrollTo( $('#portfolio'), 1200,  {offset:-40} );
		$(".gotoAbout a").removeClass("current").animate({opacity: 1}, 400);
		$(this).addClass("current").animate({opacity: 0.3}, 400);
		return false;
	});
	$(".gotoAbout a").click(function(){
		$(window).scrollTo( $('#about'), 1200,  {offset:-40} );
		$(".gotoPortfolio a").removeClass("current").animate({opacity: 1}, 400);
		$(this).addClass("current").animate({opacity: 0.3}, 400);
		return false;
	});
	
	$(".seeDetails").click(function(){
		$(".removeDetails").fadeIn();
		$(window).scrollTo( $('#details'), 600,  {offset:20} );
		return false;
	});
	$(".removeDetails a,.close-detail").click(function(){
		$(window).scrollTo( $('#portfolio'), 600,  {offset:-90} );
		$(".portfolio-detail").slideUp();
		return false;
	});
	$("#portfolio-items li").mousedown(function(){
		var item = $(".projectname a",this).attr("class");
		$("#port_"+item).slideDown();
		$(window).scrollTo( $("#port_"+item), 600,  {offset:0} );
		$('.screenshot .images').delay(150).cycle({
			fx: 'fade',
			speed: 900,
			timeout: 2000
		});
		return false;
	});
	
	
	
	$("#portfolio-items li").mouseenter(function(){
		
		$("#portfolio-items li").not($(this)).stop().animate({"opacity":"0.5"}, 300);
		
		$(".thumb", this).animate({
			"left":"14px",
			"top":"14px",
			"width":"248px",
			"height":"297px"
		},50);
		$(".thumb img", this).animate({
			"left":"-14px",
			"top":"-14px"
		},50);
		
		$(".thumb", this).delay(50).animate({
			"left":"0px",
			"top":"0px",
			"width":"275px",
			"height":"325px"
		},150);
		$(".thumb img", this).delay(50).animate({
			"left":"0px",
			"top":"0px"
		},150);
		$(".description", this).delay(50).animate({
			"left":"0px",
			"top":"270px"
		},200);
		$(".description .goto", this).fadeIn();
		
	});
	$("#portfolio-items li").mouseleave(function(){
		
		$(".thumb", this).animate({
			"left":"10px",
			"top":"10px",
			"width":"255px",
			"height":"305px"
		},50);
		$(".thumb img", this).animate({
			"left":"-10px",
			"top":"-10px"
		},50);
		$(".description", this).animate({
			"left":"0px",
			"top":"260px"
		},200);
		$(".description .goto", this).fadeOut();
		$("#portfolio-items li").stop().animate({"opacity":"1"}, 300);
		
	});
	
	jQuery.easing.def = "easeIn";
	

});


// Email.js version 5
var tld_ = new Array()
tld_[0] = "com";
tld_[1] = "org";
tld_[2] = "net";
tld_[3] = "ws";
tld_[4] = "info";
tld_[10] = "co.uk";
tld_[11] = "org.uk";
tld_[12] = "gov.uk";
tld_[13] = "ac.uk";
var topDom_ = 13;
var m_ = "mailto:";
var a_ = "@";
var d_ = ".";

function mail(name, dom, tl, params)
{
	var s = e(name,dom,tl);
	document.write('<a href="'+m_+s+params+'">'+s+'</a>');
}
function mail2(name, dom, tl, params, display)
{
	document.write('<a href="'+m_+e(name,dom,tl)+params+'">'+display+'</a>');
}
function e(name, dom, tl)
{
	var s = name+a_;
	if (tl!=-2)
	{
		s+= dom;
		if (tl>=0)
			s+= d_+tld_[tl];
	}
	else
		s+= swapper(dom);
	return s;
}
function swapper(d)
{
	var s = "";
	for (var i=0; i<d.length; i+=2)
		if (i+1==d.length)
			s+= d.charAt(i)
		else
			s+= d.charAt(i+1)+d.charAt(i);
	return s.replace(/\?/g,'.');
}





