/***** Javascript Mon Jan 30 17:08:18 CST 2012 *****/
/* ready_begin: */
$(document).ready(function(){
  /* showhide: */
  $(".show_hide").hide();
  $(".show").click(function(){
    $(this).next(".show_hide").slideToggle(600);
  });
  /* fb_fancy: */
  $('a.fancybox').fancybox({
    closeClick    : true,
    titlePosition : 'inside',
    zoomOpacity   : true,
    overlayShow   : true,
    speedIn       : 600,
    speedOut      : 500
  });
  /* fb_plain: */
  $('a.fancygal').fancybox({
    loop          : false,
    closeClick    : true,
    titlePosition : 'inside',
    titleFormat   : function(title, currentArray, currentIndex, currentOpts) {
    return '<span id="fancybox-title-over">' + (currentIndex + 1) + ' / ' + currentArray.length + (title.length ? ' &mdash; ' + title : '') + '</span>';
    }
  });
  /* fb_button: */
  $(".fancybox-button").fancybox({
    prevEffect    : 'fade',
    nextEffect    : 'fade',
    closeBtn      : false,
    closeClick    : true,
    loop          : false,
    helpers       : {
      title       : { type: 'inside' },
      buttons     : {}
    },
    afterLoad     : function() {
      this.title = (this.index + 1) + '/' + this.group.length + (this.title ? ' - ' + this.title : '');
    }
  });
  /* fb_show: */
  $(".fancybox-show").addClass("fancybox-button").fancybox({
    prevEffect    : 'fade',
    nextEffect    : 'fade',
    closeBtn      : false,
    closeClick    : true,
    loop          : true,
    helpers       : {
      title       : { 'type': 'inside' },
      buttons     : {}
    },
    afterLoad     : function() {
      this.title = (this.index + 1) + '/' + this.group.length + (this.title ? ' - ' + this.title : '');
    }
  });
  /* fb_iframe: */
  $("a.iframe").fancybox({
    width         : '75%',
    height        : '75%',
    autoScale     : 'none',
    type          : 'iframe',
    onCleanup     : function() {
      var myContent = this.href;
      $(myContent).unwrap();
    }
  });
  /* fb_inline: */
  $("a.inline").fancybox({
    closeClick    : false
  });
  /* fb_calendar: */
  $("a.calinline").fancybox({
    autoDimensions    : false,
    width             : 280,
    height            : 240,
    transitionIn      : 'none',
    transitionOut     : 'none'
  });
  /* fb_map: */
  $('area.fancy').fancybox({
    closeClick        : true,
    titlePosition     : 'inside',
    titleFormat       : function(title, currentArray, currentIndex, currentOpts) {
      return '<span id="fancybox-title-over">' + (currentIndex + 1) + ' / ' + currentArray.length + (title.length ? ' &mdash; ' + title : '') + '</span>';
    }
  });
  /* spamno: */
  $("a.spamno").each(function() {
    str         = $(this).attr('href');
    var re_at   = new RegExp("/q-q/");
    var re_addr = new RegExp("addr=(.+?)&");
    var re_name = new RegExp("name=(.*)");
    var addr_ar = re_addr.exec(str);
    var addr    = addr_ar[1];
    addr        = addr.replace(re_at,'@').split('').reverse().join('').replace(/\//g, '.');
    var name_ar = re_name.exec(str);
    var name    = name_ar[1];
    $(this).attr('href', 'mailto:' + addr);
    name        = name.replace("(addr)", addr);
    $(this).text(name);
  });
  /* pullquotes: */
  $('span.pql').each(function(index) { 
    var $parentParagraph = $(this).parent('p'); 
    $parentParagraph.css('position', 'relative'); 
    $(this).clone() 
      .addClass('pulled-left') 
      .prependTo($parentParagraph); 
  }); 
  $('span.pqr').each(function(index) { 
    var $parentParagraph = $(this).parent('p'); 
    $parentParagraph.css('position', 'relative'); 
    $(this).clone() 
      .addClass('pulled-right') 
      .prependTo($parentParagraph); 
  });
  /* js_add: */
  $("div.scrollable").scrollable({
    circular: true, 
    speed: 900,
    onBeforeSeek: function() {
        this.getItems().fadeTo(300, 0.2);		
    },
    onSeek: function() {
        this.getItems().fadeTo(300, 1);
    }
  }).autoscroll(3000);
/* ready_end: */
});

