//
//	DHTML-Bibliothek 
//	from Selfhtml 8.0
//

var DHTML = 0, DOM = 0, MS = 0, NS = 0, OP = 0;

function DHTML_init() 
{

 if (window.opera) 
 {
     OP = 1;
 }
 if(document.getElementById) 
 {
   DHTML = 1;
   DOM = 1;
 }
 if(document.all && !OP) 
 {
   DHTML = 1;
   MS = 1;
 }
if(document.layers && !OP) 
{
   DHTML = 1;
   NS = 1;
 }
}

function getElem(p1,p2,p3) 
{
 var Elem;
 if(DOM) 
 {
   if(p1.toLowerCase()=="id") 
   {
     if (typeof document.getElementById(p2) == "object")
     Elem = document.getElementById(p2);
     else Elem = void(0);
     return(Elem);
   }
   else if(p1.toLowerCase()=="name") 
   {
     if (typeof document.getElementsByName(p2) == "object")
     Elem = document.getElementsByName(p2)[p3];
     else Elem = void(0);
     return(Elem);
   }
   else if(p1.toLowerCase()=="tagname") 
   {
     if (typeof document.getElementsByTagName(p2) == "object" || (OP && typeof document.getElementsByTagName(p2) == "function"))
     Elem = document.getElementsByTagName(p2)[p3];
     else Elem = void(0);
     return(Elem);
   }
   else return void(0);
 }
 else if(MS) 
 {
   if(p1.toLowerCase()=="id") 
   {
     if (typeof document.all[p2] == "object")
     Elem = document.all[p2];
     else Elem = void(0);
     return(Elem);
   }
   else if(p1.toLowerCase()=="tagname") 
   {
     if (typeof document.all.tags(p2) == "object")
     Elem = document.all.tags(p2)[p3];
     else Elem = void(0);
     return(Elem);
   }
   else if(p1.toLowerCase()=="name") 
   {
     if (typeof document[p2] == "object")
     Elem = document[p2];
     else Elem = void(0);
     return(Elem);
   }
   else return void(0);
 }
 else if(NS) 
 {
   if(p1.toLowerCase()=="id" || p1.toLowerCase()=="name") 
   {
   if (typeof document[p2] == "object")
     Elem = document[p2];
   else Elem = void(0);
     return(Elem);
   }
   else if(p1.toLowerCase()=="index") 
   {
    if (typeof document.layers[p2] == "object")
     Elem = document.layers[p2];
    else Elem = void(0);
     return(Elem);
   }
   else return void(0);
 }
}


DHTML_init();

//
// Compatibility Functions
//

var _x = 0;
var _y = 1;

var _visible = 1;
var _hidden = 0;

// outer html
function _setOuterHTML (el, html)
{
	if (!el) return;
	
	if (DOM || MS)
	{
		el.outerHTML = html;
		return;
	} else if (NS)
	{
		alert ( 'SET OUTER HTML FAILED' );
		return;
	}
	alert ("YOUR BROWSER IS NOT SUPPORTED YET");
}

function setOuterHTML (id, html)
{
	var el = getElem ('id', id, 0);
	
	_setOuterHTML (el, html);
}

function _getOuterHTML (el)
{
	if (!el) return 0;
	
	if (DOM || MS)
	{
		return el.outerHTML;
	} else if (NS)
	{
		alert ( 'SET OUTER HTML FAILED' );
		return 0;
	}
	alert ("YOUR BROWSER IS NOT SUPPORTED YET");
}

function getOuterHTML (id)
{
	var el = getElem ('id', id, 0);
	
	return _getOuterHTML (el);
}


// inner html
function _setInnerHTML (el, html)
{
	if (!el) return;
	
	if (DOM || MS)
	{
		el.innerHTML = html;
	} else if (NS)
	{
		alert ( 'SET INNER HTML FAILED' );
	}
}

function setInnerHTML (id, html)
{
	var el = getElem ('id', id, 0);
	
	_setInnerHTML (el, html);
}

function _getInnerHTML (el)
{
	if (!el) return 0;
	
	if (DOM || MS)
	{
		return el.innerHTML;
	} else if (NS)
	{
		alert ( 'GET INNER HTML FAILED' );
		return 0;
	}
}

function getInnerHTML (id)
{
	var el = getElem ('id', id, 0);
	
	return _getInnerHTML (el);
}

// visibility
function _getVisibility (el)
{
	if (!el) return;
		
	if (DOM || MS)
	{
		return el.style.visibility;
	} else if (NS)
	{
		return el.visibility;
	}	
	alert ("YOUR BROWSER IS NOT SUPPORTED YET");
}

function getVisibility (id)
{
	var el = getElem ('id', id, 0);
	
	return _getVisibility (el);
}

function _setVisibility (el, vis)
{
	if (!el) return;

	switch (vis)
	{
		case 0: vis = 'hidden';
				break;
				
		case 1: vis = 'visible';
				break;
	}	
		
	if (DOM || MS)
	{
		el.style.visibility = vis;
		return;
	} else if (NS)
	{
		el.visibility = vis;
		return;
	}	
	alert ("YOUR BROWSER IS NOT SUPPORTED YET");
}

function setVisibility (id, vis)
{
	var el = getElem ('id', id, 0);
	
	_setVisibility (el, vis);
}

// Z-Index
function _getZIndex (el)
{
	if (!el) return;
		
	if (DOM || MS)
	{
		return el.style.zIndex;
	} else if (NS)
	{
		return el.zIndex;
	}	
	alert ("YOUR BROWSER IS NOT SUPPORTED YET");
}

