// JavaScript Document
//Agregar a favoritos
	function agregar(){
		if ((navigator.appName=="Microsoft Internet Explorer") && (parseInt(navigator.appVersion)>=4)) {
			var url="http://www.resorteshercules.com/"; 
			var titulo="::: Hercules :::";
			window.external.AddFavorite(url,titulo);
		}
		else { 
			if(navigator.appName == "Netscape") 
				alert("Presiona Crtl+D para agregar este sitio a tus Favoritos."); 
		}
	}
//Establecer como pagina de inicio diferente a Explorer
	function ini() {
		var browsName = navigator.appName;
		if (browsName == "Microsoft Internet Explorer") {
			alert ("Gracias por seleccionarnos como tu pgina de inicio en tu navegador.");
		} else
		if (browsName == "Netscape") {
			alert ("\nPara poner www.resorteshercules.com como tu pgina de inicio desde Mozilla Firefox:\n\n- Abre el menu Herramientas (Tools), submenu Opciones (Options).\n- Seleccionas la pestaa General (General).\n- En Pgina de Inicio (Home Page) has clic en el botn Usar Pgina Actual (Use Current Page).\n- Una vez hecho esto, pulsa OK.\n\nGracias por dejarnos ser tu pgina de inicio en tu navegador.");
		} else
			alert ("\nPara poner www.resorteshercules.com como tu pgina de inicio:\n\n- Consulta las instrucciones de tu navegador\n\nGracias por dejarnos ser tu pgina de inicio en tu navegador.");
	}
	
	
function LTrim( value ) {
	var re = /\s*((\S+\s*)*)/;
	return value.replace(re, "$1");
}


function RTrim( value ) {
	var re = /((\s*\S+)*)\s*/;
	return value.replace(re, "$1");
}


function Trim( value ) {
return LTrim(RTrim(value));
}


function getCheckedValue(radioObj) {
	if(!radioObj)
		return "";
	var radioLength = radioObj.length;
	if(radioLength == undefined)
		if(radioObj.checked)
			return radioObj.value;
		else
			return "";
	for(var i = 0; i < radioLength; i++) {
		if(radioObj[i].checked) {
			return radioObj[i].value;
		}
	}
	return "";
}

function ValidarVacios(campos)
{
	// HASTA AHORA SOLO PARA OBJETOS CON VALUE !!!, FALTAN RADIO Y CHECK ...
esta_bien = true;
for(i=0;i<campos.length;i++){
var obj = document.getElementsByName(campos[i]);
for(j=0;j<obj.length;j++)
 if (Trim(obj[j].value)==''){
  esta_bien = false; 
  window.focus(obj[j]);
  break;
  }
}
if(!esta_bien) alert('Por Favor Complete Todos Los Campos Obligatorios');
return esta_bien;	
}

function ValidarSolInfo()
{
var campos = new Array('Name','Email','Enterprise','CurrentJob','Phone2','country','City','Phone2','WorkerNumber','Industry', 'country');
//var campos_selects = new Array('WorkerNumber','Industry');
//var ok = ValidadSinSeleccion(campos_selects);
var tabien = ValidarVacios(campos);
if(tabien) {
hola = window.open('about:blank','nuevaVentana','menubar=no,status=no,height=200,width=400');
hola.focus();}
return tabien;
}

function ValidarNuevosProductos()
{
var campos = new Array();	
tabien = true;
alguna = false;
for(i=0;i<document.nuevosproductos.rows.value;i++)
{

requerido = false;
completa = true;


for(j=0;j<document.nuevosproductos.elements.length;j++)
if(document.nuevosproductos.elements[j].row != null)
if(document.nuevosproductos.elements[j].row==""+(i+1)) {
if((j!=2)&&(j!=3)&&(j!=6)&&(j!=7))	
completa  = completa&&(document.nuevosproductos.elements[j].value!="");
if(document.nuevosproductos.elements[j].value!="") requerido = true;		
}
alguna = alguna||completa;
tabien = tabien&&((requerido&&completa)||(!requerido));
}
tabien = tabien&&alguna;
if(tabien) {
hola = window.open('about:blank','nuevaVentana','menubar=no,status=no,height=200,width=400');
hola.focus();}
else
alert("Favor complete las lineas que ha llenado !");
return tabien;
}

function ConfRecomendada(){
hola = window.open('requerimientos.asp','nuevaVentana','menubar=no,status=no,scrollbars=yes,height=400,width=500');
hola.focus();	
	
}	
