function NewsListActions(id, max) {
    this.ID = id;
    this.size = max;
    this.current = 1;

    document.write("<DIV STYLE='margin-left:10px; margin-top:5px;'><SMALL>Newsliste: ");
    document.write("[ <A ID='"+this.ID+"min' onClick='return "+this.ID+".min();' CLASS=disabled>minimal</A> ] · ");
    document.write("[ <A ID='"+this.ID+"kuerzer' onClick='return "+this.ID+".kuerzer();' CLASS=disabled>verkürzen</A> ] · ");
    document.write("[ <A ID='"+this.ID+"laenger' onClick='return "+this.ID+".laenger();' HREF='#' CLASS=enabled>verlängern</A> ] · ");
    document.write("[ <A ID='"+this.ID+"max' onClick='return "+this.ID+".max();' HREF='#' CLASS=enabled>maximal</A> ]");
    document.write("</SMALL></DIV>");
}

NewsListActions.prototype = {
    link: function(link, flag) {
	var el = document.getElementById(this.ID + link);
	if(flag && el.className == "disabled") {
	    el.setAttribute("href", "#");
	    el.className = "enabled";
	} else if(! flag && el.className == "enabled") {
	    el.removeAttribute("href");
	    el.className = "disabled";
	}
    },
    links: function() {
	this.link('min', this.current > 1);
	this.link('kuerzer', this.current > 1);
	this.link('laenger', this.current < this.size);
	this.link('max', this.current < this.size);

	return false;
    },
    kuerzer: function() {
        if(this.current > 1) {
	    document.getElementById(this.ID+'_'+this.current).style.display = 'none';
	    this.current--;
        }
	if(this.current == 1)
	    this.double_display("");
	return this.links();
    },
    laenger: function() {
        if(this.current == 1)
	    this.double_display("show_duplicates");
        if(this.current < this.size) {
	    document.getElementById(this.ID+'_'+(this.current+1)).style.display = 'block';
	    this.current++;
        }
	return this.links();
    },
    min: function() {
	if(this.current > 1) {
	    for(var i = this.size; i >= 2; i--) {
		document.getElementById(this.ID + '_' + i).style.display = 'none';
	    }
	    this.current = 1;
	    this.double_display("");
	}
	return this.links();
    },
    max: function() {
        if(this.current == 1)
	    this.double_display("show_duplicates");
	if(this.current < this.size) {
	    for(var i = 2; i <= this.size; i++) {
		document.getElementById(this.ID + '_' + i).style.display = 'block';
	    }
	    this.current = this.size;
	}
	return this.links();
    },
    double_display: function(classname) {
	var el = document.getElementById(this.ID+"_1");
	el.className = classname;
    }
}


