
function GenerateWidget(Config)
 { 
    var DomainName = 'serverroom.us';

    var iframe = document.createElement('iframe');
    var minwidth = 250;
    var minheight = 130;
    
    if (Config['width']<minwidth) Config['width']=minwidth;
    var bgcolor = "#CCC";
    var copyright = 1;
    
	  var nowplayingcolor = "#FF0000";
	  var songslist = "0";
	  var ap64 = '';
    var timezone = '+0';
    var nowplaying = '1';
    try { bgcolor = Config['bgcolor']; } catch(e) {}
    try { copyright = Config['copyright'];  } catch (e) {}
    try { nowplayingcolor = Config['nowplayingcolor'];  } catch (e) {}
    try { songslist = Config['songslist'];  } catch (e) {}
    try { timezone = Config['timezone'];  } catch (e) {}
    if (Config['nowplaying']) nowplaying = Config['nowplaying'];  
    if (Config['StationTitle']=="") { minheight-=20; }
    if (Config['ShowListeners']==0) { minheight-=20; }
    if (Config['copyright']==0) { minheight-=20; }
    
    if (Config['ap64']) { ap64 = Config['ap64']; }
    if (Config['DomainName']) { DomainName = Config['DomainName']; }
    
    if (songslist==1) 
     { var playlistheight = 150;
       if (Config['playlistheight']) {playlistheight = Config['playlistheight']; }
       minheight+=parseInt(playlistheight)+70; 
     }

    if (Config['height']<minheight) Config['height']=minheight;
    
    var isOpera, isIE = false;
    if(typeof(window.opera) != 'undefined'){isOpera = true;}
    if(isOpera == false && navigator.userAgent.indexOf('Internet Explorer')){isIE = true};
    
    var WidgetPath = 'http://widgets.'+DomainName+'/SHOUTinfo/';
    
    var CSSstyle = 'background:#CCC; border:none; width:'+Config['width']+'px; height:'+Config['height']+'px;';       
    iframe.setAttribute('scrolling','no');
    iframe.setAttribute('frameborder','0');
    iframe.style.cssText += CSSstyle;
    //if (isIE == false) { iframe.setAttribute('style',CSSstyle); }
    //else { iframe.style.setAttribute('cssText',CSSstyle); }
    
    var Source = WidgetPath+'main.htm?'+'st='+Config['StationTitle']+'&s='+Config['Station']+'&tpl='+Config['BoxStyle']+'&lst='+Config['ShowListeners']+'&timezone='+timezone+'&nowplaying='+nowplaying;
    Source += '&width='+Config['width']+'&height='+Config['height'] + '&copyright='+copyright+'&bgcolor='+bgcolor+'&nowplayingcolor='+nowplayingcolor+"&songslist="+songslist+"&playlistheight="+playlistheight+"&ap="+ap64;
    iframe.setAttribute('src',Source);
 
    document.getElementById('SRwidget').appendChild(iframe);
 }