/* *** JQUERY PLUGINS ***
 * jqFancyTransitions - banner ROTATION
 * Enhanced Easy Slider
 * swapImage
 * SearchHighlight
 * Watermark v3.1.3
 */


/**
 * jqFancyTransitions - jQuery plugin
 * @version: 1.8 (2010/06/13)
 * @requires jQuery v1.2.2 or later 
 * @author Ivan Lazarevic
 * Examples and documentation at: http://www.workshop.rs/projects/jqfancytransitions
 
 * Dual licensed under the MIT and GPL licenses:
 *   http://www.opensource.org/licenses/mit-license.php
 *   http://www.gnu.org/licenses/gpl.html
**/

(function($){var opts=new Array;var level=new Array;var img=new Array;var links=new Array;var titles=new Array;var order=new Array;var imgInc=new Array;var inc=new Array;var stripInt=new Array;var imgInt=new Array;$.fn.jqFancyTransitions=$.fn.jqfancytransitions=function(options){init=function(el){opts[el.id]=$.extend({},$.fn.jqFancyTransitions.defaults,options);img[el.id]=new Array();links[el.id]=new Array();titles[el.id]=new Array();order[el.id]=new Array();imgInc[el.id]=0;inc[el.id]=0;params=opts[el.id];if(params.effect=='zipper'){params.direction='alternate';params.position='alternate';}
if(params.effect=='wave'){params.direction='alternate';params.position='top';}
if(params.effect=='curtain'){params.direction='alternate';params.position='curtain';}
stripWidth=parseInt(params.width/params.strips);gap=params.width-stripWidth*params.strips;stripLeft=0;$.each($('#'+el.id+' img'),function(i,item){img[el.id][i]=$(item).attr('src');links[el.id][i]=$(item).next().attr('href');titles[el.id][i]=$(item).attr('alt')?$(item).attr('alt'):'';$(item).hide();});$('#'+el.id).css({'background-image':'url('+img[el.id][0]+')','width':params.width,'height':params.height,'position':'relative','background-position':'top left'});$('#'+el.id).append("<div class='ft-title' id='ft-title-"+el.id+"' style='position: absolute; bottom:0; left: 0; z-index: 1000; color: #fff; background-color: #000; '>"+titles[el.id][0]+"</div>");if(titles[el.id][imgInc[el.id]])
$('#ft-title-'+el.id).css('opacity',opts[el.id].titleOpacity);else
$('#ft-title-'+el.id).css('opacity',0);if(params.navigation){$.navigation(el);$('#ft-buttons-'+el.id).children().first().addClass('ft-button-'+el.id+'-active');}
odd=1;for(j=1;j<params.strips+1;j++){if(gap>0){tstripWidth=stripWidth+1;gap--;}else{tstripWidth=stripWidth;}
if(params.links)
$('#'+el.id).append("<a href='"+links[el.id][0]+"' class='ft-"+el.id+"' id='ft-"+el.id+j+"' style='width:"+tstripWidth+"px; height:"+params.height+"px; float: left; position: absolute;outline:none;'></a>");else
$('#'+el.id).append("<div class='ft-"+el.id+"' id='ft-"+el.id+j+"' style='width:"+tstripWidth+"px; height:"+params.height+"px; float: left; position: absolute;'></div>");$("#ft-"+el.id+j).css({'background-position':-stripLeft+'px top','left':stripLeft});stripLeft+=tstripWidth;if(params.position=='bottom')
$("#ft-"+el.id+j).css('bottom',0);if(j%2==0&&params.position=='alternate')
$("#ft-"+el.id+j).css('bottom',0);if(params.direction=='fountain'||params.direction=='fountainAlternate'){order[el.id][j-1]=parseInt(params.strips/2)-(parseInt(j/2)*odd);order[el.id][params.strips-1]=params.strips;odd*=-1;}else{order[el.id][j-1]=j;}}
$('.ft-'+el.id).mouseover(function(){opts[el.id].pause=true;});$('.ft-'+el.id).mouseout(function(){opts[el.id].pause=false;});$('#ft-title-'+el.id).mouseover(function(){opts[el.id].pause=true;});$('#ft-title-'+el.id).mouseout(function(){opts[el.id].pause=false;});clearInterval(imgInt[el.id]);imgInt[el.id]=setInterval(function(){$.transition(el)},params.delay+params.stripDelay*params.strips);};$.transition=function(el,direction){if(opts[el.id].pause==true)return;stripInt[el.id]=setInterval(function(){$.strips(order[el.id][inc[el.id]],el)},opts[el.id].stripDelay);$('#'+el.id).css({'background-image':'url('+img[el.id][imgInc[el.id]]+')'});if(typeof(direction)=="undefined")
imgInc[el.id]++;else
if(direction=='prev')
imgInc[el.id]--;else
imgInc[el.id]=direction;if(imgInc[el.id]==img[el.id].length){imgInc[el.id]=0;}
if(imgInc[el.id]==-1){imgInc[el.id]=img[el.id].length-1;}
if(titles[el.id][imgInc[el.id]]!=''){$('#ft-title-'+el.id).animate({opacity:0},opts[el.id].titleSpeed,function(){$(this).html(titles[el.id][imgInc[el.id]]).animate({opacity:opts[el.id].titleOpacity},opts[el.id].titleSpeed);});}else{$('#ft-title-'+el.id).animate({opacity:0},opts[el.id].titleSpeed);}
inc[el.id]=0;buttons=$('#ft-buttons-'+el.id).children();buttons.each(function(index){if(index==imgInc[el.id]){$(this).addClass('ft-button-'+el.id+'-active');}else{$(this).removeClass('ft-button-'+el.id+'-active');}});if(opts[el.id].direction=='random')
$.fisherYates(order[el.id]);if((opts[el.id].direction=='right'&&order[el.id][0]==1)||opts[el.id].direction=='alternate'||opts[el.id].direction=='fountainAlternate')
order[el.id].reverse();};$.strips=function(itemId,el){temp=opts[el.id].strips;if(inc[el.id]==temp){clearInterval(stripInt[el.id]);return;}
$('.ft-'+el.id).attr('href',links[el.id][imgInc[el.id]]);if(opts[el.id].position=='curtain'){currWidth=$('#ft-'+el.id+itemId).width();$('#ft-'+el.id+itemId).css({width:0,opacity:0,'background-image':'url('+img[el.id][imgInc[el.id]]+')'});$('#ft-'+el.id+itemId).animate({width:currWidth,opacity:1},1000);}else{$('#ft-'+el.id+itemId).css({height:0,opacity:0,'background-image':'url('+img[el.id][imgInc[el.id]]+')'});$('#ft-'+el.id+itemId).animate({height:opts[el.id].height,opacity:1},1000);}
inc[el.id]++;};$.navigation=function(el){$('#'+el.id).append("<a href='#' id='ft-prev-"+el.id+"' class='ft-prev'>prev</a>");$('#'+el.id).append("<a href='#' id='ft-next-"+el.id+"' class='ft-next'>next</a>");$('#ft-prev-'+el.id).css({'position':'absolute','top':params.height/2-15,'left':0,'z-index':1001,'line-height':'30px','opacity':0.7}).click(function(e){e.preventDefault();$.transition(el,'prev');clearInterval(imgInt[el.id]);imgInt[el.id]=setInterval(function(){$.transition(el)},params.delay+params.stripDelay*params.strips);});$('#ft-next-'+el.id).css({'position':'absolute','top':params.height/2-15,'right':0,'z-index':1001,'line-height':'30px','opacity':0.7}).click(function(e){e.preventDefault();$.transition(el);clearInterval(imgInt[el.id]);imgInt[el.id]=setInterval(function(){$.transition(el)},params.delay+params.stripDelay*params.strips);});$("<div id='ft-buttons-"+el.id+"'></div>").insertAfter($('#'+el.id));$('#ft-buttons-'+el.id).css({'text-align':'right','padding-top':5,'width':opts[el.id].width});for(k=1;k<img[el.id].length+1;k++){$('#ft-buttons-'+el.id).append("<a href='#' class='ft-button-"+el.id+"'>"+k+"</a>");}
$('.ft-button-'+el.id).css({'padding':5});$.each($('.ft-button-'+el.id),function(i,item){$(item).click(function(e){e.preventDefault();$.transition(el,i);clearInterval(imgInt[el.id]);imgInt[el.id]=setInterval(function(){$.transition(el)},params.delay+params.stripDelay*params.strips);})});}
$.fisherYates=function(arr){var i=arr.length;if(i==0)return false;while(--i){var j=Math.floor(Math.random()*(i+1));var tempi=arr[i];var tempj=arr[j];arr[i]=tempj;arr[j]=tempi;}}
this.each(function(){init(this);});};$.fn.jqFancyTransitions.defaults={width:500,height:332,strips:10,delay:5000,stripDelay:50,titleOpacity:0.7,titleSpeed:1000,position:'alternate',direction:'fountainAlternate',effect:'',navigation:false,links:false};})(jQuery);

