function shortlistSetup()
{$("div.result-detail-button.shortlist.tbd").live('click',function(){_gaq.push(['_trackEvent','Shortlist','Property removed']);pid=this.id.split("_")[2];$.post("/lib/shortlist-actions.php",{id:pid,func:'del'},function(data){moveCounter(data.newnumber);$("#sp_"+data.pid).slideUp({easing:'easeInOutExpo'});$("span#header-sl-count").html(data.count);if(data.html)
{$("#result-container").html(data.html);}},"json");});$("div.result-detail-button.shortlist.tba").live('click',function(){_gaq.push(['_trackEvent','Shortlist','Property added']);pid=this.id.split("_")[2];$.post("/lib/shortlist-actions.php",{id:pid,func:'add'},function(data){$("div#sl_add_"+data.pid).replaceWith('<div class="result-detail-button shortlist" id="sl_view_'+data.pid+'"><a href="'+data.url+'"><img src="/media/image/search/add-to-shortlist.jpg" alt="View Shortlist" /><span class="span-shadow">View Shortlist</span><span>View Shortlist</span></a></div>');$("ul#shortlist-list").html(data.list);$("span#header-sl-count").html(data.count);},"json");});}
function moveCounter(newnumber){var one=newnumber.substr(0,1);var two=newnumber.substr(1,1);var three=newnumber.substr(2,1);one=one*33;two=two*33;three=three*33;$("#cd1l").animate({backgroundPosition:"(0 -"+one+"px)"},700,'easeOutElastic');$("#cd2l").animate({backgroundPosition:"(0 -"+two+"px)"},800,'easeOutElastic');$("#cd3l").animate({backgroundPosition:"(0 -"+three+"px)"},900,'easeOutElastic');if(newnumber=="001")
{setTimeout(function(){$(".propertyplural").each(function(){$(this).html('');})},800);}else{setTimeout(function(){$(".propertyplural").each(function(){$(this).html('s');})},800);}}
function slNotesSetup()
{notescontent=$("#slnotes").val();if(notescontent=="")
{$("#slnotes").val("Use this area to store any notes with your shortlist...");$("#slnotes").focus(function(){$(this).val("");$(this).unbind('focus');});}
$("#slnotes").keyup(function(){$(this).doTimeout('SaveSlNotes');$(this).doTimeout('SaveSlNotes',1000,function(){_gaq.push(['_trackEvent','Shortlist','Notes saved']);notescontent=$("#slnotes").val();$.post("/lib/shortlist-actions.php",{notes:notescontent,func:'savenotes'},function(data){},"json");});})}
$(document).ready(function(){shortlistSetup();slNotesSetup();$(".highslide").each(function(){$(this).click(function(){return hs.expand(this,{captionId:'maincaption_'+parseInt(this.id.split("_")[1])});});});$("#sendfriendmail").click(function(){_gaq.push(['_trackEvent','Shortlist','Sent to friend']);$(this).attr('disabled','disabled');$(this).val('Sending');fdata=$('#sendtoafriend').serialize();$.post("/lib/shortlist-actions.php",{formdata:fdata,func:'emailfriend'},function(data){if(data.errortext!=null)
{$("div#friend-errortext").html(data.errortext);}else{$("div#friend-errortext").html('');$("#to_address").val('');$("div#friend-sent").css('display','block');$(this).doTimeout('SentRemove','3000',function(){$("div#friend-sent").fadeOut("fast");});}
$("#sendfriendmail").attr('disabled','');$("#sendfriendmail").val('Send');},"json");});$("#sendctcmail").click(function(){_gaq.push(['_trackEvent','Shortlist','Sent to CTC']);$(this).attr('disabled','disabled');$(this).val('Sending');fdata=$('#sendtoctc').serialize();$.post("/lib/shortlist-actions.php",{formdata:fdata,func:'emailctc'},function(data){if(data.errortext!=null)
{$("div#ctc-errortext").html(data.errortext);}else{$("div#ctc-errortext").html('');$("#from_address").val('');$("div#ctc-sent").css('display','block');$(this).doTimeout('SentRemove','3000',function(){$("div#ctc-sent").fadeOut("fast");});}
$("#sendctcmail").attr('disabled','');$("#sendctcmail").val('Send');},"json");});});
