/* Main Functions */

document.write('<link rel=stylesheet href="../css/master.css" type="text/css">');

function LoadFrames_d( MenueURL, HeadURL, DatenURL )
{
if (DatenURL != 'noData') {
DatenURL = MenueURL.replace( '../menue/m_', '../main/' );
}

if(parent.Daten){
    /* alert('LoadFrames_d-2 Aktueller Pfad: ' + location.pathname + '\n' + MenueURL + '\n' + HeadURL + '\n' + DatenURL ); */

    setFrame( 'Head' , HeadURL  );
    setFrame( 'Menue', MenueURL );
    /* Debug Modus f&uuml;r HTML-Studio ---
    setFrame( 'Daten', DatenURL );
    /*--- ENDE Debug Modus f&uuml;r HTML-Studio */
}
else
{
    var dateiAktuell = document.URL;
    var Ergebnis = dateiAktuell.search( 'file://' );                  /* lokaler Entwicklungsmodus ? */
    if(Ergebnis == -1) {
      var Ergebnis = dateiAktuell.search( 'http://www.icm-air' );     /* Frameset nur auf ICM WEB-Site nachladen */
      /* alert('BREAK at LoadFrames_d-1 ' + '\n' + dateiAktuell + '\n' + Ergebnis + '\n' + DatenURL ); */
      if(Ergebnis == 0) {                                             /* steht Suchbegriff an Anfang ?*/
        location.replace('../frames.html?' + location.pathname);
      }
    }
    else {
        location.replace('../index.html?' + location.pathname); /* lokaler Entwicklungsmodus */
    }
}

}


function LoadFrames_e(MenueURL, HeadURL, DatenURL)
{
if (DatenURL != 'noData') {
DatenURL = MenueURL.replace( '../menue/m_', '../main/' );
}

if(parent.Daten){

    setFrame( 'Head' , HeadURL  );
    setFrame( 'Menue', MenueURL );
    /* Debug Modus f&uuml;r HTML-Studio ---
    setFrame( 'Daten', DatenURL );
    /*--- ENDE Debug Modus f&uuml;r HTML-Studio */
}
else
{
    var dateiAktuell = document.URL;
    var Ergebnis = dateiAktuell.search( 'file://' );                  /* lokaler Entwicklungsmodus ? */
    if(Ergebnis == -1) {
      var Ergebnis = dateiAktuell.search( 'http://www.icm-air' ); /* Frameset nur auf UT WEB-Site nachladen */
      if(Ergebnis != -1) {
        /* alert('BREAK at LoadFrames_d-1 ' + '\n' + MenueURL + '\n' + HeadURL + '\n' + DatenURL ); */
        location.replace('../frames.html?' + location.pathname);
      }
    }
    else {
        location.replace('../index.html?' + location.pathname); /* lokaler Entwicklungsmodus */
    }
}

}


/*----- SUB-Functions ------------------------------------*/

function setFrame( FrameName, URLname )
{
    var dateiAktuell = String(eval('parent.' + FrameName + '.location'));
    var Ergebnis = dateiAktuell.search( URLname );
    if(Ergebnis == -1) {eval( 'parent.'+ FrameName +'.location.replace(URLname)' );}
    /*alert(dateiAktuell + '\n' + URLname + '\n' + Ergebnis );*/
}


function setStatus(msg){
  status = msg
  return true
}

//-- Popup-Picture mit Auto-Resize -1 -----------------------------------

function PopupPic(sPicURL, sPicTitle) {
  picTitle = sPicTitle
  var leftX= 250  // distance of window's left side from left of screen
  var topY = 190  // distance of window's top side from top of screen
  winFeatures = "screenX=" + leftX + ",left=" + leftX	+ ",screenY=" + topY + ",top=" + topY + ",resizable=0"
  WinID = window.open( "../pages/_popup.htm?"+sPicURL, "name", winFeatures )
}

//-- Popup-Picture mit Auto-Resize -2 -----------------------------------

