/*if((screen.width > 800 && location.href.split("r=").length == 1) || (screen.width > 800 && location.href.split("r=")[1].indexOf('800') >-1 )) {
location.replace(location.pathname + location.href.replace(/800/,1024))
}
if((screen.width == 800 && location.href.split("r=").length == 1) || (screen.width == 800 && location.href.split("r=")[1] == 1024)){
location.replace(location.pathname + location.href.search().replace(/1024/,800) )
}
if(location.href.split("?").length > 1){
	if(location.href.search().substr(1).split("r=")[1].indexOf('800') > -1){
	
	}
}*/
resAn = screen.width;
//resAn = resAn > 800 ? 1024 : 800;
if(location.href.split("?").length > 1){
	cad = location.search.substr(1);
	mCad = cad.split("&");
	r = false
	for(m=0; m<mCad.length; m++){
		if(mCad[m].split("=")[0] == "r"){
			r = true;
			/*if(mCad[m].split("=")[1] == 800 && screen.width > 800){
				location.replace(location.pathname + location.search.replace(/800/,1024))
			}
			if(mCad[m].split("=")[1] == 1024 && screen.width > 1024){
				location.replace(location.pathname + location.search.replace(/1024/,800))
			}*/
			val = mCad[m].split("=")[1]
			if(val != resAn){
				pat = new RegExp(val)
				location.replace(location.pathname + location.search.replace(pat,resAn))
			}
		}
	}
	if(!r){
		location.replace(location.pathname + location.search + "&r=" + resAn)
	}
}


else{
	location.replace(location.pathname + "?r=" + resAn)

}
var seccionActiva = ''
var subMenu = false;
var imagenes = new Array()
function botones(){
	contenedor = document.getElementById('barra_menu')
	l = contenedor.childNodes.length;
	for(m=0; m<l;  m++){
		if(contenedor.childNodes[m].childNodes.length > 0){
			for(s=0; s<contenedor.childNodes[m].childNodes.length;s++){
				if(contenedor.childNodes[m].childNodes[s].nodeName.toLowerCase() == "img"){
					imagenes[imagenes.length] = new Image()
					imagenes[imagenes.length-1].src = contenedor.childNodes[m].childNodes[s].src.replace(/_off/,'_on')
					if(seccionActiva == contenedor.childNodes[m].childNodes[s].id){
						contenedor.childNodes[m].childNodes[s].src = contenedor.childNodes[m].childNodes[s].src.replace(/_off/,'_on')
					}
					else{
						contenedor.childNodes[m].childNodes[s].onmouseover = function(){
							fue = this.src.replace(/_off/,'_on')
							this.src = fue;
						}
						contenedor.childNodes[m].childNodes[s].onmouseout = function(){
							fue = this.src.replace(/_on/,'_off')
							this.src = fue;
						}
					}
				}
			}
		}
		
	}
}
function popimas(f,s){
	vent = window.open('imagenes.php?f='+f+'&salon='+s,'vent','width=50,height=50,statusbar=no')
}
var patEmail = /^([\w\.-]{2,150})@([\w-]{2,64})\.[a-z]{2,6}(\.[a-z]{2,6})?$/
function revisaForm(f){
	campos = new Array('nombre','apellido1','telefono','email');
	for(m=0; m<campos.length; m++){
		eval('c =   f .' + campos[m]);
		if(c.value == ""){
			alert('Por favor, debe especificar cuál es su ' + c.name)
			c.focus();
			return false
			break;
		}
		if(c.name == 'email'){
			if(!patEmail.test(c.value)){
			alert('Por favor, ingrese un e-mail válido')
			c.focus();
			return false
			}
		}
	}
}
function ampliarInfClub(id,l){
	el = document.getElementById(id)
	el.style.display = el.style.display == 'none' ? 'block' : 'none';
	l.firstChild.nodeValue = el.style.display == 'none' ? '+ Info' : '- Info';
}
function redireccionaMapa(valor) {
		alert(valor);

}
function selector(o,v){
	if(location.search.length == 0){
		location.href = location.href + "?" + o + "=" + v
		return true
	}
	else{
		l = location.href;
		if(l.indexOf(o + '=') > -1){
			args = location.search.substr(1).split("&")
			for(m=0; m<args.length; m++){
				if(args[m].split("=")[0] == o){
					pat = new RegExp(o + "=" + args[m].split("=")[1])
					location.href = l.replace(pat,o + "=" + v)
					break;
					return true
				}
			}
		}
		else{
			location.href = l + "&" + o + "=" + v
		}
	}
}