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);
} 


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

function check_contact_form() {
	var check_form = true;
	
	// Anrede
	if(!ge("kontakt_anrede_herr").checked && !ge("kontakt_anrede_frau").checked) {
		alert("Bitte wählen Sie eine Anrede aus.");
		check_form = false;
	}
	
	// Name
	if(ge("kontakt_name").value == "") {
		alert("Bitte geben Sie einen Namen ein.");
		check_form = false;
	}
	
	// E-Mail
	if(!EMail(ge("kontakt_email").value)) {
		alert("Bitte geben Sie eine E-Mail Adresse ein.");
		check_form = false;
	}
	
	return check_form;
}

function check_contact_form_en() {
	var check_form = true;
	
	// Anrede
	if(!ge("kontakt_anrede_herr").checked && !ge("kontakt_anrede_frau").checked) {
		alert("Please fill out title field.");
		check_form = false;
	}
	
	// Name
	if(ge("kontakt_name").value == "") {
		alert("Please fill out name field.");
		check_form = false;
	}
	
	// E-Mail
	if(!EMail(ge("kontakt_email").value)) {
		alert("Please fill out email field.");
		check_form = false;
	}
	
	return check_form;
}

function formatText(index, panel) {
  return index + "";
}



$(document).ready(function(){  



 
//Slider
    
$(function () {

	$('.anythingSlider').anythingSlider({
		easing: "easeInOutExpo",        // Anything other than "linear" or "swing" requires the easing plugin
		autoPlay: false,                 // This turns off the entire FUNCTIONALY, not just if it starts running or not.
		delay: 3000,                    // How long between slide transitions in AutoPlay mode
		startStopped: false,            // If autoPlay is on, this can force it to start stopped
		animationTime: 600,             // How long the slide transition takes
		hashTags: true,                 // Should links change the hashtag in the URL?
		buildNavigation: false,          // If true, builds and list of anchor links to link to each slide
		pauseOnHover: true,             // If true, and autoPlay is enabled, the show will pause on hover
		startText: "",             // Start text
		stopText: "",               // Stop text
		navigationFormatter: formatText       // Details at the top of the file on this use (advanced use)
	});
	
	$("#slide-jump").click(function(){
		$('.anythingSlider').anythingSlider(6);
	});
	
});

if($.browser.msie && $.browser.version=="6.0") {

} else {


// Top Navigtaion Effekte
 $(".top_navi_over_link").mouseover(function(){
      $(this).parent().parent().children(".top_navi_over").animate({ 
        opacity: 1
      }, 200 );
    });
 $(".top_navi_over_link").mouseout(function(){
      $(this).parent().parent().children(".top_navi_over").animate({ 
        opacity: 0
      }, 200 );
    });


// Top Buttons Effekte

 $(".top_buttons_over_link").mouseover(function(){
      $(this).parent().parent().children(".top_buttons_over").animate({ 
        opacity: 1
      }, 200 );
      
    });
 $(".top_buttons_over_link").mouseout(function(){
      $(this).parent().parent().children(".top_buttons_over").animate({ 
        opacity: 0
      }, 200 );
      
    });

// Sub Navigation Effekte

 $(".sub_navi_over_link").mouseover(function(){
      $(this).parent().parent().children(".sub_navi_over").animate({ 
        opacity: 1
      }, 200 );
      
    });
 $(".sub_navi_over_link").mouseout(function(){
      $(this).parent().parent().children(".sub_navi_over").animate({ 
        opacity: 0
      }, 200 );
      
    });
}

}); 
