$(document).ready(function() { /* HOMEPAGE SLIDESHOW */ $('.slideshow').cycle({ fx: 'fade', speed:2000, timeout:3000, pause:1 }); /* SCHOLARSHIPS CLEAR INPUT */ $('#country').focus(function(){$(this).attr("value","")}); $('#degree').focus(function(){$(this).attr("value","")}); $('#subject').focus(function(){$(this).attr("value","")}); $('#college').focus(function(){$(this).attr("value","")}); /* TRUSTEES TOGGLE */ $('.hideme').after('

More...

'); $('.hideme').hide(); $('a.toggleLink').click(function() { $(this).parent().prev('.hideme').slideToggle(); //this.text(($('.toggleLink').text() == 'More...') ? 'Less...' : 'More...'); ($(this).text() == 'More...') ? $(this).text('Less...') : $(this).text('More...'); return false; }); /* FAQ ACCORDION */ $('.accordion-link').click(function() { $('.accordion-link').removeClass('on'); $('.accordion-content').slideUp('fast'); if($(this).next().is(':hidden') == true) { $(this).addClass('on'); $(this).next().slideDown('normal'); } }); $('.accordion-content').hide(); /* SURVEY FORM */ $('#rad-visit-yes').click(function () {$('#toggle-visit').show();}); $('#rad-visit-no').click(function () {$('#toggle-visit').hide();}); $('#rad-contact-yes').click(function () {$('#toggle-contact').show();}); $('#rad-contact-no').click(function () {$('#toggle-contact').hide();}); $('#rad-user-friendly-yes').click(function () {$('#toggle-user-friendly').show();}); $('#rad-user-friendly-no').click(function () {$('#toggle-user-friendly').hide();}); $('#rad-facebook-yes').click(function () {$('#toggle-social-media').show();}); $('#rad-facebook-no').click(function () {$('#toggle-social-media').hide();}); $('#rad-profile-yes').click(function () { $('.toggle-alumni').show(); $('#txt-name').addClass('required'); $('#txt-email').addClass('required'); }); $('#rad-profile-no').click(function () { $('.toggle-alumni').hide(); $('#txt-name').removeClass('required'); $('#txt-email').removeClass('required'); }); $("#freeform").validate({ rules: { nationality: "required", admission: "required", hear: "required", visit: "required", contact: "required", user_friendly: "required", facebook: "required", profile: "required" } /*, messages: { nationality: "Please enter your nationality", admission: "Please select either yes or no", hear: "Please tell us how you heard about the website", visit: "Please select either yes or no", contact: "Please select either yes or no", user_friendly: "Please select either yes or no", facebook: "Please select either yes or no", profile: "Please select either yes or no" } */ }); /* TABLE STRIPING */ $('table tr:even').addClass('odd'); /** * Click on info icon on scholarships forms */ $('a.info').click(function() { // Remove old info box var currentEl = $(this); var parentEl = $(this).parent().parent(); if (!$(this).hasClass('active')) { var html = '
'; html += $(this).data('text'); html += '
'; parentEl.append(html); $(this).addClass('active'); } else { parentEl.find('.info-box').remove(); $(this).removeClass('active'); } }); }); //google maps code if ($("#map").length > 0){ var myLatlng = new google.maps.LatLng(52.206411,0.120011); var myOptions = { zoom: 17, center: myLatlng, mapTypeId: google.maps.MapTypeId.ROADMAP, panControl: false, zoomControl: true, mapTypeControl: true, scaleControl: true, streetViewControl: true, overviewMapControl: true } var map = new google.maps.Map(document.getElementById("map"), myOptions); var infowindow = new google.maps.InfoWindow({ content: "

Cambridge Commonwealth & Overseas Trusts

53-54 Sidney Street
Cambridge
CB2 3HX

", maxWidth: 200 }); var marker = new google.maps.Marker({ position: myLatlng, map: map, title:"Cambridge Commonwealth Trust and Cambridge Overseas Trust" }); google.maps.event.addListener(marker, 'click', function() {infowindow.open(map,marker);}); } //end if the map div on page if ($("#country").length > 0){ var availableTags = [ "Afghanistan","Albania","Algeria","Andorra","Angola","Antigua & Barbuda","Argentina","Armenia","Australia","Azerbaijan","Bahamas","Bahrain","Bangladesh","Barbados","Belarus","Belize","Benin","Bhutan","Bolivia","Bosnia & Herzegovina","Botswana","Brazil","Vatican","Brunei","Burkina Faso","Burundi","Cambodia","Cameroon","Canada","Cape Verde","Central African Republic","Chad","Chile","China","Colombia","Comoros","Congo, Democratic Republic of the","Congo, Republic of the","Cook Islands","Costa Rica","Cote d'Ivoire","Croatia","Cuba","Djibouti","Dominica","Dominican Republic","East Timor","Ecuador","Egypt","El Salvador","Equatorial Guinea","Eritrea","Ethiopia","Fiji","Gabon","Gambia","Georgia","Ghana","Grenada","Guatemala","Guinea","Guinea-Bissau","Guyana","Haiti","Honduras","Hong Kong","Iceland","India","Indonesia","Iran","Iraq","Israel","Jamaica","Japan","Jordan","Kazakhstan","Kenya","Kiribati","Korea, Democratic People's Republic of","Korea, Republic of","Kuwait","Kyrgyzstan","Laos","Lebanon","Lesotho","Liberia","Libya","Liechtenstein","Macao","Macedonia","Madagascar","Malawi","Malaysia","Maldives","Mali","Marshall Islands","Mauritania","Mauritius","Mexico","Micronesia, Federated States of","Moldova","Monaco","Mongolia","Montenegro","Sweden","Morocco","Mozambique","Myanmar (Burma)","Namibia","Nauru","Nepal","New Zealand","Nicaragua","Niger","Nigeria","Norway","Oman","Pakistan","Palau","Palestinian Territories","Panama","Papua New Guinea","Paraguay","Peru","Philippines","Spain","Qatar","Russian Federation","Rwanda","South Sudan","Saint Kitts & Nevis","Saint Lucia","Saint Vincent & the Grenadines","Samoa","San Marino","Sao Tome & Principe","Saudi Arabia","Senegal","Serbia","Seychelles","Sierra Leone","Singapore","Solomon Islands","Somalia","South Africa","Sri Lanka","Sudan","Suriname","Swaziland","Switzerland","Syria","Taiwan","Tajikistan","Tanzania","Thailand","Togo","Tonga","Trinidad & Tobago","Slovenia","Tunisia","Slovakia","Turkey","Turkmenistan","Tuvalu","Uganda","Ukraine","United Arab Emirates","United States of America","Uruguay","Uzbekistan","Vanuatu","Venezuela","Vietnam","Western Sahara","Yemen","Zambia","Zimbabwe","Austria","Kosovo","Puerto Rico","Cyprus","Malta","Belgium","Bulgaria","Czech Republic","Denmark","Estonia","Finland","France","Germany","Greece","Greenland","Channel Islands","Hungary","Ireland","Italy","Latvia","Lithuania","Luxembourg","Isle of Man","Netherlands","Poland","Portugal","Romania","British Overseas Territories","Jersey","Guernsey","United Kingdom", ]; $("#country").autocomplete({ source: availableTags, select: function(event, ui) { //when the user selects a country var selectedObj = ui.item; $('#dropdown-country option[value="' + selectedObj.value + '"]').prop('selected', true); $("#country").val(''); }, change: function(event, ui) { //when the user selects a country var selectedObj = ui.item; $('#dropdown-country option[value="' + selectedObj.value + '"]').prop('selected', true); $("#country").val(''); } }); }//end if the country input is on the page if ($("#degree").length > 0){ var availableTags = [ "Undergraduate","Masters","PhD", ]; $("#degree").autocomplete({ source: availableTags, select: function(event, ui) { //when the user selects a degree var selectedObj = ui.item; $('#dropdown-degree option[value="' + selectedObj.value + '"]').prop('selected', true); $("#degree").val(''); }, change: function(event, ui) { //when the user selects a degree var selectedObj = ui.item; $('#dropdown-degree option[value="' + selectedObj.value + '"]').prop('selected', true); $("#degree").val(''); } }); }//end if the degree input is on the page if ($("#subject").length > 0){ var availableTags = [ "African Studies ","Anglo-Saxon, Norse and Celtic","Animal Health","Applied Mathematics and Theoretical Physics","Archaeology","Architecture","Astronomy ","Biochemistry ","Bioinformatics","Biological Anthropology","Biology ","Biostatistics","Cancer Research","Chemical Engineering and Biotechnology","Chemistry ","Classics","Clinical Biochemistry ","Clinical Medicine","Clinical Neurosciences ","Clinical Pharmacology","Cognition and Brain Sciences","Computer Science","Criminology ","Development Studies ","Divinity","Earth Sciences ","East Asian Studies","Economics ","Education ","Engineering","English","Epidemiology","Experimental Psychology","French","Genetics ","Geography ","German and Dutch","Haematology ","History ","History of Art and Architecture","History and Philosophy of Science","Human Nutrition","Italian","Judge Business School","Land Economy ","Latin American Studies ","Law ","Linguistics","Materials Science and Metallurgy ","Medical Genetics ","Medical Research","Medicine ","Metabolic Science","Middle Eastern Studies","Mitochondrial Biology","Modern and Medieval Languages","Molecular Biology","Music","Obstetrics and Gynaecology ","Oncology ","Orthopaedic Research","Paediatrics ","Pathology ","Pharmacology ","Philosophy","Physics ","Physiology, Development and Neuroscience ","Plant Sciences ","Polar Studies","Politics and International Studies","Psychiatry ","Public Health and Primary Care","Pure Mathematics and Mathematical Statistics","Radiology ","Slavonic Studies","Social Anthropology","Social and Developmental Psychology","Sociology ","South Asian Studies ","Spanish and Portuguese","Stem Cell Research ","Surgery ","Veterinary Science ","Zoology ","Gender Studies","Film and Screen Studies","Public Policy","Conservation Leadership","Engineering for Sustainable Development","Environmental Policy","Planning, Growth and Regeneration", ]; $("#subject").autocomplete({ source: availableTags, select: function(event, ui) { //when the user selects a subject var selectedObj = ui.item; $('#dropdown-subject option[value="' + selectedObj.value + '"]').prop('selected', true); $("#subject").val(''); }, change: function(event, ui) { //when the user selects a subject var selectedObj = ui.item; $('#dropdown-subject option[value="' + selectedObj.value + '"]').prop('selected', true); $("#subject").val(''); } }); }//end if the subject input is on the page if ($("#college").length > 0){ var availableTags = [ "Christ's","Churchill ","Clare","Clare Hall","Corpus Christi","Darwin","Downing","Emmanuel","Fitzwilliam ","Girton ","Gonville and Caius","Homerton","Hughes Hall","Jesus","King's","Lucy Cavendish","Magdalene ","Murray Edwards ","Newnham","Pembroke","Peterhouse","Queens' ","Robinson","Selwyn","Sidney Sussex","St Catharine's ","St Edmund's ","St John's ","Trinity","Trinity Hall ","Wolfson", ]; $("#college").autocomplete({ source: availableTags, select: function(event, ui) { //when the user selects a college var selectedObj = ui.item; $('#dropdown-college option[value="' + selectedObj.value + '"]').prop('selected', true); $("#college").val(''); }, change: function(event, ui) { //when the user selects a college var selectedObj = ui.item; $('#dropdown-college option[value="' + selectedObj.value + '"]').prop('selected', true); $("#college").val(''); } }); }//end if the college input is on the page