//
// Cinematica Producciones Ltda.
// Copyright (C) 2003 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 OpenFileCentered(szUrl) {
	var iWidth = fixedWidth;
	var iHeight = fixedHeight;
	var filesCenterLeft = (screenWidth - iWidth) / 2;
	var filesCenterTop = (screenHeight - iHeight) / 2;
	winNewFile = window.open(szUrl, "winSANewFile", "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 + ",scrollbars=0");
	winNewFile.focus();
}

function OpenFileToPrint(szUrl,szWinName,iWidth,iHeight) {
	var filesCenterLeft = (screenWidth - iWidth) / 2;
	var filesCenterTop = (screenHeight - iHeight) / 2;
	winNewFile = window.open(szUrl,szWinName, "menubar=1,left=" + filesCenterLeft + ",top=" + filesCenterTop + ",width=" + iWidth + ",height=" + iHeight + ",scrollbars=1");
	winNewFile.focus();
}

// 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;
}