
// Projektspezifische JS-Funktionen

function openPopup(url, ID) {
	switch(ID){
		case 4:
			parent.location.href = url;
			break;
		case 5:
			parent.window.opener.location.href = url;
			break;
		default:
			if (parseInt(ID,10) > 0) {
				window.open(url, "ePilotPopup"+ID, IstrListboxTargetPopupstyle[ID]);
			}	else {
				window.open(url);
			}
	}
}

function openGrundriss(ID) {
  /*//var url = "/DetailedView.aspx?WN=";
  var url = "http://java.wohnbau-gmbh.de/DetaledView.asp?WN=";
  url += ID;
  window.open(url, "Grundriss", "status=no,scrollbars=yes,width=463,height=500");*/
  var url = "/grundriss/FloorPlan.aspx?flatID=";
  url += ID;
  var w = window.open(url, "Grundriss", "status=no,scrollbars=yes,width=1024,height=768");
  w.focus();
}

function RunSearch(lngPopupMode) {

  var strLink = IstrPopupLink;
  var queryval = document.forms["suche"].elements["Z"].value;
  var ID = document.forms["suche"].elements["ID"].value;

  strLink += "/ID/" + ID + "/Z/" + queryval;

  openPopup(strLink, lngPopupMode);
}


function hideshowdiv(divID) {
	var VState = document.getElementById(divID).style.visibility;

	//document.title = divID + " " + document.getElementById(divID).style.display;

	if (VState=="visible") {
		document.getElementById(divID).style.visibility = "hidden";
	} else {
		document.getElementById(divID).style.visibility = "visible";
	}

} //end function
/*
function hidediv(divID) {
	document.getElementById(divID).style.visibility = "hidden";
} //end function

function showdiv(divID) {
	document.getElementById(divID).style.visibility = "visible";
} //end function

function CloseAlleMenues(blnShowDiv) {

	if (!blnShowDiv) {
		showdiv("objectsearch");
	}
	closaAlleMenues();
}
*/

function OpenPDF(url, title, popupID) {
	var link = "/htmltopdf/default.aspx?"
	link += "name=" + encodeURI(title);
	link += "&cnf=2";
	link += "&url=" + encodeURIComponent(url);

	openPopup(link, popupID, -1);
}

var activenav01index = 0;
var activenav01id = 0;
var nav02index = 0;



function MarkNav02(objectid, index) {

}


function RunImmoSearch() {
	var folderid = FixID_mietobjekte;
	var s1 = "";
  var s2 = "";
	stadt = window.document.AppartmentSuche.s1.value;

	var link = "";
	link = IstrBaseLink + "/Z/" + stadt + "/Z2/" + s2; // // + "/Z3//Z4/"
	link += "/ID/" + folderid;

	location.href = link;
}

function SortImmo() {
	var folderid = FixID_mietobjekte;
	var s1 = "";
  var s2 = "";
	stadt = window.document.ImmoSorting.z.value;
	sortparam = window.document.ImmoSorting.s2.value;

	var link = "";
	link = IstrBaseLink + "/Z/" + stadt + "/Z2/" + sortparam; // // + "/Z3//Z4/"
	link += "/ID/" + folderid;

	location.href = link;
}


function ShowFlash(controlID, src, width, height, quality, bgcolor, align, params) {
    if (!align)
        align = "middle"
    if (!bgcolor)
        bgcolor = "#ffffff"
    if (!quality)
        quality = "high"

    var output = "";

    output += '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="https://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0"';

		
    if (width != '')
        output += ' width="' + width + '"';
    if (height != '')
        output += ' height="' + height + '"';
		
    output += ' id="' + controlID + '" align="' + align + '">';

    output += '<param name="allowScriptAccess" value="sameDomain" />';
    output += '<param name="movie" value="' + src + '" />';
    output += '<param name="quality" value="' + quality + '" />';
    output += '<param name="bgcolor" value="' + bgcolor + '" />';

    var embedVars = "";
    if (params) {
        for(var i = 0; i < params.length; i++) {
            output += '<param name="' + params[i]['Key'] + '" value="' + params[i]['Value'] + '" />';
            embedVars += params[i]['Key'] + "=\"" + params[i]['Value'] + "\"";
        }
    }

    output += '<embed src="' + src + '" quality="' + quality + '"';
		
    if (width != '')
        output += ' width="' + width + '"';
    if (height != '')
        output += ' height="' + height + '"'
		
    output += ' bgcolor="' + bgcolor + '" name="' + controlID + '" align="' + align + '" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="https://www.macromedia.com/go/getflashplayer" ' + embedVars + '></embed>';

    output += '</object>';

    document.write(output);
}

function openUrl() {
	var url = window.document.KomponentenSuche.s1.value;
	window.open(url);
}
