$(document).ready(function() {

	checkWinSize();

	// hide navigation
	$('#nav .nav_toggle').click(function(){
		$('#nav').animate({
			bottom: '-180'
		}, 150, function() {
			$('#curnav').animate({
				bottom: '0'
			}, 300, function() {
				$('#wrapper').css('bottom', '32px'); // resize scrollbar and set to bottom 42px
				if (typeof jsp != 'undefined') {
					jsp.reinitialise();
				}
			});
		});
		return false;
	});

	// show navigation
	$('#curnav .curnav_toggle, #curnav .curnav_title').click(function() {
		$('#curnav').animate({
			bottom: '-60'
		}, 300, function() {
			$('#nav').animate({
				bottom: '0'
			}, 150, function() {
				$('#wrapper').css('bottom', '162px'); // resize scrollbar and set to bottom 162px
				if (typeof jsp != 'undefined') {
					jsp.reinitialise();
				}
			});
		});
		return false;
	});
	$('.slideshow img').click(function() { $(this).parent().parent().cycle('next'); });
	
	// on window resize
	$(window).resize(function() {
		if (typeof jsp != 'undefined') {
			jsp.reinitialise();
		}
		checkWinSize();
	});

	// highlight portfolio in curnav_title
	$('.curnav_title span').hover(function() {
		$(this).css('color','#ff7701');
	}, function() {
		$(this).css('color','#000');
	})
	
});

function getAssetSize_height() {
	var cww = $(window).width();
	if (cww > 1280) { // screen is larger than 1280
		return 514;
	} else {
		return 350;
	}
}

function getAssetSize_width() {
	var cww = $(window).width();
	if (cww > 1280) { // screen is larger than 1280
		return 686;
	} else {
		return 514;
	}
}

function checkWinSize() {
	var cww = $(window).width();
	if (cww > 1280) {
		// screen is larger than 1280
		$('#content h1').css({'font-size':'37px','line-height':'1em'});
		$('#content h2').css({'font-size':'28px','line-height':'1em'});
		$('#content h3').css({'font-size':'24px','line-height':'1em'});
		$('#content h4').css({'font-size':'16px','line-height':'1em'});
		$('#content').css({'width':'1240px', 'padding-right':'0px'});
		$('#content .middlecol').addClass('large_col').removeClass('small_col');
		$('.slideshow').addClass('large_asset').removeClass('small_asset');
		$('#content li').addClass('large_asset').removeClass('small_asset');
		$('#content table').addClass('large_asset').removeClass('small_asset');
		$('#content td').addClass('large_asset').removeClass('small_asset');
		$('#content img').addClass('large_img').removeClass('small_img');
		$('#content object').addClass('large_asset').removeClass('small_asset');
	} else if (cww < 1280) {
		// screen is lower than 1280
		$('#content h1').css({'font-size':'33px','line-height':'1em'});
		$('#content h2').css({'font-size':'26px','line-height':'1em'});
		$('#content h3').css({'font-size':'23px','line-height':'1em'});
		$('#content h4').css({'font-size':'16px','line-height':'1em'});
		$('#content').css({'width':'auto', 'padding-right':'20px'});
		$('#content .middlecol').addClass('small_col').removeClass('large_col');
		$('.slideshow').addClass('small_asset').removeClass('large_asset');
		$('#content li').addClass('small_asset').removeClass('large_asset');
		$('#content table').addClass('small_asset').removeClass('large_asset');
		$('#content td').addClass('small_asset').removeClass('large_asset');
		$('#content img').addClass('small_img').removeClass('large_img');
		$('#content object').addClass('small_asset').removeClass('large_asset');
	}
}

