var Streema = Streema || {};
Streema.Widgets = Streema.Widgets || {};

(function() {
    Streema.Widgets.widgetType = 'list';
    Streema.Widgets.listPopupPlayer = function(radioId) {
	    var win = null;
        var left = (screen.width/2)-(740/2);
 	    var top = (screen.height/2)-(240/2);
	    var domain = 'streema.com';
		var url = 'http://'+domain+'/widgets/play/' + radioId;
		url += '?ref=' + document.location.href;
        url += '&type='+Streema.Widgets.widgetType;

		win = window.open(url, 'popwinname', 'width=740,height=270,statusbar=no,menubar=0,resizable=no,scrollbars=no,top=' + top + ',left=' + left);
        win.focus();
    };
    Streema.Widgets.popupPlayer = function() {
        var anchorEl = document.getElementById('streema-widget-listen-anchor');
        radioId = anchorEl.name;
        Streema.Widgets.widgetType = 'radio';
        Streema.Widgets.listPopupPlayer(radioId);
    };
})();

