﻿$(function () {
    $(".button").mouseover(function () {
        $(this).fadeTo(80, 0.50);
    });
    $(".button").mouseout(function () {
        $(this).fadeTo(80, 1);
    });
    $("#bigbtn").mouseover(function () {
        $(this).fadeTo(80, 0.00);
    });
    $("#bigbtn").mouseout(function () {
        $(this).fadeTo(80, 1);
    });
    $("ul.inner li").mouseover(function () {
        $(this).fadeTo(125, 0.00);
    });
    $("ul.inner li").mouseout(function () {
        $(this).fadeTo(75, 1);
    });

    $("#btn_home").mouseover(function () { popup("#pup_home"); });
    $("#btn_about").mouseover(function () { popup("#pup_about"); });
    $("#btn_prod").mouseover(function () { popup("#pup_prod"); });
    $("#btn_res").mouseover(function () { popup("#pup_res"); });
    $("#btn_contact").mouseover(function () { popup("#pup_contact"); });

    $("#btn_home").mouseout(function () { popclear("#pup_home"); });
    $("#btn_about").mouseout(function () { popclear("#pup_about"); });
    $("#btn_prod").mouseout(function () { popclear("#pup_prod"); });
    $("#btn_res").mouseout(function () { popclear("#pup_res"); });
    $("#btn_contact").mouseout(function () { popclear("#pup_contact"); });

    $(".title,.menu,.content").mouseover(function () { headerup() });

    $(".container").mouseover(function () {
        $(this).animate({ top: "-40px" }, 100);
    });

    setInterval(function () {
        getScrollPosition()
    }, 500);
});

function getScrollPosition() {
    y = document.documentElement.scrollTop || document.body.scrollTop;
    if (y > 0) {
        $(".backtop").css("visibility", "visible");
        $(".backtop").css("cursor", "pointer");
        $(".backtop").fadeTo(225, 1);
    }
    else {
        $(".backtop").fadeTo(125, 0);
        $(".backtop").css("cursor", "default");
    }
}

function headerup() {
    $(".container").queue([]);
    $(".container").animate({
        top: "0px"
    }, 100);
    }

function popup(target) {
    $(target).css("visibility", "visible");
    $(target).css("z-index", "6");
    $(target).css("bottom", "-10");
    $(target).fadeTo(0, 0.00);
    $(target).animate({
        opacity: 0.95,
        bottom: "5px"
    }, 180);
}

function popclear(target) {
    $(target).animate({
        opacity: 0.00,
        bottom: "0px"
    }, 100);
    $(target).css("z-index", "2");
}

function Scroll(target) {
    if (target == undefined){ target = 0 }
    $('html,body').animate({ scrollTop: target }, 'fast');
}
