﻿$(document).ready(function () {
    initMyAquacity();
});

function loadDialog(title, message) {
    closeDialog();

    $("#messageBox h2").text(title);
    $("#messageText p").text(message);

    $("#messageLayer").css("display", "block");
    $("#messageBox").css("display", "block");
}

function closeDialog() {
    $("#messageBox").css("display", "none");
    $("#messageLayer").css("display", "none");
}

function unsubscribe(guid) {
    $("#messageText").html("<iframe src=\"http://213.81.136.3/unsubscribe/?guid=" + guid + "\" frameborder=\"0\"></iframe>");
}

function initMyAquacity() {
    $('#myAquaCityBtn').click(function () {
        togleBar();
    });

    $('#aquaShop').click(function () {
        showFrame('test');
    });

    $('#aquaParentBarControl_lnkRegister').click(function () {
        showFrame($(this).attr('href'));
    });
}

function showFrame(urlTarget) {
    $('#aquaFrameBg').css('display', 'block');
    $('#aquaFrame').css('display', 'block');
    $('#aquaFrameContent').load('src',urlTarget);
    hideBar();
}

function hideFrame() {
    $('#aquaFrameBg').css('display', 'none');
    $('#aquaFrame').css('display', 'none');
}

function togleBar() {
    if ($('#myAquaCityBar').css('margin-top') == '-153px') {
        showBar();
    }
    else {
        
        hideBar();
    }
}

function showBar() {
    $('#language').css('z-index', '255');
    $('#myAquaCityBar').animate({ 'margin-top': '0px' }, 'slow');
    $('#myAquaCityBg').fadeIn();
}

function hideBar() {
    //$('#myAquaCityBar').animate({ top: 0 }, 1000);
    $('#language').css('z-index', '257');
    $('#myAquaCityBar').animate({ 'margin-top': '-153px' }, 'slow');
    $('#myAquaCityBg').fadeOut();
}
