function tooltip_show (element)
{
  debug('show=' + element);
  $(element).attr({ src: "../../assets/common/pfeil_mehr_termine_active.gif" });
}
function tooltip_hide (element)
{
  debug('hide=' + element);
  $(element).attr({ src: "../../assets/common/pfeil_mehr_termine.gif" });
}

function debug(error)
{
  if (window.console)
  {
    console.debug(error);
  }
}

function ip_expander(id)
{
  var expander = document.getElementById('ip_expander_'+id);
  var teaser = document.getElementById('ip_teaser_'+id);

  closeDenRest(id);

  if (expander.style.display!='block')
  {
//  	document.all.expander.style.setAttribute('display', 'block', 'false');
//  	document.all.teaser.style.setAttribute('display', 'none', 'false');


    expander.style.display = 'block';
    teaser.style.display = 'none';
  }
  else
  {
    expander.style.display = 'none';
    teaser.style.display = 'block';
  }
}

/**
  *
  */
function closeDenRest(the_one)
{
  var all_details = document.getElementById('all_details').value;
  if (all_details)
  {

     var arr_details = all_details.split(',');

     for (i=0 ; my_id = arr_details[i] ; i++)
     {

       var my_expander = document.getElementById('ip_expander_'+my_id);
       var my_teaser = document.getElementById('ip_teaser_'+my_id);
       if (my_teaser && my_expander && my_id!=the_one)
       {
         my_expander.style.display = 'none';
         my_teaser.style.display = 'block';
       }
     }

  }
}

function sendSeminarfinder()
{
		debug('halo welt');

     var options = {
        target:        '#content'   // target element(s) to be updated with server response
		};
    $('#seminarfinder_form').ajaxSubmit(options);
}

function sendAnmeldung()
{
      var options = {
        target:        '#temp_div'   // target element(s) to be updated with server response
//        beforeSubmit:  showRequestForm  // pre-submit callback
//        success:       showResponseForm  // post-submit callback

        // other available options:
        //url:       url         // override for form's 'action' attribute
        //type:      type        // 'get' or 'post', override for form's 'method' attribute
        //dataType:  null        // 'xml', 'script', or 'json' (expected server response type)
        //clearForm: true        // clear all form fields after successful submit
        //resetForm: true        // reset the form after successful submit

        // $.ajax options can be used here too, for example:
        //timeout:   3000
    };

    // bind form using 'ajaxForm'
    $('#form_anmeldung').ajaxSubmit(options);
}

// pre-submit callback
function showRequestForm(formData, jqForm, options) {
    // formData is an array; here we use $.param to convert it to a string to display it
    // but the form plugin does this for you automatically when it submits the data
    var queryString = $.param(formData);

    // jqForm is a jQuery object encapsulating the form element.  To access the
    // DOM element for the form do this:
    // var formElement = jqForm[0];

    alert('About to submit: \n\n' + queryString);

    // here we could return false to prevent the form from being submitted;
    // returning anything other than false will allow the form submit to continue
    return true;
}

// post-submit callback
function showResponseForm(responseText, statusText)  {
    // for normal html responses, the first argument to the success callback
    // is the XMLHttpRequest object's responseText property

    // if the ajaxSubmit method was passed an Options Object with the dataType
    // property set to 'xml' then the first argument to the success callback
    // is the XMLHttpRequest object's responseXML property

    // if the ajaxSubmit method was passed an Options Object with the dataType
    // property set to 'json' then the first argument to the success callback
    // is the json data object returned by the server

    alert('status: ' + statusText + '\n\nresponseText: \n' + responseText +
        '\n\nThe output div should have already been updated with the responseText.');
}

function sendForm()
{
      var options = {
        target:        '#temp_div'   // target element(s) to be updated with server response
    };

    // bind form using 'ajaxForm'
    $('#form').ajaxSubmit(options);
}


function sendFormReg()
{
debug('senden');

      var options = {
        target:        '#temp_div'   // target element(s) to be updated with server response
    };

    // bind form using 'ajaxForm'
    $('#form_reg').ajaxSubmit(options);
}

function sendFormLost()
{
debug('senden');

      var options = {
        target:        '#temp_div'   // target element(s) to be updated with server response
    };

    // bind form using 'ajaxForm'
    $('#form_lost').ajaxSubmit(options);
}

