﻿$(document).ready(function(){
    $('input').focus(function() {
        $(this).addClass("input-form-focus");
    })
    $('input').blur(function() {
        $(this).removeClass("input-form-focus");
    })
    $('textarea').focus(function() {
        $(this).addClass("area-focus");
    })
    $('textarea').blur(function() {
        $(this).removeClass("area-focus");
    })
});

function toggleMenu(div, idImg, image) {
    if ($('#' + div).is(':visible'))
        $('#' + idImg).attr('src', '/images/' + image + '-close.png');
    else
        $('#' + idImg).attr('src', '/images/' + image + '-open.png');
    $('#' + div).slideToggle();
    return false;
}

function scroll(obj, offset) {
    if (typeof obj.pathname == 'undefined') {
        var $target = $(obj);
    } else if (location.pathname.replace(/^\//, '') == obj.pathname.replace(/^\//, '') && location.hostname == obj.hostname) {
        var $target = $(obj.hash);
        $target = $target.length && $target || $('[name=' + obj.hash.slice(1) + ']');
    }
    if ($target.length) {
        var targetOffset = $target.offset().top + offset;
        $('html,body').stop().animate({ scrollTop: targetOffset }, 500, 'swing');
        return false;
    }
}