var iFrameStyle = new Array();
var toolbarStyle = new Array();
var iFrameMode;

function setVars() {
   var iFrame = $x('seciframe');
   var toolbar = $x('e-toolbar');

   iFrameMode = 'minimized';

   iFrameStyle[0] = iFrame.style.position;
   iFrameStyle[1] = iFrame.style.width;
   iFrameStyle[2] = iFrame.style.height;
   iFrameStyle[3] = iFrame.style.top;
   iFrameStyle[4] = iFrame.style.left;

   toolbarStyle[0] = toolbar.style.position;
   toolbarStyle[1] = toolbar.style.width;
   toolbarStyle[2] = toolbar.style.height;
   toolbarStyle[3] = toolbar.style.top;
   toolbarStyle[4] = toolbar.style.left;
}

function manageWindow(_iframeID, _maximiseBtnId) {
   var iFrame = $x(_iframeID);
   var toolbar = $x('e-toolbar');

   if (iFrameMode == 'minimized') {

      $x('main').style.visibility = 'hidden';
      $x('e-footer').style.visibility = 'hidden';


      iFrame.style.position = 'absolute';
      iFrame.style.width = '99.9%';
      iFrame.style.height = '95%';
      iFrame.style.top = "35px";
      iFrame.style.left = "0px";

      toolbar.style.position = 'absolute';
      toolbar.style.width = '100%';
      toolbar.style.height = '35px';
      toolbar.style.top = "0px";
      toolbar.style.left = "0px";

      document.location = '#top';
      iFrameMode = 'maximized';
   }
   else {
      var iFrame = document.getElementById(_iframeID);
      var toolbar = document.getElementById('e-toolbar');

      $x('main').style.visibility = 'visible';
      $x('e-footer').style.visibility = 'visible';

      // reset the old size and positioning
      iFrame.style.position = iFrameStyle[0];
      iFrame.style.width = iFrameStyle[1];
      iFrame.style.height = iFrameStyle[2];
      iFrame.style.top = iFrameStyle[3];
      iFrame.style.left = iFrameStyle[4];

      toolbar.style.position = toolbarStyle[0];
      toolbar.style.width = toolbarStyle[1];
      toolbar.style.height = toolbarStyle[2];
      toolbar.style.top = toolbarStyle[3];
      toolbar.style.left = toolbarStyle[4];

      // change image and onclick handler
      //$x(_restoreBtnId).className = "maxButtonImage";
      //$x(_restoreBtnId).onclick = function(){maxWindow(_iframeID, _restoreBtnId)}; 
      iFrameMode = 'minimized';
   }
}

function centerOfPage(pVideo) {
   var Element = $x(pVideo);
   objh = parseFloat(Element.style.height) / 2;
   objw = parseFloat(Element.style.width) / 2;
   var y = Math.floor(Math.round((document.documentElement.offsetHeight / 2) + document.body.scrollTop) - objh);
   var x = Math.floor(Math.round((document.documentElement.offsetWidth / 2) + document.body.scrollLeft) - objw);
   return [x, y];
}

function showiPhone(piPhone, pThis, pThat) {
   var iPhone = $x(piPhone);
   var xypos = centerOfPage(piPhone);
   var x = xypos[0];
   var y = 25;
   // commented out because we don't want to start from the middle height of the page
   //var y = xypos[1];
   showVideo(pThis, pThat);
   iPhone.style.visibility = 'visible';
   JSFX_FloatDiv(piPhone, x, y).flt();
}

function showVideo(pThis, pThat) {
   var src = '<OBJECT ID="MediaPlayer" WIDTH="322" HEIGHT="230" CLASSID="CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95" STANDBY="Loading Windows Media Player components..." TYPE="application/x-oleobject"> <PARAM NAME="FileName" VALUE="#IMAGE_PREFIX#e-dba-website/flash/e-dba-alex.wmv"> <PARAM name="autostart" VALUE="false"> <PARAM name="ShowControls" VALUE="true"> <param name="ShowStatusBar" value="false"> <PARAM name="ShowDisplay" VALUE="false"> <EMBED TYPE="application/x-mplayer2" SRC="#IMAGE_PREFIX#e-dba-website/flash/e-dba-alex.wmv" NAME="MediaPlayer" WIDTH="322" HEIGHT="230" ShowControls="1" ShowStatusBar="0" ShowDisplay="0" autostart="0"> </EMBED> </OBJECT>';
   var video = $x(pThis);
   video.innerHTML = src;
   video.style.visibility = 'visible';
   if (pThat) {
      $x(pThat).style.visibility = 'hidden';
      $x(pThat).innerHTML = '';
   }
}

function hideiPhone(piPhone, pThis, pThat) {
   if (piPhone) $x(piPhone).style.visibility = 'hidden';
   if (pThis) {
      $x(pThis).style.visibility = 'hidden';
      $x(pThis).innerHTML = '';
   }
   if (pThat) {
      $x(pThat).style.visibility = 'hidden';
      $x(pThat).innerHTML = '';
   }
}

function loadiFrame(pThis, pThat, pPage) {
   if (pPage.indexOf('ttp') > 0) {
      var src = '<iframe name="seciframe" id="ipframe" scrolling="yes" frameborder="0" width="330" height="230" style="border: 1px solid #cecfce;" src="' + pPage + '"></iframe>';
   } else {
      var src = '<iframe name="seciframe" id="ipframe" scrolling="yes" frameborder="0" width="330" height="230" style="border: 1px solid #cecfce;" src="f?p=ORACLE_SUPPORT:' + pPage + ':0:::"></iframe>';
   }
   if (pThis) {
      $x(pThis).innerHTML = src;
      $x(pThis).style.visibility = 'visible';
      $x(pThis).style.display = 'block';
   }
   if (pThat) {
      $x(pThat).style.visibility = 'hidden';
      $x(pThat).innerHTML = '';
   }
}

function loadGoogleMap(pThis, pThat) {
   if (GBrowserIsCompatible()) {
      var map = new GMap2(document.getElementById(pThis));
      map.addControl(new GSmallMapControl());
      map.addControl(new GMapTypeControl());

      map.setCenter(new GLatLng(50.820428283799, -0.138595104218), 13);

      // Our info window content
   }
   $x(pThis).style.visibility = 'visible';
   $x(pThis).style.display = 'block';
   if (pThat) {
      $x(pThat).style.visibility = 'hidden';
      $x(pThat).innerHTML = '';
   }
}
