// Projektspezifische JS-Funktionen
/*
function openPopup(url,ID){
	//der array 'IstrListboxTargetPopupstyle' wird in der methode
	//MainOutputClass.GetClientJSPopupTargets() gefuellt...
	window.open(url,"ePilotPopup"+ID,IstrListboxTargetPopupstyle[ID]);
}
*/

function openPopup(url, ID, mediaID){
	//der array 'IstrListboxTargetPopupstyle' wird in der methode
	//MainOutputClass.GetClientJSPopupTargets() gefuellt...

	if ((mediaID > 0) && (ID == 197)) {
		url = "/main.aspx/G/" + GroupID + "/L/" + LangID + "/A/" + AreaID + "/ID/" + mediaID + "/V/media";
		window.open(url, "ePilotPopup"+ID, IstrListboxTargetPopupstyle[ID]);
	} else {
		//url += "/V/popup/PM/1";
		window.open(url, "ePilotPopup"+ID, IstrListboxTargetPopupstyle[ID]);
	}
}


function openContent(url,ID){
	switch(ID){
		case 4:
			parent.location.href = url;
			break;
		case 5:
			parent.window.opener.location.href = url;
			break;
	}
}


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();
}

// Popup fuer den Lageplan
function openPopupLageplan(xkoordinate,ykoordinate){
	var url = "http://www.niedersachsennavigator.niedersachsen.de/cgi-bin/nn/n.pl?prj=wg_wesermarsch";
	url +=  "&amp;m_re=" + xkoordinate + "&amp;m_ho=" + ykoordinate;
	url +=  "&amp;s_re=" + xkoordinate + "&amp;s_ho=" + ykoordinate;
	url +=  "&amp;zoom=7";

	window.open(url, "Flash", "status=no,scrollbars=no,width=484,height=420");
}

function openPopupKarte(STRASSE,HAUSNUMMER,PLZ,ORT){
	var url = "http://link2.map24.com/?lid=2d1b1345&amp;maptype=CGI&amp;street0=";
	url +=  STRASSE + "+" + HAUSNUMMER;
	url +=  "&amp;zip0=" + PLZ + "&amp;city0=" + ORT;
	url +=  "&amp;country0=de&amp;description0=wohnbauwesermarsch&amp;lang=de";

	window.open(url, "Flash", "status=no,scrollbars=yes,resizable=yes,width=800,height=600");
}


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 RunSearch(lngPopupMode) {

  var queryval = encodeURI(document.forms["suche"].elements["Z"].value);
  
  // Die Auswahl des Suchbereiches erfolgt über die Radiobuttons
  var ID = -1;
  
    if(document.forms["suche"].elements["ID"][0].checked == true)
        ID = document.forms["suche"].elements["ID"][0].value;
    else
        ID = document.forms["suche"].elements["ID"][1].value;
  
  if (lngPopupMode > 0) {
    var strLink = IstrPopupLink;
	  strLink += "/ID/" + ID + "/Z/" + queryval;
    openPopup(strLink, lngPopupMode);
  }
  else {
    var strLink = IstrBaseLink;
	  strLink += "/ID/" + ID + "/Z/" + queryval;
	  
    document.location.href = strLink;
  }
}
