﻿<?xml version="1.0" encoding="UTF-8" ?> 
<Module>

  <ModulePrefs
  title="Star Trek: Alliance - News &amp; Pics" 
  title_url="http://gioco.net/startrek/alliance"
  directory_title="Star Trek: Alliance - daily news &amp; pics"
  description="Ogni giorno immagini, sfondi di fantascienza e notizie dal Gioco di Ruolo Star Trek: Alliance (GDR via email)"
  author="Lorenzo" author_email="alliance@ciaoweb.it"
  author_location="Roma, IT"
  author_affiliation="Alliance"
  screenshot="http://gioco.net/startrek/alliance/html/gadget/all-screenshot.png"
  thumbnail="http://gioco.net/startrek/alliance/html/gadget/all-thumbnail.png">
  <Require feature="dynamic-height"/>
  </ModulePrefs> 
  <UserPref name="num_entries" display_name="Numero di News:" default_value="3" datatype="enum">
	<EnumValue value='1' />
	<EnumValue value='2' />
	<EnumValue value='3' />
	<EnumValue value='4' />
	<EnumValue value='5' />
 </UserPref>
  <Content type="html">
  <![CDATA[ 
    <style type="text/css">
	#content_div { font-size: 75%;  margin: 2px; background-color: #ffffff;}
	#content_div tr { font-size: 75%; background-color: #ffffff;}
	#pic a { text-align:center; text-decoration:none; }
	.summary { display: none; } 
	.news { border: "none"; } 
	</style>
	
	<div id=dailypic_div></div>
		
	<script type="text/javascript">
		var gg;
		var today;
		var data = new Date();
		today = data.getDate() ;
		prev = today-1;
		if (prev == 0 ) { prev = 31 ; }
		
		html="";
		html += '<div id="pic" align="center">';
		html += "<a title='Prev' id=imgprev href=javascript:drawimg('" + prev + "');><b>&laquo;</b></a>";
		html += '<a id="img" href="http://gioco.net/startrek/alliance/html/gallery.htm" target="_blank" ><img id="img" src="http://gioco.net/startrek/alliance/html/gadget/Thumb_alliance-'+today+'.JPG" alt="Daily Alliance image" width="300" height="228" align="middle"/></a><font color=#ffffff><b>&raquo;</b></font></div>';		
		_gel('dailypic_div').innerHTML = html ;
		_IG_AdjustIFrameHeight();
	</script>
 
    
    <div id=content_div></div>	
		
    <script type="text/javascript">
	
	// Get userprefs
	 var prefs = new _IG_Prefs(__MODULE_ID__);
     var entries = prefs.getInt("num_entries");
	 var summary = true;
	 
	 var prev = -1;
   
	 function expand(element){ 
		if( _gel('ta'+element).style.display!='block'){
			_gel('ta'+element).style.display='block';			
			_gel('div'+element).style.border='thin solid';			
			_gel ('plus'+element).src='http://www.google.com/ig/images/zippy_minus_sm.gif';
			if (prev != -1 ) {
				_gel('ta'+prev).style.display='none';
				_gel('div'+prev).style.border='none';
				_gel('plus'+prev).src='http://www.google.com/ig/images/zippy_plus_sm.gif';
			}
			prev = element;
		}else{
			_gel('ta'+element).style.display='none';
			_gel('div'+element).style.border='none';
			_gel('plus'+element).src='http://www.google.com/ig/images/zippy_plus_sm.gif';
			prev = -1 ;
		}
		_IG_AdjustIFrameHeight();
	 }
	 
	 function drawimg(id) {
	 	var dd = new Date();
		tt = dd.getDate() ;
		
		prv = eval(id) - 1 ;
		nxt = eval(id) + 1 ;
		if (prv == 0 ) { prv = 31 ; }
		if (nxt == 32 ) { nxt = 1 ; }		
		
		html="";
		html += '<div id="pic" align="center">';
		html += "<a title='Prev' id=imgprev href=javascript:drawimg('" + prv + "');><b>&laquo; </b></a>";
		html += '<a id="img" href="http://gioco.net/startrek/alliance/html/gallery.htm" target="_blank" ><img id="img" src="http://gioco.net/startrek/alliance/html/gadget/Thumb_alliance-'+id+'.JPG" alt="Daily Alliance image" width="300" height="228" align="middle"/></a> ';
		
		if ( id != tt ) {
			html += "<a title='Next' id=imgnext href=javascript:drawimg('" + nxt + "');><b>&raquo;</b></a>";		
		} else {
			html += "<font color=#ffffff><b>&raquo;</b></font>";
		}
		html += "</div>";		
		
		_gel('dailypic_div').innerHTML = html ;
		_IG_AdjustIFrameHeight();
		
	 
	 }
	


     // Use the _IG_FetchFeedAsJSON() function to retrieve core feed data from
     // the specified URL. Then combine the data with HTML markup for display in
     // the gadget.
     _IG_FetchFeedAsJSON("http://gioco.net/startrek/alliance/html/gadget/rss.php",
              function(feed) { 
			  
              if (feed == null){ 
			  	_gel("content_div").innerHTML = "<i>Le informazioni non sono temporaneamente disponibili</i>";
			  	return;
			  }
     
         // Start building HTML string that will be displayed in gadget.
         var html = "";

         // Access the fields in the feed
         html += "<div><b>" + feed.Title + "</b></div>";
         html += "<div>" + feed.Description + "</div><br>";
		 
     
         // Access the data for a given entry
         if (feed.Entry) {
             for (var i = 0; i < feed.Entry.length; i++) {
				 html += "<div id='div" + i + "' class=news>";
				 
			 	 html += '<table border="0" cellspacing="0" cellpadding="3"><tr><td valign="top">' ;
				 html += "<a href=# onclick=expand('" + i + "'); > ";
				 html += "<img id='plus" + i + "' src='http://www.google.com/ig/images/zippy_plus_sm.gif' border=0></a>";
				 html += "<a href=" + feed.Entry[i].Link + ">" 				                
                 + "<a target=_blank href=" + feed.Entry[i].Link + ">" 
                 + feed.Entry[i].Title
                 + "</a></td></tr></table>";
		
				 html += '<table id="ta' + i + '" border="0" cellspacing="0" cellpadding="3" class="summary"><tr><td valign="top">' ;		 
				 html += "<tr><td valign='top'>";
				 html += "<i>" + feed.Entry[i].Summary + "</i></td></tr></table>";				
				 
				 html += "</div>"
             }			 
         }
		 
		 
     _gel("content_div").innerHTML = html;
	 // Tells gadget to resize itself
	 _IG_AdjustIFrameHeight();

     // The rest of the function parameters, which are optional: the number
     // of entries to return, and whether to return summaries.
     }, entries, summary);	 	 
 
  </script>
  
  
  ]]> 
  </Content>
</Module>