//
//
//	Uhr für Kopfzeile
//



var timerID = null;
var timerRunning = false;

function stopclock(){
    if(timerRunning)
    clearTimeout(timerID);
    timerRunning = false;
}
function startclock(){
    stopclock();
    showtime();
}
function showtime(){
	var theclock = document.getElementById("theclock")
    var now = new Date();
    var hours = now.getHours();
    var minutes = now.getMinutes();
    var seconds = now.getSeconds();
    var timeValue = "" + ((hours > 12) ? hours - 12 : hours);
    var timeValue1 = "" + ((hours < 10) ? "0" : "") + hours;
    timeValue  += ((minutes < 10) ? ":0" : ":") + minutes;
    timeValue1 += ((minutes < 10) ? ":0" : ":") + minutes;
    timeValue  += ((seconds < 10) ? ":0" : ":") + seconds;
    timeValue1 += ((seconds < 10) ? ":0" : ":") + seconds;
    timeValue  += (hours >= 12) ? " P.M." : " A.M.";
	
    theclock.innerHTML = timeValue;
    theclock.innerHTML  = timeValue1;
    timerID = setTimeout("showtime()",1000);
    timerRunning = true;
}
//
//
//	Details zu einem bestimmten Teammitglied einblenden
//
function show_details(elem)
{
	var SHTML = document.getElementById(elem);
	var IHTML = document.getElementById('vax');
	IHTML.innerHTML = SHTML.innerHTML;	
}

//XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
var DDSPEED = 10;
var DDLOWSPEED = 1;
var DDSLOWUPLIMIT = 30;
var DDTIMER = 15;
OriSize = 0;

function showhide(SearchStr,id){
	//window.clearInterval(aktivSL);
	hideall(SearchStr);
	var elem = document.getElementById(id);
		elem.style.overflow = 'visible';
		elem.style.height='auto';
		elem.style.display='block';
		OriSize = elem.offsetHeight;
		//alert(OriSize);
		elem.style.overflow = 'hidden';
		elem.style.height='0px';
		moveDiv(id,SearchStr);
}

function moveDiv(id,SearchStr){
	var mydiv=document.getElementById(id);
	var oldpos = parseInt(mydiv.style.height);
	var newpos= parseInt(mydiv.style.height) + DDSPEED;
	if(oldpos > (OriSize-DDSLOWUPLIMIT)){
		newpos = parseInt(oldpos)+DDLOWSPEED;
	}
	mydiv.style.height = '' + newpos + 'px';
	var ti = setTimeout("moveDiv('"+id+"','" + SearchStr + "')",DDTIMER); 
	if(newpos>OriSize){
		clearTimeout(ti);
 	}
}

	function hideall(SearchStr){
		var tagToSet = 'div';
		var difsInside = document.getElementsByTagName(tagToSet);
		var legCut = SearchStr.length;
		for(var i = 0; i < difsInside.length; i++){
			var thisid = difsInside[i].id;
			if(thisid.substring(0, legCut) == SearchStr){
				difsInside[i].style.display = 'none';
				//ddMenu(thisid,-1);
			}
		}
	}
	

	
	function sendemessage(n){
		var mailurl = n.name;
		//alert(mailurl);
		cleanedurl = mailurl.replace('[at]','@');
		newurl = cleanedurl.replace('[at]','@');
		//alert(cleanedurl);
		document.location.href='mailto:' + newurl;
		
		}
		
	function isValidEmail(str) {
   		return (str.indexOf(".") > 2) && (str.indexOf("@") > 0);
 
	}
//XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
