///
var ie = (navigator.appName == "Microsoft Internet Explorer") ? true : false;
var ie6 
if(ie){
	_navV = navigator.userAgent.split(';');
	ie6 = (_navV[1].substring(6)<7) ? true : false;
}

///
win_ancho=screen.availWidth;
win_alto=screen.availHeight;
function wl(ruta){
	window.location=ruta;
}
function volver(){
	window.history.back();
}
///
function Cachear(){
	cacheOver=[];
	for(im=0; im<Cachear.arguments.length; im++){
		imagenCachear = Cachear.arguments[im];
		cacheOver[im] = new Image();
		cacheOver[im].src = imagenCachear;
	}	
}
//
function soloLetras(e){
	tecla = (e.keyCode) ? e.keyCode : e.which;
	if(e.ctrlKey && tecla==118 || tecla==39) return false;
    if (tecla==8 || tecla==9 || tecla==0 || tecla==13|| tecla==37 || tecla==46) return true;
    patron = /[A-Za-z\s]/;
    return patron.test(String.fromCharCode(tecla));
}
//
function soloEmail(e){
	arrayBlock = [' ','ñ','Ñ','[',']',',',';',':','{','}','(',')','+','*','/','=','&','%','$','#','!','<','>','|','°','?','¿','¡','\'','"'];
	var tecla = (e.keyCode) ? e.keyCode : e.which;
	if(e.ctrlKey && tecla==118 || tecla==39){
		return false;
	}
	var l = String.fromCharCode(tecla)
	for(var i=0; i<arrayBlock.length; i++){
		if(arrayBlock[i] == l){
			return false;
		}
	}
}
function soloNumeros(e){
	tecla = (e.keyCode) ? e.keyCode : e.which;
	if(e.ctrlKey && tecla==118 || tecla==39){
		return false;
	}
    if (tecla==8 || tecla==0 || tecla==13) return true;
    patron = /\d/;
    te = String.fromCharCode(tecla); 
    return patron.test(te); 
}
function filtrarTecla(e){		
	arrayBlock = ['[',']',',',';',':','{','}','(',')','+','*','/','=','&','%','$','#','!','<','>','|','°','?','¿','¡','\'','"',0,1,2,3,4,5,6,7,8,9];
	var tecla = (e.keyCode) ? e.keyCode : e.which;
	if(tecla==32 || tecla==13){
		return true;
	}
	if(e.ctrlKey && tecla==118 || tecla==39){
		return false;
	}
	var l = String.fromCharCode(tecla)
	for(var i=0; i<arrayBlock.length; i++){
		if(arrayBlock[i] == l){
			return false;			
		}
	}
}
//
memSRC = "";
function rollOver(obj){
	memSRC = obj.src;
	obj.src =  memSRC.substr(0,memSRC.length-4) + "_over" + memSRC.substring(memSRC.length-4);
}
function rollOut(obj){
	obj.src =  memSRC
}
//
function expandir(obj){
	with(document.getElementById(obj)){
		if(style.display=="none"){
			style.display="block";
		}else{
			style.display="none";
		}
	}
}
function verFoto(obj){
	document.getElementById("imgCont").src=obj.src;
}
//
function cancelarReserva(sistema,id){
	esOK=window.confirm('Esta seguro que desea Cancelar esta reserva?');
	if(esOK){
		if (sistema == 0){
			wl('ht_misreservas.asp?c=1&id='+id);
		}else{
			wl('ht_cancelando.asp?id='+id+'&s='+sistema);
		}
	}
}
///
function overCel(obj){
	obj.style.backgroundColor='#EFF5E5';
}
function outCel(obj, id){
	color='#F9F9F2';
	if(id=='1'){
		color='#F2F8F9';	
	}
	obj.style.backgroundColor=color;
}
function overCeld(obj){
	obj.style.backgroundColor='#ffffff';
}
function outCeld(obj,color){
	obj.style.backgroundColor=color;
}
//
//
_yscroll=_scrollto=0;
function scrollerTo(posv){
	_yscroll = getTopScroll();
	_scrollto=posv;
	intervalScroll=setInterval(scrollerMove,50);
}
function scrollerMove(){
	_yscroll += (_scrollto-_yscroll)/2;
	_ymove=Math.round(_yscroll);
	if(_ymove==_scrollto){
		clearInterval(intervalScroll);
	}
	window.scrollTo(0,_ymove);
}
function getTopScroll(){
	if(self.pageYOffset){		
		scrolTop = self.pageYOffset;
	}else if (document.documentElement && document.documentElement.scrollTop){
		scrolTop = document.documentElement.scrollTop;
	}else if (document.body){
		scrolTop = document.body.scrollTop;
	}
	return scrolTop;
}
//
function enfoco(obj){
	obj.style.border='1px solid #CDCED5';
}
function err(obj){
	obj.style.border='1px solid #D98200';
}
//
function Cbg(obj,color){
	obj.style.backgroundColor=color;
}
function Wo(ruta){
	window.open(ruta);
}
function Alpha(obj,valor){
	obj.style.filter='alpha(opacity='+valor+')';
	punto='.';
	if(valor==100){punto='';}
	obj.style.MozOpacity=punto+valor;
}
function Imprimir(pagina) {
	win_w=695;
	win_h=500;
	posLeft=(win_ancho/2)-(win_w/2);
	posTop=(win_alto/2)-(win_h/2);
	winB = window.open(pagina, 'ventanaF', 'width='+win_w+', height='+win_h+', top='+posTop+', left='+posLeft+', scrollbars=yes, status=no, resizable=no, toolbar=no');
	winB.focus();
}
function EnviarXmail(pagina) {
	win_w=300;
	win_h=195;
	posLeft=(screen.availWidth/2)-(win_w/2);
	posTop=(screen.availHeight/2)-(win_h/2);
	winB = window.open('enviarpormail.asp?pagina='+pagina, 'ventanaF', 'width='+win_w+', height='+win_h+', top='+posTop+', left='+posLeft+', scrollbars=no, resizable=no, toolbar=no');
	winB.focus();
}

