function nav(inArea, inSub){
	var red							= '#EC0101';
	var grey						= '#E2E2E2';
	var black						= '#000';
	$().ready(function() {
		var cssObj = {
			'background-color' : '#fff',
			'border-bottom' : 'solid 1px #fff',
			'z-index' : 20
		}
		if(inArea !== null){
			var activeli 			= 'ul#topnav li#' + inArea;
			var ActiveSub			= inSub;
			var currentPipeID		= $(activeli).find('div.pipe').attr('id');
			$('ul#topnav li').css({'border-bottom' : '1px solid ' + grey});
			pipes('on', currentPipeID, activeli);
			$(activeli).css(cssObj);
			$(activeli).find('span').css({'display' : 'block'});
			$(activeli).find('a:first').css({'color': red});
			$('div#bottom-stroke').hide();
			if(ActiveSub !== null){
				$(activeli).find('span').find('a[rel^="' + inSub + '"]').css({'color' : red});
			}
		}
		$('ul#topnav li').hover(function() {
			var currentLiID		= $(this).attr('id');
			if(inArea !== null){
				$(activeli).find('span').css({'display' : 'none'});
				//Cufon.replace($(activeli).find('a:first'), {hover: true, color: black});
				if(currentLiID != inArea){
					Cufon.replace($(activeli).find('a:first'), {hover: true, color: black});
				}
			}
			$(this).css(cssObj); 
			$(this).find('span').show();
			$('div#bottom-stroke').hide();
			
			var currentId		= $(this).find('div.pipe').attr('id');
			$('ul#topnav li').css({'border-bottom' : '1px solid ' + grey});
			if(currentId == 1 || currentId == 6 || currentId == 7){
				$('ul#topnav li').css({'border' : 'none'});
				$('div#bottom-stroke').show();
			}
			$(this).css({'border-bottom' : '1px solid #fff'});
			pipes('on', currentId, this);
		} , function() { 
			var currentLiID		= $(this).attr('id');
			$(this).css({'background' : '#fff'}); 
			$(this).find('span').hide();
			$('div#bottom-stroke').show();
			var currentId		= $(this).find('div.pipe').attr('id');
			$('ul#topnav li').css({'border-bottom' : '1px solid #fff'});
			pipes('off', currentId, null);
			if(inArea !== null){
				$(activeli).find('span').css({'display' : 'block'});
				$('ul#topnav li').css({'border-bottom' : '1px solid ' + grey});
				$(activeli).css(cssObj);
				$('div#bottom-stroke').hide();
				pipes('on', currentId, null);
				Cufon.replace($(activeli).find('a:first'), {hover: true, color: red});
			}
		});
	});
}

function pipes(type, currentId, target){
	if(type == 'on'){
		$(target).find('div.pipe').addClass('bigpipe');
		if(currentId > 1 && currentId != 8){
			var tmp			= 'div.pipe#' + (currentId - 1);
			$(tmp).addClass('bigpipe');
			$(target).css({'border-bottom' : '1px solid #fff'});
		}
		if(currentId == 8){
			var tmp			= 'div.pipe#' + (currentId - 1);
			$(tmp).addClass('bigpipe');
			var cur			= 'div.pipe#' + currentId;
		}
	}else{
		$(target).find('div.pipe').removeClass('bigpipe');
		if(currentId > 1 && currentId != 8){
			var tmp			= 'div.pipe#' + (currentId - 1);
			$(tmp).removeClass('bigpipe');
		}
		if(currentId == 8){
			var tmp			= 'div.pipe#' + (currentId - 1);
			$(tmp).removeClass('bigpipe');
			var cur			= 'div.pipe#' + currentId;
		}
	}
}

function activateSingle(inArea){
	var red					= '#EC0101';
	$().ready(function() {
		var activeli 		= 'ul#topnav li#' + inArea;
		Cufon.replace($(activeli).find('a:first'), {hover: true, color: red});
	});
}
