function bilderTausch(bildID,tauschbild) {
    document.getElementById(bildID).src = tauschbild;
}

function cssDisplay(id) {
		if (document.getElementById(id).style.display=="block") {
			document.getElementById(id).style.display = "none";
		}
		else {
			document.getElementById(id).style.display = "block";

		}
	}

function unsichtbar(ebene) {
    document.getElementById(ebene).style.display = 'none';
}

function sichtbar(ebene) {
    document.getElementById(ebene).style.display = 'block';
}

function alleUnsichtbar(){
    document.getElementById('kalenderart').style.display = 'none';
    document.getElementById('auflage').style.display = 'none';
    document.getElementById('kalendarium').style.display = 'none';
    document.getElementById('sprache').style.display = 'none';
    document.getElementById('einband').style.display = 'none';
    document.getElementById('werbemoeglichkeit').style.display = 'none';
    document.getElementById('sonderwuensche').style.display = 'none';
    document.getElementById('startseite').style.display = 'none';
    document.getElementById('trackFinder').style.display = 'none';
    document.getElementById('dragFinder').style.display = 'none';
    document.getElementById('contentMaskbreitFinder').style.display = 'none';
    document.getElementById('contenttextbreitFinder').style.display = 'none';
    document.getElementById('dragFinder').style.top = "";
    document.getElementById('finderContent').style.display = 'block';

};

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){
 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;
	}
	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=no,resizable=no,dependent=no';

    var openpopupWindow=window.open('','Popup',settings);
    if(infocus=='front'){
		openpopupWindow.focus();
		openpopupWindow.location=mypage;
	}
}

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 blink(url) {
    document.getElementById('btnzettel').src = '/img/html/btn_anfragezettel.png';
    window.setTimeout("document.getElementById('btnzettel').src = '/img/html/btn_anfragezettel_over.png'", 100);
    sendRequest(url);
}

function handleHttpResponse() {

  if (http.readyState == 4) {

        //document.getElementById('btnzettel').src = '/img/html/btn_anfragezettel.png';
        srcanfragezettel = '/img/html/btn_anfragezettel_over.png';

        isWorking = false;



  }

}

var isWorking = false;


function sendRequest(url) {


if (!isWorking && http) {


    http.open("GET", url, true);

    http.onreadystatechange = handleHttpResponse;


isWorking = true;


    http.send(null);
}


}

function getHTTPObject() {

  var xmlhttp;

  /*@cc_on

  @if (@_jscript_version >= 5)

    try {

      xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");

    } catch (e) {

      try {

        xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");

      } catch (E) {

        xmlhttp = false;

      }

    }

  @else

  xmlhttp = false;

  @end @*/

  if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {

    try {

      xmlhttp = new XMLHttpRequest();

    } catch (e) {

      xmlhttp = false;

    }

  }

  return xmlhttp;

}

var http = getHTTPObject();
