var plg_popup_cmsContent = new function()
{

	this.cache = {};
	this.overlayDef = null;
	
	this.init = function()
	{
		$('a.lexiconLink').click( plg_popup_cmsContent.askForContent );
	}

	this.askForContent = function( sender )
	{
		var pop = $('.jQ_cmsContentPopup:eq(0)').clone();
		$.extend( $.blockUI.defaults.overlayCSS, { backgroundColor: 'transparent', cursor:'default' } );	
		plg_popup.show( pop );
	
		
		$( ".blockMsg" ).css( { border:'0px', left:'250px', top:'150px', width:'600px' } );
		$( ".popup" ).css( { width: '600px' } );
		$( ".popup .content" ).css( { background:'#FFF' } );

		$('.jQ_cmsContentPopup_inner:eq(1)').html( $('.jQ_cmsContentPopup_loadingContent:eq(1)').html() );

		if( plg_popup_cmsContent.cache[ $(sender.target).attr('href') ] )
		{
			plg_popup_cmsContent.askForContent__callback( plg_popup_cmsContent.cache[ $(sender.target).attr('href') ] );
			return false;
		}

		majax.call_callback( 'plg_popup_cmsContent::ajaxGetContent', plg_popup_cmsContent.askForContent__callback, [ $(sender.target).attr('href') ] );
		return false;
	}

	this.askForContent__callback = function( response )
	{
		var response = eval( response );
		plg_popup_cmsContent.cache[ response.result.itemUri ] = response;

		$('.title__callback:eq(1)').html( response.result.subject );
		$('.body__callback:eq(1)' ).html( response.result.body );

		$('.jQ_cmsContentPopup_inner:eq(1)').html( $('.jQ_cmsContentPopup_readyContent:eq(1)').html() );
	}

}