function ventanaNueva(theURL,winName,w,h,l,t,resize,scroll,stat,tool,locat,direct,menu,history) 
{
	features = 'width=' + w + ',height=' + h + ',left=' + l + ',top=' + t + ',resizable=' + resize + ',scrollbars=' + scroll + ',status=' + stat + ',toolbar=' + tool + ',location=' + locat + ',directories=' + direct + ',menubar=' + menu + ',copyhistory=' + history + ',screenX=' + l + ',screenY=' + t
	window.open(theURL, winName, features)
}


function expandCollapse(ElementId)
{
	var theElement = document.getElementById(ElementId);
	theElement.style.display = (theElement.style.display == 'none') ? 'block' : 'none';
}

function closeDiv(ElementId)
{
	var theElement = document.getElementById(ElementId);
	theElement.style.display = 'none'
}

function openDiv(ElementId)
{
	var theElement = document.getElementById(ElementId);
	theElement.style.display = 'block'
}

function trim(x) {
   
   while (x.substring(0,1) == ' ') x = x.substring(1);
   while (x.substring(x.length-1,x.length) == ' ') x = x.substring(0,x.length-1);
   return x;
}

function validarCorreo(valor) {
  if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(valor)){
    return (true)
  } else {
    return (false);
  }
}

function validarEmail(valor) {
	valor=valor.replace(';',',');
	var correo;

  while (1){
    var num = valor.indexOf(",");
    if(num>0){
      correo = valor.substring(0,num);
      correo =trim(correo);
      if (!validarCorreo(correo)) return false;
      var longi = valor.length;
      valor=valor.substring(num+1,longi);
    }else {
      correo = valor;
      correo =trim(correo);
      if (!validarCorreo(correo)) return false;
      break;
    }
  
  }  
  return true;
}

function validarEmailMulti(valor) {
	var email = valor.split(',');
	for (var i = 0; i < email.length; i++) {
		if (!validarEmail(email[i], 1, 0)) {
			//alert('one or more email addresses entered is invalid');
			return false;
		}
	}
	return true;
} 

function Left(str, n){
	if (n <= 0)
	    return "";
	else if (n > String(str).length)
	    return str;
	else
	    return String(str).substring(0,n);
}

function Right(str, n){
    if (n <= 0)
       return "";
    else if (n > String(str).length)
       return str;
    else {
       var iLen = String(str).length;
       return String(str).substring(iLen, iLen - n);
    }
}

function getFlashMovieObject(movieName)
{
  if (window.document[movieName]) 
  {
    return window.document[movieName];
  }
  if (navigator.appName.indexOf("Microsoft Internet")==-1)
  {
    if (document.embeds && document.embeds[movieName])
      return document.embeds[movieName]; 
  }
  else // if (navigator.appName.indexOf("Microsoft Internet")!=-1)
  {
    return document.getElementById(movieName);
  }
}
	
function CallFrameFlashMovie(movieName, nextFrame)
{
	var flashMovie=getFlashMovieObject(movieName);
	flashMovie.GotoFrame(nextFrame);		
}
