/* Copyright (c) 2007 Paul Bakaus (paul.bakaus@googlemail.com) and Brandon Aaron (brandon.aaron@gmail.com || http://brandonaaron.net)
* Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
* and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
*
* $jLastChangedDate: 2007-12-20 08:46:55 -0600 (Thu, 20 Dec 2007) $j
* $jRev: 4259 $j
*
* Version: 1.2
*
* Requires: jQuery 1.2+
*/
(function($j) {
  $j.dimensions = {
    version: '1.2'
  };
  // Create innerHeight, innerWidth, outerHeight and outerWidth methods
  $j.each(['Height', 'Width'], function(i, name) {
    // innerHeight and innerWidth
    $j.fn['inner' + name] = function() {
      if (!this[0]) return;
      var torl = name == 'Height' ? 'Top' : 'Left',  // top or left
		    borr = name == 'Height' ? 'Bottom' : 'Right'; // bottom or right
      return this.is(':visible') ? this[0]['client' + name] : num(this, name.toLowerCase()) + num(this, 'padding' + torl) + num(this, 'padding' + borr);
    };
    // outerHeight and outerWidth
    $j.fn['outer' + name] = function(options) {
      if (!this[0]) return;
      var torl = name == 'Height' ? 'Top' : 'Left',  // top or left
		    borr = name == 'Height' ? 'Bottom' : 'Right'; // bottom or right
      options = $j.extend({ margin: false }, options || {});
      var val = this.is(':visible') ?
				this[0]['offset' + name] :
				num(this, name.toLowerCase())
					+ num(this, 'border' + torl + 'Width') + num(this, 'border' + borr + 'Width')
					+ num(this, 'padding' + torl) + num(this, 'padding' + borr);
      return val + (options.margin ? (num(this, 'margin' + torl) + num(this, 'margin' + borr)) : 0);
    };
  });
  // Create scrollLeft and scrollTop methods
  $j.each(['Left', 'Top'], function(i, name) {
    $j.fn['scroll' + name] = function(val) {
      if (!this[0]) return;
      return val != undefined ?
      // Set the scroll offset
			this.each(function() {
			  this == window || this == document ?
					window.scrollTo(
						name == 'Left' ? val : $j(window)['scrollLeft'](),
						name == 'Top' ? val : $j(window)['scrollTop']()
					) :
					this['scroll' + name] = val;
			}) :
      // Return the scroll offset
			this[0] == window || this[0] == document ?
				self[(name == 'Left' ? 'pageXOffset' : 'pageYOffset')] ||
					$j.boxModel && document.documentElement['scroll' + name] ||
					document.body['scroll' + name] :
				this[0]['scroll' + name];
    };
  });
  $j.fn.extend({
    position: function() {
      var left = 0, top = 0, elem = this[0], offset, parentOffset, offsetParent, results;
      if (elem) {
        // Get *real* offsetParent
        offsetParent = this.offsetParent();
        // Get correct offsets
        offset = this.offset();
        parentOffset = offsetParent.offset();
        // Subtract element margins
        offset.top -= num(elem, 'marginTop');
        offset.left -= num(elem, 'marginLeft');
        // Add offsetParent borders
        parentOffset.top += num(offsetParent, 'borderTopWidth');
        parentOffset.left += num(offsetParent, 'borderLeftWidth');
        // Subtract the two offsets
        results = {
          top: offset.top - parentOffset.top,
          left: offset.left - parentOffset.left
        };
      }
      return results;
    },
    offsetParent: function() {
      var offsetParent = this[0].offsetParent;
      while (offsetParent && (!/^body|html$j/i.test(offsetParent.tagName) && $j.css(offsetParent, 'position') == 'static'))
        offsetParent = offsetParent.offsetParent;
      return $j(offsetParent);
    }
  });
  function num(el, prop) {
    return parseInt($j.curCSS(el.jquery ? el[0] : el, prop, true)) || 0;
  };
})(jQuery);
/*
 
 jQuery Tools 1.2.3 Tooltip - UI essentials
 NO COPYRIGHTS OR LICENSES. DO WHAT YOU LIKE.
 http://flowplayer.org/tools/tooltip/
 Since: November 2008
 Date:    Mon Jun 7 13:43:53 2010 +0000 
*/
(function(f){function p(a,b,c){var h=c.relative?a.position().top:a.offset().top,e=c.relative?a.position().left:a.offset().left,i=c.position[0];h-=b.outerHeight()-c.offset[0];e+=a.outerWidth()+c.offset[1];var j=b.outerHeight()+a.outerHeight();if(i=="center")h+=j/2;if(i=="bottom")h+=j;i=c.position[1];a=b.outerWidth()+a.outerWidth();if(i=="center")e-=a/2;if(i=="left")e-=a;return{top:h,left:e}}function t(a,b){var c=this,h=a.add(c),e,i=0,j=0,m=a.attr("title"),q=n[b.effect],k,r=a.is(":input"),u=r&&a.is(":checkbox, :radio, select, :button, :submit"),
s=a.attr("type"),l=b.events[s]||b.events[r?u?"widget":"input":"def"];if(!q)throw'Nonexistent effect "'+b.effect+'"';l=l.split(/,\s*/);if(l.length!=2)throw"Tooltip: bad events configuration for "+s;a.bind(l[0],function(d){clearTimeout(i);if(b.predelay)j=setTimeout(function(){c.show(d)},b.predelay);else c.show(d)}).bind(l[1],function(d){clearTimeout(j);if(b.delay)i=setTimeout(function(){c.hide(d)},b.delay);else c.hide(d)});if(m&&b.cancelDefault){a.removeAttr("title");a.data("title",m)}f.extend(c,{show:function(d){if(!e){if(m)e=
f(b.layout).addClass(b.tipClass).appendTo(document.body).hide().append(m);else if(b.tip)e=f(b.tip).eq(0);else{e=a.next();e.length||(e=a.parent().next())}if(!e.length)throw"Cannot find tooltip for "+a;}if(c.isShown())return c;e.stop(true,true);var g=p(a,e,b);d=d||f.Event();d.type="onBeforeShow";h.trigger(d,[g]);if(d.isDefaultPrevented())return c;g=p(a,e,b);e.css({position:"absolute",top:g.top,left:g.left});k=true;q[0].call(c,function(){d.type="onShow";k="full";h.trigger(d)});g=b.events.tooltip.split(/,\s*/);
e.bind(g[0],function(){clearTimeout(i);clearTimeout(j)});g[1]&&!a.is("input:not(:checkbox, :radio), textarea")&&e.bind(g[1],function(o){o.relatedTarget!=a[0]&&a.trigger(l[1].split(" ")[0])});return c},hide:function(d){if(!e||!c.isShown())return c;d=d||f.Event();d.type="onBeforeHide";h.trigger(d);if(!d.isDefaultPrevented()){k=false;n[b.effect][1].call(c,function(){d.type="onHide";k=false;h.trigger(d)});return c}},isShown:function(d){return d?k=="full":k},getConf:function(){return b},getTip:function(){return e},
getTrigger:function(){return a}});f.each("onHide,onBeforeShow,onShow,onBeforeHide".split(","),function(d,g){f.isFunction(b[g])&&f(c).bind(g,b[g]);c[g]=function(o){f(c).bind(g,o);return c}})}f.tools=f.tools||{version:"1.2.3"};f.tools.tooltip={conf:{effect:"toggle",fadeOutSpeed:"fast",predelay:0,delay:30,opacity:1,tip:0,position:["top","center"],offset:[0,0],relative:false,cancelDefault:true,events:{def:"mouseenter,mouseleave",input:"focus,blur",widget:"focus mouseenter,blur mouseleave",tooltip:"mouseenter,mouseleave"},
layout:"<div/>",tipClass:"tooltip"},addEffect:function(a,b,c){n[a]=[b,c]}};var n={toggle:[function(a){var b=this.getConf(),c=this.getTip();b=b.opacity;b<1&&c.css({opacity:b});c.show();a.call()},function(a){this.getTip().hide();a.call()}],fade:[function(a){var b=this.getConf();this.getTip().fadeTo(b.fadeInSpeed,b.opacity,a)},function(a){this.getTip().fadeOut(this.getConf().fadeOutSpeed,a)}]};f.fn.tooltip=function(a){var b=this.data("tooltip");if(b)return b;a=f.extend(true,{},f.tools.tooltip.conf,a);
if(typeof a.position=="string")a.position=a.position.split(/,?\s/);this.each(function(){b=new t(f(this),a);f(this).data("tooltip",b)});return a.api?b:this}})(jQuery);
(function($) {
  $.fn.bgIframe = $.fn.bgiframe = function(s) {
    if ($.browser.msie && /6.0/.test(navigator.userAgent)) {
      s = $.extend({
        top: 'auto', // auto == .currentStyle.borderTopWidth
        left: 'auto', // auto == .currentStyle.borderLeftWidth
        width: 'auto', // auto == offsetWidth
        height: 'auto', // auto == offsetHeight
        opacity: true,
        src: 'javascript:false;'
      }, s || {});
      var prop = function(n) { return n && n.constructor == Number ? n + 'px' : n; },
		    html = '<iframe class="bgiframe"frameborder="0"tabindex="-1"src="' + s.src + '"' +
		               'style="display:block;position:absolute;z-index:-1;' +
			               (s.opacity !== false ? 'filter:Alpha(Opacity=\'0\');' : '') +
					       'top:' + (s.top == 'auto' ? 'expression(((parseInt(this.parentNode.currentStyle.borderTopWidth)||0)*-1)+\'px\')' : prop(s.top)) + ';' +
					       'left:' + (s.left == 'auto' ? 'expression(((parseInt(this.parentNode.currentStyle.borderLeftWidth)||0)*-1)+\'px\')' : prop(s.left)) + ';' +
					       'width:' + (s.width == 'auto' ? 'expression(this.parentNode.offsetWidth+\'px\')' : prop(s.width)) + ';' +
					       'height:' + (s.height == 'auto' ? 'expression(this.parentNode.offsetHeight+\'px\')' : prop(s.height)) + ';' +
					'"/>';
      return this.each(function() {
        if ($('> iframe.bgiframe', this).length == 0)
          this.insertBefore(document.createElement(html), this.firstChild);
      });
    }
    return this;
  };
})(jQuery);


