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(){
	var _sub = $('sub_menu');
	var _list = $('list');
	var _inner = $('inner');
	var _block = $$('div.block_large');
	
	if(_sub){
		if(_block.first().getHeight() > _sub.getHeight()){
			_sub.setStyle({height: _inner.getHeight()+'px'});
		}else{
			_block.first().setStyle({height: _sub.getHeight()+20+'px'});
		}
	}
	if(_list){
		if(_list.getHeight()-22 > _block.first(). getHeight()){
			_block.first().setStyle({height:_list.getHeight()-22+'px'});
		}
		
	}
}
function start_sIFR(){
}
new NVB.load({
	//path:'../www/js/',
	onload:new Array(
		init,
		start_sIFR
	),
	scripts: new Array(
		'sifr.js',
		'supersleight.js',
		'google_analytics.js'
	)
	//google_analytics: "UA-4059529-1"
});
