function check_email(e) 
{
	ok = "1234567890qwertyuiop[]asdfghjklzxcvbnm.@-_QWERTYUIOPASDFGHJKLZXCVBNM";
	for(i=0; i < e.length ;i++)
	{
		if(ok.indexOf(e.charAt(i))<0){return (false);} 
	}
	if (document.images)
	{
		re = /(@.*@)|(\.\.)|(^\.)|(^@)|(@$)|(\.$)|(@\.)/;
		re_two = /^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$/;
		if (!e.match(re) && e.match(re_two)){return (-1);} 
	}
}


function kontaktFormValidate(){
	if(jQuery('#kontaktForm input#name').val().length == 0)
	{
		alert('Type your name.');
		return false;
	}
	if(jQuery('#kontaktForm input#tel').val().length == 0)
	{
		alert('Type phone number.');
		return false;
	}	
	if(!check_email(jQuery('#kontaktForm input#mail').val()))
	{
		alert('Type true e-mail address.');
		return false;
	}	
	if(jQuery('#kontaktForm input#personal[type=checkbox]:checked').length == 0)
	{
		alert('You must agree with the rules of personal data protection.');
		return false;
	}	
	if(jQuery('#kontaktForm input#passKey').val().length == 0)
	{
		alert('Type Safety code.');
		return false;
	}	
}




function enquiryFormValidate(){
	if(!check_email(jQuery('#kontaktForm input#mail').val()))
	{
		alert('Type true e-mail address.');
		return false;
	}	
	if(jQuery('#kontaktForm input#firstname').val().length == 0)
	{
		alert('Type your first name.');
		return false;
	}
	if(jQuery('#kontaktForm input#lastname').val().length == 0)
	{
		alert('Type your last name.');
		return false;
	}
	if(jQuery('#kontaktForm input#address').val().length == 0)
	{
		alert('Type your address.');
		return false;
	}
	if(jQuery('#kontaktForm input#zip').val().length == 0)
	{
		alert('Type zip.');
		return false;
	}
	if(jQuery('#kontaktForm input#city').val().length == 0)
	{
		alert('Type city.');
		return false;
	}
	if(jQuery('#kontaktForm input#country').val().length == 0)
	{
		alert('Type country.');
		return false;
	}
	if(jQuery('#kontaktForm input#personal[type=checkbox]:checked').length == 0)
	{
		alert('You must agree with the rules of personal data protection.');
		return false;
	}	
	if(jQuery('#kontaktForm input#passKey').val().length == 0)
	{
		alert('Type Safety code.');
		return false;
	}	
}





$(document).ready(function(){
	$(".carousellite").jCarouselLite({
        btnNext: ".next",
        btnPrev: ".prev",
		visible: 5,
		start: 1,
		scroll: 1,
		easing: "easeOutQuart",
		speed: 1000
    }); 

$(function() {window.setInterval("$('.blink-img').toggle();",800);});


jQuery('.kontakt-form-wrapper #kontaktForm').submit(function() {
		return kontaktFormValidate();
});

jQuery('.enquiry-form-wrapper #kontaktForm').submit(function() {
		return enquiryFormValidate();
});



jQuery('.villogo').each(function() {
    var elem = $(this);
    setInterval(function() {
        if (elem.css('visibility') == 'hidden') {
            elem.css('visibility', 'visible');
        } else {
            elem.css('visibility', 'hidden');
        }    
    }, 500);
});



/*function menuhover(){
    document.getElementById('menuhover').style.display='block';
	document.getElementById('menuhover').style.visibility='visible';
	return true;
}*/
	
	
	//$('#menu li ul').css("display", "none");
	//$('#menu li ul:hover').css("visibility", "visible");
	//$('#menu li ul:hover').css("display", "block");
	
		/*$('#menu li').hover( 
		function (){
			$(this).children("ul").fadeIn("fast");
		},
		function() {
			$(this).children("ul").fadeOut("fast");
	});*/

});