/*
function stopError()
  {
  return true;
  }
window.onerror = stopError;
*/

var movieName = "testcommand";

function thisMovie(movieName) {
  // IE and Netscape refer to the movie object differently.
  // This function returns the appropriate syntax depending on the browser.
  if (navigator.appName.indexOf ("Microsoft") !=-1) {
    return window[movieName]
  }	else {
    return document[movieName]
  }
}

// Checks if movie is completely loaded.
// Returns true if yes, false if no.
function movieIsLoaded (theMovie) {
  if (typeof(theMovie) != "undefined") {
	return theMovie.PercentLoaded() == 100;
  } else {
    return false;
  }
}


function playmovie() {
  if (movieIsLoaded(thisMovie(movieName))) {
    thisMovie(movieName).Play();
  }
}

function stopmovie() {
  if (movieIsLoaded(thisMovie(movieName))) {
    thisMovie(movieName).StopPlay();
  }
}


function go(theFrame) {
  if (movieIsLoaded(thisMovie(movieName))) {
    thisMovie(movieName).GotoFrame(theFrame);
  }
}

function golabel() {
  if (movieIsLoaded(thisMovie(movieName))) {
    thisMovie(movieName).TGotoLabel("_level0/","redframe");
  }
}

function testen(wert) {
  if (movieIsLoaded(thisMovie(movieName))) {
    thisMovie(movieName).SetVariable("_root.pfad_neu",wert);
  }
}


$(document).ready(function()
  {
  /* bilder nachladen
  ----------------------------------------------------------------*/
  cx_bild_nachladen();
  for(i=0;i<$('.news-bilder').length;i++)
	{
    $('.news-bilder:eq('+i+') a').lightBox(
      {
	  fixedNavigation:true,
	  imageLoading: JS_rb+'ini/images/lightbox-ico-loading.gif',
	  imageBtnClose: JS_rb+'ini/images/lightbox-btn-close.gif',
	  imageBtnPrev: JS_rb+'ini/images/lightbox-btn-prev.gif',
	  imageBtnNext: JS_rb+'ini/images/lightbox-btn-next.gif',
	  imageBlank: JS_rb+'ini/images/lightbox-blank.gif',
	  txtImage: 'Bild',
	  txtOf: 'von'
	  });
	}


  /* subnavi
  ----------------------------------------------------------------*/
  $('.topnavi-drop').hover(function()
	{
	id_topnavi                                                      = $(this).attr('rel');
	offset															= $(this).offset();
	int_top                                                         = offset.top;
	int_left                                                        = offset.left;
	str_src															= $(this).children('img').attr('src');
	str_src_neu														= $(this).children('img').attr('src').replace('_a.gif','.gif').replace('.gif','_a.gif');
	$(this).children('img').attr('src',str_src_neu);

	for(i=0;i<$('.topnavi-drop[rel!=\''+id_topnavi+'\']').length;i++)
	  {
	  if(!$('.topnavi-drop[rel!=\''+id_topnavi+'\']:eq('+i+')').hasClass('cx-selected'))
		{
	    str_src														= $('.topnavi-drop[rel!=\''+id_topnavi+'\']:eq('+i+')').children('img').attr('src');
	    str_src_neu													= $('.topnavi-drop[rel!=\''+id_topnavi+'\']:eq('+i+')').children('img').attr('src').replace('_a.gif','.gif');
	    $('.topnavi-drop[rel!=\''+id_topnavi+'\']:eq('+i+')').children('img').attr('src',str_src_neu);
		}
	  }

	$('.subnavi-container').hide();
	$('.subnavi-'+id_topnavi).css('top',(int_top+19)+'px');
	$('.subnavi-'+id_topnavi).css('left',int_left+'px');
	$('.subnavi-'+id_topnavi).show();
	});

  $('.subnavi-container').mouseleave(function()
	{
	$('.subnavi-container').hide();
	id_topnavi														= $(this).attr('rel');
	if(!$('.topnavi-drop[rel=\''+id_topnavi+'\']').hasClass('cx-selected'))
	  {
	  str_src														= $('.topnavi-drop[rel=\''+id_topnavi+'\']').children('img').attr('src');
	  str_src_neu													= $('.topnavi-drop[rel=\''+id_topnavi+'\']').children('img').attr('src').replace('_a.gif','.gif');
	  $('.topnavi-drop[rel=\''+id_topnavi+'\']').children('img').attr('src',str_src_neu);
	  }
	});
  });


function cx_bild_nachladen()
  {
  if($('.cx-bild-nachladen').length)
    {
	$('.cx-bild-nachladen:eq(0)').css('background-image','url('+$('.cx-bild-nachladen:eq(0)').attr('rel')+')');
	$('.cx-bild-nachladen:eq(0)').removeClass('cx-bild-nachladen');
	setTimeout('cx_bild_nachladen()',200);
	}
  }