/*
 *  Enhanced Easy Slider
 *
 *  Built off of the Easy Slider - jQuery plugin
 *  written by Alen Grakalic
 *  http://cssglobe.com/post/3783/jquery-plugin-easy-image-or-content-slider
 *
 *  enhancements by Joseph Pecoraro
 *  email: joepeck02@gmail.com
 *  http://blog.bogojoker.com
 *
 *  The Easy Slider Copyrights:
 *  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
 *
 */

/*
 *  Quick Documentation of New Features
 *
 *    * Non-Autogenerated Pagination - set the autogeneratePagination
 *      option to false in the easySlide options and be sure to provide
 *      id's in the prevId and nextId options.  Those provided ids will
 *      unobtrusively get the easySlide actions applied to them.
 *
 *    * Looping - just set the loop option to true in the easySlide
 *      options and you will be able to navigate forward/backward around
 *      the ends smoothly.
 *
 *    * Autoplay - just set the autoplayDuration to a non-zero value
 *      in the easySlide options and the content will slide on its own.
 *      The value you provide will only be the value between animations,
 *      so you don't have to compensate for the speed of transitions,
 *      that is handled automatically.  Autoplaying works fine with
 *      looping.
 *
 *      If you have pagination buttons, when the user clicks a button
 *      the autoplay will suspend for a little while.  The restartDuration
 *      value specifies the amount of time since the last user
 *      interruption to wait before restarting the autoplay.
 *
 *    * Hovering - just set hover to true and pagination will trigger
 *      when hovering instead of clicking.  The slides will continue to
 *      transition as long as you hover over the pagination element.
 *      Hovering works fine with looping.
 *
 *      If you want a pause between slides you can set the hoverPause
 *      value to an integer greater than 0.  That specifies the time
 *      to wait between transitions.
 *
 *    * Linear or Swing easing - jQuery offers two different styles
 *      of animations.  Just set the easing option to 'linear' or
 *      'swing' (default)and it will use that easing style.
 *
 *    * Pauseable - Pause autoplay by hovering over an image.  Likewise
 *      you can extend this to pause when hovering the buttons as well.
 *
 *    * Fade Orientation - Not Vertical or Horizontal Slideing, but Fading!
 *      Just provide orientation: 'fade' for fading to happen.
 *
 *    * Callbacks - You are allowed to provide your own functions for
 *      events triggered by the slider.  You can provide a function
 *      for 'beforeTransition' and 'afterTransition'.  Their signature
 *      is as follows:
 *
 *          function callback( slideNumber, jQuery_li, jQuery_ul )
 *                                 ^            ^         ^
 *                                 |            |         |
 *     int of the slide number -----            |         |
 *     jQuery wrapper for the now showing <li> --         |
 *     jQuery wrapper for the entire <ul> of all slides ---
 *
 *       For example, to get the explicit DOM <li> Node you could do
 *
 *          function after(num, $li, $ul) {
 *            dom_li = $li[0];
 *            console.log(dom_li);
 *          }
 *
 */

