//Selecciona un elemento del Combo Box
function CBSelectItem( aSelect , aValue )
{
    var ops = aSelect.options;
    for (i=0; i< ops.length; i++)
      if (ops(i).value == aValue)
          ops(i).selected = true;
}

//Retorna true si el campo esta vacio y false en caso contrario
function isEmpty ( anEditBox, msg  ){
   if ( anEditBox.value == "") {
		alert (msg);
		anEditBox.focus();
		return true;
	 }   
   else
     return false;
  }


//Genera las clases para el combox
function buildClasses(aSelect, country){

  for ( var i = 1; i <= aSelect.length ; i++) aSelect.options[i] = null;
  for ( var i = 1; i <= 42 ; i++){  
     var option = new Option(i,i);
     eval("aSelect.options[i]=option" )
   }
  //Si el pais es VE agrego 3 clases mas (43,44 y 45)
  if ( country == 'VE') {
    for ( var i = 43; i <= 45 ; i++){  
      var option = new Option(i,i);
      eval("aSelect.options[i]=option" );
    }
  }
}


//parche en los formularios de cliente, como todos no se llaman frm_cliente, se hizo un case
function ChangeCountry(combo, aForm){
    FileName = '/frm_cliente.asp?default=N';
    if ((combo.value == 'VE') || ( combo.value == 'AR')){
        FileName = '/nv_form.asp?default=N'
        aForm.action = "/cliente/forms/" + combo.value + FileName;
	}
	else
	  if ((combo.value == 'BR') || ( combo.value == 'UY') || (combo.value == 'MX'))
	  {
         aForm.action = "/cliente/forms/" + combo.value + FileName;
	  }
	  else{
         aForm.action = "/cliente/forms/XX" + FileName;
	  }
	   
    aForm.submit();
 }




//Marcas aquellas opciones donde DeMarcas tiene BD
function DisplayCountriesDB( aSelect ){
    var ops = aSelect.options;
    for (i=0; i< ops.length; i++)
      if ((ops(i).value == 'AR')  || (ops(i).value == 'BR') || (ops(i).value == 'MX') || (ops(i).value == 'CO') || (ops(i).value == 'VE') || (ops(i).value == 'UY') || (ops(i).value == 'PE') )
	   {
          ops(i).text = ops(i).text + ' (*)' ;
	   }
}

