var allSupport = 1;//(document.all!=null || window.sidebar!=null);
var time_out;
var ns6 = document.getElementById&&!document.all?1:0;
var ie = document.all?1:0;
var ns4 = document.layers?1:0;
var dom = document.getElementById?1:0;
var time_out;

//document.onclick = closePopUp;

if(top!=self)
  top.location=self.location;

function setStatus(txt) {
  if(txt==0) txt="akad. Corps Hellas zu Wien";
  window.status = txt;
}
function scrolltop() {
	window.scrollTo(0,0);
}

function setVis(element,zeige) {
  if(zeige==1) {
    element.style.visibility = "visible";
  }
  else {
    element.style.visibility = "hidden";
  }
}
function mov(th,color)
{
	if(!color) color = "#F7D7A5";
	th.style.backgroundColor = color;
  th.style.color = "#633084";
}
function mou(th)
{
	th.style.backgroundColor = "";
  th.style.color = "";
}

var aktDropDown,dropDownDest,dropDownTyp,selDrpDwnArr;
function zeigeDropDown(id,el)
{
  if (selDrpDwnArr!=null) {
	  id = selDrpDwnArr[document.getElementById(selDrpDwnEl).value][id];
  }
  window.clearTimeout(time_out);
  aktDropDown = document.getElementById("divDropDown"+id);
  dropDownDest = document.getElementById(el);
	dropDownDest.focus();
  setPosition(aktDropDown,getOffset(dropDownDest,"Left"),getOffset(dropDownDest,"Top") + dropDownDest.offsetHeight+1);
  aktDropDown.style.width = dropDownDest.offsetWidth + 16;
  aktDropDown.style.visibility = "visible";
}
function hideDropDown()
{
  if(aktDropDown) {
    aktDropDown.style.visibility = "hidden";
  }
}

function getDrpDwnVal(tmpName)
{
	if(dropDownDest.drpDwnTyp==0) {
	  dropDownDest.firstChild.nodeValue = tmpName;
  }
  else if(dropDownDest.drpDwnTyp==1) {
	  dropDownDest.value = tmpName;
  }
  else if(dropDownDest.drpDwnTyp==2) {
	  tmpVal = dropDownDest.value;
	  if(tmpVal.length > 0) tmpVal = tmpVal + ", ";
	  dropDownDest.value = tmpVal + tmpName;
  }
}

function zeigeDetails(id,el)
{
  window.clearTimeout(time_out);
  document.getElementById("divPopUp").innerHTML = details[id];
  setPosition(document.getElementById("divPopUp"),getOffset(el,"Left"),getOffset(el,"Top"));
  document.getElementById("divPopUp").style.visibility = "visible";
}

function setPosition(el,tmpX,tmpY) {
  var scrollY = 0;
  var scrollX = 0;
  var winHeight = 5000;
  var winWidth = 5000;
  if(document.body.scrollTop) scrollY = document.body.scrollTop;
  else if(window.pageYOffset) scrollY = window.pageYOffset;
	if (window.innerHeight) winHeight = window.innerHeight + scrollY;
	else if (document.body && document.body.offsetHeight) winHeight = document.body.offsetHeight + scrollY;
  if((tmpY + el["offsetHeight"]) > (winHeight)) {
		tmpY = winHeight - el["offsetHeight"] - 5;
  }
  if(document.body.scrollLeft) scrollX = document.body.scrollLeft;
  else if(window.pageXOffset) scrollX = window.pageXOffset;
	if (window.innerWidth) winWidth = window.innerWidth + scrollX;
	else if (document.body && document.body.offsetWidth) winWidth = document.body.offsetWidth + scrollX;
  if((tmpX + el["offsetWidth"]) > (winWidth-20)) {
		tmpX = winWidth - el["offsetWidth"] - 20;
	}
  el.style.top = tmpY + "px";
  el.style.left = tmpX + "px";

/*
	el.style.pixelTop = tmpY;
	el.style.pixelRight = tmpX;
	el.top = tmpY + "px";
	el.left = tmpX + "px";
*/
}
function getOffset(el, which) {
  var amount = el["offset"+which];
  el = el.offsetParent;
  while (el!=null) {
    amount+=el["offset"+which];
    el = el.offsetParent;
  }
  return amount
}


var aktiv = window.setInterval("menupos()",100);
function menupos() {
//alert(document.body.scrollTop);
  if(dom && document.getElementById("leftmenu")) {
		if(document.body.scrollTop>120) {
		  document.getElementById("leftmenu").style.top=document.body.scrollTop+10;
    }
		else {
		  document.getElementById("leftmenu").style.top=130;
    }
  }
}

function erg(nr)
{
	if(nr==0) {
		nr = 1;
      if (window.getSelection) selText=window.getSelection();
      else if (document.getSelection) selText=document.getSelection();
      else if (document.selection) selText=document.selection.createRange().text;
      document.srch.suche.value=selText;
    }
	document.srch.erg.value = nr;
	document.srch.submit();
}

function zeige(nr)
{
	//if(IDArr[nr])
	{
		document.srch.ID.value = nr;
		document.srch.submit();
	}
}

function CheckInput()
{
	if(document.srch.suche.value.length < 4)
	{
		alert("Der Suchbegriff muß mindestens vier Zeichen lang sein!");
		document.srch.suche.focus();
		return false;
	}
	document.srch.erg.value = 1;
	return true;
}

selText="";
function srchSel()
{
	if(selText=="")	{
		alert("Markiere zuerst das Wort nach dem gesucht werden soll!");
	}
	else {
		selText = "\"" + selText.substr(0,20) + "\"";
        //alert(selText);
        document.prot.suche.value=selText;
		document.prot.erg.value = 1;
		document.prot.submit();
	}
}
function chkSelText()
{
	if (window.getSelection) selText=window.getSelection();
	else if (document.getSelection) selText=document.getSelection();
	else if (document.selection) selText=document.selection.createRange().text;
	if(selText=="")	document.getElementById("selTxt").style.color="#999999";
	else document.getElementById("selTxt").style.color="#5F0F79";
}

function copyCP(id)
{
	if(ie==1) {
		zwischenspeicher.innerText = terminArr[id];
		ablage = zwischenspeicher.createTextRange();
		ablage.execCommand("Copy");
		alert("Termin wurde in die Zwischenablage kopiert:\n\n" + terminArr[id]);
	}
}

x = 0;
function MouseHandler(e) {

 if (ns4) {

 x = e.pageX;
 y = e.pageY;
 }
 else if (ns6) {

 Event = e;
 x = Event.pageX;
 y = Event.pageY;
 }
 else if (ie) {

 x = window.event.clientX;
 y = window.event.clientY;
 }
}
if (ns4) {
	document.captureEvents(Event.MOUSEMOVE);
}
	document.onmousemove = MouseHandler;



/*
var curCSS = "../main.css";
function schema()
{
  curCSS = (curCSS == "../main.css") ? "../main1.css" : "../main.css";
  document.getElementsByTagName("link")[0].href = curCSS;
}

if(parent.frames.length == 0) {
  document.cookie = "url=" + document.location.href;
  top.location.replace('../index.php');
}
if(parent.frames[0].name != "hellasoben") {
  document.cookie = "url=" + document.location.href;
  top.location.href = "../index.php";
}
self.focus();
*/
