$(window).load(function() {

	$('#content').find("#box").each(function() {
		$(this).liquidCanvas("[shadow gradient{from:#565951; to:#2E2E2E;}] => roundedRect{radius:10}");
	});

});

(function($) {
  var cache = [];
  // Arguments are image paths relative to the current page.
  $.preLoadImages = function() {
    var args_len = arguments.length;
    for (var i = args_len; i--;) {
      var cacheImage = document.createElement('img');
      cacheImage.src = arguments[i];
      cache.push(cacheImage);
    }
  }
})(jQuery);

jQuery.preLoadImages("/images/overlay/header_overlay_1.png", "/images/overlay/header_overlay_2.png", "/images/overlay/header_overlay_3.png");

var hoverIntentConfig = {    
     over: fadeColIn,
     timeout: 100,
     out: fadeColOut
};

function fadeColIn() {
	$(this).animate({color: '#DB101B'});
}

function fadeColOut() {
	$(this).animate({color: '#FFF94D'});
}


$(document).ready(function() {

	$('li a').each(function() {
		if(!$(this).parent().hasClass("active")) {
			$(this).hoverIntent( hoverIntentConfig );
		}
	});


	var ac_ov = Math.round(Math.random()*2)+1;
	$("#header").children("#overlay").css({ "background": "url(/images/overlay/header_overlay_"+ac_ov+".png) 0px 0px no-repeat" });
	ac_ov++;

	var aktiv = window.setInterval(function() {
		if(ac_ov>3) { ac_ov = 1; }
		$("#header").children("#overlay").animate({ opacity: 0 }, 800, function() {
			$("#header").children("#overlay").css({ "background": "url(/images/overlay/header_overlay_"+ac_ov+".png) 0px 0px no-repeat" });
			$("#header").children("#overlay").animate({ opacity: 1 }, 800, function() { ac_ov++; } );
		});

	}, 20000);

});

function checkcontactform() {
		var check_form = true;
		
		if(ge('name').value == "") {
			alert('Bitte füllen Sie das Feld "Name" vollständig aus!');
			ge('name').focus();
			check_form = false; return false;
		} 
		if(!EMail(ge('email').value)) {
			alert('Bitte füllen Sie das Feld "E-Mail" vollständig aus!');
			ge('email').focus();
			check_form = false; return false;
		} 
		if(ge('subject').value == "") {
			alert('Bitte füllen Sie das Feld "Anliegen" vollständig aus!');
			ge('subject').focus();
			check_form = false; return false;
		} 
		if(ge('message').value == "") {
			alert('Bitte füllen Sie das Feld "Nachricht" vollständig aus!');
			ge('message').focus();
			check_form = false; return false;
		} 
		if(ge('spams').value == "") {
			alert('Bitte füllen Sie das Feld "Spamschutz" vollständig aus!');
			ge('spams').focus();
			check_form = false; return false;
		} 
		if(check_form==true) {
			return true;
		} else {
			return false;
		}
}

function ge(obj) { return document.getElementById(obj); }

function EMail(s)
	{
		var a = false;
		var res = false;
		if(typeof(RegExp) == 'function')
		{
			var b = new RegExp('abc');
			if(b.test('abc') == true){a = true;}
		}
	
		if(a == true)
		{
			reg = new RegExp('^([a-zA-Z0-9\\-\\.\\_]+)'+
			'(\\@)([a-zA-Z0-9\\-\\.]+)'+
			'(\\.)([a-zA-Z]{2,4})$');
			res = (reg.test(s));
		}
		else
		{
		res = (s.search('@') >= 1 &&
		s.lastIndexOf('.') > s.search('@') &&
		s.lastIndexOf('.') >= s.length-5)
		}
		return(res);
	} 

