
// setShowStatus
// Viser/skjuler DIV element.
// 31-08-2005 - Oprettet
function setShowStatus(whichLayer, blnStatus)
{
	try{
		if (document.getElementById)
		{
			// this is the way the standards work
			var style2 = document.getElementById(whichLayer).style;
			if (blnStatus)
			{
			style2.display = "block";
			}
			else
			{
			style2.display = "none";
			}
		
		}
		else if (document.all)
		{
			// this is the way old msie versions work
			var style2 = document.all[whichLayer].style;
			if (blnStatus)
			{
			style2.display = "block";
			}
			else
			{
			style2.display= "none";
			}
		}
		else if (document.layers)
		{
			// this is the way nn4 works
			var style2 = document.layers[whichLayer].style;
			if (blnStatus)
			{
			style2.display = "block";
			}
			else
			{
			style2.display= "none";
			}
		}
	}catch(e){}
}

// launchCenter
// Åbner PopUp vindue med specifik størrelse centreret.
// 20-03-2006 - Oprettet
function launchCenter(url, name, height, width) {
  var str = "height=" + height + ",innerHeight=" + height;
  str += ",width=" + width + ",innerWidth=" + width;
  if (window.screen) {
    var ah = screen.availHeight - 30;
    var aw = screen.availWidth - 10;

    var xc = (aw - width) / 2;
    var yc = (ah - height) / 2;

    str += ",left=" + xc + ",screenX=" + xc;
    str += ",top=" + yc + ",screenY=" + yc;
  }
  return window.open(url, name, str);
}

//function ShowInWin(url, name, height, width){
//	var str = "height=" + height + ",innerHeight=" + height;
//	str += ",width=" + width + ",innerWidth=" + width;
//	if (window.screen) {
//		var ah = screen.availHeight - 30;
//		var aw = screen.availWidth - 10;
//
//		var xc = (aw - width) / 2;
//		var yc = (ah - height) / 2;
//
//		str += ",left=" + xc + ",screenX=" + xc;
//		str += ",top=" + yc + ",screenY=" + yc;
//	}	
//	return window.open(url, name, str);
//}

/**************************************
» Autor: Jonas Raoni Soares Silva
» Site: http://www.joninhas.ath.cx:666
**************************************/
//Requires http://www.jsfromhell.com/Geral/event-listener
enterAsTab = function(){
	for( var f, i = ( f = document.forms ).length; i; addEvent( f[--i], "keypress", function( evt ){
		var el, l, k = evt.key == 13, e = evt.target;
		if( k && !/textarea|select/i.test( e.type ) && !evt.preventDefault() ){
			for( l = k = ( el = e.form.elements ).length; el[--k] != e; );
			while( !(e = el[ k = ++k * ( k < l ) ]).type || e.disabled );
			//e.focus();
			
			try
			{
			e.focus();
			}
			catch(ex)
			{
			return;
			}
			
		}
	} ) );
};


/*
**************************************
* Event Listener Function v1.4       *
* Autor: Carlos R. L. Rodrigues      *
**************************************
*/
addEvent = function(o, e, f, s){
	var r = o[r = "_" + (e = "on" + e)] = o[r] || (o[e] ? [[o[e], o]] : []), a, c, d;
	r[r.length] = [f, s || o], o[e] = function(e){
		try{
			(e = e || event).preventDefault || (e.preventDefault = function(){e.returnValue = false;});
			e.stopPropagation || (e.stopPropagation = function(){e.cancelBubble = true;});
			e.target || (e.target = e.srcElement || null);
			e.key = (e.which + 1 || e.keyCode + 1) - 1 || 0;
		}catch(f){}
		for(d = 1, f = r.length; f; r[--f] && (a = r[f][0], o = r[f][1], a.call ? c = a.call(o, e) : (o._ = a, c = o._(e), o._ = null), d &= c !== false));
		return e = null, !!d;
    }
};

removeEvent = function(o, e, f, s){
	for(var i = (e = o["_on" + e] || []).length; i;)
		if(e[--i] && e[i][0] == f && (s || o) == e[i][1])
			return delete e[i];
	return false;
};




