

function resetTM() {
	$('li#tmhome a').removeClass('active')
	$('li#tmlogistics a').removeClass('active');
	$('li#tmshipping a').removeClass('active');
	$('li#tmlines a').removeClass('active');
	$('li#tmtrade a').removeClass('active');
	$('li#tmseapolport a').removeClass('active');
	$('li#tmgallery a').removeClass('active');
	$('li#tmaboutus a').removeClass('active');
};
function openHome() {
	$('#contentDiv').load('home.html');
	resetTM();
	$('li#tmhome a').addClass('active');
};
function openLogistics() {
	$('#contentDiv').load('seaportlogistics.html');
	resetTM();
	$('li#tmlogistics a').addClass('active');
};
function openShipping() {
	$('#contentDiv').load('seaportshipping.html');
	resetTM();
	$('li#tmshipping a').addClass('active');
};
function openLines() {
	$('#contentDiv').load('seaportlines.html');
	resetTM();
	$('li#tmlines a').addClass('active');
};
function openTrade() {
	$('#contentDiv').load('seatrade.html');
	resetTM();
	$('li#tmtrade a').addClass('active');
};
function openSeapolport() {
	$('#contentDiv').load('seapolport.html');
	resetTM();
	$('li#tmseapolport a').addClass('active');
};
function openGallery() {
	$('#contentDiv').load('gallery.html');
	resetTM();
	$('li#tmgallery a').addClass('active');
};
function openAboutus() {
	$('#contentDiv').load('aboutus.html');
	resetTM();
	$('li#tmaboutus a').addClass('active');
};
	
/* Internal navigation */
function closeAll() {
	if($('#tm-1c').css("display") == 'block') { $('#tm-1c').slideUp('slow'); }
	if($('#tm-2c').css("display") == 'block') { $('#tm-2c').slideUp('slow'); }
	if($('#tm-3c').css("display") == 'block') { $('#tm-3c').slideUp('slow'); }
	if($('#tm-4c').css("display") == 'block') { $('#tm-4c').slideUp('slow'); }
	if($('#tm-5c').css("display") == 'block') { $('#tm-5c').slideUp('slow'); }
	if($('#tm-6c').css("display") == 'block') { $('#tm-6c').slideUp('slow'); }
	if($('#tm-7c').css("display") == 'block') { $('#tm-7c').slideUp('slow'); }
};

function openST1() {
	closeAll();
	setTimeout('$(\'#tm-1c\').slideDown(\'slow\'); $(\'#tm-1c\').show(); $(\'#tm-2c\').hide(); $(\'#tm-3c\').hide(); $(\'#tm-4c\').hide(); $(\'#tm-5c\').hide(); $(\'#tm-6c\').hide(); $(\'#tm-7c\').hide();',500);	
};

function openST2() {
		closeAll();
		setTimeout('$(\'#tm-2c\').slideDown(\'slow\'); $(\'#tm-2c\').show(); $(\'#tm-1c\').hide(); $(\'#tm-3c\').hide(); $(\'#tm-4c\').hide(); $(\'#tm-5c\').hide(); $(\'#tm-6c\').hide(); $(\'#tm-7c\').hide();',500);		
};

function openST3() {
	closeAll();
	setTimeout('$(\'#tm-3c\').slideDown(\'slow\'); $(\'#tm-3c\').show(); $(\'#tm-1c\').hide(); $(\'#tm-2c\').hide(); $(\'#tm-4c\').hide(); $(\'#tm-5c\').hide(); $(\'#tm-6c\').hide(); $(\'#tm-7c\').hide();',500);	
};

function openST4() {
		closeAll();
		setTimeout('$(\'#tm-4c\').slideDown(\'slow\'); $(\'#tm-4c\').show(); $(\'#tm-1c\').hide(); $(\'#tm-2c\').hide(); $(\'#tm-3c\').hide(); $(\'#tm-5c\').hide(); $(\'#tm-6c\').hide(); $(\'#tm-7c\').hide();',500);
	};
	
function openST5() {
		closeAll();
		setTimeout('$(\'#tm-5c\').slideDown(\'slow\'); $(\'#tm-5c\').show(); $(\'#tm-1c\').hide(); $(\'#tm-2c\').hide(); $(\'#tm-3c\').hide(); $(\'#tm-4c\').hide(); $(\'#tm-6c\').hide(); $(\'#tm-7c\').hide();',500);
	};
	
function openST6() {
		closeAll();
		setTimeout('$(\'#tm-6c\').slideDown(\'slow\'); $(\'#tm-6c\').show(); $(\'#tm-1c\').hide(); $(\'#tm-2c\').hide(); $(\'#tm-3c\').hide(); $(\'#tm-4c\').hide(); $(\'#tm-5c\').hide(); $(\'#tm-7c\').hide();',500);
	};

function openST7(){
		closeAll();
		setTimeout('$(\'#tm-7c\').slideDown(\'slow\'); $(\'#tm-7c\').show(); $(\'#tm-1c\').hide(); $(\'#tm-2c\').hide(); $(\'#tm-3c\').hide(); $(\'#tm-4c\').hide(); $(\'#tm-5c\').hide(); $(\'#tm-6c\').hide();',500);
	};


$(document).ready(function(){
    
	$("#loading").ajaxStart(function(){
  		$(this).show();
		
	});
	
	$("#loading").ajaxStop(function(){
		setTimeout('$(\'#loading\').hide();',2000);
	});
	
	//http://www.malsup.com/jquery/cycle/
	/*$('#headermsg').cycle( { pause: 1, speed: 3000, timeout: 7000, fit: 1 } );*/
	$('#headermsg').cycle({ 
		fx: 'scrollRight', 
		sync:   0, 
		delay: -2000,
		speed: 3000,
		timeout: 7000,
		fit: 1
	});
	
	/* Top navigation links */
	$('#tmhome').click(function(){
		openHome();
		document.title = "Seapol";
	});
	$('#tmlogistics').click(function(){
		openLogistics();
	});
	$('#tmshipping').click(function(){
		openShipping();
	});
	$('#tmlines').click(function(){
		openLines();
	});
	$('#tmtrade').click(function(){
		openTrade();
	});
	$('#tmseapolport').click(function(){
		openSeapolport();
	});
	$('#tmgallery').click(function(){
		openGallery();
	});
	$('#tmaboutus').click(function(){
		openAboutus();
	});
	
	/* To load home page on start */
	openHome();
	
	
	/* home page links */
	$('#trmhome').click(function() {
		openHome();
	});
	
	
});

