/**************************************************************************
Peter Wright	03/06/2008		Start up manager	v2
**************************************************************************/
var Sum = {
	swfobject:'',
	functions:[],
	flashes:[],
	gallerys:[],
	beforeafters:[],
	dir:"/inc/js/",
	sources:[],
	init:function() {
		if(window.addEventListener) { i.addEventListener("load",this.exec,false) }
		else if (window.attachEvent) { i.attachEvent("onload",this.exec) }
		else {window.onload=this.exec(); }
	},
	load:function() {
		var head = document.getElementsByTagName("head");
		for(i in this.sources) {
			var script = document.createElement('script');
			script.language = this.sources[i].language;
			script.type = this.sources[i].type;
			script.src = this.dir + this.sources[i].src;
			head[0].appendChild(script);
		};
	},
	exec:function()	{
		for(var i=0;i<Sum.functions.length;  i++)
		{
			eval(Sum.functions[i]);
		}
	},
	add:function(func) {
		this.functions[this.functions.length]=func;
		this.init();
	},
	flash:function(obj) {
		this.flashes[this.flashes.length] = obj;
		this.execFlashQue();
	},
	execFlashQue:function(swfobject) {
		if((typeof swfobject) == "object") {
			this.swfobject = swfobject;
		}
		for(var i=0;  i<this.flashes.length;  i++)
		{
			if((typeof this.flashes[i]) == "object" && (typeof this.swfobject == "object"))
			{
				var obj = this.flashes[i];
				if(obj) {
					switch(obj.func)
					{
						case 'registerObject' :this.swfobject.registerObject(obj.id, obj.version, obj.ei);
							break;
						case 'embedSWF' :this.swfobject.embedSWF(obj.file, obj.id, obj.width, obj.height, obj.version, obj.ei, obj.flashvars, obj.params, obj.attrs);
							break;
					}
					this.flashes[i] = null;
				}
			}
		};
	}
};
Sum.load();
