
function ocultaCapa(capa) {
	document.getElementById(capa).style.visibility='hidden';
}

function muestraCapa(capa) {
	document.getElementById(capa).style.visibility='visible';
}

function ampliarFoto(urlfoto,width,height) {
	window.open(urlfoto,'ampliarFoto', 'scrollbars=no,width=' + width + ',height=' + height);
}

function abrirVentanaCentrada(url, nombre, width, height, features) {
	window.open(url, nombre, "width=" + width + ",height=" + height + ",left=" +((screen.availWidth - width) / 2)+ ",top=" +((screen.availHeight - height) / 2)+(features!='' ? ','+features : ''));
}

function toggleVisible(id_layer) {
	$('#'+id_layer).toggle();
}
function toggleFlecha(id_img) {
	var obj = document.getElementById(id_img);
	if (obj.src.indexOf('flecha_abajo') < 0)
		obj.src = '/img/flecha_abajo.gif';
	else
		obj.src = '/img/flecha_arriba.gif';
}
function tabover(src, tab) {
	if (src.id!=selectedTab)
		src.style.backgroundImage = 'url(/img/tab_'+tab+'sel.gif)';
}
function tabout(src, tab) {
	if (src.id!=selectedTab)
		src.style.backgroundImage = 'url(/img/tab_'+tab+'.gif)';
}
function tabclick(src, tab) {
	if (src.id!=selectedTab) {
		selectedTab = src.id;
		src.style.backgroundImage = 'url(/img/tab_'+tab+'sel.gif)';
	}
}
function tabvover(src, tab) {
	if (src.id!=selectedTabv) {
		src.style.backgroundImage = 'url(/img/tab_'+tab+'vsel.gif)';
	}
}
function tabvout(src, tab) {
	if (src.id!=selectedTabv)
		src.style.backgroundImage = 'url(/img/tab_'+tab+'v.gif)';
}
function tabvclick(src, tab) {
	if (src.id!=selectedTabv) {
		selectedTabv = src.id;
		src.style.backgroundImage = 'url(/img/tab_'+tab+'vsel.gif)';
	}
}

function masOpciones() {
	var img = document.getElementById('img_opciones');
	if (img.src.indexOf('masopciones') >= 0) {
		$('#layer_masopciones').show();
		img.src = '/img/ocultaropciones.gif';
	} else {
		$('#layer_masopciones').hide();
		img.src = '/img/masopciones.gif';
	}
}
function volverDetalleInmueble() {
	document.location.href = '/buscador_resultado.php';
}
function activarTab(container, tab) {
	$('#'+container+'>ul>li:eq('+tab+')').find('a').trigger('click');
}

function isEmpty(inputStr) {
	if (inputStr == null || inputStr == "") {
		return true;
	}
	return false;
}
function isEmail(inputStr) {
	var er = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/;
	return er.test(inputStr);
}
function isPrecio(inputStr) {
	var er = /^[1-9][0-9\.]*(,\d{1,2})?$/;
	return er.test(inputStr);
}

function ltrim(s) {
   return s.replace(/^\s+/, "");
}

function rtrim(s) {
   return s.replace(/\s+$/, "");
}

function trim(s) {
   return rtrim(ltrim(s));
}

