﻿var bottomNavHeight = 25;
var flag = "up";

//window.onload = bottomNav; <--- zu finden beim validator.js

function bottomNavEvent(event1)
{
    var bottomNavX,bottomNavY;
    if (self.innerHeight) // all except Explorer
    {
	    bottomNavX = self.innerWidth;
	    bottomNavY = self.innerHeight;
	    if (event1.clientY < bottomNavY - 170)
        {    
	        flag = "down";
            bottomNavDown();
        }
        else if (event1.clientY > bottomNavY - 20)
        {
            flag = "up";
            bottomNavUp();
        }
    }
    else if (document.documentElement && document.documentElement.clientHeight)
	    // Explorer 6 Strict Mode
    {
	    bottomNavX = document.documentElement.clientWidth;
	    bottomNavY = document.documentElement.clientHeight;
	    if (event1.clientY < bottomNavY - 170)
	    {    
	        flag = "down";
            bottomNavDown();
        }
        else if (event1.clientY > bottomNavY - 20)
        {
            flag = "up";
            bottomNavUp();
        }
    }
    else if (document.body) // other Explorers
    {
	    bottomNavX = document.body.clientWidth;
	    bottomNavY = document.body.clientHeight;
	    if (event1.clientY < bottomNavY- 170)
        {    
	        flag = "down";
            bottomNavDown();
        }
        else if (event1.clientY > bottomNavY - 20)
        {
            flag = "up";
            bottomNavUp();
        }
    }
}

function bottomNav()
{
    if (document.getElementById("sessionVisited").value == "True")
    {
        bottomNavHeight = 25;
        
        document.getElementById("bottomNavPanel").style.height = bottomNavHeight + "px";
        document.getElementById("bottomNavPanel").style.display = "block";
    }
    else
    {
        bottomNavHeight = 215;
        document.getElementById("bottomNavPanel").style.height = bottomNavHeight + "px";
        document.getElementById("bottomNavPanel").style.display = "block";
        
        setTimeout("bottomNavDown();", 1000);
    }
}

function bottomNavUp()
{
    bottomNavHeight += 10;
    if (bottomNavHeight < 215 && flag == "up")
    {
        document.getElementById("bottomNavPanel").style.height = bottomNavHeight + "px";
        setTimeout("bottomNavUp();", 20);
    }    
    else
        bottomNavHeight = 215;
}

function bottomNavDown()
{
    bottomNavHeight = 25;
    //if (bottomNavHeight > 20)
    //{
        document.getElementById("bottomNavPanel").style.height = bottomNavHeight + "px";
        //setTimeout("bottomNavDown();", 50);
    //}
    //else
        //bottomNavHeight= 20;
    
}




function showMainContent(me,id)
{

    if (!me.firstChild)
        me = document.getElementById(me);
    
    if (navigator.appName.indexOf("Explorer") != -1)
    {
        if (document.getElementById(id).style.display == "block")
        {
            document.getElementById(id).style.display="none";
            me.firstChild.firstChild.nodeValue = "> ";
            me.parentNode.style.backgroundImage = "url(/img/immoDetailTableRow.jpg)"
        }
        else
        {
            document.getElementById(id).style.display="block";
            me.firstChild.firstChild.nodeValue = "v ";
            me.parentNode.style.backgroundImage = "url(/img/immoDetailTableRowA.jpg)"
        }
    }
    else
    {
        if (document.getElementById(id).style.display == "table-cell")
        {
            document.getElementById(id).style.display="none";
            me.firstChild.firstChild.nodeValue = "> ";
            me.parentNode.style.backgroundImage = "url(/img/immoDetailTableRow.jpg)"
        }
        else
        {
            document.getElementById(id).style.display="table-cell";       
            me.firstChild.firstChild.nodeValue = "v ";
            me.parentNode.style.backgroundImage = "url(/img/immoDetailTableRowA.jpg)"
        }  
    
    }  
    
    
}

function showAllTopContents()
{
	var alltags = document.getElementsByTagName("*");
	var flag = 0;
	
	for (i=0; i<alltags.length; i++)
	{
	    if (alltags[i].className.indexOf("collapseText") != -1)
	    {
	        if (alltags[i].firstChild.nodeValue == "Alle öffnen")
	        {
	            flag = 1
	            alltags[i].firstChild.nodeValue = "Alle schließen"
	        }
	        else
	        {
	            alltags[i].firstChild.nodeValue = "Alle öffnen"
	        }
        }
    }     
    
	for (i=0; i<alltags.length; i++)
	{
	    if (alltags[i].className.indexOf("collapseArea") != -1)
	    {
		    if (navigator.appName.indexOf("Explorer") != -1)
            {
                if (flag)
                {
                    alltags[i].style.display="block";
                    //alltags[i].firstChild.src = "/img/detailArrow.jpg";
                }
                else
                {
                    alltags[i].style.display="none";
                    //alltags[i].firstChild.src = "/img/detailActiveArrow.jpg";
                }
            }
            else
            {
                if (flag)
                {
                    alltags[i].style.display="table-cell";
                    //alltags[i].firstChild.src = "/img/detailArrow.jpg";
                }
                else
                {
                    alltags[i].style.display="none";       
                    //alltags[i].firstChild.src = "/img/detailActiveArrow.jpg";
                } 
            } 
        }
        else if (alltags[i].className.indexOf("collapseArrow") != -1)
        {
            if (flag)
            {
                alltags[i].firstChild.nodeValue = "v ";
            }
            else
            {
                alltags[i].firstChild.nodeValue = "> ";
            }
        }
    }  
}



var fenstername;
var variablenname;

function test(obj)
{
  variablenname = obj.parentNode.parentNode.innerHTML;
  fenstername = window.open("drucken.htm");
  setTimeout("go();", 1000);
}

function printMerkList(obj)
{
    variablenname = "";
    var alltags = document.getElementsByTagName("td");
	
	for (i=0; i<alltags.length; i++)
	{
	    if (alltags[i].className.indexOf("collapseArea") != -1)
	    {
	        variablenname += alltags[i].innerHTML + "<br /><br />";
	    }
	}  
	    	    
    fenstername = window.open("drucken.htm");
    setTimeout("go();", 1000);
}

function go()
{
  fenstername.document.getElementById("content").innerHTML=variablenname;
  
  var alltags = fenstername.document.getElementsByTagName("img")
  for (i=0; i<alltags.length; i++)
	{
	    alltags[i].style.width="500px";
	    alltags[i].style.height="auto";
	    
	    var path = alltags[i].src;
	    alltags[i].src=path.replace("thumb_","");
	    //alert(path.replace("thumb_",""));
	} 
	
  var alltags = fenstername.document.getElementsByTagName("div")
  for (i=0; i<alltags.length; i++)
	{
	    if (alltags[i].className.indexOf("topContentShowImgText") != -1)
	    alltags[i].style.display="none";
	} 
	
  fenstername.print();
  /* 
  fenstername.close();*/
}
