/*
 *  Easy Slider 1.7 - jQuery plugin
 *  written by Alen Grakalic  
 *  http://cssglobe.com/post/4004/easy-slider-15-the-easiest-jquery-plugin-for-sliding
 *
 *  Copyright (c) 2009 Alen Grakalic (http://cssglobe.com)
 *  Dual licensed under the MIT (MIT-LICENSE.txt)
 *  and GPL (GPL-LICENSE.txt) licenses.
 *
 *  Built for jQuery library
 *  http://jquery.com
 *
 */
 
/*
 *  markup example for $("#slider").easySlider();
 *  
 *  <div id="slider">
 *    <ul>
 *      <li><img src="images/01.jpg" alt="" /></li>
 *      <li><img src="images/02.jpg" alt="" /></li>
 *      <li><img src="images/03.jpg" alt="" /></li>
 *      <li><img src="images/04.jpg" alt="" /></li>
 *      <li><img src="images/05.jpg" alt="" /></li>
 *    </ul>
 *  </div>
 *
 */

(function($) {

  $.fn.easySlider = function(options){
    
    // default configuration properties
    var defaults = {      
      prevId:     'prevBtn',
      prevText:     'Previous',
      nextId:     'nextBtn',  
      nextText:     'Next',
      controlsShow: true,
      controlsBefore: '<ul id="hp-related-nav">',
      controlsAfter:  '</ul>',  
      controlsFade: true,
      firstId:    'firstBtn',
      firstText:    'First',
      firstShow:    false,
      lastId:     'lastBtn',  
      lastText:     'Last',
      lastShow:   false,        
      vertical:   false,
      speed:      500,
      auto:     true,
      pause:      50000,
      continuous:   true, 
      numeric:    true,
      numericId:    'hp-related-pagelist'
    }; 
    
    var options = $.extend(defaults, options);  
        
    this.each(function() {  
      var obj = $(this);        
      var s = $("li", obj).length;
      var w = $("li", obj).width(); 
      var h = $("li", obj).height(); 
      var clickable = true;
      obj.width(w); 
      obj.height(h); 
      obj.css("overflow","hidden");
      var ts = s-1;
      var t = 0;
      $("ul", obj).css('width',s*w);      
      
      if(options.continuous){
        $("ul", obj).prepend($("ul li:last-child", obj).clone().css("margin-left","-"+ w +"px"));
        $("ul", obj).append($("ul li:nth-child(2)", obj).clone());
        $("ul", obj).css('width',(s+1)*w);
      };        
      
      if(!options.vertical) $("li", obj).css('float','left');
                
      if(options.controlsShow){
        var html = options.controlsBefore;        
        html += ' <li id="'+ options.prevId +'"><a href=\"javascript:void(0);\">'+ options.prevText +'</a></li>';
        html += '<ol id="'+ options.numericId +'"></ol>';
        html += ' <li id="'+ options.nextId +'"><a href=\"javascript:void(0);\">'+ options.nextText +'</a></li>';       
        html += options.controlsAfter;            
        $('#hp-related-header').append(html)
      };
      
      if(options.numeric){                  
        for(var i=0;i<s;i++){           
          $(document.createElement("li"))
            .attr('id',options.numericId + (i+1))
            .html('<a rel='+ i +' href=\"javascript:void(0);\">'+ (i+1) +'</a>')
            .appendTo($("#"+ options.numericId))
            .click(function(){              
              animate($("a",$(this)).attr('rel'),true);
            });                         
        };              
      //} else {
        $("a","#"+options.nextId).click(function(){   
          animate("next",true);
        });
        $("a","#"+options.prevId).click(function(){   
          animate("prev",true);       
        }); 
        $("a","#"+options.firstId).click(function(){    
          animate("first",true);
        });       
        $("a","#"+options.lastId).click(function(){   
          animate("last",true);       
        });       
      };
      
      function setCurrent(i){
        i = parseInt(i)+1;
        $("li", "#" + options.numericId).removeClass("current");
        $("li#" + options.numericId + i).addClass("current");
      };
      
      function adjust(){
        if(t>ts) t=0;   
        if(t<0) t=ts; 
        if(!options.vertical) {
          $("ul",obj).css("margin-left",(t*w*-1));
        } else {
          $("ul",obj).css("margin-left",(t*h*-1));
        }
        clickable = true;
        if(options.numeric) setCurrent(t);
      };
      
      function animate(dir,clicked){
        if (clickable){
          clickable = false;
          var ot = t;
// Using numeral as well as back,forward makes int behave as string for some reason - so forcing int  
          t = parseInt(t);
          switch(dir){
            case "next":
              t = (ot>=ts) ? (options.continuous ? t+1 : ts) : t+1; 
              break; 
            case "prev":
              t = (t<=0) ? (options.continuous ? t-1 : 0) : t-1;
              break; 
            case "first":
              t = 0;
              break; 
            case "last":
              t = ts;
              break; 
            default:
              t = dir;
              break; 
          };  
          var diff = Math.abs(ot-t);
          var speed = diff*options.speed;           
          p = (t*w*-1);
// Custom resize code ck 3.2.10
                                        t = parseInt(t);
                                        $('#hp-related-body').animate(
            { height: $("li:eq(" + (t+1) + ")", obj).height() }
          );
//End resize

          $("ul",obj).animate(
            { marginLeft: p }, 
            { queue:false, duration:speed, complete:adjust }
          );
        
          
          if(!options.continuous && options.controlsFade){          
            if(t==ts){
              $("a","#"+options.nextId).fadeTo('0.4');
              $("a","#"+options.lastId).fadeTo('0.4');
            } else {
              $("a","#"+options.nextId).show('fast');
              $("a","#"+options.lastId).show('fast');         
            };
            if(t==0){
              $("a","#"+options.prevId).fadeTo('0.4');
              $("a","#"+options.firstId).fadeTo('0.4');
            } else {
              $("a","#"+options.prevId).show('fast');
              $("a","#"+options.firstId).show('fast');
            };          
          };        
          
          if(clicked) clearTimeout(timeout);
          if(options.auto && dir=="next" && !clicked){;
            timeout = setTimeout(function(){
              animate("next",false);
            },diff*options.speed+options.pause);
          };
      
        };
        
      };
      // init
      var timeout;
      if(options.auto){;
        timeout = setTimeout(function(){
          animate("next",false);
        },options.pause);
      };    
      
      if(options.numeric) setCurrent(0);
    
      if(!options.continuous && options.controlsFade){          
        $("a","#"+options.prevId).fadeTo('0.4');
        $("a","#"+options.firstId).fadeTo('0.4');       
      };        
      
    });
    
  };

})(jQuery);



// ColorBox v1.3.6 - a full featured, light-weight, customizable lightbox based on jQuery 1.3
// c) 2009 Jack Moore - www.colorpowered.com - jack@colorpowered.com
// Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php

