function importLightbox(path, pathR)
{
	pathRoot = pathR;
	var files = Array("prototype.js", "scriptaculous.js", "lightbox.js");
	for(i=0; i<files.length; i++)
	{
		document.write('<script type="text/javascript" src="'+path+files[i]+'"></script>');
	}
	
	document.write('<link rel="stylesheet" type="text/css" href="'+path+'lightbox.css">');
}


//### blendet je ein Element ein & aus
function showhide( showid, hideid ) {
  if ( showid == hideid && document.getElementById( showid ) ) {
    if ( document.getElementById( hideid ).style.visibility == 'hidden' ) {
      hideid = '';
    }
    else {
      showid = '';
    }
  }
  if ( document.getElementById( showid ) ) {
    document.getElementById( showid ).style.visibility = 'visible';
    document.getElementById( showid ).style.display = '';
  }
  if ( document.getElementById( hideid ) ) {
    document.getElementById( hideid ).style.visibility = 'hidden';
    document.getElementById( hideid ).style.display = 'none';
  }
}

function jump2page( schritt ) {
  document.getElementById('schritt').value = schritt;
  document.getElementById('fragebogen_form').submit();
}

function swapClass( id, className ) {
  if ( document.getElementById( id ) ) {
    document.getElementById( id ).className = className;
  }
}

function swapImg( id, img ) {
  if ( document.getElementById( id ) ) {
    document.getElementById( id ).src = img;
  }
}

//### Ein-/ bzw. ausblenden des Kalenders
function calendar( modus, evt, name ) {
  element = document.getElementById( 'div_calendar_'+name );
  
  if( element != null ) {
    modus = ( modus==1 ) ? 'visible' : 'hidden';
    
    if( modus == 'visible' ) {
      var e = ( window.event ) ? window.event : evt;
      var offX = document.body.scrollLeft;
      var offY = document.body.scrollTop;
      
      element.style.left = offX + e.clientX;
      element.style.top  = offY + e.clientY;
      element.style.display = '';
      element.style.visibility = modus;
    }
  }
  else {
    elemARR = document.getElementsByName( 'calendar' );
    for ( i=0; i<elemARR.length; i++ )
    {
      elem_name = elemARR[i].style;
      elem_name.visibility = 'hidden';
      elem_name.display = 'none';
    }
  }
}

//### Setzt das gewählte Datum aus dem Kalender in die passenden Felder (field)
function calendar_set_date(field, day, month, year) {
  with (top.main.document) {
    getElementsByName( field+'_tag' )[0].value = day;
    getElementsByName( field+'_monat' )[0].value = month;
    getElementsByName( field+'_jahr' )[0].value = year;
    
    getElementById( 'div_calendar_'+field ).style.visibility = 'hidden';
    getElementById( 'div_calendar_'+field ).style.display = 'none';
  }
}

function goTo( url ) {
  window.location = url.replace( /&amp;/g, "&" );
}

function showFilter( path ) {
	showhide( 'filter_tab', 'filter_tab' );
	
	if ( document.getElementById( 'filter_tab' ).style.visibility == 'hidden' ) {
		swapImg( 'filter_plus', path+'plus.gif');
	} else {
		swapImg( 'filter_plus', path+'minus.gif');
	}
}

function setDummy( id ) {
	document.getElementById( id+'_dummy' ).value = document.getElementById( id ).value;
}

function checkWaehrung( id, id2 ) {
	if ( document.getElementById( id ).value == document.getElementById( id2 ).value ) {
		document.getElementById( id2 ).value = document.getElementById( id+'_dummy' ).value;
	}
	
	setDummy( id );
	setDummy( id2 );
}

function showBenachrichtigungZusatz( value ) {
	showhide( '', 'zusatz_email' );
	showhide( '', 'zusatz_telefon' );
	if ( value == "email" ) {
		showhide( 'zusatz_email' );
	}
	else if ( value == "telefon" ) {
		showhide( 'zusatz_telefon' );
	}
}