$(document).ready(function(){

if(mod == 1){
		
	$.listen('click','img.thumbhome',function(){
		var myurl = $(this).attr('big');
		var linkk = $(this).attr('link');
		var cssstring = 'url(' + myurl + ') no-repeat center center';
		var ptitle = '<a href=' + linkk + '>' + $(this).attr('ptitle') + '</a>';
		$('h2#details').html(ptitle);
		$('#home_img_holder').css({ background: cssstring });
    });

	function mycarousel_itemLoadCallback(carousel, state)
	{
		for (var i = carousel.first; i <= carousel.last; i++) {
			if (carousel.has(i)) {
				continue;
			}

			if (i > projects_itemList.length) {
				break;
			}

			carousel.add(i, mycarousel_getItemHTML(projects_itemList[i-1]));
		}
	};

	function mycarousel_getItemHTML(item)
	{
		return '<img src="' + item.src + '" big="' + item.big + '" link="' + item.link + '" ptitle="' + item.ptitle + '" class="thumbhome" />';
	};

	$('#mycarousel').jcarousel({
		scroll: 1,
		size: projects_itemList.length,
        itemLoadCallback: {onBeforeAnimation: mycarousel_itemLoadCallback}
	});
	
	$('div.slide').css({ left: "632px" });
	var pageposition = 2;
	var pagetitle2 = $('div.slide').text();
	
	$('a.page_1').click(function(){
		
		if(pageposition == 2){
			$('li.page-2').css({ display: "none" });
			$('li.page-1').fadeIn();
			$('div.slide').css({ left: "27px" }).html(pagetitle1);
			pageposition = 1;
		}
								 
	});
	
	$('a.page_2').click(function(){
		
		if(pageposition == 1){
			$('li.page-1').css({ display: "none" });
			$('li.page-2').fadeIn();
			$('div.slide').css({ left: "632px" }).html(pagetitle2);
			pageposition = 2;
		}
								 
	});
	
	$("ul#years > li > a").hover(function(){
	
		var year = $(this).attr('id');
		var area = $(this).attr('area');
		var dteNow = new Date();
		var intYear = dteNow.getFullYear();
		if(pageposition == 1){
			var goto = year - 1993;
		}else if(pageposition == 2){
			var goto = year - (intYear - 11);
		}
		var gotopx = (goto * 55) + 27;
		$('div.slide').stop().animate({ left: gotopx + 'px' }).html(area);
	
	}, function(){});
	
}else if(mod == 99){
	
	$.listen('click','img.thumbin',function(){
		var myurl = $(this).attr('big');
		$('#big_img').attr({ src: myurl });
    });

	function mycarousel_itemLoadCallback2(carousel, state)
	{
		for (var i = carousel.first; i <= carousel.last; i++) {
			if (carousel.has(i)) {
				continue;
			}

			if (i > projects_itemList.length) {
				break;
			}

			carousel.add(i, mycarousel_getItemHTML2(projects_itemList[i-1]));
		}
	};

	function mycarousel_getItemHTML2(item)
	{
		return '<img src="' + item.src + '" big="'  + item.big + '" class="thumbin" />';
	};

	$('#mycarousel').jcarousel({
		scroll: 1,
		size: projects_itemList.length,
        itemLoadCallback: {onBeforeAnimation: mycarousel_itemLoadCallback2}
	});

}


	$(".first").focus(function () {      
         $(this).addClass('second');
    });

    $(".first").blur(function () {      
         $(this).removeClass('second');
    });

    $("input.submit").hover(function () {
        $(this).addClass('buton');
    }, function () {
        $(this).removeClass('buton');
    });
	
	jQuery.preloadImages = function(){
		for(var i = 0; i<arguments.length; i++){
			jQuery("<img>").attr("src", arguments[i]);
		}
	}
	
});