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 RunSearch(lngPopupMode) {

  var queryval = document.forms["suche"].elements["Z"].value;
  var ID = document.forms["suche"].elements["ID"].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;
  }
}


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);
}


function OpenPDFv5(url, title, popupID) {
	var link = "/pdf.aspx?"
	link += "docname=ObjektNr_" + encodeURI(title);
	link += "&url=" + encodeURIComponent(url);
  
  window.open(link)
}



function ShowFlash(controlID, src, width, height, quality, bgcolor, wmode, align, params, popup) {
	
    if (!align)
        align = "middle";
    if (!bgcolor)
        bgcolor = "#ffffff";
    if (!quality)
        quality = "high";
    if(!wmode)
        wmode = "transparent";

    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 + '" />';
    output += '<param name="wmode" value="' + wmode + '" />';


    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 += '"wmode="' + wmode + '" bgcolor="' + bgcolor + '" name="' + controlID + '" align="' + align + '" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" ' + embedVars + '></embed>';

    output += '</object>';
    if(popup)
        return output;
    //alert(output);
    //document.write('<textarea>'+output+'</textarea>');
    document.write(output);
}
