﻿$(document).ready(function () {
    // Placeholdes in form
    $(".textField", "#formContainer").placeHolder();
    // Send button click animation
    $(".btnSend").bind("mousedown", function () { $(this).css("background-position", "0 -28px"); })
        .bind("mouseup", function () { $(this).css("background-position", ""); });
    // Handle radiobuttons as gfx
    $(".radioButtons", "#formContainer").css("display", "none")
        .after('<div id="radioSpans"><span class="consulting" rel="Consulting"></span><span class="solutions" rel="Solutions"></span><span class="nearshoring" rel="Nearshoring"></span></div>');
    $("#radioSpans span").live("click", function () {
        $("#radioSpans span").removeClass("selected");
        $(this).addClass("selected");
        $(".sel" + $(this).attr("rel") + " input", "#contactForm").click();
    });
    // Show nearshoring story + overlay
    $("a.nearshoring", "#container").click(function () {
        $("#overlayBackground").fadeIn("fast");
        $("#overlay").fadeIn("fast");
    });
    // Close nearshoring story + overlay
    $("img.closer", "#nearshoringStory").click(function () {
        $("#overlayBackground").fadeOut("fast");
        $("#overlay").fadeOut("fast");
    });
    // Show case story
    $("#caseLink a").mousedown(function () {
        $(this).css("background-position", "0 -28px");
    })
        .mouseup(function () {
            $(this).css("background-position", "");
        })
        .click(function () {
            $(this).parent().hide();
            $("#nearshoringCase").fadeIn("fast");
        });
    // Close nearshoring story
    $("img.closer", "#nearshoringCase").click(function () {
        $("#nearshoringCase").fadeOut("fast");
        $("#caseLink").show();
    });
});
