﻿/// <reference path="jquery-1.2.4.pack.js"/>
/// <reference path="ListItems.js"/>
/// <reference path="newsbar.js"/>
var c = {};
function openWindow(name, url, width, height, scrollbar, resize) {
    var win = window.open(url, name, 'width=' + width + ',height=' + height + ',scrollbars=' + scrollbar + ',resizable=' + resize)
    if (!win) {
        alert('Error Opening window!');
    };
};
function searchfield(el) {
    if (!el.first) {
        el.first = true;
        el.value = "";
    };
};
function loadnews(bxid, id) {
    document.getElementById("srvbox_" + bxid).innerHTML = '<img src="style/load.gif" alt="loading" />';
    $.ajax({
        url: "websrv/getnews.ashx",
        data: { mode: "news", id: id },
        success: function(data) { document.getElementById("srvbox_" + bxid).innerHTML = data; },
        cache : false
    });
};
function addload(bxid, id) {
    if(!window.list){
        window.list = new generic.list();
    };
    window.list.add({ bxid: bxid, id: id });
};
var nv, srvid;
window.onload = function() {
    if (window.list) {
        for (var i = 0; i < window.list.count(); i++) {
            loadnews(window.list.getProperty(i, "bxid"), window.list.getProperty(i, "id"));
        };
    };
    var serviceId = "";
    if (srvid)
        serviceId = srvid;
    $.ajax({
        url: "websrv/getnews.ashx",
        data: { mode: "last", service: serviceId },
        success: function(data) {
            nv = new newsbar("nv", "khheader_left_menu_b", 25, 2000);
            nv.setData(data);
            nv.init();
        },
        error: function(xml, status, err) {
            alert(err + ":" + status);
        },
        dataType: "json",
        cache: false
    });
    if (c.getComments) {
        c.getComments();
    };
};