$(function()
  {
  Cufon.replace('h1,h2',
    {
    hover															: true,
	fontFamily                                                      : 'Helvetica Neue LT Pro'
    });


  $('.cx-fahne').fancybox();


  cx_init_login();
  cx_init_videos();
  });


function cx_init_login()
  {
  $('.cx-login-trigger').attr('href',js_rwb+'?l=1');
  $('.cx-login-trigger').fancybox(
	{
    'autoDimensions'  : true,
    'autoScale'       : true,
	'overlayOpacity'  : 0.7,
	'titleShow'		  : false,
	'overlayColor'	  : '#000',
	'onStart'         : function()
	  {
	  $('html').addClass('cx-no-scrolling-2');
	  },
	'onComplete'      : function()
	  {
	  $('.cx-overlay-login .cx-kundenlogin-login-submit').click(function()
	    {
		$('.cx-overlay-login .cx-hinweis-fehler').hide();
		obj_form                                                    = $(this).parents('form');
		str_action                                                  = $(obj_form).attr('action');

		$.post(str_action,$(obj_form).serialize(),function(data)
		  {
		  arr_data                                                  = data.split('|');
		  if(arr_data[0] == '0')
			{
			$('.cx-overlay-login .cx-hinweis-fehler').html(arr_data[1]).show();
			}
		  else
			{
			cx_status_erfolg(arr_data[1],1);
			document.location.reload(-1);
			}
		  });
		});
	  },
	'onClosed'        : function()
	  {
	  $('html').removeClass('cx-no-scrolling-2');
	  }
	});
  }


function cx_init_videos()
  {
  $('.cx-video-trigger').fancybox(
	{
    'autoDimensions'  : true,
    'autoScale'       : true,
	'overlayOpacity'  : 0.7,
	'titleShow'		  : false,
	'overlayColor'	  : '#000',
	'onStart'         : function()
	  {
	  $('html').addClass('cx-no-scrolling-2');
	  },
	'onComplete'      : function()
	  {
	  },
	'onClosed'        : function()
	  {
	  $('html').removeClass('cx-no-scrolling-2');
	  }
	});
  }


function cx_status_erfolg(str,autohide)
  {
  cx_status_erfolg_hide();
  if(str != '')
	{
	$('.cx-status-dialog').html(str);
	}
  $('.cx-status-dialog').show();
  if(autohide)
	{
    setTimeout('cx_status_erfolg_hide()',3000);
	}
  }

function cx_status_erfolg_hide()
  {
  $('.cx-status-dialog').hide();
  }
