	// Only proceed once DOM is ready
	$(document).ready(function() {

	});
	
	function switchClass(passTarget,passClass) {
		if (passTarget === undefined) {
		
		} else {
			document.getElementById(passTarget).className = passClass;
		};
	}
	
	function switchmultipleState(targetType,targetID, switchID){
		var itemCollection = document.getElementsByTagName(targetType);
		for (var i=0; i<itemCollection.length; i++) {
			if(itemCollection[i].className === targetID) {
				document.getElementById(itemCollection[i]).className = passClass;
			}
		}
	}
	
	function addLoadEvent(func) {
		var oldonload = window.onload;
		if (typeof window.onload != 'function') {
			window.onload = func;
		} else {
			window.onload = function() {
				if (oldonload) {oldonload();}
				func();
			}
		}
	}
	
	function initSIFR(targetElement, sifrWeight, sifrAlign, sifrColour, sifrLinkColour, sifrHoverColour, sifrTextcase){
	
		if (targetElement === undefined) {var targetElement = "h2";};
		if (sifrWeight === undefined) {var sifrWeight = "normal";};
		if (sifrAlign === undefined) {var sifrAlign = "left";};
		if (sifrColour === undefined) {var sifrColour = "#FFFFFF";};
		if (sifrLinkColour === undefined) {var sifrLinkColour = "#FFFFFF";};
		if (sifrHoverColour === undefined) {var sifrHoverColour = "#FFFFFF";};
		if (sifrTextcase === undefined) {var sifrTextcase = "none";};
	
		var smoothfont = {src: '/reads/swf/sifr/sifr.swf'};
		sIFR.delayCSS  = false;
		sIFR.domains = ['*'];
		sIFR.activate(smoothfont);
		sIFR.replace(smoothfont, {selector:targetElement,css:['.sIFR-root {width:100%;text-align:' + sifrAlign + ';font-weight:' + sifrWeight + ';color:' + sifrColour + ';letter-spacing:-0.5;text-transform:' + sifrTextcase + ';}','a {color:' + sifrLinkColour + ';text-decoration:none;}','a:link {color:' + sifrLinkColour + ';}','a:hover {color:' + sifrHoverColour + ';}'],wmode:'transparent'});
	}

	var tabsReady = true;
	
	function renderTabs(targetID,actionID,focusID){
		// Switch CSS back to match JQuery style
        switchClass(targetID, "tab-show");
        switchClass(actionID, "js-show");

        $('#' + targetID + ' div').hide();
        if (focusID == 0) {
            $('#' + targetID + ' div:first').show();
            $('ul#' + actionID + ' li:first').addClass('active');
        } else {
            $('#' + targetID + ' div#' + focusID).show();
            $('ul#' + actionID + ' li.' + focusID).addClass('active');
        };
		
		$('#pulloutinformation00 a').click(function() {
			 if (tabsReady) {
   	        	tabsReady = false;
                setTimeout('tabsWait()', 1000);
				$('ul#' + actionID + ' li').removeClass('active');
   	            var currentTab = $(this).attr('href');
                $('#' + targetID + ' div:visible').fadeOut("slow",function() {$(currentTab).fadeIn("slow");});
                return false;
                }
            }
        );
		
        $('ul#' + actionID + ' li a').click(function() {
            if (tabsReady) {
   	        	tabsReady = false;
                setTimeout('tabsWait()', 1000);
   	            $('ul#' + actionID + ' li').removeClass('active');
                $(this).parent().addClass('active');
                var currentTab = $(this).attr('href');
                $('#' + targetID + ' div:visible').fadeOut("slow", 
                    function() {
                        $(currentTab).fadeIn("slow");
                        //initSIFR("h2.smooth-titlefont","bold","left","#5d1b18","#5d1b18","#5d1b18","none");
                    }
                );
                return false;
                }
            }
        );
	    
	}

	function tabsWait() {tabsReady = true;}
	
	function initMultiFade(targetID){
		//$('' + targetID + '').fadeTo("fast", 0.45);
		$('' + targetID + '').css("opacity","0");
		$('' + targetID + '').stop().animate({opacity:0.50},2000);
		$('' + targetID + '').hover(function(){$(this).fadeTo('' + targetID + '', 1.0);},function(){$(this).fadeTo('' + targetID + '', 0.50);});
	}
	
	function initFadeIn(targetID,navigationID){
		$('' + targetID + '').css("opacity","0");
		$('' + targetID + '').stop().animate({opacity:1.0},2000);
		
		if (navigationID != undefined) {
			//$('' + navigationID + '').fadeTo("fast", 0.50);
			$('' + navigationID + '').css("opacity","0");
			$('' + navigationID + '').stop().animate({opacity:0.50},2000);
			$('' + navigationID + '').hover(function(){$(this).fadeTo('' + navigationID + '', 1.0);},function(){$(this).fadeTo('' + navigationID + '', 0.50);});
		}
	}
