function isValidEmailAddress(emailAddress) {
	var pattern = new RegExp(/^(("[\w-\s]+")|([\w-]+(?:\.[\w-]+)*)|("[\w-\s]+")([\w-]+(?:\.[\w-]+)*))(@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$)|(@\[?((25[0-5]\.|2[0-4][0-9]\.|1[0-9]{2}\.|[0-9]{1,2}\.))((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\.){2}(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\]?$)/i);
	return pattern.test(emailAddress);
}
function contact(){
    var name        = $("#msg_name");
    var check_email = $("#check_email");
    var msg         = $("#msg");
    
    if(name.val() == ""){
        $("#error_name").css('color','red');
    }else if( !isValidEmailAddress(check_email.val()) ){
        $("#error_email").css('color','red');
    }else if(msg.val() == ""){
        $("#error_msg").css('color','red');
    }else{
        $("#check_contact").submit();
    }
}

var MENU_TIMER = null;
$(function(){
    
    /*IE6 sucks, therfore we will use this plugin to fix the "problem"*/
    $(document).pngFix(); 
   
    $('a.email_check').nospam({ replaceText: true, filterLevel: 'low' });
	$('.fb-icon').tipsy({gravity: 'e'});
	
    $.reject({  
		reject: {  
			msie6: true // Microsoft Internet Explorer  
		}  
	});
	
	$('#contact_us').contactable({
 		subject: 'Kontakt'
 	  });

    // Dropdown Menu
    $('#activate-drop').mouseover(function() {

        if(MENU_TIMER) {
            window.clearTimeout(MENU_TIMER);
        	MENU_TIMER = null;
        }

        $('#dropdown-menu').css('display', 'block');
		$(this).find('.remove').css('display', 'block');
    });

    $('#activate-drop').mouseout(function() {
        var this_ref = this;
        MENU_TIMER = window.setTimeout(function() {
            $('.remove').css('display', 'none');
        }, 500);
    });
	$("#dropdown-menu").css('display','none');
});
