// JavaScript Document var public=0; var inmueble=0; function comparar_url(){ new Ajax.Request('/propiedades/seleccionadas/?cache=1', {asynchronous:true, evalScripts:true, onSuccess:function(request){ eval('var k ='+request.responseText); alert(k); } } ); } function add_compare(propiedad,div,tipo_publicacion,tipo_inmueble){ if(tipo_inmueble<5){ tipo_inmueble=1; }else{ tipo_inmueble=2; } if(public==0){ public=tipo_publicacion; inmueble=tipo_inmueble; } chek = document.getElementById("Propiedad"+propiedad); if(tipo_publicacion==public && tipo_inmueble==inmueble){ loadingUp = document.getElementById('LoadingUp'); loadingDown = document.getElementById('LoadingDown'); Element.show('LoadingUp'); Element.show('LoadingDown'); new Ajax.Request('/propiedades/seleccionadas/?scache=1/', {asynchronous:true, evalScripts:true, onSuccess:function(request){ eval('var k ='+request.responseText); if(chek.checked){ if(k<5){ //add_propiedad(propiedad,null,null,null); new Ajax.Request('/addtocompare/'+propiedad+'/null/?cache=1', {asynchronous:true, evalScripts:true, onComplete:function(request, json) {Element.hide('LoadingUp'); Element.hide('LoadingDown');}, onSuccess:function(request) {} } ); }else{ chek.checked = false; Dialog.alert("Seleccione sólo cinco propiedades",{ width:400, height:100, okLabel: "Cerrar", buttonClass: "myButtonClass", id: "compartir", ok:function(win) {return true;} } ); Element.hide('LoadingUp'); Element.hide('LoadingDown'); } }else{ //delete_propiedad(propiedad,div,null,null,null); new Ajax.Request('/deleteofcompare/'+propiedad+'/null/null/?cache=1', {asynchronous:true, evalScripts:true, onComplete:function(request, json) {Element.hide('LoadingUp'); Element.hide('LoadingDown');}, onSuccess:function(request){ eval('var k='+request.responseText); if(k==0){ public=0; inmueble=0; } } } ); } } } ); }else{ //if(chek.cheked==true){ chek.checked=false; Dialog.alert("El tipo de inmueble o tipo de publicación es diferente con respecto a las propiedades anteriormente seleccionadas.",{ width:400, height:100, okLabel: "Cerrar", buttonClass: "myButtonClass", id: "compartir", ok:function(win) {return true;} } ); Element.hide('LoadingUp'); Element.hide('LoadingDown'); //} } } function add_propiedad(id,div,render,tipo_publicacion,tipo_inmueble){ if(tipo_inmueble<5){ tipo_inmueble=1; }else{ tipo_inmueble=2; } if(public==0){ public=tipo_publicacion; inmueble=tipo_inmueble; } if(tipo_publicacion==public && tipo_inmueble==inmueble){ new Ajax.Request('/addtocompare/'+id+'/'+render+'/?cache=1', {asynchronous:true, evalScripts:true, onComplete:function(request, json) {Element.hide('CompareLoading');}, onLoading:function(request) {Element.show('CompareLoading');}, onSuccess:function(request) { var divComp = document.getElementById(div); divComp.innerHTML=request.responseText; } } ); }else{ Dialog.alert("El tipo de inmueble o tipo de publicación es diferente con respecto a las propiedades anteriormente seleccionadas.",{ width:400, height:100, okLabel: "Cerrar", buttonClass: "myButtonClass", id: "compartir", ok:function(win) {return true;} } ); } } function delete_propiedad(id,div,render,actual){ new Ajax.Request('/deleteofcompare/'+id+'/'+render+'/'+actual+'/?cache=1', {asynchronous:true, evalScripts:true, onComplete:function(request, json) {Element.hide('CompareLoading');}, onLoading:function(request) {Element.show('CompareLoading');}, onSuccess:function(request){ if(div){ var divComp = document.getElementById(div); divComp.innerHTML=request.responseText; } } } ); }