$(document).ready(function(){
    $('.introContent .left img').css('height',$(window).height());
    
    $('.dateOfBirthInputs').submit(function(){
        var day = $("#day").val();
        var month = $("#month").val();
        var year = $("#year").val();
        var age = 18;
        var mydate = new Date();
        
        mydate.setFullYear(year, month-1, day);
        var currdate = new Date();
        currdate.setFullYear(currdate.getFullYear() - age);
        if (day == "DD" || day > 32) {
            alert("Please enter a valid day value.");
            return false;
        } else if (month == "MM" || month > 12) {
            alert("Please enter a valid month value.");
            return false;
        } else if (year == "YYYY" || year < 1910) {
            alert("Please enter a valid year value.");
            return false;
        }
        if ((currdate - mydate) < 0){
            alert("Sorry, only persons over the age of " + age + " may enter this site");
            window.location.href = 'index.php?pre_index_no=1';
        } else {
            window.location.href = 'index.php?pre_index_passed=1';
        }
        return false;
    });
    
    $('.contactForm').submit(function(){
        var name = $("#name").val();
        var phone = $("#phone").val();
        var mail = $("#mail").val();
        
        if (name == "") {
            alert("Please enter a valid name.");
            return false;
        } else if (phone == "") {
            alert("Please enter a valid phone number.");
            return false;
        } else if (mail == "") {
            alert("Please enter a valid mail.");
            return false;
        } 
        alert("Your request was send.");
        return true;
    });
    
    $('.content').css('height',$('.body').height()-$('#footer').height());
    $('.lineDottedVertical').css('height',$('#mainMenu').height());
    $('.content .contentRight').css('width',$(window).width()-370);
    $(window).bind("load", function() {
        if($('#ProductImage').hasClass('productImage')) {
            $('.content .contentRightPadding').css('width',$('.content .contentRight').width()-$('.content .productImage').width()-20);
        } else {
            $('.content .contentRightPadding').css('width',$('.content .contentRight').width()-60);
        }
        if($(window).height() < 888) {
            $('h2').css('font-size','25px');
        }
        $('.content .scrollable').css('height',$('.contentRight').height()-$('h2').height()-70);
        $('.contentLeft').css('height',$('.content').height());
        if($(window).height() < 888) {
            $('.content').css('height','100%');
            $('.contentLeft').css('height',$('.content').height());
            $('.contentLeft').css('background-position','50% 100%');
            $('#articleCat30').css('background','url("../../wepp/templates/images/left_bottle_small.png") 50% bottom no-repeat');
            $('#articleCat31').css('background','url("../../wepp/templates/images/left_bottle_small.png") 50% bottom no-repeat');
            $('#articleCat32').css('background','url("../../wepp/templates/images/left_bottle_small.png") 50% bottom no-repeat');
            $('.productImage img').css('height', 670);
        }
        $('.productImage').css('left', 430);
        if($(window).width() > 1025) {
            $('.content').css('width','1280px');
            $('.content .contentRight').css('width',$('.content').width()-370);
            if($('#ProductImage').hasClass('productImage')) {
                $('.content .contentRightPadding').css('width',$('.content .contentRight').width()-$('.content .productImage').width()-60);
            } else {
                $('.content .contentRightPadding').css('width',$('.content .contentRight').width()-310);
            }
            $('.productImage').css('left', 700);
        }
        $('.content .scrollable').css('width',$('.contentRightPadding').width());
        $('.contentRightPadding .scrollable').jScrollPane();
        $('#gallery').slideView();
    });
});
$(function() {
    $("#pravda li p").tooltip({
   		offset: [10, 2],
   		effect: 'slide'
	}).dynamic({ bottom: { direction: 'down', bounce: true } });
});
