PageSourceSearch

https://www.coxhardware.com/jscripts/Custom2.js

js coxhardware.com collected 2026-09-26 18:43:44 UTC 46,404 bytes, 1,260 lines download raw bytes

1/**
2* hoverIntent is similar to jQuery's built-in "hover" function except that
3* instead of firing the onMouseOver event immediately, hoverIntent checks
4* to see if the user's mouse has slowed down (beneath the sensitivity
5* threshold) before firing the onMouseOver event.
6* 
7* hoverIntent r5 // 2007.03.27 // jQuery 1.1.2
8* <http://cherne.net/brian/resources/jquery.hoverIntent.html>
9* 
10* hoverIntent is currently available for use in all personal or commercial 
11* projects under both MIT and GPL licenses. This means that you can choose 
12* the license that best suits your project, and use it accordingly.
13* 
14* // basic usage (just like .hover) receives onMouseOver and onMouseOut functions
15* $("ul li").hoverIntent( showNav , hideNav );
16* 
17* // advanced usage receives configuration object only
18* $("ul li").hoverIntent({
19*	sensitivity: 2, // number = sensitivity threshold (must be 1 or higher)
20*	interval: 50,   // number = milliseconds of polling interval
21*	over: showNav,  // function = onMouseOver callback (required)
22*	timeout: 100,   // number = milliseconds delay before onMouseOut function call
23*	out: hideNav    // function = onMouseOut callback (required)
24* });
25* 
26* @param  f  onMouseOver function || An object with configuration options
27* @param  g  onMouseOut function  || Nothing (use configuration options object)
28* @return    The object (aka "this") that called hoverIntent, and the event object
29* @author    Brian Cherne <[email protected]>
30* 
31* modified by Karl Swedberg. Namespaced events in order to work better with clueTip plugin
32*/
33(function($) {
34	$.fn.hoverIntent = function(f,g) {
35		// default configuration options
36		var cfg = {
37			sensitivity: 7,
38			interval: 100,
39			timeout: 0
40		};
41		// override configuration options with user supplied object
42		cfg = $.extend(cfg, g ? { over: f, out: g } : f );
43
44		// instantiate variables
45		// cX, cY = current X and Y position of mouse, updated by mousemove event
46		// pX, pY = previous X and Y position of mouse, set by mouseover and polling interval
47		var cX, cY, pX, pY;
48
49		// A private function for getting mouse position
50		var track = function(ev) {
51			cX = ev.pageX;
52			cY = ev.pageY;
53		};
54
55		// A private function for comparing current and previous mouse position
56		var compare = function(ev,ob) {
57			ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t);
58			// compare mouse positions to see if they've crossed the threshold
59			if ( ( Math.abs(pX-cX) + Math.abs(pY-cY) ) < cfg.sensitivity ) {
60				$(ob).unbind("mousemove",track);
61				// set hoverIntent state to true (so mouseOut can be called)
62				ob.hoverIntent_s = 1;
63				return cfg.over.apply(ob,[ev]);
64			} else {
65				// set previous coordinates for next time
66				pX = cX; pY = cY;
67				// use self-calling timeout, guarantees intervals are spaced out properly (avoids JavaScript timer bugs)
68				ob.hoverIntent_t = setTimeout( function(){compare(ev, ob);} , cfg.interval );
69			}
70		};
71
72		// A private function for delaying the mouseOut function
73		var delay = function(ev,ob) {
74			ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t);
75			ob.hoverIntent_s = 0;
76			return cfg.out.apply(ob,[ev]);
77		};
78
79		// A private function for handling mouse 'hovering'
80		var handleHover = function(e) {
81			// next three lines copied from jQuery.hover, ignore children onMouseOver/onMouseOut
82			var p = (e.type == "mouseover" ? e.fromElement : e.toElement) || e.relatedTarget;
83			while ( p && p != this ) { try { p = p.parentNode; } catch(e) { p = this; } }
84			if ( p == this ) { return false; }
85
86			// copy objects to be passed into t (required for event object to be passed in IE)
87			var ev = jQuery.extend({},e);
88			var ob = this;
89
90			// cancel hoverIntent timer if it exists
91			if (ob.hoverIntent_t) { ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t); }
92
93			// else e.type == "onmouseover"
94			if (e.type == "mouseover") {
95				// set "previous" X and Y position based on initial entry point
96				pX = ev.pageX; pY = ev.pageY;
97				// update "current" X and Y position based on mousemove
98				$(ob).bind("mousemove.cluetip",track);
99				// start polling interval (self-calling timeout) to compare mouse coordinates over time
100				if (ob.hoverIntent_s != 1) { ob.hoverIntent_t = setTimeout( function(){compare(ev,ob);} , cfg.interval );}
101
102			// else e.type == "onmouseout"
103			} else {
104				// unbind expensive mousemove event
105				$(ob).unbind("mousemove.cluetip",track);
106				// if hoverIntent state is true, then call the mouseOut function after the specified delay
107				if (ob.hoverIntent_s == 1) { ob.hoverIntent_t = setTimeout( function(){delay(ev,ob);} , cfg.timeout );}
108			}
109		};
110
111		// bind the function to the two event listeners
112		return this.bind('mouseover.cluetip', handleHover).bind('mouseout.cluetip', handleHover);
113	};
114})(jQuery);
115
116
117/*!
118 * clueTip - v1.2.10 - 2013-09-29
119 * http://plugins.learningjquery.com/cluetip/
120 * Copyright (c) 2013 Karl Swedberg
121 * Licensed MIT (http://www.opensource.org/licenses/mit-license.php)
122 */
123
124(function($) {
125
126  $.cluetip = {
127    version: '1.2.10',
128
129    // the HTML that will be used for the tooltip
130    template: ['<div>',
131      '<div class="cluetip-outer">',
132        '<h3 class="cluetip-title ui-widget-header ui-cluetip-header"></h3>',
133        '<div class="cluetip-inner ui-widget-content ui-cluetip-content"></div>',
134      '</div>',
135      '<div class="cluetip-extra"></div>',
136    '</div>'].join(''),
137
138    /* clueTip setup
139     *  the setup options are applied each time .cluetip() is called,
140     *  BUT only if <div id="cluetip"> is not already in the document
141    */
142    setup: {
143      // method to be used for inserting the clueTip into the DOM.
144      // Permitted values are 'appendTo', 'prependTo', 'insertBefore', and 'insertAfter'
145      insertionType: 'appendTo',
146      // element in the DOM the plugin will reference when inserting the clueTip.
147      insertionElement: 'body'
148    },
149
150    /*
151     * clueTip options
152     *
153     * each one can be explicitly overridden by changing its value.
154     * for example: $.cluetip.defaults.width = 200;
155     *         or: $.fn.cluetip.defaults.width = 200; // for compatibility with previous clueTip versions
156     * would change the default width for all clueTips to 200.
157     *
158     * each one can also be overridden by passing an options map to the cluetip method.
159     * for example: $('a.example').cluetip({width: 200});
160     * would change the default width to 200 for clueTips invoked by a link with class of "example"
161     *
162    */
163    defaults: {
164      multiple:         false,    // Allow a new tooltip to be created for each .cluetip() call
165      width:            275,      // The width of the clueTip
166      height:           'auto',   // The height of the clueTip
167      cluezIndex:       97,       // Sets the z-index style property of the clueTip
168      positionBy:       'auto',   // Sets the type of positioning: 'auto', 'mouse','bottomTop', 'topBottom', fixed'
169      topOffset:        15,       // Number of px to offset clueTip from top of invoking element
170      leftOffset:       15,       // Number of px to offset clueTip from left of invoking element
171      snapToEdge:       false,    // For bottomTop and topBottom, snap to the top or bottom of the element.
172      local:            false,    // Whether to use content from the same page for the clueTip's body
173      localPrefix:      null,     // string to be prepended to the tip attribute if local is true
174      localIdSuffix:    null,     // string to be appended to the cluetip content element's id if local is true
175      hideLocal:        true,     // If local option is set to true, this determines whether local content
176                                  // to be shown in clueTip should be hidden at its original location
177      attribute:        'rel',    // the attribute to be used for fetching the clueTip's body content
178      titleAttribute:   'title',  // the attribute to be used for fetching the clueTip's title
179      splitTitle:       '',       // A character used to split the title attribute into the clueTip title and divs
180                                  // within the clueTip body. more info below [6]
181      escapeTitle:      false,    // whether to html escape the title attribute
182      showTitle:        true,     // show title bar of the clueTip, even if title attribute not set
183      cluetipClass:     'default',// class added to outermost clueTip div in the form of 'cluetip-' + clueTipClass.
184      hoverClass:       '',       // class applied to the invoking element onmouseover and removed onmouseout
185      waitImage:        true,     // whether to show a "loading" img, which is set in jquery.cluetip.css
186      cursor:           'help',
187      arrows:           false,    // if true, displays arrow on appropriate side of clueTip
188      dropShadow:       true,     // set to false if you don't want the drop-shadow effect on the clueTip
189      dropShadowSteps:  6,        // adjusts the size of the drop shadow
190      sticky:           false,    // keep visible until manually closed
191      mouseOutClose:    false,    // close when clueTip is moused out: false, 'cluetip', 'link', 'both'
192      delayedClose:     50,        // close clueTip on a timed delay
193      activation:       'hover',  // set to 'click' to force user to click to show clueTip
194                                  // set to 'focus' to show on focus of a form element and hide on blur
195      clickThrough:     true,    // if true, and activation is not 'click', then clicking on link will take user to the link's href,
196                                  // even if href and tipAttribute are equal
197      tracking:         false,    // if true, clueTip will track mouse movement (experimental)
198      closePosition:    'top',    // location of close text for sticky cluetips; can be 'top', 'bottom', 'title' or 'none'
199      closeText:        'Close',  // text (or HTML) to to be clicked to close sticky clueTips
200      truncate:         0,        // number of characters to truncate clueTip's contents. if 0, no truncation occurs
201
202      // effect and speed for opening clueTips
203      fx: {
204                        open:       'show', // can be 'show' or 'slideDown' or 'fadeIn'
205                        openSpeed:  ''
206      },
207
208      // settings for when hoverIntent plugin is used
209      hoverIntent: {
210                        sensitivity:  3,
211                        interval:     50,
212                        timeout:      0
213      },
214
215      // short-circuit function to run just before clueTip is shown.
216      onActivate:       function(e) {return true;},
217      // function to run just after clueTip is shown.
218      onShow:           function(ct, ci){},
219      // function to run just after clueTip is hidden.
220      onHide:           function(ct, ci){},
221      // whether to cache results of ajax request to avoid unnecessary hits to server
222      ajaxCache:        true,
223
224      // process data retrieved via xhr before it's displayed
225      ajaxProcess:      function(data) {
226                          data = data.replace(/<(script|style|title)[^<]+<\/(script|style|title)>/gm, '').replace(/<(link|meta)[^>]+>/g,'');
227                          return data;
228      },
229
230      // can pass in standard $.ajax() parameters. Callback functions, such as beforeSend,
231      // will be queued first within the default callbacks.
232      // The only exception is error, which overrides the default
233      ajaxSettings: {
234                        // error: function(ct, ci) { /* override default error callback */ },
235                        // beforeSend: function(ct, ci) { /* called first within default beforeSend callback */ },
236                        dataType: 'html'
237      },
238      debug: false
239
240    }
241  };
242  var $cluetipWait,
243      standardClasses = 'cluetip ui-widget ui-widget-content ui-cluetip',
244      caches = {},
245      counter = 0,
246      imgCount = 0;
247
248  var encodeString = function(str) {
249    return str.replace(/&/g,'&amp;').replace(/>/g,'&gt;').replace(/</g,'&lt;');
250  };
251  // use $.fn.prop() if available (jQuery 1.6+); otherwise, $.fn.attr()
252  $.fn.attrProp = $.fn.prop || $.fn.attr;
253
254  // .cluetip() method
255  $.fn.cluetip = function(js, options) {
256    var $cluetip, $cluetipInner, $cluetipOuter, $cluetipTitle, $cluetipArrows, $dropShadow;
257    if (typeof js == 'object') {
258      options = js;
259      js = null;
260    }
261    if (js == 'destroy') {
262      this.each(function(index) {
263        var $l = $(this),
264            data = $l.data('cluetip');
265        if ( data ) {
266          $(data.selector).remove();
267          $.removeData(this, 'title');
268          $.removeData(this, 'cluetip');
269        }
270        if (data.title) {
271          $l.attrProp('title', data.title);
272        }
273        $l.unbind('.cluetip').unbind('cluetipMoc');
274      });
275      if ( !$('[id^="cluetip"]').length ) {
276        $(document).unbind('.cluetip');
277      }
278      return this;
279    }
280
281    // merge per-call options with defaults
282    options = $.extend(true, {}, $.cluetip.defaults, options || {});
283
284    /** =create cluetip divs **/
285    counter++;
286    var cluezIndex,
287        cluetipId = $.cluetip.backCompat || !options.multiple ? 'cluetip' : 'cluetip-' + counter,
288        cluetipSelector = '#' + cluetipId,
289        prefix = $.cluetip.backCompat ? '#' : '.',
290        insertionType = $.cluetip.setup.insertionType,
291        insertionElement = $.cluetip.setup.insertionElement || 'body';
292
293    insertionType = (/appendTo|prependTo|insertBefore|insertAfter/).test(insertionType) ? insertionType : 'appendTo';
294    $cluetip = $(cluetipSelector);
295    if (!$cluetip.length) {
296
297      $cluetip = $($.cluetip.template)
298      [insertionType](insertionElement)
299      .attr('id', cluetipId)
300      .css({position: 'absolute', display: 'none'});
301
302      cluezIndex = +options.cluezIndex;
303      $cluetipOuter = $cluetip.find(prefix + 'cluetip-outer').css({position: 'relative', zIndex: cluezIndex});
304      $cluetipInner = $cluetip.find(prefix + 'cluetip-inner');
305      $cluetipTitle = $cluetip.find(prefix + 'cluetip-title');
306
307      $cluetip.bind('mouseenter mouseleave', function(event) {
308        $(this).data('entered', event.type === 'mouseenter');
309      });
310    }
311
312    $cluetipWait = $('#cluetip-waitimage');
313    if (!$cluetipWait.length && options.waitImage) {
314      $cluetipWait = $('<div></div>').attr('id', 'cluetip-waitimage').css({position: 'absolute'});
315      $cluetipWait.insertBefore($cluetip).hide();
316    }
317
318
319    var cluetipPadding = (parseInt($cluetip.css('paddingLeft'), 10) || 0) + (parseInt($cluetip.css('paddingRight'), 10) || 0);
320
321
322    this.each(function(index) {
323      var jsContent,
324          link = this,
325          $link = $(this),
326          // support metadata plugin (v1.0 and 2.0)
327          opts = $.extend(true, {}, options, $.metadata ? $link.metadata() : $.meta ? $link.data() : $link.data('cluetip') || {}),
328          // start out with no contents (for ajax activation)
329          cluetipContents = false,
330          isActive = false,
331          closeOnDelay = null,
332          tipAttribute = opts[opts.attribute] ||
333            ( opts.attribute == 'href' ? $link.attr(opts.attribute) : $link.attrProp(opts.attribute) || $link.attr(opts.attribute) ),
334          ctClass = opts.cluetipClass;
335
336      cluezIndex = +opts.cluezIndex;
337      $link.data('cluetip', {title: link.title, zIndex: cluezIndex, selector: cluetipSelector, cursor: link.style.cursor || ''});
338
339      if (opts.arrows && !$cluetip.find('.cluetip-arrows').length) {
340        $cluetip.append('<div class="cluetip-arrows ui-state-default"></div>');
341      }
342
343      if (!tipAttribute && !opts.splitTitle && !js) {
344        return true;
345      }
346      // if hideLocal is set to true, on DOM ready hide the local content that will be displayed in the clueTip
347      if (opts.local && opts.localPrefix) {tipAttribute = opts.localPrefix + tipAttribute;}
348      if (opts.local && opts.hideLocal && tipAttribute) { $(tipAttribute + ':first').hide(); }
349
350      var tOffset = parseInt(opts.topOffset, 10), lOffset = parseInt(opts.leftOffset, 10);
351      // vertical measurement variables
352      var tipHeight, wHeight,
353          defHeight = isNaN(parseInt(opts.height, 10)) ? 'auto' : (/\D/g).test(opts.height) ? opts.height : opts.height + 'px';
354      var sTop, linkTop, linkBottom, posY, tipY, mouseY, baseline;
355      // horizontal measurement variables
356      var tipInnerWidth = parseInt(opts.width, 10) || 275,
357          tipWidth = tipInnerWidth + cluetipPadding + opts.dropShadowSteps,
358          linkWidth = this.offsetWidth,
359          linkLeft, posX, tipX, mouseX, winWidth;
360
361      // parse the title
362      var tipParts;
363      var tipTitle = (opts.attribute != 'title') ? $link.attr(opts.titleAttribute) || '' : '';
364      if (opts.escapeTitle) {
365        tipTitle = encodeString(tipTitle);
366      }
367      if (opts.splitTitle) {
368        tipParts = tipTitle.split(opts.splitTitle);
369        tipTitle = opts.showTitle || tipParts[0] === '' ? tipParts.shift() : '';
370      }
371
372
373
374      var localContent;
375      function returnFalse() { return false; }
376
377      // Keep track of mouse entered state on link
378      $link.bind('mouseenter mouseleave', function(event) {
379        var data = $link.data('cluetip');
380        data.entered = event.type === 'entered';
381        $link.data('cluetip', data);
382      });
383
384/***************************************
385* ACTIVATION
386****************************************/
387
388//activate clueTip
389    var activate = function(event) {
390      var pY, ajaxMergedSettings, cacheKey,
391          continueOn = opts.onActivate.call(link, event);
392
393      if (continueOn === false) {
394        return false;
395      }
396
397      isActive = true;
398
399      // activate function may get called after an initialization of a
400      // different target so need to re-get the Correct Cluetip object here
401      $cluetip = $(cluetipSelector).css({position: 'absolute'});
402      $cluetipOuter = $cluetip.find(prefix + 'cluetip-outer');
403      $cluetipInner = $cluetip.find(prefix + 'cluetip-inner');
404      $cluetipTitle = $cluetip.find(prefix + 'cluetip-title');
405      $cluetipArrows = $cluetip.find(prefix + 'cluetip-arrows');
406      $cluetip.removeClass().css({width: tipInnerWidth});
407      if (tipAttribute == $link.attr('href')) {
408        $link.css('cursor', opts.cursor);
409      }
410      if (opts.hoverClass) {
411        $link.addClass(opts.hoverClass);
412      }
413      linkTop = posY = $link.offset().top;
414      linkBottom = linkTop + $link.innerHeight();
415      linkLeft = $link.offset().left;
416      if ( $(insertionElement).css('position') === 'relative' ) {
417        linkLeft -= $(insertionElement)[0].getBoundingClientRect().left;
418      }
419
420      // FIX: (bug 4412)
421      linkWidth = $link.innerWidth();
422      if ( event.type == focus || (opts.positionBy == 'mouse' && !event.pageX) ) {
423        // in focus event, no mouse position is available; this is needed with bottomTop:
424        mouseX = linkLeft +  ( linkWidth / 2 ) + lOffset;
425        $cluetip.css({left: posX});
426        mouseY = posY + tOffset;
427      } else {
428        mouseX = event.pageX;
429        mouseY = event.pageY;
430      }
431      //END OF FIX
432
433      if (link.tagName.toLowerCase() != 'area') {
434        sTop = $(document).scrollTop();
435        winWidth = $(window).width();
436      }
437// position clueTip horizontally
438      if (opts.positionBy == 'fixed') {
439        posX = linkWidth + linkLeft + lOffset;
440        $cluetip.css({left: posX});
441      } else {
442        posX = (linkWidth > linkLeft && linkLeft > tipWidth) ||
443          linkLeft + linkWidth + tipWidth + lOffset > winWidth ?
444          linkLeft - tipWidth - lOffset :
445          linkWidth + linkLeft + lOffset;
446        if (link.tagName.toLowerCase() == 'area' || opts.positionBy == 'mouse' || linkWidth + tipWidth > winWidth) { // position by mouse
447          if (mouseX + 20 + tipWidth > winWidth) {
448            $cluetip.addClass('cluetip-' + ctClass);
449            posX = (mouseX - tipWidth - lOffset) >= 0 ? mouseX - tipWidth - lOffset - parseInt($cluetip.css('marginLeft'),10) + parseInt($cluetipInner.css('marginRight'),10) :  mouseX - (tipWidth/2);
450          } else {
451            posX = mouseX + lOffset;
452          }
453        }
454        pY = posX < 0 ? event.pageY + tOffset : event.pageY;
455        if (posX < 0 || opts.positionBy == 'bottomTop'  || opts.positionBy == 'topBottom') {
456          posX = (mouseX + (tipWidth/2) > winWidth) ? winWidth/2 - tipWidth/2 : Math.max(mouseX - (tipWidth/2),0);
457        }
458      }
459//silex
460
461if(ctClass=='jtip2'){
462         
463    }
464    else 
465	{	
466	if(posX + 520 >
466 $(document).width()){
467        posX = $(document).width() - 520;  
468}		
469    }
470
471      $cluetipArrows.css({zIndex: $link.data('cluetip').zIndex+1});
472      $cluetip.css({
473        left: posX,
474        zIndex: $link.data('cluetip').zIndex
475      });
476      wHeight = $(window).height();
477
478/***************************************
479* load a string from cluetip method's first argument
480***************************************/
481      if (js) {
482        if (typeof js == 'function') {
483          jsContent = js.call(link);
484        } else {
485          jsContent = js;
486        }
487        $cluetipInner.html(jsContent);
488        cluetipShow(pY);
489      }
490/***************************************
491* load the title attribute only (or user-selected attribute).
492* clueTip title is the string before the first delimiter
493* subsequent delimiters place clueTip body text on separate lines
494***************************************/
495
496      else if (tipParts) {
497        var tpl = tipParts.length;
498        $cluetipInner.html(tpl ? tipParts[0] : '');
499        if (tpl > 1) {
500          for (var i=1; i < tpl; i++) {
501            $cluetipInner.append('<div class="split-body">' + tipParts[i] + '</div>');
502          }
503        }
504        cluetipShow(pY);
505      }
506/***************************************
507* load external file via ajax
508***************************************/
509
510      else if ( !opts.local && tipAttribute.indexOf('#') !== 0 ) {
511        if (/\.(jpe?g|tiff?|gif|png)(?:\?.*)?$/i.test(tipAttribute)) {
512          $cluetipInner.html('<img src="' + tipAttribute + '" alt="' + tipTitle + '" />');
513          cluetipShow(pY);
514        } else {
515          var optionBeforeSend = opts.ajaxSettings.beforeSend,
516              optionError = opts.ajaxSettings.error,
517              optionSuccess = opts.ajaxSettings.success,
518              optionComplete = opts.ajaxSettings.complete;
519
520          cacheKey = getCacheKey(tipAttribute, opts.ajaxSettings.data);
521
522          var ajaxSettings = {
523            cache: opts.ajaxCache, // force requested page not to be cached by browser
524            url: tipAttribute,
525            beforeSend: function(xhr, settings) {
526              if (optionBeforeSend) {optionBeforeSend.call(link, xhr, $cluetip, $cluetipInner, settings);}
527              $cluetipOuter.children().empty();
528              if (opts.waitImage) {
529                $cluetipWait
530                .css({top: mouseY+20, left: mouseX+20, zIndex: $link.data('cluetip').zIndex-1})
531                .show();
532              }
533            },
534            error: function(xhr, textStatus) {
535              if ( options.ajaxCache && !caches[cacheKey] ) {
536                caches[cacheKey] = {status: 'error', textStatus: textStatus, xhr: xhr};
537              }
538
539              if (isActive) {
540                if (optionError) {
541                  optionError.call(link, xhr, textStatus, $cluetip, $cluetipInner);
542                } else {
543                  $cluetipInner.html('<i>sorry, the contents could not be loaded</i>');
544                }
545              }
546            },
547            success: function(data, textStatus, xhr) {
548              if ( options.ajaxCache && !caches[cacheKey] ) {
549                caches[cacheKey] = {status: 'success', data: data, textStatus: textStatus, xhr: xhr};
550              }
551
552              cluetipContents = opts.ajaxProcess.call(link, data);
553
554              // allow for changing the title based on data returned by xhr
555              if ( typeof cluetipContents == 'object' && cluetipContents !== null ) {
556                tipTitle = cluetipContents.title;
557                cluetipContents = cluetipContents.content;
558              }
559
560              if (isActive) {
561                if (optionSuccess) {
562                  optionSuccess.call(link, data, textStatus, $cluetip, $cluetipInner);
563                }
564                $cluetipInner.html(cluetipContents);
565
566              }
567            },
568            complete: function(xhr, textStatus) {
569              if (optionComplete) {
570                optionComplete.call(link, xhr, textStatus, $cluetip, $cluetipInner);
571              }
572              var imgs = $cluetipInner[0].getElementsByTagName('img');
573              imgCount = imgs.length;
574              for (var i=0, l = imgs.length; i < l; i++) {
575                if (imgs[i].complete) {
576                  imgCount--;
577                }
578              }
579              if (imgCount) {
580                $(imgs).bind('load.ct error.ct', function() {
581                  imgCount--;
582                  if (imgCount === 0) {
583                    $cluetipWait.hide();
584                    $(imgs).unbind('.ct');
585                    if (isActive) { cluetipShow(pY); }
586                  }
587                });
588              } else {
589                $cluetipWait.hide();
590                if (isActive) { cluetipShow(pY); }
591              }
592            }
593          };
594
595          ajaxMergedSettings = $.extend(true, {}, opts.ajaxSettings, ajaxSettings);
596
597          if ( caches[cacheKey] ) {
598            cachedAjax( caches[cacheKey], ajaxMergedSettings );
599          } else {
600            $.ajax(ajaxMergedSettings);
601          }
602        }
603      }
604/***************************************
605* load an element from the same page
606***************************************/
607      else if (opts.local) {
608        var $localContent = $(tipAttribute + (/^#\S+$/.test(tipAttribute) ? '' : ':eq(' + index + ')')).clone(true).show();
609        if (opts.localIdSuffix) {
610          $localContent.attr('id', $localContent[0].id + opts.localIdSuffix);
611        }
612        $cluetipInner.html($localContent);
613        cluetipShow(pY);
614      }
615    };
616
617    $link.unbind('showCluetip.cluetip', activate).bind('showCluetip.cluetip', activate);
618
619// get dimensions and options for cluetip and prepare it to be shown
620    var cluetipShow = function(bpY) {
621      var $closeLink, dynamicClasses, heightDiff,
622          titleHTML = tipTitle || opts.showTitle && '&nbsp;',
623          bgY = '', direction = '', insufficientX = false;
624      var stickyClose = {
625        bottom: function($cLink) {
626          $cLink.appendTo($cluetipInner);
627        },
628        top: function($cLink) {
629          $cLink.prependTo($cluetipInner);
630        },
631        title: function($cLink) {
632          $cLink.prependTo($cluetipTitle);
633        }
634      };
635
636      $cluetip.addClass('cluetip-' + ctClass);
637      if (opts.truncate) {
638        var $truncloaded = $cluetipInner.text().slice(0,opts.truncate) + '...';
639        $cluetipInner.html($truncloaded);
640      }
641
642      if (titleHTML) {
643        $cluetipTitle.show().html(titleHTML);
644      } else {
645        $cluetipTitle.hide();
646      }
647
648      if (opts.sticky) {
649        if (stickyClose[opts.closePosition]) {
650          $closeLink = $('<div class="cluetip-close"><a href="#">' + opts.closeText + '</a></div>');
651          stickyClose[opts.closePosition]( $closeLink );
652          $closeLink.bind('click.cluetip', function() {
653            cluetipClose();
654            return false;
655          });
656        }
657        if (opts.mouseOutClose) {
658          $link.unbind('mouseleave.cluetipMoc');
659          $cluetip.unbind('mouseleave.cluetipMoc');
660          if (opts.mouseOutClose == 'both' || opts.mouseOutClose == 'cluetip' || opts.mouseOutClose === true) { // true implies 'cluetip' for backwards compatability
661            $cluetip.bind('mouseleave.cluetipMoc', mouseOutClose);
662          }
663          if (opts.mouseOutClose == 'both' || opts.mouseOutClose == 'link') {
664            $link.bind('mouseleave.cluetipMoc', mouseOutClose);
665          }
666        }
667      }
668
669// now that content is loaded, finish the positioning
670      $cluetipOuter.css({zIndex: $link.data('cluetip').zIndex, overflow: defHeight == 'auto' ? 'visible' : 'auto', height: defHeight});
671      tipHeight = defHeight == 'auto' ? Math.max($cluetip.outerHeight(),$cluetip.height()) : parseInt(defHeight,10);
672      tipY = posY;
673      baseline = sTop + wHeight;
674      insufficientX = (posX < mouseX && (Math.max(posX, 0) + tipWidth > mouseX));
675      if (opts.positionBy == 'fixed') {
676        tipY = posY - opts.dropShadowSteps + tOffset;
677      } else if (opts.positionBy == 'topBottom' || opts.positionBy == 'bottomTop' || insufficientX) {
678        if (opts.positionBy == 'topBottom') {
679          if (posY + tipHeight + tOffset < baseline && mouseY - sTop < tipHeight + tOffset) {
680            direction = 'bottom';
681          } else {
682            direction = 'top';
683          }
684        } else if (opts.positionBy == 'bottomTop' || insufficientX) {
685          if (posY + tipHeight + tOffset > baseline && mouseY - sTop > tipHeight + tOffset) {
686            direction = 'top';
687          } else {
688            direction = 'bottom';
689          }
690        }
691        // We should now have a direction. Compute tipY
692        if (opts.snapToEdge) {
693          if (direction == 'top') {
694            tipY = linkTop - tipHeight - tOffset;
695          } else if (direction == 'bottom') {
696            tipY = linkBottom + tOffset;
697          }
698        } else {
699          if (direction == 'top') {
700            tipY = mouseY - tipHeight - tOffset;
701          } else if (direction == 'bottom') {
702            tipY = mouseY + tOffset;
703          }
704        }
705      } else if ( posY + tipHeight + tOffset > baseline ) {
706        tipY = (tipHeight >= wHeight) ? sTop : baseline - tipHeight - tOffset;
707      } else if ($link.css('display') == 'block' || link.tagName.toLowerCase() == 'area' || opts.positionBy == "mouse") {
708        tipY = bpY - tOffset;
709      } else {
710        tipY = posY - opts.dropShadowSteps;
711      }
712      if (direction === '') {
713        direction = posX < linkLeft ? 'left' :  'right';
714      }
715      // add classes
716      dynamicClasses = ' clue-' + direction + '-' + ctClass + ' cluetip-' + ctClass;
717      if (ctClass == 'rounded') {
718        dynamicClasses += ' ui-corner-all';
719      }
720      $cluetip.css({top: tipY + 'px'}
720).attrProp({'className': standardClasses + dynamicClasses});
721      // set up arrow positioning to align with element
722      if (opts.arrows) {
723        if ( /(left|right)/.test(direction) ) {
724          heightDiff = $cluetip.height() - $cluetipArrows.height();
725          bgY = posX >= 0 && bpY > 0 ? (posY - tipY - opts.dropShadowSteps) : 0;
726          bgY = heightDiff > bgY ? bgY : heightDiff;
727          bgY += 'px';
728        }
729        $cluetipArrows.css({top: bgY}).show();
730      } else {
731        $cluetipArrows.hide();
732      }
733
734// (first hide, then) ***SHOW THE CLUETIP***
735      // handle dropshadow divs first
736      $dropShadow = createDropShadows($cluetip, opts);
737      if ($dropShadow && $dropShadow.length) {
738        $dropShadow.hide().css({height: tipHeight, width: tipInnerWidth, zIndex: $link.data('cluetip').zIndex-1}).show();
739      }
740
741      if (!closeOnDelay) {
742        $cluetip.hide();
743      }
744      clearTimeout(closeOnDelay);
745      closeOnDelay = null;
746
747      // show the cluetip
748      $cluetip[opts.fx.open](opts.fx.openSpeed || 0);
749
750      if ($.fn.bgiframe) { $cluetip.bgiframe(); }
751
752      // trigger the optional onShow function
753      opts.onShow.call(link, $cluetip, $cluetipInner);
754    };
755
756/***************************************
757   =INACTIVATION
758-------------------------------------- */
759    var inactivate = function(event) {
760      isActive = false;
761      $cluetipWait.hide();
762      if (!opts.sticky || (/click|toggle/).test(opts.activation) ) {
763        // delayed close (not fully tested)
764        if (opts.delayedClose > 0) {
765          clearTimeout(closeOnDelay);
766          closeOnDelay = null;
767          closeOnDelay = setTimeout(cluetipClose, opts.delayedClose);
768        } else {
769          cluetipClose();
770          clearTimeout(closeOnDelay);
771        }
772      }
773
774      if (opts.hoverClass) {
775        $link.removeClass(opts.hoverClass);
776      }
777    };
778
779    // close cluetip and reset some things
780    var cluetipClose = function(el) {
781      var $closer = el && el.data('cluetip') ? el : $link,
782          ct = $closer.data('cluetip') && $closer.data('cluetip').selector,
783          ctSelector = ct || 'div.cluetip',
784          $cluetip = $(ctSelector),
785          $cluetipInner = $cluetip.find(prefix + 'cluetip-inner'),
786          $cluetipArrows = $cluetip.find(prefix + 'cluetip-arrows');
787
788      $cluetip.hide().removeClass();
789      opts.onHide.call($closer[0], $cluetip, $cluetipInner);
790
791      if (ct) {
792        $closer.removeClass('cluetip-clicked');
793        $link.css('cursor', $link.data('cluetip').cursor);
794      }
795      if (ct && tipTitle) {
796        $closer.attrProp(opts.titleAttribute, tipTitle);
797      }
798
799      if (opts.arrows) {
800        $cluetipArrows.css({top: ''});
801      }
802      if ($dropShadow) {
803        $dropShadow.hide();
804      }
805    };
806
807    // Check to see if we should be closing by checking where the user is hovering.
808    // We do a short 50ms delay for two reasons: to prevent flicker, and to allow the user time to hover on other element
809    var mouseOutClose = function() {
810      var el = this;
811      clearTimeout(closeOnDelay);
812      closeOnDelay = setTimeout(function() {
813        var linkOver = $link.data('cluetip').entered,
814            cluetipOver = $cluetip.data('entered'),
815            entered = false;
816
817        if ( opts.mouseOutClose == 'both' && (linkOver || cluetipOver) ) {
818          entered = true;
819        }
820        // true implies 'cluetip' for backwards compatibility
821        else if ( (opts.mouseOutClose === true || opts.mouseOutClose == 'cluetip') && cluetipOver) {
822          entered = true;
823        }
824        else if (opts.mouseOutClose == 'link' && linkOver) {
825          entered = true;
826        }
827
828        if ( !entered ) {
829          // All checks pass, close the cluetip
830          cluetipClose.call(el);
831        }
832
833      }, opts.delayedClose);
834    };
835
836    $(document).unbind('hideCluetip.cluetip').bind('hideCluetip.cluetip', function(e) {
837      cluetipClose( $(e.target) );
838    });
839/***************************************
840   =BIND EVENTS
841-------------------------------------- */
842  // activate by click
843      if ( (/click|toggle/).test(opts.activation) ) {
844        $link.bind('click.cluetip', function(event) {
845          if ($cluetip.is(':hidden') || !$link.is('.cluetip-clicked')) {
846            activate(event);
847            $('.cluetip-clicked').removeClass('cluetip-clicked');
848            $link.addClass('cluetip-clicked');
849          } else {
850            inactivate(event);
851          }
852          return false;
853        });
854  // activate by focus; inactivate by blur
855      } else if (opts.activation == 'focus') {
856        $link.bind('focus.cluetip', function(event) {
857          $link.attrProp('title','');
858          activate(event);
859        });
860        $link.bind('blur.cluetip', function(event) {
861          $link.attrProp('title', $link.data('cluetip').title);
862          inactivate(event);
863        });
864  // activate by hover
865      } else {
866
867        // clicking is returned false if clickThrough option is set to false
868        $link[opts.clickThrough ? 'unbind' : 'bind']('click.cluetip', returnFalse);
869
870        //set up mouse tracking
871        var mouseTracks = function(evt) {
872          if (opts.tracking) {
873            var trackX = posX - evt.pageX;
874            var trackY = tipY ? tipY - evt.pageY : posY - evt.pageY;
875            $link.bind('mousemove.cluetip', function(evt) {
876              $cluetip.css({left: evt.pageX + trackX, top: evt.pageY + trackY });
877            });
878          }
879        };
880
881        if ($.fn.hoverIntent && opts.hoverIntent) {
882          $link.hoverIntent({
883            sensitivity: opts.hoverIntent.sensitivity,
884            interval: opts.hoverIntent.interval,
885            over: function(event) {
886              activate(event);
887              mouseTracks(event);
888            },
889            timeout: opts.hoverIntent.timeout,
890            out: function(event) {
891              inactivate(event);
892              $link.unbind('mousemove.cluetip');
893            }
894          });
895        } else {
896          $link.bind('mouseenter.cluetip', function(event) {
897            activate(event);
898            mouseTracks(event);
899          })
900          .bind('mouseleave.cluetip', function(event) {
901            inactivate(event);
902            $link.unbind('mousemove.cluetip');
903          });
904        }
905
906        $link.bind('mouseover.cluetip', function(event) {
907          $link.attrProp('title','');
908        }).bind('mouseleave.cluetip', function(event) {
909          $link.attrProp('title', $link.data('cluetip').title);
910        });
911      }
912
913      // trigger a cached Ajax response
914      function cachedAjax(info, settings) {
915        var status = info.status;
916        settings.beforeSend(info.xhr, settings);
917        if ( status == 'error' ) {
918          settings[status](info.xhr, info.textStatus);
919        } else if (status == 'success') {
920          settings[status](info.data, info.textStatus, info.xhr);
921        }
922        settings.complete(info.xhr, settings.textStatus);
923      }
924
925    }); // end this.each
926
927    /** =private functions
928    ************************************************************/
929    //empty function
930    function doNothing() {}
931
932    // create a string to be used as an identifier for ajax caches
933    function getCacheKey(url, data) {
934      var cacheKey = url || '';
935      data = data || '';
936
937      if (typeof data == 'object') {
938        $.each(data, function(key, val) {
939          cacheKey += '-' + key + '-' + val;
940        });
941      } else if (typeof data == 'string') {
942        cacheKey += data;
943      }
944
945      return cacheKey;
946    }
947
948    /** =create dropshadow divs **/
949
950    function createDropShadows($cluetip, options, newDropShadow) {
951      var dsStyle = '',
952          dropShadowSteps = (options.dropShadow && options.dropShadowSteps) ? +options.dropShadowSteps : 0;
953
954      if ($.cluetip.boxShadow) {
955        if ( dropShadowSteps ) {
956          dsStyle = '1px 1px ' + dropShadowSteps + 'px rgba(0,0,0,0.5)';
957        }
958        var dsOffsets = dropShadowSteps === 0 ? '0 0 ' : '1px 1px ';
959        $cluetip.css($.cluetip.boxShadow, dsStyle);
960        return false;
961      }
962      var oldDropShadow = $cluetip.find('.cluetip-drop-shadow');
963      if (dropShadowSteps == oldDropShadow.length) {
964        return oldDropShadow;
965      }
966      oldDropShadow.remove();
967      var dropShadows = [];
968      for (var i=0; i < dropShadowSteps;) {
969        dropShadows[i++] = '<div style="top:' + i + 'px;left:' + i + 'px;"></div>';
970      }
971
972      newDropShadow = $(dropShadows.join(''))
973      .css({
974        position: 'absolute',
975        backgroundColor: '#000',
976        zIndex: cluezIndex -1,
977        opacity: 0.1
978      })
979      .addClass('cluetip-drop-shadow')
980      .prependTo($cluetip);
981      return newDropShadow;
982
983    }
984
985    return this;
986  };
987
988  (function() {
989    $.support = $.support || {};
990
991    // check support for CSS3 properties (currently only boxShadow)
992    var div = document.createElement('div'),
993        divStyle = div.style,
994        styleProps = ['boxShadow'],
995        prefixes = ['moz', 'Moz', 'webkit', 'o'];
996
997    for (var i=0, sl = styleProps.length; i < sl; i++) {
998      var prop = styleProps[i],
999          uProp = prop.charAt(0).toUpperCase() + prop.slice(1);
1000
1001      if ( typeof divStyle[ prop ] !== 'undefined' ) {
1002        $.cluetip[ prop ] = prop;
1003      } else {
1004        for (var j=0, pl = prefixes.length; j < pl; j++) {
1005
1006          if (typeof divStyle[ prefixes[j] + uProp ] !== 'undefined') {
1007            $.cluetip[ prop ] = prefixes[j] + uProp;
1008            break;
1009          }
1010        }
1011      }
1012
1013      if ( !$.support[ prop ] ) {
1014        $.support[ prop ] = $.cluetip[ prop ];
1015      }
1016    }
1017
1018    div = null;
1019  })();
1020
1021  $.fn.cluetip.defaults = $.cluetip.defaults;
1022
1023})(jQuery);
1024
1025
1026
1027
1028function $bindMethod(object, method) {
1029  return function() {
1030    return method.apply(object, arguments);
1031  };
1032}
1033
1034function $window_addLoad(handler) {
1035    if (window.addEventListener) { 
1036        window.addEventListener('load',handler,false);
1037    }
1038    else if (document.addEventListener) {
1039        document.addEventListener('load',handler,false);
1040    }
1041    else if (window.attachEvent) { 
1042        window.attachEvent('onload',handler);
1043    }
1044    else {
1045        if (typeof window.onload=='function') {
1046            var oldload=window.onload;
1047            window.onload = function(){
1048                oldload();
1049                handler();
1050            }
1051        } 
1052        else { window.onload=init; }
1053    }
1054
1055}
1056
1057function $getElement(id, handler) {
1058    var el = document.getElementById(id);
1059    return el;
1060}
1061
1062var Keys = {
1063    Enter: 13
1064}
1065
1066function $handleSearchEnterKey(id, handler) {
1067    var el = $getElement(id);    
1068    if(el) {
1069        var delKeypress = function(e) {
1070
1071            var keyCode;
1072            if (e && e.which) {
1073                keyCode = e.which;
1074            }
1075            else if (typeof (event) != 'undefined') {
1076                keyCode = event.keyCode;
1077            }
1078
1079            // we must manually invoke the Page_ClientValidate
1080            // method here since relying on the normal behavior
1081            // is not guaranteed to set the appropriate validation flags
1082            // to stop the postback.
1083            if (keyCode == Keys.Enter) {
1084                if (typeof (Page_ClientValidate) != 'undefined') {
1085                    if (Page_ClientValidate() == false) {
1086                        return;
1087                    }
1088                }
1089
1090                handler();
1091
1092                return false;
1093            }
1094        }
1095        
1096        el.onkeypress = delKeypress;
1097    }
1098
1099}
1100
1101
1102
1103
1104
1105
1106function SmartSearch(ctrlname)
1107{
1108
1109$(ctrlname).wrap('<span  id="smartsearch"/>');
1110$('#smartsearch').append('<div id="result"></div>');
1111$('#result').mouseleave(function(){$('#result').fadeOut();});
1112//key up event of the search text box
1113
1114$(ctrlname).keyup(function(e){
1115var term=$('#txtSearch').val();
1116
1117var keyCode = e.keyCode || e.which,
1118      arrow = {left: 37, up: 38, right: 39, down: 40,escape:27 };
1119
1120  switch (keyCode) {
1121   case arrow.escape:  
1122        $('#result').fadeOut();      
1123        return false;
1124    break;
1125    case arrow.left:        
1126        return false;
1127    break;
1128    case arrow.up:
1129        if($('#result').css('display')=='block')
1130        {
1131            if($('#result ul li.hover').attr('id')==undefined)
1132            {
1133            $('#result ul li').last().mouseover();       
1134            }
1135            else
1136            {
1137            var li=$('#result ul li.hover');
1138            
1139            li.prev().mouseover();        
1140            li.removeClass('hover');
1141            
1142            }
1143         }  
1144        return false;
1145    break;
1146    case arrow.right:      
1147        return false;
1148    break;
1149    case arrow.down:    
1150        if($('#result').css('display')=='block')
1151        {
1152            if($('#result ul li.hover').attr('id')==undefined)
1153            {
1154            $('#result ul li').first().mouseover();       
1155            }
1156            else
1157            {
1158            var li=$('#result ul li.hover');
1159            li.next().mouseover();        
1160            li.removeClass('hover');
1161            }
1162         }  
1163        return false;
1164    break;
1165  }
1166
1167
1168
1169if($('#txtSearch').val().length >1)
1170{
1171var term=$('#txtSearch').val();
1172$.post('x-smartsearch.aspx',{SearchTerm:$('#txtSearch').val()},function(data){$('#result').html(data);$('#result').show();
1173adnsf$('#result > ul li').highlight(term);
1174$('#result > ul li').hover(
1175
1176//mouse over event of the searched product
1177function(){
1178var pid=$(this).attr('ID');
1179var pidCtrl=$(this);
1180$(this).addClass('hover');
1181//after product is loaded
1182
1183
1184//$(ctrlname).attr('value',$(this).html());
1185$('.productinfo').hide();
1186},
1187function(){
1188$('.relative').hide();
1189$(this).removeClass('hover');
1190}
1191);
1192});
1193$(ctrlname).focus();
1194
1195}
1196else
1197{
1198$('#result').html('');
1199}
1200
1201});
1202
1203
1204}
1205
1206/*
1207
1208highlight v3
1209
1210Highlights arbitrary terms.
1211
1212<http://johannburkard.de/blog/programming/javascript/highlight-javascript-text-higlighting-jquery-plugin.html>
1213
1214MIT license.
1215
1216Johann Burkard
1217<http://johannburkard.de>
1218<mailto:[email protected]>
1219
1220*/
1221
1222jQuery.fn.highlight = function(pat) {
1223 function innerHighlight(node, pat) {
1224  var skip = 0;
1225  if (node.nodeType == 3) {
1226   var pos = node.data.toUpperCase().indexOf(pat);
1227   if (pos >= 0) {
1228    var spannode = document.createElement('span');
1229    spannode.className = 'highlight';
1230    var middlebit = node.splitText(pos);
1231    var endbit = middlebit.splitText(pat.length);
1232    var middleclone = middlebit.cloneNode(true);
1233    spannode.appendChild(middleclone);
1234    middlebit.parentNode.replaceChild(spannode, middlebit);
1235    skip = 1;
1236   }
1237  }
1238  else if (node.nodeType == 1 && node.childNodes && !/(script|style)/i.test(node.tagName)) {
1239   for (var i = 0; i < node.childNodes.length; ++i) {
1240    i += innerHighlight(node.childNodes[i], pat);
1241   }
1242  }
1243  return skip;
1244 }
1245 return this.each(function() {
1246  innerHighlight(this, pat.toUpperCase());
1247 });
1248};
1249
1250jQuery.fn.removeHighlight = function() {
1251 return this.find("span.highlight").each(function() {
1252  this.parentNode.firstChild.nodeName;
1253  with (this.parentNode) {
1254   replaceChild(this.firstChild, this);
1255   normalize();
1256  }
1257 }).end();
1258};
1259
1260

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.