<?xml version="1.0" encoding="UTF-8" ?> 
<Module>
 <ModulePrefs title="India Election - 2009" title_url="http://www.leepool.com/" description="Read all about Indian Assembly Election 2009 events, news, views and forecast" author="Widget Geek" author_email="widget.geek@gmail.com" screenshot="http://hosting.gmodules.com/ig/gadgets/file/104342096967082496017/election-ss.gif" thumbnail="http://hosting.gmodules.com/ig/gadgets/file/104342096967082496017/india-election.gif" height="350" width="335" scrolling="false" singleton="true" category="news">
  <Require feature="dynamic-height" /> 
  <Require feature="setprefs" /> 
  <Require feature="tabs" /> 
  <Require feature="flash"/>
<Require feature="analytics" /> 
  </ModulePrefs>
  <UserPref name="feed1" display_name="Feed 1" datatype="string" default_value="http://news.in.msn.com/rss/elections2009.aspx" /> 
  <UserPref name="selectedTab" datatype="hidden" /> 
  <Content type="html">
  <![CDATA[ 
  <style type="text/css">
  /* Import tabs library style sheet */
  @import url(http://www.google.com/ig/tablib.css);
:link{color:#0000c8;}:visited{color:#c800c8;}a:active{color:#f06;}a:hover{color:#0000c8;text-decoration:underline;}A {text-decoration:none;}ul{list-style-type:disc;}li{margin-left:15px;}
  .statusLabel {
    font-size:12px;
    font-style:italic;
    padding-top:10px;
    text-align:center;
  }
  .feedHeader {
    padding-top:5px;
    font-size:12px;
  }
  .feedList {
    font-size:12px;
    margin:5px 0px 0px 0px;
    padding:0px 3px 5px 3px;
    border-top: 1px solid #aaaaaa;
    border-bottom: 1px solid #aaaaaa;
    list-style-type:disc;
  }
  .feedList li {
    margin-top:5px;
    padding:0px;
  }
  .feedList div.entrySummary {
    font-size:11px;
  }
  .feedlist div.entryTimestamp {
    font-size:10px;
    font-style:italic;
    color:#676767;
  }
  </style>

  <script>
  // Global variables
  var prefs = new _IG_Prefs(__MODULE_ID__);
  var tabs = new _IG_Tabs(__MODULE_ID__);

  /**
   * Initialize tabs when page loads.
   * Create tab for each userpref only if userpref is not empty.
   */
  function init() {
    var f1 = _trim(prefs.getString("feed1"));
    if (f1 != "") {
      tabs.addDynamicTab("News", callbackGenerator(f1));
    }
    var f2 = "http://in.elections.yahoo.com/elections_v3.swf";
    if (f2 != "") {
      tabs.addDynamicTab("Dashboard", dashboardGenerator(f2));
    }
      };

  /**
   * Creates a function that calls the tab's callback function
   * and passes along an additional variable from the calling environment.
   */
  function callbackGenerator(feedUrl) {
    return function(tabId) {
      callbackTab(tabId, feedUrl);
    }
  }

  function dashboardGenerator(url)
  {
    return function(tabId) {
      dashboard(tabId, url);
     }
  }
  function dashboard(tabId,url)
  {
        var container = _gel(tabId);
        container.innerHTML = "<iframe src='http://in.elections.yahoo.com/elections_v3.swf' width='100%' height=350></iframe>";
  _IG_AdjustIFrameHeight();
          }
  /**
   * Fetches an Atom or RSS feed and generates content inside the
   * selected tab's content container.  This function is called whenever
   * a tab is selected.
   */
  function callbackTab(tabId, feedUrl) {
    var summaries = prefs.getInt("summaries");
    var entries = prefs.getInt("entries");
    var container = _gel(tabId);

    // Display loading message before fetching feed.
    container.innerHTML = '<div class="statusLabel">Loading...</div>';

    // Fetch feed and return it as a JSON object.
    // Callback function is defined within local scope.
    _IG_FetchFeedAsJSON(
      feedUrl,
      function(feed) {
        if (typeof feed == "undefined" || typeof feed.Entry == "undefined") {
          container.innerHTML = '<div class="statusLabel">Invalid feed URL:<br>' + feedUrl + '</div>';
        } else {
          // Fetch feed successful.  Generate HTML content from returned JSON object.
          var html = new Array();
          // Iterate through each feed entry and generate list of content.
          html.push('<ul class="feedList">');
          for (var n = 0; n < feed.Entry.length; n++) {
            var entry = feed.Entry[n];
            html.push('<li>');
            html.push('<a target="_blank" href="' + entry.Link + '">' + _hesc(entry.Title) + '</a>');
            html.push('</li>');
          }
          html.push('</ul>');
          container.innerHTML = html.join("");
        }

        // Resize iframe height to fit content.
  _IG_AdjustIFrameHeight();

      },
      10,
      false
    );
  }

  // Set onload event handler to call init()
</script>
<script type="text/javascript">
google_ad_client = "pub-1600288466300286";
/* 234x60, created 4/4/09 */
google_ad_slot = "2730746259";
google_ad_width = 234;
google_ad_height = 60;
</script>
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
<script  type="text/javascript">
    _IG_RegisterOnloadHandler(init);
_IG_Analytics("UA-4517972-1", "/india-election-2009");

</script>
  ]]> 
    </Content>
  </Module>

