Ext.onReady(function(){
	IP.web.init = function (b, c, cb, d) {
		var isDone = false;
		var postLoad = function() {
			c.b.setStyle({'background-image':'url(' + b.r + c.s + '-lg.jpg)'});
			c.i.setStyle({'background-image':'url(' + b.r + c.s + '-sm.jpg)'});
			var config = {
				duration : (d != undefined ? d : .01),
				callback : function () {
					setTimeout(function() {
						if (Ext.type(cb) == 'function') cb();
					}, 100);
				}
			};
			if (d == 0) {
				$('wrapper').show();
				config.callback();
			} else {
				$('wrapper').show(config);
			}
			
		};
		if (c.s) {
			var loader1 = new IP.Image();
			loader1.load({
				url : b.r + c.s + '-sm.jpg',
				callback : function() {
					isDone ? postLoad() : isDone = true;
				}
			});
			var loader2 = new IP.Image();
			loader2.load({
				url : b.r + c.s + '-lg.jpg',
				callback : function() {
					isDone ? postLoad() : isDone = true;
				}
			});
		}
	};
	IP.web.page.init = function (b, c, cb) {
		if (c.l) IP.SwfManager.inject('f-logo', '197', '107', 'logo.swf', b.r + b.f, Ext.encode(c.l));	
		if (c.n) IP.SwfManager.inject('f-nav', '701', '38', 'nav.swf', b.r + b.f, Ext.encode(c.n));	
		if (c.s) IP.SwfManager.inject('f-sub', '701', '38', 'nav.swf', b.r + b.f, Ext.encode(c.s));	
		if (c.t) IP.SwfManager.inject('f-title', '900', '75', 'title.swf', b.r + b.f, Ext.encode(c.t));	
		if (Ext.type(cb) == 'function') cb();
	}
	IP.web.page.ready = {
		//*** properties
		htmlReady : false,
		logoReady : false,
		navReady : false,
		titleReady : false,
		htmlStarted : false,
		//*** methods
		checkFlashReadiness : function () {
			if (this.htmlReady && this.titleReady && this.logoReady && this.navReady) this.startLogo();
		},
		//*** events
		onHtmlReady : function () {
			this.htmlReady = true;
			this.checkFlashReadiness();
		},
		onLogoReady : function () {
			this.logoReady = true;
			this.checkFlashReadiness();
		},
		onNavReady : function () {
			this.navReady = true;
			this.checkFlashReadiness();
		},
		onTitleReady : function () {
			this.titleReady = true;
			this.checkFlashReadiness();
		},
		//*** private methods
		startHtml : function () {
			if (!this.htmlStarted) this.buildHtml();
			this.htmlStarted = true;
		},
		startLogo : function () {
			$('f-logo').dom.startFlash();
		},
		startNav : function () {
			$('f-nav').dom.startFlash();
		},
		startSub : function () {
			$('f-sub').dom.startFlash();
		},
		startTitle : function () {
			$('f-title').dom.startFlash();
		},
		//*** public methods
		buildHtml : function () {
		}
	}
});

