var CTBOX = {
	
	//----------------------------------------------------------------
	
	box:null,
	iframe:null,
	bt_close:null,
	image:null,
	contentContainer:null,
	
	//----------------------------------------------------------------
	
	init:function() {
		this.set_box();
	},
	
	//----------------------------------------------------------------
	
	set_box:function() {
		this.box = document.getElementById('contentBox');
		this.image = document.getElementById('contentBox_bgImage');
		this.iframe = document.getElementById('contentBox_iframe');
		this.contentContainer = document.getElementById('contentSource');
		this.bt_close = document.getElementById('contentBox_close');
		this.bt_close.onclick = function() {
			CTBOX.hide();
		}
		window.addEvent('resize',function(){CTBOX.on_resize();});
		
		if( IS_IFRAME === false && this.contentContainer.innerHTML != '' ) {
			this.show(window.location.href);
		}
	},
	
	//----------------------------------------------------------------
	
	show:function( url, target ) {
		
		if( target == '_popup' ) {
			url = JSON.decode(url);
			var w = window.open(url.url, "Powerup", url.params);
			w.focus();
		} else if( target == '_top' ) {
			window.location.href = url;
		} else if( target == '_blank' ) {
			window.open(url, '_blank');
		} else {
			
			if (this.iframe.attachEvent) {
				this.iframe.attachEvent('onload',
					function (evt) {
						CTBOX.box.style.display = 'block';
						CTBOX.on_resize();
					}
				);
			} else {
				this.iframe.onload = function() {
					CTBOX.box.style.display = 'block';
					CTBOX.on_resize();
				}
			}
			
			url = ( url.indexOf('?') > -1 ) ? url+'&' : url+'?';
			this.iframe.src = url+'iframe=1';
		}
	},
	
	//----------------------------------------------------------------
	
	hide:function() {
		this.box.style.display = 'none';
	},
	
	//----------------------------------------------------------------

	on_resize:function() {
		this.image.style.height = this.box.offsetHeight+'px';
		this.iframe.style.height = this.box.offsetHeight - 72 + 'px';
	}

	//----------------------------------------------------------------
	
};

window.addEvent('domready',function(){
	CTBOX.init();
	document.getElementById('altNavigation').style.display = 'none';
});
