var homepath = "/";
var subtitle = "print and interactive design consultancy";


$(document).ready(function(){
	
	
	
	$(document).bind("idle.idleTimer", function(){
	 	// function you want to fire when the user goes idle
		var h = $(window).height();
		var w = $(window).width();
		$('<div class="standby" style="opacity:0;">Zzzzzzz</div>').css('height',h).css('width',w).appendTo(document.body).animate({opacity:0.9},1000,function(){});
	});

	$(document).bind("active.idleTimer", function(){
		$('div.standby').remove();
	}).trigger('active.idleTimer');
	
	$.idleTimer(200000);
	
	if ((navigator.userAgent.indexOf('iPhone') != -1) || (navigator.userAgent.indexOf('iPod') != -1) || (navigator.userAgent.indexOf('iPad') != -1)) {
		$(document).bind('touchstart',function(e){$('div.standby').remove();});		
	}
	else{
		$(window).focus(function(){$('div.standby').remove();});	
	}
	
	/*
	$('#navimore a').click(function(){
		showNav();
		return false;	
	});
	*/
	
	$('a.c-link').click(function(){
		var id = $(this).attr('id');
		if($('a.c-link').hasClass('curr')){
			$('a.c-link').removeClass('curr');
		}
		$(this).addClass('curr');
		$('div.c-text').hide();
		$('div#'+id+'-text').slideDown();
		return false;	
	});
	
	$('#ohplay').bind("click",returnhome);
	
});


function returnhome(){
	window.location = homepath;
}



function showNav(){
	
	$('#navimore a').addClass('curr');

	if($("#menuholder").css("display") == "none"){	
		$("#menuholder").slideDown("slow");
	}
	else{
		$("#menuholder").slideUp("slow");
	}

	$("#wrapper").mousedown(function(e){
		var target = e.target;
		if(target.className != 'jScrollPaneTrack' && target.className != 'jScrollPaneDrag' && target.className != 'menuitem'){
			$('#navimore a').removeClass('curr');	
			$("#menuholder").slideUp("fast");
			$("#wrapper").unbind("mousedown");
		}
	});	
	if ((navigator.userAgent.indexOf('iPhone') != -1) || (navigator.userAgent.indexOf('iPod') != -1) || (navigator.userAgent.indexOf('iPad') != -1)) {
	}
	else{
		$("#menufull").jScrollPane({scrollbarWidth: 10,dragMaxHeight: 120});
	}
	return false;
	
}
