
(function($) {
  $(document).ready(function(){
    $("a.ps_white_black").attr({ href: "#" });
    $("a.ps_black_white").attr({ href: "#" });
    $("a.ps_yellow_blue").attr({ href: "#" });
    $("a.ps_standard").attr({ href: "#" });
    function PSremoveBC(){
      $("body").removeClass("pagestyle_black_white");
      $("body").removeClass("pagestyle_white_black");
      $("body").removeClass("pagestyle_yellow_blue");
      $("body").removeClass("pagestyle_standard");
      $("link.ps_white_black").attr({ rel: "alternate stylesheet" });
      $("link.ps_black_white").attr({ rel: "alternate stylesheet" });
      $("link.ps_yellow_blue").attr({ rel: "alternate stylesheet" });
      $("link.ps_standard").attr({ rel: "alternate stylesheet" });
    };
    function editLink(link_href){
      var ps_val = $("#edit-pagestyle-select").val();
      if (link_href = "standard") {
        $("link.ps_" + pagestyleCurrent).attr({ href: pagestylePath + "/css/style_standard.css" });
      }
      else if (link_href = "current") {
        $("link.ps_" + pagestyleCurrent).attr({ href: pagestylePath + "/css/style_" + pagestyleCurrent + ".css" });
      }
      $("link.ps_" + ps_val).attr({ href: pagestylePath + "/css/style_" + ps_val + ".css" });
    }
    $("a.ps_black_white[href=#]").click(
      function(){
        PSremoveBC();
        editLink(link_href = "current");
        $.cookie('pagestyle', "black_white", { expires: pagestyleCookieExpires, path: pagestyleCookieDomain});
        $("#pagestyle_current").empty();
        $("#pagestyle_current").append(Drupal.t('Black') + '/'+ Drupal.t('White'));
        $("#pagestyle_current").attr({ title: Drupal.t('Current Style') + ": " + Drupal.t('Black') + '/'+ Drupal.t('White')});
        $("body").addClass("pagestyle_black_white");
        return false;
      }
    );
    $("a.ps_white_black[href=#]").click(
    function (){
        PSremoveBC();
        editLink(link_href = "current");
        $.cookie('pagestyle', "white_black", { expires: pagestyleCookieExpires, path: pagestyleCookieDomain});
        $("#pagestyle_current").empty();
        $("#pagestyle_current").append(Drupal.t('White') + '/' + Drupal.t('Black'));
        $("#pagestyle_current").attr({ title: Drupal.t('Current Style') + ": " + Drupal.t('White') + '/'+ Drupal.t('Black')});
        $("body").addClass("pagestyle_white_black");
        return false;
      }
    );
    $("a.ps_yellow_blue[href=#]").click(
      function(){
        PSremoveBC();
        editLink(link_href = "current");
        $.cookie('pagestyle', "yellow_blue", { expires: pagestyleCookieExpires, path: pagestyleCookieDomain});
        $("#pagestyle_current").empty();
        $("#pagestyle_current").append(Drupal.t('Yellow') + '/' + Drupal.t('Blue'));
        $("#pagestyle_current").attr({ title: Drupal.t('Current Style') + ": " + Drupal.t('Yellow') + '/'+ Drupal.t('Blue')});
        $("body").addClass("pagestyle_yellow_blue");
        return false;
      }
    );
    $("a.ps_standard[href=#]").click(
      function(){
        PSremoveBC();
        editLink(link_href = "standard");
        $.cookie('pagestyle', "standard", { expires: pagestyleCookieExpires, path: pagestyleCookieDomain});
        $("#pagestyle_current").empty();
        $("#pagestyle_current").append(Drupal.t('Standard'));
        $("#pagestyle_current").attr({ title: Drupal.t('Current Style') + ": " + Drupal.t('Standard')});
        $("body").addClass("pagestyle_standard");
        return false;
      }
    );
    function pagestyleVals() {
      var ps_val = $("#edit-pagestyle-select").val();
        PSremoveBC();
        editLink(link_href = "standard");
        $.cookie('pagestyle', ps_val, { expires: pagestyleCookieExpires, path: pagestyleCookieDomain});
        $("body").addClass("pagestyle_" + ps_val);
        $("select.pagestyle option:selected").each(function () {
          $("#pagestyle_current").empty();
          $("#pagestyle_current").append( $(this).text() );
          }
        );
        $("body").addClass('pagestyle_' + ps_val);
        $("link.ps_" + ps_val).attr({ rel: "stylesheet" });
    }
    $("#edit-pagestyle-select").change(pagestyleVals);
    $("#edit-pagestyle-submit").hide();
    $("img.ps_rollover").hover(
      function(){
        if($(this).attr("src").indexOf("16_hover") == -1) {
          var newSrc = $(this).attr("src").replace("16.gif","16_hover.gif#hover");
          $(this).attr("src",newSrc);
        }
      },
      function(){
        if($(this).attr("src").indexOf("16_hover.gif#hover") != -1) {
          var oldSrc = $(this).attr("src").replace("16_hover.gif#hover","16.gif");
          $(this).attr("src",oldSrc);
        }
        else if($(this).attr("src").indexOf("16_focus.gif#focus") != -1) {
          var oldSrc = $(this).attr("src").replace("16_focus.gif#focus","16.gif");
          $(this).attr("src",oldSrc);
        }
      }
    );
    $("a.ps_rollover").focus(
      function(){
        var tsIMG = $(this).children("img");
        if($(tsIMG).attr("src").indexOf("16_hover.gif#hover") != -1) {
          var newSrc = $(tsIMG).attr("src").replace("16_hover.gif#hover","16_focus.gif#focus");
          $(tsIMG).attr("src",newSrc);
        }
      }
    );
    function pagestyleFW() {
      var ps_fw_bw = $("#edit-pagestyle-fontweight-black-white").val();
      var ps_fw_wb = $("#edit-pagestyle-fontweight-white-black").val();
      var ps_fw_yb = $("#edit-pagestyle-fontweight-yellow-blue").val();
      var ps_fw_s = $("#edit-pagestyle-fontweight-standard").val();
      $("div.form-item-pagestyle-fontweight-black-white label").css({"font-weight": ps_fw_bw});
      $("div.form-item-pagestyle-fontweight-white-black label").css({"font-weight": ps_fw_wb});
      $("div.form-item-pagestyle-fontweight-yellow-blue label").css({"font-weight": ps_fw_yb});
      $("div.form-item-pagestyle-fontweight-standard label").css({"font-weight": ps_fw_s});
    }
    $("#edit-pagestyle-fontweight-black-white").change(pagestyleFW);
    $("#edit-pagestyle-fontweight-white-black").change(pagestyleFW);
    $("#edit-pagestyle-fontweight-yellow-blue").change(pagestyleFW);
    $("#edit-pagestyle-fontweight-standard").change(pagestyleFW);
  });
})(jQuery);
;
// $Id: jquery.cookie.js,v 1.1 2009/07/01 12:16:48 dries Exp $

