function lib_bwcheck(){ 
this.ver= parseInt(navigator.appVersion);
var agt=navigator.userAgent.toLowerCase();
this.dom=document.getElementById?1:0
this.ns= ((agt.indexOf('mozilla')!=-1) && (agt.indexOf('spoofer')==-1)
&& (agt.indexOf('compatible') == -1) && (agt.indexOf('opera')==-1)
&& (agt.indexOf('webtv')==-1) && (agt.indexOf('hotjava')==-1));
this.ns4 = (this.ns && (this.ver == 4));
this.ns4up = (this.ns && (this.ver >= 4));
this.ns6 = (this.ns && (this.ver == 5));
this.ies     = ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1));
this.ie4    = (this.ies && (this.ver == 4) && (agt.indexOf("msie 4")!=-1) );
this.ie  = (this.ies  && (this.ver >= 4));
this.ie5    = (this.ies && (this.ver == 4) && (agt.indexOf("msie 5.0")!=-1) );
this.ie5_5  = (this.ies && (this.ver == 4) && (agt.indexOf("msie 5.5") !=-1));
this.ie5up  = (this.ies  && !this.ie3 && !this.ie4);
this.ie5_5up =(this.ies && !this.ie3 && !this.ie4 && !this.ie5);
this.ie6 = (this.ies && (this.ver == 4) && (agt.indexOf("msie 6.")!=-1) );
this.bw=(this.ie||this.ns4up)
  return this
if(bw.ns4 || bw.ie4) return lib_message('La presente página está diseñada para Internet Explorer 5 ó +,Netscape 6/7, Firefox 0.8/0.9 y Opera 7. Es posible que encuentre problemas en su navegación')
}
bw=new lib_bwcheck() //Browsercheck object

function lib_message(txt){alert(txt); return false}
function lib_obj(obj,nest){ 
 this.nested="";
if(bw.ns4 && nest){ //get nested
nest="n "+nest;
nest=nest.split(' ');
for(var i=1;i<nest.length;i++) this.nested+="document."+nest[i]+".";}
this.evnt=bw.ns4?eval(this.nested+'document.layers["'+obj+'"]'):bw.ie4?eval('document.all["'+obj+'"]'):
bw.dom?eval('document.getElementById("'+obj+'")'):0;
  if(!this.evnt) return lib_message('The layer does not exist ('+obj+')' 
    +'- \nIf your using Netscape please check the nesting of your tags!')
  this.css=bw.dom||bw.ie4?this.evnt.style:this.evnt; 
  this.ref=bw.dom||bw.ie4?document:this.css.document
    this.x=parseInt(this.css.left)||this.css.pixelLeft||this.evnt.offsetLeft||0;
  this.y=parseInt(this.css.top)||this.css.pixelTop||this.evnt.offsetTop||0
  }

//Writing content to object ***
lib_obj.prototype.writeIt = function(text,startHTML,endHTML){
	if(bw.ns4){
    if(!startHTML){startHTML=""; endHTML=""}
	  this.ref.open("text/html"); 
    this.ref.write(startHTML+text+endHTML); 
    this.ref.close()
	}else this.evnt.innerHTML=text
}


function Imagen(imagen, nombre_ventana, pie, dimensiones, ancho, alto) { 
var codHTML = "";
var aleatorio = "" + Math.random();
aleatorio = aleatorio.substring(1+aleatorio.indexOf("."),aleatorio.length);
var ventana;
ventana = window.open("/blanco.html",aleatorio,dimensiones,"resizable=0");
codHTML += '<HTML><HEAD><TITLE>';
codHTML += nombre_ventana;
codHTML += '</TITLE><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"></HEAD><BODY onblur="javascript:window.close()" onclick="javascript:window.close()" bgcolor="FFFFFF" leftMargin=0 text=000000 topMargin=0 marginwidth="0" marginheight="0">';
codHTML += '<IMG SRC="' + imagen + '" WIDTH=' + ancho + ' HEIGHT=' + alto + ' ALT="" BORDER="0">';
codHTML += '<BR><table width="' + ancho + '" border="0" cellspacing="0" cellpadding="5"><tr align="right"><td><div align=justify>';
codHTML += '<font size="1" color="#333333" face="Verdana, sans-serif">' + pie;
codHTML += '</font></div>';
codHTML += '</td></tr></table>';
codHTML += '</BODY></HTML>';
ventana.document.open();
ventana.document.write(codHTML);
ventana.document.close();
}

function Ventana(url,w,h)

{
var aleatorio = "" + Math.random();
aleatorio = aleatorio.substring(1+aleatorio.indexOf("."),aleatorio.length);

  Window=window.open(url, aleatorio, 'location=0,resizable=0,status=0,titlebar=1,directories=0,toolbar=0,menubar=0,scrollbars=0,status=0,screenX=200,screenY=35,width='+w+',height='+h);

  Window.focus();

  onscreen=true;
}

function Item(){
  this.length = Item.arguments.length 
  for (var i = 0; i < this.length; i++)
    this[i] = Item.arguments[i]
}

