//Setup the list so only the first four are show
function initlist_setup (listcontainerID, looplist) {
	var offset = 0;
	var limit = 4;
	
	var looplist = looplist - 1;
	
	//loop through each of the lists to be altered
	for(e = 0; e < looplist; e++) {
		
		var currentlistcontainer = listcontainerID+'-'+e;
		var listcontainer = document.getElementById(currentlistcontainer);
		var lists = listcontainer.getElementsByTagName('ul');
		
		//loop through each of the lists setting only the first n li tags as visible
		for(i = 0; i < lists.length; i++) {
			children = lists[i].getElementsByTagName('li');
			limitcounter = 1;
			counter = 1;
			for(r = 0; r < children.length; r++) {
				currentchild = children[r];
				
				if (  counter > offset ) {
					
					if ( limitcounter > limit ) {
						currentchild.style.display="none";
					} else {
						currentchild.style.display="list-item";
					}
					limitcounter++;
					
				} else {
					//currentchild.style.display="list-item";
					
				}
				counter++;
			}
		}
	
	}
	
}

// Show the number of list elements
function more_list(listid, button, limit, offset) {
	var offset = (offset == null) ? 1 : offset;
	
	var numberofsib;
	
	var list = document.getElementById(listid);
	
	var children = list.getElementsByTagName('li');
	
	var counter = 1;
	var limitcounter = 1; 
	
	//Loop through each of the list hidding and showing based on offset and limit
	for(i = 0; i < children.length; i++)
	{
		
		currentchild = children[i];
		currentchild.style.display="list-item";
		
		//currentchild.style.backgroundColor="#FFFFFF";
		
		if (  counter > offset ) {
			
			if ( limitcounter > limit ) {
				currentchild.style.display="none";
			} else {
				//currentchild.style.display="list";
			}
			limitcounter++;
			
		} else {
			currentchild.style.display="none";
			
		}
		counter++;
		

	}
	
	nextoffset = offset + limit;
	if ( nextoffset >= (counter - 1) ) { //If offset is greater than the number of list then we know to loop back to the begining
		nextoffset = 0;
	}
	
	//Update the button code with a new offset
	button.onclick=function() {return more_list(listid,this,limit,nextoffset);}
	
	return false;
	
}