Vudu.widget.SearchLoginPanel = function( popupDiv , imgSrc )	{
	
	this._popupDiv = popupDiv;
	this._imgSrc = imgSrc;
	
	this.fwdLink = null;
	
	this.render();
};


Vudu.widget.SearchLoginPanel.prototype = {

	render : function()	{
		
		var sugX = Math.round( (YAHOO.util.Dom.getViewportWidth() - 550 )/2) ;
		var sugY = Math.round( (YAHOO.util.Dom.getViewportHeight() - 250 )/2) ;
		
		// populate YUI panel
		this.popupPanel = new YAHOO.widget.Panel( YAHOO.util.Dom.get(this._popupDiv) , {
				width:"550px",
				visible:false,
				constraintoviewport:false,
				draggable:false ,
				underlay: "shadow",
				modal:true,
				fixedcenter:false,
				x: sugX,
				y: sugY,
				close:false,
				zIndex:100000
		});
		
		
		var popUpBody = document.createElement('div');
		YAHOO.util.Dom.setStyle(popUpBody , 'width' , '540px' );
		
		// add a spacer
		var spacer = document.createElement('div');
		YAHOO.util.Dom.setStyle(spacer, 'position' , 'relative' );
		YAHOO.util.Dom.setStyle(spacer , 'float' , 'left' );
		YAHOO.util.Dom.setStyle(spacer , 'width' , '100%');
		YAHOO.util.Dom.setStyle(spacer , 'height' , '40px');
		popUpBody.appendChild(spacer);
				
		// set the title span
		this.msgSpan = document.createElement('div');
		YAHOO.util.Dom.setStyle(this.msgSpan , 'position' , 'relative' );
		YAHOO.util.Dom.setStyle(this.msgSpan , 'float' , 'left' );
		YAHOO.util.Dom.setStyle(this.msgSpan , 'width' , '100%' );
		YAHOO.util.Dom.setStyle(this.msgSpan , 'height' , '200px' );
		YAHOO.util.Dom.setStyle(this.msgSpan , 'padding-left' , '10px' );
		YAHOO.util.Dom.setStyle(this.msgSpan , 'font-family' , 'arial,helvetica,clean,sans-serif' );
		YAHOO.util.Dom.setStyle(this.msgSpan , 'font-size' , '12pt' );
		YAHOO.util.Dom.setStyle(this.msgSpan , 'color' , 'rgb(153, 153, 153)' ); 
		popUpBody.appendChild(this.msgSpan);
		
		var linksDiv = document.createElement('div');
		YAHOO.util.Dom.setStyle(linksDiv , 'positoin' 	, 'relative' );
		YAHOO.util.Dom.setStyle(linksDiv , 'float' 		, 'left' );
		YAHOO.util.Dom.setStyle(linksDiv , 'height' 	, '50px' );
		YAHOO.util.Dom.setStyle(linksDiv , 'width' 		, '100%' );
		popUpBody.appendChild(linksDiv);
		
		this.fwdButton = document.createElement('div');
		YAHOO.util.Dom.setStyle(this.fwdButton , 'float' 	, 'right' );
		YAHOO.util.Dom.setStyle(this.fwdButton , 'padding-top' 	, '4px' );
		YAHOO.util.Dom.setStyle(this.fwdButton , 'cursor' , 'pointer' );
		YAHOO.util.Dom.setStyle(this.fwdButton , 'color' , '#000000' );
		YAHOO.util.Dom.setStyle(this.fwdButton , 'width' , '110px' );
		YAHOO.util.Dom.setStyle(this.fwdButton , 'height' , '26px' );
		YAHOO.util.Dom.setStyle(this.fwdButton , 'background-repeat' , 'no-repeat' );
		YAHOO.util.Dom.setStyle(this.fwdButton , 'background-image' , 'url('+this._imgSrc+'/vudu_button_110.gif)' );
		YAHOO.util.Dom.setStyle(this.fwdButton , 'background-color' , 'transparent' );
	 	YAHOO.util.Dom.setStyle(this.fwdButton , 'font-family' 	, 'arial,helvetica,clean,sans-serif' );
	 	YAHOO.util.Dom.setStyle(this.fwdButton , 'font-size' 	, '10pt' );
	 	YAHOO.util.Dom.setStyle(this.fwdButton , 'font-weight' 	, 'bold' );
	 	YAHOO.util.Dom.setStyle(this.fwdButton , 'text-align' 	, 'center' );
	 	YAHOO.util.Event.addListener  (
			this.fwdButton ,
			'click' ,
			function( e , searchPopup ) {
				if(searchPopup.fwdLink)	{
					document.location.href = searchPopup.fwdLink;
				}
			},
			this ,
			true
		);
		// add the close button div
		var closeButton = document.createElement('div');
		YAHOO.util.Dom.setStyle(closeButton , 'float' 	, 'right' );
		YAHOO.util.Dom.setStyle(closeButton , 'padding-top' 	, '4px' );
		YAHOO.util.Dom.setStyle(closeButton , 'cursor' , 'pointer' );
		YAHOO.util.Dom.setStyle(closeButton , 'color' , '#000000' );
		YAHOO.util.Dom.setStyle(closeButton , 'width' , '110px' );
		YAHOO.util.Dom.setStyle(closeButton , 'height' , '26px' );
		YAHOO.util.Dom.setStyle(closeButton , 'background-repeat' , 'no-repeat' );
		YAHOO.util.Dom.setStyle(closeButton , 'background-image' , 'url('+this._imgSrc+'/vudu_button_110.gif)' );
		YAHOO.util.Dom.setStyle(closeButton , 'background-color' , 'transparent' );
	 	YAHOO.util.Dom.setStyle(closeButton , 'font-family' 	, 'arial,helvetica,clean,sans-serif' );
	 	YAHOO.util.Dom.setStyle(closeButton , 'font-size' 	, '10pt' );
	 	YAHOO.util.Dom.setStyle(closeButton , 'font-weight' 	, 'bold' );
	 	YAHOO.util.Dom.setStyle(closeButton , 'text-align' 	, 'center' );
	 	closeButton.innerHTML = 'Close';
	 		 	YAHOO.util.Event.addListener  (
			closeButton ,
			'click' ,
			function( e , searchPopup ) {
				searchPopup.popupPanel.hide();
			},
			this ,
			true
		);
	 	linksDiv.appendChild(closeButton);
	 	linksDiv.appendChild(this.fwdButton);
	 	
		// render the YUI panel
		this.popupPanel.render();
		// set the body of the div 
		this.popupPanel.setBody(popUpBody);
	},
	
	showPanel : function( msg , fwdButtonTxt , fwdUrl )	{
		
		// if there is no msg to show - DONT show anything
		if(!msg) return;
		
		this.msgSpan.innerHTML = msg;
		
				
		if(fwdButtonTxt && fwdUrl )	{	
			YAHOO.util.Dom.setStyle(this.fwdButton , 'display' 	, 'block' );
			this.fwdLink = fwdUrl;
			this.fwdButton.innerHTML = fwdButtonTxt;
		}
		else	{
			YAHOO.util.Dom.setStyle(this.fwdButton , 'display' 	, 'none' );
		}
		this.popupPanel.show();
	}
}