var currentsearch = ''; var currentsearchID = 0; $(function() { var locations = {"FALMOUTH UNIVERSITY":{"E":"180711","N":"32196"},"UNIVERSITY OF OXFORD":{"E":"450974","N":"206807"},"UNIVERSITY OF LANCASTER":{"E":"348528","N":"457448"},"BATH SPA UNIVERSITY":{"E":"369654","N":"164501"},"CARDIFF UNIVERSITY":{"E":"318176","N":"177343"},"UNIVERSITY OF SOUTHAMPTON":{"E":"442562","N":"115145"},"THE ROYAL VETERINARY COLLEGE":{"E":"529548","N":"183646"},"UNIVERSITY OF DERBY":{"E":"433924","N":"338022"},"BOURNEMOUTH UNIVERSITY":{"E":"407352","N":"93713"},"UNIVERSITY OF THE ARTS, LONDON":{"E":"530740","N":"181549"},"UNIVERSITY OF STIRLING":{"E":"280397","N":"696841"},"EDGE HILL UNIVERSITY":{"E":"342245","N":"407385"},"UNIVERSITY OF SURREY":{"E":"498663","N":"150213"},"UNIVERSITY OF ESSEX":{"E":"602815","N":"223876"},"THE LIVERPOOL INSTITUTE FOR PERFORMING ARTS":{"E":"335451","N":"389644"},"UNIVERSITY OF READING":{"E":"473277","N":"171811"},"UNIVERSITY OF SUSSEX":{"E":"534715","N":"108961"},"UNIVERSITY OF BEDFORDSHIRE":{"E":"509451","N":"221114"},"UNIVERSITY OF KENT":{"E":"614178","N":"159963"},"NEWMAN UNIVERSITY":{"E":"400435","N":"281794"},"UNIVERSITY OF CAMBRIDGE":{"E":"544734","N":"258453"},"DE MONTFORT UNIVERSITY":{"E":"458346","N":"304132"},"UNIVERSITY OF EDINBURGH":{"E":"325899.00","N":"673412.00"},"UNIVERSITY OF LEEDS":{"E":"429547","N":"434780"},"NORTHERN SCHOOL OF CONTEMPORARY DANCE":{"E":"430828","N":"435317"},"LEEDS METROPOLITAN UNIVERSITY":{"E":"429791.00","N":"434244.00"},"EDINBURGH NAPIER UNIVERSITY":{"E":"319582","N":"670861"},"CARDIFF METROPOLITAN UNIVERSITY":{"E":"315131","N":"176777"},"UNIVERSITY OF ABERTAY DUNDEE":{"E":"340057","N":"730538"},"UNIVERSITY OF THE WEST OF ENGLAND, BRISTOL":{"E":"362093","N":"178061"},"COURTAULD INSTITUTE OF ART":{"E":"530773","N":"180770"},"BRUNEL UNIVERSITY":{"E":"506024","N":"182654"},"ROYAL COLLEGE OF MUSIC":{"E":"526643","N":"179391"},"MANCHESTER METROPOLITAN UNIVERSITY":{"E":"384199","N":"397132"},"BISHOP GROSSETESTE UNIVERSITY":{"E":"497811","N":"372888"},"RAVENSBOURNE":{"E":"539279","N":"179966"},"KINGSTON UNIVERSITY":{"E":"517794","N":"168834"},"UNIVERSITY OF WOLVERHAMPTON":{"E":"391414","N":"298951"},"THE CITY UNIVERSITY":{"E":"531738","N":"182693"},"SCHOOL OF PHARMACY UNIVERSITY OF LONDON(THE)":{"E":"530349","N":"182356"},"UNIVERSITY FOR THE CREATIVE ARTS":{"E":"483525","N":"146963"},"THE ROBERT GORDON UNIVERSITY":{"E":"391399","N":"803026"},"TRINITY LABAN CONSERVATOIRE OF MUSIC AND DANCE LTD":{"E":"538470","N":"177954"},"UNIVERSITY OF THE HIGHLANDS AND ISLANDS":{"E":"266305","N":"844355"},"QUEEN MARY UNIVERSITY OF LONDON":{"E":"536037","N":"182319"},"UNIVERSITY OF EAST LONDON":{"E":"543392","N":"180739"},"GOLDSMITHS' COLLEGE":{"E":"536540","N":"176850"},"UNIVERSITY OF LONDON":{"E":"529987","N":"181892"},"TEESSIDE UNIVERSITY":{"E":"449574","N":"519920"},"NORTHUMBRIA UNIVERSITY NEWCASTLE":{"E":"425221","N":"564754"},"STAFFORDSHIRE UNIVERSITY":{"E":"387845","N":"345879"},"UNIVERSITY OF GLOUCESTERSHIRE":{"E":"393986","N":"220997"},"BIRMINGHAM CITY UNIVERSITY":{"E":"407067","N":"291048"},"THE ROYAL CENTRAL SCHOOL OF SPEECH AND DRAMA":{"E":"526706","N":"184406"},"UNIVERSITY OF GLASGOW":{"E":"256916","N":"666655"},"COVENTRY UNIVERSITY":{"E":"433721","N":"279003"},"UNIVERSITY OF PORTSMOUTH":{"E":"463980","N":"99915"},"HARPER ADAMS UNIVERSITY":{"E":"371404","N":"320354"},"LEEDS COLLEGE OF MUSIC":{"E":"430973","N":"433649"},"GLASGOW SCHOOL OF ART.":{"E":"258456","N":"665959"},"PRIFYSGOL ABERYSTWYTH":{"E":"261072","N":"280350"},"UNIVERSITY OF WINCHESTER":{"E":"447265","N":"129182"},"PLYMOUTH UNIVERSITY":{"E":"248044","N":"54998"},"UNIVERSITY OF EAST ANGLIA":{"E":"619497","N":"307667"},"UNIVERSITY OF BRISTOL":{"E":"358182","N":"173516"},"UNIVERSITY OF ST ANDREWS":{"E":"351076","N":"716822"},"UNIVERSITY OF BOLTON":{"E":"371210","N":"408634"},"QUEEN MARGARET UNIVERSITY, EDINBURGH":{"E":"333055","N":"671436"},"UNIVERSITY OF WARWICK":{"E":"429932.00","N":"275871.00"},"UNIVERSITY OF NORTHAMPTON,THE":{"E":"476309","N":"264347"},"UNIVERSITY OF LEICESTER":{"E":"459412","N":"303044"},"UNIVERSITY COLLEGE BIRMINGHAM":{"E":"406485","N":"287106"},"GLASGOW CALEDONIAN UNIVERSITY":{"E":"259260","N":"665956"},"THE UNIVERSITY OF WESTMINSTER":{"E":"528922","N":"181397"},"UNIVERSITY OF HUDDERSFIELD":{"E":"414793","N":"416379"},"ROYAL AGRICULTURAL UNIVERSITY":{"E":"400442","N":"201195"},"HEYTHROP COLLEGE":{"E":"525670","N":"179434"},"ROYAL WELSH COLLEGE OF MUSIC AND DRAMA LIMITED":{"E":"317895","N":"176964"},"ROSE BRUFORD COLLEGE":{"E":"546526","N":"173217"},"UNIVERSITY OF SALFORD, THE":{"E":"382136","N":"398570"},"WRITTLE COLLEGE":{"E":"567756","N":"207044"},"LONDON SCHOOL OF ECONOMICS & POLITICAL SCIENCE":{"E":"530778","N":"181130"},"MIDDLESEX UNIVERSITY":{"E":"522823","N":"189360"},"OPEN UNIVERSITY(THE)":{"E":"488625","N":"237063"},"SOUTHAMPTON SOLENT UNIVERSITY":{"E":"442271","N":"112202"},"BUCKINGHAMSHIRE NEW UNIVERSITY":{"E":"486480","N":"192815"},"UNIVERSITY OF YORK":{"E":"462215","N":"450672"},"UNIVERSITY OF LINCOLN":{"E":"496943","N":"371181"},"UNIVERSITY COLLEGE LONDON":{"E":"529589","N":"182302"},"UNIVERSITY OF BRIGHTON":{"E":"532519","N":"106455"},"LOUGHBOROUGH UNIVERSITY":{"E":"452089","N":"318864"},"GLYNDWR UNIVERSITY":{"E":"332690","N":"351107"},"LONDON SCHOOL OF HYGIENE AND TROPICAL MEDICINE":{"E":"529790","N":"181879"},"LIVERPOOL HOPE UNIVERSITY":{"E":"340781","N":"388664"},"UNIVERSITY OF HERTFORDSHIRE":{"E":"521435","N":"207482"},"UNIVERSITY OF SHEFFIELD":{"E":"434108","N":"387293"},"UNIVERSITY OF DURHAM":{"E":"427644","N":"541552"},"NOTTINGHAM TRENT UNIVERSITY":{"E":"457065","N":"340224"},"UNIVERSITY OF STRATHCLYDE":{"E":"259616","N":"665410"},"THE UNIVERSITY OF CHICHESTER":{"E":"486383","N":"105688"},"HERIOT-WATT UNIVERSITY":{"E":"317537","N":"669266"},"LONDON BUSINESS SCHOOL":{"E":"527645","N":"182454"},"UNIVERSITY OF BIRMINGHAM":{"E":"404796","N":"283448"},"THE UNIVERSITY OF CUMBRIA":{"E":"340992","N":"555542"},"UNIVERSITY OF EXETER":{"E":"291819.00","N":"93967.00"},"SHEFFIELD HALLAM UNIVERSITY":{"E":"435670","N":"387060"},"UNIVERSITY OF DUNDEE":{"E":"339795","N":"729880"},"SRUC":{"E":"326572","N":"670462"},"ROEHAMPTON UNIVERSITY":{"E":"521965","N":"174363"},"UNIVERSITY OF SUNDERLAND":{"E":"439126","N":"556811"},"ANGLIA RUSKIN UNIVERSITY":{"E":"570928","N":"207625"},"INSTITUTE OF EDUCATION, UNIVERSITY OF LONDON":{"E":"529934","N":"182166"},"SWANSEA UNIVERSITY":{"E":"262948","N":"191946"},"ROYAL HOLLOWAY COLLEGE AND BEDFORD NEW COLLEGE":{"E":"499713","N":"170564"},"ROYAL COLLEGE OF ART(THE)":{"E":"526529","N":"179619"},"CRANFIELD UNIVERSITY":{"E":"494079","N":"242615"},"UNIVERSITY OF KEELE":{"E":"381670","N":"345217"},"LEEDS TRINITY UNIVERSITY":{"E":"423249","N":"439204"},"KING'S COLLEGE LONDON":{"E":"530773","N":"180770"},"ST. GEORGE'S, UNIVERSITY OF LONDON":{"E":"527086","N":"171469"},"NORWICH UNIVERSITY OF THE ARTS":{"E":"623191","N":"308717"},"LEEDS COLLEGE OF ART":{"E":"429614","N":"434777"},"ASTON UNIVERSITY":{"E":"407502","N":"287641"},"UNIVERSITY OF CHESTER":{"E":"340104","N":"367217"},"UNIVERSITY OF ABERDEEN":{"E":"394104","N":"808245"},"THE UNIVERSITY OF MANCHESTER":{"E":"384615","N":"396824"},"ROYAL CONSERVATOIRE OF SCOTLAND":{"E":"258817","N":"665968"},"UNIVERSITY OF NOTTINGHAM, THE":{"E":"454768","N":"338516"},"NEWCASTLE UNIVERSITY":{"E":"424693","N":"565147"},"BANGOR UNIVERSITY":{"E":"257949","N":"372359"},"UNIVERSITY OF ST MARK & ST JOHN":{"E":"250187","N":"60037"},"THE UNIVERSITY OF BUCKINGHAM":{"E":"469315","N":"233542"},"UNIVERSITY OF HULL":{"E":"507718","N":"431603"},"UNIVERSITY OF SOUTH WALES\/PRIFYSGOL DE CYMRU":{"E":"308249","N":"188598"},"ROYAL ACADEMY OF MUSIC":{"E":"528321","N":"182141"},"LONDON METROPOLITAN UNIVERSITY":{"E":"531120","N":"185351"},"ST MARY'S UNIVERSITY, TWICKENHAM":{"E":"515805","N":"172252"},"CANTERBURY CHRIST CHURCH UNIVERSITY":{"E":"615312","N":"157479"},"THE CONSERVATOIRE FOR DANCE AND DRAMA":{"E":"529884","N":"182469"},"BIRKBECK COLLEGE":{"E":"529987","N":"181892"},"UNIVERSITY OF LIVERPOOL":{"E":"335243","N":"390397"},"INSTITUTE OF CANCER RESEARCH: ROYAL CANCER HOSPITAL (THE)":{"E":"526335","N":"178430"},"UNIVERSITY OF GREENWICH":{"E":"538695","N":"178060"},"YORK ST JOHN UNIVERSITY":{"E":"460436","N":"452521"},"UNIVERSITY OF WALES: TRINITY SAINT DAVID":{"E":"239732","N":"220318"},"SWANSEA METROPOLITAN UNIVERSITY":{"E":"265153","N":"193560"},"GUILDHALL SCHOOL OF MUSIC & DRAMA":{"E":"532448","N":"181789"},"UNIVERSITY OF BRADFORD":{"E":"415768","N":"432847"},"LONDON SOUTH BANK UNIVERSITY":{"E":"531869","N":"179427"},"UNIVERSITY CAMPUS SUFFOLK LTD":{"E":"616931","N":"244074"},"UNIVERSITY OF THE WEST OF SCOTLAND":{"E":"248040","N":"663830"},"LIVERPOOL JOHN MOORES UNIVERSITY":{"E":"335397","N":"390093"},"UNIVERSITY OF BATH (THE)":{"E":"377083","N":"164651"},"ARTS UNIVERSITY BOURNEMOUTH, THE":{"E":"407314","N":"93581"},"UNIVERSITY OF WEST LONDON":{"E":"517844","N":"179995"},"OXFORD BROOKES UNIVERSITY":{"E":"453717","N":"206473"},"SCHOOL OF ORIENTAL AND AFRICAN STUDIES":{"E":"529885","N":"182040"},"ROYAL NORTHERN COLLEGE OF MUSIC":{"E":"384368","N":"396896"},"UNIVERSITY OF CENTRAL LANCASHIRE":{"E":"353463","N":"429675"},"IMPERIAL COLLEGE OF SCIENCE, TECHNOLOGY AND MEDICINE":{"E":"526549","N":"179525"},"UNIVERSITY OF WALES PRIFYSGOL CYMRU":{"E":"318091","N":"176949"},"UNIVERSITY OF WORCESTER, THE":{"E":"383485","N":"255508"},"ROSLIN INSTITUTE":{"E":"325053","N":"664276"}};var availableTags = ["FALMOUTH UNIVERSITY","UNIVERSITY OF OXFORD","UNIVERSITY OF LANCASTER","BATH SPA UNIVERSITY","CARDIFF UNIVERSITY","UNIVERSITY OF SOUTHAMPTON","THE ROYAL VETERINARY COLLEGE","UNIVERSITY OF DERBY","BOURNEMOUTH UNIVERSITY","UNIVERSITY OF THE ARTS, LONDON","UNIVERSITY OF STIRLING","EDGE HILL UNIVERSITY","UNIVERSITY OF SURREY","UNIVERSITY OF ESSEX","THE LIVERPOOL INSTITUTE FOR PERFORMING ARTS","UNIVERSITY OF READING","UNIVERSITY OF SUSSEX","UNIVERSITY OF BEDFORDSHIRE","UNIVERSITY OF KENT","NEWMAN UNIVERSITY","UNIVERSITY OF CAMBRIDGE","DE MONTFORT UNIVERSITY","UNIVERSITY OF EDINBURGH","UNIVERSITY OF LEEDS","NORTHERN SCHOOL OF CONTEMPORARY DANCE","LEEDS METROPOLITAN UNIVERSITY","EDINBURGH NAPIER UNIVERSITY","CARDIFF METROPOLITAN UNIVERSITY","UNIVERSITY OF ABERTAY DUNDEE","UNIVERSITY OF THE WEST OF ENGLAND, BRISTOL","COURTAULD INSTITUTE OF ART","BRUNEL UNIVERSITY","ROYAL COLLEGE OF MUSIC","MANCHESTER METROPOLITAN UNIVERSITY","BISHOP GROSSETESTE UNIVERSITY","RAVENSBOURNE","KINGSTON UNIVERSITY","UNIVERSITY OF WOLVERHAMPTON","THE CITY UNIVERSITY","SCHOOL OF PHARMACY UNIVERSITY OF LONDON(THE)","UNIVERSITY FOR THE CREATIVE ARTS","THE ROBERT GORDON UNIVERSITY","TRINITY LABAN CONSERVATOIRE OF MUSIC AND DANCE LTD","UNIVERSITY OF THE HIGHLANDS AND ISLANDS","QUEEN MARY UNIVERSITY OF LONDON","UNIVERSITY OF EAST LONDON","GOLDSMITHS' COLLEGE","UNIVERSITY OF LONDON","TEESSIDE UNIVERSITY","NORTHUMBRIA UNIVERSITY NEWCASTLE","STAFFORDSHIRE UNIVERSITY","UNIVERSITY OF GLOUCESTERSHIRE","BIRMINGHAM CITY UNIVERSITY","THE ROYAL CENTRAL SCHOOL OF SPEECH AND DRAMA","UNIVERSITY OF GLASGOW","COVENTRY UNIVERSITY","UNIVERSITY OF PORTSMOUTH","HARPER ADAMS UNIVERSITY","LEEDS COLLEGE OF MUSIC","GLASGOW SCHOOL OF ART.","PRIFYSGOL ABERYSTWYTH","UNIVERSITY OF WINCHESTER","PLYMOUTH UNIVERSITY","UNIVERSITY OF EAST ANGLIA","UNIVERSITY OF BRISTOL","UNIVERSITY OF ST ANDREWS","UNIVERSITY OF BOLTON","QUEEN MARGARET UNIVERSITY, EDINBURGH","UNIVERSITY OF WARWICK","UNIVERSITY OF NORTHAMPTON,THE","UNIVERSITY OF LEICESTER","UNIVERSITY COLLEGE BIRMINGHAM","GLASGOW CALEDONIAN UNIVERSITY","THE UNIVERSITY OF WESTMINSTER","UNIVERSITY OF HUDDERSFIELD","ROYAL AGRICULTURAL UNIVERSITY","HEYTHROP COLLEGE","ROYAL WELSH COLLEGE OF MUSIC AND DRAMA LIMITED","ROSE BRUFORD COLLEGE","UNIVERSITY OF SALFORD, THE","WRITTLE COLLEGE","LONDON SCHOOL OF ECONOMICS & POLITICAL SCIENCE","MIDDLESEX UNIVERSITY","OPEN UNIVERSITY(THE)","SOUTHAMPTON SOLENT UNIVERSITY","BUCKINGHAMSHIRE NEW UNIVERSITY","UNIVERSITY OF YORK","UNIVERSITY OF LINCOLN","UNIVERSITY COLLEGE LONDON","UNIVERSITY OF BRIGHTON","LOUGHBOROUGH UNIVERSITY","GLYNDWR UNIVERSITY","LONDON SCHOOL OF HYGIENE AND TROPICAL MEDICINE","LIVERPOOL HOPE UNIVERSITY","UNIVERSITY OF HERTFORDSHIRE","UNIVERSITY OF SHEFFIELD","UNIVERSITY OF DURHAM","NOTTINGHAM TRENT UNIVERSITY","UNIVERSITY OF STRATHCLYDE","THE UNIVERSITY OF CHICHESTER","HERIOT-WATT UNIVERSITY","LONDON BUSINESS SCHOOL","UNIVERSITY OF BIRMINGHAM","THE UNIVERSITY OF CUMBRIA","UNIVERSITY OF EXETER","SHEFFIELD HALLAM UNIVERSITY","UNIVERSITY OF DUNDEE","SRUC","ROEHAMPTON UNIVERSITY","UNIVERSITY OF SUNDERLAND","ANGLIA RUSKIN UNIVERSITY","INSTITUTE OF EDUCATION, UNIVERSITY OF LONDON","SWANSEA UNIVERSITY","ROYAL HOLLOWAY COLLEGE AND BEDFORD NEW COLLEGE","ROYAL COLLEGE OF ART(THE)","CRANFIELD UNIVERSITY","UNIVERSITY OF KEELE","LEEDS TRINITY UNIVERSITY","KING'S COLLEGE LONDON","ST. GEORGE'S, UNIVERSITY OF LONDON","NORWICH UNIVERSITY OF THE ARTS","LEEDS COLLEGE OF ART","ASTON UNIVERSITY","UNIVERSITY OF CHESTER","UNIVERSITY OF ABERDEEN","THE UNIVERSITY OF MANCHESTER","ROYAL CONSERVATOIRE OF SCOTLAND","UNIVERSITY OF NOTTINGHAM, THE","NEWCASTLE UNIVERSITY","BANGOR UNIVERSITY","UNIVERSITY OF ST MARK & ST JOHN","THE UNIVERSITY OF BUCKINGHAM","UNIVERSITY OF HULL","UNIVERSITY OF SOUTH WALES\/PRIFYSGOL DE CYMRU","ROYAL ACADEMY OF MUSIC","LONDON METROPOLITAN UNIVERSITY","ST MARY'S UNIVERSITY, TWICKENHAM","CANTERBURY CHRIST CHURCH UNIVERSITY","THE CONSERVATOIRE FOR DANCE AND DRAMA","BIRKBECK COLLEGE","UNIVERSITY OF LIVERPOOL","INSTITUTE OF CANCER RESEARCH: ROYAL CANCER HOSPITAL (THE)","UNIVERSITY OF GREENWICH","YORK ST JOHN UNIVERSITY","UNIVERSITY OF WALES: TRINITY SAINT DAVID","SWANSEA METROPOLITAN UNIVERSITY","GUILDHALL SCHOOL OF MUSIC & DRAMA","UNIVERSITY OF BRADFORD","LONDON SOUTH BANK UNIVERSITY","UNIVERSITY CAMPUS SUFFOLK LTD","UNIVERSITY OF THE WEST OF SCOTLAND","LIVERPOOL JOHN MOORES UNIVERSITY","UNIVERSITY OF BATH (THE)","ARTS UNIVERSITY BOURNEMOUTH, THE","UNIVERSITY OF WEST LONDON","OXFORD BROOKES UNIVERSITY","SCHOOL OF ORIENTAL AND AFRICAN STUDIES","ROYAL NORTHERN COLLEGE OF MUSIC","UNIVERSITY OF CENTRAL LANCASHIRE","IMPERIAL COLLEGE OF SCIENCE, TECHNOLOGY AND MEDICINE","UNIVERSITY OF WALES PRIFYSGOL CYMRU","UNIVERSITY OF WORCESTER, THE","ROSLIN INSTITUTE"]; $( "#qs-sort" ).autocomplete({ source: availableTags, select: function(event,ui) { $('#qs-sort').val(ui.item.value); quick_search(); } }); $( "#qs-sort" ).keyup(function() { quick_search(); }); $('#qs-input').keyup(function() { quick_search(); }); $( "#qs-clear-sort" ).click(function() { $('#qs-sort').css('color','#999'); $('#qs-sort').val( "University of..."); quick_search(); }); $( "#qs-sort" ).focus(function() { var sort_name = $('#qs-sort').val(); if( sort_name == "" || sort_name =="University of...") { $('#qs-sort').css('color','#000'); $('#qs-sort').val( "" ); } }); $( "#qs-sort" ).blur(function() { var sort_name = $('#qs-sort').val(); if( sort_name == "" || sort_name =="University of...") { $('#qs-sort').css('color','#999'); $('#qs-sort').val( "University of..."); } }); $( ".search-div .search-cancel" ).click(function(event) { $('#qs-input').val(''); $('#sort-option').hide(); $('#results-container').hide(); $('#qs-overlay').hide(); $('#helpstring').show(); $('.search-div .search-cancel').hide(); clear_results(); event.preventDefault(); return false; }); $('#units-toggle').click(function() { if( $('#units').text() == 'km' ) { $('#units').text("miles"); } else { $('#units').text("km"); } quick_search(); }); $('#qs-input').focus(); quick_search(); function quick_search() { var text = $('#qs-input').val(); var sort_name = $('#qs-sort').val().toUpperCase(); var sort = ""; if( sort_name == "" || sort_name =="UNIVERSITY OF...") { $('#qs-sort').css('background-image','none'); $('#qs-clear-sort').hide(); } else if( locations[sort_name] ) { sort = locations[sort_name]["E"]+","+locations[sort_name]["N"]; $('#qs-sort').css('background-image','url(/resources/images/accept.png'); $('#qs-clear-sort').show(); } else { $('#qs-sort').css('background-image','url(/resources/images/cancel.png'); $('#qs-clear-sort').show(); } if (text.length > 2) { $('#helpstring').hide(); $('#sort-option').show(); $('#results-container').show(); $('#qs-overlay').show(); $('.search-div .search-cancel').show(); $('#results').scrollTop(0); tracking.currentSearchTerm = text; $.get('/search', { 'term': text, 'units': $('#units').text(), 'sort': sort }, function(results) { $('#results').html( results ); }, 'html' ); currentsearch = tracking.currentSearchTerm; if(currentsearchID){ clearTimeout(currentsearchID); } currentsearchID = setTimeout(function() { currentsearchID = 0; register_search(tracking.currentSearchTerm); }, 3000); } if (text.length < 3) { $('#sort-option').hide(); $('#qs-overlay').hide(); $('#results-container').hide(); $('#helpstring').show(); $('.search-div .search-cancel').hide(); clear_results(); } } function clear_results() { $('#featured-result').html(''); $('#results').html(''); } function register_search(term){ if(term == currentsearch){ ga('send', 'event','search', 'fpsearch',term); } } }); // this function is called from the code produced by ajax so is tricky // to not put in the main namespace function show_result( id, title ) { tracking.currentItemId = id; tracking.currentItemTitle= title; $.get('item/'+id+".fragment", function(page) { ga('send', 'pageview', '/item/'+id); $('#featured-result').scrollTop(0); $('#featured-result').html( page ); }, 'html'); }