/*function renderMaps() {
	if (GBrowserIsCompatible()) {
		var toMark = propsCords.findAll(function(s) { return (s.type == 2); })

		if ( toMark.length > 0) {
				var map = new GMap2(document.getElementById("google_map_index"));

				for (i = 0; i < toMark.length; i++)
				{
					if (i == toMark.length-1)
					{
						centerLL = new GLatLng(parseFloat(toMark[i].lat), parseFloat(toMark[i].lng));
						map.setCenter(centerLL, 13);
					}

					var latLng = new GLatLng(parseFloat(toMark[i].lat), parseFloat(toMark[i].lng));
					map.addOverlay(new GMarker(latLng));
				}

		}
	}
}*/

function domLoaded(){
	/*$$('#menu ul li').invoke('observe', 'mouseover', function(){
		this.addClassName('hover')
	}).invoke('observe', 'mouseout', function(){
		this.removeClassName('hover')
	});*/
	return false;
}

function validateContact () {
	var error = false;
	['nombre', 'email', 'telefono', 'msg'].each(function(e) {
		if ($F(e) == '') {
			error = true;
			alert('Debe completar todos los campos.');
			$(e).focus();
			throw $break;
		}
	})
	
	if (!$F('email').match(/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i)) {
			error = true;
			alert('Ingrese un email valido.');
			$('email').focus();
	}

	if (error) return false;
	return true;
}

function unidadToggle (id, el) {
	
	Effect.toggle('infoUnidad_'+id, 'blind');
	$(el).toggleClassName('expanded');	
	
}

function bookmark(title, url){
if (window.sidebar) {
	window.sidebar.addPanel(title, url, "");// firefox
} else if(window.opera && window.print){ // opera
    var elem = document.createElement('a');
    elem.setAttribute('href',url);
    elem.setAttribute('title',title);
    elem.setAttribute('rel','sidebar');
    elem.click();
} else if(document.all)// ie
    window.external.AddFavorite(url, title);
}

function searchByReference () {
	new Ajax.Request('/ajax/searchByReference', {
		parameters: {ref: $F('qRef')},
		onComplete: function(transp) {
			el = eval(" ( "+transp.responseText+" ) ");
			if (el.status == 'ok' && el.url != 'not_found') {
				window.location = el.url;
			} else if (el.status == 'ok') {
				alert('Propiedad no encontrada');
			}
		}
	})
}
