function bilderTausch(bildID,tauschbild) {
    document.getElementById(bildID).src = tauschbild;
}

function cssDisplay(element) {
    if (document.getElementById(element).style.display = "none")
    document.getElementById(element).style.display = "block";
    else document.getElementById(element).style.display = "none";
}

function unsichtbar(ebene) {
    document.getElementById(ebene).style.visibility = 'hidden';
}

function sichtbar(ebene) {
    document.getElementById(ebene).style.visibility = 'visible';
}

function showbilddetail(ebene, bilddetailtyp, bilddetailtypres, bilddetailsize, bilddetail_url, bilddetailbildsrc, textid) {
	document.getElementById(ebene).style.visibility = 'visible';
	document.getElementById('bilddetailterms').checked = false;
	document.getElementById('bilddetailbild').src = bilddetailbildsrc;
	document.getElementById('bilddetail_anzeigen_download').style.display = 'none';
	document.getElementById('bilddetailtyp').innerHTML = bilddetailtyp;
	document.getElementById('bilddetailtypres').innerHTML = bilddetailtypres;
	document.getElementById('bilddetailsize').innerHTML = bilddetailsize;
	document.getElementById('bilddetail_url').href = bilddetail_url;
	document.getElementById('bilddetail_text').innerHTML = document.getElementById(textid).innerHTML;
	window.setTimeout("document.getElementById('bilddetailbild').src = '" + bilddetailbildsrc + "';", 300);
}

function loadImage(url)
{
	if (document.images) 
	{
		result = new Image();
		result.src = url;
		return result;
	}
}

var preloaded = false;
function preloadImages() 
{
	if (document.images) 
	{
		overImages = new Array;
		for (var i = 0; i < preloadImages.arguments.length; i++)
		{
			overImages[i] = loadImage(preloadImages.arguments[i]);
		}
		preloaded = true;
	}
}

var openpopupWindow=null;
function openpopup (mypage,myname,w,h,pos,infocus,dependent,scroll,resize){

	
	
 if(pos=='random'){
		LeftPosition=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;
		TopPosition=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;
	}
    var dep = dependent ? dependent : 'no';
    var scroll = scroll ? scroll : 'no';
    var resize = resize ? resize : 'resize';
	if(pos=='center'){
		LeftPosition=(screen.width)?(screen.width-w)/2:100;
		TopPosition=(screen.height)?(screen.height-h)/2:100;
	} else if((pos!='center' && pos!='random') || pos==null){
		LeftPosition=100;TopPosition=100;
	}
	
	var settings='width='+ w + ',height='+ h + ',top=' + TopPosition + ',left=' + LeftPosition + ',location=no,directories=no,menubar=no,toolbar=no,status=no,scrollbars=' + scroll + ',resizable=' + resize + ',dependent=' + dep;

    var openpopupWindow=window.open('','Popup',settings);
    
    if(infocus=='front'){
		openpopupWindow.focus();
		openpopupWindow.location=mypage;
	}
}

var soundWindow = false;
function opensoundpopup (mypage,myname,w,h,pos,infocus,frame){

    if(parent.frames.length > 0){
        if (!document.getElementById('soundicon').src.match(/sound_icon_off/)) {
            parent.frames[1].location = '/at/sound,00,nosound.html';
            document.getElementById('soundicon').src = '/shared/img/sound_icon_off.gif';
            soundWindow = true;
        } else {
            parent.frames[1].location = '/at/sound,00,frame.html';
            document.getElementById('soundicon').src = '/shared/img/sound_icon.gif';
            soundWindow = false;
        }
        
    } else {
        if (!soundWindow.location) {
           var dep = 'no';
           LeftPosition=100;TopPosition=100;
        	var settings='width='+ w + ',height='+ h + ',top=' + TopPosition + ',left=' + LeftPosition + ',location=no,directories=no,menubar=no,toolbar=no,status=no,scrollbars=no,resizable=no,dependent=' + dep;

            soundWindow=window.open('','sound',settings);
            if(infocus=='front'){
        		soundWindow.focus();
        		soundWindow.location=mypage;
                document.getElementById('soundicon').src = '/shared/img/sound_icon.gif';
        	}
        } else {
            soundWindow.location = '/at/sound,00,nosound,close,01,close.html';
//            soundWindow.close();
            soundWindow = false;
            document.getElementById('soundicon').src = '/shared/img/sound_icon_off.gif';
        }
    }
	
}


function openWindow(mypage) {
	w = 800;
	h= 600;
   LeftPosition=(screen.width)?(screen.width-w)/2:100;
   TopPosition=(screen.height)?(screen.height-h)/2:100;
   var settings='width='+ w + ',height='+ h + ',top=' + TopPosition + ',left=' + LeftPosition + ',location=yes,directories=yes,menubar=yes,toolbar=yes,status=yes,scrollbars=yes,resizable=yes,dependent=no';
   var openWindow=window.open('','pdf',settings);
   openWindow.location=mypage;
}

function checkHeight() {

    if(document.getElementById('contentMain') && document.getElementById('contentRechts')){
        if((document.getElementById('contentMain').offsetHeight < document.getElementById('subNaviLinks').offsetHeight) || (document.getElementById('contentMain').offsetHeight < document.getElementById('contentRechts').offsetHeight)){
            if(document.getElementById('contentRechts').offsetHeight > document.getElementById('subNaviLinks').offsetHeight){
                document.getElementById('contentMain').style.height = document.getElementById('contentRechts').offsetHeight+"px";
            }else {
                document.getElementById('contentMain').style.Height =  document.getElementById('subNaviLinks').offsetHeight+"px";
            }
        }
    }
}

function externalLinks() {
 if (!document.getElementsByTagName) return;
 var anchors = document.getElementsByTagName("a");
 for (var i=0; i<anchors.length; i++) {
   var anchor = anchors[i];
   if (anchor.getAttribute("href") &&
       anchor.getAttribute("rel") == "external")
     anchor.target = "_blank";
 }
}

function getScreen() {

	//alert ("FF:" + window.innerWidth + "x" + window.innerHeight + "\nIE7: " + document.documentElement.clientWidth + "x" + document.documentElement.clientHeight + "\nIE6:" + document.body.offsetWidth + "x" + document.body.offsetHeight);
	//document.getElementById('mainTable').style.height = (window.innerHeight-92) + "px";
	//document.getElementById('mainTable').style.backgroundColor = "#343434";
}

function positionierung(id) {
	if (navigator.userAgent.indexOf('MSIE 7') != -1) {
		//alert(document.body.scrollTop);
		//document.getElementById(id).style.top = parseInt()+180;
	}
}

function switchImages()
{
	if (document.images && (preloaded == true))
	{
		for (var i = 0; i < switchImages.arguments.length; i += 2)
		{
            document.getElementById(switchImages.arguments[i]).src = switchImages.arguments[i+1];
		}
	}
	document.getElementById('NavigationOben').style.zIndex = 30;
}

function loadImage(url)
{
	if (document.images)
	{
		result = new Image();
		result.src = url;
		return result;
	}
}

var preloaded = false;
function preloadImages()
{
	if (document.images)
	{
		overImages = new Array;
		for (var i = 0; i < preloadImages.arguments.length; i++)
		{
			overImages[i] = loadImage(preloadImages.arguments[i]);
		}
		preloaded = true;
	}
}