<?xml version="1.0" encoding="UTF-8" ?>
<Module>
	<ModulePrefs 
							width="160" 
							height="200" 
	 						title="Micro TV" 
							title_url="http://www.30minutelunchbreak.com" 
							description="Watch online available TV channels. There are over 80 (english) channels to choose from; news channels, music channels, entertainment channels, sport channels and many more.... Note for Firefox users: look at 30minutelunchbreak.com/livetvff.html to get this gadget to work." 
							author="30minutelunchbreak.com" 
							author_email="info (at) 30minutelunchbreak.com" 
							thumbnail="http://www.cammap.net/tvlive/tvgadget_tn.jpg"
							screenshot="http://www.30minutelunchbreak.com/gadgets/microtv.jpg" 
							author_location="Amsterdam, Netherlands">
 <Require feature="analytics" />
 </ModulePrefs>
 <UserPref name="kanaal" display_name="Default channel(fill in exact name from the list box):" default_value="BBC World" datatype="string">
</UserPref>

 <Content type="html">
     <![CDATA[
 <script type="text/javascript" src="http://www.cammap.net/tvlive/tvstationsgb.js"></script>
 <STYLE type=text/css>
input {width: 8em;font-size: 9px}

a.rstyle { 
color:#ffcc66;
font-size: 9px;
font-family: verdana, sans-serif;
}
a.rstyle:link        {color: #ffcc66;font-size: 9px;}
a.rstyle:visited     {color: #ffcc66;font-size: 9px;}


a.tstyle { 
color:#89a4ff;
font-size: 9px;
font-family: arial;
text-decoration:none;
font-weight: bold;
}
a.tstyle:link        {color: #89a4ff;font-size: 9px;}
a.tstyle:visited     {color: #89a4ff;font-size: 9px;}

select { 
 background-color: #000000; 
 color: #89a4ff;
 font-size: 7pt;
 font-family: verdana, sans-serif;
}

#submitbutton1 { height: 17px;width: 15px }
#submitbutton2 { height: 20px;width: 21px }

</STYLE>

<script>
   // Track this gadget using Google Analytics.
   _IG_Analytics("UA-1098462-11", "/test_analyticslib");
</script>
<script language="javascript">
var chanch=0;
var iNews=0;
var ftxt = "";
var urls = "";
var prefs = new _IG_Prefs(__MODULE_ID__);
var kanPref = prefs.getString("kanaal");
var autoPref = prefs.getString("autoplay");
var currentInterval = "";


_IG_RegisterOnloadHandler(startTV);


function loadChan(channel) {
 document.getElementById('submitbutton2').style.visibility = 'hidden';
 document.getElementById('submitbutton1').style.visibility = 'visible';
 document.getElementById("TV2tje").innerHTML = "<OBJECT ID='MediaPlayer6' Name='MediaPlayer6' WIDTH=160 HEIGHT=120 CLASSID='CLSID:22D6f312-B0F6-11D0-94AB-0080C74C7E95' STANDBY='Loading Windows Media Player components...' TYPE='application/x-oleobject' CODEBASE='http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,7,1112' <PARAM name='AutoStart' value='True'> <PARAM name='FileName' value='" + channel +"'><PARAM NAME='ShowControls' VALUE='0'><PARAM NAME='ShowDisplay' VALUE='0'><PARAM NAME='ShowStatusBar' VALUE='0'><PARAM NAME='AutoSize' VALUE='1'><Embed type='application/x-mplayer2' pluginspage='http://www.microsoft.com/windows/windowsmedia/download/AllDownloads.aspx/' filename='" + channel +"' src='" + channel +"' Name='MediaPlayer6' ShowControls=0 ShowDisplay=0 ShowStatusBar=0 width=160 height=120></embed>";
 }

function fillCategory(){ 
     // this function is used to fill the category list on load
		for(j=0;j<cat.length;j++){ 
    addOption(document.drop_list.Category, cat[j], cat[j], "");
    }

}

function SelectSubCat(){
    // ON selection of category this function will work
    var tstr="";
		
    removeAllOptions(document.drop_list.SubCat);
		addOption(document.drop_list.SubCat, "#", "Station:");
		
		for(j=0;j<cat.length;j++){
    	  if(document.drop_list.Category.value == cat[j]){ 
    		 for (var i=0; i<tcat[j].length;i++){
           if (tcat[j].charAt(i) != ",")
           		 tstr = tstr + tcat[j].charAt(i);
           else{
    			     var nr = parseInt(tstr);
    					 tstr="";
    					 var str="javascript:switchChannel(" + nr + ")";
       				  addOption(document.drop_list.SubCat,str,chn[nr]);		
      			}
          }
    		 }
		}
}

function removeAllOptions(selectbox)
{
	var i;
	for(i=selectbox.options.length-1;i>=0;i--)
	{
		//selectbox.options.remove(i);
		selectbox.remove(i);
	}
}

function addOption(selectbox, value, text )
{
	var optn = document.createElement("OPTION");
	optn.text = text;
	optn.value = value;

	selectbox.options.add(optn);
}

function switchChannel(chnr)
{
    loadChan(chs[chnr]);
		chanch=chnr;
  	GetMessage();
}

function openWeb(chnr)
{
 		stopPlayer();					
    window.open(chw[chnr],'mywindow','toolbar=yes,location=yes,resizable=yes,status=yes,menubar=yes,scrollbars=yes,width=1024,height=768');
}


function startTV()
{
 _gel("submitbutton1").src = _IG_GetImageUrl("http://www.cammap.net/tvlive/stopwms.png");
 _gel("submitbutton2").src = _IG_GetImageUrl("http://www.cammap.net/tvlive/startwms.png");

  for (var i=0; i<89; i++)
  	{
   		if (kanPref == chn[i]){
   			 chanch = i;
				 if (i == 0)
				 		   	 chanch = 20;
  		}
  }
 fillCategory();
 GetMessage();
 if (autoPref=="Yes")
 		 loadChan(chs[chanch]);
 else
			stopPlayer();
				 
 }

function GetMessage()
{
 document.getElementById('myMsg').innerHTML = "<a class='rstyle' href='" + chw[chanch] + "' target='blank_'>"+ chn[chanch]+ "</a><br>  (double-click for full-screen)";
 }
 
function stopPlayer()
{
 document.getElementById('submitbutton2').style.visibility = 'visible';
 document.getElementById('submitbutton1').style.visibility = 'hidden';

 document.getElementById("TV2tje").innerHTML = '<A HREF="http://30minutelunchbreak.com"  target="_blank"><img src="http://www.xs4all.nl/~noraz/ltvbg.png" border=0 ></a>';

} 

 
function stopPlayerAd()
{
	 var str="";

 str+= "<div style=' width:160px; height:120px;overflow:hidden; '>";
 str+= "<table width='160px' border='0' cellpadding='0' cellspacing='0'>";
			      str+= "<tr><td valign='top' align='center'>";
	
						str+='<iframe frameborder="0" height="120" name="frame1" scrolling="no" src="http:\/\/www.30minutelunchbreak.com\/gadgets\/gad2mi.html" width="160"><\/iframe>';
	
	
						str+= "</td></tr>";
  str+= "</table>";
  str+= "</div>";
  _gel('TV2tje').innerHTML = str;		
}  
 
 
 
</script>

<table width="160" border="0" cellpadding="0" cellspacing="0" border="0" align="center">
<tr>
<td align="center">
<div id="myMsg"  style="width:160;background-color:#2b2b2b;color:#ffcc66;font-size: 9px;font-family: verdana, sans-serif;"></div>
<div id="TV2tje"></div>
</td>
</tr>
</table>
<div id="menu" style="height:40px;overflow:hidden">

<table width="160" border="0" cellpadding="2" cellspacing="0" align="center">
<tr>
<td  width="20" bgcolor=#212121 align="center" valign="top">
	  <input type="image" id="submitbutton2" onClick="loadChan(chs[chanch])" title="Start playing">
	  <input type="image" id="submitbutton1" onClick="stopPlayer()" title="Stop playing">
</td>

<td align="right" bgcolor=#212121>   
<FORM name="drop_list">
  <SELECT id="MainCat" NAME="Category" onChange="SelectSubCat()" size="1">
  <Option value="">Category:</option>
  </SELECT><br>
  <SELECT id="SubCat" NAME="Plaats" OnChange="location.href=this.options[this.selectedIndex].value" size="1">
  <Option value="">--</option>
  </SELECT>
</FORM></td>



</tr>
</table>
</div>
]]> </Content>
</Module>  