(function($) {

  $.fn.easySlider = function(options){

    // default configuration properties
    var defaults = {
      prevId: 'prevBtn',             // id of the element to apply prev rules to
      nextId: 'nextBtn',             // id of the element to apply next rules to
      prevText: 'Previous',          // text for autogenerated prev link
      nextText: 'Next',              // text for autogenerated next link
      autogeneratePagination: false, // will automatically generate pagination links
      orientation: '',               // 'vertical', 'fade', or anything else will assume horizontal
      speed: 800,                    // duration of a transition
      autoplayDuration: 0,           // auto-play if non-zero, this is the time between transitions
      restartDuration: 2500,         // time to restart autoplay after a user interupts and autoplay
      loop: false,                   // loop around the content
      hoverPause: 0,                 // when hovering, the time between transitions
      hover: false,                  // on hover instead of onclick
      easing: null,                  // jQuery animation settings 'linear' or 'swing' (default)
      pauseable: false,              // pause autoplay when hovering the image
      pauseButtons: false,           // hovering over the cuttons will pause as well
      beforeTransition: null,        // callback before transitioning
      afterTransition: null          // callback after transitioning
    };

    var options = $.extend(defaults, options);

    return this.each(function() {

      // Setup Measurements and Options
      var obj = $(this),
          totalSlides  = $("li", obj).length,
          slideWidth   = obj.width(),
          slideHeight  = obj.height(),
          lastSlide    = totalSlides-1,
          current      = 0;

      // States
      var vertical         = (options.orientation == 'vertical'),
          fade             = (options.orientation == 'fade'),
          horizontal       = (!vertical && !fade),
          autogen          = options.autogeneratePagination,
          pauseable        = options.pauseable,
          loop             = options.loop,
          speed            = options.speed,
          easing           = options.easing,
          hover            = options.hover,
          hoverPause       = options.hoverPause,
          buttonsPause     = options.pauseButtons,
          restartDuration  = options.restartDuration,
          autoplayDuration = Math.max(options.autoplayDuration,25)+speed,
          autoplay         = (options.autoplayDuration > 0),
          beforeTransition = options.beforeTransition,
          afterTransition  = options.afterTransition;
          interval         = null,
          restart          = null;

      // Autogenerate Pagination
      if (autogen) {
        $(obj).after( '<div id="prevBtn"><a href=\"javascript:void(0);\">'+options.prevText+'</a> &nbsp;&nbsp;'+
                      '<a href=\"javascript:void(0);\">'+options.nextText+'</a></div>');
      }

      // Important Elements
      var $ul   = $("ul", obj),
          $next = $("#"+options.nextId),
          $prev = $("#"+options.prevId);

      // Loop - Duplicate the First Slide onto the end
      if (loop) {
        $ul.append( $("li:first", obj).clone() );
        totalSlides += 1;
        lastSlide += 1;
      }

      // Horizontal - Make them float left and set the width of the ul (for all slides)
      if (horizontal) {
        $("li", obj).css('float','left');
        $ul.css('width', totalSlides * slideWidth);
      }

      // Fade - Hide all but the first slide so they can fadeIn from nothing
      if (fade) {
        $ul.find("li:not(:first)").hide();
      }

      // Reusable Closure to pause the autoplay timer
      var pauseFunc = function() {
        clearInterval(interval);
        clearTimeout(restart);
      }

      // Reusable Closure to restart the autoplay timers using the restartDuration
      var restartFunc = function() {
        restart = setTimeout(function() {
          interval = setInterval(auto, autoplayDuration);
        }, restartDuration);
      };

      // Pauseable (should be autoplay only, but would have no effect otherwise)
      // On Hover: cancel the autoplay timers
      // On Leave: restart the autoplay timers
      if ( pauseable && autoplay ) {
        $(obj).hover(pauseFunc, restartFunc);
        if ( buttonsPause ) {
          $next.hover(pauseFunc, restartFunc);
          $prev.hover(pauseFunc, restartFunc);
        }
      }

      // Add Actions to Next and Prev Buttons
      // If Not Hover Mode made it click(), if it is Hover Mode, make it hover()
      // When in autoplay mode make next/prev reset the autoplay timers
      if ( !hover ) {

        $next.click(function(){
          if (autoplay) {
            pauseFunc();
            if ( !buttonsPause ) {
              restartFunc();
            }
          };
          animate("next");
        });

        $prev.click(function(){
          if (autoplay) {
            pauseFunc();
            if ( !buttonsPause ) {
              restartFunc();
            }
          };
          animate("prev");
        });

      } else {

        var hoverNext = false,
            hoverPrev = false,
            isAnimating = false;

        $next.hover(
          function() {
            var tfunc = arguments.callee;
            hoverNext = true;
            if ( !isAnimating ) {
              isAnimating = true;
              animate("next", function() {
                isAnimating = false;
                if ( hoverNext ) { tfunc(); }
              });
            }
          },
          function() {
            hoverNext = false;
          }
        );

        $prev.hover(
          function() {
            var tfunc = arguments.callee;
            hoverPrev = true;
            if ( !isAnimating ) {
              isAnimating = true;
              animate("prev", function() {
                isAnimating = false;
                if ( hoverPrev ) { tfunc(); }
              });
            }
          },
          function() {
            hoverPrev = false;
          }
        );

      }


      //
      // Enclosed Slide Animation
      //
      // This handles all of the sliding/faiding animation
      // @param dir the direction "next" or "prev"
      // @param cb the callback function
      //
      function animate(dir, cb) {

        // Before Transition, Guarantee
        if ( beforeTransition ) {
          beforeTransition( current, $ul.find('li:eq('+current+')'), $ul );
        }


        // After Transition, Guarantee
        // Setup the next have
        // NOTE: That current will be the new value when this is called
        // due to it being a closure!
        var newcb = function() {
          if ( cb != null ) {
            ( hoverPause == 0 ) ? cb() : setTimeout(cb, hoverPause);
          }
          if ( afterTransition ) {
            afterTransition( current, $ul.find('li:eq('+current+')'), $ul );
          }
        }


        // cur, nex, and update "current"
        // cur is the old current slide, the slide we are currently on
        // nex is the new current slide, the slide we are transitioning too
        // current is a global value that gets updated right here
        var cur = current;
        if ( loop ) {
          if ( dir == 'next' ) {
            current = (current==lastSlide) ? 1 : current+1;
          } else {
            current = (current==0) ? lastSlide-1 : current-1;
          }
        } else {
          if (dir == "next") {
            current = (current>=lastSlide) ? lastSlide : current+1;
          } else {
            current = (current<=0) ? 0 : current-1;
          }
        }
        var nex = current;


        // Special Case for looping
        // If at the end and going forward, instantaneous jump to the first slide
        // If at the start and going backward, instantaneous jump to the last slide
        // NOTE: The instantaneous jump is an animate() so jQuery handles it in tune
        // with the rest of the animations, and is -1 (not 0) time so its instant.
        if ( loop ) {
          if ( (dir == "next") && (cur == lastSlide) ) {
            (vertical) ?
              $ul.animate({marginTop:0}, -1) :
              $ul.animate({marginLeft:0}, -1);
          } else if ( (dir == "prev") && (cur == 0) ) {
            (vertical) ?
              $ul.animate({marginTop:(totalSlides-1)*slideHeight*-1}, -1) :
              $ul.animate({marginLeft:(totalSlides-1)*slideWidth*-1}, -1);
          }
        }


        // Dispatch jQuery Animation for the transition
        // Slide horizontally, vertically, or fade
        if ( horizontal ) {
          $ul.animate( { marginLeft: (nex*slideWidth*-1)  }, speed, easing, newcb );
        } else if ( vertical ) {
          $ul.animate( { marginTop:  (nex*slideHeight*-1) }, speed, easing, newcb );
        } else {
          var curli = 'li:eq(' + cur + ')';
          var nexli = 'li:eq(' + nex + ')';
          $ul.find(curli).fadeOut("slow", function() {
            $ul.find(nexli).fadeIn("slow", newcb);
          });
        }


        // Correctly show the Next/Prev links
        // When looping they always show, so we can ignore that
        // If at the end, hide the next link
        // If at the start, hide the previous link
        // Any other case we can show both links
        if ( !loop ) {
          if ( nex <= 0 ) {
            $prev.fadeOut();
          } else if ( nex >= lastSlide ) {
            $next.fadeOut();
          } else {
            $next.fadeIn();
            $prev.fadeIn();
          }
        }

      };


      //
      // Autoplay
      //
      // Note that autoplayDuration already has the transitionDuration
      // added to it (to prevent doing the addition over and over).
      // However that means that the first invokation would take
      // autoplayDuration+transitionDuration.  We remove that extra
      // wait by first doing a single setTimeout with the correct
      // time, followed by the correct setInterval.
      //
      if ( autoplay ) {
        var auto = function() {
          animate('next');
          if ( !loop && current>=lastSlide ) {
            clearInterval(interval);
          }
        }
        restart = setTimeout(function() {
          auto();
          interval = setInterval(auto, autoplayDuration);
        }, autoplayDuration-speed);
      }


      // Initially Hide both buttons
      $next.hide();
      $prev.hide();

      // Finally, Display the Next Link if more then one slide
      if (totalSlides>1) {
        $next.fadeIn();
        if(loop) { $prev.fadeIn(); }
      }

    });

  };

})(jQuery);
/*
 * swapImage - jQuery plugin for swapping image
 *
 * Copyright (c) 2010 tszming (tszming@gmail.com)
 *
 * Dual licensed under the MIT and GPL licenses:
 * http://www.opensource.org/licenses/mit-license.php
 * http://www.gnu.org/licenses/gpl.html
 *
 */
