function iconShow(layerid,x,y){var icon=document.getElementById(layerid);icon.style.visibility="visible";icon.style.left=x+'px';icon.style.top=y+'px'}
function iconHide(layerid){document.getElementById(layerid).style.visibility="hidden"}
function submit(o){var a=$(".larea option:selected").val(),t=$(".ltown option:selected").val(),j=$("#category").val();if(a)a=a+"/";if(t)t=t+"/";if(o){if(o=="tour"&&a==""&&t==""){c=""}else{c=o+"/"}}else{if(j=="tour"&&a==""&&t==""){c=""}else{c=j+"/"}}location.href="/"+a+t+c}
$(document).ready(function(){getJSONMethod("/execute/ajax?cmd=getRecentlyCreated")
$('#createdtab').click(function(){$("#popularLoader").show();getJSONMethod("/execute/ajax?cmd=getRecentlyCreated")});$('#populartab').click(function(){$("#popularLoader").show();getJSONMethod("/execute/ajax?cmd=getPopularListings")});$('#updatedtab').click(function(){$("#popularLoader").show();getJSONMethod("/execute/ajax?cmd=getRecentlyUpdated")});function getJSONMethod(method){$.ajaxSetup({cache:false});$.getJSON(method,{type:$("#category").val(),area:$(".larea").val()},function(data){var div="";var rowclass;$(data).each(function(i){rowclass=(i%2==1)?"odd":"even";div+="<div class='"+rowclass+" leftDiv'><span title='"+data[i].fullType+"' class='"+data[i].type+"'></span><a title='"+data[i].name+"' href='/listing/"+data[i].listingNumber+"/' class='name'>"+data[i].shortName+"</a></div>";div+="<div class='"+rowclass+" rightDiv'>";if(data[i].townDisplay!="null"&&data[i].townDisplay!=""){div+="<a href='/"+data[i].area+"/"+data[i].town+"/tour/' class='town'title='"+data[i].townDisplay+"'>"+data[i].townDisplay+"</a>"}else{div+=data[i].otherTown}div+="</div>";});$("#widgetcontent").html(div);if(data){$("#popularLoader").hide()}})};if($(".larea option:selected").val()!="")$("#townDiv").show();$('.larea').change(function(){if($(this).val()=="")$(".ltown").val("");});$("#reset").click(function(){$("#category").get(0).selectedIndex=0;$(".larea").get(0).selectedIndex=0;$("#townDiv").hide();$("#townLoader").hide();$(".ltown").val("")})})
$(function(){$("select.larea").change(function(){$("#townDiv").hide();$("#townLoader").show();if($(this).val()){$(".ltown").val("");$.ajaxSetup({cache:true});$.getJSON("/execute/ajax?cmd=getTownsFromArea",{areaParam:$(this).val()},function(j){var options='';options+='<option value="">Select Town -Optional-<\/option>';for(var i=0;i<j.length;i++){options+='<option value="'+j[i].value+'">'+j[i].label+'<\/option>'}$(".ltown").html(options);$('.ltown option:first').attr('selected','selected');$("#townLoader").hide();$("#townDiv").show();},$(".larea").val($(this).val()))}else{$("#townDiv").hide();$("#townLoader").hide()}})})
$(function(){$("select.ltown").change(function(){$(".ltown").val($(this).val())})})
function advSearch(type){var selected=$("#category").val();if(selected=="tour")selected="accom";if(selected!=type)type=selected;location.href="/advanced/search/"+selected+"/"}