(function ($) {
  // Shortcuts (to increase compression)
  var colorbox = 'colorbox',
  hover = 'hover',
  TRUE = true,
  FALSE = false,
  cboxPublic,
  isIE = !$.support.opacity,
  isIE6 = isIE && !window.XMLHttpRequest,

  // Event Strings (to increase compression)
  cbox_open = 'cbox_open',
  cbox_load = 'cbox_load',
  cbox_complete = 'cbox_complete',
  cbox_cleanup = 'cbox_cleanup',
  cbox_closed = 'cbox_closed',
  cbox_resize = 'resize.cbox_resize',

  // Cached jQuery Object Variables
  $overlay,
  $cbox,
  $wrap,
  $content,
  $topBorder,
  $leftBorder,
  $rightBorder,
  $bottomBorder,
  $related,
  $window,
  $loaded,
  $loadingBay,
  $loadingOverlay,
  $loadingGraphic,
  $title,
  $current,
  $slideshow,
  $next,
  $prev,
  $close,

  // Variables for cached values or use across multiple functions
  interfaceHeight,
  interfaceWidth,
  loadedHeight,
  loadedWidth,
  element,
  bookmark,
  index,
  settings,
  open,
  active,
  
  // ColorBox Default Settings. 
  // See http://colorpowered.com/colorbox for details.
  defaults = {
    transition: "elastic",
    speed: 350,
    width: FALSE,
    height: FALSE,
    innerWidth: FALSE,
    innerHeight: FALSE,
    initialWidth: "400",
    initialHeight: "400",
    maxWidth: FALSE,
    maxHeight: FALSE,
    scalePhotos: TRUE,
    scrolling: TRUE,
    inline: FALSE,
    html: FALSE,
    iframe: FALSE,
    photo: FALSE,
    href: FALSE,
    title: FALSE,
    rel: FALSE,
    opacity: 0.9,
    preloading: TRUE,
    current: "image {current} of {total}",
    previous: "previous",
    next: "next",
    close: "close",
    open: FALSE,
    overlayClose: TRUE,
    
    slideshow: FALSE,
    slideshowAuto: TRUE,
    slideshowSpeed: 2500,
    slideshowStart: "start slideshow",
    slideshowStop: "stop slideshow",
    
    onOpen: FALSE,
    onLoad: FALSE,
    onComplete: FALSE,
    onCleanup: FALSE,
    onClosed: FALSE
  };
  
  // ****************
  // HELPER FUNCTIONS
  // ****************
    
  // Convert % values to pixels
  function setSize(size, dimension) {
    dimension = dimension === 'x' ? $window.width() : $window.height();//document.documentElement.clientWidth : document.documentElement.clientHeight;
    return (typeof size === 'string') ? Math.round((size.match(/%/) ? (dimension / 100) * parseInt(size, 10) : parseInt(size, 10))) : size;
  }

  // Checks an href to see if it is a photo.
  // There is a force photo option (photo: true) for hrefs that cannot be matched by this regex.
  function isImage(url) {
    url = $.isFunction(url) ? url.call(element) : url;
    return settings.photo || url.match(/\.(gif|png|jpg|jpeg|bmp)(?:\?([^#]*))?(?:#(\.*))?$/i);
  }
  
  // Assigns functions results to their respective settings.  This allows functions to be used to set ColorBox options.
  function process() {
    for (var i in settings) {
      if ($.isFunction(settings[i]) && i.substring(0, 2) !== 'on') { // checks to make sure the function isn't one of the callbacks, they will be handled at the appropriate time.
          settings[i] = settings[i].call(element);
      }
    }
    settings.rel = settings.rel || element.rel;
    settings.href = settings.href || element.href;
    settings.title = settings.title || element.title;
  }

  function launch(elem) {
    
    element = elem;
    
    settings = $(element).data(colorbox);
    
    process(); // Convert functions to their returned values.
    
    if (settings.rel && settings.rel !== 'nofollow') {
      $related = $('.cboxElement').filter(function () {
        var relRelated = $(this).data(colorbox).rel || this.rel;
        return (relRelated === settings.rel);
      });
      index = $related.index(element);
      
      // Check direct calls to ColorBox.
      if (index < 0) {
        $related = $related.add(element);
        index = $related.length - 1;
      }
    } else {
      $related = $(element);
      index = 0;
    }
    
    if (!open) {
      open = TRUE;
      
      active = TRUE; // Prevents the page-change action from queuing up if the visitor holds down the left or right keys.
      
      bookmark = element;
      
      bookmark.blur(); // Remove the focus from the calling element.
      
      // Set Navigation Key Bindings
      $(document).bind("keydown.cbox_close", function (e) {
        if (e.keyCode === 27) {
          e.preventDefault();
          cboxPublic.close();
        }
      }).bind("keydown.cbox_arrows", function (e) {
        if ($related.length > 1) {
          if (e.keyCode === 37) {
            e.preventDefault();
            $prev.click();
          } else if (e.keyCode === 39) {
            e.preventDefault();
            $next.click();
          }
        }
      });
      
      if (settings.overlayClose) {
        $overlay.css({"cursor": "pointer"}).one('click', cboxPublic.close);
      }
      
      $.event.trigger(cbox_open);
      if (settings.onOpen) {
        settings.onOpen.call(element);
      }
      
      $overlay.css({"opacity": settings.opacity}).show();
      
      // Opens inital empty ColorBox prior to content being loaded.
      settings.w = setSize(settings.initialWidth, 'x');
      settings.h = setSize(settings.initialHeight, 'y');
      cboxPublic.position(0);
      
      if (isIE6) {
        $window.bind('resize.cboxie6 scroll.cboxie6', function () {
          $overlay.css({width: $window.width(), height: $window.height(), top: $window.scrollTop(), left: $window.scrollLeft()});
        }).trigger("scroll.cboxie6");
      }
    }
    
    $current.add($prev).add($next).add($slideshow).add($title).hide();
    
    $close.html(settings.close).show();
    
    cboxPublic.slideshow();
    
    cboxPublic.load();
  }

  // ****************
  // PUBLIC FUNCTIONS
  // Usage format: $.fn.colorbox.close();
  // Usage from within an iframe: parent.$.fn.colorbox.close();
  // ****************
  
  cboxPublic = $.fn.colorbox = function (options, callback) {
    var $this = this;
    
    if (!$this.length) {
      if ($this.selector === '') { // empty selector means a direct call, ie: $.fn.colorbox();
        $this = $('<a/>');
        options.open = TRUE;
      } else { // else the selector didn't match anything, and colorbox should go ahead and return.
        return this;
      }
    }
    
    $this.each(function () {
      var data = $.extend({}, $(this).data(colorbox) ? $(this).data(colorbox) : defaults, options);
      
      $(this).data(colorbox, data).addClass("cboxElement");
      
      if (callback) {
        $(this).data(colorbox).onComplete = callback;
      }
    });
    
    if (options && options.open) {
      launch($this);
    }
    
    return this;
  };

  // Initialize ColorBox: store common calculations, preload the interface graphics, append the html.
  // This preps colorbox for a speedy open when clicked, and lightens the burdon on the browser by only
  // having to run once, instead of each time colorbox is opened.
  cboxPublic.init = function () {
    
    // jQuery object generator to save a bit of space
    function $div(id) {
      return $('<div id="cbox' + id + '"/>');
    }
    
    // Create & Append jQuery Objects
    $window = $(window);
    $cbox = $('<div id="colorbox"/>');
    $overlay = $div("Overlay").hide();
    $wrap = $div("Wrapper");
    $content = $div("Content").append(
      $loaded = $div("LoadedContent").css({width: 0, height: 0}),
      $loadingOverlay = $div("LoadingOverlay"),
      $loadingGraphic = $div("LoadingGraphic"),
      $title = $div("Title"),
      $current = $div("Current"),
      $slideshow = $div("Slideshow"),
      $next = $div("Next"),
      $prev = $div("Previous"),
      $close = $div("Close")
    );
    $wrap.append( // The 3x3 Grid that makes up ColorBox
      $('<div/>').append(
        $div("TopLeft"),
        $topBorder = $div("TopCenter"),
        $div("TopRight")
      ),
      $('<div/>').append(
        $leftBorder = $div("MiddleLeft"),
        $content,
        $rightBorder = $div("MiddleRight")
      ),
      $('<div/>').append(
        $div("BottomLeft"),
        $bottomBorder = $div("BottomCenter"),
        $div("BottomRight")
      )
    ).children().children().css({'float': 'left'});
    
    $loadingBay = $("<div style='position:absolute; top:0; left:0; width:9999px; height:0;'/>");
    
    $('body').prepend($overlay, $cbox.append($wrap, $loadingBay));
        
    if (isIE) {
      $cbox.addClass('cboxIE');
      if (isIE6) {
        $overlay.css('position', 'absolute');
      }
    }
    
    // Add rollover event to navigation elements
    $content.children()
    .bind('mouseover mouseout', function(){
      $(this).toggleClass(hover);
    }).addClass(hover);
    
    // Cache values needed for size calculations
    interfaceHeight = $topBorder.height() + $bottomBorder.height() + $content.outerHeight(TRUE) - $content.height();//Subtraction needed for IE6
    interfaceWidth = $leftBorder.width() + $rightBorder.width() + $content.outerWidth(TRUE) - $content.width();
    loadedHeight = $loaded.outerHeight(TRUE);
    loadedWidth = $loaded.outerWidth(TRUE);
    
    // Setting padding to remove the need to do size conversions during the animation step.
    $cbox.css({"padding-bottom": interfaceHeight, "padding-right": interfaceWidth}).hide();
    
    // Setup button & key events.
    $next.click(cboxPublic.next);
    $prev.click(cboxPublic.prev);
    $close.click(cboxPublic.close);
    
    // Adding the 'hover' class allowed the browser to load the hover-state
    // background graphics.  The class can now can be removed.
    $content.children().removeClass(hover);
    
    $('.cboxElement').live('click', function (e) {
      if (e.button !== 0 && typeof e.button !== 'undefined') {// checks to see if it was a non-left mouse-click.
        return TRUE;
      } else {
        launch(this);     
        return FALSE;
      }
    });
  };

  cboxPublic.position = function (speed, loadedCallback) {
    var
    animate_speed,
    winHeight = $window.height(),
    // keeps the top and left positions within the browser's viewport.
    posTop = Math.max(winHeight - settings.h - loadedHeight - interfaceHeight,0)/2 + $window.scrollTop(),
    posLeft = Math.max(document.documentElement.clientWidth - settings.w - loadedWidth - interfaceWidth,0)/2 + $window.scrollLeft();
    
    // setting the speed to 0 to reduce the delay between same-sized content.
    animate_speed = ($cbox.width() === settings.w+loadedWidth && $cbox.height() === settings.h+loadedHeight) ? 0 : speed;
    
    // this gives the wrapper plenty of breathing room so it's floated contents can move around smoothly,
    // but it has to be shrank down around the size of div#colorbox when it's done.  If not,
    // it can invoke an obscure IE bug when using iframes.
    $wrap[0].style.width = $wrap[0].style.height = "9999px";
    
    function modalDimensions (that) {
      // loading overlay size has to be sure that IE6 uses the correct height.
      $topBorder[0].style.width = $bottomBorder[0].style.width = $content[0].style.width = that.style.width;
      $loadingGraphic[0].style.height = $loadingOverlay[0].style.height = $content[0].style.height = $leftBorder[0].style.height = $rightBorder[0].style.height = that.style.height;
    }
    
    $cbox.dequeue().animate({width:settings.w+loadedWidth, height:settings.h+loadedHeight, top:posTop, left:posLeft}, {duration: animate_speed,
      complete: function(){
        modalDimensions(this);
        
        active = FALSE;
        
        // shrink the wrapper down to exactly the size of colorbox to avoid a bug in IE's iframe implementation.
        $wrap[0].style.width = (settings.w+loadedWidth+interfaceWidth) + "px";
        $wrap[0].style.height = (settings.h+loadedHeight+interfaceHeight) + "px";
        
        if (loadedCallback) {loadedCallback();}
      },
      step: function(){
        modalDimensions(this);
      }
    });
  };

  cboxPublic.resize = function (object) {
    if(!open){ return; }
    
    var topMargin,
    prev,
    prevSrc,
    next,
    nextSrc,
    photo,
    timeout,
    speed = settings.transition==="none" ? 0 : settings.speed;
    
    $window.unbind(cbox_resize);
    
    if(!object){
      timeout = setTimeout(function(){ // timer allows IE to render the dimensions before attempting to calculate the height
        var $child = $loaded.wrapInner("<div style='overflow:auto'></div>").children(); // temporary wrapper to get an accurate estimate of just how high the total content should be.
        settings.h = $child.height();
        $loaded.css({height:settings.h});
        $child.replaceWith($child.children()); // ditch the temporary wrapper div used in height calculation
        cboxPublic.position(speed);
      }, 1);
      return;
    }
    
    $loaded.remove();
    $loaded = $('<div id="cboxLoadedContent"/>').html(object);
    
    function getWidth(){
      settings.w = settings.w || $loaded.width();
      settings.w = settings.mw && settings.mw < settings.w ? settings.mw : settings.w;
      return settings.w;
    }
    function getHeight(){
      settings.h = settings.h || $loaded.height();
      settings.h = settings.mh && settings.mh < settings.h ? settings.mh : settings.h;
      return settings.h;
    }
    
    $loaded.hide()
    .appendTo($loadingBay)// content has to be appended to the DOM for accurate size calculations.  Appended to an absolutely positioned element, rather than BODY, which avoids an extremely brief display of the vertical scrollbar in Firefox that can occur for a small minority of websites.
    .css({width:getWidth(), overflow:settings.scrolling ? 'auto' : 'hidden'})
    .css({height:getHeight()})// sets the height independently from the width in case the new width influences the value of height.
    .prependTo($content);
    
    $('#cboxPhoto').css({cssFloat:'none'});// floating the IMG removes the bottom line-height and fixed a problem where IE miscalculates the width of the parent element as 100% of the document width.
    
    // Hides SELECT elements in IE6 because they would otherwise sit on top of the overlay.
    if (isIE6) {
      $('select:not(#colorbox select)').filter(function(){
        return this.style.visibility !== 'hidden';
      }).css({'visibility':'hidden'}).one(cbox_cleanup, function(){
        this.style.visibility = 'inherit';
      });
    }
        
    function setPosition (s) {
      cboxPublic.position(s, function(){
        if (!open) { return; }
        
        if (isIE) {
          //This fadeIn helps the bicubic resampling to kick-in.
          if( photo ){$loaded.fadeIn(100);}
          //IE adds a filter when ColorBox fades in and out that can cause problems if the loaded content contains transparent pngs.
          $cbox[0].style.removeAttribute("filter");
        }
        
        //Waited until the iframe is added to the DOM & it is visible before setting the src.
        //This increases compatability with pages using DOM dependent JavaScript.
        if(settings.iframe){
          $loaded.append("<iframe id='cboxIframe'" + (settings.scrolling ? " " : "scrolling='no'") + " name='iframe_"+new Date().getTime()+"' frameborder=0 src='"+settings.href+"' " + (isIE ? "allowtransparency='true'" : '') + " />");
        }
        
        $loaded.show();
        
        $title.show().html(settings.title);
        
        if ($related.length>1) {
          $current.html(settings.current.replace(/\{current\}/, index+1).replace(/\{total\}/, $related.length)).show();
          $next.html(settings.next).show();
          $prev.html(settings.previous).show();
          
          if(settings.slideshow){
            $slideshow.show();
          }
        }
        
        $loadingOverlay.hide();
        $loadingGraphic.hide();
        
        $.event.trigger(cbox_complete);
        if (settings.onComplete) {
          settings.onComplete.call(element);
        }
        
        if (settings.transition === 'fade'){
          $cbox.fadeTo(speed, 1, function(){
            if(isIE){$cbox[0].style.removeAttribute("filter");}
          });
        }
        
        $window.bind(cbox_resize, function(){
          cboxPublic.position(0);
        });
      });
    }
    
    if((settings.transition === 'fade' && $cbox.fadeTo(speed, 0, function(){setPosition(0);})) || setPosition(speed)){}
    
    // Preloads images within a rel group
    if (settings.preloading && $related.length>1) {
      prev = index > 0 ? $related[index-1] : $related[$related.length-1];
      next = index < $related.length-1 ? $related[index+1] : $related[0];
      nextSrc = $(next).data(colorbox).href || next.href;
      prevSrc = $(prev).data(colorbox).href || prev.href;
      
      if(isImage(nextSrc)){
        $('<img />').attr('src', nextSrc);
      }
      
      if(isImage(prevSrc)){
        $('<img />').attr('src', prevSrc);
      }
    }
  };

  cboxPublic.load = function () {
    var href, img, setResize, resize = cboxPublic.resize;
    
    active = TRUE;
    
    /*
     
    // I decided to comment this out because I can see it causing problems as users
    // really should just set the dimensions on their IMG elements instead,
    // but I'm leaving the code in as it may be useful to someone.
    // To use, uncomment the function and change 'if(textStatus === "success"){ resize(this); }'
    // to 'if(textStatus === "success"){ preload(this); }'
    
    // Preload loops through the HTML to find IMG elements and loads their sources.
    // This allows the resize method to accurately estimate the dimensions of the new content.
    function preload(html){
      var
      $ajax = $(html),
      $imgs = $ajax.find('img'),
      x = $imgs.length;
      
      function loadloop(){
        var img = new Image();
        x = x-1;
        if(x >= 0){
          img.onload = loadloop;
          img.src = $imgs[x].src;
        } else {
          resize($ajax);
        }
      }
      
      loadloop();
    }
    */
    
    element = $related[index];
    
    settings = $(element).data(colorbox);
    
    //convert functions to static values
    process();
    
    $.event.trigger(cbox_load);
    if (settings.onLoad) {
      settings.onLoad.call(element);
    }
    
    // Evaluate the height based on the optional height and width settings.
    settings.h = settings.height ?
        setSize(settings.height, 'y') - loadedHeight - interfaceHeight :
        settings.innerHeight ?
          setSize(settings.innerHeight, 'y') :
          FALSE;
    settings.w = settings.width ?
        setSize(settings.width, 'x') - loadedWidth - interfaceWidth :
        settings.innerWidth ?
          setSize(settings.innerWidth, 'x') :
          FALSE;
    
    // Sets the minimum dimensions for use in image scaling
    settings.mw = settings.w;
    settings.mh = settings.h;
    
    // Re-evaluate the minimum width and height based on maxWidth and maxHeight values.
    // If the width or height exceed the maxWidth or maxHeight, use the maximum values instead.
    if(settings.maxWidth){
      settings.mw = setSize(settings.maxWidth, 'x') - loadedWidth - interfaceWidth;
      settings.mw = settings.w && settings.w < settings.mw ? settings.w : settings.mw;
    }
    if(settings.maxHeight){
      settings.mh = setSize(settings.maxHeight, 'y') - loadedHeight - interfaceHeight;
      settings.mh = settings.h && settings.h < settings.mh ? settings.h : settings.mh;
    }
    
    href = settings.href;
    
    $loadingOverlay.show();
    $loadingGraphic.show();
    
    if (settings.inline) {
      // Inserts an empty placeholder where inline content is being pulled from.
      // An event is bound to put inline content back when ColorBox closes or loads new content.
      $('<div id="cboxInlineTemp" />').hide().insertBefore($(href)[0]).bind(cbox_load+' '+cbox_cleanup, function(){
        $(this).replaceWith($loaded.children());
      });
      resize($(href));
    } else if (settings.iframe) {
      // IFrame element won't be added to the DOM until it is ready to be displayed,
      // to avoid problems with DOM-ready JS that might be trying to run in that iframe.
      resize(" ");
    } else if (settings.html) {
      resize(settings.html);
    } else if (isImage(href)){
      img = new Image();
      img.onload = function(){
        var percent;
        
        img.onload = null;
        
        img.id = 'cboxPhoto';
        
        $(img).css({margin:'auto', border:'none', display:'block', cssFloat:'left'});
        
        if(settings.scalePhotos){
          setResize = function(){
            img.height -= img.height * percent;
            img.width -= img.width * percent; 
          };
          if(settings.mw && img.width > settings.mw){
            percent = (img.width - settings.mw) / img.width;
            setResize();
          }
          if(settings.mh && img.height > settings.mh){
            percent = (img.height - settings.mh) / img.height;
            setResize();
          }
        }
        
        if (settings.h) {
          img.style.marginTop = Math.max(settings.h - img.height,0)/2 + 'px';
        }
        
        resize(img);
        
        if($related.length > 1){
          $(img).css({cursor:'pointer'}).click(cboxPublic.next);
        }
        
        if(isIE){
          img.style.msInterpolationMode='bicubic';
        }
      };
      img.src = href;
    } else {
      $('<div />').appendTo($loadingBay).load(href, function(data, textStatus){
        if(textStatus === "success"){
          resize(this);
        } else {
          resize($("<p>Request unsuccessful.</p>"));
        }
      });
    }
  };

  // Navigates to the next page/image in a set.
  cboxPublic.next = function () {
    if(!active){
      index = index < $related.length-1 ? index+1 : 0;
      cboxPublic.load();
    }
  };
  
  cboxPublic.prev = function () {
    if(!active){
      index = index > 0 ? index-1 : $related.length-1;
      cboxPublic.load();
    }
  };

  cboxPublic.slideshow = function () {
    var stop, timeOut, className = 'cboxSlideshow_';
    
    $slideshow.bind(cbox_closed, function(){
      $slideshow.unbind();
      clearTimeout(timeOut);
      $cbox.removeClass(className+"off"+" "+className+"on");
    });
    
    function start(){
      $slideshow
      .text(settings.slideshowStop)
      .bind(cbox_complete, function(){
        timeOut = setTimeout(cboxPublic.next, settings.slideshowSpeed);
      })
      .bind(cbox_load, function(){
        clearTimeout(timeOut);  
      }).one("click", function(){
        stop();
        $(this).removeClass(hover);
      });
      $cbox.removeClass(className+"off").addClass(className+"on");
    }
    
    stop = function(){
      clearTimeout(timeOut);
      $slideshow
      .text(settings.slideshowStart)
      .unbind(cbox_complete+' '+cbox_load)
      .one("click", function(){
        start();
        timeOut = setTimeout(cboxPublic.next, settings.slideshowSpeed);
        $(this).removeClass(hover);
      });
      $cbox.removeClass(className+"on").addClass(className+"off");
    };
    
    if(settings.slideshow && $related.length>1){
      if(settings.slideshowAuto){
        start();
      } else {
        stop();
      }
    }
  };

  // Note: to use this within an iframe use the following format: parent.$.fn.colorbox.close();
  cboxPublic.close = function () {
    
    $.event.trigger(cbox_cleanup);
    if (settings.onCleanup) {
      settings.onCleanup.call(element);
    }
    
    open = FALSE;
    $(document).unbind("keydown.cbox_close keydown.cbox_arrows");
    $window.unbind(cbox_resize+' resize.cboxie6 scroll.cboxie6');
    $overlay.css({cursor: 'auto'}).fadeOut('fast');
    
    $cbox
    .stop(TRUE, FALSE)
    .fadeOut('fast', function () {
      $('#colorbox iframe').attr('src', 'about:blank');
      $loaded.remove();
      $cbox.css({'opacity': 1});
      
      try{
        bookmark.focus();
      } catch (er){
        // do nothing
      }
      
      $.event.trigger(cbox_closed);
      if (settings.onClosed) {
        settings.onClosed.call(element);
      }
    });
  };

  // A method for fetching the current element ColorBox is referencing.
  // returns a jQuery object.
  cboxPublic.element = function(){ return $(element); };

  cboxPublic.settings = defaults;

  // Initializes ColorBox when the DOM has loaded
  $(cboxPublic.init);

}(jQuery));


/*****************************************************************

typeface.js, version 0.14 | typefacejs.neocracy.org

Copyright (c) 2008 - 2009, David Chester davidchester@gmx.net 

Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.

*****************************************************************/

(function() {

var _typeface_js = {

  faces: {},

  loadFace: function(typefaceData) {

    var familyName = typefaceData.familyName.toLowerCase();
    
    if (!this.faces[familyName]) {
      this.faces[familyName] = {};
    }
    if (!this.faces[familyName][typefaceData.cssFontWeight]) {
      this.faces[familyName][typefaceData.cssFontWeight] = {};
    }

    var face = this.faces[familyName][typefaceData.cssFontWeight][typefaceData.cssFontStyle] = typefaceData;
    face.loaded = true;
  },

  log: function(message) {
    
    if (this.quiet) {
      return;
    }
    
    message = "typeface.js: " + message;
    
    if (this.customLogFn) {
      this.customLogFn(message);

    } else if (window.console && window.console.log) {
      window.console.log(message);
    }
    
  },
  
  pixelsFromPoints: function(face, style, points, dimension) {
    var pixels = points * parseInt(style.fontSize) * 72 / (face.resolution * 100);
    if (dimension == 'horizontal' && style.fontStretchPercent) {
      pixels *= style.fontStretchPercent;
    }
    return pixels;
  },

  pointsFromPixels: function(face, style, pixels, dimension) {
    var points = pixels * face.resolution / (parseInt(style.fontSize) * 72 / 100);
    if (dimension == 'horizontal' && style.fontStretchPrecent) {
      points *= style.fontStretchPercent;
    }
    return points;
  },

  cssFontWeightMap: {
    normal: 'normal',
    bold: 'bold',
    400: 'normal',
    700: 'bold'
  },

  cssFontStretchMap: {
    'ultra-condensed': 0.55,
    'extra-condensed': 0.77,
    'condensed': 0.85,
    'semi-condensed': 0.93,
    'normal': 1,
    'semi-expanded': 1.07,
    'expanded': 1.15,
    'extra-expanded': 1.23,
    'ultra-expanded': 1.45,
    'default': 1
  },
  
  fallbackCharacter: '.',

  configure: function(args) {
    var configurableOptionNames = [ 'customLogFn',  'customClassNameRegex', 'customTypefaceElementsList', 'quiet', 'verbose', 'disableSelection' ];
    
    for (var i = 0; i < configurableOptionNames.length; i++) {
      var optionName = configurableOptionNames[i];
      if (args[optionName]) {
        if (optionName == 'customLogFn') {
          if (typeof args[optionName] != 'function') {
            throw "customLogFn is not a function";
          } else {
            this.customLogFn = args.customLogFn;
          }
        } else {
          this[optionName] = args[optionName];
        }
      }
    }
  },

  getTextExtents: function(face, style, text) {
    var extentX = 0;
    var extentY = 0;
    var horizontalAdvance;
  
    var textLength = text.length;
    for (var i = 0; i < textLength; i++) {
      var glyph = face.glyphs[text.charAt(i)] ? face.glyphs[text.charAt(i)] : face.glyphs[this.fallbackCharacter];
      var letterSpacingAdjustment = this.pointsFromPixels(face, style, style.letterSpacing);

      // if we're on the last character, go with the glyph extent if that's more than the horizontal advance
      extentX += i + 1 == textLength ? Math.max(glyph.x_max, glyph.ha) : glyph.ha;
      extentX += letterSpacingAdjustment;

      horizontalAdvance += glyph.ha + letterSpacingAdjustment;
    }
    return { 
      x: extentX, 
      y: extentY,
      ha: horizontalAdvance
      
    };
  },

  pixelsFromCssAmount: function(cssAmount, defaultValue, element) {

    var matches = undefined;

    if (cssAmount == 'normal') {
      return defaultValue;

    } else if (matches = cssAmount.match(/([\-\d+\.]+)px/)) {
      return matches[1];

    } else {
      // thanks to Dean Edwards for this very sneaky way to get IE to convert 
      // relative values to pixel values
      
      var pixelAmount;
      
      var leftInlineStyle = element.style.left;
      var leftRuntimeStyle = element.runtimeStyle.left;

      element.runtimeStyle.left = element.currentStyle.left;

      if (!cssAmount.match(/\d(px|pt)$/)) {
        element.style.left = '1em';
      } else {
        element.style.left = cssAmount || 0;
      }

      pixelAmount = element.style.pixelLeft;
    
      element.style.left = leftInlineStyle;
      element.runtimeStyle.left = leftRuntimeStyle;
      
      return pixelAmount || defaultValue;
    }
  },

  capitalizeText: function(text) {
    return text.replace(/(^|\s)[a-z]/g, function(match) { return match.toUpperCase() } ); 
  },

  getElementStyle: function(e) {
    if (window.getComputedStyle) {
      return window.getComputedStyle(e, '');
    
    } else if (e.currentStyle) {
      return e.currentStyle;
    }
  },

  getRenderedText: function(e) {

    var browserStyle = this.getElementStyle(e.parentNode);

    var inlineStyleAttribute = e.parentNode.getAttribute('style');
    if (inlineStyleAttribute && typeof(inlineStyleAttribute) == 'object') {
      inlineStyleAttribute = inlineStyleAttribute.cssText;
    }

    if (inlineStyleAttribute) {

      var inlineStyleDeclarations = inlineStyleAttribute.split(/\s*\;\s*/);

      var inlineStyle = {};
      for (var i = 0; i < inlineStyleDeclarations.length; i++) {
        var declaration = inlineStyleDeclarations[i];
        var declarationOperands = declaration.split(/\s*\:\s*/);
        inlineStyle[declarationOperands[0]] = declarationOperands[1];
      }
    }

    var style = { 
      color: browserStyle.color, 
      fontFamily: browserStyle.fontFamily.split(/\s*,\s*/)[0].replace(/(^"|^'|'$|"$)/g, '').toLowerCase(), 
      fontSize: this.pixelsFromCssAmount(browserStyle.fontSize, 12, e.parentNode),
      fontWeight: this.cssFontWeightMap[browserStyle.fontWeight],
      fontStyle: browserStyle.fontStyle ? browserStyle.fontStyle : 'normal',
      fontStretchPercent: this.cssFontStretchMap[inlineStyle && inlineStyle['font-stretch'] ? inlineStyle['font-stretch'] : 'default'],
      textDecoration: browserStyle.textDecoration,
      lineHeight: this.pixelsFromCssAmount(browserStyle.lineHeight, 'normal', e.parentNode),
      letterSpacing: this.pixelsFromCssAmount(browserStyle.letterSpacing, 0, e.parentNode),
      textTransform: browserStyle.textTransform
    };

    var face;
    if (
      this.faces[style.fontFamily]  
      && this.faces[style.fontFamily][style.fontWeight]
    ) {
      face = this.faces[style.fontFamily][style.fontWeight][style.fontStyle];
    }

    var text = e.nodeValue;
    
    if (
      e.previousSibling 
      && e.previousSibling.nodeType == 1 
      && e.previousSibling.tagName != 'BR' 
      && this.getElementStyle(e.previousSibling).display.match(/inline/)
    ) {
      text = text.replace(/^\s+/, ' ');
    } else {
      text = text.replace(/^\s+/, '');
    }
    
    if (
      e.nextSibling 
      && e.nextSibling.nodeType == 1 
      && e.nextSibling.tagName != 'BR' 
      && this.getElementStyle(e.nextSibling).display.match(/inline/)
    ) {
      text = text.replace(/\s+$/, ' ');
    } else {
      text = text.replace(/\s+$/, '');
    }
    
    text = text.replace(/\s+/g, ' ');
  
    if (style.textTransform && style.textTransform != 'none') {
      switch (style.textTransform) {
        case 'capitalize':
          text = this.capitalizeText(text);
          break;
        case 'uppercase':
          text = text.toUpperCase();
          break;
        case 'lowercase':
          text = text.toLowerCase();
          break;
      }
    }

    if (!face) {
      var excerptLength = 12;
      var textExcerpt = text.substring(0, excerptLength);
      if (text.length > excerptLength) {
        textExcerpt += '...';
      }
    
      var fontDescription = style.fontFamily;
      if (style.fontWeight != 'normal') fontDescription += ' ' + style.fontWeight;
      if (style.fontStyle != 'normal') fontDescription += ' ' + style.fontStyle;
    
      
      return;
    }
  
    var words = text.split(/\b(?=\w)/);

    var containerSpan = document.createElement('span');
    containerSpan.className = 'typeface-js-vector-container';
    
    var wordsLength = words.length;
    for (var i = 0; i < wordsLength; i++) {
      var word = words[i];
      
      var vector = this.renderWord(face, style, word);
      
      if (vector) {
        containerSpan.appendChild(vector.element);

        if (!this.disableSelection) {
          var selectableSpan = document.createElement('span');
          selectableSpan.className = 'typeface-js-selected-text';

          var wordNode = document.createTextNode(word);
          selectableSpan.appendChild(wordNode);

          if (this.vectorBackend != 'vml') {
            selectableSpan.style.marginLeft = -1 * (vector.width + 1) + 'px';
          }
          selectableSpan.targetWidth = vector.width;
          //selectableSpan.style.lineHeight = 1 + 'px';

          if (this.vectorBackend == 'vml') {
            vector.element.appendChild(selectableSpan);
          } else {
            containerSpan.appendChild(selectableSpan);
          }
        }
      }
    }

    return containerSpan;
  },

  renderDocument: function(callback) { 
    
    if (!callback)
      callback = function(e) { e.style.visibility = 'visible' };

    var elements = document.getElementsByTagName('*');
    
    var elementsLength = elements.length;
    for (var i = 0; i < elements.length; i++) {
      if (elements[i].className.match(/(^|\s)typeface-js(\s|$)/) || elements[i].tagName.match(/^(H1|H2|H3|H4|H5|H6)$/)) {
        this.replaceText(elements[i]);
        if (typeof callback == 'function') {
          callback(elements[i]);
        }
      }
    }

    if (this.vectorBackend == 'vml') {
      // lamely work around IE's quirky leaving off final dynamic shapes
      var dummyShape = document.createElement('v:shape');
      dummyShape.style.display = 'none';
      document.body.appendChild(dummyShape);
    }
  },

  replaceText: function(e) {

    var childNodes = [];
    var childNodesLength = e.childNodes.length;

    for (var i = 0; i < childNodesLength; i++) {
      this.replaceText(e.childNodes[i]);
    }

    if (e.nodeType == 3 && e.nodeValue.match(/\S/)) {
      var parentNode = e.parentNode;

      if (parentNode.className == 'typeface-js-selected-text') {
        return;
      }

      var renderedText = this.getRenderedText(e);
      
      if (
        parentNode.tagName == 'A' 
        && this.vectorBackend == 'vml'
        && this.getElementStyle(parentNode).display == 'inline'
      ) {
        // something of a hack, use inline-block to get IE to accept clicks in whitespace regions
        parentNode.style.display = 'inline-block';
        parentNode.style.cursor = 'pointer';
      }

      if (this.getElementStyle(parentNode).display == 'inline') {
        parentNode.style.display = 'inline-block';
      }

      if (renderedText) { 
        if (parentNode.replaceChild) {
          parentNode.replaceChild(renderedText, e);
        } else {
          parentNode.insertBefore(renderedText, e);
          parentNode.removeChild(e);
        }
        if (this.vectorBackend == 'vml') {
          renderedText.innerHTML = renderedText.innerHTML;
        }

        var childNodesLength = renderedText.childNodes.length
        for (var i; i < childNodesLength; i++) {
          
          // do our best to line up selectable text with rendered text

          var e = renderedText.childNodes[i];
          if (e.hasChildNodes() && !e.targetWidth) {
            e = e.childNodes[0];
          }
          
          if (e && e.targetWidth) {
            var letterSpacingCount = e.innerHTML.length;
            var wordSpaceDelta = e.targetWidth - e.offsetWidth;
            var letterSpacing = wordSpaceDelta / (letterSpacingCount || 1);

            if (this.vectorBackend == 'vml') {
              letterSpacing = Math.ceil(letterSpacing);
            }

            e.style.letterSpacing = letterSpacing + 'px';
            e.style.width = e.targetWidth + 'px';
          }
        }
      }
    }
  },

  applyElementVerticalMetrics: function(face, style, e) {

    if (style.lineHeight == 'normal') {
      style.lineHeight = this.pixelsFromPoints(face, style, face.lineHeight);
    }

    var cssLineHeightAdjustment = style.lineHeight - this.pixelsFromPoints(face, style, face.lineHeight);

    e.style.marginTop = Math.round( cssLineHeightAdjustment / 2 ) + 'px';
    e.style.marginBottom = Math.round( cssLineHeightAdjustment / 2) + 'px';
  
  },

  vectorBackends: {

    canvas: {

      _initializeSurface: function(face, style, text) {

        var extents = this.getTextExtents(face, style, text);

        var canvas = document.createElement('canvas');
        if (this.disableSelection) {
          canvas.innerHTML = text;
        }

        canvas.height = Math.round(this.pixelsFromPoints(face, style, face.lineHeight));
        canvas.width = Math.round(this.pixelsFromPoints(face, style, extents.x, 'horizontal'));
  
        this.applyElementVerticalMetrics(face, style, canvas);

        if (extents.x > extents.ha) 
          canvas.style.marginRight = Math.round(this.pixelsFromPoints(face, style, extents.x - extents.ha, 'horizontal')) + 'px';

        var ctx = canvas.getContext('2d');

        var pointScale = this.pixelsFromPoints(face, style, 1);
        ctx.scale(pointScale * style.fontStretchPercent, -1 * pointScale);
        ctx.translate(0, -1 * face.ascender);
        ctx.fillStyle = style.color;

        return { context: ctx, canvas: canvas };
      },

      _renderGlyph: function(ctx, face, char, style) {

        var glyph = face.glyphs[char];

        if (!glyph) {
          //this.log.error("glyph not defined: " + char);
          return this.renderGlyph(ctx, face, this.fallbackCharacter, style);
        }

        if (glyph.o) {

          var outline;
          if (glyph.cached_outline) {
            outline = glyph.cached_outline;
          } else {
            outline = glyph.o.split(' ');
            glyph.cached_outline = outline;
          }

          var outlineLength = outline.length;
          for (var i = 0; i < outlineLength; ) {

            var action = outline[i++];

            switch(action) {
              case 'm':
                ctx.moveTo(outline[i++], outline[i++]);
                break;
              case 'l':
                ctx.lineTo(outline[i++], outline[i++]);
                break;

              case 'q':
                var cpx = outline[i++];
                var cpy = outline[i++];
                ctx.quadraticCurveTo(outline[i++], outline[i++], cpx, cpy);
                break;

              case 'b':
                var x = outline[i++];
                var y = outline[i++];
                ctx.bezierCurveTo(outline[i++], outline[i++], outline[i++], outline[i++], x, y);
                break;
            }
          }         
        }
        if (glyph.ha) {
          var letterSpacingPoints = 
            style.letterSpacing && style.letterSpacing != 'normal' ? 
              this.pointsFromPixels(face, style, style.letterSpacing) : 
              0;

          ctx.translate(glyph.ha + letterSpacingPoints, 0);
        }
      },

      _renderWord: function(face, style, text) {
        var surface = this.initializeSurface(face, style, text);
        var ctx = surface.context;
        var canvas = surface.canvas;
        ctx.beginPath();
        ctx.save();

        var chars = text.split('');
        var charsLength = chars.length;
        for (var i = 0; i < charsLength; i++) {
          this.renderGlyph(ctx, face, chars[i], style);
        }

        ctx.fill();

        if (style.textDecoration == 'underline') {

          ctx.beginPath();
          ctx.moveTo(0, face.underlinePosition);
          ctx.restore();
          ctx.lineTo(0, face.underlinePosition);
          ctx.strokeStyle = style.color;
          ctx.lineWidth = face.underlineThickness;
          ctx.stroke();
        }

        return { element: ctx.canvas, width: Math.floor(canvas.width) };
      
      }
    },

    vml: {

      _initializeSurface: function(face, style, text) {

        var shape = document.createElement('v:shape');

        var extents = this.getTextExtents(face, style, text);
        
        shape.style.width = shape.style.height = style.fontSize + 'px'; 
        shape.style.marginLeft = '-1px'; // this seems suspect...

        if (extents.x > extents.ha) {
          shape.style.marginRight = this.pixelsFromPoints(face, style, extents.x - extents.ha, 'horizontal') + 'px';
        }

        this.applyElementVerticalMetrics(face, style, shape);

        var resolutionScale = face.resolution * 100 / 72;
        shape.coordsize = (resolutionScale / style.fontStretchPercent) + "," + resolutionScale;
        
        shape.coordorigin = '0,' + face.ascender;
        shape.style.flip = 'y';

        shape.fillColor = style.color;
        shape.stroked = false;

        shape.path = 'hh m 0,' + face.ascender + ' l 0,' + face.descender + ' ';

        return shape;
      },

      _renderGlyph: function(shape, face, char, offsetX, style, vmlSegments) {

        var glyph = face.glyphs[char];

        if (!glyph) {
          this.log("glyph not defined: " + char);
          this.renderGlyph(shape, face, this.fallbackCharacter, offsetX, style);
          return;
        }
        
        vmlSegments.push('m');

        if (glyph.o) {
          
          var outline, outlineLength;
          
          if (glyph.cached_outline) {
            outline = glyph.cached_outline;
            outlineLength = outline.length;
          } else {
            outline = glyph.o.split(' ');
            outlineLength = outline.length;

            for (var i = 0; i < outlineLength;) {

              switch(outline[i++]) {
                case 'q':
                  outline[i] = Math.round(outline[i++]);
                  outline[i] = Math.round(outline[i++]);
                case 'm':
                case 'l':
                  outline[i] = Math.round(outline[i++]);
                  outline[i] = Math.round(outline[i++]);
                  break;
              } 
            } 

            glyph.cached_outline = outline;
          }

          var prevX, prevY;
          
          for (var i = 0; i < outlineLength;) {

            var action = outline[i++];

            var x = Math.round(outline[i++]) + offsetX;
            var y = Math.round(outline[i++]);
  
            switch(action) {
              case 'm':
                vmlSegments.push('xm ', x, ',', y);
                break;
  
              case 'l':
                vmlSegments.push('l ', x, ',', y);
                break;

              case 'q':
                var cpx = outline[i++] + offsetX;
                var cpy = outline[i++];

                var cp1x = Math.round(prevX + 2.0 / 3.0 * (cpx - prevX));
                var cp1y = Math.round(prevY + 2.0 / 3.0 * (cpy - prevY));

                var cp2x = Math.round(cp1x + (x - prevX) / 3.0);
                var cp2y = Math.round(cp1y + (y - prevY) / 3.0);
                
                vmlSegments.push('c ', cp1x, ',', cp1y, ',', cp2x, ',', cp2y, ',', x, ',', y);
                break;

              case 'b':
                var cp1x = Math.round(outline[i++]) + offsetX;
                var cp1y = outline[i++];

                var cp2x = Math.round(outline[i++]) + offsetX;
                var cp2y = outline[i++];

                vmlSegments.push('c ', cp1x, ',', cp1y, ',', cp2x, ',', cp2y, ',', x, ',', y);
                break;
            }

            prevX = x;
            prevY = y;
          }         
        }

        vmlSegments.push('x e');
        return vmlSegments;
      },

      _renderWord: function(face, style, text) {
        var offsetX = 0;
        var shape = this.initializeSurface(face, style, text);
    
        var letterSpacingPoints = 
          style.letterSpacing && style.letterSpacing != 'normal' ? 
            this.pointsFromPixels(face, style, style.letterSpacing) : 
            0;

        letterSpacingPoints = Math.round(letterSpacingPoints);
        var chars = text.split('');
        var vmlSegments = [];
        for (var i = 0; i < chars.length; i++) {
          var char = chars[i];
          vmlSegments = this.renderGlyph(shape, face, char, offsetX, style, vmlSegments);
          offsetX += face.glyphs[char].ha + letterSpacingPoints ; 
        }

        if (style.textDecoration == 'underline') {
          var posY = face.underlinePosition - (face.underlineThickness / 2);
          vmlSegments.push('xm ', 0, ',', posY);
          vmlSegments.push('l ', offsetX, ',', posY);
          vmlSegments.push('l ', offsetX, ',', posY + face.underlineThickness);
          vmlSegments.push('l ', 0, ',', posY + face.underlineThickness);
          vmlSegments.push('l ', 0, ',', posY);
          vmlSegments.push('x e');
        }

        // make sure to preserve trailing whitespace
        shape.path += vmlSegments.join('') + 'm ' + offsetX + ' 0 l ' + offsetX + ' ' + face.ascender;
        
        return {
          element: shape,
          width: Math.floor(this.pixelsFromPoints(face, style, offsetX, 'horizontal'))
        };
      }

    }

  },

  setVectorBackend: function(backend) {

    this.vectorBackend = backend;
    var backendFunctions = ['renderWord', 'initializeSurface', 'renderGlyph'];

    for (var i = 0; i < backendFunctions.length; i++) {
      var backendFunction = backendFunctions[i];
      this[backendFunction] = this.vectorBackends[backend]['_' + backendFunction];
    }
  },
  
  initialize: function() {

    // quit if this function has already been called
    if (arguments.callee.done) return; 
    
    // flag this function so we don't do the same thing twice
    arguments.callee.done = true;

    // kill the timer
    if (window._typefaceTimer) clearInterval(_typefaceTimer);

    this.renderDocument( function(e) { e.style.visibility = 'visible' } );

  }
  
};

// IE won't accept real selectors...
var typefaceSelectors = ['.fest'];

if (document.createStyleSheet) { 

  var styleSheet = document.createStyleSheet();
  for (var i = 0; i < typefaceSelectors.length; i++) {
    var selector = typefaceSelectors[i];
    styleSheet.addRule(selector, 'visibility: hidden');
  }

  styleSheet.addRule(
    '.typeface-js-selected-text', 
    '-ms-filter: \
      "Chroma(color=black) \
      progid:DXImageTransform.Microsoft.MaskFilter(Color=white) \
      progid:DXImageTransform.Microsoft.MaskFilter(Color=blue) \
      alpha(opacity=30)" !important; \
    color: black; \
    font-family: Modern; \
    position: absolute; \
    white-space: pre; \
    filter: alpha(opacity=0) !important;'
  );

  styleSheet.addRule(
    '.typeface-js-vector-container',
    'position: relative'
  );

} else if (document.styleSheets) {

  if (!document.styleSheets.length) { (function() {
    // create a stylesheet if we need to
    var styleSheet = document.createElement('style');
    styleSheet.type = 'text/css';
    document.getElementsByTagName('head')[0].appendChild(styleSheet);
  })() }

  var styleSheet = document.styleSheets[0];
  document.styleSheets[0].insertRule(typefaceSelectors.join(',') + ' { visibility: hidden; }', styleSheet.cssRules.length); 

  document.styleSheets[0].insertRule(
    '.typeface-js-selected-text { \
      color: rgba(128, 128, 128, 0); \
      opacity: 0.30; \
      position: absolute; \
      font-family: Arial, sans-serif; \
      white-space: pre \
    }', 
    styleSheet.cssRules.length
  );

  try { 
    // set selection style for Mozilla / Firefox
    document.styleSheets[0].insertRule(
      '.typeface-js-selected-text::-moz-selection { background: blue; }', 
      styleSheet.cssRules.length
    ); 

  } catch(e) {};

  try { 
    // set styles for browsers with CSS3 selectors (Safari, Chrome)
    document.styleSheets[0].insertRule(
      '.typeface-js-selected-text::selection { background: blue; }', 
      styleSheet.cssRules.length
    ); 

  } catch(e) {};

  // most unfortunately, sniff for WebKit's quirky selection behavior
  if (/WebKit/i.test(navigator.userAgent)) {
    document.styleSheets[0].insertRule(
      '.typeface-js-vector-container { position: relative }',
      styleSheet.cssRules.length
    );
  }

}

var backend = !!(window.attachEvent && !window.opera) ? 'vml' : window.CanvasRenderingContext2D || document.createElement('canvas').getContext ? 'canvas' : null;

if (backend == 'vml') {

  document.namespaces.add("v","urn:schemas-microsoft-com:vml","#default#VML");

  var styleSheet = document.createStyleSheet();
  styleSheet.addRule('v\\:shape', "display: inline-block;");
}

_typeface_js.setVectorBackend(backend);
window._typeface_js = _typeface_js;
  
if (/WebKit/i.test(navigator.userAgent)) {

  var _typefaceTimer = setInterval(function() {
    if (/loaded|complete/.test(document.readyState)) {
      _typeface_js.initialize(); 
    }
  }, 10);
}

if (document.addEventListener) {
  window.addEventListener('DOMContentLoaded', function() { _typeface_js.initialize() }, false);
} 

/*@cc_on @*/
/*@if (@_win32)

document.write("<script id=__ie_onload_typeface defer src=//:><\/script>");
var script = document.getElementById("__ie_onload_typeface");
script.onreadystatechange = function() {
  if (this.readyState == "complete") {
    _typeface_js.initialize(); 
  }
};

/*@end @*/



})();


/*!
 * jQuery UI 1.8.12
 *
 * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT or GPL Version 2 licenses.
 * http://jquery.org/license
 *
 * http://docs.jquery.com/UI
 */
(function(c,j){function k(a){return!c(a).parents().andSelf().filter(function(){return c.curCSS(this,"visibility")==="hidden"||c.expr.filters.hidden(this)}).length}c.ui=c.ui||{};if(!c.ui.version){c.extend(c.ui,{version:"1.8.12",keyCode:{ALT:18,BACKSPACE:8,CAPS_LOCK:20,COMMA:188,COMMAND:91,COMMAND_LEFT:91,COMMAND_RIGHT:93,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,MENU:93,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,
NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SHIFT:16,SPACE:32,TAB:9,UP:38,WINDOWS:91}});c.fn.extend({_focus:c.fn.focus,focus:function(a,b){return typeof a==="number"?this.each(function(){var d=this;setTimeout(function(){c(d).focus();b&&b.call(d)},a)}):this._focus.apply(this,arguments)},scrollParent:function(){var a;a=c.browser.msie&&/(static|relative)/.test(this.css("position"))||/absolute/.test(this.css("position"))?this.parents().filter(function(){return/(relative|absolute|fixed)/.test(c.curCSS(this,
"position",1))&&/(auto|scroll)/.test(c.curCSS(this,"overflow",1)+c.curCSS(this,"overflow-y",1)+c.curCSS(this,"overflow-x",1))}).eq(0):this.parents().filter(function(){return/(auto|scroll)/.test(c.curCSS(this,"overflow",1)+c.curCSS(this,"overflow-y",1)+c.curCSS(this,"overflow-x",1))}).eq(0);return/fixed/.test(this.css("position"))||!a.length?c(document):a},zIndex:function(a){if(a!==j)return this.css("zIndex",a);if(this.length){a=c(this[0]);for(var b;a.length&&a[0]!==document;){b=a.css("position");
if(b==="absolute"||b==="relative"||b==="fixed"){b=parseInt(a.css("zIndex"),10);if(!isNaN(b)&&b!==0)return b}a=a.parent()}}return 0},disableSelection:function(){return this.bind((c.support.selectstart?"selectstart":"mousedown")+".ui-disableSelection",function(a){a.preventDefault()})},enableSelection:function(){return this.unbind(".ui-disableSelection")}});c.each(["Width","Height"],function(a,b){function d(f,g,l,m){c.each(e,function(){g-=parseFloat(c.curCSS(f,"padding"+this,true))||0;if(l)g-=parseFloat(c.curCSS(f,
"border"+this+"Width",true))||0;if(m)g-=parseFloat(c.curCSS(f,"margin"+this,true))||0});return g}var e=b==="Width"?["Left","Right"]:["Top","Bottom"],h=b.toLowerCase(),i={innerWidth:c.fn.innerWidth,innerHeight:c.fn.innerHeight,outerWidth:c.fn.outerWidth,outerHeight:c.fn.outerHeight};c.fn["inner"+b]=function(f){if(f===j)return i["inner"+b].call(this);return this.each(function(){c(this).css(h,d(this,f)+"px")})};c.fn["outer"+b]=function(f,g){if(typeof f!=="number")return i["outer"+b].call(this,f);return this.each(function(){c(this).css(h,
d(this,f,true,g)+"px")})}});c.extend(c.expr[":"],{data:function(a,b,d){return!!c.data(a,d[3])},focusable:function(a){var b=a.nodeName.toLowerCase(),d=c.attr(a,"tabindex");if("area"===b){b=a.parentNode;d=b.name;if(!a.href||!d||b.nodeName.toLowerCase()!=="map")return false;a=c("img[usemap=#"+d+"]")[0];return!!a&&k(a)}return(/input|select|textarea|button|object/.test(b)?!a.disabled:"a"==b?a.href||!isNaN(d):!isNaN(d))&&k(a)},tabbable:function(a){var b=c.attr(a,"tabindex");return(isNaN(b)||b>=0)&&c(a).is(":focusable")}});
c(function(){var a=document.body,b=a.appendChild(b=document.createElement("div"));c.extend(b.style,{minHeight:"100px",height:"auto",padding:0,borderWidth:0});c.support.minHeight=b.offsetHeight===100;c.support.selectstart="onselectstart"in b;a.removeChild(b).style.display="none"});c.extend(c.ui,{plugin:{add:function(a,b,d){a=c.ui[a].prototype;for(var e in d){a.plugins[e]=a.plugins[e]||[];a.plugins[e].push([b,d[e]])}},call:function(a,b,d){if((b=a.plugins[b])&&a.element[0].parentNode)for(var e=0;e<b.length;e++)a.options[b[e][0]]&&
b[e][1].apply(a.element,d)}},contains:function(a,b){return document.compareDocumentPosition?a.compareDocumentPosition(b)&16:a!==b&&a.contains(b)},hasScroll:function(a,b){if(c(a).css("overflow")==="hidden")return false;b=b&&b==="left"?"scrollLeft":"scrollTop";var d=false;if(a[b]>0)return true;a[b]=1;d=a[b]>0;a[b]=0;return d},isOverAxis:function(a,b,d){return a>b&&a<b+d},isOver:function(a,b,d,e,h,i){return c.ui.isOverAxis(a,d,h)&&c.ui.isOverAxis(b,e,i)}})}})(jQuery);
;
/*!
 * jQuery UI Widget 1.8.12
 *
 * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT or GPL Version 2 licenses.
 * http://jquery.org/license
 *
 * http://docs.jquery.com/UI/Widget
 */
(function(b,j){if(b.cleanData){var k=b.cleanData;b.cleanData=function(a){for(var c=0,d;(d=a[c])!=null;c++)b(d).triggerHandler("remove");k(a)}}else{var l=b.fn.remove;b.fn.remove=function(a,c){return this.each(function(){if(!c)if(!a||b.filter(a,[this]).length)b("*",this).add([this]).each(function(){b(this).triggerHandler("remove")});return l.call(b(this),a,c)})}}b.widget=function(a,c,d){var e=a.split(".")[0],f;a=a.split(".")[1];f=e+"-"+a;if(!d){d=c;c=b.Widget}b.expr[":"][f]=function(h){return!!b.data(h,
a)};b[e]=b[e]||{};b[e][a]=function(h,g){arguments.length&&this._createWidget(h,g)};c=new c;c.options=b.extend(true,{},c.options);b[e][a].prototype=b.extend(true,c,{namespace:e,widgetName:a,widgetEventPrefix:b[e][a].prototype.widgetEventPrefix||a,widgetBaseClass:f},d);b.widget.bridge(a,b[e][a])};b.widget.bridge=function(a,c){b.fn[a]=function(d){var e=typeof d==="string",f=Array.prototype.slice.call(arguments,1),h=this;d=!e&&f.length?b.extend.apply(null,[true,d].concat(f)):d;if(e&&d.charAt(0)==="_")return h;
e?this.each(function(){var g=b.data(this,a),i=g&&b.isFunction(g[d])?g[d].apply(g,f):g;if(i!==g&&i!==j){h=i;return false}}):this.each(function(){var g=b.data(this,a);g?g.option(d||{})._init():b.data(this,a,new c(d,this))});return h}};b.Widget=function(a,c){arguments.length&&this._createWidget(a,c)};b.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",options:{disabled:false},_createWidget:function(a,c){b.data(c,this.widgetName,this);this.element=b(c);this.options=b.extend(true,{},this.options,
this._getCreateOptions(),a);var d=this;this.element.bind("remove."+this.widgetName,function(){d.destroy()});this._create();this._trigger("create");this._init()},_getCreateOptions:function(){return b.metadata&&b.metadata.get(this.element[0])[this.widgetName]},_create:function(){},_init:function(){},destroy:function(){this.element.unbind("."+this.widgetName).removeData(this.widgetName);this.widget().unbind("."+this.widgetName).removeAttr("aria-disabled").removeClass(this.widgetBaseClass+"-disabled ui-state-disabled")},
widget:function(){return this.element},option:function(a,c){var d=a;if(arguments.length===0)return b.extend({},this.options);if(typeof a==="string"){if(c===j)return this.options[a];d={};d[a]=c}this._setOptions(d);return this},_setOptions:function(a){var c=this;b.each(a,function(d,e){c._setOption(d,e)});return this},_setOption:function(a,c){this.options[a]=c;if(a==="disabled")this.widget()[c?"addClass":"removeClass"](this.widgetBaseClass+"-disabled ui-state-disabled").attr("aria-disabled",c);return this},
enable:function(){return this._setOption("disabled",false)},disable:function(){return this._setOption("disabled",true)},_trigger:function(a,c,d){var e=this.options[a];c=b.Event(c);c.type=(a===this.widgetEventPrefix?a:this.widgetEventPrefix+a).toLowerCase();d=d||{};if(c.originalEvent){a=b.event.props.length;for(var f;a;){f=b.event.props[--a];c[f]=c.originalEvent[f]}}this.element.trigger(c,d);return!(b.isFunction(e)&&e.call(this.element[0],c,d)===false||c.isDefaultPrevented())}}})(jQuery);
;
/*
 * jQuery UI Position 1.8.12
 *
 * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT or GPL Version 2 licenses.
 * http://jquery.org/license
 *
 * http://docs.jquery.com/UI/Position
 */
(function(c){c.ui=c.ui||{};var n=/left|center|right/,o=/top|center|bottom/,t=c.fn.position,u=c.fn.offset;c.fn.position=function(b){if(!b||!b.of)return t.apply(this,arguments);b=c.extend({},b);var a=c(b.of),d=a[0],g=(b.collision||"flip").split(" "),e=b.offset?b.offset.split(" "):[0,0],h,k,j;if(d.nodeType===9){h=a.width();k=a.height();j={top:0,left:0}}else if(d.setTimeout){h=a.width();k=a.height();j={top:a.scrollTop(),left:a.scrollLeft()}}else if(d.preventDefault){b.at="left top";h=k=0;j={top:b.of.pageY,
left:b.of.pageX}}else{h=a.outerWidth();k=a.outerHeight();j=a.offset()}c.each(["my","at"],function(){var f=(b[this]||"").split(" ");if(f.length===1)f=n.test(f[0])?f.concat(["center"]):o.test(f[0])?["center"].concat(f):["center","center"];f[0]=n.test(f[0])?f[0]:"center";f[1]=o.test(f[1])?f[1]:"center";b[this]=f});if(g.length===1)g[1]=g[0];e[0]=parseInt(e[0],10)||0;if(e.length===1)e[1]=e[0];e[1]=parseInt(e[1],10)||0;if(b.at[0]==="right")j.left+=h;else if(b.at[0]==="center")j.left+=h/2;if(b.at[1]==="bottom")j.top+=
k;else if(b.at[1]==="center")j.top+=k/2;j.left+=e[0];j.top+=e[1];return this.each(function(){var f=c(this),l=f.outerWidth(),m=f.outerHeight(),p=parseInt(c.curCSS(this,"marginLeft",true))||0,q=parseInt(c.curCSS(this,"marginTop",true))||0,v=l+p+(parseInt(c.curCSS(this,"marginRight",true))||0),w=m+q+(parseInt(c.curCSS(this,"marginBottom",true))||0),i=c.extend({},j),r;if(b.my[0]==="right")i.left-=l;else if(b.my[0]==="center")i.left-=l/2;if(b.my[1]==="bottom")i.top-=m;else if(b.my[1]==="center")i.top-=
m/2;i.left=Math.round(i.left);i.top=Math.round(i.top);r={left:i.left-p,top:i.top-q};c.each(["left","top"],function(s,x){c.ui.position[g[s]]&&c.ui.position[g[s]][x](i,{targetWidth:h,targetHeight:k,elemWidth:l,elemHeight:m,collisionPosition:r,collisionWidth:v,collisionHeight:w,offset:e,my:b.my,at:b.at})});c.fn.bgiframe&&f.bgiframe();f.offset(c.extend(i,{using:b.using}))})};c.ui.position={fit:{left:function(b,a){var d=c(window);d=a.collisionPosition.left+a.collisionWidth-d.width()-d.scrollLeft();b.left=
d>0?b.left-d:Math.max(b.left-a.collisionPosition.left,b.left)},top:function(b,a){var d=c(window);d=a.collisionPosition.top+a.collisionHeight-d.height()-d.scrollTop();b.top=d>0?b.top-d:Math.max(b.top-a.collisionPosition.top,b.top)}},flip:{left:function(b,a){if(a.at[0]!=="center"){var d=c(window);d=a.collisionPosition.left+a.collisionWidth-d.width()-d.scrollLeft();var g=a.my[0]==="left"?-a.elemWidth:a.my[0]==="right"?a.elemWidth:0,e=a.at[0]==="left"?a.targetWidth:-a.targetWidth,h=-2*a.offset[0];b.left+=
a.collisionPosition.left<0?g+e+h:d>0?g+e+h:0}},top:function(b,a){if(a.at[1]!=="center"){var d=c(window);d=a.collisionPosition.top+a.collisionHeight-d.height()-d.scrollTop();var g=a.my[1]==="top"?-a.elemHeight:a.my[1]==="bottom"?a.elemHeight:0,e=a.at[1]==="top"?a.targetHeight:-a.targetHeight,h=-2*a.offset[1];b.top+=a.collisionPosition.top<0?g+e+h:d>0?g+e+h:0}}}};if(!c.offset.setOffset){c.offset.setOffset=function(b,a){if(/static/.test(c.curCSS(b,"position")))b.style.position="relative";var d=c(b),
g=d.offset(),e=parseInt(c.curCSS(b,"top",true),10)||0,h=parseInt(c.curCSS(b,"left",true),10)||0;g={top:a.top-g.top+e,left:a.left-g.left+h};"using"in a?a.using.call(b,g):d.css(g)};c.fn.offset=function(b){var a=this[0];if(!a||!a.ownerDocument)return null;if(b)return this.each(function(){c.offset.setOffset(this,b)});return u.call(this)}}})(jQuery);
;


/*
 * jQuery UI Tabs 1.8.11
 *
 * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT or GPL Version 2 licenses.
 * http://jquery.org/license
 *
 * http://docs.jquery.com/UI/Tabs
 *
 * Depends:
 *	jquery.ui.core.js
 *	jquery.ui.widget.js
 */
(function(d,p){function u(){return++v}function w(){return++x}var v=0,x=0;d.widget("ui.tabs",{options:{add:null,ajaxOptions:null,cache:false,cookie:null,collapsible:false,disable:null,disabled:[],enable:null,event:"click",fx:null,idPrefix:"ui-tabs-",load:null,panelTemplate:"<div></div>",remove:null,select:null,show:null,spinner:"<em>Loading&#8230;</em>",tabTemplate:"<li><a href='#{href}'><span>#{label}</span></a></li>"},_create:function(){this._tabify(true)},_setOption:function(b,e){if(b=="selected")this.options.collapsible&&
e==this.options.selected||this.select(e);else{this.options[b]=e;this._tabify()}},_tabId:function(b){return b.title&&b.title.replace(/\s/g,"_").replace(/[^\w\u00c0-\uFFFF-]/g,"")||this.options.idPrefix+u()},_sanitizeSelector:function(b){return b.replace(/:/g,"\\:")},_cookie:function(){var b=this.cookie||(this.cookie=this.options.cookie.name||"ui-tabs-"+w());return d.cookie.apply(null,[b].concat(d.makeArray(arguments)))},_ui:function(b,e){return{tab:b,panel:e,index:this.anchors.index(b)}},_cleanup:function(){this.lis.filter(".ui-state-processing").removeClass("ui-state-processing").find("span:data(label.tabs)").each(function(){var b=
d(this);b.html(b.data("label.tabs")).removeData("label.tabs")})},_tabify:function(b){function e(g,f){g.css("display","");!d.support.opacity&&f.opacity&&g[0].style.removeAttribute("filter")}var a=this,c=this.options,h=/^#.+/;this.list=this.element.find("ol,ul").eq(0);this.lis=d(" > li:has(a[href])",this.list);this.anchors=this.lis.map(function(){return d("a",this)[0]});this.panels=d([]);this.anchors.each(function(g,f){var i=d(f).attr("href"),l=i.split("#")[0],q;if(l&&(l===location.toString().split("#")[0]||
(q=d("base")[0])&&l===q.href)){i=f.hash;f.href=i}if(h.test(i))a.panels=a.panels.add(a.element.find(a._sanitizeSelector(i)));else if(i&&i!=="#"){d.data(f,"href.tabs",i);d.data(f,"load.tabs",i.replace(/#.*$/,""));i=a._tabId(f);f.href="#"+i;f=a.element.find("#"+i);if(!f.length){f=d(c.panelTemplate).attr("id",i).addClass("ui-tabs-panel ui-widget-content ui-corner-bottom").insertAfter(a.panels[g-1]||a.list);f.data("destroy.tabs",true)}a.panels=a.panels.add(f)}else c.disabled.push(g)});if(b){this.element.addClass("ui-tabs ui-widget ui-widget-content ui-corner-all");
this.list.addClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all");this.lis.addClass("ui-state-default ui-corner-top");this.panels.addClass("ui-tabs-panel ui-widget-content ui-corner-bottom");if(c.selected===p){location.hash&&this.anchors.each(function(g,f){if(f.hash==location.hash){c.selected=g;return false}});if(typeof c.selected!=="number"&&c.cookie)c.selected=parseInt(a._cookie(),10);if(typeof c.selected!=="number"&&this.lis.filter(".ui-tabs-selected").length)c.selected=
this.lis.index(this.lis.filter(".ui-tabs-selected"));c.selected=c.selected||(this.lis.length?0:-1)}else if(c.selected===null)c.selected=-1;c.selected=c.selected>=0&&this.anchors[c.selected]||c.selected<0?c.selected:0;c.disabled=d.unique(c.disabled.concat(d.map(this.lis.filter(".ui-state-disabled"),function(g){return a.lis.index(g)}))).sort();d.inArray(c.selected,c.disabled)!=-1&&c.disabled.splice(d.inArray(c.selected,c.disabled),1);this.panels.addClass("ui-tabs-hide");this.lis.removeClass("ui-tabs-selected ui-state-active");
if(c.selected>=0&&this.anchors.length){a.element.find(a._sanitizeSelector(a.anchors[c.selected].hash)).removeClass("ui-tabs-hide");this.lis.eq(c.selected).addClass("ui-tabs-selected ui-state-active");a.element.queue("tabs",function(){a._trigger("show",null,a._ui(a.anchors[c.selected],a.element.find(a._sanitizeSelector(a.anchors[c.selected].hash))[0]))});this.load(c.selected)}d(window).bind("unload",function(){a.lis.add(a.anchors).unbind(".tabs");a.lis=a.anchors=a.panels=null})}else c.selected=this.lis.index(this.lis.filter(".ui-tabs-selected"));
this.element[c.collapsible?"addClass":"removeClass"]("ui-tabs-collapsible");c.cookie&&this._cookie(c.selected,c.cookie);b=0;for(var j;j=this.lis[b];b++)d(j)[d.inArray(b,c.disabled)!=-1&&!d(j).hasClass("ui-tabs-selected")?"addClass":"removeClass"]("ui-state-disabled");c.cache===false&&this.anchors.removeData("cache.tabs");this.lis.add(this.anchors).unbind(".tabs");if(c.event!=="mouseover"){var k=function(g,f){f.is(":not(.ui-state-disabled)")&&f.addClass("ui-state-"+g)},n=function(g,f){f.removeClass("ui-state-"+
g)};this.lis.bind("mouseover.tabs",function(){k("hover",d(this))});this.lis.bind("mouseout.tabs",function(){n("hover",d(this))});this.anchors.bind("focus.tabs",function(){k("focus",d(this).closest("li"))});this.anchors.bind("blur.tabs",function(){n("focus",d(this).closest("li"))})}var m,o;if(c.fx)if(d.isArray(c.fx)){m=c.fx[0];o=c.fx[1]}else m=o=c.fx;var r=o?function(g,f){d(g).closest("li").addClass("ui-tabs-selected ui-state-active");f.hide().removeClass("ui-tabs-hide").animate(o,o.duration||"normal",
function(){e(f,o);a._trigger("show",null,a._ui(g,f[0]))})}:function(g,f){d(g).closest("li").addClass("ui-tabs-selected ui-state-active");f.removeClass("ui-tabs-hide");a._trigger("show",null,a._ui(g,f[0]))},s=m?function(g,f){f.animate(m,m.duration||"normal",function(){a.lis.removeClass("ui-tabs-selected ui-state-active");f.addClass("ui-tabs-hide");e(f,m);a.element.dequeue("tabs")})}:function(g,f){a.lis.removeClass("ui-tabs-selected ui-state-active");f.addClass("ui-tabs-hide");a.element.dequeue("tabs")};
this.anchors.bind(c.event+".tabs",function(){var g=this,f=d(g).closest("li"),i=a.panels.filter(":not(.ui-tabs-hide)"),l=a.element.find(a._sanitizeSelector(g.hash));if(f.hasClass("ui-tabs-selected")&&!c.collapsible||f.hasClass("ui-state-disabled")||f.hasClass("ui-state-processing")||a.panels.filter(":animated").length||a._trigger("select",null,a._ui(this,l[0]))===false){this.blur();return false}c.selected=a.anchors.index(this);a.abort();if(c.collapsible)if(f.hasClass("ui-tabs-selected")){c.selected=
-1;c.cookie&&a._cookie(c.selected,c.cookie);a.element.queue("tabs",function(){s(g,i)}).dequeue("tabs");this.blur();return false}else if(!i.length){c.cookie&&a._cookie(c.selected,c.cookie);a.element.queue("tabs",function(){r(g,l)});a.load(a.anchors.index(this));this.blur();return false}c.cookie&&a._cookie(c.selected,c.cookie);if(l.length){i.length&&a.element.queue("tabs",function(){s(g,i)});a.element.queue("tabs",function(){r(g,l)});a.load(a.anchors.index(this))}else throw"jQuery UI Tabs: Mismatching fragment identifier.";
d.browser.msie&&this.blur()});this.anchors.bind("click.tabs",function(){return false})},_getIndex:function(b){if(typeof b=="string")b=this.anchors.index(this.anchors.filter("[href$="+b+"]"));return b},destroy:function(){var b=this.options;this.abort();this.element.unbind(".tabs").removeClass("ui-tabs ui-widget ui-widget-content ui-corner-all ui-tabs-collapsible").removeData("tabs");this.list.removeClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all");this.anchors.each(function(){var e=
d.data(this,"href.tabs");if(e)this.href=e;var a=d(this).unbind(".tabs");d.each(["href","load","cache"],function(c,h){a.removeData(h+".tabs")})});this.lis.unbind(".tabs").add(this.panels).each(function(){d.data(this,"destroy.tabs")?d(this).remove():d(this).removeClass("ui-state-default ui-corner-top ui-tabs-selected ui-state-active ui-state-hover ui-state-focus ui-state-disabled ui-tabs-panel ui-widget-content ui-corner-bottom ui-tabs-hide")});b.cookie&&this._cookie(null,b.cookie);return this},add:function(b,
e,a){if(a===p)a=this.anchors.length;var c=this,h=this.options;e=d(h.tabTemplate.replace(/#\{href\}/g,b).replace(/#\{label\}/g,e));b=!b.indexOf("#")?b.replace("#",""):this._tabId(d("a",e)[0]);e.addClass("ui-state-default ui-corner-top").data("destroy.tabs",true);var j=c.element.find("#"+b);j.length||(j=d(h.panelTemplate).attr("id",b).data("destroy.tabs",true));j.addClass("ui-tabs-panel ui-widget-content ui-corner-bottom ui-tabs-hide");if(a>=this.lis.length){e.appendTo(this.list);j.appendTo(this.list[0].parentNode)}else{e.insertBefore(this.lis[a]);
j.insertBefore(this.panels[a])}h.disabled=d.map(h.disabled,function(k){return k>=a?++k:k});this._tabify();if(this.anchors.length==1){h.selected=0;e.addClass("ui-tabs-selected ui-state-active");j.removeClass("ui-tabs-hide");this.element.queue("tabs",function(){c._trigger("show",null,c._ui(c.anchors[0],c.panels[0]))});this.load(0)}this._trigger("add",null,this._ui(this.anchors[a],this.panels[a]));return this},remove:function(b){b=this._getIndex(b);var e=this.options,a=this.lis.eq(b).remove(),c=this.panels.eq(b).remove();
if(a.hasClass("ui-tabs-selected")&&this.anchors.length>1)this.select(b+(b+1<this.anchors.length?1:-1));e.disabled=d.map(d.grep(e.disabled,function(h){return h!=b}),function(h){return h>=b?--h:h});this._tabify();this._trigger("remove",null,this._ui(a.find("a")[0],c[0]));return this},enable:function(b){b=this._getIndex(b);var e=this.options;if(d.inArray(b,e.disabled)!=-1){this.lis.eq(b).removeClass("ui-state-disabled");e.disabled=d.grep(e.disabled,function(a){return a!=b});this._trigger("enable",null,
this._ui(this.anchors[b],this.panels[b]));return this}},disable:function(b){b=this._getIndex(b);var e=this.options;if(b!=e.selected){this.lis.eq(b).addClass("ui-state-disabled");e.disabled.push(b);e.disabled.sort();this._trigger("disable",null,this._ui(this.anchors[b],this.panels[b]))}return this},select:function(b){b=this._getIndex(b);if(b==-1)if(this.options.collapsible&&this.options.selected!=-1)b=this.options.selected;else return this;this.anchors.eq(b).trigger(this.options.event+".tabs");return this},
load:function(b){b=this._getIndex(b);var e=this,a=this.options,c=this.anchors.eq(b)[0],h=d.data(c,"load.tabs");this.abort();if(!h||this.element.queue("tabs").length!==0&&d.data(c,"cache.tabs"))this.element.dequeue("tabs");else{this.lis.eq(b).addClass("ui-state-processing");if(a.spinner){var j=d("span",c);j.data("label.tabs",j.html()).html(a.spinner)}this.xhr=d.ajax(d.extend({},a.ajaxOptions,{url:h,success:function(k,n){e.element.find(e._sanitizeSelector(c.hash)).html(k);e._cleanup();a.cache&&d.data(c,
"cache.tabs",true);e._trigger("load",null,e._ui(e.anchors[b],e.panels[b]));try{a.ajaxOptions.success(k,n)}catch(m){}},error:function(k,n){e._cleanup();e._trigger("load",null,e._ui(e.anchors[b],e.panels[b]));try{a.ajaxOptions.error(k,n,b,c)}catch(m){}}}));e.element.dequeue("tabs");return this}},abort:function(){this.element.queue([]);this.panels.stop(false,true);this.element.queue("tabs",this.element.queue("tabs").splice(-2,2));if(this.xhr){this.xhr.abort();delete this.xhr}this._cleanup();return this},
url:function(b,e){this.anchors.eq(b).removeData("cache.tabs").data("load.tabs",e);return this},length:function(){return this.anchors.length}});d.extend(d.ui.tabs,{version:"1.8.11"});d.extend(d.ui.tabs.prototype,{rotation:null,rotate:function(b,e){var a=this,c=this.options,h=a._rotate||(a._rotate=function(j){clearTimeout(a.rotation);a.rotation=setTimeout(function(){var k=c.selected;a.select(++k<a.anchors.length?k:0)},b);j&&j.stopPropagation()});e=a._unrotate||(a._unrotate=!e?function(j){j.clientX&&
a.rotate(null)}:function(){t=c.selected;h()});if(b){this.element.bind("tabsshow",h);this.anchors.bind(c.event+".tabs",e);h()}else{clearTimeout(a.rotation);this.element.unbind("tabsshow",h);this.anchors.unbind(c.event+".tabs",e);delete this._rotate;delete this._unrotate}return this}})})(jQuery);
;


