// <WebServiceGeneratedProxy Path="/Modules/MusicV2/Services/PopUpPlayer.asmx">
Type.registerNamespace('MySpace.Web.Modules.MusicV2.Services');
MySpace.Web.Modules.MusicV2.Services.PopUpPlayer=function() {
MySpace.Web.Modules.MusicV2.Services.PopUpPlayer.initializeBase(this);
this._timeout = 0;
this._userContext = null;
this._succeeded = null;
this._failed = null;
}
MySpace.Web.Modules.MusicV2.Services.PopUpPlayer.prototype={
GetMultipleArtistsUpdate:function(ArtistIds,succeededCallback, failedCallback, userContext) {
return this._invoke(MySpace.Web.Modules.MusicV2.Services.PopUpPlayer.get_path(), 'GetMultipleArtistsUpdate',false,{ArtistIds:ArtistIds},succeededCallback,failedCallback,userContext); },
GetArtistUpdate:function(ArtistId,succeededCallback, failedCallback, userContext) {
return this._invoke(MySpace.Web.Modules.MusicV2.Services.PopUpPlayer.get_path(), 'GetArtistUpdate',false,{ArtistId:ArtistId},succeededCallback,failedCallback,userContext); }}
MySpace.Web.Modules.MusicV2.Services.PopUpPlayer.registerClass('MySpace.Web.Modules.MusicV2.Services.PopUpPlayer',Sys.Net.WebServiceProxy);
MySpace.Web.Modules.MusicV2.Services.PopUpPlayer._staticInstance = new (MySpace.Web.Modules.MusicV2.Services.PopUpPlayer)();
MySpace.Web.Modules.MusicV2.Services.PopUpPlayer.set_path = function(value) { MySpace.Web.Modules.MusicV2.Services.PopUpPlayer._staticInstance._path =  _proxy_jslib_handle(null, 'value', value, 0, 0); }
MySpace.Web.Modules.MusicV2.Services.PopUpPlayer.get_path = function() { return MySpace.Web.Modules.MusicV2.Services.PopUpPlayer._staticInstance._path; }
MySpace.Web.Modules.MusicV2.Services.PopUpPlayer.set_timeout = function(value) { MySpace.Web.Modules.MusicV2.Services.PopUpPlayer._staticInstance._timeout =  _proxy_jslib_handle(null, 'value', value, 0, 0); }
MySpace.Web.Modules.MusicV2.Services.PopUpPlayer.get_timeout = function() { return MySpace.Web.Modules.MusicV2.Services.PopUpPlayer._staticInstance._timeout; }
MySpace.Web.Modules.MusicV2.Services.PopUpPlayer.set_defaultUserContext = function(value) { MySpace.Web.Modules.MusicV2.Services.PopUpPlayer._staticInstance._userContext =  _proxy_jslib_handle(null, 'value', value, 0, 0); }
MySpace.Web.Modules.MusicV2.Services.PopUpPlayer.get_defaultUserContext = function() { return MySpace.Web.Modules.MusicV2.Services.PopUpPlayer._staticInstance._userContext; }
MySpace.Web.Modules.MusicV2.Services.PopUpPlayer.set_defaultSucceededCallback = function(value) { MySpace.Web.Modules.MusicV2.Services.PopUpPlayer._staticInstance._succeeded =  _proxy_jslib_handle(null, 'value', value, 0, 0); }
MySpace.Web.Modules.MusicV2.Services.PopUpPlayer.get_defaultSucceededCallback = function() { return MySpace.Web.Modules.MusicV2.Services.PopUpPlayer._staticInstance._succeeded; }
MySpace.Web.Modules.MusicV2.Services.PopUpPlayer.set_defaultFailedCallback = function(value) { MySpace.Web.Modules.MusicV2.Services.PopUpPlayer._staticInstance._failed =  _proxy_jslib_handle(null, 'value', value, 0, 0); }
MySpace.Web.Modules.MusicV2.Services.PopUpPlayer.get_defaultFailedCallback = function() { return MySpace.Web.Modules.MusicV2.Services.PopUpPlayer._staticInstance._failed; }
MySpace.Web.Modules.MusicV2.Services.PopUpPlayer.set_path("/Modules/MusicV2/Services/PopUpPlayer.asmx");
MySpace.Web.Modules.MusicV2.Services.PopUpPlayer.GetMultipleArtistsUpdate= function(ArtistIds,onSuccess,onFailed,userContext) {MySpace.Web.Modules.MusicV2.Services.PopUpPlayer._staticInstance.GetMultipleArtistsUpdate(ArtistIds,onSuccess,onFailed,userContext); }
MySpace.Web.Modules.MusicV2.Services.PopUpPlayer.GetArtistUpdate= function(ArtistId,onSuccess,onFailed,userContext) {MySpace.Web.Modules.MusicV2.Services.PopUpPlayer._staticInstance.GetArtistUpdate(ArtistId,onSuccess,onFailed,userContext); }
// </WebServiceGeneratedProxy>


