
/* scientific advisory board */

function setHash(el, attribute){
	window.location.hash = el.attr(attribute)
}


function getHash(){
	var hash=location.hash
	if(hash != ''){
		hash = hash.substring(1)
		//hash = hash.replace("&", "/"); // our custom directory characters with actual directory char
		//hash = hash.replace("%20", " "); // replace with actual whitespace
		return hash;
	} else {
		return false;
	}
}


function clearHash(){
	if ("pushState" in history){ // html5 compatilbe : remove the # too
    	history.pushState("", document.title, window.location.pathname);
	} else { // not html5 : leaves #
        window.location.hash = "";
	}	
}

function setTabState(el){
			$('#tabs li').removeClass('current');
			$(el).parent().addClass('current');
			var tab_content_id = $(el).attr('id') + '_content';
			$('.tab_content').addClass('hide')
			$('#' + tab_content_id).removeClass('hide')
		}
		
		function initTabs(){
			$('.tab_content').addClass('hide')
			// read hash if available
			var hash = getHash();
			var has_hash = false;
			$('#tabs li a').each(function(){
				if( $(this).attr('title') == hash ){
					has_hash = true;
					setTabState($(this))
				} 
			
			});
			
			if( ! has_hash){
					$('#disp_press_release_content').removeClass('hide')
				}
		}

$(document).ready(function() {
	/* SAB page */
	initTabs();
	$('#tabs li a').click(function(e){
		e.preventDefault();
		setTabState($(this))
		setHash($(this), 'title')
	});
	
	
});

