// JavaScript-Datei für das WEBERG-Newspanel

// Einzel-Markierung einer Nachricht
function row_marker(row) {
  document.getElementById(row).bgColor = '#dddddd';
  return false;
}

// Markierung aller Nachrichten
function row_marker_all() {
  allRows = document.getElementsByTagName('tr');
  if (allRows != null) {
    timer = document.hider.hide.value;
    now = document.hider.now.value;
    for(var i=0; i<allRows.length; i++) {
      if (allRows[i].id.substr(0,1) == '_') {
        if (timer == 'all') {
          allRows[i].bgColor = '#dddddd';
        } else if (timer > 0) {
          t = 60*60*timer;
          if (timer_array[(allRows[i].id)] < now-t) {
            allRows[i].bgColor = '#dddddd';
          }
        }
      }
    }
    document.hider.submit();
  }
  return false;
}


// Funktion für die sofortige Weiterleitung bei Auswahländerung
function go(selectedObj) {
  var t = selectedObj.options[selectedObj.selectedIndex].value;
  if (t != "") {
    window.content.document.location.href = "go.php?uri=" + t;
  }
}


// Funktion zum Einblenden der Konfiguration
function toggle_configuration() {
  if (show_configuration) {
    get_element('conf_options').style.display = 'block';
    show_configuration = 0;

  } else {
    get_element("conf_options").style.display = 'none';
    show_configuration = 1;
  }
}


// Funktion zum Ermitteln der Layer
function get_element(e, f) {
  if (document.layers) {
    f = (f) ? f : self;
    if (f.document.layers[e]) {
      return f.document.layers[e];
    }
    for (W=0; i<f.document.layers.length; W++) {
      return (get_element(e, f.document.layers[W]));
    }
  }
  if (document.all) {
    return document.all[e];
  }
  return document.getElementById(e);
}


// Extender-Funktionen
// Funktion zum Ausblenden aller Extended-News
function init_extended() {
	allExtender = document.getElementsByTagName('div');
	if (allExtender != null)	{
		for (i=0; i<allExtender.length; i++) {
      if (allExtender[i].id.substr(0,3) == '_ex') {
        allExtender[i].style.display = 'none';
      }
		}
	}
}


document.onclick = function( e ) {
	var o = ( e == null ) ? window.event.srcElement : e.target;
	t = o.tagName.toUpperCase();
	if (t == "IMG" && (o.src.indexOf("p.png") != -1 || o.src.indexOf("m.png")!= -1)) {
		toggle_extender(o);
	}
}


function toggle_extender(o) {
	var container = document.getElementById('_' + o.id);
  if (container != null) {
    if (o.src.indexOf('logos/p.png') != -1)	{
      container.style.display = 'block';
      o.src = 'logos/m.png';
    } else {
   	  container.style.display = 'none';
      o.src = 'logos/p.png';
	  }
  }
}


// Eingaben für Denic optimieren
function denic_check() {
  var t = document.denic.domain.value.toLowerCase();
  var l = t.length;
  if (t.substring(l-3) == '.de') {
    t = t.substring(0, l-3);
  }
  document.denic.domain.value = t;
  return true;
}


// Eingaben für Knipp optimieren
function knipp_check() {
  var t = document.knipp.domainname.value.toLowerCase();
  document.knipp.domainname.value = t;
  return true;
}


function show_short(s){
  return overlib('<iframe src="detail.php?subject='+s+'" frameborder="0" marginheight="1px" marginwidth="1px" width="165"></iframe>', STICKY, MOUSEOFF, WIDTH, 150, HEIGHT, 100, WRAP);
  return true;
}

