/* 2004 - Demetrey Iljin */

/* Drawing a Media Window */
document.write('<div id="mediaWindow" onMousedown="window.parent.dragWindow(event)" onMouseup="window.parent.stopDragWindow()" onSelectStart="return false" style="top: 137px; left: 5px; position: absolute; cursor: move; display: none; z-index: 10000" >');
document.write('<div id="windowHead" align="right" style="margin: 0px 0px 0px 0px; padding: 0px 0px 0px 0px; width: 790px; height: 25px; position: absolute;"><img alt="Halten Sie die linke Maustaste gedr&uuml;ckt und verschieben Sie das Fenster" src="menu/bilder/back_nav.gif" width="790" height="25" border="0"></div>');
document.write('<div id="windowInfo" style="margin: 4px 0px 0px 0px; padding: 0px 0px 0px 0px; width: 765px; height: 21px; position: absolute; background: transparent; cursor: move;"><font style="padding-left: 6px; font: bold 17px Arial; color: #000000;">Media-Window</font></div>');
document.write('<div id="menuButton" style="margin: 0px 0px 0px 725px; padding: 1px 0px 0px 1px; width: 25px; height: 25px; position: absolute; cursor: hand;" onClick="window.parent.menuLaunch(\'B\');"><img alt="Men&uuml; &ouml;ffnen: Access Key \'B\'" src="menu/bilder/menu_4.gif" width="23" height="23" border="0"></div>');
document.write('<div id="closeButton" style="margin: 0px 0px 0px 765px; padding: 1px 0px 0px 1px; width: 25px; height: 25px; position: absolute; cursor: hand;" onClick="window.parent.openWindow();"><img alt="Window schlie&szlig;en: Access Key \'Escape\' or \'O\'" src="menu/bilder/close_4.gif" width="23" height="23" border="0"></div>');
document.write('<div id="windowContent" style="margin: 25px 0px 0px 0px; padding: 0px 0px 0px 0px; width: 790px; height: 390px; position: absolute; border: ridge 3px #FFFFFF;">');
document.write('<iframe id="frameContent" name="frameContent" frameborder="0" marginheight="0" marginwidth="0" scrolling="no" width="100%" height="100%"></iframe>');
document.write('</div>');
document.write('</div>');

var dragapproved=false
var ie5=document.all&&document.getElementById
document.getElementById("frameContent").src='';

function window.parent.dragWindow(e){
  offsetx=ie5? event.clientX : e.clientX
  offsety=ie5? event.clientY : e.clientY
  document.getElementById("frameContent").style.display="none"
  tempx=parseInt(document.getElementById("mediaWindow").style.left)
  tempy=parseInt(document.getElementById("mediaWindow").style.top)
  dragapproved=true
  document.getElementById("mediaWindow").onmousemove=window.parent.dragNdrop
				    }

function window.parent.dragNdrop(e){
  if (ie5&&dragapproved&&event.button==1){
   document.getElementById("mediaWindow").style.left=tempx+event.clientX-offsetx+"px"
   document.getElementById("mediaWindow").style.top=tempy+event.clientY-offsety+"px"
                                         }
				   }

function window.parent.stopDragWindow(){
  dragapproved=false;
  document.getElementById("mediaWindow").onmousemove=null;
  document.getElementById("frameContent").style.display="inline"
				       }

function window.parent.openWindow(which){
  if (window.parent.mediaWindowOpen==true){
   window.parent.mediaWindowOpen=false;
   document.getElementById("mediaWindow").style.display='none';
   if (parent.document.tivionbrowser==true){window.parent.location.href="tvoon://tv/preview?activ=1";}
   window.parent.setFocus();
   return;
					  }
  if (window.parent.mediaWindowOpen!=true){
   window.parent.mediaWindowOpen=true;
  if (which==1){window.parent.which=which;document.getElementById("frameContent").src='menu/remote_1.html';}
  if (which==2){window.parent.which=which;document.getElementById("frameContent").src='menu/remote_2.html';}
  if (which==3){window.parent.which=which;document.getElementById("frameContent").src='menu/remote_3.html';}
  if (which==4){window.parent.which=which;document.getElementById("frameContent").src='menu/remote_4.html';}
   document.getElementById("mediaWindow").style.display='inline';
   window.setTimeout("window.parent.manageFocus('mediaWindow')",100);
   return;
					  }
				        }
