jQuery(document).ready(function($){
 
 
    
	$('.simg').each( function() {
	
		imagenes = $(this).attr('name' ).split('|') ;		
		
		if (imagenes.length == 1 ) {
	
			$(this).html( '<img src="/app/webroot/img/' + imagenes[0] + '" />' );
		} else {
		
		
			if (typeof SeccionActual != "undefined"  &&  $(this).attr('id') == ('mSeccion' + SeccionActual ) )  {
			
				imagenes[0] = imagenes[1] ;
				$(this).attr('name', imagenes.join('|') );
			}
			$(this).html( '<img src="/app/webroot/img/' + imagenes[0] + '"  rel="' + $(this).attr('name' ) + '"/>' );
			$( this ).hover( function() {
				var imagen = $('img', this ) ;
 				
				if ( imagen.attr('estado') != 1 ) {
					imagen.attr( 'estado', 1 ) ;
					imagen.attr('src', '/img/' +imagen.attr('rel' ).split('|')[1] );
				}
			
			}, 
			function () {
				var imagen = $('img', this ) ;
   				if ( imagen.attr('estado') != 0 ) {
					imagen.attr( 'estado', 0 ) ;
					imagen.attr('src', '/app/webroot/img/' + imagen.attr('rel' ).split('|')[0] );
				}
			
			} );
		}
	
	} );
  	com.besbello.lib.forms.autodata.load( 'form.autodata' );
	$('#filtroPisosSubmit').click( function() {
			var url = '/index.php?/mercavenda/pisos/index' +  com.besbello.lib.forms.pair.values( '#filtroPisos' ) ;
			document.location.href= url ;
			
			return false;
		
	});
	$('#filtroTerrenosSubmit').click( function() {
			var url = '/index.php?/mercavenda/terrenos/index' +  com.besbello.lib.forms.pair.values( '#filtroTerrenos' ) ;
			document.location.href= url ;
			
			return false;
		
	});
	$('#filtroCasasSubmit').click( function() {
			var url = '/index.php?/mercavenda/casas/index' +  com.besbello.lib.forms.pair.values( '#filtroCasas' ) ;
			document.location.href= url ;
			
			return false;
		
	});	
	
	$('#filtroLocalesSubmit').click( function() {
			var url = '/index.php?/mercavenda/locales/index' +  com.besbello.lib.forms.pair.values( '#filtroLocales' ) ;
			document.location.href= url ;
			
			return false;
		
	});
	
	$('#filtroNegociosSubmit').click( function() {
			var url = '/index.php?/mercavenda/negocios/index' +  com.besbello.lib.forms.pair.values( '#filtroNegocios' ) ;
			document.location.href= url ;
			
			return false;
		
	});
	
	                $('#buscadorSolapas').tabs({ fxSlide: true, fxFade: true, fxSpeed: 'normal' });
});