/**
 * jQuery Validation Plugin 1.8.0
 *
 * http://bassistance.de/jquery-plugins/jquery-plugin-validation/
 * http://docs.jquery.com/Plugins/Validation
 *
 * Copyright (c) 2006 - 2011 Jörn Zaefferer
 *
 * Dual licensed under the MIT and GPL licenses:
 *   http://www.opensource.org/licenses/mit-license.php
 *   http://www.gnu.org/licenses/gpl.html
 */
(function(c){c.extend(c.fn,{validate:function(a){if(this.length){var b=c.data(this[0],"validator");if(b)return b;b=new c.validator(a,this[0]);c.data(this[0],"validator",b);if(b.settings.onsubmit){this.find("input, button").filter(".cancel").click(function(){b.cancelSubmit=true});b.settings.submitHandler&&this.find("input, button").filter(":submit").click(function(){b.submitButton=this});this.submit(function(d){function e(){if(b.settings.submitHandler){if(b.submitButton)var f=c("<input type='hidden'/>").attr("name",
b.submitButton.name).val(b.submitButton.value).appendTo(b.currentForm);b.settings.submitHandler.call(b,b.currentForm);b.submitButton&&f.remove();return false}return true}b.settings.debug&&d.preventDefault();if(b.cancelSubmit){b.cancelSubmit=false;return e()}if(b.form()){if(b.pendingRequest){b.formSubmitted=true;return false}return e()}else{b.focusInvalid();return false}})}return b}else a&&a.debug&&window.console&&console.warn("nothing selected, can't validate, returning nothing")},valid:function(){if(c(this[0]).is("form"))return this.validate().form();
else{var a=true,b=c(this[0].form).validate();this.each(function(){a&=b.element(this)});return a}},removeAttrs:function(a){var b={},d=this;c.each(a.split(/\s/),function(e,f){b[f]=d.attr(f);d.removeAttr(f)});return b},rules:function(a,b){var d=this[0];if(a){var e=c.data(d.form,"validator").settings,f=e.rules,g=c.validator.staticRules(d);switch(a){case "add":c.extend(g,c.validator.normalizeRule(b));f[d.name]=g;if(b.messages)e.messages[d.name]=c.extend(e.messages[d.name],b.messages);break;case "remove":if(!b){delete f[d.name];
return g}var h={};c.each(b.split(/\s/),function(j,i){h[i]=g[i];delete g[i]});return h}}d=c.validator.normalizeRules(c.extend({},c.validator.metadataRules(d),c.validator.classRules(d),c.validator.attributeRules(d),c.validator.staticRules(d)),d);if(d.required){e=d.required;delete d.required;d=c.extend({required:e},d)}return d}});c.extend(c.expr[":"],{blank:function(a){return!c.trim(""+a.value)},filled:function(a){return!!c.trim(""+a.value)},unchecked:function(a){return!a.checked}});c.validator=function(a,
b){this.settings=c.extend(true,{},c.validator.defaults,a);this.currentForm=b;this.init()};c.validator.format=function(a,b){if(arguments.length==1)return function(){var d=c.makeArray(arguments);d.unshift(a);return c.validator.format.apply(this,d)};if(arguments.length>2&&b.constructor!=Array)b=c.makeArray(arguments).slice(1);if(b.constructor!=Array)b=[b];c.each(b,function(d,e){a=a.replace(RegExp("\\{"+d+"\\}","g"),e)});return a};c.extend(c.validator,{defaults:{messages:{},groups:{},rules:{},errorClass:"error",
validClass:"valid",errorElement:"label",focusInvalid:true,errorContainer:c([]),errorLabelContainer:c([]),onsubmit:true,ignore:[],ignoreTitle:false,onfocusin:function(a){this.lastActive=a;if(this.settings.focusCleanup&&!this.blockFocusCleanup){this.settings.unhighlight&&this.settings.unhighlight.call(this,a,this.settings.errorClass,this.settings.validClass);this.addWrapper(this.errorsFor(a)).hide()}},onfocusout:function(a){if(!this.checkable(a)&&(a.name in this.submitted||!this.optional(a)))this.element(a)},
onkeyup:function(a){if(a.name in this.submitted||a==this.lastElement)this.element(a)},onclick:function(a){if(a.name in this.submitted)this.element(a);else a.parentNode.name in this.submitted&&this.element(a.parentNode)},highlight:function(a,b,d){c(a).addClass(b).removeClass(d)},unhighlight:function(a,b,d){c(a).removeClass(b).addClass(d)}},setDefaults:function(a){c.extend(c.validator.defaults,a)},messages:{required:"This field is required.",remote:"Please fix this field.",email:"Please enter a valid email address.",
url:"Please enter a valid URL (including 'http://').",date:"Please enter a valid date.",dateISO:"Please enter a valid date (ISO).",number:"Please enter a valid number.",digits:"Please enter only digits.",creditcard:"Please enter a valid credit card number.",equalTo:"Please enter the same value again.",accept:"Please enter a value with a valid extension.",maxlength:c.validator.format("Please enter no more than {0} characters."),minlength:c.validator.format("Please enter at least {0} characters."),rangelength:c.validator.format("Please enter a value between {0} and {1} characters long."),
range:c.validator.format("Please enter a value between {0} and {1}."),max:c.validator.format("Please enter a value less than or equal to {0}."),min:c.validator.format("Please enter a value greater than or equal to {0}.")},autoCreateRanges:false,prototype:{init:function(){function a(e){var f=c.data(this[0].form,"validator");e="on"+e.type.replace(/^validate/,"");f.settings[e]&&f.settings[e].call(f,this[0])}this.labelContainer=c(this.settings.errorLabelContainer);this.errorContext=this.labelContainer.length&&
this.labelContainer||c(this.currentForm);this.containers=c(this.settings.errorContainer).add(this.settings.errorLabelContainer);this.submitted={};this.valueCache={};this.pendingRequest=0;this.pending={};this.invalid={};this.reset();var b=this.groups={};c.each(this.settings.groups,function(e,f){c.each(f.split(/\s/),function(g,h){b[h]=e})});var d=this.settings.rules;c.each(d,function(e,f){d[e]=c.validator.normalizeRule(f)});c(this.currentForm).validateDelegate(":text, :password, :file, select, textarea",
"focusin focusout keyup",a).validateDelegate(":radio, :checkbox, select, option","click",a);this.settings.invalidHandler&&c(this.currentForm).bind("invalid-form.validate",this.settings.invalidHandler)},form:function(){this.checkForm();c.extend(this.submitted,this.errorMap);this.invalid=c.extend({},this.errorMap);this.valid()||c(this.currentForm).triggerHandler("invalid-form",[this]);this.showErrors();return this.valid()},checkForm:function(){this.prepareForm();for(var a=0,b=this.currentElements=this.elements();b[a];a++)this.check(b[a]);
return this.valid()},element:function(a){this.lastElement=a=this.clean(a);this.prepareElement(a);this.currentElements=c(a);var b=this.check(a);if(b)delete this.invalid[a.name];else this.invalid[a.name]=true;if(!this.numberOfInvalids())this.toHide=this.toHide.add(this.containers);this.showErrors();return b},showErrors:function(a){if(a){c.extend(this.errorMap,a);this.errorList=[];for(var b in a)this.errorList.push({message:a[b],element:this.findByName(b)[0]});this.successList=c.grep(this.successList,
function(d){return!(d.name in a)})}this.settings.showErrors?this.settings.showErrors.call(this,this.errorMap,this.errorList):this.defaultShowErrors()},resetForm:function(){c.fn.resetForm&&c(this.currentForm).resetForm();this.submitted={};this.prepareForm();this.hideErrors();this.elements().removeClass(this.settings.errorClass)},numberOfInvalids:function(){return this.objectLength(this.invalid)},objectLength:function(a){var b=0,d;for(d in a)b++;return b},hideErrors:function(){this.addWrapper(this.toHide).hide()},
valid:function(){return this.size()==0},size:function(){return this.errorList.length},focusInvalid:function(){if(this.settings.focusInvalid)try{c(this.findLastActive()||this.errorList.length&&this.errorList[0].element||[]).filter(":visible").focus().trigger("focusin")}catch(a){}},findLastActive:function(){var a=this.lastActive;return a&&c.grep(this.errorList,function(b){return b.element.name==a.name}).length==1&&a},elements:function(){var a=this,b={};return c([]).add(this.currentForm.elements).filter(":input").not(":submit, :reset, :image, [disabled]").not(this.settings.ignore).filter(function(){!this.name&&
a.settings.debug&&window.console&&console.error("%o has no name assigned",this);if(this.name in b||!a.objectLength(c(this).rules()))return false;return b[this.name]=true})},clean:function(a){return c(a)[0]},errors:function(){return c(this.settings.errorElement+"."+this.settings.errorClass,this.errorContext)},reset:function(){this.successList=[];this.errorList=[];this.errorMap={};this.toShow=c([]);this.toHide=c([]);this.currentElements=c([])},prepareForm:function(){this.reset();this.toHide=this.errors().add(this.containers)},
prepareElement:function(a){this.reset();this.toHide=this.errorsFor(a)},check:function(a){a=this.clean(a);if(this.checkable(a))a=this.findByName(a.name).not(this.settings.ignore)[0];var b=c(a).rules(),d=false,e;for(e in b){var f={method:e,parameters:b[e]};try{var g=c.validator.methods[e].call(this,a.value.replace(/\r/g,""),a,f.parameters);if(g=="dependency-mismatch")d=true;else{d=false;if(g=="pending"){this.toHide=this.toHide.not(this.errorsFor(a));return}if(!g){this.formatAndAdd(a,f);return false}}}catch(h){this.settings.debug&&
window.console&&console.log("exception occured when checking element "+a.id+", check the '"+f.method+"' method",h);throw h;}}if(!d){this.objectLength(b)&&this.successList.push(a);return true}},customMetaMessage:function(a,b){if(c.metadata){var d=this.settings.meta?c(a).metadata()[this.settings.meta]:c(a).metadata();return d&&d.messages&&d.messages[b]}},customMessage:function(a,b){var d=this.settings.messages[a];return d&&(d.constructor==String?d:d[b])},findDefined:function(){for(var a=0;a<arguments.length;a++)if(arguments[a]!==
undefined)return arguments[a]},defaultMessage:function(a,b){return this.findDefined(this.customMessage(a.name,b),this.customMetaMessage(a,b),!this.settings.ignoreTitle&&a.title||undefined,c.validator.messages[b],"<strong>Warning: No message defined for "+a.name+"</strong>")},formatAndAdd:function(a,b){var d=this.defaultMessage(a,b.method),e=/\$?\{(\d+)\}/g;if(typeof d=="function")d=d.call(this,b.parameters,a);else if(e.test(d))d=jQuery.format(d.replace(e,"{$1}"),b.parameters);this.errorList.push({message:d,
element:a});this.errorMap[a.name]=d;this.submitted[a.name]=d},addWrapper:function(a){if(this.settings.wrapper)a=a.add(a.parent(this.settings.wrapper));return a},defaultShowErrors:function(){for(var a=0;this.errorList[a];a++){var b=this.errorList[a];this.settings.highlight&&this.settings.highlight.call(this,b.element,this.settings.errorClass,this.settings.validClass);this.showLabel(b.element,b.message)}if(this.errorList.length)this.toShow=this.toShow.add(this.containers);if(this.settings.success)for(a=
0;this.successList[a];a++)this.showLabel(this.successList[a]);if(this.settings.unhighlight){a=0;for(b=this.validElements();b[a];a++)this.settings.unhighlight.call(this,b[a],this.settings.errorClass,this.settings.validClass)}this.toHide=this.toHide.not(this.toShow);this.hideErrors();this.addWrapper(this.toShow).show()},validElements:function(){return this.currentElements.not(this.invalidElements())},invalidElements:function(){return c(this.errorList).map(function(){return this.element})},showLabel:function(a,
b){var d=this.errorsFor(a);if(d.length){d.removeClass().addClass(this.settings.errorClass);d.attr("generated")&&d.html(b)}else{d=c("<"+this.settings.errorElement+"/>").attr({"for":this.idOrName(a),generated:true}).addClass(this.settings.errorClass).html(b||"");if(this.settings.wrapper)d=d.hide().show().wrap("<"+this.settings.wrapper+"/>").parent();this.labelContainer.append(d).length||(this.settings.errorPlacement?this.settings.errorPlacement(d,c(a)):d.insertAfter(a))}if(!b&&this.settings.success){d.text("");
typeof this.settings.success=="string"?d.addClass(this.settings.success):this.settings.success(d)}this.toShow=this.toShow.add(d)},errorsFor:function(a){var b=this.idOrName(a);return this.errors().filter(function(){return c(this).attr("for")==b})},idOrName:function(a){return this.groups[a.name]||(this.checkable(a)?a.name:a.id||a.name)},checkable:function(a){return/radio|checkbox/i.test(a.type)},findByName:function(a){var b=this.currentForm;return c(document.getElementsByName(a)).map(function(d,e){return e.form==
b&&e.name==a&&e||null})},getLength:function(a,b){switch(b.nodeName.toLowerCase()){case "select":return c("option:selected",b).length;case "input":if(this.checkable(b))return this.findByName(b.name).filter(":checked").length}return a.length},depend:function(a,b){return this.dependTypes[typeof a]?this.dependTypes[typeof a](a,b):true},dependTypes:{"boolean":function(a){return a},string:function(a,b){return!!c(a,b.form).length},"function":function(a,b){return a(b)}},optional:function(a){return!c.validator.methods.required.call(this,
c.trim(a.value),a)&&"dependency-mismatch"},startRequest:function(a){if(!this.pending[a.name]){this.pendingRequest++;this.pending[a.name]=true}},stopRequest:function(a,b){this.pendingRequest--;if(this.pendingRequest<0)this.pendingRequest=0;delete this.pending[a.name];if(b&&this.pendingRequest==0&&this.formSubmitted&&this.form()){c(this.currentForm).submit();this.formSubmitted=false}else if(!b&&this.pendingRequest==0&&this.formSubmitted){c(this.currentForm).triggerHandler("invalid-form",[this]);this.formSubmitted=
false}},previousValue:function(a){return c.data(a,"previousValue")||c.data(a,"previousValue",{old:null,valid:true,message:this.defaultMessage(a,"remote")})}},classRuleSettings:{required:{required:true},email:{email:true},url:{url:true},date:{date:true},dateISO:{dateISO:true},dateDE:{dateDE:true},number:{number:true},numberDE:{numberDE:true},digits:{digits:true},creditcard:{creditcard:true}},addClassRules:function(a,b){a.constructor==String?this.classRuleSettings[a]=b:c.extend(this.classRuleSettings,
a)},classRules:function(a){var b={};(a=c(a).attr("class"))&&c.each(a.split(" "),function(){this in c.validator.classRuleSettings&&c.extend(b,c.validator.classRuleSettings[this])});return b},attributeRules:function(a){var b={};a=c(a);for(var d in c.validator.methods){var e=a.attr(d);if(e)b[d]=e}b.maxlength&&/-1|2147483647|524288/.test(b.maxlength)&&delete b.maxlength;return b},metadataRules:function(a){if(!c.metadata)return{};var b=c.data(a.form,"validator").settings.meta;return b?c(a).metadata()[b]:
c(a).metadata()},staticRules:function(a){var b={},d=c.data(a.form,"validator");if(d.settings.rules)b=c.validator.normalizeRule(d.settings.rules[a.name])||{};return b},normalizeRules:function(a,b){c.each(a,function(d,e){if(e===false)delete a[d];else if(e.param||e.depends){var f=true;switch(typeof e.depends){case "string":f=!!c(e.depends,b.form).length;break;case "function":f=e.depends.call(b,b)}if(f)a[d]=e.param!==undefined?e.param:true;else delete a[d]}});c.each(a,function(d,e){a[d]=c.isFunction(e)?
e(b):e});c.each(["minlength","maxlength","min","max"],function(){if(a[this])a[this]=Number(a[this])});c.each(["rangelength","range"],function(){if(a[this])a[this]=[Number(a[this][0]),Number(a[this][1])]});if(c.validator.autoCreateRanges){if(a.min&&a.max){a.range=[a.min,a.max];delete a.min;delete a.max}if(a.minlength&&a.maxlength){a.rangelength=[a.minlength,a.maxlength];delete a.minlength;delete a.maxlength}}a.messages&&delete a.messages;return a},normalizeRule:function(a){if(typeof a=="string"){var b=
{};c.each(a.split(/\s/),function(){b[this]=true});a=b}return a},addMethod:function(a,b,d){c.validator.methods[a]=b;c.validator.messages[a]=d!=undefined?d:c.validator.messages[a];b.length<3&&c.validator.addClassRules(a,c.validator.normalizeRule(a))},methods:{required:function(a,b,d){if(!this.depend(d,b))return"dependency-mismatch";switch(b.nodeName.toLowerCase()){case "select":return(a=c(b).val())&&a.length>0;case "input":if(this.checkable(b))return this.getLength(a,b)>0;default:return c.trim(a).length>
0}},remote:function(a,b,d){if(this.optional(b))return"dependency-mismatch";var e=this.previousValue(b);this.settings.messages[b.name]||(this.settings.messages[b.name]={});e.originalMessage=this.settings.messages[b.name].remote;this.settings.messages[b.name].remote=e.message;d=typeof d=="string"&&{url:d}||d;if(this.pending[b.name])return"pending";if(e.old===a)return e.valid;e.old=a;var f=this;this.startRequest(b);var g={};g[b.name]=a;c.ajax(c.extend(true,{url:d,mode:"abort",port:"validate"+b.name,
dataType:"json",data:g,success:function(h){f.settings.messages[b.name].remote=e.originalMessage;var j=h===true;if(j){var i=f.formSubmitted;f.prepareElement(b);f.formSubmitted=i;f.successList.push(b);f.showErrors()}else{i={};h=h||f.defaultMessage(b,"remote");i[b.name]=e.message=c.isFunction(h)?h(a):h;f.showErrors(i)}e.valid=j;f.stopRequest(b,j)}},d));return"pending"},minlength:function(a,b,d){return this.optional(b)||this.getLength(c.trim(a),b)>=d},maxlength:function(a,b,d){return this.optional(b)||
this.getLength(c.trim(a),b)<=d},rangelength:function(a,b,d){a=this.getLength(c.trim(a),b);return this.optional(b)||a>=d[0]&&a<=d[1]},min:function(a,b,d){return this.optional(b)||a>=d},max:function(a,b,d){return this.optional(b)||a<=d},range:function(a,b,d){return this.optional(b)||a>=d[0]&&a<=d[1]},email:function(a,b){return this.optional(b)||/^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i.test(a)},
url:function(a,b){return this.optional(b)||/^(https?|ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test(a)},
date:function(a,b){return this.optional(b)||!/Invalid|NaN/.test(new Date(a))},dateISO:function(a,b){return this.optional(b)||/^\d{4}[\/-]\d{1,2}[\/-]\d{1,2}$/.test(a)},number:function(a,b){return this.optional(b)||/^-?(?:\d+|\d{1,3}(?:,\d{3})+)(?:\.\d+)?$/.test(a)},digits:function(a,b){return this.optional(b)||/^\d+$/.test(a)},creditcard:function(a,b){if(this.optional(b))return"dependency-mismatch";if(/[^0-9-]+/.test(a))return false;var d=0,e=0,f=false;a=a.replace(/\D/g,"");for(var g=a.length-1;g>=
0;g--){e=a.charAt(g);e=parseInt(e,10);if(f)if((e*=2)>9)e-=9;d+=e;f=!f}return d%10==0},accept:function(a,b,d){d=typeof d=="string"?d.replace(/,/g,"|"):"png|jpe?g|gif";return this.optional(b)||a.match(RegExp(".("+d+")$","i"))},equalTo:function(a,b,d){d=c(d).unbind(".validate-equalTo").bind("blur.validate-equalTo",function(){c(b).valid()});return a==d.val()}}});c.format=c.validator.format})(jQuery);
(function(c){var a={};if(c.ajaxPrefilter)c.ajaxPrefilter(function(d,e,f){e=d.port;if(d.mode=="abort"){a[e]&&a[e].abort();a[e]=f}});else{var b=c.ajax;c.ajax=function(d){var e=("port"in d?d:c.ajaxSettings).port;if(("mode"in d?d:c.ajaxSettings).mode=="abort"){a[e]&&a[e].abort();return a[e]=b.apply(this,arguments)}return b.apply(this,arguments)}}})(jQuery);
(function(c){!jQuery.event.special.focusin&&!jQuery.event.special.focusout&&document.addEventListener&&c.each({focus:"focusin",blur:"focusout"},function(a,b){function d(e){e=c.event.fix(e);e.type=b;return c.event.handle.call(this,e)}c.event.special[b]={setup:function(){this.addEventListener(a,d,true)},teardown:function(){this.removeEventListener(a,d,true)},handler:function(e){arguments[0]=c.event.fix(e);arguments[0].type=b;return c.event.handle.apply(this,arguments)}}});c.extend(c.fn,{validateDelegate:function(a,
b,d){return this.bind(b,function(e){var f=c(e.target);if(f.is(a))return d.apply(f,arguments)})}})})(jQuery);


/*
 * jQuery UI Autocomplete 1.8.12
 *
 * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT or GPL Version 2 licenses.
 * http://jquery.org/license
 *
 * http://docs.jquery.com/UI/Autocomplete
 *
 * Depends:
 *	jquery.ui.core.js
 *	jquery.ui.widget.js
 *	jquery.ui.position.js
 */
(function(d){var e=0;d.widget("ui.autocomplete",{options:{appendTo:"body",autoFocus:false,delay:300,minLength:1,position:{my:"left top",at:"left bottom",collision:"none"},source:null},pending:0,_create:function(){var a=this,b=this.element[0].ownerDocument,g;this.element.addClass("ui-autocomplete-input").attr("autocomplete","off").attr({role:"textbox","aria-autocomplete":"list","aria-haspopup":"true"}).bind("keydown.autocomplete",function(c){if(!(a.options.disabled||a.element.attr("readonly"))){g=
false;var f=d.ui.keyCode;switch(c.keyCode){case f.PAGE_UP:a._move("previousPage",c);break;case f.PAGE_DOWN:a._move("nextPage",c);break;case f.UP:a._move("previous",c);c.preventDefault();break;case f.DOWN:a._move("next",c);c.preventDefault();break;case f.ENTER:case f.NUMPAD_ENTER:if(a.menu.active){g=true;c.preventDefault()}case f.TAB:if(!a.menu.active)return;a.menu.select(c);break;case f.ESCAPE:a.element.val(a.term);a.close(c);break;default:clearTimeout(a.searching);a.searching=setTimeout(function(){if(a.term!=
a.element.val()){a.selectedItem=null;a.search(null,c)}},a.options.delay);break}}}).bind("keypress.autocomplete",function(c){if(g){g=false;c.preventDefault()}}).bind("focus.autocomplete",function(){if(!a.options.disabled){a.selectedItem=null;a.previous=a.element.val()}}).bind("blur.autocomplete",function(c){if(!a.options.disabled){clearTimeout(a.searching);a.closing=setTimeout(function(){a.close(c);a._change(c)},150)}});this._initSource();this.response=function(){return a._response.apply(a,arguments)};
this.menu=d("<ul></ul>").addClass("ui-autocomplete").appendTo(d(this.options.appendTo||"body",b)[0]).mousedown(function(c){var f=a.menu.element[0];d(c.target).closest(".ui-menu-item").length||setTimeout(function(){d(document).one("mousedown",function(h){h.target!==a.element[0]&&h.target!==f&&!d.ui.contains(f,h.target)&&a.close()})},1);setTimeout(function(){clearTimeout(a.closing)},13)}).menu({focus:function(c,f){f=f.item.data("item.autocomplete");false!==a._trigger("focus",c,{item:f})&&/^key/.test(c.originalEvent.type)&&
a.element.val(f.value)},selected:function(c,f){var h=f.item.data("item.autocomplete"),i=a.previous;if(a.element[0]!==b.activeElement){a.element.focus();a.previous=i;setTimeout(function(){a.previous=i;a.selectedItem=h},1)}false!==a._trigger("select",c,{item:h})&&a.element.val(h.value);a.term=a.element.val();a.close(c);a.selectedItem=h},blur:function(){a.menu.element.is(":visible")&&a.element.val()!==a.term&&a.element.val(a.term)}}).zIndex(this.element.zIndex()+1).css({top:0,left:0}).hide().data("menu");
d.fn.bgiframe&&this.menu.element.bgiframe()},destroy:function(){this.element.removeClass("ui-autocomplete-input").removeAttr("autocomplete").removeAttr("role").removeAttr("aria-autocomplete").removeAttr("aria-haspopup");this.menu.element.remove();d.Widget.prototype.destroy.call(this)},_setOption:function(a,b){d.Widget.prototype._setOption.apply(this,arguments);a==="source"&&this._initSource();if(a==="appendTo")this.menu.element.appendTo(d(b||"body",this.element[0].ownerDocument)[0]);a==="disabled"&&
b&&this.xhr&&this.xhr.abort()},_initSource:function(){var a=this,b,g;if(d.isArray(this.options.source)){b=this.options.source;this.source=function(c,f){f(d.ui.autocomplete.filter(b,c.term))}}else if(typeof this.options.source==="string"){g=this.options.source;this.source=function(c,f){a.xhr&&a.xhr.abort();a.xhr=d.ajax({url:g,data:c,dataType:"json",autocompleteRequest:++e,success:function(h){this.autocompleteRequest===e&&f(h)},error:function(){this.autocompleteRequest===e&&f([])}})}}else this.source=
this.options.source},search:function(a,b){a=a!=null?a:this.element.val();this.term=this.element.val();if(a.length<this.options.minLength)return this.close(b);clearTimeout(this.closing);if(this._trigger("search",b)!==false)return this._search(a)},_search:function(a){this.pending++;this.element.addClass("ui-autocomplete-loading");this.source({term:a},this.response)},_response:function(a){if(!this.options.disabled&&a&&a.length){a=this._normalize(a);this._suggest(a);this._trigger("open")}else this.close();
this.pending--;this.pending||this.element.removeClass("ui-autocomplete-loading")},close:function(a){clearTimeout(this.closing);if(this.menu.element.is(":visible")){this.menu.element.hide();this.menu.deactivate();this._trigger("close",a)}},_change:function(a){this.previous!==this.element.val()&&this._trigger("change",a,{item:this.selectedItem})},_normalize:function(a){if(a.length&&a[0].label&&a[0].value)return a;return d.map(a,function(b){if(typeof b==="string")return{label:b,value:b};return d.extend({label:b.label||
b.value,value:b.value||b.label},b)})},_suggest:function(a){var b=this.menu.element.empty().zIndex(this.element.zIndex()+1);this._renderMenu(b,a);this.menu.deactivate();this.menu.refresh();b.show();this._resizeMenu();b.position(d.extend({of:this.element},this.options.position));this.options.autoFocus&&this.menu.next(new d.Event("mouseover"))},_resizeMenu:function(){var a=this.menu.element;a.outerWidth(Math.max(a.width("").outerWidth(),this.element.outerWidth()))},_renderMenu:function(a,b){var g=this;
d.each(b,function(c,f){g._renderItem(a,f)})},_renderItem:function(a,b){return d("<li></li>").data("item.autocomplete",b).append(d("<a></a>").text(b.label)).appendTo(a)},_move:function(a,b){if(this.menu.element.is(":visible"))if(this.menu.first()&&/^previous/.test(a)||this.menu.last()&&/^next/.test(a)){this.element.val(this.term);this.menu.deactivate()}else this.menu[a](b);else this.search(null,b)},widget:function(){return this.menu.element}});d.extend(d.ui.autocomplete,{escapeRegex:function(a){return a.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,
"\\$&")},filter:function(a,b){var g=new RegExp(d.ui.autocomplete.escapeRegex(b),"i");return d.grep(a,function(c){return g.test(c.label||c.value||c)})}})})(jQuery);
(function(d){d.widget("ui.menu",{_create:function(){var e=this;this.element.addClass("ui-menu ui-widget ui-widget-content ui-corner-all").attr({role:"listbox","aria-activedescendant":"ui-active-menuitem"}).click(function(a){if(d(a.target).closest(".ui-menu-item a").length){a.preventDefault();e.select(a)}});this.refresh()},refresh:function(){var e=this;this.element.children("li:not(.ui-menu-item):has(a)").addClass("ui-menu-item").attr("role","menuitem").children("a").addClass("ui-corner-all").attr("tabindex",
-1).mouseenter(function(a){e.activate(a,d(this).parent())}).mouseleave(function(){e.deactivate()})},activate:function(e,a){this.deactivate();if(this.hasScroll()){var b=a.offset().top-this.element.offset().top,g=this.element.attr("scrollTop"),c=this.element.height();if(b<0)this.element.attr("scrollTop",g+b);else b>=c&&this.element.attr("scrollTop",g+b-c+a.height())}this.active=a.eq(0).children("a").addClass("ui-state-hover").attr("id","ui-active-menuitem").end();this._trigger("focus",e,{item:a})},
deactivate:function(){if(this.active){this.active.children("a").removeClass("ui-state-hover").removeAttr("id");this._trigger("blur");this.active=null}},next:function(e){this.move("next",".ui-menu-item:first",e)},previous:function(e){this.move("prev",".ui-menu-item:last",e)},first:function(){return this.active&&!this.active.prevAll(".ui-menu-item").length},last:function(){return this.active&&!this.active.nextAll(".ui-menu-item").length},move:function(e,a,b){if(this.active){e=this.active[e+"All"](".ui-menu-item").eq(0);
e.length?this.activate(b,e):this.activate(b,this.element.children(a))}else this.activate(b,this.element.children(a))},nextPage:function(e){if(this.hasScroll())if(!this.active||this.last())this.activate(e,this.element.children(".ui-menu-item:first"));else{var a=this.active.offset().top,b=this.element.height(),g=this.element.children(".ui-menu-item").filter(function(){var c=d(this).offset().top-a-b+d(this).height();return c<10&&c>-10});g.length||(g=this.element.children(".ui-menu-item:last"));this.activate(e,
g)}else this.activate(e,this.element.children(".ui-menu-item").filter(!this.active||this.last()?":first":":last"))},previousPage:function(e){if(this.hasScroll())if(!this.active||this.first())this.activate(e,this.element.children(".ui-menu-item:last"));else{var a=this.active.offset().top,b=this.element.height();result=this.element.children(".ui-menu-item").filter(function(){var g=d(this).offset().top-a+b-d(this).height();return g<10&&g>-10});result.length||(result=this.element.children(".ui-menu-item:first"));
this.activate(e,result)}else this.activate(e,this.element.children(".ui-menu-item").filter(!this.active||this.first()?":last":":first"))},hasScroll:function(){return this.element.height()<this.element.attr("scrollHeight")},select:function(e){this._trigger("selected",e,{item:this.active})}})})(jQuery);
;
