
if(!DA) var DA = {};

DA.VideoLightbox = (function(){
    var href = 'player/', 
        movies = [], 
        instance = false;
    
    function show(){
        // Hide all Flash movies on the page.
        $$('object, embed').each(function(movie){
            // TODO: Movies re-load completely when we show them again. Maybe
            // wrapping them in a container and hiding *it* will solve.
            movies.push(movie.hide());
        });
        
        instance = new lightboxgw(new Element('a', { href: href }));
        instance.activate();
    }
    
    function hide(){
        movies.invoke('show');
        instance.deactivate();
    }
    
    return {
        show: show, 
        hide: hide
    };
})();

// For compatibility with old Flash.
var openLightbox = function(){ return DA.VideoLightbox.show(); };
var closeLightbox = function(){ return DA.VideoLightbox.hide(); };

// Who knows where all this is getting called from; will clean up later.
var show_nav_header = function(){ return false; }


/* 
window.onload = handle_onload;

window._$ = function (id)
{
	return document.getElementById(id);
}
window.$ = window._$;

function handle_onload()
{
	var subnav = _$("main-header").getElementsByTagName("img");
	var i;

	for (i = 0; i < subnav.length; i++)
	{
		var img = subnav[i];
		if (img.src.indexOf("-off.") == -1)
			continue;

		img.onmouseover = handle_img_over;
		img.onmouseout = handle_img_out;
	}
}

function handle_img_over()
{
	this.src = this.src.replace("-off.", "-on.");
}

function handle_img_out()
{
	this.src = this.src.replace("-on.", "-off.");
}

function show_nav_header(section,vidnum)
{
	if (vidnum==undefined || vidnum=="") vidnum=1;
	//introFLV				:"../../downloads/video/nav-trailer-" + vidnum + ".flv",
	var appendum="";
	switch (vidnum) {
		case 1: //home, game
			appendum="-1";
			break;
		case 2: //charcters
			appendum="-2";
			break;
		case 3: //creatures
			appendum="-1"; //map creatures to home
			break;
		case 4: //gallery
			appendum="-5"; //map gallery to hero
			break;
		case 5: //hero
			appendum="-5";
			break;
		case 6: //world
			appendum="-2"; //map world to characters
			break;
	}
	var flashvars = {			
		preloaderAnimationSwf	:"images/flash/preloader_animation.swf",
		sectionSwf				:"images/flash/home.swf",
		introSwf				:"images/flash/intro.swf",
		introSwfBytes			:"467972",
		introFLV				:"../../downloads/video/nav-trailer" + appendum + ".flv",
		navSwf					:"images/flash/nav.swf",
		navSwfBytes				:"426636",
		navXml					:"xml/nav.xml",
		section		:section
	};
	var params = {
		menu:"false",
		wmode:"transparent",
		base:"",
		allowscriptaccess:"always"
	};
	var attributes = {
	};

	swfobject.embedSWF("images/flash/preloader.swf", "nav", "100%", "600", "10.0.0", "images/flash/expressInstall.swf", flashvars, params, attributes);
}
*/