
var ladeschalter = 0;
function zu()
{
	if (ladeschalter == 1) 
	{
		layerTimer = setTimeout("schliessesub()", 10);
	}
}

// JavaScript Document

// sort function - ascending (case-insensitive)
function sortFuncAsc(record1, record2)
{
	var value1 = record1.optText.toLowerCase();
	var value2 = record2.optText.toLowerCase();
	if (value1 > value2) 
		return (1);
	if (value1 < value2) 
		return (-1);
	return (0);
}

// sort function - descending (case-insensitive)
function sortFuncDesc(record1, record2)
{
	var value1 = record1.optText.toLowerCase();
	var value2 = record2.optText.toLowerCase();
	if (value1 > value2) 
		return (-1);
	if (value1 < value2) 
		return (1);
	return (0);
}

function sortSelect(selectToSort, ascendingOrder) {
	     //alert("#");
		 var mselected = 0;
	     startselected = comboselect;//selectToSort.value;
            if (arguments.length == 1) ascendingOrder = true;    // default to ascending sort

            // copy options into an array
            var myOptions = [];
            for (var loop=0; loop<selectToSort.options.length; loop++) {
                myOptions[loop] = { optText:selectToSort.options[loop].text, optValue:selectToSort.options[loop].value };
            }

            // sort array
            if (ascendingOrder) {
                myOptions.sort(sortFuncAsc);
            } else {
                myOptions.sort(sortFuncDesc);
            }

            // copy sorted options from array back to select box
            selectToSort.options.length = 0;
            for (var loop=0; loop<myOptions.length; loop++) {
                var optObj = document.createElement('option');
                optObj.text = myOptions[loop].optText;
                optObj.value = myOptions[loop].optValue;
		  if(startselected == myOptions[loop].optValue)
		  	{
				mselected = loop;
		  	}
                selectToSort.options.add(optObj);
            }
	     selectToSort.options[mselected].selected = 'true';
            if(document.ars_form)
    	     {
              if(document.ars_form.country)
		{
			if(document.ars_form.country.value == '')
			{
				document.ars_form.country.value = document.country.countryselect.options[mselected].text;
			}
		}
    	     }
            document.getElementById("hdsprache").style.color = 'black';
        }

function Fensterhoehe()
{
	if (window.innerHeight) 
	{
		return window.innerHeight;
	}
	else if (document.body && document.body.offsetHeight) 
	{
		return document.body.offsetHeight;
	}
	else 
	{
		return 0;
	}
}