/**
 * Cookie plugin 1.0
 *
 * Copyright (c) 2006 Klaus Hartl (stilbuero.de)
 * Dual licensed under the MIT and GPL licenses:
 * http://www.opensource.org/licenses/mit-license.php
 * http://www.gnu.org/licenses/gpl.html
 *
 */
jQuery.cookie=function(b,j,m){if(typeof j!="undefined"){m=m||{};if(j===null){j="";m.expires=-1}var e="";if(m.expires&&(typeof m.expires=="number"||m.expires.toUTCString)){var f;if(typeof m.expires=="number"){f=new Date();f.setTime(f.getTime()+(m.expires*24*60*60*1000))}else{f=m.expires}e="; expires="+f.toUTCString()}var l=m.path?"; path="+(m.path):"";var g=m.domain?"; domain="+(m.domain):"";var a=m.secure?"; secure":"";document.cookie=[b,"=",encodeURIComponent(j),e,l,g,a].join("")}else{var d=null;if(document.cookie&&document.cookie!=""){var k=document.cookie.split(";");for(var h=0;h<k.length;h++){var c=jQuery.trim(k[h]);if(c.substring(0,b.length+1)==(b+"=")){d=decodeURIComponent(c.substring(b.length+1));break}}}return d}};
;
(function ($) {

Drupal.behaviors.shadowbox = {
  attach: function(context, settings) {
    if (settings.shadowbox.auto_enable_all_images == 1) {
      $("a[href$='jpg'], a[href$='png'], a[href$='gif'], a[href$='jpeg'], a[href$='bmp'], a[href$='JPG'], a[href$='PNG'], a[href$='GIF'], a[href$='JPEG'], a[href$='BMP']").each(function() {
        if (settings.shadowbox.auto_gallery == 1) {
          $(this).attr('rel', 'shadowbox[gallery]');
        }
        else {
          $(this).attr('rel', 'shadowbox');
        }
      });
    }
    Shadowbox.setup();
  }
};

})(jQuery);;

