 function unhide(divID) {
 	var item = document.getElementById(divID);
 	
 	if (item) {
 		item.className=(item.className=='hidden')?'unhidden':'hidden';
 	}
 }
 
 //hides home and unhides divID
 function selectContentDiv(divID)
 {
 	if(divID != 'home')
 	{
 		//hide home if it is present
 		var home = document.getElementById('home');
 		if(home) home.className='hidden';
 		
 		//unhide divID if it is present
 		var div = document.getElementById(divID);
 		if(div) div.className='unhidden';
 	}
 }
 
 //opens or closes collapsable menu elements
 function menuselect(divID) {
 	var item = document.getElementById(divID);
 	var imgitem = document.getElementById("img"+divID);
 	
 	if (item) {
 		if(item.className=='hidden')
 		{
 			item.className= 'unhidden';
 			if(imgitem) imgitem.src='images/downarrow.gif';
 		}
 		else
 		{
 			item.className= 'hidden';
 			if(imgitem) imgitem.src='images/rightarrow.gif';
 		}
 	}
 }
 
 
 //deprecated - now use selectContentDiv instead
 //
 // relies on divs being id'ed as item0, item1, item2 ... etc.
 // or as blog0, blog1, blog2 ... etc
 /*function select(divID) {
 	
 	var selected = document.getElementById(divID);
 
 	//hide all the items and blog entries (max 20)
 	for ( var iParam = 0; iParam < 20; iParam++ ){
 		
 		//if there is an item at this pos then hide it
 		var item = document.getElementById('item' + iParam);
 		if(item){ if(item.className=='unhidden') {item.className='hidden';} }
 	
 		//if there is a blog entry at this pos then hide it
 		var blog = document.getElementById('blog' + iParam);
 		if(blog){ if(blog.className=='unhidden') {blog.className='hidden';} }
 	
 	}
 
 	//show the selected div
 	if(selected){ selected.className='unhidden'; }

 }*/
 
 //allows javascript to select an item based on the id in the url
 function getURLParam(strParamName){
  	var strReturn = "";
  	var strHref = window.location.href;
  
  	if ( strHref.indexOf("?") > -1 ){
    	var strQueryString = strHref.substr(strHref.indexOf("?")).toLowerCase();
    	var aQueryString = strQueryString.split("&");
    
    	for ( var iParam = 0; iParam < aQueryString.length; iParam++ ){
      		if (aQueryString[iParam].indexOf(strParamName.toLowerCase() + "=") > -1 ){
        		var aParam = aQueryString[iParam].split("=");
        		strReturn = aParam[1];
        		break;
      		}
    	}
  	}
  	return unescape(strReturn);
}

//selects an item based on the url ("example.html?id=item1")
function selectBasedOnURL()
{
	var item = getURLParam('id');
	if(item) selectContentDiv(item);
}
 
