/**
 * author Remy Sharp
 * url http://remysharp.com/2009/01/26/element-in-view-event-plugin/
 */
(function ($) {
    function getViewportHeight() {
        var height = window.innerHeight; // Safari, Opera
        var mode = document.compatMode;

        if ( (mode || !$.support.boxModel) ) { // IE, Gecko
            height = (mode == 'CSS1Compat') ?
            document.documentElement.clientHeight : // Standards
            document.body.clientHeight; // Quirks
        }

        return height;
    }

    $(window).scroll(function () {
        var vpH = getViewportHeight(),
            scrolltop = (document.documentElement.scrollTop ?
                document.documentElement.scrollTop :
                document.body.scrollTop),
            elems = [];
        
        // naughty, but this is how it knows which elements to check for
        $.each($.cache, function () {
            if (this.events && this.events.inview) {
                elems.push(this.handle.elem);
            }
        });

        if (elems.length) {
            $(elems).each(function () {
                var $el = $(this),
                    top = $el.offset().top,
                    height = $el.height(),
                    inview = $el.data('inview') || false;

                if (scrolltop > (top + height) || scrolltop + vpH < top) {
                    if (inview) {
                        $el.data('inview', false);
                        $el.trigger('inview', [ false ]);                        
                    }
                } else if (scrolltop < (top + height)) {
                    if (!inview) {
                        $el.data('inview', true);
                        $el.trigger('inview', [ true ]);
                    }
                }
            });
        }
    });
    
    // kick the event to pick up any elements already in view.
    // note however, this only works if the plugin is included after the elements are bound to 'inview'
    $(function () {
        $(window).scroll();
    });
})(jQuery);
;
/**
 * jQuery.ScrollTo - Easy element scrolling using jQuery.
 * Copyright (c) 2007-2009 Ariel Flesler - aflesler(at)gmail(dot)com | http://flesler.blogspot.com
 * Dual licensed under MIT and GPL.
 * Date: 5/25/2009
 * @author Ariel Flesler
 * @version 1.4.2
 *
 * http://flesler.blogspot.com/2007/10/jqueryscrollto.html
 */
;(function(d){var k=d.scrollTo=function(a,i,e){d(window).scrollTo(a,i,e)};k.defaults={axis:'xy',duration:parseFloat(d.fn.jquery)>=1.3?0:1};k.window=function(a){return d(window)._scrollable()};d.fn._scrollable=function(){return this.map(function(){var a=this,i=!a.nodeName||d.inArray(a.nodeName.toLowerCase(),['iframe','#document','html','body'])!=-1;if(!i)return a;var e=(a.contentWindow||a).document||a.ownerDocument||a;return d.browser.safari||e.compatMode=='BackCompat'?e.body:e.documentElement})};d.fn.scrollTo=function(n,j,b){if(typeof j=='object'){b=j;j=0}if(typeof b=='function')b={onAfter:b};if(n=='max')n=9e9;b=d.extend({},k.defaults,b);j=j||b.speed||b.duration;b.queue=b.queue&&b.axis.length>1;if(b.queue)j/=2;b.offset=p(b.offset);b.over=p(b.over);return this._scrollable().each(function(){var q=this,r=d(q),f=n,s,g={},u=r.is('html,body');switch(typeof f){case'number':case'string':if(/^([+-]=)?\d+(\.\d+)?(px|%)?$/.test(f)){f=p(f);break}f=d(f,this);case'object':if(f.is||f.style)s=(f=d(f)).offset()}d.each(b.axis.split(''),function(a,i){var e=i=='x'?'Left':'Top',h=e.toLowerCase(),c='scroll'+e,l=q[c],m=k.max(q,i);if(s){g[c]=s[h]+(u?0:l-r.offset()[h]);if(b.margin){g[c]-=parseInt(f.css('margin'+e))||0;g[c]-=parseInt(f.css('border'+e+'Width'))||0}g[c]+=b.offset[h]||0;if(b.over[h])g[c]+=f[i=='x'?'width':'height']()*b.over[h]}else{var o=f[h];g[c]=o.slice&&o.slice(-1)=='%'?parseFloat(o)/100*m:o}if(/^\d+$/.test(g[c]))g[c]=g[c]<=0?0:Math.min(g[c],m);if(!a&&b.queue){if(l!=g[c])t(b.onAfterFirst);delete g[c]}});t(b.onAfter);function t(a){r.animate(g,j,b.easing,a&&function(){a.call(this,n,b)})}}).end()};k.max=function(a,i){var e=i=='x'?'Width':'Height',h='scroll'+e;if(!d(a).is('html,body'))return a[h]-d(a)[e.toLowerCase()]();var c='client'+e,l=a.ownerDocument.documentElement,m=a.ownerDocument.body;return Math.max(l[h],m[h])-Math.min(l[c],m[c])};function p(a){return typeof a=='object'?a:{top:a,left:a}}})(jQuery);;
/**
 * jquery.about.min.js
 *
 * Created by Roland Carney
 * Copyright (c) Web Assistant
 */
