﻿//for handling the NewsBox Control
function GetNext(number, isFirst) {
    if (strFileId && objThis) {
        var handleComplete = function(objRequest) {
            if (objRequest.readyState == 4) {
                
            }
        }
        var objRequest = GetXmlHttpRequest();
        objRequest.open("GET", "GetNews.aspx?mode=next&first=" + strFileId, true);
        objRequest.onreadystatechange = function() { handleComplete(objRequest); };
        objRequest.send(null);
    }
    return false;
}

function InitNews() {
   if (window.location.href.lastIndexOf("Job") > window.location.href.indexOf("Index")
            || window.location.href.lastIndexOf("Stellenangebote") > window.location.href.indexOf("Home")
            || window.location.href.lastIndexOf("OnlineFormular") > window.location.href.indexOf("Home")) {
        ShowJobs();
    }
    else if (window.location.href.lastIndexOf("Home") > window.location.href.indexOf("Index")
                && window.location.href.indexOf("Index") >= 0) {
        ShowNews();
    }
    else {
        HideNews();
    }
}

function HideNews() {
    if (_("newsContent")) {
        var news = _("newsContent");
        news.style.display = "none";
        _("newsHeader").removeAttribute("class");
        _("newsHeader").className = "";
        if (_("newsHeader")) _("newsHeader").onclick = function() { ShowNews(); };
    }
}

function ShowNews() {
    HideJobs();
    if (_("newsContent")) {
        var news = _("newsContent");
        news.style.display = "block";
        _("newsHeader").setAttribute("class", "open");
        _("newsHeader").className = "open";
        if (_("newsHeader")) _("newsHeader").onclick = function() { HideNews(); };
    }
}

function GetNext() {
    
}

function GetPrevious() { 

}

function ShowJobs() {
    HideNews();
    if (_("jobContent")) {
        var jobs = _("jobContent");
        jobs.style.display = "block";
        _("jobsHeader").setAttribute("class", "open");
        _("jobsHeader").className = "open";
        if (_("jobsHeader")) _("jobsHeader").onclick = function() { HideJobs(); };
    }
}

function HideJobs() {
    if (_("jobContent")) {
        var jobs = _("jobContent");
        jobs.style.display = "none";
        _("jobsHeader").removeAttribute("class");
        _("jobsHeader").className = "";
        if (_("jobsHeader")) _("jobsHeader").onclick = function() { ShowJobs(); };
    }
}

