/* $Id: download.view.js 653 2009-07-29 09:24:21Z sonice $ */
e107.runOnLoad( function(event) {
	var element = event.memo['element'] ? $(event.memo.element) : $$('body')[0];
	
	//Ajax navigation
	element.select('ul.download-nav-bar > li').invoke('observe', 'click', function(event) {
		var cont = event.findElement('li'), 
			a = event.findElement('a'),
			loader = a && a.rel ? $(a.rel + '-loader') : null,
			ajaxcont = a && a.rel ? $(a.rel) : null;

		if(!ajaxcont) {
			return;
		}
		
		event.stop();
		if(cont.hasClassName('active')) {
			return;
		}
		
		element.select('ul.download-nav-bar > li').invoke('removeClassName', 'active');
		cont.addClassName('active');
		var opts = {
			overlayPage: false,
			evalScripts: false,
			overlayElement: false,
			history: { id: ajaxcont.id.camelize(), state: a.identify(), cache: true },
			onComplete: function() { if(loader) { loader.hide(); } }
		}
		if(loader) {
			loader.show();
		}
		new e107Ajax.Updater(ajaxcont, a.href, opts);
	});
	
	//tabs
	element.select('div.e-tab').each(function(container) {
		//init tabs
    	new e107Widgets.Tabs(container, {
			ajaxCache: false,
			pageOverlay: document.body,
			elementOverlay: false,
			ajaxEvalScripts: false
		});
    });
	
	Shadowbox.setup("a.video", {
        gallery:	"My Movies",
		flashVars: {"plugins": 'gapro-1,rateit-2', "gapro.accountid": 'UA-2317437-6'},
        autoplayMovies:	true,
		width: 1024,
		height: 576
    });

}, null, true);