var mItem = Array();
var mLink = Array();
var sItem = Array();
var sLink = Array();

//Menu data - items, links
mItem[1] = "Editoriale";
mLink[1] = "index.html";
mItem[2] = "Politic";
mLink[2] = "index_stiri.html?tip=2";
mItem[3] = "Economic";
mLink[3] = "index_stiri.html?tip=3";
mItem[4] = "Social";
mLink[4] = "index_stiri.html?tip=4";
mItem[5] = "Sport";
mLink[5] = "index_stiri.html?tip=5";
mItem[6] = "TI & C";
mLink[6] = "index_stiri.html?tip=6";
mItem[7] = "Diverse";
mLink[7] = "index_stiri.html?tip=7";

ref = document.URL;

function writeEditoriale() {
    t = "";
    for (i=1; i < tE.length; i++) {
        if (aE[i] != "") comma=", "; else comma="";
        t +=  "<div class=\"editorial\">";
        t +=  "<a target=\"_blank\" href=\"gotostire.php?url=" + safeURL(lE[i]) + "\">" + tE[i] + "</a>";
        t +=  "<div><i>" + aE[i] + "</i>" + comma + zE[i] + "</div>";
        t +=  "</div>";
    }
    document.writeln(t);
}

function writeTopNews() {
    t = "";
    for (i=1; i<topt.length; i++) {
        t +=  "<div class=\"top5-item\">";
        t +=  "<a href=\"gotostire.php?url=" + safeURL(topl[i]) + "\" target=\"_blank\">" + topt[i] + "</a>";
        t +=  "<p>" + topc[i];
        t +=  "<p class=\"top5-source\"><a href=\"gotostire.php?url=" + safeURL(topl[i]) + "\" target=\"_blank\">(" + topz[i] + ")</a>";
        t +=  "</div>";
    }
    document.writeln(t);
}

function writeStiri(col, tip) {
    t = new Array();
    l = new Array();
    t = (tip==1) ? tI : tE;
    l = (tip==1) ? lI : lE;
    if (col==1) {i1 = 1; i2 = m[tip]} else {i1=m[tip]+1; i2=t.length-1}
    k=0;
    for (i=i1; i<=i2; i++) {
        if (l[i]=="") {
            if (k>0)
                document.writeln("<div class=\"top\"><a href=\"#top\" title=\"Sus\"><img src=\"images/revista-top.gif\"></a></div>");
            document.writeln("<div class=\"newspaper\">"+t[i]+"</div>");
        } else {
            document.writeln("<p>&bull; <a target=\"_blank\" href=\"gotostire.php?url="+safeURL(l[i])+"\">"+t[i]+"</a><br>");
        }
        k++;
    }
    document.writeln("<div class=\"top\"><a href=\"#top\" title=\"Sus\"><img src=\"images/revista-top.gif\"></a></div>");
}

function urlGetParam(param) {
    param += "=";
    url = document.URL;
    pos = url.search(param);
    if (pos==-1) return false;
    url = url.substr(pos+param.length, url.length);
    pos = url.search("[&]");
    param = (pos==-1) ? url.substr(0,url.length) : url.substr(0,pos);
    return param;
}

function safeURL(url) {
    return escape(url);
}
