// Author: Chris Calon (koeus.com) // About: Using jQuery to run all JS Functionality. // No JS?: Backup measures have been taken into account /*--------------------------------------------------------------------------------------------------*/ //Did you Know? ticket thing var newsitems; var curritem=0; var iPause=0; $(document).ready(function() { // Row color alternator // About: Zebra stripping for weather tables. // No JS?: Not a big deal, data still there, just no alternating row colors /*--------------------------------------------------------------------------------------------------*/ $('table.weather tbody tr:odd').addClass('odd'); $('table.weather tbody tr:even').addClass('even'); // Trip Dates Collapser // About: // No JS?: /*--------------------------------------------------------------------------------------------------*/ var collapse = $('.tripdatescollapse ul li').size(); $('.tripdatescollapse ul li:gt(1)').hide(); $('.itinerary a').click(function() { $('.seeall-wrapper').hide(); $('.tripdatescollapse ul li').show(); }); $('p.jsrequired').remove(); // Adventure Tags // About: Adds comma to the end of every tags // No JS?: no commans /*--------------------------------------------------------------------------------------------------*/ $('a.tag:not(:last)').after(","); // Form Input // About: Styles Form Inputs // No JS?: /*--------------------------------------------------------------------------------------------------*/ $('input:text').addClass('form-input'); // PNG fix // About: // No JS?: Images will look funny /*-------------------------------------------------------------------------------------------------*/ var ie6 = $.browser.msie && typeof XMLHttpRequest == 'function'; if (ie6) { $(document).pngFix(); } // Image Lightboxes // About: If images exist inside content-details area, wrap lightbox around them. // No JS?: /*--------------------------------------------------------------------------------------------------*/ $('#content-details img, img.fancybox').each(function() { var title = $(this).attr("alt"); var href = $(this).attr("src").replace("thumbs", "images"); $(this).wrap(''); }); // Fancy Boxes // About: Fancy Boxes // No JS?: Images show, but no click. /*--------------------------------------------------------------------------------------------------*/ $('.fancybox').fancybox({ 'overlayShow': true }); // Slideshows // About: If slideshow exists, run the cycle // No JS?: /*--------------------------------------------------------------------------------------------------*/ $('#slideshow').html(''); $('#slideshow-home').html(''); $('#slideshow-home').cycle({ fx: 'fade', speed: 1000, timeout: 3000 }); $('#slideshow').cycle({ fx: 'fade', speed: 4000, timeout: 3000, random: 1 }); // Validate Form // About: Validate the Inquiry form to make sure email address is complete,and phone numbe entered // No JS?: Will not break, and people will be able to circumvent form. /*--------------------------------------------------------------------------------------------------*/ if ($('#inquire').size() > 0) { $("#inquire").validate({ rules: { Realname: "required", Email: "required", Phone: "required", Name: { required: true, minlength: 2 }, Email: { required: true, email: true }, Phone: { required: true, minlength: 10 } }, messages: { Realname: "Please enter your name", Email: "Please enter a valid email address", Phone: "Please enter a valid 10 digit phone number" } }); } // Booking Validate Form // About: Validate the Booking form to make sure email address is complete,and phone numbe entered // No JS?: Will not break, and people will be able to circumvent form. /*--------------------------------------------------------------------------------------------------*/ if ($('#booking').size() > 0) { $("#booking").validate({ rules: { name_title: "required", name_first: "required", name_last: "required", gender: "required", email: "required", phone: "required", phone_work: "required", phone_mobile: "required", address: "required", city: "required", state: "required", country: "required", postcode: "required", passport_no: "required", passport_country: "required", dateofbirth: "required", passport_date_issue: "required", passport_date_expirey: "required", flights_arrival_date: "required", flights_arrival_time: "required", flights_arrival_flight_number: "required", flights_departure_date: "required", flights_departure_time: "required", flights_departure_flight_number: "required", medical_major_illness: "required", medical_allergies: "required", other_conditions_medication: "required", kin_name: "required", kin_relationship: "required", kin_phone: "required", insurance_company: "required", insurance_policy_number: "required", insurance_contact: "required", special_travlling_together: "required", special_room_type_single_double_twin: "required", special_requested_shirt_size: "required", special_requested_bike_size: "required", special_diet: "required", special_additional_questions: "required", terms: "required" } }); } // Round all corners // About: // No JS?: /*--------------------------------------------------------------------------------------------------*/ $('#content').corner({ tl: { radius: 6 }, tr: { radius: 6 }, bl: false, br: false, antiAlias: true, autoPad: true, validTags: ["div"] }); $('#updated').corner({ tl: { radius: 8 }, tr: { radius: 8 }, bl: { radius: 8 }, br: { radius: 8 }, antiAlias: true, autoPad: true, validTags: ["div"] }); // News Ticker on Left // About: // No JS?: /*--------------------------------------------------------------------------------------------------*/ $('#dyk-ticker').cycle({ fx: 'fade', speed: 1000, timeout: 4000, random: 1 }); // Submenu // About: // No JS?: /*--------------------------------------------------------------------------------------------------*/ if ($('ul.submenu').size() > 0) { var tabContainers = $('#container > div'); $('ul.submenu').tabs({ fxSlide: true, fxFade: true, fxSpeed: 'slow' }); $('ul.submenu a:first').addClass('active'); $('ul.submenu a').click(function() { if ($(this).attr('className') != "active") { $('ul.submenu a').removeClass('active'); $(this).addClass('active'); return false; } }); } // Dates // About: // No JS?: /*--------------------------------------------------------------------------------------------------*/ if ($('#panel').size() > 0) { if ($('.on-demand').size() > 0) { var onDemandLink = $('.bookthistrip a').attr("href"); $('.on-demand').attr({'href':onDemandLink}); } else { var tripTitle = $('div.upcomingdates').attr('title'); $('div.upcomingdates').prepend('
(see all)
'); $('.alldates').after(''); $('.seeall').click(function() { var rel = tripTitle; $.ajax({ beforeSend: function() { $('.alldates').slideUp('slow'); $('.loader').slideDown('slow'); }, url: "_includes/showAllDates.php", data: {rel: rel}, success: function(html) { $('.loader').slideUp(); $('.alldates').text(html).slideDown('slow'); }, error: function() { $('.alldates').text('Error'); } }); }); } } $('.on-demand').each(function() { var tripLink = $(this).attr('rel'); var tripLink = 'inquire?refer='+tripLink; $(this).attr({'href':tripLink}); }); // External Links // About: Adds external link and graphic to external links // No JS?: link still works, just not in blank window. /*--------------------------------------------------------------------------------------------------*/ $("a[href^='http']:not('.not-external, [href*='smilingalbino.com']'), .blank").attr('target', '_blank').addClass('external'); // Equilize Columns // About: Makes sure all columns are of equal height so CSS works // No JS?: no big deal. Columns won't be same height /*--------------------------------------------------------------------------------------------------*/ $("div.b1, div.b2, div.b3").equalizeCols(); // Icon Popup // About: When trip icons are clicked info window pops up // No JS?: no click /*--------------------------------------------------------------------------------------------------*/ $('.icon-hike').click(function() { jQuery.facebox('Most Smiling Albino adventures include some walking or hiking.

