<?xml version="1.0" encoding="UTF-8" ?>
<Module>
<ModulePrefs 
  author="Dongjoon Hyun"
  author_email="dongjoon.hyun@gmail.com"
  author_location="Suwon, South Korea"
  author_link="http://dongjoonhyun.com"
  author_aboutme="Software Engineer"
  author_affiliation=""
  author_quote="I Like Google."
  description="__MSG_description__"
  title="__MSG_title__" 
  directory_title="Korean Boxoffice"
  title_url="http://movie.daum.net/ranking/boxoffice_ranking/rankingBoxoffice.do?country=KR" 
  height="150"
  width="240"
  scrolling="false" 
  thumbnail="http://www.kobis.or.kr/img/contents/main_logo.gif"
  screenshot="http://lh4.ggpht.com/_FSMmsNDDvV4/SRIxJpX_zGI/AAAAAAAAAKQ/CeqiWk9DWHY/KoreanBoxofficeScreenshot.PNG"
>
  <Locale lang="ko" country="KR" messages="http://hosting.gmodules.com/ig/gadgets/file/106896148690643376552/KoreanBoxoffice_ko_KR.xml"/> 
  <Locale lang="ja" country="JP" messages="http://hosting.gmodules.com/ig/gadgets/file/106896148690643376552/KoreanBoxoffice_ja_JP.xml"/>
  <Locale lang="*" country="*" messages="http://hosting.gmodules.com/ig/gadgets/file/106896148690643376552/KoreanBoxoffice_ALL_ALL.xml"/>
  <Locale lang="all" country="all" messages="http://hosting.gmodules.com/ig/gadgets/file/106896148690643376552/KoreanBoxoffice_ALL_ALL.xml"/>
  <Require feature="minimessage"/>
  <Require feature="setprefs" />
  <Require feature="dynamic-height" />
</ModulePrefs>
<UserPref name="number" display_name="Number of Movie (Max: 5)" default_value="3"/>
<UserPref name="poster_width" display_name="Width of Poster Image" default_value="70"/>
<UserPref name="poster_height" display_name="Height of Poster Image" default_value="101"/>
<Content type="html">
<![CDATA[
<style>
#time_div {
  text-align: right;
  font-weight:bold;
  font-size: 12px;
  font-family: Times New Roman;
  color: #000000;
}
#content_div {
  text-align: center;
  font-weight:bold;
  font-size: 16px;
  font-family: Arial, Helvetica, sans-serif;
  color: #000000;
}
#copyright_div {
  text-align: right;
  font-weight:bold;
  font-size: 12px;
  font-family: Arial, Helvetica, sans-serif;
  color: #000000;
}
</style>

<div id="content_div">ImageList</div>
<div id="time_div"></div>
<div id="copyright_div">
  from <strong>KOFIC</strong> 
  <a target=_new href="http://fusion.google.com/add?source=atgs&moduleurl=http%3A//hosting.gmodules.com/ig/gadgets/file/106896148690643376552/KoreanBoxoffice.xml"><img src="http://gmodules.com/ig/images/plus_google.gif" border="0" alt="Add to Google"></a> 
</div>

<script type="text/javascript">
var msg = new _IG_MiniMessage(__MODULE_ID__);
var prefs = new _IG_Prefs();

function getHtml() {  
  var params = {};
  var url = "http://movie.daum.net/ranking/boxoffice_ranking/rankingBoxoffice.do?country=KR";
  _IG_FetchContent(url, response, params);
};
  
function response(obj) {
  text = obj;
  var posterPrefix = '	<a href="http://movie.daum.net/moviedetail/moviedetailMain.do?movieId=';
  var posterPostfix = 'class="poster" />';
  var html = "";
  var start = 0;
  var poster_width = prefs.getInt("poster_width");
  var poster_height = prefs.getInt("poster_height");
  var prevPoster = "";
  for (var i = 0; i < prefs.getInt("number"); i++) {
    var posterBegin = text.indexOf(posterPrefix, start);
    var posterEnd = text.indexOf(posterPostfix, posterBegin);
    var poster = text.substr(posterBegin, (posterEnd + posterPostfix.length)-posterBegin) + '</a>';
    poster = poster.replace("38_55","198_288").replace('width="38" height="55"','width=' + poster_width + ' height=' + poster_height).replace("><img"," target=_new><img");
    start = posterEnd + 1;
    if (prevPoster == poster) {
      i--;
    }
    else {
      html += poster;
      prevPoster = poster;
    }
  }
  document.getElementById("content_div").innerHTML = html ;
  document.getElementById("time_div").innerHTML = new Date().toLocaleDateString();
  _IG_AdjustIFrameHeight();
  setTimeout('_IG_AdjustIFrameHeight();',500);
};
  
_IG_RegisterOnloadHandler(getHtml);
</script>
]]>
</Content>
</Module>