function Fecha() {
  var nmes  = new Item('enero', 'febrero', 'marzo', 'abril', 'mayo', 'junio', 
                          'julio', 'agosto', 'septiembre', 'octubre', 'noviembre', 'diciembre')
  var ahora
  var fecha = new Date()
  var ano   = fecha.getYear()
  var mes   = fecha.getMonth()
  var aux   = "" + fecha
  
  if (ano<10) {
    ano2 = "200" + eval(ano)
  }
  else if (ano<80) {                
    ano2 = "20" + ano
  } 
  else if (ano<=99) {               
    ano2 = "19" + ano
  }
  else if (ano<1000) {              
    ano2 = eval(ano) + eval(1900)
  }
  else {
    ano2 = ano                     
  }
  

  ahora = " , " + eval(aux.substring(7, 10)) + " de " + nmes[mes] + " de " + ano2
  return ahora
}

	function comprobarform(formobj,funcion){
	// dialog message

	var alertMsg = typeof(msgAlert)=="undefined"?"Por favor rellene los siguientes campos:\n":msgAlert;
	var l_Msg = alertMsg.length;
	
	for (var i = 0; i < fieldRequired.length; i++){
		var obj = formobj.elements[fieldRequired[i]];
		if (obj){
			switch(obj.type){
			case "select-one":
				if (obj.selectedIndex == -1 || obj.options[obj.selectedIndex].text == ""){
					alertMsg += " - " + fieldDescription[i] + "\n";
				}
				break;
			case "select-multiple":
				if (obj.selectedIndex == -1){
					alertMsg += " - " + fieldDescription[i] + "\n";
				}
				break;
			case "text":
			case "textarea":
				if (obj.value == "" || obj.value == null){
					alertMsg += " - " + fieldDescription[i] + "\n";
				}
				break;
			default:
			}
			if (obj.type == undefined){
				var blnchecked = false;
				for (var j = 0; j < obj.length; j++){
					if (obj[j].checked){
						blnchecked = true;
					}
				}
				if (!blnchecked){
					alertMsg += " - " + fieldDescription[i] + "\n";
				}
			}
		}
if(alertMsg.length == l_Msg && fieldEmail[i]==1 && validateEmail(obj.value)==false){
alertMsg='Por favor, compruebe que el e-mail que ha escrito en --'+fieldDescription[i]+'-- se compone de: nombredeusuario+@+dominio+.+extensión. Por ejemplo: nombreusuario@servidordecorreo.com';
break
}	
	}

if (alertMsg.length == l_Msg){//<if-1
args=comprobarform.arguments;
argsLen=comprobarform.arguments.length;
for (i=1;i<argsLen;i++){//<for-2
if(args[i]!=""){//<if-3
funcion=args[i];
if(funcion(formobj)){//<if-4
}
else{return false;
break}//>if-4

}//>if-3
}//>for-2
lacapa.writeIt('<strong>Enviando...</strong>');
formobj.submit();


}
	else{
		alert(alertMsg);
		return false;
	} 
}
function iguales(formobj){
if(formobj.elements[losiguales[0]].value==formobj.elements[losiguales[1]].value){
return true
}else{
alert("Por favor compruebe que "+losigualesDescripcion[0]+" y "+losigualesDescripcion[1]+" son iguales");
return false
}
}

function unoden(formobj){
argsLen=unodeN.length;
for (i=0;i<argsLen;i++){//<for-2
if(formobj.elements[unodeN[i]].value!=""){
return true;
break;
}}
alert("Por favor compruebe que ha elegido una opción de "+unodeNDescripcion);
return false;
}

function validateEmail(formobj)
{

splitted = formobj.match("^(.+)@(.+)$");
    var regexp_user=/^\"?[\w-_\.]*\"?$/;
    var regexp_domain=/^[\w-\.]*\.[A-Za-z]{2,4}$/;
    var regexp_ip =/^\[\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\]$/;	 
						    if(splitted==null || (splitted[1] != null && splitted[1].match(regexp_user) == null) || (splitted[2] != null && splitted[2].match(regexp_domain) == null && splitted[2].match(regexp_ip) == null))
							{ 						
return false;							}					
							return true;	
}
function resetear(){
campos=Array("INPUT","SELECT","TEXTAREA");
tipoexcluido=Array("hidden");
tipoexcluidolen=tipoexcluido.length;
	for(h=0;h<campos.length;h++){
	elementoslen=document.getElementsByTagName(campos[h]).length;
		for(i=0;i<elementoslen;i++){
			for(j=0;j<tipoexcluidolen;j++){
					if(document.getElementsByTagName(campos[h])(i).getAttribute("type")!=tipoexcluido[j]){
					document.getElementsByTagName(campos[h])(i).value="";
					}
			}
		}
	}
}

function volver() { 
				var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;}

			function MM_findObj(n, d) {
				var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
				d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
				if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
				for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); return x;
			}
			function vermov() {
				var i,j=0,x,a=vermov.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
				if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
			}
			function comment(comentario){
window.status=comentario;
}
function uncomment(){
window.status="Hotel Abanico";
window.defaultStatus="Hotel Abanico"
}
if(bw.ie){
window.defaultStatus="Hotel Abanico"}
