﻿var xmlHttp = null;
var xmlHttpTwo = null;

function loads() {
    News();
    Jobs();
}
function News() {
    xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
    xmlHttp.open("post", "../ashx/DefaultNews.ashx", false);
    xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded;charset=utf-8");
    xmlHttp.onreadystatechange = renewsfun;
    xmlHttp.send(null);
}

function renewsfun() {
    if (xmlHttp.readyState == 4) {
        //alert(xmlHttp.status);
        if (xmlHttp.status == 200) {
            var json = eval('(' + xmlHttp.responseText + ')');
            var table = document.getElementById("DefNewsTable");
            for (var i = 0; i < json.length; i++) {
                table.insertRow(0);
                table.rows[0].style.height = "16px";
                table.rows[0].insertCell(0);
                table.rows[0].cells[0].innerHTML = "<img src='Images/li.gif' />";
                table.rows[0].cells[0].style.width = "8px";
                table.rows[0].insertCell(1);

                table.rows[0].cells[1].style.width = "70%";
                table.rows[0].cells[1].innerHTML = "<a href='../NewsCenter/NewsDetail.aspx?Id=" + json[i].ArticleId + "' target=_black >" + json[i].ArticleTitle + "</a>";
                table.rows[0].insertCell(2)
                table.rows[0].cells[2].innerHTML = "&nbsp;" + json[i].CreationDate;

            }
            // document.getElementById("divDefNews").appendChild(table);
        }
    }
}

function Jobs() {
    xmlHttpTwo = new ActiveXObject("Msxml2.XMLHTTP");
    xmlHttpTwo.open("post", "../ashx/DefaultJobs.ashx", false);
    xmlHttpTwo.setRequestHeader("Content-type", "application/x-www-form-urlencoded;charset=utf-8");
    //alert("hhd");DefJobsTable
    xmlHttpTwo.onreadystatechange = rejobsfun;
    xmlHttpTwo.send(null);
}

function rejobsfun() {
    if (xmlHttpTwo.readyState == 4) {
        //alert(xmlHttpTwo.status);
        if (xmlHttpTwo.status == 200) {
            var table = document.getElementById("DefJobsTable");
            var json = eval('(' + xmlHttpTwo.responseText + ')');
           // alert(json.length);
             for (var i = 0; i < json.length; i++) {
                 table.insertRow(0);
                 table.rows[0].style.height = "16px";
                 table.rows[0].insertCell(0);
                 table.rows[0].cells[0].innerHTML = "<img src='Images/li.gif' />";
                 table.rows[0].cells[0].style.width = "8px";
                 table.rows[0].insertCell(1);

                 table.rows[0].cells[1].style.width = "70%";
                 table.rows[0].cells[1].innerHTML = "<a href='../ManPowerWeb/JobDetails.aspx?Id=" + json[i].ArticleId + "' target=_black >" + json[i].ArticleTitle + "</a>";
                 table.rows[0].insertCell(2)
                 table.rows[0].cells[2].innerHTML = "&nbsp;" + json[i].CreationDate;
             }

        }
     }
}
