function change_tab(tabref){
	//hide the other tabs
	$('.tabs-content:not(#' + tabref + ')').hide();
	
	//show proper tab, catch IE6 bug
	if (($.browser.msie && $.browser.version.substr(0, 3) == "6.0") || 
		($.browser.msie && $.browser.version.substr(0, 3) == "7.0")) {
		$('.tabs-content#' + tabref).show();
	} else {
		$('.tabs-content#' + tabref).show();
	}
		
	//clear highlight from previous tab title
	$('.tabs a:not(#' + tabref + ')').removeClass('selected');
	$('.tabs li').removeClass('selected');
	
	//highlight currenttab title
	$('.tabs a[href=#' + tabref + ']').addClass('selected');
	$('.tabs a[href=#' + tabref + ']').parent('li').addClass('selected');
}

function first_tab(){
	$(".tabs-content").hide();
	
	//clear highlight from previous tab title
	$('.tabs a').removeClass('selected');
	$('.tabs li').removeClass('selected');
	
	//set initial tab
	$('.tabs a:first').addClass('selected');
	$('.tabs a:first').parent('li').addClass('selected');
	$('.tabs-content:first').show();
}

$(document).ready(function(){
	
	var target = window.location.href.slice(window.location.href.indexOf('#') + 1);
	if (target.toLowerCase().indexOf("rikvinsingapore.com") >= 0) {
		//alert(target);
		first_tab();
	} else {
		change_tab(target);
		$('html, body').animate({scrollTop:0}, 'slow');
	}
	
	/*
	
	*/
	
	/*
	$(".tabs-content .button").click(function(){
	   document.location.href=$(this).attr("href");
	})
	*/
	$(".tabs a").click(function(){
		
		tabref = $(this).attr("href").split('#')[1];
		
		//display referenced tab
		change_tab(tabref);
		
		return false;
		
	});
	
});