(function(a){a.swapImage=function(c,b,e,f,d){a.swapImage.files={};a.swapImage.data={};a.swapImage.uuid=0;a.swapImage.init=function(){var h=++a.swapImage.uuid;a(this).attr("swapImageId",h);var g=a(this).metadata();a.swapImage.data[h]=a.swapImage.data[h]||{};if(typeof g.src!="undefined"){a.swapImage.data[h]["src"]=g.src;a.swapImage.files[g.src]=false}a.each(a.grep([[g.sin,"sin"],[g.sout,"sout"]],function(i){return(typeof i[0]!="undefined"&&i[0].length>0)}),function(){var k=this[0];var o=this[1];for(var m=0;m<k.length;m++){var j=g[o][m].indexOf(":");var n=g[o][m].substring(0,j);var l=g[o][m].substring(j+1);a.swapImage.data[h][o]=a.swapImage.data[h][o]||[];if(j>1){a.swapImage.data[h][o].push([n,l]);a.swapImage.files[l]=false}else{a.swapImage.data[h][o].push([l])}}})};a.swapImage.preload=function(){a.each(a.swapImage.files,function(i,h){if(h==false){a.swapImage.files[i]=true;var g=new Image();g.src=i}})};a.swapImage.swapIn=function(){a.swapImage.swap(this,"sin")};a.swapImage.swapOut=function(){a.swapImage.swap(this,"sout")};a.swapImage.swap=function(j,g){var k=a(j).attr("swapImageId");if(typeof a.swapImage.data[k][g]!="undefined"){for(var h=0;h<a.swapImage.data[k][g].length;h++){if(a.swapImage.data[k][g][h].length>1){a(a.swapImage.data[k][g][h][0]).attr("src",a.swapImage.data[k][g][h][1])}else{a(a.swapImage.data[k][g][h][0]).each(a.swapImage._swap)}}}else{a.swapImage._swap.call(j)}};a.swapImage._swap=function(i){var j=a(this).attr("swapImageId");var h=a.swapImage.data[j];if(typeof h.src!="undefined"){var g=h.src;h.src=this.src;this.src=g}};a(document).ready(function(){if(typeof e=="undefined"){e=true}if(typeof b=="undefined"){b=true}a(c).each(a.swapImage.init);if(typeof f=="undefined"&&typeof f=="undefined"){f="mouseenter";d="mouseleave"}if(e){if(typeof d!="undefined"){a(c).bind(f,a.swapImage.swapIn).bind(d,a.swapImage.swapOut)}else{a(c).bind(f,a.swapImage.swapIn)}}else{a(c).one(f,a.swapImage.swapIn)}if(b){a(c).each(a.swapImage.preload)}})}})(jQuery);


