$(document).ready(function(){var root='http://'+window.location.hostname+'/';$("a.iframe").fancybox({'width':'800','height':'500'});$("a.hf-zbbc").click(function(){$.fancybox({'padding':0,'autoScale':false,'transitionIn':'none','transitionOut':'none','title':this.title,'width':680,'height':495,'href':this.href.replace(new RegExp("watch\\?v=","i"),'v/'),'type':'swf','swf':{'wmode':'transparent','allowfullscreen':'false'}});return false});$("a.beeb-watch").click(function(){$.fancybox({'padding':0,'autoScale':false,'transitionIn':'none','transitionOut':'none','title':this.title,'width':680,'height':495,'href':this.href.replace(new RegExp("watch\\?v=","i"),'v/'),'type':'swf','swf':{'wmode':'transparent','allowfullscreen':'false'}});return false});$("#phone").autocomplete(root+"suggest/",{width:573,max:100,highlight:false,scroll:true,scrollHeight:405,formatItem:function(data,i,n,value){val=value;val=val.replace('#','');val=val.replace('#','');return val},formatResult:function(data,value){val=value.split("#")[1];return val}});$("#phone").result(function(event,data,formatted){$("#phone").css('color','white');var href=$(data+' div.hoverd').find('span.ref').html();window.location=href});$("#phone").focus(function(){if($(this).val()=='Enter your phone make/model, eg. iphone 3gs'){$(this).val('').css('color','#4E4E50')}});$("#phone").blur(function(){if($(this).val()==''||$(this).val()==' '){$(this).val('Enter your phone make/model, eg. iphone 3gs').css('color','#D2D2D2')}});$("ul.matrix > li > a").hover(function(){$(this).parent().find("p").find("a").addClass("hover")},function(){$(this).parent().find("p").find("a").removeClass("hover")});if(window.location.pathname=='/'){$('#s4').after('<div id="slnav">').cycle({fx:'fade',speed:500,timeout:5000,pager:'#slnav'})}$("input.error").change(function(){$(this).removeClass("error")});$("div.slider div.bestprice").click(function(){window.location=root+"why-use-sellmymobile/#price-guarantee"});$("div.slider div.uksno1").click(function(){window.location=root+"why-use-sellmymobile/"});$("div.slider div.winipad2").click(function(){window.location="https://www.facebook.com/Sellmymobile?sk=app_160731367297271"});$("div.slider div.honest").click(function(){window.location=root+"blog/trusted-unbiased-impartial-price-comparison-%E2%80%93-sellmymobile-com/"});$("input#email").focus(function(){if($(this).val()=="enter your e-mail address"){$(this).val("")}$(this).css("color","#666")});$("input#email").blur(function(){if(trim($(this).val())==""){$(this).val("enter your e-mail address");$(this).css("color","#BBBBBB")}});$("form#newsletter").submit(function(){if(trim($(this).find("#email").val())!=''){if(trim($(this).find("#email").val())!='enter your e-mail address'){var match=new RegExp(/^([\w-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([\w-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$/);if(!match.test($("input#email").val())){alert("You have not entered a valid e-mail address")}else{$.ajax({type:"POST",url:"submitEmail/",data:"email="+$("input#email").val(),dataType:'html',success:function(msg){var fontsize=(msg=='Thanks for subscribing to our newsletter.')?"12":"11";var thanks='<p id="thanks" style="font-size: '+fontsize+'px; padding: 5px; margin: 0px 5px; font-weight: bold; display: none; background-color: #D3F289;">'+msg+'</p>';$("form#newsletter").parent().append(thanks);$("form#newsletter").slideToggle("fast");$("#thanks").fadeIn(500).animate({backgroundColor:'#FFF0E4'},1000)}})}}}return false});function liveUpdate(){setInterval(function(){var response=$.ajax({url:root+"liveUpdate/",dataType:"text",success:function(response){if(response!=''){var phones=response.split("\n");for(var c in phones){if(window.location.path!='/recent-sales/'){$('ul.recent li:eq(5)').fadeOut("fast")}var phone=phones[c].split('::');var outputname=(phone[4].length>25)?phone[4].substring(0,22)+'...':phone[4];var li='<li class="clear pt15 pb15">'+'<a href="#" class="small-merchants small-'+phone[2]+' floatl mr10" title="Sell '+phone[4]+'" rel="nofollow">Sell '+phone[4]+'</a>'+'<div class="details">'+'<h5 style="visibility: visible;"><a href="#" title="Sell '+phone[4]+'">'+outputname+'</a></h5>'+'<a href="#" title="Sell '+phone[4]+'" class="prices" style="position: relative; top: 5px;">'+phone[5]+'</a>'+'</div>'+'<h5 class="price mt10" style="visibility: visible;"><a href="#" title="Sell '+phone[4]+'" class="orange fs14">&pound;'+phone[6]+'</a></h5>'+'</li>';$('ul.recent li:first-child').after(li).fadeIn("slow")}}}})},20000)}});function trim(str,chars){return ltrim(rtrim(str,chars),chars)}function ltrim(str,chars){chars=chars||"\\s";return str.replace(new RegExp("^["+chars+"]+","g"),"")}function rtrim(str,chars){chars=chars||"\\s";return str.replace(new RegExp("["+chars+"]+$","g"),"")}
