//swapDisplay
//	swapID - Value of the html-tag of which to toogle the style block:none (a tag within a tag-set).
//	parentID - Value of a spesific tag-attribute which identifies the tag-set to switch among.
//Remark: The function depends on the global naming convention of html-attribute "parentID".
function swapDisplay(swapID, parentID) {
	showDIV(swapID, parentID);
	window.scroll(0,0);//only for backwards IE-compatibility.
	window.scrollTo(0,0);//crossbrowser (but no w3c-standard).
}//eo swapDisplay()

//Remark: the var.-name "parentID" could be named "tagGroupName".
function showDIV(swapID, parentID) {
	var elems = document.getElementsByTagName("DIV");
	var nElems = elems.length;
	var nID;

	for (i = 0; i < nElems ; i++) {
		nID = elems[i].id;//returns an empty string if no id-attribute is present.
		if (nID != "" && parentID == elems[i].getAttribute("parentID")) {
			if (nID == swapID)
				elems[i].style.display = (elems[i].style.display == "inline") ? "none": "inline";
			else
				elems[i].style.display = "none";
		}
	}
}//eo showDIV()

function ComboSwapDisplay( strCombo, strParentID ) {
	var strID = document.getElementById( strCombo ).value;
	swapDisplay( strID, strParentID );
}

function SkipChannelContent( strID, nDelta )
{
	var objChannelContainer = document.getElementById( "channellist_" + strID );
	SkipContainerContent( objChannelContainer, strID, nDelta );
}

function SkipDynamicListContent( strID, nDelta )
{
	var objListContainer = document.getElementById( "dynamiclist_" + strID );
	SkipContainerContent( objListContainer, strID, nDelta );
}

function SkipContainerContent( objChannelContainer, strID, nDelta )
{
	if ( objChannelContainer && objChannelContainer.children.length > 0 )
	{
		var nLastIndex 		= objChannelContainer.children.length - 1;
		var nCurrentIndex 	= ( objChannelContainer.currentindex ? objChannelContainer.currentindex : 0 );
		var nNewIndex		= nCurrentIndex + nDelta;
		var nShowIndex 		= ( nNewIndex > nLastIndex ? 0 : ( nNewIndex < 0 ? nLastIndex : nNewIndex ) );

		objChannelContainer.children.item( nCurrentIndex ).style.display = "none";
		
		DisplayElement( objChannelContainer.children.item( nShowIndex ) );

		// Remember which item is shown now
		objChannelContainer.currentindex = nShowIndex;

		// Update current item
		var objCurrentItemLabel = document.getElementById( "currentItem_" + strID );
		if ( objCurrentItemLabel )
		{
			objCurrentItemLabel.innerText = ( nShowIndex + 1 );
		}
	}
}

function DisplayElement( objElement )
{
	var objDivs = objElement.getElementsByTagName( "DIV" );
	for ( var i = 0; i < objDivs.length; i++ )
	{
		if ( objDivs[ i ].style.display != "block" )
		{
			objDivs[ i ].style.display = "block";
		}
	}

	objElement.style.display = "block";
}