// jQuery and jQuery Plug-ins Initialization
$(document).ready(function() {

// Accordion components, add additional id as required
//$("#AccordionMenu").accordion({autoHeight: false, collapsible: true});
$("#Accordion").accordion({autoHeight: false, collapsible: true, active: false, navigation: true });
$("#Accordion2").accordion({autoHeight: false, collapsible: true, active: false, navigation: true });
$("#Accordion3").accordion({autoHeight: false, collapsible: true, active: false, navigation: true });
$("#Accordion4").accordion({autoHeight: false, collapsible: true, active: false, navigation: true });
$("#Accordion5").accordion({autoHeight: false, collapsible: true, active: false, navigation: true });
$("#Accordion6").accordion({autoHeight: false, collapsible: true, active: false, navigation: true });
$("#Accordion7").accordion({autoHeight: false, collapsible: true, active: false, navigation: true });

// Tab components, add additional id as required
$('#Tabs').tabs();
$('#Tabs2').tabs();
$('#Tabs3').tabs();
$('#Tabs4').tabs();
$('#Tabs5').tabs();
$('#Tabs6').tabs();
$('#Tabs7').tabs();

// Table sorter
$.tablesorter.defaults.widgets = ['zebra']; 
$("#TravelHealthNoticesTable").tablesorter(); 

// Table sorter
//$("#TravelHealthNoticesTableFra").tablesorter(); 

});


// Legacy code begins
/**
 * External Links
 * This is used to open external links in a new window to replace target="_blank" for XHTML validation
 * Example: <a href="document.html" target="_blank">external link</a>
 * should now be <a href="document.html" rel="x">external link</a>
 */
	
function xLinks() {
 if (!document.getElementsByTagName) return;
 var anchors = document.getElementsByTagName("a");
 for (var i=0; i<anchors.length; i++) {
   var anchor = anchors[i];
   if (anchor.getAttribute("href") &&
       anchor.getAttribute("rel") == "x")
     anchor.target = "_blank";
 }
}
window.onload = xLinks;

// Toggle text size to big/normal
flip=false;off="Start";on="Stop"; // global to save state
flip=false;on="Stop";off="Start"; // global to save state
var min=0;
var max=.05;
function toggleTextSize(pn){
p=parseInt(pn,10);
var phactext = document.getElementsByTagName('body');
for (i=0;i<phactext.length;i++) {
		if(flip){
			if(phactext[i].style.fontSize) {
				var s = parseFloat(phactext[i].style.fontSize.replace("em",""));
			} else {
				var s = .8;
			}
			if (s!=min) {
			s -= .1;
			}
			phactext[i].style.fontSize = s+"em";		
   			phactext.value=on;

   		} else {
			if(phactext[i].style.fontSize) {
				var s = parseFloat(phactext[i].style.fontSize.replace("em",""));
			} else {
				var s = .8;
			}
			if (s!=max) {
			s += .1;
			}
			phactext[i].style.fontSize = s+"em";		
			phactext.value=off;		
   		}
}
flip=!flip;
};

/*
jQuery.fn.fadeToggle=function(speed,easing,callback){
	return this.animate({opacity:'toggle',height:'toggle'},speed,easing,callback)};

	$(document).ready(function(){

	// Hides the DIV's with the following ID's before the page loads
	$('#TwitterTipContainer, #FacebookTipContainer').hide();
	
	// Call function for the Facebook feature
	$("#TwitterTip-Toggle").click(function () {
			$('#FacebookTipContainer').hide();
			$("#TwitterTipContainer").fadeToggle();
			return false;
	});

	// Call function for the Twitter feature
	$("#FacebookTip-Toggle").click(function () {
			$('#TwitterTipContainer').hide();
			$("#FacebookTipContainer").fadeToggle();
			return false;
	});

});
	
*/