/// <summary>
/// MySpaceMusic Object definition
/// </summary>
MySpaceMusic = {
	focusStatus: true,
	Focus : function() {
        MySpaceMusic.focusStatus = true;
	},
	Blur : function() {
        MySpaceMusic.focusStatus = false;
	}
}

// Add our Focus/Blur via ASP DOM handlers
if (typeof($addHandler) !== 'undefined') {
    if (Sys.Browser.agent === Sys.Browser.InternetExplorer) {
        $addHandler(document, "focusout", MySpaceMusic.Blur);
        $addHandler(document, "focusin", MySpaceMusic.Focus);
    } else if (Sys.Browser.agent === Sys.Browser.Safari) {
        $addHandler(window, "blur", MySpaceMusic.Blur);
        $addHandler(window, "focus", MySpaceMusic.Focus);
    } else { // Firefox
        $addHandler(window, "blur", MySpaceMusic.Blur);
        $addHandler(window, "focus", MySpaceMusic.Focus);
    }
}
  

/// <summary>
/// MySpaceMusic.WebSvrManager Object definition
/// </summary>
MySpaceMusic.WebSvrManager = {
    ArtistUpdateSuccess: function(result, eventArgs) {
		if (result != null) {
		     _proxy_jslib_assign('',  _proxy_jslib_handle(document, 'getElementById', '', 1, 0)('feedResult'), 'innerHTML', '=', ( result));
        }
    },
    OnFailure: function(msg) {
//        alert("Error MySpaceMusic.WebSvrManager: " + msg._message);
    }
}

/// ------------------------------callBacks-------------------------------

getElementPosition = function(element) {
    var left = 0;
    var top = 0;
    if (element) {
        while (element.offsetParent) {
            left += element.offsetLeft;
             top= _proxy_jslib_assign_rval('', 'top', '+=', ( element.offsetTop), top);
            element = element.offsetParent;
        }
        left += element.offsetLeft;
         top= _proxy_jslib_assign_rval('', 'top', '+=', ( element.offsetTop), top);
    }
    
    return { x: left, y:  _proxy_jslib_handle(null, 'top', top, 0, 0) };
}

MySpaceMusic.openTooltip = function (paramHeight, paramWidth) {
    var swfDiv =  _proxy_jslib_handle(document, 'getElementById', '', 1, 0)(MusicPlayerControl.SwfObjectDiv);
    var swfPos = getElementPosition(swfDiv);

    // calculate the center position
    var leftMargin = 0; 
    if (swfDiv.offsetWidth > paramWidth) {
        leftMargin = (swfDiv.offsetWidth - paramWidth)/2

 }
    var topMargin = 0;
    if (swfDiv.offsetHeight > paramHeight) {
        topMargin = (swfDiv.offsetHeight - paramHeight)/2

 }

    var iframeLeft = leftMargin;
    var iframeTop = -swfDiv.offsetHeight + topMargin;
       
    var cssText = '.tooltip div.corner,.tooltip div.top,.tooltip div.arrow,.tooltip div.origin_tl,.tooltip div.origin_tr,.tooltip div.origin_bl,.tooltip div.origin_br,.tooltip div.closeButton{background:none;position: absolute;}.tooltip{display:none;z-index: 100001;cursor: default;position: relative;top:0px;}.tooltip div.origin_tl,.tooltip div.origin_tr,.tooltip div.origin_bl,.tooltip div.origin_br{background-position: bottom right;}.tooltip div.corner,.tooltip div.top{top:-5px;}.tooltip div.corner{background:none;height:25px;width:5px;left:-5px;}.tooltip div.top{background: none;height:5px;width:100%;}.tooltip div.closeButton{background-position:-72px top;width:17px;height:16px;top:5px;right:10px;cursor:pointer;z-index: 100002;}.tooltip div.arrow{background: none;height:15px;width:15px;z-index: 100002;}.tooltip div.arrow_lt{margin: 0px 0px 0px 0px}.tooltip div.content {	width:' + paramWidth + 'px;height:' + paramHeight + ';background: none; position:relative;	padding: 0;}';
    addStyles( _proxy_jslib_handle(null, 'cssText', cssText, 0, 0));
     content= _proxy_jslib_assign_rval('', 'content', '=', ( "<iframe scrolling='no' style='position:absolute; top:" + iframeTop + "px; left:" + iframeLeft + "px' id='musicFlashPlayerContent' height='" + paramHeight + "' width='" + paramWidth + "' frameborder='0' src='" + MusicPlayerControl.TooltipUrl + "'></iframe>"), content);
//    content = "<iframe scrolling='no' style='position:absolute; top:" + iframeTop + "px; left:" + iframeLeft + "px' id='musicFlashPlayerContent' height='" + paramHeight + "' width='" + paramWidth + "' frameborder='0' src='" + "/modules/musicv2/pages/MusicPlayerTooltip.aspx" + "'></iframe>";
    window.tip = $create(MySpace.UI.Tooltip, {content: _proxy_jslib_handle(null, 'content', content, 0, 0)},null,null,$get(MusicPlayerControl.SwfObjectDiv));
    window.tip.show();
//   window.setTimeout("MySpaceMusic.closeTooltip()", 25000)   // remove timeout 
}

