if(!album){
var album = {
    items:[
               {
                 "title"       : escape("商品1"),
                 "catchcopy"   : escape("商品1　キャッチコピー"),
                 "image"       : "http://www.infotop.jp/img/banner1_32335.gif",
                 "description" : escape("商品1　説明文</br>商品1　説明文2行目"),
                 "link"        : "http://karen100.biz/review/material/1297.html"
               },
               {
                 "title"       : escape("商品2"),
                 "catchcopy"   : escape("shohin2 01234567890123456789"),
                 "image"       : "http://karen100.biz/wordpress/wp-content/uploads/2009/04/ppcm_bn.jpg",
                 "description" : escape("商品2　説明文</br>商品1　説明文2行目"),
                 "link"        : "http://karen100.biz/review/132.html"
               },
               {
                 "title"       : "shohin3 title",
                 "catchcopy"   : "shohin3 catch",
                 "image"       : "http://care.cure.to/blog/tabelog/photos/100x100_1046928.jpg",
                 "description" : "shohin3 description",
                 "link"        : "http://care.cure.to/blog/tabelog/photos/100x100_1046928.jpg"
               }
            ] }
}
var karenworks_tplt  = "";
karenworks_tplt  = karenworks_tplt  + "<ul id='imageContainer'>\r\n";
karenworks_tplt  = karenworks_tplt  + "<% for ( postIndex in context.items ) { %>\r\n";
karenworks_tplt  = karenworks_tplt  + "  <% var post = context.items[postIndex]; %>\r\n";
karenworks_tplt  = karenworks_tplt  + "  <li id='karenalbum<%=postIndex%>'>\r\n";
karenworks_tplt  = karenworks_tplt  + "    <div class='kw_title'><a href='<%=post.link%>'><%=unescape(post.title)%></a></div>\r\n";
karenworks_tplt  = karenworks_tplt  + "    <div class='kw_catchcopy'><%=unescape(post.catchcopy)%></div>\r\n";
karenworks_tplt  = karenworks_tplt  + "    <div class='kw_image'><a href='<%=post.link%>'><img src='<%=post.image%>' alt='<%=unescape(post.title)%>'></a></div>\r\n";
karenworks_tplt  = karenworks_tplt  + "    <div class='kw_desc'><%=unescape(post.description)%></div>\r\n";
karenworks_tplt  = karenworks_tplt  + "  </li>\r\n";
karenworks_tplt  = karenworks_tplt  + "<% } %>\r\n";
karenworks_tplt  = karenworks_tplt  + "</ul>\r\n";
karenworks_tplt  = karenworks_tplt  + "<div id='karenworks_copy'><a href='#' target='_blank'>What's this?</a></div>\r\n";

//表示領域
document.write("<div id='karenworks_output'></div>");

//表示領域取得
var outputArea = document.getElementById("karenworks_output");

/* フェードイン・アウト処理 */
var imgs   = new Array();
var opa    = 0;               //透明度 0は透明
var opacnt = 5;               //透明度の増減の間隔
var timer  = 100;
var gazouId = "";
var fadetime = 5000;
var current  = 0;
var bIndex = 0;
// フェードイン
function so_init() {
  if(!document.getElementById || !document.createElement)return;

  css = document.createElement("link");
  css.setAttribute("href","http://teardorpshope.web.fc2.com/album.css");
  css.setAttribute("rel","stylesheet");
  css.setAttribute("type","text/css");
  document.getElementsByTagName("head")[0].appendChild(css);

  imgs = document.getElementById("imageContainer").getElementsByTagName("li");
  bIndex = imgs.length - 1;

  FadeInStart();

}
function FadeInStart() {
  imgs = document.getElementById("imageContainer").getElementsByTagName("li");
  if(imgs.length <= 0){
    setTimeout("FadeInStart()", 100); //imgsロード待ち
    return;
  }
  bIndex = imgs.length - 1;
  FadeIn();
}

function FadeIn() {
  nIndex = imgs[current+1]?current+1:0;
  if (opa <= 100) {
    if(imgs[bIndex] && imgs[current]){
      imgs[bIndex].style.display = "none";
      imgs[current].style.display = "block";
      imgs[current].style.width = "100%";
      imgs[current].style.filter = "alpha(opacity="+opa+")";  // IE
      imgs[current].style.opacity = opa/100;                  // Mozilla
    }else{
      setTimeout("so_init()", 100); //imgsロード待ち
      return;
    }
    opa += opacnt;
    setTimeout("FadeIn()", 50);
  }else{
    bIndex = current;
    current = nIndex;
    opa = 0;
    setTimeout("FadeIn()", fadetime);
  }
}

/* HTML表示処理 */
var ajp = new AjaxPages();
ajp.addPage("http://teardorpshope.web.fc2.com/album.ajp");
var tmphtml = ajp.process("http://teardorpshope.web.fc2.com/album.ajp", album, karenworks_tplt);
//var tmphtml = ajp.process("http://teardorpshope.web.fc2.com/album.ajp", album);
outputArea.innerHTML = tmphtml;
so_init();
