// JavaScript Document $(document).ready(function(){ // The select element to be replaced: var select = $('select.soption') //select.each(function(index) { buildselect($(this)); }); //clear any form text fields... $('#stext, #nlemail').focus(function() { if (this.value == this.title) { $(this).val(""); $(this).css({'color' : '#333333', 'font-weight' : 'normal', 'font-style' : 'normal'}); } }).blur(function() { if (this.value == "") { $(this).val(this.title); $(this).css({'color' : '#cccccc', 'font-weight' : 'bold', 'font-style' : 'italic'});} }); $('#hpform').submit(function() { //alert('stext: '+$("#hpform #stext").val()+' - title: '+$("#hpform #stext").attr('title')); if($("#hpform #stext").val()==$("#hpform #stext").attr('title')){ $("#hpform #stext").val(''); }; return true; }); $("select#ssale").change(function(){ var iStart=300, iMax=2000, iStep=100, iVal=0, iTxt=""; var ms = $("select#smaxprice").multiselect({multiple: false,header: false, minWidth: 85, selectedList: 1, classes: 'myclassXXX'}); $("select#smaxprice option").remove(); if($('select#sminprice').length){ var mx = $("select#sminprice").multiselect({multiple: false,header: false, minWidth: 85, selectedList: 1, classes: 'myclassXXX'}); $("select#sminprice option").remove(); } if($("select#ssale").val()==1){ iStart=50000; iMax=1000000; iStep=50000; } for(var i=iStart;i<=iMax;i+=iStep){ iVal=i; iTxt='€'+numberFormat(iVal); if (iVal==iMax){ iTxt+=" +"; } if($("select#ssale").val()==2){ iTxt+=" pcm"; } if($("select#ssale").val()==3){ iTxt+=" pcw"; } $("select#smaxprice").append(''); if($('select#sminprice').length){ $("select#sminprice").append(''); } } ms.multiselect("refresh"); if($('select#sminprice').length){ mx.multiselect("refresh"); } }); $(".selectjs").multiselect({multiple: false,header: false, minWidth: 85, selectedList: 1, classes: 'myclassXXX'}); $(".selectjsmulti").multiselect( { multiple: true, click: function(e, ui){ if(ui.value==0 && ui.checked==true && $(this).multiselect("getChecked").length>1){ $(this).multiselect("uncheckAll"); $(this).multiselect("widget").find(":checkbox").first().click(); } else if(ui.value!=0 && $(this).multiselect("widget").find(":checkbox").eq(0).prop('checked') === true){ $(this).multiselect("widget").find(":checkbox").first().click(); } }, header: false, height: 225,selectedList: 1, classes: 'myclassXXX'}); $(".selectjsmultis").multiselect( { multiple: true, create: function(){ $(this).next().width(175); }, click: function(e, ui){ if(ui.value==0 && ui.checked==true && $(this).multiselect("getChecked").length>1){ $(this).multiselect("uncheckAll"); $(this).multiselect("widget").find(":checkbox").first().click(); } else if(ui.value!=0 && $(this).multiselect("widget").find(":checkbox").eq(0).prop('checked') === true){ $(this).multiselect("widget").find(":checkbox").first().click(); } }, header: false, height: 225,selectedList: 1, classes: 'myclassXXX'} ); $(".selectjsmultisx").multiselect( { multiple: true, create: function(){ $(this).next().width(129); }, click: function(e, ui){ if(ui.value==0 && ui.checked==true && $(this).multiselect("getChecked").length>1){ $(this).multiselect("uncheckAll"); $(this).multiselect("widget").find(":checkbox").first().click(); } else if(ui.value!=0 && $(this).multiselect("widget").find(":checkbox").eq(0).prop('checked') === true){ $(this).multiselect("widget").find(":checkbox").first().click(); } }, header: false, height: 225,selectedList: 1, classes: 'myclassXXX'} ); if($('.fp-viewer .imgelem').length) { $('.fp-viewer .imgelem:gt(0)').hide(); setInterval('rotateHeader()', 6000); } // Gallery //move the last list item before the first item. The purpose of this is if the user clicks previous he will be able to see the last item. if($('#propthumbul li').length>4){ $('#propthumbul li:first').before($('#propthumbul li:last')); // $('#carousel_ul li:first').before($('#carousel_ul li:last')); //when user clicks the image for sliding down $('.it-thumb-down').click(function(){ //get the width of the items ( i like making the jquery part dynamic, so if you change the width in the css you won't have o change it here too ) ' var item_height = $('#propthumbul li').outerHeight()+8; //alert("item_height: "+item_height); //calculate the new left indent of the unordered list var top_indent = parseInt($('#propthumbul').css('top')) - item_height; //alert(top_indent); //make the sliding effect using jquery's anumate function ' //$('#propthumbul').animate({'top' : top_indent},{queue:false, duration:500},function(){ $('#propthumbul:not(:animated)').animate({'top' : top_indent},500,function(){ //get the first list item and put it after the last list item (that's how the infinite effects is made) ' $('#propthumbul li:last').after($('#propthumbul li:first')); //and get the left indent to the default -210px $('#propthumbul').css({'top' : '-113px'}); }); return false; }); $('.it-thumb-up').click(function(){ var item_height = $('#propthumbul li').outerHeight() + 8; /* same as for sliding right except that it's current left indent + the item width (for the sliding right it's - item_width) */ var top_indent = parseInt($('#propthumbul').css('top')) + item_height; //$('#propthumbul').animate({'top' : top_indent},{queue:false, duration:500},function(){ $('#propthumbul:not(:animated)').animate({'top' : top_indent},500,function(){ /* when sliding to left we are moving the last item before the first item */ $('#propthumbul li:first').before($('#propthumbul li:last')); /* and again, when we make that change we are setting the left indent of our unordered list to the default -210px */ $('#propthumbul').css({'top' : '-113px'}); }); return false; }); } //image carousel fade in/out on click... $("#propthumbul li img").click(function(){ var mainimg=$(".image-main").find("img").stop(true,true), newimg=$(this).attr('src').replace(/&size=2/gi, "");; mainimg.animate({opacity: 0}, 400, function(){ //alert("all done!"); //mainimg.attr('src','http://new.manilvaproperties.com'+newimg ); mainimg.attr('src','http://manilvaproperties.com'+newimg ); //mainimg.animate({opacity: 1}, 500); mainimg.load(function() { mainimg.animate({opacity: 1}, 500); }); }) }); $("select#sprov").change(function(){ //if the search filter changes var vpid=$('select#sprov').val(); //alert("vpid: "+vpid); doajax('select#stown',{provid:vpid}, function(){ remELEM('#tzIDstown','select#stown'); }); }); /*$("select#ssale").change(function(){ //if the search filter changes var vsid=$('select#ssale').val(); doajax2('select#smaxprice',{sid:vsid}, function(){ remELEM('#tzIDsmaxprice','select#smaxprice'); }); });*/ }); function numberFormat(x) { return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ","); } function remELEM(varOLDELEM, varNEWELEM){ $(varOLDELEM).remove(); buildselect(varNEWELEM); } function rotateHeader(){ //rotate featured images $('.fp-viewer div.imgelem:first-child').fadeOut('slow').next('div').fadeIn('slow').end().appendTo('.fp-viewer'); } function buildselect(varOBJ){ //function to build a select box... var sitem = $(varOBJ), tzIDVAL='', tzOTHERCLASS=''; if(sitem.attr("id")!=''){ tzIDVAL=sitem.attr('id'); } //alert('class: '+sitem.attr('class')); if(sitem.attr('class').split(' ')[1]){tzOTHERCLASS=' '+sitem.attr('class').split(' ')[1];} //alert(sitem.attr("id")); //alert('tzOTHERCLASS: '+tzOTHERCLASS); var selectBoxContainer = $('
',{ width : sitem.outerWidth(), 'class' : 'tzSelect'+tzOTHERCLASS, 'id' : 'tzID'+tzIDVAL, html : '
' }); //alert("Attributes: width="+selectBoxContainer.attr('width')+", class="+selectBoxContainer.attr('class')+", id="+selectBoxContainer.attr('id')+""); var dropDown = $('