var bg = '#faf71b';
var bgon = '#ffffc0';

function navBarClick( ref, url ) {
  window.location.href = url;
}

function navBar( ref, over ) {
  if ( over ) {
    ref.style.backgroundColor = bgon;
  }
  else {
    ref.style.backgroundColor = bg;
  }
}

function popitup(url,title,attr)
{
  newwindow=window.open(url,title,attr);
  if (window.focus) (newwindow.focus())
  return false;
}

function popup(mylink, windowname, attr)
{
 if (! window.focus) return true;
 var href;
 if (typeof(mylink) == 'string') href=mylink;
 else href=mylink.href;
 newwindow=window.open(href, windowname, attr);
 newwindow.focus();
 return false;
}

function popup_session() {
 var w = 800; var h = 600; var s = 'yes';
 if ( typeof(popup_session_width) != "undefined" )
	w = popup_session_width;
 if ( typeof(popup_session_height) != "undefined" ) 
	h = popup_session_height;
 if ( typeof(popup_session_scrollbars) != "undefined" ) 
	s = popup_session_scrollbars;
 popup( this, 'vortrag', 'width='+w+',height='+h+',scrollbars='+s );
}

function popup_training() {
 popup( this, 'training', 'width=600,height=450,scrollbars=yes' );
}

function textLimit(field,maxlen)
{
  if (field.value.length > maxlen)
  {
    field.value = field.value.substring(0,maxlen);
    alert('Textgrenze erreicht!');
  }		
}

function ShowCert(sn)
{
  window.open('http://www.trustcenter.de/cgi-bin/Search.cgi?Template=printable&SN='+sn,
	'Zertifikat','width=640,height=480,resizable,scrollbars,status');
}

var m_ = "mailto";
function post(name, dom, tl, params, disp)
{
	var s = mail_e(name,dom,tl);
	if (disp.length == 0) disp = s;
	if (params.length > 0) s+="?"+params;
	document.write('<a href="'+m_+String.fromCharCode(58)+s+'">'+disp+'</a>');
}
var tld_ = new Array()
tld_[0] = "de"; tld_[1] = "com"; tld_[2] = 'edu';
function mail_e(name, dom, tl)
{
	if (dom.length == 0 && tl == 0 ) dom='hp-user-society';
	var s = name+String.fromCharCode(64)+dom;
	if (typeof tl == "number") {
		if (typeof tld_[tl] != 'undefined') s+='.'+tld_[tl]; 
	}
	else s+='.'+tl;
	return s;
}

function button(f,value)
{
  f.value = value;
  f.submit();
  return true;
}
