function checkInputValue( iv, defVal )
{
  if ( iv.value == defVal )
  {
    iv.value = '';
  }
}


function checkInputValueOut( iv, defVal )
{
  if ( iv.value == '' )
  {
    iv.value = defVal;
  }
}


function checkInputPassValue( iv, defVal )
{
  if ( iv.value == defVal )
  {
    iv.value = '';
    iv.type = 'password';
  }
}


function checkInputPassValueOut( iv, defVal )
{
  if ( iv.value == '' )
  {
    iv.type = 'text';
    iv.value = defVal;
  }
}


function jslink( link )
{
  window.location.href = link;
}

function jslinkWindow( link, target )
{
	window.open(link, target);
}

function setActive()
{
  active = true;
}


function setBoxHeight(el, this_el)
{
  $('#'+this_el).height($('#'+el).height());
}


function setFocus( field  )
{
  formname  = field.split("['");
  fieldname = formname[1].split("'");

  $('#' + formname[0] + ' #' + fieldname[0] ).focus();
}


function setErrorPatched( field, count )
{
  var newImgPath = bp + 'media/msg/';

  for ( var x = 1; x <= count; x++ )
  {
    $( '#' + field + x ).attr( 'src', newImgPath + $( '#' + field + x ).attr('alt') + '_done.gif' );
  }
}

function showInfo( id, count )
{
  for ( var i = 0; i <= count - 1; i++)
  {
    $( '#info_' + i ).attr('class', 'hidden');
    $( '#infoname_' + i ).attr('class', 'hidden');
  }
  
  $( '#info_' + id ).removeClass( 'hidden' );
  $( '#infoname_' + id ).removeClass( 'hidden' );
}

function startSearch()
{
  $('#wait').show();
  var search = $('#searchtext').val();

  if ( search != '' )
  {
    $.ajax({
      type: "POST",
      url: "20.html",
      data: { file: "search", searchtext: search},
      dataType: "html",
      success: function(data){
        if ( data != 'not_found' )
        {
          $('#content').css('background','none');
          $('#content_bg').css('background','none');
          $('.col_right').remove();
          $('div .col_left').replaceWith( '<div class="col_left">' + data + '</div>');
          $('.col_left').width(950);
          sIFR.replace(conduit, {
            selector: '.headline h3',
            wmode: 'transparent',
            css: [
                '.sIFR-root { color: #414d4f; font-weight: bold; }'
                ,'a { color: #4E7852; text-decoration: none; }'
                ,'a:link { color: #414d4f; }'
                ,'a:hover { color: #414d4f; }'
            ]
          });
        }
        else
        {
          $.nyroModalManual({
            content: '<img src="simon/skip-intro.net/media/main/not_found.png" alt="not found" />'
          });
        }
        $('#wait').hide();
      }
    });
  }
}

function loadImage(i)
{
  if ( $('#panorama_img').attr('src').substr(-images[i].length) != images[i] ) //wird das gewählte Bild schon angezeigt?
  {
    var img = new Image();
    var inProgress = true;

    $(img).load(function() {
      if ( inProgress == false )
      {
        $('#panorama_img').attr('src', img.src);
        $('#panorama').removeClass('loading');
        $('#panorama_img').fadeIn('slow');
      }
      else
      {
        inProgress = false;
      }
    }).attr('src', images[i]);

    $('#panorama_img').fadeOut('slow', function() {
      if ( inProgress == false )
      {
        $('#panorama_img').attr('src', img.src);
        $('#panorama').removeClass('loading');
        $('#panorama_img').fadeIn('slow');
      }
      else
      {
        inProgress = false;
        $('#panorama').addClass('loading');
      }
    });
  }
}

function rotateImg()
{
  if ( irNextImg < irCountImg )
  {
    irNextImg = irNextImg + 1;
  }
  else if ( irNextImg == irCountImg )
  {
    irNextImg = 0;
  }
  loadImage(irNextImg);
}

function stopImgRotator()
{
  window.clearInterval( imgTimeout );
  window.clearInterval( imgRotator );
}

function startImgRotator()
{
  window.clearInterval( imgTimeout );
  imgRotator = window.setInterval( 'rotateImg()', irTimer );
}

function startSplash()
{
//  $.nyroModalManual({
//    content: '<img src="simon/skip-intro.net/media/main/not_found.png" alt="not found" />'
//  });
}

function hoverNavibar( obj, time, val )
{
  if ( jQuery.browser.msie == false )
  {
    $(obj).fadeTo(time, val);
  }
}
