// 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 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 {
		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 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 + "/V/popup";
  
  openPopup(strLink, lngPopupMode);
}


function openPopupFlash(url){
	window.open(url, "Flash", "status=no,scrollbars=no,width=830,height=700");
}


function DropDownSelect(formName, elementName) {
  var value = document.forms[formName].elements[elementName].value;
  
  // der Link unterteilt sich in Link und Target
  var valueA = value.split(" ");

  var targetID = valueA[1];
  var link = valueA[0];
  
  if (targetID < 3)
	  location.href = link;
  if (targetID == 3)
	  window.open(link);
  if (targetID > 3)
		openPopup(link, targetID, -1);
}


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="http://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="http://www.macromedia.com/go/getflashplayer" ' + embedVars + '></embed>';

    output += '</object>';
   // alert(output);
    
    document.write(output);
}