/*
	Watermark v3.1.3 (March 22, 2011) plugin for jQuery
	http://jquery-watermark.googlecode.com/
	Copyright (c) 2009-2011 Todd Northrop
	http://www.speednet.biz/
	Dual licensed under the MIT or GPL Version 2 licenses.
*/
(function(a,h,y){var w="function",v="password",j="maxLength",n="type",b="",c=true,u="placeholder",i=false,t="watermark",g=t,f="watermarkClass",q="watermarkFocus",l="watermarkSubmit",o="watermarkMaxLength",e="watermarkPassword",d="watermarkText",k=/\r/g,s="input:data("+g+"),textarea:data("+g+")",m="input:text,input:password,input[type=search],input:not([type]),textarea",p=["Page_ClientValidate"],r=i,x=u in document.createElement("input");a.watermark=a.watermark||{version:"3.1.3",runOnce:c,options:{className:t,useNative:c,hideBeforeUnload:c},hide:function(b){a(b).filter(s).each(function(){a.watermark._hide(a(this))})},_hide:function(a,r){var p=a[0],q=(p.value||b).replace(k,b),l=a.data(d)||b,m=a.data(o)||0,i=a.data(f);if(l.length&&q==l){p.value=b;if(a.data(e))if((a.attr(n)||b)==="text"){var g=a.data(e)||[],c=a.parent()||[];if(g.length&&c.length){c[0].removeChild(a[0]);c[0].appendChild(g[0]);a=g}}if(m){a.attr(j,m);a.removeData(o)}if(r){a.attr("autocomplete","off");h.setTimeout(function(){a.select()},1)}}i&&a.removeClass(i)},show:function(b){a(b).filter(s).each(function(){a.watermark._show(a(this))})},_show:function(g){var p=g[0],u=(p.value||b).replace(k,b),h=g.data(d)||b,s=g.attr(n)||b,t=g.data(f);if((u.length==0||u==h)&&!g.data(q)){r=c;if(g.data(e))if(s===v){var m=g.data(e)||[],l=g.parent()||[];if(m.length&&l.length){l[0].removeChild(g[0]);l[0].appendChild(m[0]);g=m;g.attr(j,h.length);p=g[0]}}if(s==="text"||s==="search"){var i=g.attr(j)||0;if(i>0&&h.length>i){g.data(o,i);g.attr(j,h.length)}}t&&g.addClass(t);p.value=h}else a.watermark._hide(g)},hideAll:function(){if(r){a.watermark.hide(m);r=i}},showAll:function(){a.watermark.show(m)}};a.fn.watermark=a.fn.watermark||function(p,o){var t="string";if(!this.length)return this;var s=i,r=typeof p===t;if(r)p=p.replace(k,b);if(typeof o==="object"){s=typeof o.className===t;o=a.extend({},a.watermark.options,o)}else if(typeof o===t){s=c;o=a.extend({},a.watermark.options,{className:o})}else o=a.watermark.options;if(typeof o.useNative!==w)o.useNative=o.useNative?function(){return c}:function(){return i};return this.each(function(){var B="dragleave",A="dragenter",z=this,i=a(z);if(!i.is(m))return;if(i.data(g)){if(r||s){a.watermark._hide(i);r&&i.data(d,p);s&&i.data(f,o.className)}}else{if(x&&o.useNative.call(z,i)&&(i.attr("tagName")||b)!=="TEXTAREA"){r&&i.attr(u,p);return}i.data(d,r?p:b);i.data(f,o.className);i.data(g,1);if((i.attr(n)||b)===v){var C=i.wrap("<span>").parent(),t=a(C.html().replace(/type=["']?password["']?/i,'type="text"'));t.data(d,i.data(d));t.data(f,i.data(f));t.data(g,1);t.attr(j,p.length);t.focus(function(){a.watermark._hide(t,c)}).bind(A,function(){a.watermark._hide(t)}).bind("dragend",function(){h.setTimeout(function(){t.blur()},1)});i.blur(function(){a.watermark._show(i)}).bind(B,function(){a.watermark._show(i)});t.data(e,i);i.data(e,t)}else i.focus(function(){i.data(q,1);a.watermark._hide(i,c)}).blur(function(){i.data(q,0);a.watermark._show(i)}).bind(A,function(){a.watermark._hide(i)}).bind(B,function(){a.watermark._show(i)}).bind("dragend",function(){h.setTimeout(function(){a.watermark._show(i)},1)}).bind("drop",function(e){var c=i[0],a=e.originalEvent.dataTransfer.getData("Text");if((c.value||b).replace(k,b).replace(a,b)===i.data(d))c.value=a;i.focus()});if(z.form){var w=z.form,y=a(w);if(!y.data(l)){y.submit(a.watermark.hideAll);if(w.submit){y.data(l,w.submit);w.submit=function(c,b){return function(){var d=b.data(l);a.watermark.hideAll();if(d.apply)d.apply(c,Array.prototype.slice.call(arguments));else d()}}(w,y)}else{y.data(l,1);w.submit=function(b){return function(){a.watermark.hideAll();delete b.submit;b.submit()}}(w)}}}}a.watermark._show(i)})};if(a.watermark.runOnce){a.watermark.runOnce=i;a.extend(a.expr[":"],{data:function(c,d,b){return!!a.data(c,b[3])}});(function(c){a.fn.val=function(){var e=this;if(!e.length)return arguments.length?e:y;if(!arguments.length)if(e.data(g)){var f=(e[0].value||b).replace(k,b);return f===(e.data(d)||b)?b:f}else return c.apply(e,arguments);else{c.apply(e,arguments);a.watermark.show(e);return e}}})(a.fn.val);p.length&&a(function(){for(var b,c,d=p.length-1;d>=0;d--){b=p[d];c=h[b];if(typeof c===w)h[b]=function(b){return function(){a.watermark.hideAll();return b.apply(null,Array.prototype.slice.call(arguments))}}(c)}});a(h).bind("beforeunload",function(){a.watermark.options.hideBeforeUnload&&a.watermark.hideAll()})}})(jQuery,window);
