﻿function ShowStickyBarPopup()
{
    RePosition();
    if ($(".stickybar .popup").css("display") == "none")
    {
        $(".stickybar .popup").slideDown();
    }
    else
    {
        $(".stickybar .popup").slideUp();
        $(".stickybar .labSubscriptionResult").html("");
        $(".stickybar .txtEmail").val("");
        $(".stickybar .txtEmail").blur();
    }

}

function ShowStickyBarPopupAfterDelay(milliseconds)
{
    RePosition();
    if ($(".stickybar .popup").css("display") == "none") {
        setTimeout(function() {
            $(".stickybar .popup").slideDown();
        }, milliseconds);
    }
    else {
        $(".stickybar .popup").slideUp();
        $(".stickybar .labSubscriptionResult").html("");
        $(".stickybar .txtEmail").val("");
        $(".stickybar .txtEmail").blur();
    }
}

function HideStickyBarPopup()
{
    ShowStickyBarPopup();
}

function HideStickyPopup() {
    ShowStickyBarPopup();
}

function Subscribe()
{
    //-- Omniture events --//	
    var useParent = false;
    if (typeof (s_gi) == 'undefined')
    {
        s_gi = parent.s_gi;
        useParent = true;
    }
    if (useParent)
        s_account = parent.s_account;

    var s = s_gi(s_account);

    s.linkTrackVars = 'events';
    s.linkTrackEvents = 'event14';
    s.events = 'event14';
    s.eVar11 = "e-boutique";
    s.tl(true, 'o');

    return true;
}

function RePosition()
{
    if (navigator.platform == 'iPad' || navigator.platform == 'iPhone' || navigator.platform == 'iPod')
    {
        $(".stickybar").css("position", "static");
        $(".stickybar .content .popup").css("position", "absolute");
        $(".stickybar .content .popup").css("bottom", "auto");
        //$(".stickybar .content .popup").css("left", "auto");
        $(".stickybar .content .popup").css("margin-top", "-248px");
        $(".stickybar .content .popup").css("margin-left", "10px");
    }
}

$(function ()
{
    RePosition();
}
);

function OnRequestBeginModuleStickyBar(sender, args) {
    var postbackElement = args.get_postBackElement();
    if (postbackElement.id.indexOf("btnSubscribe") != -1) {
        $("[id$='btnSubscribe']").css("display", "none");
        $("#imgStickyBarLoader").css("display", "");
    }


}


function OnRequestEndModuleStickyBar(sender, args) {
    $("#imgStickyBarLoader").css("display", "none");
    $("[id$='btnSubscribe']").css("display", "");
}
