﻿$(document).ready(function () {

    $("#loginArrow").click(function (event) {
        event.preventDefault();
        $('#headerLogin').slideToggle();
    });

    $(".loginDisplay").click(function (event) {
        //event.preventDefault();
        $('#headerLogin').slideToggle();
    });

    $("#includedButton").click(function (event) {
        event.preventDefault();
        if ($("#container2").is(":hidden")) {
            $(this).addClass('downButton');
        } else {
            $(this).removeClass('downButton');
        }

        $('#container2').slideToggle();
    });
    
    // If user already logged in send them to My Headspace - If not logged in show register popup
    $('.getStartedPopup').click(function (event) {
        event.preventDefault();
        if($('#loginArrow').length > 0){
            $.colorbox({ iframe: true, href: "/pages/account/register.aspx?nt=1" });
        } else {
            window.location = "/pages/account/myheadspace.aspx";
        }
    });

    $('a').smoothScroll({ speed: 600 });

    $("#closeButton").click(function (event) {
        $('#introVideo').hide();
        $('#introVideo iframe').attr('src', '');
    });

});

$.colorbox.settings.width = 675;
$.colorbox.settings.height = 500;
$.colorbox.settings.opacity = 0.5;

// DONT PUT ME IN THE DOCUMENT READY
function ColorBoxCloser(sURL) {
    $.colorbox.close(); // normal color box close
    window.location = sURL;
}
