﻿
// JScript File
var pg_innerWidth = 0, pg_innerHeight = 0;   
var sc_availWidth = 0, sc_availHeight = 0;   
var sc_Width = 0, sc_Height = 0;   
var scrOfX = 0, scrOfY = 0;

function WinSize() {
  sc_Width = screen.width;
  sc_Height = screen.height;
}

function availWinSize() {
	sc_availWidth=screen.availWidth;
	sc_availHeight=screen.availHeight;
}

function innerWinSize() {
  if( typeof( window.innerWidth ) == 'number' ) {
    pg_innerWidth = window.innerWidth; 
    pg_innerHeight = window.innerHeight;
  } 
  else if( document.documentElement && ( document.documentElement.clientWidth ||document.documentElement.clientHeight ) ) {
    pg_innerWidth = document.documentElement.clientWidth; 
    pg_innerHeight = document.documentElement.clientHeight;
  } 
  else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    pg_innerWidth = document.body.clientWidth; 
    pg_innerHeight = document.body.clientHeight;
  }
  //window.alert( 'Width = ' + myWidth + ' and height = ' + myHeight );
}

function getScrollXY() {
  if( typeof( window.pageYOffset ) == 'number' ) {
    scrOfY = window.pageYOffset; scrOfX = window.pageXOffset;
  } 
  else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
    scrOfY = document.body.scrollTop; scrOfX = document.body.scrollLeft;
  } 
  else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
    scrOfY = document.documentElement.scrollTop; scrOfX = document.documentElement.scrollLeft;
  }
  //window.alert( 'Horizontal scrolling = ' + scrOfX + '\nVertical scrolling = ' + scrOfY );
}    

// Maximizar la ventana 
function WinToMaxSize() {
	try{
		window.moveTo(0,0);
		availWinSize();
		if (document.all) {
			top.window.resizeTo(sc_availWidth,sc_availHeight);
		}
		else if (document.layers||document.getElementById) {
			if (top.window.outerHeight<sc_availHeight||top.window.outerWidth<sc_availWidth){
				top.window.outerHeight = sc_availHeight;
				top.window.outerWidth = sc_availWidth;
			}
		}
	}
	catch(err)	{	}
}

function popupWindow(url_page, page_name, w, h, scroll) {
  WinSize();
	var winl = (sc_Width - w) / 2;
	var wint = (sc_Height - h) / 2;
	winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',resizable'
	win = window.open(url_page, page_name, winprops)
	//if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
}

function openWin(url) {
	var opciones="toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,width=650,height=400,top=25,left=50";
	window.open(url,"",opciones); 
}

function openWinMax(url) {
	//var opciones="toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,width=650,height=400,top=25,left=50";
	var opciones="toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=yes,resizable=no,fullscreen=yes";	
	window.open(url,"",opciones); 
	WinToMaxSize();
}

function ToInnerWinSize(src) {
	innerWinSize();
	src.Width = pg_innerWidth;
    src.Height = pg_innerHeight;
}