/* Modernizr 2.6.2 (Custom Build) | MIT & BSD * Build: http://modernizr.com/download/#-canvas-canvastext-audio-video-svg-printshiv-cssclasses-cssclassprefix:mod! */ ;window.Modernizr=function(a,b,c){function v(a){j.cssText=a}function w(a,b){return v(prefixes.join(a+";")+(b||""))}function x(a,b){return typeof a===b}function y(a,b){return!!~(""+a).indexOf(b)}function z(a,b,d){for(var e in a){var f=b[a[e]];if(f!==c)return d===!1?a[e]:x(f,"function")?f.bind(d||b):f}return!1} var d="2.6.2",e={},f=!0,g=b.documentElement,h="modernizr",i=b.createElement(h),j=i.style,k,l={}.toString,m={svg:"http://www.w3.org/2000/svg"},n={},o={},p={},q=[],r=q.slice,s,t={}.hasOwnProperty,u;!x(t,"undefined")&&!x(t.call,"undefined")?u=function(a,b){return t.call(a,b)}:u=function(a,b){return b in a&&x(a.constructor.prototype[b],"undefined")},Function.prototype.bind||(Function.prototype.bind=function(b){var c=this;if(typeof c!="function")throw new TypeError;var d=r.call(arguments,1),e=function(){if(this instanceof e){var a=function(){};a.prototype=c.prototype;var f=new a,g=c.apply(f,d.concat(r.call(arguments)));return Object(g)===g?g:f}return c.apply(b,d.concat(r.call(arguments)))};return e}),n.canvas=function(){var a=b.createElement("canvas");return!!a.getContext&&!!a.getContext("2d")},n.canvastext=function(){return!!e.canvas&&!!x(b.createElement("canvas").getContext("2d").fillText,"function")},n.video=function(){var a=b.createElement("video"),c=!1;try{if(c=!!a.canPlayType)c=new Boolean(c),c.ogg=a.canPlayType('video/ogg; codecs="theora"').replace(/^no$/,""),c.h264=a.canPlayType('video/mp4; codecs="avc1.42E01E"').replace(/^no$/,""),c.webm=a.canPlayType('video/webm; codecs="vp8, vorbis"').replace(/^no$/,"")}catch(d){}return c},n.audio=function(){var a=b.createElement("audio"),c=!1;try{if(c=!!a.canPlayType)c=new Boolean(c),c.ogg=a.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/,""),c.mp3=a.canPlayType("audio/mpeg;").replace(/^no$/,""),c.wav=a.canPlayType('audio/wav; codecs="1"').replace(/^no$/,""),c.m4a=(a.canPlayType("audio/x-m4a;")||a.canPlayType("audio/aac;")).replace(/^no$/,"")}catch(d){}return c},n.svg=function(){return!!b.createElementNS&&!!b.createElementNS(m.svg,"svg").createSVGRect};for(var A in n)u(n,A)&&(s=A.toLowerCase(),e[s]=n[A](),q.push((e[s]?"":"no-")+s));return e.addTest=function(a,b){if(typeof a=="object")for(var d in a)u(a,d)&&e.addTest(d,a[d]);else{a=a.toLowerCase();if(e[a]!==c)return e;b=typeof b=="function"?b():b,typeof f!="undefined"&&f&&(g.className+=" mod-"+(b?"":"no-")+a),e[a]=b}return e},v(""),i=k=null,e._version=d,g.className=g.className.replace(/(^|\s)no-js(\s|$)/,"$1$2")+(f?" mod-js mod-"+q.join(" mod-"):""),e}(this,this.document),function(a,b){function k(a,b){var c=a.createElement("p"),d=a.getElementsByTagName("head")[0]||a.documentElement;return c.innerHTML="x",d.insertBefore(c.lastChild,d.firstChild)}function l(){var a=r.elements;return typeof a=="string"?a.split(" "):a}function m(a){var b=i[a[g]];return b||(b={},h++,a[g]=h,i[h]=b),b}function n(a,c,f){c||(c=b);if(j)return c.createElement(a);f||(f=m(c));var g;return f.cache[a]?g=f.cache[a].cloneNode():e.test(a)?g=(f.cache[a]=f.createElem(a)).cloneNode():g=f.createElem(a),g.canHaveChildren&&!d.test(a)?f.frag.appendChild(g):g}function o(a,c){a||(a=b);if(j)return a.createDocumentFragment();c=c||m(a);var d=c.frag.cloneNode(),e=0,f=l(),g=f.length;for(;e+~])("+l().join("|")+")(?=[[\\s,>+~#.:]|$)","gi"),f="$1"+t+"\\:$2";while(d--)b=c[d]=c[d].split("}"),b[b.length-1]=b[b.length-1].replace(e,f),c[d]=b.join("}");return c.join("{")}function y(a){var b=a.length;while(b--)a[b].removeNode()}function z(a){function g(){clearTimeout(d._removeSheetTimer),b&&b.removeNode(!0),b=null}var b,c,d=m(a),e=a.namespaces,f=a.parentWindow;return!u||a.printShived?a:(typeof e[t]=="undefined"&&e.add(t),f.attachEvent("onbeforeprint",function(){g();var d,e,f,h=a.styleSheets,i=[],j=h.length,l=Array(j);while(j--)l[j]=h[j];while(f=l.pop())if(!f.disabled&&s.test(f.media)){try{d=f.imports,e=d.length}catch(m){e=0}for(j=0;j",f="hidden"in a,j=a.childNodes.length==1||function(){b.createElement("a");var a=b.createDocumentFragment();return typeof a.cloneNode=="undefined"||typeof a.createDocumentFragment=="undefined"||typeof a.createElement=="undefined"}()}catch(c){f=!0,j=!0}})();var r={elements:c.elements||"abbr article aside audio bdi canvas data datalist details figcaption figure footer header hgroup mark meter nav output progress section summary time video",shivCSS:c.shivCSS!==!1,supportsUnknownElements:j,shivMethods:c.shivMethods!==!1,type:"default",shivDocument:q,createElement:n,createDocumentFragment:o};a.html5=r,q(b);var s=/^$|\b(?:all|print)\b/,t="html5shiv",u=!j&&function(){var c=b.documentElement;return typeof b.namespaces!="undefined"&&typeof b.parentWindow!="undefined"&&typeof c.applyElement!="undefined"&&typeof c.removeNode!="undefined"&&typeof a.attachEvent!="undefined"}();r.type+=" print",r.shivPrint=z,z(b)}(this,document); /* user agent detection script, taken from http://cssuseragent.org/ */ window.cssua=function(i,l){var m=/\s*([\-\w ]+)[\s\/]([\d_]+\b([\-\._\/]\w+)*)/,n=/([\w\-\.]+[\s\/][v]?[\d_]+\b([\-\._\/]\w+)*)/g,o=/rv[:](\d+(\.\w+)*).*?\bgecko[\/]\w+/,p=/\bblackberry\w*[\s\/]+(\d+(\.\w+)*)/,q=/(\bwindows\b|\bmacintosh\b|\blinux\b|\bunix\b)/,r=/(\bandroid\b|\bipad\b|\bipod\b|\bblackberry|\brim tablet os\b|\bwebos\b|\bwindows ce\b|\bwindows phone os\b|\bwindows ce\b|\bpalm|\bsymbian|\bj2me\b|\bdocomo\b|\bpda\b|\bchtml\b|\bmidp\b|\bcldc\b|\w*?mobile\w*?|\w*?phone\w*?)/,s=/(\bxbox\b|\bplaystation\b|\bnintendo\s+\w+)/,d={parse:function(c){var a={},c=(""+c).toLowerCase();if(!c)return a;for(var b,g,e=c.split(/[()]/),f=0,d=e.length;f maxTriggerWidth) maxTriggerWidth = w; }); $(".trigger span",$tools).css('width',maxTriggerWidth); $sharecontent.css({'padding-right':parseInt(maxTriggerWidth) + 27 + "px"}); $(".print",$tools).hover( function(){ $('.trigger span',$(this)).css('width', parseInt(maxTriggerWidth) + 3 + "px"); }, function(){ $('.trigger span',$(this)).css('width', maxTriggerWidth); } ); if (!msie6 && $panel.offset()!= null){ var panelTop = $panel.offset().top - parseFloat($panel.css('margin-top').replace(/auto/, 0)); var toolsMarginTop = null; $(window).bind('scroll resize',function (e){ var y = $(this).scrollTop(); if (y >= panelTop){ if(!$panel.hasClass(params.fixedClass)) $panel.addClass(params.fixedClass); } else{ $panel.css("top",panelTop); $panel.removeClass(params.fixedClass); } if($tools.length){ var maincontainerTop = $maincontainer.offset().top - parseFloat($panel.height()); if(y >= maincontainerTop){ if(!$tools.hasClass(params.fixedClass)) { $tools.addClass(params.fixedClass); } } else{ $tools.removeClass(params.fixedClass); $tools.removeAttr("style"); } var isTooWide = $('#maincontent').outerWidth(true) > $(window).width(); $tools.toggleClass(params.tooWideClass, isTooWide); var toolsMarginTop = parseFloat($tools.css('margin-top').replace(/auto/, 0)); /** * Login panel */ $panelLogin.mouseenter(function(){ var $e = $(this); var height = parseFloat($e.find(params.panelContentElement).outerHeight()); if($tools.hasClass(params.fixedClass)) $tools.css("margin-top",toolsMarginTop+height+"px"); else $tools.css("margin-top",toolsMarginTop+"px"); }); $panelLogin.mouseleave(function(){ if($tools.hasClass(params.fixedClass)) $tools.css("margin-top",toolsMarginTop+"px"); else $tools.css("margin-top",toolsMarginTop+"px"); $(this).find('input').blur(); }); /** * Search panel */ $panelSearch.mouseenter(function(){ var $e = $(this); var height = parseFloat($e.find(params.panelContentElement).outerHeight()); if($tools.hasClass(params.fixedClass)) $tools.css("margin-top",toolsMarginTop+height+"px"); else $tools.css("margin-top",toolsMarginTop+"px"); }); $panelSearch.mouseleave(function(){ if($tools.hasClass(params.fixedClass)) $tools.css("margin-top",toolsMarginTop+"px"); else $tools.css("margin-top",toolsMarginTop+"px"); $(this).find('input').blur(); }); } }).trigger("resize"); $share.mouseenter(function(){ $(this).addClass(params.hoverClass); $(".trigger span", $(this)).css('width', parseInt(maxTriggerWidth) + 3 + "px"); }); $share.mouseleave(function(){ if ($('#booking-share-data') != null && !$('#booking-share-data').is(':visible')) { $(this).removeClass(params.hoverClass); $('.trigger span',$(this)).css('width', maxTriggerWidth); } }); } }, initFormSubmit: function($submit){ var self = this; var $form = $submit.closest("form"); $submit.click(function(){ $form.submit(); return false; }); }, initAccordion: function(options){ var self = this; var defaults = { 'items': 'dl.accordion' }; var options = $.extend(defaults, options); var $accordions = $(options['items']); if(!$accordions.length) return false; $('dt', $accordions).click(function(){ var $dd = $(this).next('dd'); var $href = $('a', this); var openText = $href.data('openText') || 'Open'; var closeText = $href.data('closeText') || 'Close'; if ($href.hasClass('open')) { $href.removeClass('open').addClass('close').text(closeText); $dd.show(); } else { $href.removeClass('close').addClass('open').text(openText); $dd.hide(); } }); $('dt a', $accordions).click(function(){ $(this).closest('dt').click(); return false; }) }, initSTooltip: function($trigger,params) { var self = this; var defaults = { fadeSpeed: 200, tooltipClass: '.tooltip-container' }; params = $.extend(defaults,params); var selector = (typeof $trigger.selector === 'undefined') ? $trigger : $trigger.selector ; $(document.body) .on({ click: false, mouseenter: function(e) { $(this).find(params.tooltipClass) .stop() .show() .animate({opacity: '0',bottom: "20px"},0) .animate({opacity: '1',bottom: "0px"},params.fadeSpeed) ; }, mouseleave: function(e) { var $tooltip = $(this).find(params.tooltipClass); $tooltip .stop() .animate({opacity: '0',bottom: "20px"}, (params.fadeSpeed/2),function(){ $tooltip.hide(); }); } }, selector); }, initCardsLessMore: function($trigger,$content,params){ var self = this; var defaults = { closestElement: '.card', activeClass: 'sel', fadeSpeed: 200 }; var params = $.extend(defaults,params); if(!$trigger.length || !$content.length) return false; $trigger.click(function(){ var $e = $(this); var $c = $e.closest(params.closestElement).find($content); if(!$c.length) return false; if($e.hasClass(params.activeClass)){ $e.removeClass(params.activeClass); $c.slideUp(params.fadeSpeed); } else{ $e.addClass(params.activeClass); $c.slideDown(params.activeClass); } return false; }); }, initChk: function($container,params){ var self = this; var defaults = { activeClass: 'sel', labelElement: 'label', triggerElement: 'a' }; params = $.extend(defaults, params); $container.each(function(){ var $e = $(this); var $input = $e.find('input'); var $label = $e.find(params.labelElement); var $trigger = $e.find(params.triggerElement); var checkF = function(){ if($input.is(":checked")){ $trigger.removeClass(params.activeClass); $input.removeAttr("checked"); } else{ $trigger.addClass(params.activeClass); $input.attr("checked","checked"); } }; if($input.is(":checked")) $trigger.addClass(params.activeClass); $trigger.click(function(){ checkF(); if("parUserType"==$input.attr('name'))parFuelTypeChkbox($input.attr('id'));/** * addition by L&T Infotech */ return false; }); $label.click(function(){ checkF(); if("parUserType"==$input.attr('name'))parFuelTypeChkbox($input.attr('id'));/** * addition by L&T Infotech */ return false; }); }); }, initChkInContainer: function(selector, cfg) { if(typeof selector.jquery === 'undefined' && /^[a-z]+$/i.test(selector)) { selector = '#' + selector; } Common.initChk($(selector).find('.__jsChk'), cfg); }, initRadioButtons: function(params) { var defaults = { container: '.__jsRadio', selectedClass: 'sel' }; params = $.extend({}, defaults, params); $('body').on('click', params.container + ' a, ' + params.container + ' label', function(e) { e.preventDefault(); var $this = $(this); var $wrapper = $this.closest(params.container); $wrapper.find('a').addClass(params.selectedClass); var $input = $wrapper.find('input[type="radio"]'); $input.attr('checked', 'checked'); var name = $input.attr('name'); var $others = $('body').find(params.container + ' input[name="' + name + '"]').not($input); $others.each(function() { var $this = $(this); var $wrapper = $this.closest(params.container); $wrapper.find('a').removeClass(params.selectedClass); }); }); }, _preloadImages: function() { var src = Array.prototype.slice.apply(arguments); (function preloadImg(sources) { if(sources.length) { (new Image()).src = sources.shift(); setTimeout(function() { preloadImg(sources); }, 100); } })(src); }, initPicturesGallery: function($container, $largeImage, $controls, $thumbstriger, $thumbs, params){ var self = this; var defaults = { activeClass: "active", slideSpeed: 200, fadeSpeed: 500, prevControlClass: 'prev', nextControlClass: 'next', activeImgClass: 'sel' }; params = $.extend(defaults, params); if(!$container.length) return false; $container.each(function(){ var $c = $(this); var $lImg = $c.find($largeImage); var $ctrl = $c.find($controls); var $counter = $ctrl.find('.current'); var $trg = $c.find($thumbstriger); var $thmb = $c.find($thumbs); var $smallPictures = $thmb.find('a'); var maxIdx = $smallPictures.length - 1; var getLargeURL = function(el) { return el.attr('href') || el.find('img').attr('src'); }; var largeImageURLs = $.map($smallPictures, function() { return getLargeURL($(this)); }); Common._preloadImages.apply(null, largeImageURLs); if($trg.hasClass(params.activeClass)){ $trg.addClass(params.activeClass); // ?? jm: If want opened thumbs block on page load $thmb.addClass(params.activeClass); } var busySwitching = false; var curIdx = 0; var displayImage = function($thumbContainer) { if(busySwitching) { return; } busySwitching = true; curIdx = $thumbContainer.prevAll().length; var largeSrc = getLargeURL($thumbContainer); var $fullImage = $lImg.find('img'); $fullImage.animate({ opacity: 0 }, params.fadeSpeed, function() { $thmb.find('.' + params.activeImgClass).removeClass(params.activeImgClass); $thumbContainer.addClass(params.activeImgClass); $counter.text(curIdx + 1); $fullImage.attr('src', largeSrc); $fullImage.animate({ opacity: 1 }, params.fadeSpeed, function() { busySwitching = false; }); }); }; $thmb.on('click', 'a', function(e) { e.preventDefault(); var $this = $(this); displayImage($this); }); $ctrl.on('click', 'a', function(e) { e.preventDefault(); var $this = $(this), $tgt; var myIdx = false; switch(true) { case $this.hasClass(params.prevControlClass): myIdx = (curIdx > 0) ? curIdx - 1 : maxIdx ; $tgt = $smallPictures.eq(myIdx); displayImage($tgt); break; case $this.hasClass(params.nextControlClass): myIdx = (curIdx < maxIdx) ? curIdx + 1 : 0 ; $tgt = $smallPictures.eq(myIdx); displayImage($tgt); break; case $this.is($thumbstriger.selector): if($this.hasClass(params.activeClass)) { $this.removeClass(params.activeClass); $thmb.slideUp(params.slideSpeed); } else{ $this.addClass(params.activeClass); $thmb.slideDown(params.slideSpeed); } break; } }); }); }, initVideoGallery: function($container, params) { if(!$container.length) return false; window.onYouTubePlayerReady = window.onYouTubePlayerReady || function(playerId) { var $player = $('#' + playerId); $player.closest($container.selector).data('video-player', $player[0]); }; var defaults = { activeThumbClass: 'sel' }; params = $.extend(defaults, params); var $player = $container.find(params.player); var $videosContainer = $container.find(params.thumbs); var firstVid = $videosContainer.find('a').first().attr('href'); var swfParams = params.params; var swfAttrs = params.attrs; var videoURL = firstVid; if(videoURL.indexOf('?') == -1) { videoURL += '?'; } else { videoURL += '&'; } videoURL += params.queryData + '&enablejsapi=1&playerapiid=' + swfAttrs.id; swfobject.embedSWF(videoURL, $player.attr('id'), params.width, params.height, "8", null, null, swfParams, swfAttrs); $videosContainer.on('click', 'a', function(e) { e.preventDefault(); var $this = $(this); var videoURL = $this.attr('href'); var playerAPI = $container.data('video-player'); if(playerAPI) { if(videoURL.indexOf('?') == -1) { videoURL += '?'; } else { videoURL += '&'; } videoURL += params.queryData; /*Redfaire - JGH */ // playerAPI.loadVideoByUrl(videoURL); $('#__jsVPlayer').attr("data", videoURL + "&enablejsapi=1&playerapiid=__jsVPlayer "); /*Redfaire - JGH */ } $videosContainer.find('.' + params.activeThumbClass).removeClass(params.activeThumbClass); $this.addClass(params.activeThumbClass); }); }, initSelect: function($container){ var self = this; var defaults = { activeClass: 'sel', triggerElement: 'a', optionsElement: '.ct' }; var params = $.extend(defaults,params); $container.each(function(ix) { var $e = $(this); var $select = $e.find('select'); var $options = $("option",$select); var $trigger = $e.find(params.triggerElement); var $ct = $e.find(params.optionsElement); var $ct_option = $ct.find(params.triggerElement); var init = function(){ var output = ""; for(var i=0,count = $options.length; i < count; i++){ var $e = $($options[i]); var style = (i==0) ? 'class="first"': ''; output += '
  • '+$e.text()+'
  • '; } $ct.html("
      "+output+"
    "); $trigger.find("span").text($("option:selected",$select).text()); }; init(); $trigger.click(function(){ $ct.addClass(params.activeClass); return false; }); $ct_option.live('click',function(){ var $e = $(this); var text = $e.text(); var val = $e.attr("href").split("#")[1]; $trigger.find("span").text(text); $select.val(val); $select.find('option').removeAttr('selected'); $select.find('option[value="' + val + '"]').attr('selected', 'selected'); $select.change(); $ct.removeClass(params.activeClass); return false; }); // bugfix for new issues in form dropdown zindex var $row = $e.closest('.row'); var z = $row.css('z-index'); if(z !== 'auto') { $row.css('z-index', parseInt(z, 10) + ($container.length - ix)); } }); $(document).click(function(e){ $container.find(params.optionsElement).removeClass(params.activeClass); }); }, initShadows: function($elements){ var self = this; var defaults = {}; var params = $.extend(defaults,params); if(($.browser == "msie") && ($.browser.version < 10) || 1==1){ for(var i = 0, count = $elements.length; i'+$e.text()+''); } } }, /* Stations */ initGmap: function(params){ var self = this; var defaults = { shadowUrl: 'CMS/img/gmap/marker.shadow.png' }; params = $.extend(defaults, params); var latlng = new google.maps.LatLng(params.lat,params.lng); var options = { zoom: 4, center: latlng, mapTypeId: google.maps.MapTypeId.ROADMAP, disableDefaultUI: false, zoomControl: true, streetViewControl: false, mapTypeControl: true, zoomControlOptions: { style: google.maps.ZoomControlStyle.Default } }; if(!$("#gmap").length) return false; var map = new google.maps.Map(document.getElementById("gmap"), options); /*changed*/ var CustomControls = function (map, div) { var control = this; var controlsDiv = div; var styleControl = function(button){ button.style.width = "40px"; button.style.height = "60px"; button.style.cursor = "pointer"; button.style.marginRight = "10px"; button.style.marginTop = "20px"; button.style.styleFloat = "left"; button.style.cssFloat = "left"; }; /* Statiol */ var cStatoil = document.createElement("div"); styleControl(cStatoil); var cStatoilImg = new Image(); cStatoilImg.src = "CMS/img/gmap/marker.statoil.png"; cStatoilImg.width = 40; cStatoilImg.height = 66; cStatoil.appendChild(cStatoilImg); controlsDiv.appendChild(cStatoil); google.maps.event.addDomListener(cStatoil, 'click', function() { control.sort('statoil'); }); /** * 1-2-3 */ var cOTT = document.createElement("div"); styleControl(cOTT); var cOTTImg = new Image(); cOTTImg.src = "CMS/img/gmap/marker.1-2-3.png"; cOTTImg.width = 40; cOTTImg.height = 66; cOTT.appendChild(cOTTImg); controlsDiv.appendChild(cOTT); google.maps.event.addDomListener(cOTT, 'click', function() { control.sort('one-two-three'); }); /** * Truck diesel */ var cTruck = document.createElement("div"); styleControl(cTruck); var cTruckImg = new Image(); cTruckImg.src = "CMS/img/gmap/marker.truckdiesel.png"; cTruckImg.width = 40; cTruckImg.height = 66; cTruck.appendChild(cTruckImg); controlsDiv.appendChild(cTruck); google.maps.event.addDomListener(cTruck, 'click', function() { control.sort('truck'); }); }; CustomControls.prototype.sort = function (type) { console.log(type); // Sort markers here }; var customControlsDiv = document.createElement('div'); customControlsDiv.index = 1; var customControls = new CustomControls(map, customControlsDiv); map.controls[google.maps.ControlPosition.TOP_LEFT].push(customControlsDiv); /* Markers */ var markers_level0 = []; var markers_level1 = []; var initMarkers = function(map){ var image_shadow = new google.maps.MarkerImage(params.shadowUrl, new google.maps.Size(67, 52), new google.maps.Point(0,0), new google.maps.Point(-18, 50) ); $.getJSON('CMS/js/c/stations/stations.json',function(data,textStatus, jqXHR){ if(data.length){ $.each(data,function(index,value){ var $e = $(this); var level0_id = index; var latlng = new google.maps.LatLng($e[0].location[0],$e[0].location[1]); var image = new google.maps.MarkerImage($e[0].icon, new google.maps.Size(40, 66), new google.maps.Point(0,0), new google.maps.Point(0, 66) ); var marker = new google.maps.Marker({ position: latlng, map: map, icon: image, shadow: image_shadow, shape: 'poly', title: $e.name }); google.maps.event.addListener(marker, 'click', function() { hideMarkers(map,markers_level0); setMarkers(map,markers_level1); map.setZoom(6); map.setCenter(marker.getPosition()); }); markers_level0.push(marker); if($e[0].childrens.length){ $.each($e[0].childrens,function(index,value){ var $e = $(this); var level1_id = index; var latlng = new google.maps.LatLng($e[0].location[0],$e[0].location[1]); var image = new google.maps.MarkerImage($e[0].icon, new google.maps.Size(40, 66), new google.maps.Point(0,0), new google.maps.Point(0, 66) ); var marker = new google.maps.Marker({ position: latlng, map: map, icon: image, shadow: image_shadow, shape: 'poly', title: $e.name, animation: google.maps.Animation.DROP }); google.maps.event.addListener(marker, 'click', function() { getMarkerInfo(map,marker,level0_id,level1_id); }) markers_level1.push(marker); }); hideMarkers(map,markers_level1); } }); } setMarkers(map,markers_level0); }); }; var setMarkers = function(map,markers){ if(markers.length){ for (i in markers){ markers[i].setMap(map); } } }; var hideMarkers = function(map, markers){ if(markers.length){ for (i in markers) { markers[i].setMap(null); } } }; var getMarkerInfo = function(map,marker,level0,level1){ $.getJSON('CMS/js/c/stations/stations.json',function(data,textStatus, jqXHR){ $.get('CMS/js/c/stations/station.mustache',function(template){ var markerHtml = $.mustache(template,data[level0]['childrens'][level1]); var options = { content: markerHtml, disableAutoPan: false, maxWidth: 0, alignBottom: true, pixelOffset: new google.maps.Size(-222, 0), zIndex: 99, boxClass: "gmap-infowindow", infoBoxClearance: new google.maps.Size(1, 1), isHidden: false, pane: "floatPane", enableEventPropagation: true, closeBoxURL: "" }; var infobox = new InfoBox(options); infobox.open(map, marker); map.setCenter(marker.getPosition()); marker.setVisible(false); $("#gmap .close").live('click',function(){ infobox.close(); marker.setVisible(true); return false; }); }); }); }; initMarkers(map); google.maps.event.addListener(map, 'zoom_changed', function() { var zoomLevel = map.getZoom(); map.setCenter(latlng); if(zoomLevel <= 5){ hideMarkers(map,markers_level1); setMarkers(map,markers_level0); } else{ hideMarkers(map,markers_level0); setMarkers(map,markers_level1); } }); }, initFormSections: function($trigger, $content,params){ var self = this; var defaults = { activeClass: 'sel', closestElement: 'fieldset', labelElement: 'span', fadeSpeed: 200, openedText: '', closedText: '' }; params = $.extend(defaults, params); if(!$trigger.length || !$content.length) return false; var init = function(){ for(var i=0, count = $trigger.length; i < count ; i ++){ var e = $trigger[i]; var $e = $(e); var $label = $e.find(params.labelElement); if($e.hasClass(params.activeClass)){ $e.closest(params.closestElement).find($content).show(); $label.text($label.data('closeText') || params.closedText); } } }; init(); $trigger.click(function(){ var $e = $(this); var $c = $e.closest(params.closestElement).find($content); var $label = $e.find(params.labelElement); if($e.hasClass(params.activeClass) && $c.is(":visible")){ $e.removeClass(params.activeClass); $c.slideUp(params.fadeSpeed); $label.text($label.data('openText') || params.openedText); } else{ $e.addClass(params.activeClass); $content .not($c) .slideUp(params.fadeSpeed); $c.slideDown(params.fadeSpeed / 2); $trigger .not($e) .removeClass(params.activeClass) .find(params.labelElement) .text(params.openedText); $label.text($label.data('closeText') || params.closedText); } return false; }); }, /** * Peoples */ initPeoples: function($container, $window, $close, $trigger, $content, overlay, _cfg) { var config = $.extend({ animSpeed: 500, activeClass: "sel" }, _cfg); var busy = false; // CHANGED SFR // var json_data = null; // var getjson = function(){ // $.getJSON('CMS/js/c/people/people.json',function(data,textStatus, jqXHR){ // if(data.length) // json_data = data; // }); // }; if(!$container.length) return false; // getjson(); $container.on('click' , 'dt', function(e) { e.preventDefault(); if(busy) { return false; } busy = true; var $this = $(this); var $detail = $this.next(); var $otherShorts = $this.parent().parent().find('dt').not($this); //changed var $otherDetails = $this.parent().parent().find('dd').not($detail); //changed var $visibleDetail = $otherDetails.filter(':visible'); var detailWidth = $visibleDetail.width(); $visibleDetail.animate({ width: 0 }, config.animSpeed, function() { $this.hide(); $otherDetails.hide(); $otherShorts.show(); $detail.width(0); $detail.show(); $detail.animate({ width: detailWidth + 'px' }, config.animSpeed, function() { busy = false; }); }); return false; }); $window.jqm({ overlay: 80, overlayClass: overlay, trigger: $trigger, modal: false, onShow:function(hash){ var offsetTop = $(window).scrollTop(); var winHeight = $(window).height(); var posTop = offsetTop + winHeight * 0.3; hash.w.css({ top: posTop + 'px' }); var uid = $(hash.t).attr("href").split("#")[1]; // Added SFR var divdata = document.getElementById(uid).innerHTML; if(divdata.length){ $(hash.w).find($content).html(divdata); hash.w.show(); } // Modified SFR // if(json_data.length){ // for(var i=0,count = json_data.length; i < count; i++){ // var e = json_data[i]; // if(e.uid == uid){ // $.get('CMS/js/c/people/people.mustache',function(template){ // var output = $.mustache(template,e); // $(hash.w).find($content).html(output); // }); // break; // } // } // hash.w.show(); // } }, onHide:function(hash){ hash.w.hide(); hash.o.remove(); $trigger.removeClass(_cfg.activeClass); } }); $close.live('click',function(){ $window.jqmHide(); return false; }); $trigger.click(function(){ var $e = $(this); $e.addClass(_cfg.activeClass); return false; }); }, /** * Home slideshow */ initHomeSlideshow: function($mask, $items, $controls, $bubbles, params){ var self = this; var defaults = { delaySpeed: 5000, slideSpeed: 500, showFirst: 0, itemClass: 'item', autoPlay: true }; params = $.extend(defaults, params); if(!$mask.length || !$items.length) return false; var counter = params.showFirst; var $item = $("."+params.itemClass,$items); var itemsCount = $item.length - 1; var itemWidth = $item.outerWidth(true); var itemsWidth = itemWidth * (itemsCount + 1); var timer = null; var $bubble = null; var $firstItem = $item.eq(0); var $lastItem = $item.eq(itemsCount); var clearTimer = function() { clearTimeout(timer); timer = null; }; var inittimer = function(refresh){ if(refresh) clearTimeout(timer); var autoAdvance = function () { if(timer) { var current = counter; counter = (counter == itemsCount) ? 0 : counter + 1 ; self.__scrollToItem($mask, $bubble, $controls, $item, counter, current, params.slideSpeed, 'forward'); timer = setTimeout(autoAdvance, params.delaySpeed); } }; timer = setTimeout(autoAdvance, params.delaySpeed); }; var initbubbles = function(){ var htmlData = ''; for(var i = 1, c = itemsCount +1 ; i <= c; i++) htmlData += ''; $bubbles.append(htmlData); $bubble = $("a",$bubbles); var width = parseInt($bubbles.outerWidth()); $bubbles.css({"width": width+"px", "marginLeft":"-"+(width/2)+"px"}); } if(itemsCount <= 0){ $controls.hide(); return false; } initbubbles(); $items.css({width:itemsWidth}); self.__scrollToItem($mask, $bubble, $controls, $item, counter, 0, 0); $bubble.click(function(){ var $e = $(this); var index = $bubble.index($e); var current = counter; counter = index; if (params.autoPlay) { inittimer(true); } self.__scrollToItem($mask, $bubble, $controls, $item, counter, current, params.slideSpeed, 'auto'); return false; }); $controls.click(function(){ var $e = $(this); var direction = ($e.hasClass('prev')) ? -1 : 1; if ($e.hasClass("disabled") == true) { return false; } var current = counter; if(direction == -1){ counter = (counter == 0) ? itemsCount : counter - 1 ; } else{ counter = (counter == itemsCount) ? 0 : counter + 1 ; } if (params.autoPlay) { inittimer(true); } self.__scrollToItem($mask, $bubble, $controls, $item, counter, current, params.slideSpeed, direction == -1 ? 'backward' : 'forward'); return false; }); if (params.autoPlay) { inittimer(); } }, __scrollToItem:function ($mask, $bubble, $controls, $items, targetIndex, currentIndex, speed, direction) { var self = this; var itemCount = $items.length; var lastIndex = itemCount - 1; var $selItem = $items.eq(targetIndex); var itemWidth = $selItem.outerWidth(true); var $selBubble = $bubble.eq(targetIndex); var sliderWidth = (itemCount * itemWidth); var startProcess = function() { $bubble.removeClass("sel"); $selBubble.addClass("sel"); $controls.addClass("disabled"); }; var endProcess = function() { $items.removeClass("sel"); $selItem.addClass("sel"); $controls.removeClass("disabled"); }; var delta = Math.abs(targetIndex - currentIndex); var $masks = $mask.children(); var wrapAround = direction != 'auto'; startProcess(); if (wrapAround && currentIndex == 0 && targetIndex == lastIndex) { //wraparound going backward $masks.css({ left: 0 }); $selItem.css({ position: 'absolute', left: -itemWidth + 'px' }); $masks.animate({ left: itemWidth + 'px' }, speed, function() { $selItem.css({ position: 'relative', right: 'auto', left: 'auto' }); $masks.css({ left: -(itemCount - 1) * itemWidth + 'px' }); endProcess(); }); } else if (wrapAround && currentIndex == lastIndex && targetIndex == 0) { // wraparound going forward $masks.css({ left: -(itemCount - 2) * itemWidth + 'px' }); $selItem.css({ position: 'absolute', right: 0 }); $masks.animate({ left: -(itemCount - 1) * itemWidth + 'px' }, speed, function() { $selItem.css({ position: 'relative', right: 'auto', left: 'auto' }); $masks.css({ left: 0 }); endProcess(); }); } else { // no wraparound $masks.animate({ left: -targetIndex * itemWidth + 'px' }, speed, function() { endProcess(); }); } }, initInputPlaceholders: function() { $(function() { $('input[placeholder], textarea[placeholder]').placeholder(); }); }, /*SFR saveFormState functions removed, not used*/ /** * detects HTML5 features used in a slide * if browser supports said feature, it is displayed and fallback is hidden * otherwise, the HTML5 tag is hidden and the fallback is shown * * per task description only supported HTML5 tag is * and fallback is always the image used as the slide's background image * * @param {string|jQueryObject} selector * @param {Function(this: Element, jQueryObject, jQueryObject)} [callback] function called for each element if the feature is supported - use this to set up any effects needed for the feature */ detectSlideHTML5: function(selector, callback) { $(selector).each(function() { var $el = $(this); var $slide = $el.closest('.item'); switch(true) { case /canvas/i.test(this.nodeName): if(Modernizr.canvas) { $slide.css({ 'background-image': 'none' }); if ($.isFunction(callback)) { callback.call(this, $el, $slide); } $el.show(); } else { $el.hide(); } break; case (typeof $el.data('swf') !== 'undefined'): if(!window.swfobject) { throw "SWFObject not loaded - cannot detect flash."; } var flashVersion = "9.0.115"; if(swfobject.hasFlashPlayerVersion(flashVersion)) { var id = $el.attr('id'); if(!id) { id = 'swf-element-' + ('' + Math.random()).split('.').pop(); $el.attr('id', id); } var swf = $el.data('swf'); var flashVars = $el.data('flashvars') || {}; var params = $.extend({ menu: "false", wmode: "transparent" }, $el.data('params') || {}); var attributes = $el.data('attributes') || {}; swfobject.embedSWF(swf, id, "962", "300", flashVersion, "CMS/js/expressInstall.swf", flashVars, params, attributes, function() { $slide.css({ 'background-image': 'none' }); if ($.isFunction(callback)) { callback.call(this, $el, $slide); } }); } break; default: // what to detect? } }); }, insertCookieIframe: (function() { var getUrlContext = function(url) { var a = document.createElement('a'); a.href = url; var rawContext = [a.protocol, a.host || a.hostname, a.port].join('_'); return rawContext.replace(/[:\.]+/g, '_'); } var cookieFixIsAccepted = function(context) { var cname = 'cookiefix_' + context; return $.cookie(cname); }; var acceptCookieFix = function(context) { var cname = 'cookiefix_' + context; $.cookie(cname, 'accepted', { path: '/', expires: 365 }); }; var browserSupportsIframeCookies = function(context) { var ua = cssua.ua || {}; if(ua.safari && ua.desktop != "windows") { return cookieFixIsAccepted(context); } else { return true; } }; var createIframe= function(src, attributes) { var $iframe = $('