over_subnav = false;

function init(theme) {
	$('#nav_bottom > .containercontent > ul > li').hover(navOver, navOut);
	$('#nav_bottom > .containercontent > ul > li > ul > li').hover(subNavOver, subNavOut);
	$('#nav_bottom > .containercontent > ul > li').click(gotoId);
	$('#nav_bottom > .containercontent > ul > li > ul > li').click(gotoSubId);
	$('#tier2_left_content > ul > li').hover(sideNavOver, sideNavOut);
	$('#topLinks > ul > li').hover(topOver, topOut);
	
	if (theme == 'inventory' || theme == 'item') {
		initInventory();
	}

	$('#trans').lightBox()
	
	$('#industries_carousel').CloudCarousel(
		{
			xPos:428,
			yPos:10,
			yRadius: 10,
			bringToFront:true,
			reflHeight:50
		}
	);
	
	$('.cloudcarousel').click(showCarouselContent);
	$('.carousel_sidebar').corner();
}

function showCarouselContent(e) {
	$('#heavy_highway_div').css('display', 'none');
	$('#oil_gas_div').css('display', 'none');
	$('#rail_div').css('display', 'none');
	$('#waste_div').css('display', 'none');
	$('#mining_div').css('display', 'none');
	$('#assemblyshop_div').css('display', 'none');
	$('#paintshop_div').css('display', 'none');
	$('#tankshop_div').css('display', 'none');
	$('#fabricationshop_div').css('display', 'none');
	$('#repairshop_div').css('display', 'none');
	$('#' + this.id + '_div').css('display', 'block');
}

function navOver(e) {
	$(this).addClass('over');
	$(this).find('ul').css('display', 'block');
}

function subNavOver(e) {
	$(this).addClass('over');
	over_subnav = true;
}

function topOver(e) {
	$(this).addClass('over');
}

function topOut(e) {
	$(this).removeClass('over');
}

function navOut(e) {
	$(this).removeClass('over');
	$(this).find('ul').css('display', 'none');
}

function subNavOut(e) {
	$(this).removeClass('over');
	over_subnav = false;
}

function sideNavOver(e) {
	$(this).find('a').addClass('over');
	if (!($(this).find('img').is('.no'))) {
		$(this).find('img').attr('src', '/dev/curry/images/arrow_left_over.png');
	}
}

function sideNavOut(e) {
	$(this).find('a').removeClass('over');
	if (!($(this).find('img').is('.no'))) {
		$(this).find('img').attr('src', '/dev/curry/images/arrow_left.png');
	}
}

function gotoId(e) {
	if ($(this).attr('id') == '/dev/curry/transportation') {
		link = $(this).attr('id');
		location.href=link;
	}
}

function gotoSubId(e) {
	link = $(this).attr('id');
	location.href=link;
}