function ocultar(objCtrl){
var objText=eval('document.all.'+ objCtrl);
objText.value='';
}

function abreventa(nombre,w,h){

try
{
  var urlArray = new Array();
  urlArray = window.location.href.split('/');
  
  if (urlArray.length == 5 && urlArray[3].toString().toUpperCase() == "CIFARMA")
  {
  	//nombre = "http://www.cifarma.com.pe/asp";
  }
  else if (urlArray.length == 5 && urlArray[3].toString().toUpperCase() == "QUIMIZA")
    {
    	//nombre = "http://www.quimiza.com/espanol/extranet.htm";
    	//nombre = "http://www.quimiza.com/espanol/servicios.htm";
  }
  else if (urlArray.length == 5 && urlArray[3].toString().toUpperCase() == "QUIFATEX")
      {
      	nombre = "http://200.31.110.42/extranet/";
      	//nombre = "http://www.quimiza.com/espanol/servicios.htm";
  }
  
  var now = new Date();
  var hours = now.getHours();
  var minutes = now.getMinutes()
  var seconds = now.getSeconds()
            
  window.open(nombre, hours+minutes+seconds,'top=0,left=0,toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=yes,resizable=yes,width='+w+',screenX=20,screenY=20,height='+h).focus();;
  }
  catch(e)
  {
  
  }
}

function abreventafull(nombre)
{
	try
	{
	    var now = new Date();
	    var hours = now.getHours();
            var minutes = now.getMinutes()
            var seconds = now.getSeconds()
	    win = window.open(nombre, minutes+hours+seconds, 'scrollbars=yes, status=yes, resizable=yes, top=0, left=0');
	    win.resizeTo(screen.availWidth, screen.availHeight);
	    win.focus();
	}
	catch(e){}
//    window.screen.availHeight
//    window.screen.availWidth
//    window.resizeTo(x,y);
//    window.open(nombre,'newl','fullscreen=yes, scrollbars=auto');
}


function consisfec(xdia,xmes,xano) {
  if (parseInt(xdia)==0 || parseInt(xmes)==0 || parseInt(xano)==0) return false;
  var meses=new Array(31,28,31,30,31,30,31,31,30,31,30,31);
  meses[1]=((xano % 4)==0) ? 29 : 28;
  return ((xdia<=meses[xmes-1]) ? true : false);
}

function esEmail(elm) {
  var indiceArroba=elm.value.indexOf('@');
  var longitud=elm.value.length;
  if (indiceArroba<1 || longitud<5) return false;
  for (i=0;i<longitud;i++)
    if (elm.value.charAt(i) < '!' || elm.value.charAt(i) > '~') return false;

  if (elm.value.indexOf(' ') == -1 &&
      elm.value.indexOf(';') == -1 &&
      elm.value.indexOf(',') == -1 &&
      elm.value.indexOf('/') == -1 &&
      elm.value.indexOf('?') == -1 &&
      elm.value.indexOf('*') == -1 &&
      elm.value.indexOf(':') == -1 &&
      elm.value.indexOf('<') == -1 &&
      elm.value.indexOf('>') == -1 &&
      elm.value.indexOf('(') == -1 &&
      elm.value.indexOf(')') == -1 &&
      elm.value.indexOf('[') == -1 &&
      elm.value.indexOf(']') == -1 &&
      elm.value.indexOf('{') == -1 &&
      elm.value.indexOf('}') == -1 &&
      elm.value.indexOf('«') == -1 &&
      elm.value.indexOf('`') == -1 &&
      elm.value.indexOf('.') != -1 &&
      elm.value != '' &&
      indiceArroba < (longitud-5)) {
    dominioEmail=elm.value.substring(indiceArroba+1,longitud);
    if (dominioEmail.indexOf('@') == -1 &&
        dominioEmail.indexOf('.') > 0 &&
        dominioEmail.charAt(dominioEmail.length - 1) != '.')
      return true;
    else return false
  }
  else return false;
}

function noVacio(elm) {
  if (elm.value == '' ||
    elm.value == null) 
  return false;
  else return true;
}

function trim(str) {
  while (str.charAt(0) == ' ') str = str.substring(1);
  while (str.charAt(str.length - 1) == ' ') str = str.substring(0, str.length - 1);
  return str;
}

function valorDeCombo(objectoCombo) {
  return objectoCombo.options[objectoCombo.selectedIndex].value;
}