////////////////////////////////////////////////////////////////////////////
// 2008.1.24.
////////////////////////////////////////////////////////////////////////////
function printPhotoBanner(tab, home) {

var strSelected = ' class="selected"';
tab0selected = tab1selected = tab2selected = tab3selected = tab4selected = tab5selected = tab6selected = "";

if(tab == 0) tab0selected = strSelected;
if(tab == 1) tab1selected = strSelected;
if(tab == 2) tab2selected = strSelected;
if(tab == 3) tab3selected = strSelected;
if(tab == 4) tab4selected = strSelected;
if(tab == 5) tab5selected = strSelected;
if(tab == 6) tab6selected = strSelected;

document.write('<div id="phototab" class="yui-navset">');
document.write('    <ul class="yui-nav">');
document.write('        <li'+ tab6selected +'><a href="phototop.html" alt="写真集トップ"><em>写真集トップ<br />　</em></a></li>');
document.write('        <li'+ tab0selected +'><a href="photo.html" alt="くらりっぱ個展情報"><em>くらりっぱの<br />個展情報<font color="red">[NEW!]</font></em></a></li>');
document.write('        <li'+ tab1selected +'><a href="photom.html" alt="御蔵島旅行日記"><em>御蔵島旅行日記<br />2010年〜1999年<font color="red">[NEW!]</font></em></a></li>');
document.write('        <li'+ tab2selected +'><a href="slideshow.html" alt="スライドショー"><em>スライドショー<br />（期間限定！）</em></a></li>');
document.write('        <li'+ tab3selected +'><a href="photocon.html" alt="入選作品集"><em>くらりっぱの<br />入選作品集</em></a></li>');
document.write('        <li'+ tab4selected +'><a href="/cgi-bin/rankPhoto.cgi" alt="ランキング"><em>ランキング</em></a></li>');
document.write('        <li'+ tab5selected +'><a href="whatsnew_photo.html" alt="更新履歴"><em>更新履歴</em></a></li>');
document.write('    </ul>');
document.write('    <div class="yui-content">');
document.write('        <div id="tab6" style="height:1000px"></div>');
document.write('        <div id="tab0" style="height:1000px"></div>');
document.write('        <div id="tab1" style="height:1000px"></div>');
document.write('        <div id="tab2" style="height:1000px"></div>');
document.write('        <div id="tab3" style="height:1000px"></div>');
document.write('        <div id="tab4" style="height:1000px"></div>');
document.write('        <div id="tab5" style="height:1000px"></div>');
document.write('    </div>');
document.write('</div>');

(function() {
    var tabView = new YAHOO.widget.TabView('phototab');
    function handleClickTab0(e) {
        location.href=home+'phototop.html';
    }
    function handleClickTab1(e) {
        location.href=home+'photo.html';
    }
    function handleClickTab2(e) {
        location.href=home+'photom.html';
    }
    function handleClickTab3(e) {  
        location.href=home+'slideshow.html';
    }
    function handleClickTab4(e) {
        location.href=home+'photocon.html';
    }
    function handleClickTab5(e) {  
        location.href=home+'cgi-bin/rankPhoto.cgi';
    }
    function handleClickTab6(e) {  
        location.href=home+'whatsnew_photo.html';
    }
    if(tab != 0) {
       var tab0 = tabView.getTab(6);
       tab0.addListener('click', handleClickTab6);
    }
    if(tab != 1) {
       var tab1 = tabView.getTab(0);
       tab1.addListener('click', handleClickTab0);
    }
    if(tab != 2) {
       var tab2 = tabView.getTab(1);
       tab2.addListener('click', handleClickTab1);
    }
    if(tab != 3) {
       var tab3 = tabView.getTab(2);
       tab3.addListener('click', handleClickTab2);
    }
    if(tab != 4) {
       var tab4 = tabView.getTab(3);
       tab4.addListener('click', handleClickTab3);
    }
    if(tab != 5) {
       var tab5 = tabView.getTab(4);
       tab5.addListener('click', handleClickTab4);
    }
   if(tab != 6) {
       var tab0 = tabView.getTab(5);
       tab0.addListener('click', handleClickTab5);
    }
})();

}

