/* http://files.list.co.uk/oa/www/delivery/spcjs.php?id=1 */if (typeof(OA_zones) != 'undefined'){var OA_zoneids = '';for (var zonename in OA_zones) OA_zoneids += escape(zonename+'=' + OA_zones[zonename] + "|");OA_zoneids += '&nz=1';}else{var OA_zoneids = escape('4|3|5|6|7|8');}if (typeof(OA_source) == 'undefined'){OA_source = '';}var OA_p=location.protocol=='https:'?'https:':'http:';var OA_r=Math.floor(Math.random()*99999999);OA_output = new Array();var OA_fo = '';OA_fo += "<"+"script type=\'text/javascript\' src=\'http://files.list.co.uk/oa/www/delivery/fl.js\'><"+"/script>\n";document.write(OA_fo);var OA_spc="<"+"script type='text/javascript' ";OA_spc+="src='"+OA_p+"//files.list.co.uk/oa/www/delivery/spc.php?zones="+OA_zoneids;OA_spc+="&amp;source="+escape(OA_source)+"&amp;r="+OA_r;OA_spc+=(document.charset ? '&amp;charset='+document.charset : (document.characterSet ? '&amp;charset='+document.characterSet : ''));if (window.location) OA_spc+="&amp;loc="+escape(window.location);if (document.referrer) OA_spc+="&amp;referer="+escape(document.referrer);OA_spc+="'><"+"/script>";document.write(OA_spc);function OA_show(name){if (typeof(OA_output[name]) == 'undefined'){return;}else{document.write(OA_output[name]);}}function OA_showpop(name){if (typeof(OA_popupZones[name]) == 'undefined'){return;}var OA_pop="<"+"script type='text/javascript' ";OA_pop+="src='"+OA_p+"//files.list.co.uk/oa/www/delivery/apu.php?zoneid="+OA_popupZones[name];OA_pop+="&amp;source="+escape(OA_source)+"&amp;r="+OA_r;if (window.location) OA_pop+="&amp;loc="+escape(window.location);if (document.referrer) OA_pop+="&amp;referer="+escape(document.referrer);OA_pop+="'><"+"/script>";document.write(OA_pop);}/* */function showHide(id,prefix,list_of_ids,list_of_ads){if (document.getElementById(prefix+'Tab'+id).className!='selected'){var id_list=list_of_ids.split(','); for(var loopIndex=0;loopIndex<id_list.length;loopIndex++){document.getElementById(prefix+'Tab'+id_list[loopIndex]).className=''; document.getElementById(prefix+'List'+id_list[loopIndex]).className='listHide ' + prefix + 'LS';}document.getElementById(prefix+'Tab'+id).className='selected'; document.getElementById(prefix+'List'+id).className='listShow ' + prefix + 'LS'; position_ads(list_of_ads);}return false;}function load_map(latitude,longitude){if (GBrowserIsCompatible()){var map=new GMap2(document.getElementById('googleMap')); map.addControl(new GSmallMapControl()); map.addControl(new GMapTypeControl()); map.setCenter(new GLatLng(latitude,longitude),15); var point = new GPoint(longitude,latitude); var marker = new GMarker(point);map.addOverlay(marker);}}function ad_frames(slots,zones){for (var i=0, len=slots.length; i<len; ++i){$('#'+slots[i]).html('<iframe src="'+OA_p+'//files.list.co.uk/oa/www/delivery/afr.php?n=afe5d566&amp;zoneid='+zones[i]+'&amp;source='+OA_source+'&amp;cb='+OA_r+'" scrolling="no" frameborder="0"></iframe>');}}function position_ads(listOfSlots){var slotList=listOfSlots.split(','); var containerOffset=findPos(document.getElementById('outerContainer')); for(var loopIndex=0;loopIndex<slotList.length;loopIndex++){if(document.getElementById(slotList[loopIndex])){var coords=findPos(document.getElementById(slotList[loopIndex]+'Holder')); document.getElementById(slotList[loopIndex]).style.left=coords[0]-containerOffset[0]+'px'; document.getElementById(slotList[loopIndex]).style.top=coords[1]-containerOffset[1]+'px'; document.getElementById(slotList[loopIndex]).className='';}}}function doublempu(size){var i; var l; if(size && size>0){document.getElementById('mpuHolder').style.height = size+"px"; postition_ads('mpu'); return 1;}document.getElementById('mpuHolder').className = ''; l = document.getElementById('mpu').getElementsByTagName('iframe'); if(!l.length) l = document.getElementById('mpu').getElementsByTagName('embed'); if(!l.length) l = document.getElementById('mpu').getElementsByTagName('img'); if(l.length){for(var ii=0;ii<l.length;ii++){i = l[ii]; var h = document.getElementById('mpuHolder'); if(i && (i.height || i.style.height) && (i.width == 300 || i.style.width == "300px")){if(i.style.height){h.style.height = i.style.height;}else{h.height = i.height; h.style.height = (i.height)+"px";}position_ads('mpu'); return true;}}}position_ads('mpu,mpu2');}function findPos(obj){var curleft=curtop=0; if (obj.offsetParent){curleft=obj.offsetLeft;curtop=obj.offsetTop; while (obj=obj.offsetParent){curleft+=obj.offsetLeft;curtop+=obj.offsetTop;}}return [curleft,curtop];}/* share links */function shareLinks(u){$('#fbShare').html('<iframe src="http://www.facebook.com/plugins/like.php?href=' + u + '&amp;layout=button_count&amp;show_faces=false&amp;width=80&amp;height=21&amp;action=like&amp;font=arial&amp;colorscheme=light" scrolling="no" frameborder="0"></iframe>'); $('#twShare').html('<iframe src="http://api.tweetmeme.com/button.js?url=' + u + '&amp;style=compact" scrolling="no" frameborder="0"></iframe>');}/* show hide/event form fields (combined form) */function searchFields(type,loc){var location = loc || false; var fieldList = ['when','after','before','distance','location']; var stateList = [false,false,false,false,false]; $('#combinedSearch').removeClass('eventsRef placesRef articlesRef').addClass(type + 'Ref'); if (type == 'articles'){stateList = [true,true,true,true,true]}else if (type == 'places'){stateList = [true,true,true,false,false]}; if (location == false){stateList[3]=true;stateList[4]=true};/* distance and location stay disabled if no location */ for(var i=0; i<fieldList.length; i++){document.getElementById(fieldList[i]).disabled=stateList[i];}}/* clean form field input (removes placeholder text) */function searchFieldTidier(tags){var section = tags || ''; $('#combinedSearch input,#combinedSearch select').each(function(){if (this.type=='text' && !this.disabled && $(this).hasClass('placeholder')){$(this).val('');}}); if (section != '' && $('#sectionSelect input:radio:checked').val()!=section){$('#sort').attr('disabled','disabled');$('#show').attr('disabled','disabled');}; if(!$('#distance').val()){$('#location').attr('disabled','disabled');};}/* create a GET string from form fields */function subnavTags(tags){var parts = []; $('#combinedSearch input,#combinedSearch select').each(function(){if(this.name && this.value && (this.type != 'radio' || this.checked) && !this.disabled && !$(this).hasClass('placeholder')) if(this.name != 'redirect' && (this.name != 'location' || $('#distance').val())){if(this.name != 'section'){parts.push(this.name+':'+encodeURIComponent(this.value))}else{parts.unshift(tags)};}}); location.href='/' + parts.join('/') + '/'; return false;}/*function selectedTag(tag){createCookie('selectedTag',tag)}*/function createCookie(name,value,days){if(days){var date=new Date(); date.setTime(date.getTime()+(days*24*60*60*1000)); var expires="; expires="+date.toGMTString();}else expires=""; document.cookie = name+"="+value+expires+"; domain=.list.co.uk; path=/";}/* star ratings */function starsOn(newStarsClassName){document.getElementById('stars').className=newStarsClassName;}function starsOff(){document.getElementById('stars').className=currentStarsClassName;}function starsRate(rating,newStarsClassName){currentStarsClassName=newStarsClassName; document.getElementById('star_rating').value=rating; commentForm('review');}/* comment form */function commentForm(mode){if (mode=='comment'){if ($('#starRating')){starsOn(''); starsRate(0,'star0');}$('#review').val('0'); $('#commentForm').removeClass('reviewForm'); /* document.getElementById('starsContainer').className='none'; */ document.getElementById('commentLabel').innerHTML='Comment';}else if (mode=='review'){$('#review').val('1'); $('#commentForm').addClass('reviewForm'); /* document.getElementById('starsContainer').className=''; */ document.getElementById('commentLabel').innerHTML='Review';}if ($('#largeRectangleHolder')){position_ads('largeRectangle');}}/* show/hide address on offer entry form */function offer_address_hider(onoff){if (onoff==true){$('#address_details').addClass('none');}else{$('#address_details').removeClass('none');}if ($('#largeRectangleHolder')){position_ads('largeRectangle');}}/* calendar */ $(document).ready(function(){$('#cal1Container').datepicker({dateFormat: 'd-M-yy', minDate: new Date(), numberOfMonths: 2, showOtherMonths: true, prevText: 'Previous', hideIfNoPrevNext: true, firstDay: 1, onSelect: function(){if(this.firstClick){$('#when').val(this.firstClick+' to '+$(this).val()); this.firstClick = null; $(this).parent().hide();}else{this.firstClick = $(this).val(); $('#when').val(this.firstClick);}}}); $('#calendarLink').click(function(){$('#calendar').toggle();}); $('#calClose').click(function(){$('#calendar').hide();});/* location */ var x = document.createElement('div'); x.id="locDialog"; x.title = "Set your location"; var xy = '<p id="curLoc"></p>'; $(x).html(xy+'<form id="locForm"><fieldset><legend>Look up your location</legend><label for="locWhere">Town or postcode</label><span><input type="text" id="locWhere" maxlength="50" value="" /><button type="submit" value="Search" id="locSubmit">Search</button></span></fieldset><img style="display:none;" id="locAjaxLoader" class="ajaxLoader" src="http://files.list.co.uk/common/img/ajax-loader.gif" /><div id="locResults"></div></form>'); $('body').append(x); $('#locForm').submit(function(){$('#locResults').html(''); $('#locAjaxLoader').show(); $.ajax({url:'/js/location/', type:'POST', dataType: 'json', data:{where: $('#locWhere').val()}, success: function(data){var ul = '<ul>'; if(!data || !data.results || !data.results.length){ul += '<li><span>Your search returned no matches.</span></li>';}else if(data.results.length == 1){locPick(data.results[0].shortName, data.results[0].lat, data.results[0].lng);}else{for(var i=0;i<data.results.length;i++){var res = data.results[i]; ul += '<li><a href="#" title="Choose &quot;'+res.longName+'&quot; as your location" onclick="locPick(\''+res.shortName.replace(/'/g,'\\\'')+'\',\''+res.lat+'\',\''+res.lng+'\')">'+res.longName+'</a></li>';}}ul += '</ul>'; $('#locResults').html(ul); $('#locAjaxLoader').hide();}}); return false;}); $('#locDialog').dialog({modal:true,resizable:false,draggable:false,autoOpen:false}); $('#locButton,#locLink').click(function(){if(xx = $('#loc span').text()) $('#curLoc').html('Current location: <strong>'+xx+'</strong>'); $('#locDialog').dialog('open'); $('#locWhere').focus(); return false;}); var y = document.createElement('div'); y.id="loginDialog"; y.title = "Log in"; $(y).html('<form method="post" action="http://www.list.co.uk/you/log-in/" id="loginFormDialog"><fieldset><label for="email_address_L"><strong>Email</strong><input type="text" name="email_address" id="email_address_L" maxlength="100" value="" /></label><br /><label for="password_1_L"><strong>Password</strong><input type="password" name="password_1" id="password_1_L" maxlength="20" value="" /></label><br /><input type="hidden" name="coming_from" id="coming_from" value="" /><button type="submit" value="Log in" id="loginSubmit">Log in</button><label for="remember_L" class="rememberLabel"><input type="checkbox" name="remember" id="remember_L" value="1" /><span>Remember</span></label></fieldset></form>'); $('body').append(y); $('#loginDialog').dialog({modal:true,resizable:false,draggable:false,autoOpen:false}); $('#loginLink').first().click(function(){if(this.href){var coming_from = this.href.match(/coming_from=([^&]*)/); if(coming_from && coming_from[1]) $('#coming_from').val(coming_from[1]);}$('#loginDialog').dialog('open'); $('#email_address_L').focus(); return false;}); $(window).resize(function(){$("#locDialog").dialog( "option", "position", 'center' );});}); function locPick(name, lat, lng){var loc = name+'('+lat+','+lng+')'; createCookie('LOC', escape(loc), 365); $('#loc span').text(name); $('#loc a').text('change'); $('#location').val(loc); $('#distance').removeAttr('disabled'); if($('#distance').val()=="") $('#distance').val("5"); $('#locDialog').dialog('close'); if(window.location.href.match(/\/(events|places)\//)){$('#combinedSearch').submit();}return false;}

