
// Find all link elements and add an onfocus attribute and value
function hideFocusBorders(){
	var theahrefs = document.getElementsByTagName('a');
	if (!theahrefs){
		return;
	}
	for(var x=0; x != theahrefs.length; x++){
		theahrefs[x].onfocus = function stopLinkFocus(){
			this.hideFocus = true;
		};
	}
}

// JQuery effects plugins for CHIN sites (Virtual Museum of Canada & Knowledge Exchange)
// Plugins by Dwayne Kristjanson & Dan Copeland at Realdecoy Inc. - Ottawa ON Canada

// declare text values for expando toggle buttons
var minus = 'Collapse&nbsp;view(&ndash;)';
var plus = 'Expand&nbsp;view(+)';

var getHeader = function(panel){
	return $('#' + panel.parent().attr('id').replace(/global/,'header'));
};
var expando = function(button){
	$(button).parent().parent().siblings('.more').slideToggle(160); // 160 is the duration (in milliseconds) of the effect
};/*
var findClueTip = function(clueTipLink){
	var targetClueTipID = $('.cluetip-exhibit-info').attr('id');
	var targetClueTip = "#" + targetClueTipID;
	alert(targetClueTip);
	return targetClueTip;
};*/
$(document).ready(function(){
	$('#global-kx a, #global-vmc a, #global-chin a').slidePanel({
		role: 'toggle-accordion',
		speed: 'normal', // normal is the default. fast and slow are other options
		target: getHeader
	});
	$("#theme-nav-btn").click(function() {
		$('#themeNav').slideToggle(100);
		$(this).toggleClass("arrowDown");
		return false;
	});
	$('.expand a').click(function(){
		if(this.collapsed == false){
			$(this).children('span.state').html(plus);
			this.collapsed = true;
		} else{
			$(this).children('span.state').html(minus);
			this.collapsed = false;
		}
		expando(this);
		return false;
	});
	hideFocusBorders();
});

