// custom

// patch for IE6:
if (document.all) document.write('<style type="text/css">#aside .block, .swap-inner li {height:1%}</style>');

// hide elements that will be animated if JS is enabled:
document.write('<style type="text/css">.swap li div { left: -9999px; position: absolute; } </style>');

/* ============================================================================
   AUTO-RUN */

$(document).ready(function() {
	
	var homeDir = getURLDirectory();
	var myPage = getURLPage(); 
	
	// Open external links (specified by rel= or class=) in a new browser window:    
    $("a[rel*='external'],a[class*='external']").attr('target','_blank');
	 
    // Swap Box Behaviors (if exists)
    if ($(".swap").length > 0) {

        // Initialize:
        $(".swap-inner").prepend('<div id="swap-box"></div>');
        swapBox();

        // Attach behavior:
        $(".swap h2").bind("click", function() {
            $(".swap h2.active").removeAttr("class");
            $(this).addClass("active");
            swapBox();
        });
    }


});

$("mainFlash").ready(function() {
	loadHomePageFlash();
});

/* ============================================================================
   HELPERS */

function swapBox() {
    $("#swap-box").html($(".swap h2.active").siblings("div").eq(0).html());   
}