﻿$(document).ready(function () {
    ManageView(1);
    $('#txtEmailNewsletter').watermark("Twój adres email");
});

var ids = new Array();
ids.push(new PanelArticleShortView('panelMarketFlat', 1, 'lnkFlat'));
ids.push(new PanelArticleShortView('panelMarketComercial', 2, 'lnkComerce'));
ids.push(new PanelArticleShortView('panelNewInvest', 9, 'lnkInvest'));
ids.push(new PanelArticleShortView('panelFinances', 3, 'lnkFinance'));
ids.push(new PanelArticleShortView('panelLaw', 4, 'lnkLaw'));
ids.push(new PanelArticleShortView('panelInterviews', 5, 'lnkInterviews'));
ids.push(new PanelArticleShortView('panelDocuemnts', 6, 'lnkDocuments'));
ids.push(new PanelArticleShortView('panelManuals', 7, 'lnkManuals'));

function SignForNewsletter() {
    var email = $('#txtEmailNewsletter').val();
    WebServices.WS_Offers.SubscribeForNewsletter(email, function (result) {
        alert(result);
    });
}

function PanelArticleShortView(panelId, categoryId, lnkId) {
    this.Id = panelId;
    this.CategoryId = categoryId;
    this.LinkId = lnkId;
}
function ManageView(categoryId) {
    var i = 0;
    for (i; i < ids.length; i++) {
        if (ids[i].CategoryId == categoryId) {
            $('#' + ids[i].Id).css('display', '');
            $('#' + ids[i].LinkId).css('text-decoration', 'underline');
        }
        else {
            $('#' + ids[i].Id).css('display', 'none');
            $('#' + ids[i].LinkId).css('text-decoration', 'none');
        }
    }
    return false;
}
