
/* FAQ */ 
showfaq = function(id) {
	fitem = $('#'+id);
	if (fitem.css('display') == "none") {
		fitem.parent().addClass('closed');
		fitem.show();
	}
	else {
		fitem.parent().removeClass('closed');
		fitem.hide();  
	}
}

jumptoNode = function(val) {
	document.location.href = val;
}


var hasErrors = false;
  
function checkNewsletter() {    
	var emailPattern = /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i;
	var email = $("#inp_3").val();   
	if (!emailPattern.test(email)) {
		if (!hasErrors) {     
			var error = '<div class="messages error"><ul><li>Bitte geben Sie eine gültige E-Mailadresse an!<li></ul></div>'     
			$(".news_form:eq(0)").before($(error));
			hasErrors = true;
        }   
		return false;
    }
	return true;
}

function rollCustomers() {
    var $current = $('#slideshow a.current');
    if ( $current.length == 0 ) $current = $('#slideshow a:last');
    var $next =  $current.next().length ? $current.next() : $('#slideshow a:first');
    $current.addClass('previous');
    $next.css({opacity: 0.0})
        .addClass('current')
        .animate({opacity: 1.0}, 1000, function() {
            $current.removeClass('current previous');
        });
}

$(document).ready(function() {
   $('#content .content-block a.highslide').bind('click', function() {
      return hs.expand(this, { captionText: '' });
   });
   
   
   $('a.trial_button').bind('mouseenter', function() {
	  $(this).children('img.inactive').hide();
      $(this).children('img.active').show();
	  $(this).parent().addClass('active');
   });
   
   $('a.trial_button').bind('mouseleave', function() {
	  $(this).children('img.active').hide();
      $(this).children('img.inactive').show();
	  $(this).parent().removeClass('active');
   });
   
   $('li.sidebox a').bind('mouseenter', function() {
	  $(this).children('img.inactive').hide();
      $(this).children('img.active').show();
	  $(this).parent().addClass('active');   });
   
   $('li.sidebox a').bind('mouseleave', function() {
	  $(this).children('img.active').hide();
      $(this).children('img.inactive').show();
	  $(this).parent().removeClass('active');   });
   
   $('li.customer').bind('mouseenter', function() {
	  $('li.customer div.view div#slideshow a.sidebox img.inactive').hide();
      $('li.customer div.view div#slideshow a.sidebox img.active').show();
	  $('li.customer').addClass('active');
   });
   
   $('li.customer').bind('mouseleave', function() {
	  $('li.customer div.view div#slideshow a.sidebox img.active').hide();
      $('li.customer div.view div#slideshow a.sidebox img.inactive').show();
	  $('li.customer').removeClass('active');
   });
   
   setInterval("rollCustomers()",5000);
});
