﻿// JScript File
// JScript File
  // width to resize large images to
var maxWidth=200;
  // height to resize large images to
var maxHeight=320;
  // valid file types
var fileTypes=["bmp","gif","png","jpg","jpeg"];
  // the id of the preview image tag
var outImage="previewField";
  // what to display when the image is not valid
var defaultPic="spacer.gif";

/***** DO NOT EDIT BELOW *****/

function preview(what){
  var source=what.value;
  var ext=source.substring(source.lastIndexOf(".")+1,source.length).toLowerCase();
  for (var i=0; i<fileTypes.length; i++) if (fileTypes[i]==ext) break;
  globalPic=new Image();
  if (i<fileTypes.length) globalPic.src=source;
  else {
    globalPic.src=defaultPic;
    alert("THAT IS NOT A VALID IMAGE\nPlease load an image with an extention of one of the following:\n\n"+fileTypes.join(", "));
  }
  setTimeout("applyChanges()",200);
}
var globalPic;
function applyChanges(){
  var field=document.getElementById(outImage);
  var x=parseInt(globalPic.width);
  var y=parseInt(globalPic.height);
  if (x>maxWidth) {
    y*=maxWidth/x;
    x=maxWidth;
  }
  if (y>maxHeight) {
    x*=maxHeight/y;
    y=maxHeight;
  }
  field.style.display=(x<1 || y<1)?"none":"";
  field.src=globalPic.src;
  field.width=x;
  field.height=y;
}
function popup2(form, name, width, height, scrolls, resize)
{
        var hWindow;
		var iLeft, iTop;
		iLeft = (screen.width - width)/2;
	    iTop  = ((screen.height - height)/2)-20;	
							
		hWindow = window.open(form, name, "width="+width+",height="+height+",scrollbars="+scrolls+",resizable="+resize+",screenX="+iLeft+",left="+iLeft+",screenY="+iTop+",top="+iTop);
}
function popUp(URL) {
day = new Date();
id = day.getTime();
var hWindow;
var iLeft, iTop;
iLeft = (screen.width - 230)/2;
iTop  = ((screen.height - 120)/2)-20;	
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=yes,location=0,statusbar=0,menubar=0,resizable=yes,width=230,height=120');");
}

function Relocate(ventana){
alert ('Ventana'+ventana);
  //window.location.href=ventana;
}
function mail(form, name, width, height, scrolls, resize,mail){
        var hWindow;
		var iLeft, iTop;
		iLeft = (screen.width - width)/2;
	    iTop  = ((screen.height - height)/2)-20;	
		hWindow = window.open(form+"?mail="+mail, name, "width="+width+",height="+height+",scrollbars="+scrolls+",resizable="+resize+",screenX="+iLeft+",left="+iLeft+",screenY="+iTop+",top="+iTop);
}
function mailcontact(form, name, width, height, scrolls, resize,mail,nombre,telefono,comentarios,empresa,puesto,estado){
        var hWindow;
		var iLeft, iTop;
		iLeft = (screen.width - width)/2;
	    iTop  = ((screen.height - height)/2)-20;	
		hWindow = window.open(form+"?mail="+mail+"&nombre="+nombre+"&tel="+telefono+"&coment="+comentarios+"&emp="+empresa+"&pue="+puesto+"&est="+estado, name, "width="+width+",height="+height+",scrollbars="+scrolls+",resizable="+resize+",screenX="+iLeft+",left="+iLeft+",screenY="+iTop+",top="+iTop);


}
 