// (c) M.Boerger: mailto:marcus.boerger@post.rwth-aachen.de
// See Copyright-Info at / Beachten Sie Copyright-Info in Seite
// http://www.marcus-boerger.de/js/DynamicJavaScript.html
// Scriptname: open_href.js

// Used for menus

var md_open_last = '';
var md_open_timer= null;

function md_open_href(_href,_target){
  if (!_target) _target='RIGHT';
  if (_href!=md_open_last) {
    md_open_last = _href;
    if (md_open_timer) window.clearTimeout(md_open_timer);
    md_open_timer = window.setTimeout("md_open_last=''",500);
    if (_target=='_blank') {
      window.open(_href,_target);
    } else if (_target=='_top') {
      window.top.location.href = _href;
    } else if (_target.length) {
    		if (window.parent.frames[_target])
	        window.parent.frames[_target].location = _href;
	      else
	      	window.open(_href,_target);
    } else {
        window.location.href = _href;
    }
  }
}

function md_bgcolor(idx,faidx,cnt,color,textdeco) {
  div = 'd'+idx;//.toString();
  if ( DOM) {
    document.getElementById(div).style.backgroundColor = color;
    for(n=0;n<cnt;n++){
      aidx=faidx+n;
      anc = 'a'+aidx;//.toString();
      if ( document.getElementById(anc)) {
        with (document.getElementById(anc).style) {
          textDecoration = textdeco;
          if ( IE6) {
            if( color!='#008000') document.getElementById(anc).backupColor = document.getElementById(anc).currentStyle.color;
            if ( textdeco=='') {
              color = document.getElementById(anc).backupColor;
            } else {
              color = '#008000';
            }
          }
        }
      }
    }
  } else if ( IE4) {
    document.all[div].style.backgroundColor = color;
    for(n=0;n<cnt;n++){
      aidx=fiadx+n;
      anc = 'a'+aidx;//.toString();
      if ( document.all[anc].style) {
        with (document.all[anc].style) {
          textDecoration = textdeco;
        }
      }
    }
  }
}

function md_hover(idx,href,name) {
  if (!name.length) name = window.defaultStatus;
  window.status = name;
  if (href) md_bgcolor(idx,idx,1,'#FFFFE1','underline');
}

function md_leave(idx) {
  md_bgcolor(idx,idx,1,'','');
  window.status = window.defaultStatus;
}

function md_hover_a(idx,aidx,href,name) {
  if (!name.length) name = window.defaultStatus;
  window.status = name;
  if (href){
    md_bgcolor(idx,aidx,1,'#FFFFE1','underline');
  }
}

function md_hover_n(idx,cnt,href,name) {
  if (!name.length) name = window.defaultStatus;
  window.status = name;
  if (href){
    md_bgcolor(idx,idx,cnt,'#FFFFE1','underline');
  }
}

function md_leave_n(idx,cnt) {
  md_bgcolor(idx,idx,cnt,'','');
  window.status = window.defaultStatus;
}

function md_start() {
  window.status = document.title;
  window.defaultStatus = document.title;
}