MySpace.UI.IframePopup = function(elementId,showId,iFrameId,iFrameSrc,eleClass,ifmClass) {
	/// <param name="elementId" type="String"></param>
	/// <param name="showId" type="String"></param>
	/// <param name="iFrameId" type="String"></param>
	/// <param name="iFrameSrc" type="String"></param>
	/// <param name="width" type="Number"></param>
	/// <param name="height" type="Number"></param>
	/// <param name="backOpac" type="Number"></param>
	/// <param name="eleClass" type="String" optional="true"></param>
	/// <param name="ifmClass" type="String" optional="true"></param>
	
    this._elementID = elementId;
    this._showID = showId;
    this._iFrameId = iFrameId;
    this._iFrameSrc = iFrameSrc;
    this._elementClass = eleClass;
    this._iframeClass = ifmClass;
    
	this._element = null;
	this._elementStyle = null;
	this._showElement = null;
	this._pxFromTop = 125;
	this._initialized = false;
	if(this._showID !== ''){
		this._hookHandler();
	}
	window._iframepopup = this;
}

MySpace.UI.IframePopup.prototype = {

    setiframesrc : function(url,arg) {
    	/// <param name="url" type="String"></param>
	    /// <param name="arg" type="String" optional="true"></param>
	    if("undefined" === typeof(arg))  _proxy_jslib_assign('', $get(this._iFrameId), 'src', '=', (url));
	    else  _proxy_jslib_assign('', $get(this._iFrameId), 'src', '=', (url+arg));
    },

    _initialize : function() {
		//Create the element
		var newDiv = document.createElement("div");
		newDiv.id = this._elementID;

		var innerHtmlSB = new (Sys.StringBuilder)("<div id='iframepopupinner' style='margin:auto' class='");
		innerHtmlSB.append(this._elementClass);
		innerHtmlSB.append("'><iframe id='PWOIframeID' frameborder='0' scrolling='no' class='");
		innerHtmlSB.append(this._iframeClass);
		innerHtmlSB.append("'></iframe></div>");
		
		 _proxy_jslib_assign('', newDiv, 'innerHTML', '=', (  _proxy_jslib_handle(innerHtmlSB, 'toString', '', 1, 0)()));
		
		this._element = newDiv;
		this._elementStyle = this._element.style;
		this._elementStyle.zIndex = '1000201';
		this._elementStyle.width = '100%';
		this._elementStyle.left = '0px';
		if(Sys.Browser.InternetExplorer===Sys.Browser.agent)
		    this._elementStyle.position = 'absolute';
		else
		    this._elementStyle.position = 'fixed';
		 _proxy_jslib_assign('', this._elementStyle, 'top', '=', ( this._pxFromTop + 'px'));
		
		//Add the background element to DOM
		 _proxy_jslib_handle(document, 'body', '', 0, 0).appendChild(this._element);
		
		$get('PWOIframeID').id = this._iFrameId;
		
		this._initialized=true;
	},
	
	_hookHandler: function() {
	    var id;
	    var onclickHandler;
	    var idArray = this._showID.split(",");
	    this._showElement = {};
	   
	    for(var i = 0; i < idArray.length; i++){
	        id =  _proxy_jslib_handle(idArray, (i), 0, 0);
	         _proxy_jslib_assign('', this._showElement, (id), '=', ( $get(id)));
	        $addHandler( _proxy_jslib_handle(this._showElement, (id), 0, 0),'click',Function.createDelegate(this,this.show));
	    }
	},
	
	show : function(args) {
		/// <param name="args" type="Function"></param>
	
		if (!this._initialized){
			this._initialize();
		}
		
		var idArray = this._showID.split(",");
		if("undefined" === typeof(args)){
		    this.setiframesrc(this._iFrameSrc);
		    
		    //Show the Object
	        this._elementStyle.display = 'block';
	        this._elementStyle.visibility = 'visible';

	        window.get_overlay().show();
	        if(this._iFrameId){
		        $get(this._iFrameId).style.display = 'block';
		        $get(this._iFrameId).style.visibility = 'visible';
	        }
	        this._vertScroll();
		}
		else if (Array.contains(idArray, args.target.id)){
            this.setiframesrc(this._iFrameSrc,args.target.id.split('_')[0]);

            //Show the Object
            this._elementStyle.display = 'block';
            this._elementStyle.visibility = 'visible';

            window.get_overlay().show();
            if(this._iFrameId){
                $get(this._iFrameId).style.display = 'block';
                $get(this._iFrameId).style.visibility = 'visible';
            }
            this._vertScroll();
		}
		
		return false;
	},
	
	
	showMe : function(param) {
		if (!this._initialized){
			this._initialize();
		}
		
		 _proxy_jslib_assign('', $get(this._iFrameId), 'src', '=', (  String.format(this._iFrameSrc,param)));
		
		 //Show the Object
         this._elementStyle.display = 'block';
         this._elementStyle.visibility = 'visible';

         window.get_overlay().show();
         if(this._iFrameId){
              $get(this._iFrameId).style.display = 'block';
             $get(this._iFrameId).style.visibility = 'visible';
         }
         this._vertScroll();
        
        return false;
	},
	
	hide : function() {
		window.get_overlay().hide();
		this._elementStyle.display = 'none';
		
		//Firefox has issues closing the outer element from an IFrame.
		if(this._iFrameId){
			$get(this._iFrameId).style.display = 'none';
			 _proxy_jslib_assign('', $get(this._iFrameId), 'src', '=', (''));
		}
	},
	
    _vertScroll: function() {
        if(Sys.Browser.InternetExplorer===Sys.Browser.agent) {
            var vertScroll = 0;
            if(  _proxy_jslib_handle(document, 'body', '', 0, 0) && (  _proxy_jslib_handle(document, 'body', '', 0, 0).scrollLeft ||  _proxy_jslib_handle(document, 'body', '', 0, 0).scrollTop ) ){
                vertScroll =  _proxy_jslib_handle(document, 'body', '', 0, 0).scrollTop;
            }
            else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ){
                vertScroll = document.documentElement.scrollTop;
            }
             _proxy_jslib_assign('', this._elementStyle, 'top', '=', ( this._pxFromTop+vertScroll + 'px'));
		}
	},
	
	dispose : function() {
		this._initialized = false;
		MySpace.UI.IframePopup.callBaseMethod(this, 'dispose');
	}
}
window.get_iframepopup = function() {if(!window._iframepopup) return null; else return window._iframepopup;};

MySpace.UI.IframePopup.registerClass('MySpace.UI.IframePopup');

if(typeof(Sys)!=='undefined')Sys.Application.notifyScriptLoaded();
 ;
_proxy_jslib_flush_write_buffers() ;