// decrypt helper function
function G21_decryptCharcode(n,start,end,offset)
	{
	n = n + offset;
	if (offset > 0 && n > end)	{
		n = start + (n - end - 1);
	} else if (offset < 0 && n < start)	{
		n = end - (start - n - 1);
	}
	return String.fromCharCode(n);
	}
// decrypt string
function G21_decryptString(enc,offset)
	{
	var dec = "";
	var len = enc.length;
	for(var i=0; i < len; i++)	{
		var n = enc.charCodeAt(i);
		if (n >= 0x2B && n <= 0x3A)	{
			dec += G21_decryptCharcode(n,0x2B,0x3A,offset);	// 0-9 . , - + / :
		} else if (n >= 0x40 && n <= 0x5A)	{
			dec += G21_decryptCharcode(n,0x40,0x5A,offset);	// A-Z @
		} else if (n >= 0x61 && n <= 0x7A)	{
			dec += G21_decryptCharcode(n,0x61,0x7A,offset);	// a-z
		} else {
			dec += enc.charAt(i);
		}
	}
	return dec;
	}
// decrypt spam-protected emails
function G21_uncryptMailto(s)
	{
	location.href = G21_decryptString(s,-2);
	}


///////////////////////////////////////////////////////////////////////


function openWindow(url,w,h) { // V1.0 copyright Grfaix21.de
       l = screen.width/2-50;
       t = screen.height/2-150;
       w = eval(w) + 16;
       options = "width="+w+",height="+h+",left="+l+",top="+t+",menubar=yes,resizable=yes,scrollbars=yes,status=yes";
       Druckwindow = window.open(url,'Details',options);
       Druckwindow.focus();
	}


///////////////////////////////////////////////////////////////////////


function Druckansicht(url,w,h)
	{ // V1.0 copyright Grfaix21.de
	l = screen.width/2-50;
	t = screen.height/2-150;
	w = eval(w) + 16;
	options = "width="+w+",height="+h+",left="+l+",top="+t+",menubar=yes,resizable=yes,scrollbars=yes,status=yes";
	Druckwindow = window.open(url,'Details',options);
	Druckwindow.focus();
	}


///////////////////////////////////////////////////////////////////////


function toggleFinanceInfo(id)
	{
	theLayer = document.getElementById(id);

	if(theLayer.style.display == 'none')
		{ theLayer.style.display = 'block'; }
	else
		{ theLayer.style.display = 'none'; }
	}


///////////////////////////////////////////////////////////////////////


//mouse down on dragged DIV element   
function startdrag(t, e) {   
    if (e.preventDefault) e.preventDefault(); //line for IE compatibility   
    e.cancelBubble = true;   
	// parent Element verschieben
	t.parentNode.nodeType==3 ? l=t.parentNode.parentNode : l=t.parentNode;

 	window.document.onmousemoveOld = window.document.onmousemove;   
    window.document.onmouseupOld = window.document.onmouseup;   
    window.document.onmousemove=dodrag;   
    window.document.onmouseup=stopdrag;   
    window.document.draged = l;   

	l.dragX = e.clientX;   
    l.dragY = e.clientY;   
    return false;   
}   
//move the DIV   
function dodrag(e) {   
       
    if (!e) e = event; //line for IE compatibility   
    t = window.document.draged;   
    t.style.left = (t.offsetLeft + e.clientX - t.dragX)+"px";   
    t.style.top = (t.offsetTop + e.clientY - t.dragY)+"px";   
    t.dragX = e.clientX;   
    t.dragY = e.clientY;   
    return false;   
}   
//restore event-handlers   
function stopdrag() {   
   window.document.onmousemove=window.document.onmousemoveOld;   
   window.document.onmouseup=window.document.onmouseupOld;   
}   