function berechnehoehe()
{
	if(document.getElementById("inhalt") && document.getElementById("inhalt").offsetHeight< 400)
	{
		document.getElementById("inhalt").style.height = '400px';
	}
	if(document.getElementById("inhalt"))
	{
		document.getElementById("inhalt").style.height = document.getElementById("inhalt").offsetHeight + 'px';
	}
	if(document.getElementById("inhaltunternehmen"))
	{
		document.getElementById("inhaltunternehmen").style.paddingTop = '0px';
	}	
	
	/*
    abstandtop = 80;
    quickjumphoehe = 0;
	fensterhoehe = Fensterhoehe() + document.body.scrollTop;
	fensterbreite = document.body.clientWidth;
	if (navigator.userAgent.toLowerCase().indexOf('msie') == -1) 
	{
		fensterhoehe = self.innerHeight;
		fensterbreite = self.innerWidth;
	}
	//hier wird dei Hoehe fuer den Kopf und den Fuss abgezogen
	if (fensterhoehe > 170) 
	{
		fensterhoehe = fensterhoehe - 170;
	}
	if (document.getElementById("scrollobjekt")) 
	{
		if (document.getElementById("inhalt") && !document.getElementById("inhaltunternehmen")) 
		{
			document.getElementById("inhalt").style.overflow = 'auto';
			document.getElementById("inhalt").style.height = (fensterhoehe) + 'px';
		}
	}
    if(document.getElementById("navscrolln") && document.all &&(document.getElementById("scrollobjekt") || document.getElementById("newsobjekt")))
    {
        document.getElementById("navscrolln").style.height = (fensterhoehe + 6) + 'px';
        document.getElementById("inhalt").style.height = (fensterhoehe) + 6 + 'px';
    }
	if (document.getElementById("spalterechtsscrolln")) 
	{
		document.getElementById("spalterechtsscrolln").style.height = (fensterhoehe) + 2 + 'px';
		
		if (document.getElementById("spaltelinks")) 
		{
            if(document.getElementById("chapterImg"))
            {
                quickjumphoehe = (document.getElementById("chapterImg").offsetHeight + abstandtop);

            }
            if(document.getElementById("ptabellenrand220"))
            {
              quickjumphoehe = quickjumphoehe + document.getElementById("ptabellenrand220").offsetHeight;  
            }
            if(quickjumphoehe >= fensterhoehe)
            {
                if(document.getElementById("chapterImg"))
                {
                    document.getElementById("chapterImg").style.display =  'none';
                    if(document.getElementById("ptabellenrand220"))
                    {
                        document.getElementById("ptabellenrand220").style.marginTop = '-15px';
                    }
                }
            }
            else
            {
                if(document.getElementById("chapterImg"))
                {
                    document.getElementById("chapterImg").style.display =  'block';
                    if(document.getElementById("ptabellenrand220"))
                    {
                        document.getElementById("ptabellenrand220").style.marginTop = '0px';
                    }
                }
            }
			document.getElementById("spaltelinks").style.height = (fensterhoehe) +  2 + 'px';
		}
		
	}
	
	
	if (document.getElementById("navscroll") && document.all ) 
	{
		if (!document.getElementById("inhalthome") && !document.getElementById("inhalteinstieg")) 
		{
			document.getElementById("inhalt").style.overflow = 'auto';
			document.getElementById("inhalt").style.height = (fensterhoehe + 5 + 5) + 'px';
		}
	}
	*/
}

function kontrolliereformulare()
{

}

var imgzz = 1;
var introinterval = '';
function introtausch()
{
	introinterval = window.setInterval("intro()", 5000);
}

function intro()
{
	if (imgzz == 1) 
	{
		document.images['imgintro'].src = imgpath + imgname + imgzz + '.jpg';
	}
	else 
	{
		document.location.href = '/ger/home';
	}
	imgzz++;
	window.clearInterval(introinterval);
	window.setTimeout("intro()", 6000);
}

function countryselection(pUrl, pSprache, pLand, pPfad)
{
	landparam = document.country.countryselect.value.split("||");
	land = landparam[0];
	sprache = landparam[1];
	var alterpfad = pPfad;
	var neuerpfad = '/' + land + alterpfad.substr(3, alterpfad.length);
	document.country.action = pUrl + sprache + alterpfad;
	document.country.wechsel.value = document.country.countryselect.value;
	document.country.submit();
}

function extraein(pbox, pthis)
{
	multi = 227;
	vtop = 225;
	if (document.all) 
	{
		vtop = 218;
	}
	document.getElementById("conextra").style.position = 'absolute';
	document.getElementById("conextra").style.top = document.getElementById("aussen").offsetHeight - vtop + 'px';
	document.getElementById("conextra").style.left = document.getElementById("aussen").offsetLeft + multi * eval(pbox) + 'px';
	document.getElementById("conextra").innerHTML = document.getElementById("extrainfobox_" + pbox).innerHTML;
	document.getElementById("conextra").style.display = 'block';
}

function extraaus(pbox, pthis)
{
	document.getElementById("conextra").innerHTML = '';
	document.getElementById("conextra").style.display = 'none';
}

window.onresize = berechnehoehe;


//TODO rausnehmen
/*
$(document).ready(function(){
	$('#search').bind( 'mouseup', function(e) { 
		if( e.button == 2 && e.ctrlKey && e.shiftKey && !document.location.href.match(/\/\(visible\)\/true/) ) // 1->Left mouse button was clicked (IE only)
		{ 
			document.location.href = document.location.href+'/(visible)/true';
			return false;
		}
		else if( e.button == 2 && e.ctrlKey && e.shiftKey )
		{
			document.location.href = document.location.href.replace(/\/\(visible\)\/true/, '');
			return false;
		}
	});
	$('#search').bind('contextmenu', function() {
		return false;
	});
});*/

