// Multi-Column List documentation: http://www.project2061.org/includes/CodeLibrary/MultiColumnList/multiColumnList.manual.htm

function mcl_bwcheck(){
this.ver=navigator.appVersion
this.agent=navigator.userAgent
this.dom=document.getElementById?1:0
this.opera5=this.agent.indexOf("Opera 5")>-1
this.safari=this.agent.indexOf("Safari")>-1
this.ie5=(this.ver.indexOf("MSIE 5")>-1&&this.dom&&!this.opera5)?1:0;
this.ie6=(this.ver.indexOf("MSIE 6")>-1&&this.dom&&!this.opera5)?1:0;
this.ie7=(this.ver.indexOf("MSIE 7")>-1&&this.dom&&!this.opera5)?1:0;
this.ie4=(document.all&&!this.dom&&!this.opera5)?1:0;
this.ie=this.ie4||this.ie5||this.ie6||this.ie7
this.mac=this.agent.indexOf("Mac")>-1
this.ns6=(this.dom&&parseInt(this.ver)>=5)?1:0;
this.ns4=(document.layers&&!this.dom)?1:0;
this.bw=(this.ie7||this.ie6||this.ie5||this.ie4||this.ns4||this.ns6||this.opera5)
return this;
}
function mcl_addEvent(obj,evType,fn,useCapture){
if(obj.addEventListener){
obj.addEventListener(evType,fn,useCapture);
return true;
}else if(obj.attachEvent){
var r=obj.attachEvent("on"+evType,fn);
return r;
}
}
function mcl_init(e){
var i,j,k
var araListNodes=new Array();
var objCollection=document.getElementsByTagName('ul');
for(i=0;i<objCollection.length;i++){
objCollection[i].className.search(/\bmultiColumnList\b/ig)!=-1?araListNodes.push(objCollection[i]):null;
}
objCollection=document.getElementsByTagName('ol');
for(i=0;i<objCollection.length;i++){
objCollection[i].className.search(/\bmultiColumnList\b/ig)!=-1?araListNodes.push(objCollection[i]):null;
}
objCollection=null;
for(i=0;i<araListNodes.length;i++){
if(araListNodes[i].className.indexOf(/\bmultiColumnList\b/ig)){
araListNodes[i].className+=(araListNodes[i].className.length>0?' ':'')+'mclList';
var intWidth=parseInt(araListNodes[i].offsetWidth);
var intHeight=0;
var intColumnHeight=0;
var objCollection=araListNodes[i].getElementsByTagName('li');
j=0;
while(j<objCollection.length){
objCollection[j].style.width=100/mcl_columnCount+'%';
intHeight+=parseInt(objCollection[j].offsetHeight);
j++;
}
var j=0;
while(intColumnHeight<(intHeight/mcl_columnCount)){
intColumnHeight+=parseInt(objCollection[j].offsetHeight);
objCollection[j].style.marginLeft='0px';
j++;
}
for(k=2;k<=mcl_columnCount;k++){
if(isNaN(parseInt(objCollection[j].style.marginTop))){
objCollection[j].style.marginTop=-1*(parseInt(objCollection[j].offsetTop)-parseInt(objCollection[0].offsetTop))+'px';
objCollection[j].mclColumnTop=true;
var intCurrentHeight=0;
while(intCurrentHeight<=(intColumnHeight)&&j<objCollection.length){
intCurrentHeight+=parseInt(objCollection[j].offsetHeight);
objCollection[j].style.marginLeft=((k-1)*(100/mcl_columnCount))+'%';
parseInt(objCollection[j].offsetLeft)==0?objCollection[j].style.marginLeft=((k-1)*(araListNodes[i].offsetWidth/mcl_columnCount))+'px':null;
(mcl_browser.ie6||mcl_browser.ie7)&&document.compatMode&&document.compatMode=="BackCompat"?objCollection[j].style.width=((1/(mcl_columnCount+1-k))*100)+'%':null;
j++;
}
j-=1;
}
}
objCollection[j].style.height=(parseInt(objCollection[j].offsetHeight)+intColumnHeight-intCurrentHeight)+'px';
}
araListNodes[i].mclHeight=parseInt(araListNodes[i].offsetHeight);
araMCLLists.push(araListNodes[i]);
}
setTimeout('mcl_correct()',100);
}
function mcl_correct(intColumnHeight){
var i,j,k
var intColumnHeight=0;
var intCurrentHeight=0;
for(i=0;i<araMCLLists.length;i++){
if(araMCLLists[i].mclHeight!=parseInt(araMCLLists[i].offsetHeight)){
objListNodes=araMCLLists[i].getElementsByTagName('li');
for(j=0;j<objListNodes.length;j++){
if(objListNodes[j].mclColumnTop==true){
objListNodes[j].style.marginTop='0px';
objListNodes[j].style.marginTop=-1*(parseInt(objListNodes[j].offsetTop)-parseInt(objListNodes[0].offsetTop))+'px';
intColumnHeight<intCurrentHeight?intColumnHeight=intCurrentHeight:null;
intCurrentHeight=0;
}
intCurrentHeight+=parseInt(objListNodes[j].offsetHeight);
if(!isNaN(parseInt(objListNodes[j].style.height))){
objListNodes[j].style.height=(parseInt(objListNodes[j].offsetHeight)+intColumnHeight-intCurrentHeight)+'px';
}
}
}
araMCLLists[i].mclHeight=parseInt(araMCLLists[i].offsetHeight);
}
setTimeout('mcl_correct()',100);
}
var araStoryList=new Array();
var araStoryDetail=new Array();
var araMCLLists=new Array();
var mcl_browser=new mcl_bwcheck();
mcl_addEvent(window,'load',mcl_init,true);
var mcl_columnCount=2;
