﻿

 var layerTop=15;       //菜单顶边距
 var layerLeft=20;      //菜单左边距
 var layerWidth=170;    //菜单总宽
 var titleHeight=25;    //标题栏高度
 var contentHeight=90; //内容区高度
 var stepNo=15;         //移动步数，数值越大移动越慢


 var itemNo=0;runtimes=0;
 function addItem(itemTitle,itemContent){
   itemHTML='<div id=item'+itemNo+' itemIndex='+itemNo+' style="position:relative;left:0;top:'+(-contentHeight*itemNo)+'px;width:'+layerWidth+'px;">'+
   '<table width=100% cellspacing="0" cellpadding="0"><tr><td height="'+titleHeight+'px" onclick=changeItem('+itemNo+') class="titlestyle">'+itemTitle+'</td></tr>'+
       '<tr><td height="'+contentHeight+'px" class="contentstyle" valign="top">'+itemContent+'</td></tr></table></div>';
   document.getElementById("ssssasa").innerHTML += itemHTML;
   itemNo++;
 }
 
 //添加菜单标题和内容，可任意多项，注意格式：
 addItem('<li>雄鹰会</li>','<table border="0" cellpadding="0" cellspacing="0" style="width: 100%">'+
 '<tr><td class="rightTopchilden"><p class="a_l_indent_s"><img src="/images/arrowhead.gif">&nbsp;<a href="/group/groupinfo1016_1000.shtml"  >雄鹰会简介</a></p></td></tr>'+
 '<tr><td class="rightTopchilden"><p class="a_l_indent_s"><img src="/images/arrowhead.gif">&nbsp;<a href="/group/ActiveInfo1016_1037.shtml"  >活动剪影</a></p></td></tr>'+
 '<tr><td class="rightTopchilden"><p class="a_l_indent_s"><img src="/images/arrowhead.gif">&nbsp;<a href="/group/ActivePics1016_1046.shtml"  >社团风采</a></p></td></tr></table>');
 
 addItem('<li>精英会</li>','<table border="0" cellpadding="0" cellspacing="0" style="width: 100%">'+
 '<tr><td class="rightTopchilden"><p class="a_l_indent_s"><img src="/images/arrowhead.gif">&nbsp;<a href="/group/groupinfo1017_1000.shtml"  >精英会简介</a></p></td></tr>'+
 '<tr><td class="rightTopchilden"><p class="a_l_indent_s"><img src="/images/arrowhead.gif">&nbsp;<a href="/group/ActiveInfo1017_1038.shtml"  >活动剪影</a></p></td></tr>'+
 '<tr><td class="rightTopchilden"><p class="a_l_indent_s"><img src="/images/arrowhead.gif">&nbsp;<a href="/group/ActivePics1017_1047.shtml"  >社团风采</a></p></td></tr></table>');
 
 addItem('<li>中坚会</li>','<table border="0" cellpadding="0" cellspacing="0" style="width: 100%">'+
 '<tr><td class="rightTopchilden"><p class="a_l_indent_s"><img src="/images/arrowhead.gif">&nbsp;<a href="/group/groupinfo1018_1000.shtml"  >中坚会简介</a></p></td></tr>'+
 '<tr><td class="rightTopchilden"><p class="a_l_indent_s"><img src="/images/arrowhead.gif">&nbsp;<a href="/group/ActiveInfo1018_1039.shtml"  >活动剪影</a></p></td></tr>'+
 '<tr><td class="rightTopchilden"><p class="a_l_indent_s"><img src="/images/arrowhead.gif">&nbsp;<a href="/group/ActivePics1018_1048.shtml"  >社团风采</a></p></td></tr></table>');
 
 addItem('<li>团委</li>','<table border="0" cellpadding="0" cellspacing="0" style="width: 100%">'+
 '<tr><td class="rightTopchilden"><p class="a_l_indent_s"><img src="/images/arrowhead.gif">&nbsp;<a href="/group/groupinfo1019_1000.shtml"  >团委简介</a></p></td></tr>'+
 '<tr><td class="rightTopchilden"><p class="a_l_indent_s"><img src="/images/arrowhead.gif">&nbsp;<a href="/group/ActiveInfo1019_1040.shtml"  >活动剪影</a></p></td></tr>'+
 '<tr><td class="rightTopchilden"><p class="a_l_indent_s"><img src="/images/arrowhead.gif">&nbsp;<a href="/group/ActivePics1019_1049.shtml"  >社团风采</a></p></td></tr></table>');
 
 addItem('<li>记者协会</li>','<table border="0" cellpadding="0" cellspacing="0" style="width: 100%">'+
 '<tr><td class="rightTopchilden"><p class="a_l_indent_s"><img src="/images/arrowhead.gif">&nbsp;<a href="/group/groupinfo1020_1000.shtml"  >记者协会简介</a></p></td></tr>'+
 '<tr><td class="rightTopchilden"><p class="a_l_indent_s"><img src="/images/arrowhead.gif">&nbsp;<a href="/group/ActiveInfo1020_1041.shtml"  >活动剪影</a></p></td></tr><tr><td class="rightTopchilden"><p class="a_l_indent_s"><img src="/images/arrowhead.gif">&nbsp;<a href="/group/ActivePics1020_1053.shtml"  >社团风采</a></p></td></tr></table>');
 
 addItem('<li>艺术团</li>','<table border="0" cellpadding="0" cellspacing="0" style="width: 100%">'+
 '<tr><td class="rightTopchilden"><p class="a_l_indent_s"><img src="/images/arrowhead.gif">&nbsp;<a href="/group/groupinfo1021_1000.shtml"  >艺术团简介</a></p></td></tr>'+
 '<tr><td class="rightTopchilden"><p class="a_l_indent_s"><img src="/images/arrowhead.gif">&nbsp;<a href="/group/ActiveInfo1021_1042.shtml"  >活动剪影</a></p></td></tr><tr><td class="rightTopchilden"><p class="a_l_indent_s"><img src="/images/arrowhead.gif">&nbsp;<a href="/group/ActivePics1021_1054.shtml"  >社团风采</a></p></td></tr></table>');
 
 addItem('<li>中联慈善联合会</li>','<table border="0" cellpadding="0" cellspacing="0" style="width: 100%">'+
 '<tr><td class="rightTopchilden"><p class="a_l_indent_s"><img src="/images/arrowhead.gif">&nbsp;<a href="/group/groupinfo1022_1000.shtml"  >中联慈善联合会简介</a></p></td></tr>'+
 '<tr><td class="rightTopchilden"><p class="a_l_indent_s"><img src="/images/arrowhead.gif">&nbsp;<a href="/group/ActiveInfo1022_1043.shtml"  >活动剪影</a></p></td></tr><tr><td class="rightTopchilden"><p class="a_l_indent_s"><img src="/images/arrowhead.gif">&nbsp;<a href="/group/ActivePics1022_1055.shtml"  >社团风采</a></p></td></tr></table>');
 
 addItem('<li>中联之家俱乐部</li>','<table border="0" cellpadding="0" cellspacing="0" style="width: 100%">'+
 '<tr><td class="rightTopchilden"><p class="a_l_indent_s"><img src="/images/arrowhead.gif">&nbsp;<a href="/group/groupinfo1023_1000.shtml"  >中联之家俱乐部简介</a></p></td></tr>'+
 '<tr><td class="rightTopchilden"><p class="a_l_indent_s"><img src="/images/arrowhead.gif">&nbsp;<a href="/group/ActiveInfo1023_1044.shtml"  >活动剪影</a></p></td></tr><tr><td class="rightTopchilden"><p class="a_l_indent_s"><img src="/images/arrowhead.gif">&nbsp;<a href="/group/ActivePics1023_1056.shtml"  >社团风采</a></p></td></tr></table>');

 document.getElementById("itemsLayer").style.height=itemNo*titleHeight+contentHeight+'px';
 var toItemIndex=itemNo-1; var onItemIndex=itemNo-1;

 function changeItem(clickItemIndex){
   toItemIndex=clickItemIndex;
   if(toItemIndex-onItemIndex>0) moveUp(); else moveDown();
   runtimes++;
   if(runtimes>=stepNo){
   onItemIndex=toItemIndex;
   runtimes=0;}
   else
     setTimeout("changeItem(toItemIndex)",10);
 }

 function moveUp(){
   for(i=onItemIndex+1;i<=toItemIndex;i++)
     //eval('document.all.item'+i+'.style.top=parseInt(document.all.item'+i+'.style.top)-contentHeight/stepNo;');
      document.getElementById("item"+i).style.top=parseInt(document.getElementById("item"+i).style.top)-contentHeight/stepNo+'px';
 }

 function moveDown(){
   for(i=onItemIndex;i>toItemIndex;i--)
     //eval('document.all.item'+i+'.style.top=parseInt(document.all.item'+i+'.style.top)+contentHeight/stepNo;');
     document.getElementById("item"+i).style.top=parseInt(document.getElementById("item"+i).style.top)+contentHeight/stepNo+'px';
 }
