(function ($) {

$(function() {
  var googleCSEWatermark = function(id) {
    var f = $(id)[0];
    if (f && (f.query || f['edit-search-block-form--2'] || f['edit-keys'])) {
      var q = f.query ? f.query : (f['edit-search-block-form--2'] ? f['edit-search-block-form--2'] : f['edit-keys']);
      var n = navigator;
      var l = location;
      if (n.platform == 'Win32') {
        q.style.cssText = 'border: 1px solid #7e9db9; padding: 2px;';
      }
      var b = function() {
        if (q.value == '') {
          q.style.background = '#FFFFFF url(https://www.google.com/cse/intl/' + Drupal.settings.googleCSE.language + '/images/google_custom_search_watermark.gif) left no-repeat';
        }
      };
      var f = function() {
        q.style.background = '#ffffff';
      };
      q.onfocus = f;
      q.onblur = b;
//      if (!/[&?]query=[^&]/.test(l.search)) {
        b();
//      }
    }
  };
  googleCSEWatermark('#search-block-form.google-cse');
  googleCSEWatermark('#search-form.google-cse');
  googleCSEWatermark('#google-cse-results-searchbox-form');
});

})(jQuery);
;
/**
 *
 */
(function ($) {

  Drupal.behaviors.styleswitcher = {
    attach: function (context, setings) {

      $('.style-switcher', context).click(function() {
        this.blur();

        var title = $(this).attr('data-rel');
        Drupal.styleSwitcher.switchStyle(title);
        // Remove the fader
        /*
        // var overlay = Drupal.styleSwitcher.buildOverlay();

        overlay.fadeIn('slow', function() {
          overlay.fadeOut('slow', Drupal.styleSwitcher.killOverlay);
        });
        */
        return false;
      });

      /**
       * Style Switcher class
       */
      Drupal.styleSwitcher = {
        /**
         * Main workhorse of the class.  Given the title of a stylesheet, do the switch
         */
        switchStyle: function(title) {
          $('link[@data-rel*=style][@rel*=alt][title]').each(function(i) {
            this.disabled = 'TRUE';
            this.disabled = !($(this).attr('title') == title);
          });

          $.cookie('styleSwitcher', title);
        },

        /**
         * Set the style to either the last selected by the user or the default. This
         * function can safely be called outside of a ready() event, so long as it 
         * takes place after the declaration of the alternate stylesheets and the
         * declaration of the Drupal.settings object.
         */
        defaultStyle: function() {
          var d = $.cookie('styleSwitcher') || Drupal.settings.styleSwitcher.defaultStyle;
          Drupal.styleSwitcher.switchStyle(d);
        },

        /**
         * Build the overlay for transitions
         */
        buildOverlay: function() {
          var overlay = $('<div>')
            .attr('id', 'style-switcher-overlay')
            .appendTo($('body'))
            .hide()
            .css(
              {
                height:     '100%',
                width:      '100%',
                background: '#000000',
                position:   'absolute',
                top:        $(window).scrollTop(),
                left:       $(window).scrollLeft(),
                zIndex:     9999
              }
            );
          return overlay;
        },

        /**
         * Remove the overlay
         */
        killOverlay: function() {
          $('#style-switcher-overlay').remove();
        }


        }
      }

  };

}(jQuery));
;

