﻿// JScript File
var str = "left=0,top=0";

if (window.screen) {
  var ah = screen.height - 50;
  var aw = screen.width - 10;
  str += ",height=" + ah;
  str += ",innerHeight=" + ah;
  str += ",width=" + aw;
  str += ",innerWidth=" + aw;
} else {
  str += ",resizable"; // so the user can resize the window manually
}
str +="titlebar=no,status=no,toolbar=no,menubar=no";
function launchFull(url) 
{
  //Esto es Para Cuando no Esta En contruccion 
    window.open(url,'_blank',str); 
  //Esto es Para Cuando Esta En contruccion 
//  window.open('../underconstruction.htm','_blank',str); 
}
function closeIt() {
setTimeout('window.close()',2000); }
function launchWindow(url, features){window.open(url,"_blank",features);}
function showMessage(pMessage, pTitle, pWithTextArea, pFunction, pImage  )
{
    //<div style=''></div>
    if(document.layers||(document.getElementById&&!document.all))
        alert(pMessage);
    else
    {
        if(pFunction==null)
            pFunction = function(){return false;};

        if(pImage==null || pImage== ''  || pImage== undefined)
        {
            pImage = '/img/information.gif';
        }
            
        if(pWithTextArea)
        {
            myAlert.Dialog(pTitle, "<table align='center' border='0' cellpadding='0' cellspacing='2' style='border-collapse: collapse;'><tr><td valign='top' style='border-width:0px;white-space:nowrap;' ><img src='" + pImage + "' border='0' style='padding:15px;padding-top:5px;' /></td><td valign='middle' style='border-width:0px;'><textarea rows='2' cols='20' class='PlanoLeftCtm' style='height:100px;width:423px;;vertical-align:middle;' readonly='readonly'>" + pMessage + "</textarea></td></tr></table>", "Aceptar", pFunction , "Image");
        }
        else
        {
            myAlert.Dialog(pTitle, "<table align='center' border='0' cellpadding='0' cellspacing='2' style='border-collapse: collapse;' width='100%'><tr><td valign='middle' style='border-width:0px;white-space:nowrap;'><div style='float:left;'><img src='" + pImage + "' border='0' style='padding:15px;padding-top:5px;' /></div></td><td valign='middle' style='border-width:0px;' width='100%'>" + pMessage + "</td></tr></table>", "Aceptar", pFunction, "Image");
        }
    }
}
function showAlertConfirm(pMessage, pTitle, pWithTextArea, pFunctionAceptar, pFunctionCancelar  )
{
    if(document.layers||(document.getElementById&&!document.all))
    {
        if(confirm(pMessage))
        {
           return true;
        }
        else
            return false;       
    }        
    else
    {
        if(pFunctionCancelar==null)
            pFunctionCancelar = function(){return false;};
        if(pFunctionAceptar==null)
            pFunctionAceptar = function(){return true;};
            
        if(pWithTextArea)
        {
            myAlert.Confirm(pTitle, "<table align='center' border='0' cellpadding='0' cellspacing='2' style='border-collapse: collapse;'><tr><td valign='top' style='border-width:0px;white-space:nowrap;' ><img src='/img/information.gif' border='0' style='padding:15px;padding-top:5px;' /></td><td valign='middle' style='border-width:0px;white-space:nowrap;'><textarea rows='2' cols='20' class='PlanoLeftCtm' style='height:100px;width:423px;;vertical-align:middle;' readonly='readonly'>" + pMessage + "</textarea></td></tr></table>", "Aceptar", pFunctionAceptar , "Image", "Cancelar", pFunctionCancelar);
        }
        else
        {
            myAlert.Confirm(pTitle, "<table align='center' border='0' cellpadding='0' cellspacing='2' style='border-collapse: collapse;'><tr><td valign='middle' style='border-width:0px;white-space:nowrap;'><div style='float:left;'><img src='/img/information.gif' border='0' style='padding:15px;padding-top:5px;' /></div></td><td valign='middle' style='border-width:0px;white-space:nowrap;'><div style=''>" + pMessage + "</div></td></tr></table>", "Aceptar", pFunctionAceptar , "Image", "Cancelar", pFunctionCancelar);
        }
    }
}
function displayControl(pObjID, display)
{
  var htmlRender = valObj('_div' + pObjID);
  if(htmlRender!=null)
      htmlRender.style.display = display;
}
function renderControl(strHtml, pObjID)
{
  var htmlRender = valObj('_div' + pObjID);
  if(htmlRender!=null)
      htmlRender.innerHTML = strHtml;
}
function valObj(pobj)
{
   var pEval = '';
   if (document.layers)
   {
      // Netscape 4.0+
      pEval = 'document.' + pobj;
   }
   if (document.all)
   {
      //Internet Explorer 4.0+
      pEval = 'document.all.' + pobj;
   }
   if (document.getElementById)
   {
      // Internet Explorer 5.0+ and Netscape 6.0+
      pEval = "document.getElementById('" + pobj + "')";
   }

    try
    {
        var retOb = eval(pEval);
        return retOb;    
     }
     catch(e)
     {
        alert('Error en valObj\rDescripción: '+e.description+'.\rExpresión evaluada :' + pEval);
        return null;
     }
}   
function mask(str,textbox,loc,delim){
var locs = loc.split(',');

for (var i = 0; i <= locs.length; i++){
	for (var k = 0; k <= str.length; k++){
	 if (k == locs[i]){
	  if (str.substring(k, k+1) != delim){
	    str = str.substring(0,k) + delim + str.substring(k,str.length)
	  }
	 }
	}
 }
textbox.value = str
}

