var pw = "asdf"
var currentPanel;
var g_marker = null;


function LoginSuccess(doc)
{
	var navdoc = doc.parentWindow.parent.frames(1).document;
	//alert(window.clientInformation.cookieEnabled);
	//alert(window.clientInformation.userAgent);
	return navdoc.getElementById("hidLogin").value;
}	

function Login(input)
{
	var btn = window.event.srcElement;
	var navdoc = input.ownerDocument.parentWindow.parent.frames(1).document;
	if(input.value.indexOf(pw) != -1)
	{
		navdoc.getElementById("hidLogin").value = true;
		var link = document.createElement("A");
		link.href = "private.html";
		link.innerText = "Hier klicken um zur Privatinhalte zu gelangen";
		link.target = "_self";
		link.name = "aPrivate";
		spLink.appendChild(link);
		btn.disabled = true;
	}
	else
	{
		navdoc.getElementById("hidLogin").value = false;
		alert("Passwort inkorrekt! Bitte erneut probieren.");
		input.value = "";
		input.focus();
	}
}

function GoHome()
{
	parent.main.location.href = "home.html";
}

function SetDefaultStatus()
{
	var date = new Date();
	window.status = "Willkommen bei unserer Home Page am " + date.toLocaleDateString();
}

function DisplaySwitch(index)
{
	var coll = document.all.tags("DIV");
	if (coll != null)
	{
    		for (i = 0; i < coll.length; i++) 
    		{
    			if(i == index)
    			{
    				coll[i].style.display = (coll[i].style.display == "block") ? "none" : "block";
    			}
    			else
    			{
    				coll[i].style.display = "none";
    			}
    		}
	}
}

function SetMainPage()
{
	var btn = window.event.srcElement;
	var coll = document.all.tags("INPUT");
	if (coll != null)
	{
    		for (i = 0; i < coll.length; i++) 
    		{
    			coll[i].setAttribute("selected", (coll[i].id == btn.id) ? true : false);
    			coll[i].className = (coll[i].id == btn.id) ? "clsButtonSel" : "clsButton";
    		}
	}
	parent.main.location.href = btn.id + ".html";
}

function Hilite()
{
	var coll = document.all.tags("INPUT");
	var btn = window.event.srcElement;
	if (coll != null)
	{
    		for (i = 0; i < coll.length; i++) 
    		{
    			if(coll[i].id == btn.id)
    			{
	    			if(!coll[i].getAttribute("selected"))
	    			{
	    				if(event.srcElement == event.toElement)
	    				{
	    					coll[i].className = "clsButtonOver";
	    				}
	    				else
	    				{
	    					coll[i].className = "clsButton";
	    				}
	    			}
    			}
    		}
	}
}

function ToggleFAQ(index)
{
	var obj = window.event.srcElement;
	var row;
	if(obj.tagName == "IMG")
		row = obj.parentElement.parentElement;
	else if(obj.tagName == "TD")
		row = obj.parentElement;
	var img = row.cells(0).children(0);
				
	var coll = document.all.tags("DIV");
	if(coll != null)
	{
		var prevRow;
    		for (i = 0; i < coll.length; i++) 
    		{
    			if(i == index)
    			{
    				if(coll[i].style.display == "inline")
    				{
    					coll[i].style.display = "none";
    					img.src = "include/images/arrow_expand.gif";
    					row.style.backgroundColor = "transparent";
					row.cells(1).style.color = "";
    					
    				}
    				else
    				{
    					coll[i].style.display = "inline";
    					img.src = "include/images/arrow_down.gif";
    					row.cells(1).style.color = "white";
    					row.style.backgroundColor = "red";
    				}
    			}
    			else
    			{
    				prevRow = coll[i].parentElement.parentElement.previousSibling;
    				prevRow.style.backgroundColor = "transparent";
    				prevRow.cells(1).style.color = "";
    				prevRow.cells(0).children(0).src = "include/images/arrow_expand.gif";
    				coll[i].style.display = "none";
    			}
    		}
	}
}

function showPanel(panelNum)
{
      if (currentPanel != null) {
         hidePanel();
      }
      document.getElementById('panel'+panelNum).style.visibility = 'visible';
         currentPanel = panelNum;
         setState(panelNum);
}
   
function hidePanel()
{

      document.getElementById('panel'+currentPanel).style.visibility = 'hidden';
      document.getElementById('tab'+currentPanel).style.backgroundColor = '#ffffff';
      document.getElementById('tab'+currentPanel).style.color = 'navy';
}
   
function setState(tabNum)
{
      if (tabNum==currentPanel)
      {
         document.getElementById('tab'+tabNum).style.backgroundColor = '#ddddff';
         document.getElementById('tab'+tabNum).style.color = 'red';
      }
      else
      {
         document.getElementById('tab'+tabNum).style.backgroundColor = '#ffffff';
         document.getElementById('tab'+tabNum).style.color = 'navy';
      }
   }
   
function hover(tab)
{
      tab.style.backgroundColor = 'ddddff';
}

function SelectHeadline()
{
       	var n = Math.random();
	n = n * 10;
	n = parseInt((n % tdcNews.recordset.recordCount) -1);
	if (g_marker == null)
	{
		g_marker = tdcNews.recordset.Bookmark;
	}
	tdcNews.recordset.Move(n, g_marker);
}