function getZIndex (id)
{
	var el = getElem ('id', id, 0);
	
	return _getZIndex (el);
}

function _setZIndex (el, ix)
{
	if (!el) return;

	if (DOM || MS)
	{
		el.style.zIndex = ix;
		return;
	} else if (NS)
	{
		el.zIndex = ix;
		return;
	}	
	alert ("YOUR BROWSER IS NOT SUPPORTED YET");
}

function setZIndex (id, ix)
{
	var el = getElem ('id', id, 0);
	
	_setZIndex (el, ix);
}

// position
function _getPosition (el)
{
	if (!el) 
		return [0, 0];

		// evaluate coordinates of the upper left corner
	if (DOM || MS)
	{
		var rx = 0;
		var ry = 0;
		
		do
		{
			rx += el.offsetLeft;
			ry += el.offsetTop;
			el = el.offsetParent;
		} while (el);
		
		return [rx, ry];
	} else if (NS)
	{
		alert ("NETSCAPE SUPPORT IS CURRENTLY BEING IMPLEMENTED");
		return;
	}
	
	alert ("YOUR BROWSER IS NOT SUPPORTED YET");
}


function getPosition (id)
{
	var el = getElem ('id', id, 0);

	return _getPosition (el);
}

function _setPosition (el, pos)
{
	if (!el) return;

	if (DOM || MS)
	{
		el.style.left = pos[_x];
		el.style.top = pos[_y];
		return;
	} else if (NS)
	{
		alert ("NETSCAPE SUPPORT IS CURRENTLY BEING IMPLEMENTED");
		return;
	}
	
	alert ("YOUR BROWSER IS NOT SUPPORTED YET");
}


function setPosition (id, pos)
{
	var el = getElem ('id', id, 0);

	_setPosition (el, pos);
}

// size
function _getSize(el)
{
	if (!el) 
		return [0, 0];

		// evaluate coordinates of the upper left corner
	if (DOM || MS)
	{
		return [el.offsetWidth, el.offsetHeight];
	} else if (NS)
	{
		alert ("NETSCAPE SUPPORT IS CURRENTLY BEING IMPLEMENTED");
		return;
	}
	
	alert ("YOUR BROWSER IS NOT SUPPORTED YET");
}


function getSize (id)
{
	var el = getElem ('id', id, 0);

	return _getSize (el);
}

function _setSize (el, size)
{
	if (!el) return;

	if (DOM || MS)
	{
		el.style.width = size[_x];
		el.style.height = size[_y];
		return;
	} else if (NS)
	{
		alert ("NETSCAPE SUPPORT IS CURRENTLY BEING IMPLEMENTED");
		return;
	}
	
	alert ("YOUR BROWSER IS NOT SUPPORTED YET");
}


function setSize (id, size)
{
	var el = getElem ('id', id, 0);

	_setSize (el, size);
}



function _getColor (el)
{
	if (!el) return;

	if (DOM || MS)
	{		
		return el.style.color;
	} else if (NS)
	{		
		return el.color;
	}
	
	alert ("YOUR BROWSER IS NOT SUPPORTED YET");
}

function getColor (id)
{
	var el = getElem ('id', id, 0);
	
	return _getColor (el);
}

function _setColor (el, col)
{
	if (!el) return;

	if (DOM || MS)
	{		
		el.style.color = col;
		return;
	} else if (NS)
	{		
		el.color = col;
		return;
	}
	
	alert ("YOUR BROWSER IS NOT SUPPORTED YET");
}

function setColor (id, col)
{
	var el = getElem ('id', id, 0);
	
	_setColor (el, col);
}

function _getBGColor (el)
{
	if (!el) return;

		// evaluate coordinates of the upper left corner
	if (DOM || MS)
	{		
		return el.style.backgroundColor;
	} else if (NS)
	{		
		return el.backgroundColor;
	}
	
	alert ("YOUR BROWSER IS NOT SUPPORTED YET");
}

function getBGColor (id)
{
	var el = getElem ('id', id, 0);
	
	return _getColor (el);
}

function _setBGColor (el, col)
{
	if (!el) return;

		// evaluate coordinates of the upper left corner
	if (DOM || MS)
	{		
		el.style.backgroundColor = col;
		return;
	} else if (NS)
	{		
		el.backgroundColor = col;
		return;
	}
	
	alert ("YOUR BROWSER IS NOT SUPPORTED YET");
}

function setBGColor (id, col)
{
	var el = getElem ('id', id, 0);
	
	_setColor (el, col);
}


function toSt(n)
{
	 s="";	 
	 if(n<10) s+="0";	 
	 return s+n.toString();
}
 
function countdown()
{
	 d=new Date();
	 count=Math.floor((eventdate.getTime()-d.getTime())/1000);

	 if (count<=0) {
		 setInnerHTML ('count_secs', '');
		 setInnerHTML ('count_mins', '');
		 setInnerHTML ('count_hours', '');
		 setInnerHTML ('count_days', 'event is live!');
	
		 setTimeout("countdown()",500);
		 return;
	 }
	 setInnerHTML ('count_secs', toSt(count%60)+' sec');

	 count=Math.floor(count/60);
	 setInnerHTML ('count_mins', toSt(count%60)  +'min ');

	 count=Math.floor(count/60);
	 setInnerHTML ('count_hours', toSt(count%24)  +'h ');

	 count=Math.floor(count/24);
	 setInnerHTML ('count_days', toSt(count) + ' Tage ');    
  
	 setTimeout("countdown()",500);
 }