(function($){Drupal.behaviors.aboutUs={attach:function(context,settings){var buttonStatus=true;var inViewCount=0;var $mask=$("#mask");var $menu=$("#menu");var $textBoxes=$("> li",$mask);var $menuLinks=$("a",$menu);var $allLayers=$("#box .layer");var $ly1=$('#p12layer1');var $ly2=$('#p12layer2');var $ly3=$('#p12layer3');var $ly4=$('#p12layer4');var $ly5=$('#p12layer5');var $ly6=$('#p12layer6');var $ly7=$('#p12layer7');var $ly8=$('#p12layer8');var $ly9=$('#p12layer9');var sp=2000;var maxCy=$textBoxes.length;var activeLayer=1;$allLayers.hide();$("#sub-about, #sub-contact").click(function(e){if(buttonStatus==true){inViewCount=0;$allLayers.hide();$menu.hide();$textBoxes.hide();$.scrollTo("#block-wa-webass-about-us-scene",1200,function(){$.scrollTo('-=50px',500)})}buttonStatus=false});if(window.location.hash&&(window.location.hash=='#about-us'||window.location.hash=='#contact-us')){$.scrollTo("#block-wa-webass-about-us-scene",1800,function(){$.scrollTo('-=50px',700)})}$('#inview-marker').bind('inview',function(event,visible){if(visible==true&&inViewCount==0){sceneStart();inViewCount++}});$menuLinks.click(function(e){e.preventDefault();if(buttonStatus==true){if($(this).attr('id')=='bt-for'){activeLayer++;scrollLayer(activeLayer)}else if($(this).attr('id')=='bt-back'){activeLayer--;scrollLayer(activeLayer)}else if($(this).attr('id')=='bt-start'){scrollLayer('reset')}}buttonStatus=false;$menuLinks.addClass('disabled')});function sceneStart(){if(window.location.hash&&window.location.hash=='#contact-us'){n=6;$textBoxes.hide();$ly7.show().scrollTo('0px',0);$ly8.show().scrollTo('0px',0);$ly9.show().scrollTo('0px',0);$ly7.scrollTo('2000px',sp);$ly8.scrollTo('1700px',sp);$ly9.scrollTo('1450px',sp,function(){$("#box"+n).fadeIn();buttonStatus=true})}else{activeLayer=1;$ly1.fadeIn().scrollTo('0px',0);$ly2.fadeIn().scrollTo('0px',0);$ly3.fadeIn().scrollTo('0px',0);$ly4.show().scrollTo('0px',0);$ly5.show().scrollTo('0px',0);$ly6.show().scrollTo('0px',0);$ly7.show().scrollTo('0px',0);$ly8.show().scrollTo('0px',0);$ly9.show().scrollTo('0px',0);$allLayers.fadeIn(1200);scrollLayer(activeLayer)}}function scrollLayer(n){$menu.fadeIn(1000);$("li a",$menu).fadeOut(200);$textBoxes.fadeOut(200);switch(n){case'reset':activeLayer=1;$ly1.scrollTo('0px',2100);$ly2.scrollTo('0px',2000);$ly3.scrollTo('0px',1900,function(){$("#box1").fadeIn();$("li a:not('#bt-back, #bt-start')",$menu).removeClass('disabled').fadeIn();buttonStatus=true});$ly4.scrollTo('0px',1700);$ly5.scrollTo('0px',1600);$ly6.scrollTo('0px',1500);$ly7.scrollTo('0px',1300);$ly8.scrollTo('0px',1200);$ly9.scrollTo('0px',1100);break;case 1:$ly1.scrollTo('0px',sp);$ly2.scrollTo('0px',sp);$ly3.scrollTo('0px',sp,function(){$("#box"+n).fadeIn();$("li a:not('#bt-back, #bt-start')",$menu).removeClass('disabled').fadeIn();buttonStatus=true});$ly4.scrollTo('0px',sp);$ly5.scrollTo('0px',sp);$ly6.scrollTo('0px',sp);$ly7.scrollTo('0px',sp);$ly8.scrollTo('0px',sp);$ly9.scrollTo('0px',sp);break;case 2:$ly1.scrollTo('1150px',sp);$ly2.scrollTo('920px',sp,function(){$("#box"+n).fadeIn();$("li a",$menu).removeClass('disabled').fadeIn();buttonStatus=true});$ly3.scrollTo('700px',sp);$ly4.scrollTo('0px',sp);$ly5.scrollTo('0px',sp);$ly6.scrollTo('0px',sp);break;case 3:$ly1.scrollTo('2200px',sp);$ly2.scrollTo('1800px',sp,function(){$("#box"+n).fadeIn();$("li a",$menu).removeClass('disabled').fadeIn();buttonStatus=true});$ly3.scrollTo('1350px',sp);$ly4.scrollTo('1100px',sp);$ly5.scrollTo('950px',sp);$ly6.scrollTo('800px',sp);break;case 4:$ly2.scrollTo('2600px',sp);$ly3.scrollTo('1900px',sp,function(){$("#box"+n).fadeIn();$("li a",$menu).removeClass('disabled').fadeIn();buttonStatus=true});$ly4.scrollTo('2100px',sp);$ly5.scrollTo('1800px',sp);$ly6.scrollTo('1500px',sp);$ly7.scrollTo('0px',sp);$ly8.scrollTo('0px',sp);$ly9.scrollTo('0px',sp);break;case 5:$ly4.scrollTo('3280px',sp);$ly5.scrollTo('2850px',sp,function(){$("#box"+n).fadeIn();$("li a",$menu).removeClass('disabled').fadeIn();buttonStatus=true});$ly6.scrollTo('2350px',sp);$ly7.scrollTo('1100px',sp);$ly8.scrollTo('950px',sp);$ly9.scrollTo('850px',sp);break;case 6:$ly6.scrollTo('3050px',sp,function(){$("#box"+n).fadeIn();$("li a:not('#bt-for')",$menu).removeClass('disabled').fadeIn();buttonStatus=true});$ly7.scrollTo('2000px',sp);$ly8.scrollTo('1700px',sp);$ly9.scrollTo('1450px',sp);break}}}}})(jQuery);;
(function ($) {

$(document).ready(function() {

  // Accepts a string; returns the string with regex metacharacters escaped. The returned string
  // can safely be used at any point within a regex to match the provided literal string. Escaped
  // characters are [ ] { } ( ) * + ? - . , \ ^ $ # and whitespace. The character | is excluded
  // in this function as it's used to separate the domains names.
  RegExp.escapeDomains = function(text) {
    return (text) ? text.replace(/[-[\]{}()*+?.,\\^$#\s]/g, "\\$&") : '';
  }

  // Attach onclick event to document only and catch clicks on all elements.
  $(document.body).click(function(event) {
    // Catch the closest surrounding link of a clicked element.
    $(event.target).closest("a,area").each(function() {

      var ga = Drupal.settings.googleanalytics;
      // Expression to check for absolute internal links.
      var isInternal = new RegExp("^(https?):\/\/" + window.location.host, "i");
      // Expression to check for special links like gotwo.module /go/* links.
      var isInternalSpecial = new RegExp("(\/go\/.*)$", "i");
      // Expression to check for download links.
      var isDownload = new RegExp("\\.(" + ga.trackDownloadExtensions + ")$", "i");
      // Expression to check for the sites cross domains.
      var isCrossDomain = new RegExp("^(https?|ftp|news|nntp|telnet|irc|ssh|sftp|webcal):\/\/.*(" + RegExp.escapeDomains(ga.trackCrossDomains) + ")", "i");

      // Is the clicked URL internal?
      if (isInternal.test(this.href)) {
        // Is download tracking activated and the file extension configured for download tracking?
        if (ga.trackDownload && isDownload.test(this.href)) {
          // Download link clicked.
          var extension = isDownload.exec(this.href);
          _gaq.push(["_trackEvent", "Downloads", extension[1].toUpperCase(), this.href.replace(isInternal, '')]);
        }
        else if (isInternalSpecial.test(this.href)) {
          // Keep the internal URL for Google Analytics website overlay intact.
          _gaq.push(["_trackPageview", this.href.replace(isInternal, '')]);
        }
      }
      else {
        if (ga.trackMailto && $(this).is("a[href^=mailto:],area[href^=mailto:]")) {
          // Mailto link clicked.
          _gaq.push(["_trackEvent", "Mails", "Click", this.href.substring(7)]);
        }
        else if (ga.trackOutbound && this.href) {
          if (ga.trackDomainMode == 2 && isCrossDomain.test(this.href)) {
            // Top-level cross domain clicked. document.location is handled by _link internally.
            _gaq.push(["_link", this.href]);
          }
          else if (ga.trackOutboundAsPageview) {
            // Track all external links as page views after URL cleanup.
            // Currently required, if click should be tracked as goal.
            _gaq.push(["_trackPageview", '/outbound/' + this.href.replace(/^(https?|ftp|news|nntp|telnet|irc|ssh|sftp|webcal):\/\//i, '').split('/').join('--')]);
          }
          else {
            // External link clicked.
            _gaq.push(["_trackEvent", "Outbound links", "Click", this.href]);
          }
        }
      }
    });
  });
});

})(jQuery);
;

