/* SHOW-HIDE START */

function HideContent(d) {
if(d.length < 1) { return; }
document.getElementById(d).style.display = "none";
}
function ShowContent(d) {
if(d.length < 1) { return; }
document.getElementById(d).style.display = "block";
}
function ReverseContentDisplay(d) {
if(d.length < 1) { return; }
if(document.getElementById(d).style.display == "none") { document.getElementById(d).style.display = "block"; }
else { document.getElementById(d).style.display = "none"; }
}

/* SHOW-HIDE END */



/* SWITCH TABS START */

function switchTab(aTagObj, tabSection, tabNumber)
{
	for(i = 1; i <= 10; i ++)
	{
		if(gID(tabSection + i))
		{
			if(i != tabNumber)
			{
				gID(tabSection + i).style.display = 'none';
				gID(tabSection + "-a" + i).className = "";
			}
		}
	}
	gID(tabSection + "-a" + tabNumber).className = "current";
	gID(tabSection + tabNumber).style.display = 'block';
}
function showHideDiv(aTagObj, divId, action)
{
	if(action == 'show')
	{
		gID(divId).style.display = 'block';
		gID(divId + '-a-hide').style.display = 'block';
	}else{
		gID(divId).style.display = 'none';
		gID(divId + '-a-show').style.display = 'block';
	}
	aTagObj.style.display = 'none';
}
function gID(id)
{
	return document.getElementById(id);
}


/* SWITCH TABS END */

/* Unobtrusive Flash Objects (UFO) v3.20 <http://www.bobbyvandersluis.com/ufo/>
        Copyright 2005, 2006 Bobby van der Sluis
        This software is licensed under the CC-GNU LGPL <http://creativecommons.org/licenses/LGPL/2.1/>
*/

function createCSS(selector, declaration) {
        // test for IE
        var ua = navigator.userAgent.toLowerCase();
        var isIE = (/msie/.test(ua)) && !(/opera/.test(ua)) && (/win/.test(ua));

        // create the style node for all browsers
        var style_node = document.createElement("style");
        style_node.setAttribute("type", "text/css");
        style_node.setAttribute("media", "screen");

        // append a rule for good browsers
        if (!isIE) style_node.appendChild(document.createTextNode(selector + " {" + declaration + "}"));

        // append the style node
        document.getElementsByTagName("head")[0].appendChild(style_node);

        // use alternative methods for IE
        if (isIE && document.styleSheets && document.styleSheets.length > 0) {
                var last_style_node = document.styleSheets[document.styleSheets.length - 1];
                if (typeof(last_style_node.addRule) == "object") last_style_node.addRule(selector, declaration);
        }
};
var debounce = function (func, threshold, execAsap) {
    var timeout;
    return function debounced () {
        var obj = this, args = arguments;
        function delayed () {
            if (!execAsap)
            func.apply(obj, args);
            timeout = null;
        };
        if (timeout)
            clearTimeout(timeout);
        else if (execAsap)
            func.apply(obj, args);
        timeout = setTimeout(delayed, threshold || 100);
    };
}
