oRcsf.RegisterObject('Site');

/**
 * Wrapper for class method
 */
function CreatePopup(sUrl)
{
	oRcsf.moSite.CreatePopup(sUrl);
}
function CreateSwf(sUrl,x,y,w,h)
{
 	if($('popupswf'))
		$('popupswf').remove();
	oRcsf.moSite.CreateSwf(sUrl,x,y,w,h);
}
function ClosePopup ()
{
	$('popup').remove();
}
function CloseSwf ()
{
	$('popupswf').remove();
}
/**
 *
 */
var RCSF_Project_Site = 
{
	/**
	 * Add event listener for resize event
	 */
	OnDomLoaded : function()
	{ 
		SetMinSwfDimensions(950,670);
		Event.observe(self, 'resize', this.PositionSwf.bind(this));
		
		
	}
	
	,CreatePopup : function (sUrl)
	{
		var popup = new Element('div', {id: 'popup'});
		document.body.appendChild(popup);

		$('popup').update('<iframe width="100%" height="100%" border="0" frameborder="0" src="popup.php?url='+escape(sUrl)+'"></iframe>');
	}
	
	,CreateSwf : function (sUrl,x,y,w,h)
	{
		this._x = x;
		this._y = y;
	
	    if($('popupswf'))
	    	$('popupswf').remove();
	    
	
		var popup = new Element('div', {id: 'popupswf','style' : 'top:'+y+'px'});
		document.body.appendChild(popup);
		popup.update(new Element('div',{id : 'swf'}))
	
		this.PositionSwf();
		
		swfobject.embedSWF(
			 this.moCore.maPaths['a_url']['s_project_root'] + 'files/swf/banners/' + sUrl
			,'swf'
			,w
			,h
			,'8'
			,false //expressInstallSwfurl
			,{}
			,{}
			//attributes
			,{}
		);
	}
	
	,PositionSwf : function ()
	{
		if($('popupswf'))
		{
			var i_left = ($('IndexSWF').getWidth() / 2) - 475;
			var i_top = ($('IndexSWF').getHeight() / 2) - 335;
			$('popupswf').style.left = parseInt(this._x + i_left) + 'px';
			$('popupswf').style.top = parseInt(this._y + i_top) + 'px';
		}
	}
}