Our Day Trips include some walking through city streets and require the ability to climb stairs and ramps.
• Where a day hike is part of our multi-day adventures, the ability to navigate narrow paths and moderately steep climbs is required.
• Adventures with multi-day trekking through the mountains can include up to 8 hours per day of strenuous hiking, requiring an above average level of fitness.

Remember that most trips with moderate walking and hiking can be modified to accomodate a variety of fitness levels.'); $('#facebox div.top').html('Walking & Hiking'); }); $('.icon-bike').click(function() { jQuery.facebox('Many Smiling Albino adventures include cycling of some kind.

Our Day Trips might include light cycling on level ground.
• Where cycling is a day or two in a multi-day adventures, the ride can vary from moderately hilly paved roads to off road rides of 40-50km.
• Adventures with multiple days of riding can include up to 8 hours per day of strenuous cycling, requiring an above average level of fitness.

For trips where cycling isn not the primary activity, things can be modified to accomodate a variety of fitness levels, or even no riding at all. Remember that we always have a support vehicle with the group. Let us know your preferences when you contact us.'); $('#facebox div.top').html('Cycling'); }); $('.icon-motorbike').click(function() { jQuery.facebox('A variety of Smiling Albino adventures include the opportunity to ride a motorscooter or motorcycle.

• For our trips where motorcycling is the primary mode of transport, prior experience riding on and off road is required.

• For trips with motorscooter riding, introductory training is provided but Smiling Albino does not guarantee that all participants will be offered the option to ride.'); $('#facebox div.top').html('Motorbiking'); }); $('.icon-elephant').click(function() { jQuery.facebox('Elephants are important to the culture of all the countries that Smiling Albino travels to. Where you see the elephant icon in one of our trips you will see and have the opportunity to ride, chat with, feed and possibly bond with elephants.'); $('#facebox div.top').html('Elephants'); }); $('.icon-paddle').click(function() { jQuery.facebox('On many Smiling Albino adventures there is the option to paddle a kayak on the ocean or on a river, including the Mighty Mekong. Prior skill is not required but the opportunity to float and paddle may be affected by weather. Life jackets are always provided.'); $('#facebox div.top').html('Paddling'); }); // Effort Popup // About: When trip icons are clicked info window pops up // No JS?: no click /*--------------------------------------------------------------------------------------------------*/ $('.meter').css({'cursor':'pointer'}); $('.meter').click(function() { jQuery.facebox('Smiling Albino trips generally require some level of physical activity, but we are experienced in hosting travellers aged 1 to 100. The effort shown on our adventure pages indicate the average expected for the trip. That said, most trips can be modified to accomodate either a higher or lower level of physical exertion.
Expect moderate walking and/or light cycling
Expect three to five hours of moderate daily activity. Some experience with the trip focused activity would be beneficial.
An effort level of three indicates 3 to 7 hours per day of exercise. It is expected that participants have significant recent experience with the primary trip activities.
At this level participants will challenged by up to 8 hours per day of strenuous hiking or cycling. Participants should be very physically fit and fully competent in the trip activities.
Level five is like level four but with more days of excitement.
'); $('#facebox div.top').html('Effort Meter Information'); }); $('div.printerfriendly a').attr({'target':'_blank'}); /* CLOSE */ }); function ticknews() { if (iPause==0){ $("ul#dyk-ticker li:eq("+curritem+")").fadeOut("slow",function(){$(this).hide();}); curritem = ++curritem%newsitems; $("ul#dyk-ticker li:eq("+curritem+")").fadeIn("slow"); } } jQuery.fn.equalizeCols = function() { var el, height = 0, h; this.each(function() { el = jQuery(this).css("height", "auto"); h = el.outerHeight(); height = (h > height) ? h : height; }); return this.each(function() { jQuery(this).css("height", height); }); }; /* No idea what this is from */ var myTextExtraction = function(node) { // extract data from markup and return it return node.childNodes[0].childNodes[0].innerHTML; }