if (Object.isUndefined(NVB)) { var NVB = { } }

NVB.load = Class.create({
	initialize: function(options) {
		this.scripts = options.scripts || new Array();
		this.path = options.path || 'www/js/';
		this.onload_events = options.onload || new Array();
		this.google = options.google_analytics || false;
		this.events = {
			onload: this.onload.bind(this)
		}
		
		this.include();
		if(this.onload_events || this.google)document.observe('dom:loaded', this.events.onload);
	},
	addLoadEvent:function(func){
		this.onload_events.push(func);
	},
	onload: function(){
		if(Object.isArray(this.onload_events)){
			this.onload_events.each(
				function(s){
					if(Object.isFunction(s))s();
					else eval(s);
				}
			);
		}else if(Object.isFunction(this.onload_events)){
			this.onload_events();
		}
		if(this.google){
			var pageTracker = _gat._getTracker(this.google);
			pageTracker._initData();
			pageTracker._trackPageview();
		}
	},
	include: function(){
		this.scripts.each( function(s){
			if(s.indexOf('www') == -1) document.write('<script type="text/javascript" src="'+this.path+s+'"><\/script>');			
			else document.write('<script type="text/javascript" src="'+s+'"><\/script>');			
		}.bind(this));
		if(this.google){
			document.write('<script type="text/javascript" src="http://www.google-analytics.com/ga.js"><\/script>');
		}
	}
});

function init(){
	if($('myContent')){
		 var flashvars = {
			 xmlURL: 'www/xml/images.php?dir='+new String(window.location).split("/").last().gsub('.html',"")
		};

		swfobject.embedSWF("www/swf/gallery.swf", "myContent", "650", "600", "0", "www/swf/expressInstall.swf", flashvars);
	}
	var links = $(document.body).select('a');
	links.each(function(s){
		if(s.href.include('.doc'))s.addClassName('word');					
		if(s.href.include('.pdf'))s.addClassName('pdf');					
		if(s.href.include('.xls'))s.addClassName('xls');					
	});
	
}
function start_sIFR(){}
new NVB.load({
	onload:new Array(
		init
	),
	scripts: new Array(
		'sifr.js',
		'swfobject.js',
		//'calendar.js',
		'supersleight.js'
	),
	google_analytics: "UA-4580656-1"
});