MySpaceMusic.closeTooltip = function () {
    if (window.tip != undefined)
        window.tip.hide();
}

function addStyles(styles) {
    var styleSheet=null;
    if (document.createStyleSheet) {
        styleSheet=document.createStyleSheet();
    } else {
        var head= _proxy_jslib_handle(document, 'getElementsByTagName', '', 1, 0)("head")[0];
        styleSheet=document.createElement("style");
        head.appendChild(styleSheet);
    }

    if(Sys.Browser.agent === Sys.Browser.InternetExplorer){
         _proxy_jslib_assign('', styleSheet, 'cssText', '=', (styles));
    } else if (Sys.Browser.agent === Sys.Browser.Safari) {
        styleSheet.innerText=styles;
    } else {
         _proxy_jslib_assign('', styleSheet, 'innerHTML', '=', (styles));
    } 
}

function createPopUp(specificContent, popupW, popupH, invCloseBtn, module) {
	//Required parameter for $create function below
	var customizedTitle = ""; 
	//Contents of the popup
	var customizedContent = specificContent;
		
	//Create a <div> element with the following popup container inside of it
	var divObj = document.createElement("div");
    // center the popup
    
	var topPos = 50;
	var width = 100;
	if (MySpace.ClientContext.FunctionalContext == "PopUpPlayer" && module=="optin") {
	    topPos = 0;
	    if (browser.isIE6x) {
	        width = 65;
	    }
	}
	else {
        var scrollTop = document.documentElement.scrollTop;
        if (scrollTop == 0 ) {
	        scrollTop =  _proxy_jslib_handle(document, 'body', '', 0, 0).scrollTop;
        }
        topPos = topPos + scrollTop;
    }
	 _proxy_jslib_assign('', divObj, 'innerHTML', '=', ("<div id='divWrapper' class='popup_wrapper' style='z-index:1000001;left:0px;width: " + width + "%;position:absolute;display:none;visibility:hidden;text-align:center;padding:auto auto auto auto;'><div class='appspopup_box' style='width:" + popupW + "px; height:" + popupH + "px; margin-left: auto;margin-right: auto;border: 4px solid #6698CB;'>" + invCloseBtn + "<div></div><div class='appspopup_content' style='margin:0 auto;'></div><div class='appspopup_buttons'></div></div></div>"));
	
	//Invoke PopUp code from global.js found in Flash Media Player control
	var popupObj = $create(MySpace.UI._Popup,{title:customizedTitle,content:customizedContent,left:0,top:topPos},null,null,divObj.firstChild);

	return popupObj;	
}  