function printPhotoContent(tabid, title) {
   var menuString = getPhotoMenu(tabid, title);
   var content = '<img src="http://mikura.info/lime/lime.cgi?PHOTO" width=1 height=1>';
   if(document.all) {
      content += document.all('content0').innerHTML;
      if(content == "") content = document.all('insert_'+tabid).innerHTML;
      document.all(tabid).innerHTML = '<table border="0"><tr><td valign="top">'+menuString+'</td><td valign="top">' + '<div id="content">'+content+'</div>' + '</td></tr></table>';
//    document.all(tabid).innerHTML = document.all('insert_'+tabid).innerHTML;
      document.all(tabid).style.height = "auto";
   } else {
      content += document.getElementById('content0').innerHTML;
      if(content == "") content = document.getElementById('insert_'+tabid).innerHTML;
      document.getElementById(tabid).innerHTML = '<table border="0"><tr><td valign="top">'+menuString+'</td><td valign="top">' + '<div id="content">'+content+'</div>' + '</td></tr></table>';
      document.getElementById(tabid).style.height = "auto";
   }
}

function getPhotoMenu(tabid, title) {
   var i = 0;
   var numofMenu = "";
   if(document.all) { numofMenu = document.all('numofMenu').innerHTML; }
   else { numofMenu = document.getElementById('numofMenu').innerHTML; }
   var str = "";
   var selection = "";
   var menuid;
   if(numofMenu == 0) return str;
   str = '<div id="photomenu" class="yuimenu">';
   str += '    <div class="bd">';
   str += '<h6>'+title+'</h6>';
   str += '        <ul class="first-of-type">';
   for(i=0; i<numofMenu; i++) {
      if(i==0) selection = "menuselected";
      else selection = "menunotselected";
      menuid = 'photomenu'+i;
      if(document.all) {
         str += '            <li class="yuimenuitem"><a class="yuimenuitemlabel" href="javascript:goMenu('+i+');"><div id="'+menuid+'" class="'+selection+'">'+document.all("menuName"+i).innerHTML+'</div></a></li>';
      } else {
         str += '            <li class="yuimenuitem"><a class="yuimenuitemlabel" href="javascript:goMenu('+i+');"><div id="'+menuid+'" class="'+selection+'">'+document.getElementById("menuName"+i).innerHTML+'</div></a></li>';
      }
   }
   str += '        </ul>';
   str += '    </div>';
   str += '</div>';

   str += '<hr />';
   if(document.all) {
      if(document.all('history')) { str += '<br />' + document.all('history').innerHTML; }
   }
   else {
      if(document.getElementById('history')) { str += '<br />' + document.getElementById('history').innerHTML; }
   }

   YAHOO.util.Event.onContentReady("photomenu", function () {
        var oMenu = new YAHOO.widget.Menu("photomenu", { 
                                                        position: "static",
                                                        hidedelay:  750,
                                                        lazyload: true });
        oMenu.render();
    });

   return str;
}

function goMenu(index) {
//alert(document.all('content'+index).innerHTML);
   if(document.all) {
      document.all('content').innerHTML = document.all('content'+index).innerHTML;
      var numofMenu =  document.all('numofMenu').innerHTML;
      for(i=0; i<numofMenu; i++) {
         document.all('photomenu'+i).className="menunotselected";
      }
      document.all('photomenu'+index).className="menuselected";
   } else {
      document.getElementById('content').innerHTML = document.getElementById('content'+index).innerHTML;
      var numofMenu =  document.getElementById('numofMenu').innerHTML;
      for(i=0; i<numofMenu; i++) {
         document.getElementById('photomenu'+i).className="menunotselected";
      }
      document.getElementById('photomenu'+index).className="menuselected";
   }
}