function newAjax(){
	var http_request = false;
	if (window.XMLHttpRequest) {
		http_request = new XMLHttpRequest();
		if (http_request.overrideMimeType) {
			http_request.overrideMimeType('text/xml');			
		}
	} else if (window.ActiveXObject) {
		try {
			http_request = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try {
				http_request = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e) {}
		}
	}	
	if (!http_request) {            
		return false;
	}
	return http_request;
}

function getWindowHeight() {
	_wh = 0;
	if (document.body.scrollHeight && navigator.appVersion.indexOf("Win") != -1) {
		_wh = document.body.scrollHeight;
	}
	else if (document.documentElement.scrollHeight) {
		_wh = document.documentElement.scrollHeight;
	}
	else if (document.documentElement.offsetHeight) {
		_wh = document.documentElement.offsetHeight;
	}
	return _wh;
}
BlockWindow = function(e){
	if(e){
		with(GE('div_BlockWindow').style){		
			display = 'block';
			height = getWindowHeight()+'px';
			width = getWidth()+'px';
			hideSelectBoxes();
		}
	}else{
		GE('div_BlockWindow').style.display = 'none';
		showSelectBoxes();
	}
}
document.write('<div id="div_BlockWindow" ondblclick="WinViewClose();" style="background:url(img/win_block.gif);position:absolute; z-index:300; display:none; top:0;left:0;" oncontextmenu="return false" ondragstart="return false" onselectstart="return false"></div>');

getStyle = function(el,styleProp){
	var x = typeof el == 'String' ? document.getElementById(el) : el;
	if (x.currentStyle)
		var y = x.currentStyle[styleProp];
	else if (window.getComputedStyle)
		var y = document.defaultView.getComputedStyle(x,null).getPropertyValue(styleProp);
	return y;
}

vMemSelectsStyle = [];
vMemSelectsObject = [];
showSelectBoxes = function(){	
	for (i = 0; i != vMemSelectsStyle.length; i++) {
		vMemSelectsObject[i].style.visibility = vMemSelectsStyle[i];
	}
}
hideSelectBoxes = function(){
	vMemSelectsStyle = [];
	vMemSelectsObject = [];
	var oSe = document.getElementsByTagName("select");
	for (i = 0; i != oSe.length; i++) {
		vMemSelectsStyle.push(getStyle(oSe[i],'visibility'));
		vMemSelectsObject.push(oSe[i]);
		oSe[i].style.visibility = "hidden";
	}
}

encodeStr = function(s){
	return escape(s).replace(/\+/, "%2B");
}