function popUpImg(sPicURL, sPicTitle) {
  var leftX= 250  // distance of window's left side from left of screen
  var topY = 190  // distance of window's top side from top of screen
  myImg = new Image();
  myImg.src = sPicURL;
  var width = myImg.width;
  var height = myImg.height;
  winFeatures = "screenX=" + leftX + ",left=" + leftX	+ ",screenY=" + topY + ",top=" + topY + ",width=" + width + ", height=" + height + ", resizable=0"
  WinID = window.open('', 'imgWinName', winFeatures );
  with (WinID.document) {
    open();
    write('<HTML>');
    write('  <HEAD>');		
    write('    <title>' + sPicTitle + '</title>');
    write('  </HEAD>');
    write('  <BODY style="margin: 0px;" onLoad="self.focus();">');
    write('    <img src="' + sPicURL + '" alt="popUpImage" title="popUpImage">');
    write('  </BODY>');
    write('</HTML>');
    close();
  }
}
//-- END Popup-Picture mit Auto-Resize -------------------------------

//-- Close Popup-Window ----------------------------------------------

function ClosePic() {
  if (WinID.closed == true) {
    //alert("Fenster wurde bereits geschlossen");
  } else {
    WinID.close();
  }
}
//-- END Close Popup-Window ------------------------------------------


//-- Popup HTML Video ------------------------------------------------

function popUpHtmVideo( URL, id ) {
if (id == 'Video16_9') {
var WIDTH = 422;
var HEIGHT= 277;
var x = 350;
var y = 260;
}
if (id == 'Video4_3') {
var WIDTH = 342;
var HEIGHT= 291;
var x = 430;
var y = 260;
}
if (typeof id == 'undefined') { id = 'video'; }
eval('page' + id + ' = window.open(URL, "' + id + '", "toolbar=0,scrollbars=0,location=0,status=0,menubar=0,resizable=0,width='+ WIDTH +',height='+ HEIGHT +',left='+ x +',top='+ y +'");');
}
//-- END Popup HTML Video ------------------------------------------------


//-- Startet Flashplayer - Workaround für "Klicken Sie hier um dieses Steuerelement zu aktivieren"

function CreateVideoControl( VIDEO, DivID, AUTOPLAY, REWIND )
{
    if (DivID == 'Video16_9') {
    var WIDTH = 400;
    var HEIGHT= 226;
    }
    if (DivID == 'Video4_3') {
    var WIDTH = 320;
    var HEIGHT= 240;
    }
    WIDTH = WIDTH + 22;  /* offset f&uuml;r Player */
    HEIGHT= HEIGHT+ 51;
    /*alert('WIDTH: ' +  WIDTH + '\n' + 'HEIGHT: ' + HEIGHT ); */
    if (typeof AUTOPLAY == 'undefined' ) { AUTOPLAY = 'false'; }
    if (typeof REWIND   == 'undefined' ) { REWIND   = 'false'; }
    var d = document.getElementById(DivID);
    d.innerHTML =
    '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" '+
    'codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="'+WIDTH+'" height="'+HEIGHT+'" id="FLVPlayer">'+
    '<param name="movie" value="../videos/FLVPlayer_Progressive.swf">'+
    '<param name="salign" value="lt">'+
    '<param name="quality" value="high">'+
    '<param name="scale" value="noscale">'+
    '<param name="FlashVars" value="&MM_ComponentVersion=1&skinName=../videos/Halo_Skin_3&streamName=../videos/'+VIDEO+'&autoPlay='+AUTOPLAY+'&autoRewind='+REWIND+'">'+
    '<embed src="../videos/FLVPlayer_Progressive.swf" '+
    'flashvars="&MM_ComponentVersion=1&skinName=../videos/Halo_Skin_3&streamName=../videos/'+VIDEO+'&autoPlay='+AUTOPLAY+'&autoRewind='+REWIND+'" '+
    'quality="high" scale="noscale" width="'+WIDTH+'" height="'+HEIGHT+'" name="FLVPlayer" salign="LT"'+
    'type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer">'+
    '</embed>'+
    '</object>'
;
}