/**
 * Cookie plugin
 *
 * Copyright (c) 2006 Klaus Hartl (stilbuero.de)
 * Dual licensed under the MIT and GPL licenses:
 * http://www.opensource.org/licenses/mit-license.php
 * http://www.gnu.org/licenses/gpl.html
 *
 */

/**
 * Create a cookie with the given name and value and other optional parameters.
 *
 * @example $.cookie('the_cookie', 'the_value');
 * @desc Set the value of a cookie.
 * @example $.cookie('the_cookie', 'the_value', { expires: 7, path: '/', domain: 'jquery.com', secure: true });
 * @desc Create a cookie with all available options.
 * @example $.cookie('the_cookie', 'the_value');
 * @desc Create a session cookie.
 * @example $.cookie('the_cookie', null);
 * @desc Delete a cookie by passing null as value. Keep in mind that you have to use the same path and domain
 *       used when the cookie was set.
 *
 * @param String name The name of the cookie.
 * @param String value The value of the cookie.
 * @param Object options An object literal containing key/value pairs to provide optional cookie attributes.
 * @option Number|Date expires Either an integer specifying the expiration date from now on in days or a Date object.
 *                             If a negative value is specified (e.g. a date in the past), the cookie will be deleted.
 *                             If set to null or omitted, the cookie will be a session cookie and will not be retained
 *                             when the the browser exits.
 * @option String path The value of the path atribute of the cookie (default: path of page that created the cookie).
 * @option String domain The value of the domain attribute of the cookie (default: domain of page that created the cookie).
 * @option Boolean secure If true, the secure attribute of the cookie will be set and the cookie transmission will
 *                        require a secure protocol (like HTTPS).
 * @type undefined
 *
 * @name $.cookie
 * @cat Plugins/Cookie
 * @author Klaus Hartl/klaus.hartl@stilbuero.de
 */

/**
 * Get the value of a cookie with the given name.
 *
 * @example $.cookie('the_cookie');
 * @desc Get the value of a cookie.
 *
 * @param String name The name of the cookie.
 * @return The value of the cookie.
 * @type String
 *
 * @name $.cookie
 * @cat Plugins/Cookie
 * @author Klaus Hartl/klaus.hartl@stilbuero.de
 */
(function ($) {
  jQuery.cookie = function(name, value, options) {
    if (typeof value != 'undefined') { // name and value given, set cookie
      options = options || {};
      if (value === null) {
        value = '';
        options.expires = -1;
      }
      var expires = '';
      if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) {
        var date;
        if (typeof options.expires == 'number') {
          date = new Date();
          date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000));
        } else {
          date = options.expires;
        }
        expires = '; expires=' + date.toUTCString(); // use expires attribute, max-age is not supported by IE
      }
      // CAUTION: Needed to parenthesize options.path and options.domain
      // in the following expressions, otherwise they evaluate to undefined
      // in the packed version for some reason...
      var path = options.path ? '; path=' + (options.path) : '';
      var domain = options.domain ? '; domain=' + (options.domain) : '';
      var secure = options.secure ? '; secure' : '';
      document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join('');
    } else { // only name given, get cookie
      var cookieValue = null;
      if (document.cookie && document.cookie != '') {
        var cookies = document.cookie.split(';');
        for (var i = 0; i < cookies.length; i++) {
          var cookie = jQuery.trim(cookies[i]);
          // Does this cookie string begin with the name we want?
          if (cookie.substring(0, name.length + 1) == (name + '=')) {
            cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
            break;
          }
        }
      }
      return cookieValue;
    }
  };
})(jQuery);;

