
var iVisibleRegion = 0;
/*
var iPadding = 7; // bottom padding of #regionlist
var iMargin = 20; // temporary margin of region
var iLineHeight = 26; // height of a single destination line
*/
var iPadding = 7; // bottom padding of #regionlist
var iMargin = 1; // temporary margin of region
var iLineHeight = 26; // height of a single destination line



function hideDestinations(iId) {
  oRegionNext = findObj('reg' + ( iId + 1 ));
  oRegionSelf = findObj('reg' + iId);
  
  if ( null != oRegionNext ) {
	if ( oRegionNext.style ) {
      oRegionNext = oRegionNext.style;
    }
	
    oRegionNext.marginTop = '0px';  
  } else {
    oRegionNext = findObj('regionlist');
	  
	if ( oRegionNext.style ) {
      oRegionNext = oRegionNext.style;
    }
	  
	oRegionNext.paddingBottom = iPadding + 'px';
  }
  
  if ( null != oRegionSelf ) {
    if ( oRegionSelf.style ) {
      oRegionSelf = oRegionSelf.style;
    }
	
	oRegionSelf.marginTop = '0px';
  }
  
  showHideLayers('dest' + iId, 'hide');
}

function showDestinations(iId, iRows) {		
  if ( 0 < iVisibleRegion ) {
    hideDestinations(iVisibleRegion);
  }
  
  if ( iId == iVisibleRegion ) {
    iVisibleRegion = 0;
	return;
  }
  
  iVisibleRegion = 0;
  
  oRegionSelf = findObj('reg' + iId);
  oRegionNext = findObj('reg' + ( iId + 1 ));
    
  if ( null != oRegionSelf ) {
    if ( oRegionSelf.style ) {
      oRegionSelf = oRegionSelf.style;
    }
	
	oRegionSelf.marginTop = iMargin + 'px';
	
	if ( null != oRegionNext ) {
	  if ( oRegionNext.style ) {
        oRegionNext = oRegionNext.style;
      }
	
      oRegionNext.marginTop = ( ( (iRows * iLineHeight) + 1 ) + iMargin ) + 'px';  
	} else {
	  oRegionNext = findObj('regionlist');
	  
	  if ( oRegionNext.style ) {
        oRegionNext = oRegionNext.style;
      }
	  
	  oRegionNext.paddingBottom = ( (iRows * iLineHeight) + 1 ) + 'px';
	}
	
	showHideLayers('dest' + iId, 'show');
	
	iVisibleRegion = iId;
  }
}

function findObj(sName, oParent) {
  var iPosition, iIndex, oFindMe;

  if ( ! oParent ) {
  	oParent = document;
  }

  if ( (iPosition = sName.indexOf('?')) > 0 && parent.frames.length ) {
    oParent = parent.frames[sName.substring(iPosition + 1)].document;
	sName = sName.substring(0, iPosition);
  }

  if ( ! (oFindMe = oParent[sName]) && oParent.all ) {
    oFindMe = oParent.all[sName];
  }

  for ( iIndex = 0; ! oFindMe && iIndex < oParent.forms.length; iIndex++ ) {
    oFindMe = oParent.forms[iIndex][sName];
  }

  for ( iIndex = 0; ! oFindMe && oParent.layers && iIndex < oParent.layers.length; iIndex++ ) {
    oFindMe = findObj(sName, oParent.layers[iIndex].document);
  }

  if ( ! oFindMe && oParent.getElementById ) {
    oFindMe = oParent.getElementById(sName);
  }

  return oFindMe;
}

function showHideLayers() {
  var iIndex, sVisibility, oLayer;
  var aArguments = showHideLayers.arguments;

  for ( iIndex = 0; iIndex < (aArguments.length - 1); iIndex += 2 ) {
    if ( null != (oLayer = findObj(aArguments[iIndex])) ) {
      sVisibility = aArguments[iIndex + 1];

	  if ( oLayer.style ) {
	    oLayer = oLayer.style;
      }

	  if ( sVisibility == 'show' ) {
	    sVisibility = 'visible';
	  } else if( sVisibility == 'hide' ) {
	    sVisibility = 'hidden';
	  }

	  oLayer.visibility = sVisibility;
    }
  }
}

function openMap(iValue) {
		
	sRegionParam = '&regid=' + (iValue-1);
	
	if( iValue ) {
		
		oIframe = document.getElementById('MapModul');
		
		sIframeSrc = oIframe.src + sRegionParam;
		
		oIframe.src = sIframeSrc;
		
	}
	
}
