var myCarousel;
var featuredCarousel;
var designCarousel;
var currentCarousel;

function portfolio_initCallback(carousel, state){
	myCarousel = carousel;
	if(currentPage == "ourwork"){
		currentCarousel = myCarousel;	
	}
}
function featured_initCallback(carousel, state){
	featuredCarousel = carousel;
	if(currentPage == "featured"){
		currentCarousel = carousel;
	}
}
function design_initCallback(carousel, state){
	designCarousel = carousel;	
	if(currentPage == "designstrategy"){
		currentCarousel = designCarousel;
	}
}

function pageLoad (page, scripts) {
	$("<div></div>").attr("id","newDiv").css("position","absolute").css("zIndex","9999").insertBefore("#ajax-wrapper");
	$("#ajax-wrapper .Page").clone().appendTo("#newDiv");
	$("#ajax-wrapper").load(page+" .Page",'',function(){
		$.getScript(scripts, function(){
			$("#newDiv").fadeOut("1000", function() {
				$("#newDiv").empty().remove();								  
			});	
		});
	});
}

$(document).ready(function(){
	$("#cat_print").hide();
	currentCarousel = myCarousel;
	$('h1').show();
	$("#portfolio_page").css("background-image", "url(http://images.adventuresdesign.com/bg_page_ourwork2.jpg)");
	$(".Page").css("top", "-4000px");
	$("#portfolio_page").css("top", 0);
	$("#SignLinks a").removeClass("Active");
	$("#nav_work a").removeClass("Active");
	$(".numbering_tabs a").removeClass("Active");
	$(".ourwork").addClass("Active");
	$("#PortfolioMenu a").removeClass("Active");
	$(".default_tab").addClass("Active");
	$("#MyTitle").show();
	$(".TextGroup").html("");
	$(".Text2Group").html("");
	$(".ImageGroup").hide();
	$(".MyImage0").show();
	$(".arrow_right").hide();
	$(".arrow_left").hide();
	$(".PortfolioThumbs").hide();
	$("#our_work_buttons").show();
	$(".rollfeaturedwrapper").hide();
	
	function resetOurWork(){
		$("#cat_print").show();
		$("#PortfolioMenu a").removeClass("Active");
		$(".numbering_tabs a").removeClass("Active");
		$("#our_work_buttons").hide();
		$(".arrow_right").hide();
		$(".arrow_left").hide();
		$('#billboards').hide();
		
		
	}
	
		$(".websites_tab").click(function(){
		resetOurWork();
		$('#billboards').hide();
		$(this).addClass("Active");
		$(".websites_tab").addClass("Active");
		showCategory("websites");		
		$("#portfolio_page").css("background-image", "url(http://images.adventuresdesign.com/bg_page_ourwork_websites.jpg)");
		$(".rollfeaturedwrapper").hide();
		$(".imagebox").css("top", "-57px");
		return false;
	});
	$(".print_tab").click(function(){
		resetOurWork();
		$('#billboards').hide();
		$(".print_tab").addClass("Active");
		showCategory("print");
		$("#portfolio_page").css("background-image", "url(http://images.adventuresdesign.com/bg_page_ourwork_print.jpg)");
		$(".rollfeaturedwrapper").hide();
		$(".imagebox").css("top", "-57px");
		return false;
	});
	$(".identity_tab").click(function(){
		resetOurWork();
		$('#billboards').hide();
		$(".identity_tab").addClass("Active");
		showCategory("identity");
		$("#portfolio_page").css("background-image", "url(http://images.adventuresdesign.com/bg_page_ourwork_identity.jpg)");
		$(".rollfeaturedwrapper").hide();
		$(".imagebox").css("top", "-57px");
		return false;
	});
	$(".copywriting_tab").click(function(){
		resetOurWork();
		$('h1').hide();
		$(".copywriting_tab").addClass("Active");
		showCategory("copywriting");
		$("#portfolio_page").css("background-image", "url(http://images.adventuresdesign.com/bg_page_ourwork_copywriting.jpg)");
		$(".rollfeaturedwrapper").hide();
		$(".imagebox").css("top", "-57px");
		return false;
	});
	
	
	jQuery('#mycarousel').jcarousel({
		vertical: false,
		scroll: 1,
		size: 0,
		scroll: 3,
		initCallback: portfolio_initCallback
	});
	
	$('#homeCarousel').jcarousel({
		vertical: false,
		scroll: 1,
		easing: 'easeOutQuint',
		animation: 1000
	});
	
	$('.obfuscate').nospam({ filterLevel: 'low' });
});
