// JavaScript Document




var imgRot = new Array(3)
imgRot[0] = -3;
imgRot[1] = 2;
imgRot[2] = -4;

$(document).ready(function () {

    var navDuration = 150; //time in miliseconds

    $('img[src$=.png]').addClass('pngimg');

    for (var i = 0; i < 3; i++) {
        $('#bg' + i).rotate(imgRot[i]);
    }

    // rotating backgrounds
    $('a.homelink').hover(function () {
        var linkIndex = $(this).attr('name').charAt(4);
        var targetAngle = imgRot[linkIndex] + hoverRotation(linkIndex);
        $("#bg" + linkIndex).rotate({ animateTo: targetAngle, duration: 500 });
    }, function () {
        var linkIndex = $(this).attr('name').charAt(4);
        var targetAngle = imgRot[linkIndex];
        $("#bg" + linkIndex).rotate({ animateTo: targetAngle, duration: 400 });
    });

    // sliding tabs
    $('.tabmenu a').hover(function () {
        $(this).animate({ height: "33px"}, navDuration);
    }, function () {
        $(this).animate({ height: "29px"}, navDuration);
    });


});

function hoverRotation(index) {
    return (index % 2) ? -4 : 4;
}