MySpaceMusic.onFindRingtoneClicked = function(artistArr, currSong) {
	if(MusicPlayerControl.AllowJamba)
	{
		var jambaURL = "";
		var parameters = "";
		var aSong = [];			//Temp array holding a single song's data with formatting.
		var tempString;
		
		esvtk_track( {esvtk_v:'1', esvtk_esvid:'A10030' , event:'myspacejvmusic_ringtone', esvtk_forcecount:'1'});

		popupWidth = 604;
		popupHeight = 465;		
			
		if (currSong == "" || artistArr == "")
		{
			jambaURL = MusicPlayerControl.JambaUrl1;
		}
		else
		{
			currSong =  _proxy_jslib_handle(currSong, 'replace', '', 1, 0)(/ /g, "+");
			currSong =  _proxy_jslib_handle(currSong, 'replace', '', 1, 0)(/'/g, "");
			aSong = currSong.split(":");
			parameters = aSong[0] + "," + aSong[1];
					
			for (var i = 1; i < artistArr.length; i++) //Discard first element because it's the current song
			{
				tempString =  _proxy_jslib_handle( _proxy_jslib_handle(artistArr, (i), 0, 0), 'replace', '', 1, 0)(/ /g, "+");
				tempString =  _proxy_jslib_handle(tempString, 'replace', '', 1, 0)(/'/g,"");
				aSong = tempString.split(":");
				aSong[0] =  _proxy_jslib_handle(aSong[0], 'replace', '', 1, 0)(/,/g, "+");
				parameters = parameters + "&arttitle=" + aSong[0] + "," + aSong[1]; 
			}
			jambaURL = MusicPlayerControl.JambaUrl2 + parameters;
		}
		
		//Content to display in the popup
		popupContent = "<iframe id='popupiframe' scrolling='no' style='border:0;overflow:hidden' src='" + jambaURL + "' width='" + popupWidth + "' height='" + popupHeight + "'></iframe>";
		//The popup code allows for a single element with class=pop_x to close the popup; here, we use invisible <p> elements placed over images of the content
		invCloseBtn = "<p onclick='closeRingtoneWindow();' clafss='popup_x' style='background:none; width:66px; height:25px; top:26px; margin:-27px 0 0 0; cursor:pointer; float:right; position:relative;'></p>";

		popup = createPopUp(popupContent,popupWidth,popupHeight,invCloseBtn, "ringtone");
		popup.show();
			
/*r = document.createElement('link');
r.setAttribute('rel', 'stylesheet');
r.setAttribute('type', 'text/css');
r.setAttribute('href', 'http://x.myspacecdn.com/modules/common/static/css/apps/appsdisplay004.css');
document.body.appendChild(r);*/
	popupiFrame =  _proxy_jslib_handle(document, 'getElementById', '', 1, 0)('popupiframe');
	targetPopUpParent = popupiFrame.parentNode;
	targetPopUpParent2 = popupiFrame.offsetParent;
	targetPopUpParent.style.padding = '0px';
	targetPopUpParent2.style.padding = '0px';
	targetPopUpParent.style.paddingTop = '0px';
	targetPopUpParent.style.borderTop = '0px';
	}
}

function closeRingtoneWindow() {
    dDd =  _proxy_jslib_handle(document, 'getElementById', '', 1, 0)('divWrapper');
     _proxy_jslib_handle(document, 'body', '', 0, 0).removeChild(dDd);
}

MySpaceMusic.IsWindowFocused = function () {
    return MySpaceMusic.focusStatus;
}

killPopupBlockerMessaging = function() {
	popupFrame =  _proxy_jslib_handle(document, 'getElementById', '', 1, 0)('amazonNoPopUp');
	 _proxy_jslib_handle(document, 'body', '', 0, 0).removeChild(popupFrame);
 }

MySpaceMusic.popupAllowed = function() {	
	var popUpDetect =  _proxy_jslib_handle(window, 'open', '', 1, 0)('','','width=1,height=1,left=0,top=0,scrollbars=no');
	
	if(popUpDetect) {
		var popupPopped = true;
		 _proxy_jslib_handle(popUpDetect, 'close', '', 1, 0)()

 } else {
		var popupPopped = false;
		var iFrame = document.createElement('iframe');
		 _proxy_jslib_handle(iFrame, 'setAttribute', '', 1, 0)('src', '/modules/musicv2/pages/NoAmazonPopupMessaging.aspx');
		 _proxy_jslib_handle(iFrame, 'setAttribute', '', 1, 0)('id', 'amazonNoPopUp')

 iFrame.style.position = 'absolute';
		 _proxy_jslib_handle(iFrame, 'setAttribute', '', 1, 0)('allowTransparency', 'true');
		 _proxy_jslib_handle(iFrame, 'setAttribute', '', 1, 0)('frameBorder', '0');
		iFrame.style.backgroundColor = 'transparent';
		var swfDiv =  _proxy_jslib_handle(document, 'getElementById', '', 1, 0)(MusicPlayerControl.SwfObjectDiv);
		var swfPos = getElementPosition(swfDiv);
		 _proxy_jslib_assign('', iFrame.style, 'top', '=', ( swfPos.y + 'px'));
		iFrame.style.left = swfPos.x + 'px';
		iFrame.style.width = 300 + 'px';
		iFrame.style.height = 200 + 'px';
		iFrame.style.borderStyle = 'none';
		 _proxy_jslib_handle(document, 'body', '', 0, 0).appendChild(iFrame);
		
	}
	return popupPopped;

}

MySpaceMusic.AmazonInPlacePurchase = function(ASIN) {	
	if(MySpaceMusic.popupAllowed())
	{
		var amazonURL = MusicPlayerControl.AmazonPrice + "&asin=" + ASIN + "&mode=";
		var popupWidth = 626;
		var popupHeight = 426;
		
		if(navigator.userAgent.toLowerCase().indexOf("firefox/") >= 0)
		{
			popupWidth = 611;
			popupHeight = 366;
		}
		
		amazonURL += "windowed";
		var newWindow =  _proxy_jslib_handle(window, 'open', '', 1, 0)(amazonURL, 'Amazon', 'status=no, scrollbars=no, resizable=no, toolbar=no, location=no, directories=no, menubar=no, width=610, height=400');		
		newWindow.focus();
	} /*else {
		alert('A popup blocker has blocked your amazon purchase experience. Please disable your popup before continuing');
	}*/
}


MySpaceMusic.AmazonNotInPlacePurchase = function(engine, artistName, itemName) {
	// engine is either "album" or "track"
	baseUrl = "http://www.amazon.com/s/ref=nb_ss_dmusic";
	engineUrl = "url=search-alias%3Ddigital-music-" + engine;
	artistField = escape("\"" + artistName + "\"");
	itemField = escape("\"" + itemName + "\"");
	fields = "field-keywords=" + artistField + "+" + itemField;
	
	fullUrl = baseUrl + "?" + engineUrl + "&" + fields;
	
	 _proxy_jslib_handle(window, 'open', '', 1, 0)(fullUrl);
}



MySpaceMusic.onBuyAlbumClicked = function(ASIN, albumId, artistName, albumName) {
    esvtk_track( {esvtk_v:'1', esvtk_esvid:'A10030', event:'myspacejvmusic_buyalbum', esvtk_forcecount:'1'});
	if(MusicPlayerControl.AllowAmazonInPlace && ASIN != undefined && ASIN != null && ASIN != "")
		MySpaceMusic.AmazonInPlacePurchase(ASIN);
	else
		MySpaceMusic.AmazonNotInPlacePurchase("album", artistName, albumName);
}

MySpaceMusic.onBuySongClicked = function(ASIN, songId, artistName, songName) {
	
    esvtk_track( {esvtk_v:'1', esvtk_esvid:'A10030', event:'myspacejvmusic_buysong', esvtk_forcecount:'1'});
	if(MusicPlayerControl.AllowAmazonInPlace && ASIN != undefined && ASIN != null && ASIN != "")
		MySpaceMusic.AmazonInPlacePurchase(ASIN);
	else
		MySpaceMusic.AmazonNotInPlacePurchase("track", artistName, songName);
}

var popup;

function ClosePopUp() {
	popup._hide();
	popupId =  _proxy_jslib_handle(document, 'getElementById', '', 1, 0)('divWrapper');
	 _proxy_jslib_handle(document, 'body', '', 0, 0).removeChild(popupId);
}

MySpaceMusic.OptIn = function(userId, playlistId, songId, artistId, songName, albumId) {

	popupWidth = 545;
	popupHeight = 548;	
	
	popupContent = "<iframe id='popupiframe' scrolling='no' style='border:0;overflow:hidden' src=" + "\"/modules/musicv2/pages/optindialog.aspx?userid=" + userId + "&songid=" + songId + "&playlistid=" + playlistId + "&artistid=" + artistId + "&songname=" + escape(songName) + "&albumid=" + albumId + "\" width='" + popupWidth + "' height='" + popupHeight + "'></iframe>";

	invCloseBtn = "<p class='popup_x' style='background:none; width:55px; height:25px; top:59px; margin:-28px 20px 0 0; padding:0 20px 0 0; cursor:pointer; float:right; position:relative;'></p>";
	popup = createPopUp(popupContent,popupWidth,popupHeight,invCloseBtn,"optin");					
	popup.show();

	
}

function logoutAndClose() {
	checkbox =  _proxy_jslib_handle(document, 'getElementById', '', 1, 0)("logoutUserCheckBox");
	if (checkbox.checked)
	{
		var logoutFrame = document.createElement("iframe");
		logoutFrame.id = "amazonLogoutIFrame";
		 _proxy_jslib_assign('', logoutFrame, 'src', '=', ( MusicPlayerControl.AmazonLogoutFrameURL));
		logoutFrame.style.display = "none";
		logoutFrame.style.width = "1px";
		logoutFrame.style.height = "1px";
		 _proxy_jslib_handle(document, 'body', '', 0, 0).appendChild(logoutFrame);
		popup._hide();
	}
	else
	{
		popup._hide();
	}
	checkbox.checked = false;
}

MySpaceMusic.refreshMedRec = function() {
	MySpaceMusic.MedRecRefresh();
}

MySpaceMusic.MedRecRefresh = function() {
	if (MySpace.ClientContext.FunctionalContext == "PopUpPlayer")
        MedRecRefresh();
    if (MySpace.ClientContext.FunctionalContext == "UserViewProfile") 
    	MySpaceMusic.openTooltip(295, 310);
}

/// <summary>
/// onPlayingTrack callback
/// </summary>
MySpaceMusic.onPlayingTrack = function(songID, artistIDArray) {
    /// <param name="songID" type="Integer" mayBeNull="false"></param>
    /// <returns>none</returns>
    if (artistIDArray[0] > 0) {
        MySpace.Web.Modules.MusicV2.Services.PopUpPlayer.GetMultipleArtistsUpdate(artistIDArray, MySpaceMusic.WebSvrManager.ArtistUpdateSuccess, MySpaceMusic.WebSvrManager.OnFailure);
    } else {
	     _proxy_jslib_assign('',  _proxy_jslib_handle(document, 'getElementById', '', 1, 0)('feedResult'), 'innerHTML', '=', ( '<br/><div class="activityFeedNoUpdate">' + MySpaceRes.PopUpPlayer.NoUpdatesForThisArtist + '</div>'));
	}
}

MySpaceMusic.PlaySongInPOMP = function (songID, artistID, albumID, songName) {
    try{    
         _proxy_jslib_handle(document, 'getElementById', '', 1, 0)('shell').playSong(songID, artistID, albumID, songName);
    }
    catch (e){
    }
}

var ajaxActionHandler= '/Modules/MusicV2/Services/MusicUtil.ashx?action=EnforceLogin';
var req = null;
MySpaceMusic.EnforceLogin= function() {   
    try{
		if (window.XMLHttpRequest) {
			req = new (XMLHttpRequest)();
			req.onreadystatechange = LoginRedirect;
			 _proxy_jslib_handle(req, 'open', '', 1, 0)("GET", ajaxActionHandler, true);
			req.send(null);
		// IE/Windows ActiveX version
		} else if (window.ActiveXObject) {
			req = new (ActiveXObject)("Microsoft.XMLHTTP");
			if (req) {
				req.onreadystatechange = LoginRedirect;
				 _proxy_jslib_handle(req, 'open', '', 1, 0)("GET", ajaxActionHandler, true);
				req.send();
			}
		}
	}
	catch(ex) {}
}		

LoginRedirect = function() {
   if (req.readyState == 4) {
        //alert(req.readyState + "     " + req.responseText);
        var json = eval(_proxy_jslib_proxify_js(('(' + req.responseText + ')'), 0, 0) );        
		if (json.ServerResponse.IsRequestSuccessful) {
			 _proxy_jslib_assign('',  _proxy_jslib_handle(window, 'location', '', 0, 0), 'href', '=', ( json.ServerResponse.DisplayText));
        } 
   }	                                 
}

var loginWin = null;
MySpaceMusic.EnforceLoginPOMP = function(url) {
    loginWin =  _proxy_jslib_handle(window, 'open', '', 1, 0)(decodeURI(url), "newWin", "", "");
    
    Sleep(1000);
}

EnforceLoginOpenComplete = function() {

   if (loginWin == null) {
       Sleep(1000);
   }   
   else {
       if (loginWin.document == null) {
           Sleep(1000);
       }
       else {
           var swfDiv =  _proxy_jslib_handle(loginWin.document, 'getElementById', '', 1, 0)(MusicPlayerControl.SwfObjectDiv);
           if (swfDiv == null) {
               Sleep(1000);
           }
           else {
               loginWin.MySpaceMusic.EnforceLogin();
           }
       }
   }
}

Sleep = function(mSec) {
     _proxy_jslib_handle(null, 'setTimeout', setTimeout, 1, 0)("EnforceLoginOpenComplete()", mSec);
}
        
 ;
_proxy_jslib_flush_write_buffers() ;