﻿// JScript File
        //Accordian scripts courtesy of http://www.leigeber.com
        //Horizontal accordian
        var slideMenu=function(){
	        var sp,st,t,m,sa,l,w,sw,ot,vt;
	        return{
		        build:function(sm,vert,sw,mt,s,sl){
		            //sm=ul id, vert=vertical (true/false), sw=image width, mt + s=timing, sl = initial image
			        sp=s; st=sw; t=mt;vt=vert;
			        m=document.getElementById(sm);
			        sa=m.getElementsByTagName('li');
			        l=sa.length; 
			        if(vt)
			        {   w=m.offsetHeight;}
			        else
			        {   w=m.offsetWidth;}
			        sw=w/l;
			        ot=Math.floor((w-st)/(l-1)); var i=0;
			        for(i;i<l;i++)
			        {   s=sa[i]; 
			            if(vt)
			            {   s.style.height=sw+'px';}
			            else
			            {   s.style.width=sw+'px';}
			            this.timer(s)
			        }
			        if(sl!=null){m.timer=setInterval(function(){slideMenu.slide(sa[sl-1])},t)}
		        },
		        timer:function(s){s.onmouseover=function(){clearInterval(m.timer);m.timer=setInterval(function(){slideMenu.slide(s)},t)}},
		        slide:function(s){
		            if(vt)
		            {   var cw=parseInt(s.style.height,'10');}
		            else
		            {   var cw=parseInt(s.style.width,'10');}
			        if(cw<st){
				        var owt=0; var i=0;
				        for(i;i<l;i++){
					        if(sa[i]!=s){
						        var o,ow; var oi=0; o=sa[i]; 
						        if(vt)
						        {   ow=parseInt(o.style.height,'10');}
                                else
						        {   ow=parseInt(o.style.width,'10');}
						        if(ow>ot)
						        {   oi=Math.floor((ow-ot)/sp); 
						            oi=(oi>0)?oi:1; 
						            if(vt)
						            {   o.style.height=(ow-oi)+'px';}
						            else
						            {   o.style.width=(ow-oi)+'px';}
						        }
						        owt=owt+(ow-oi)}}
						if(vt)
						{   s.style.height=(w-owt)+'px';}
						else
						{   s.style.width=(w-owt)+'px';}
			        }else{clearInterval(m.timer)}
		        }
	        };
        }();
function showDiv(chosenDiv)
{
	var divChosen=document.getElementById(chosenDiv);
	divChosen.style.display='block';
}
function hideDiv(chosenDiv)
{
	var divChosen=document.getElementById(chosenDiv);
	divChosen.style.display='none';
}
