//
// Cinematica Producciones Ltda.
// Copyright (C) 2002 by Cinematica.
//

var screenWidth = screen.width;
var screenHeight = screen.height;
var fixedWidth = 640;
var fixedHeight = 480;
var centerLeft = (screenWidth - fixedWidth) / 2;
var centerTop = (screenHeight - fixedHeight) / 2;

function OpenNewFile(szUrl) {
  var iWidth = fixedWidth;
  var iHeight = fixedHeight;
  var filesCenterLeft = (screenWidth - iWidth) / 2;
  var filesCenterTop = (screenHeight - iHeight) / 2;
  winNewFile = window.open(szUrl, "winMMNewFile", "menubar=0,left=" + filesCenterLeft + ",top=" + filesCenterTop + ",width=" + iWidth + ",height=" + iHeight + ",resizable=1,scrollbars=1");
  winNewFile.focus();
}

function OpenNewFileCentered(szUrl,szWinName,iWidth,iHeight) {
  var filesCenterLeft = (screenWidth - iWidth) / 2;
  var filesCenterTop = (screenHeight - iHeight) / 2;
  winNewFile = window.open(szUrl,szWinName, "menubar=0,left=" + filesCenterLeft + ",top=" + filesCenterTop + ",width=" + iWidth + ",height=" + iHeight + ",resizable=1,scrollbars=1");
  winNewFile.focus();
}

function OpenNewFileCF(szUrl,szWinName,iWidth,iHeight,b) {
  var filesCenterLeft = (screenWidth - iWidth) / 2;
  var filesCenterTop = (screenHeight - iHeight) / 2;
  winNewFile = window.open(szUrl,szWinName, "menubar=0,left=" + filesCenterLeft + ",top=" + filesCenterTop + ",width=" + iWidth + ",height=" + iHeight + ",resizable=0,scrollbars=" + b);
  winNewFile.focus();
}

var winProjectWidth = 800;
var winProjectHeight = 600;

function openResourceWindow(theURL) {
  var winWidth = winProjectWidth - 50;
  var winHeight = winProjectHeight - 50;
  var winName = "__winRes";
  var centerLeft = (screen.width - winWidth) / 2;
  var centerTop = (screen.height - winHeight) / 2;
  var szCenterSettings = ",left=" + centerLeft + ",top=" + centerTop + ",width=" + winWidth + ",height=" + winHeight + ",resizable=yes";
  w = window.open(theURL, winName, szCenterSettings);
  return w;
} 

// Strings Crypter
function cryptbuffer(szSource, iLen) {
  var ch, s = "";
  for(var i = 0; i < iLen; i++) {
    ch = szSource.charCodeAt(i);
    ch ^= (iLen - i);
    s += String.fromCharCode(ch);
  }
  return s;
}

function openTargetWindow(szURL) {
  var w = window.open(szURL, "IS_ROYALV4_Course")
	if(w)
	  w.focus();
}

