(function(){if(!/*@cc_on!@*/0)return;var e = "abbr,article,aside,audio,canvas,datalist,details,eventsource,figure,footer,header,hgroup,mark,menu,meter,nav,output,progress,section,time,video".split(','),i=e.length;while(i--){document.createElement(e[i])}})();
(function(a){a.fn.menuHorizontal=function(){this.each(function(){a("ul#menu-segmentos > li").children("a").bind("mouseover",function(){a("ul#menu-segmentos").find(".menu-subitens").hide();a(this).parents("li:first").children(".menu-subitens").show().bind("mouseleave",function(){a(this).hide();});var b=a(this).siblings(".menu-subitens");var d=b.children(".conteudo-subitens").find("ul").css("padding-right");var c=b.children(".conteudo-subitens").find("ul").css("padding-left");b.css("width",b.children(".conteudo-subitens").find("ul").size()*160+parseInt(c)+parseInt(d));return false;});});return this;};})(jQuery);
/*!
 * jQuery Text Overflow v0.7
 *
 * Licensed under the new BSD License.
 * Copyright 2009-2010, Bram Stein
 * All rights reserved.
 */
/*global jQuery, document, setInterval*/
(function(c){var b=document.documentElement.style,d=("textOverflow" in b||"OTextOverflow" in b),a=function(f,i){var h=0,e=[],g=function(j){var l=0,k;if(h>i){return;}for(l=0;l<j.length;l+=1){if(j[l].nodeType===1){k=j[l].cloneNode(false);e[e.length-1].appendChild(k);e.push(k);g(j[l].childNodes);e.pop();}else{if(j[l].nodeType===3){if(h+j[l].length<i){e[e.length-1].appendChild(j[l].cloneNode(false));}else{k=j[l].cloneNode(false);k.textContent=c.trim(k.textContent.substring(0,i-h));e[e.length-1].appendChild(k);}h+=j[l].length;}else{e.appendChild(j[l].cloneNode(false));}}}};e.push(f.cloneNode(false));g(f.childNodes);return c(e.pop().childNodes);};c.extend(c.fn,{textOverflow:function(g,e){var f=g||"&#x2026;";if(!d){return this.each(function(){var l=c(this),m=l.clone(),p=l.clone(),k=l.text(),h=l.width(),n=0,o=0,j=k.length,i=function(){if(h!==l.width()){l.replaceWith(p);l=p;p=l.clone();l.textOverflow(g,false);h=l.width();}};l.after(m.hide().css({position:"absolute",width:"auto",overflow:"visible","max-width":"inherit"}));if(m.width()>h){while(n<j){o=Math.floor(n+((j-n)/2));m.empty().append(a(p.get(0),o)).append(f);if(m.width()<h){n=o+1;}else{j=o;}}if(n<k.length){l.empty().append(a(p.get(0),n-1)).append(f);}}m.remove();if(e){setInterval(i,200);}});}else{return this;}}});})(jQuery);
/*!
 * jquery.qtip. The jQuery tooltip plugin
 *
 * Copyright (c) 2009 Craig Thompson
 * http://craigsworks.com
 *
 * Licensed under MIT
 * http://www.opensource.org/licenses/mit-license.php
 *
 * Launch  : February 2009
 * Version : 1.0.0-rc3
 * Released: Tuesday 12th May, 2009 - 00:00
 * Debug: jquery.qtip.debug.js
 */
(function($)
{
   $.fn.qtip = function(options, blanket)
   {
      var i, id, interfaces, opts, obj, command, config, api;

      if(typeof options == 'string')
      {
         if(typeof $(this).data('qtip') !== 'object')
            $.fn.qtip.log.error.call(self, 1, $.fn.qtip.constants.NO_TOOLTIP_PRESENT, false);

         if(options == 'api')
            return $(this).data('qtip').interfaces[ $(this).data('qtip').current ];
         else if(options == 'interfaces')
            return $(this).data('qtip').interfaces;
      }

      else
      {
         if(!options) options = {};

         if(typeof options.content !== 'object' || (options.content.jquery && options.content.length > 0)) options.content = { text: options.content };
         if(typeof options.content.title !== 'object') options.content.title = { text: options.content.title };
         if(typeof options.position !== 'object') options.position = { corner: options.position };
         if(typeof options.position.corner !== 'object') options.position.corner = { target: options.position.corner, tooltip: options.position.corner };
         if(typeof options.show !== 'object') options.show = { when: options.show };
         if(typeof options.show.when !== 'object') options.show.when = { event: options.show.when };
         if(typeof options.show.effect !== 'object') options.show.effect = { type: options.show.effect };
         if(typeof options.hide !== 'object') options.hide = { when: options.hide };
         if(typeof options.hide.when !== 'object') options.hide.when = { event: options.hide.when };
         if(typeof options.hide.effect !== 'object') options.hide.effect = { type: options.hide.effect };
         if(typeof options.style !== 'object') options.style = { name: options.style };
         options.style = sanitizeStyle(options.style);

         opts = $.extend(true, {}, $.fn.qtip.defaults, options);

         opts.style = buildStyle.call({ options: opts }, opts.style);
         opts.user = $.extend(true, {}, options);
      };

      return $(this).each(function() // Return original elements as per jQuery guidelines
      {
         if(typeof options == 'string')
         {
            command = options.toLowerCase();
            interfaces = $(this).qtip('interfaces');

            if(typeof interfaces == 'object')
            {
               if(blanket === true && command == 'destroy')
                  while(interfaces.length > 0) interfaces[interfaces.length-1].destroy();

               else
               {
                  if(blanket !== true) interfaces = [ $(this).qtip('api') ];

                  for(i = 0; i < interfaces.length; i++)
                  {
                     if(command == 'destroy') interfaces[i].destroy();

                     else if(interfaces[i].status.rendered === true)
                     {
                        if(command == 'show') interfaces[i].show();
                        else if(command == 'hide') interfaces[i].hide();
                        else if(command == 'focus') interfaces[i].focus();
                        else if(command == 'disable') interfaces[i].disable(true);
                        else if(command == 'enable') interfaces[i].disable(false);
                     };
                  };
               };
            };
         }

         else
         {
            config = $.extend(true, {}, opts);
            config.hide.effect.length = opts.hide.effect.length;
            config.show.effect.length = opts.show.effect.length;

            if(config.position.container === false) config.position.container = $(document.body);
            if(config.position.target === false) config.position.target = $(this);
            if(config.show.when.target === false) config.show.when.target = $(this);
            if(config.hide.when.target === false) config.hide.when.target = $(this);

            id = $.fn.qtip.interfaces.length;
            for(i = 0; i < id; i++)
            {
               if(typeof $.fn.qtip.interfaces[i] == 'undefined'){ id = i; break; };
            };

            obj = new qTip($(this), config, id);

            $.fn.qtip.interfaces[id] = obj;

            if(typeof $(this).data('qtip') === 'object' && $(this).data('qtip'))
            {
               if(typeof $(this).attr('qtip') === 'undefined')
                  $(this).data('qtip').current = $(this).data('qtip').interfaces.length;

               $(this).data('qtip').interfaces.push(obj);
            }

            else $(this).data('qtip', { current: 0, interfaces: [obj] });

            if(config.content.prerender === false && config.show.when.event !== false && config.show.ready !== true)
            {
               config.show.when.target.bind(config.show.when.event+'.qtip-'+id+'-create', { qtip: id }, function(event)
               {
                  api = $.fn.qtip.interfaces[ event.data.qtip ];

                  api.options.show.when.target.unbind(api.options.show.when.event+'.qtip-'+event.data.qtip+'-create');
                  api.cache.mouse = { x: event.pageX, y: event.pageY };

                  construct.call( api );
                  api.options.show.when.target.trigger(api.options.show.when.event);
               });
            }

            else
            {
               obj.cache.mouse = {
                  x: config.show.when.target.offset().left,
                  y: config.show.when.target.offset().top
               };

               construct.call(obj);
            }
         };
      });
   };

   function qTip(target, options, id)
   {
      var self = this;

      self.id = id;
      self.options = options;
      self.status = {
         animated: false,
         rendered: false,
         disabled: false,
         focused: false
      };
      self.elements = {
         target: target.addClass(self.options.style.classes.target),
         tooltip: null,
         wrapper: null,
         content: null,
         contentWrapper: null,
         title: null,
         button: null,
         tip: null,
         bgiframe: null
      };
      self.cache = {
         mouse: {},
         position: {},
         toggle: 0
      };
      self.timers = {};

      $.extend(self, self.options.api,
      {
         show: function(event)
         {
            var returned, solo;

            if(!self.status.rendered)
               return $.fn.qtip.log.error.call(self, 2, $.fn.qtip.constants.TOOLTIP_NOT_RENDERED, 'show');

            if(self.elements.tooltip.css('display') !== 'none') return self;

            self.elements.tooltip.stop(true, false);

            returned = self.beforeShow.call(self, event);
            if(returned === false) return self;

            function afterShow()
            {
               if(self.options.position.type !== 'static') self.focus();
               self.onShow.call(self, event);

               if($.browser.msie) self.elements.tooltip.get(0).style.removeAttribute('filter');
            };

            self.cache.toggle = 1;

            if(self.options.position.type !== 'static')
               self.updatePosition(event, (self.options.show.effect.length > 0));

            if(typeof self.options.show.solo == 'object') solo = $(self.options.show.solo);
            else if(self.options.show.solo === true) solo = $('div.qtip').not(self.elements.tooltip);
            if(solo) solo.each(function(){ if($(this).qtip('api').status.rendered === true) $(this).qtip('api').hide(); });

            if(typeof self.options.show.effect.type == 'function')
            {
               self.options.show.effect.type.call(self.elements.tooltip, self.options.show.effect.length);
               self.elements.tooltip.queue(function(){ afterShow(); $(this).dequeue(); });
            }
            else
            {
               switch(self.options.show.effect.type.toLowerCase())
               {
                  case 'fade':
                     self.elements.tooltip.fadeIn(self.options.show.effect.length, afterShow);
                     break;
                  case 'slide':
                     self.elements.tooltip.slideDown(self.options.show.effect.length, function()
                     {
                        afterShow();
                        if(self.options.position.type !== 'static') self.updatePosition(event, true);
                     });
                     break;
                  case 'grow':
                     self.elements.tooltip.show(self.options.show.effect.length, afterShow);
                     break;
                  default:
                     self.elements.tooltip.show(null, afterShow);
                     break;
               };

               self.elements.tooltip.addClass(self.options.style.classes.active);
            };

            return $.fn.qtip.log.error.call(self, 1, $.fn.qtip.constants.EVENT_SHOWN, 'show');
         },

         hide: function(event)
         {
            var returned;

            if(!self.status.rendered)
               return $.fn.qtip.log.error.call(self, 2, $.fn.qtip.constants.TOOLTIP_NOT_RENDERED, 'hide');

            else if(self.elements.tooltip.css('display') === 'none') return self;

            clearTimeout(self.timers.show);
            self.elements.tooltip.stop(true, false);

            returned = self.beforeHide.call(self, event);
            if(returned === false) return self;

            function afterHide(){ self.onHide.call(self, event); };

            self.cache.toggle = 0;

            if(typeof self.options.hide.effect.type == 'function')
            {
               self.options.hide.effect.type.call(self.elements.tooltip, self.options.hide.effect.length);
               self.elements.tooltip.queue(function(){ afterHide(); $(this).dequeue(); });
            }
            else
            {
               switch(self.options.hide.effect.type.toLowerCase())
               {
                  case 'fade':
                     self.elements.tooltip.fadeOut(self.options.hide.effect.length, afterHide);
                     break;
                  case 'slide':
                     self.elements.tooltip.slideUp(self.options.hide.effect.length, afterHide);
                     break;
                  case 'grow':
                     self.elements.tooltip.hide(self.options.hide.effect.length, afterHide);
                     break;
                  default:
                     self.elements.tooltip.hide(null, afterHide);
                     break;
               };

               self.elements.tooltip.removeClass(self.options.style.classes.active);
            };

            return $.fn.qtip.log.error.call(self, 1, $.fn.qtip.constants.EVENT_HIDDEN, 'hide');
         },

         updatePosition: function(event, animate)
         {
            var i, target, tooltip, coords, mapName, imagePos, newPosition, ieAdjust, ie6Adjust, borderAdjust, mouseAdjust, offset, curPosition, returned

            if(!self.status.rendered)
               return $.fn.qtip.log.error.call(self, 2, $.fn.qtip.constants.TOOLTIP_NOT_RENDERED, 'updatePosition');

            else if(self.options.position.type == 'static')
               return $.fn.qtip.log.error.call(self, 1, $.fn.qtip.constants.CANNOT_POSITION_STATIC, 'updatePosition');

            target = {
               position: { left: 0, top: 0 },
               dimensions: { height: 0, width: 0 },
               corner: self.options.position.corner.target
            };
            tooltip = {
               position: self.getPosition(),
               dimensions: self.getDimensions(),
               corner: self.options.position.corner.tooltip
            };

            if(self.options.position.target !== 'mouse')
            {
               if(self.options.position.target.get(0).nodeName.toLowerCase() == 'area')
               {
                  coords = self.options.position.target.attr('coords').split(',');
                  for(i = 0; i < coords.length; i++) coords[i] = parseInt(coords[i]);

                  mapName = self.options.position.target.parent('map').attr('name');
                  imagePos = $('img[usemap="#'+mapName+'"]:first').offset();
                  target.position = {
                     left: Math.floor(imagePos.left + coords[0]),
                     top: Math.floor(imagePos.top + coords[1])
                  };

                  switch(self.options.position.target.attr('shape').toLowerCase())
                  {
                     case 'rect':
                        target.dimensions = {
                           width: Math.ceil(Math.abs(coords[2] - coords[0])),
                           height: Math.ceil(Math.abs(coords[3] - coords[1]))
                        };
                        break;

                     case 'circle':
                        target.dimensions = {
                           width: coords[2] + 1,
                           height: coords[2] + 1
                        };
                        break;

                     case 'poly':
                        target.dimensions = {
                           width: coords[0],
                           height: coords[1]
                        };

                        for(i = 0; i < coords.length; i++)
                        {
                           if(i % 2 == 0)
                           {
                              if(coords[i] > target.dimensions.width)
                                 target.dimensions.width = coords[i];
                              if(coords[i] < coords[0])
                                 target.position.left = Math.floor(imagePos.left + coords[i]);
                           }
                           else
                           {
                              if(coords[i] > target.dimensions.height)
                                 target.dimensions.height = coords[i];
                              if(coords[i] < coords[1])
                                 target.position.top = Math.floor(imagePos.top + coords[i]);
                           };
                        };

                        target.dimensions.width = target.dimensions.width - (target.position.left - imagePos.left);
                        target.dimensions.height = target.dimensions.height - (target.position.top - imagePos.top);
                        break;

                     default:
                        return $.fn.qtip.log.error.call(self, 4, $.fn.qtip.constants.INVALID_AREA_SHAPE, 'updatePosition');
                        break;
                  };

                  target.dimensions.width -= 2; target.dimensions.height -= 2;
               }

               else if(self.options.position.target.add(document.body).length === 1)
               {
                  target.position = { left: $(document).scrollLeft(), top: $(document).scrollTop() };
                  target.dimensions = { height: $(window).height(), width: $(window).width() };
               }

               else
               {
                  if(typeof self.options.position.target.attr('qtip') !== 'undefined')
                     target.position = self.options.position.target.qtip('api').cache.position;
                  else
                     target.position = self.options.position.target.offset();

                  target.dimensions = {
                     height: self.options.position.target.outerHeight(),
                     width: self.options.position.target.outerWidth()
                  };
               };

               newPosition = $.extend({}, target.position);
               if(target.corner.search(/right/i) !== -1)
                  newPosition.left += target.dimensions.width;

               if(target.corner.search(/bottom/i) !== -1)
                  newPosition.top += target.dimensions.height;

               if(target.corner.search(/((top|bottom)Middle)|center/) !== -1)
                  newPosition.left += (target.dimensions.width / 2);

               if(target.corner.search(/((left|right)Middle)|center/) !== -1)
                  newPosition.top += (target.dimensions.height / 2);
            }

            else
            {
               target.position = newPosition = { left: self.cache.mouse.x, top: self.cache.mouse.y };
               target.dimensions = { height: 1, width: 1 };
            };

            if(tooltip.corner.search(/right/i) !== -1)
               newPosition.left -= tooltip.dimensions.width;

            if(tooltip.corner.search(/bottom/i) !== -1)
               newPosition.top -= tooltip.dimensions.height;

            if(tooltip.corner.search(/((top|bottom)Middle)|center/) !== -1)
               newPosition.left -= (tooltip.dimensions.width / 2);

            if(tooltip.corner.search(/((left|right)Middle)|center/) !== -1)
               newPosition.top -= (tooltip.dimensions.height / 2);

            ieAdjust = ($.browser.msie) ? 1 : 0; // And this is why I hate IE...
            ie6Adjust = ($.browser.msie && parseInt($.browser.version.charAt(0)) === 6) ? 1 : 0; // ...and even more so IE6!

            if(self.options.style.border.radius > 0)
            {
               if(tooltip.corner.search(/Left/) !== -1)
                  newPosition.left -= self.options.style.border.radius;
               else if(tooltip.corner.search(/Right/) !== -1)
                  newPosition.left += self.options.style.border.radius;

               if(tooltip.corner.search(/Top/) !== -1)
                  newPosition.top -= self.options.style.border.radius;
               else if(tooltip.corner.search(/Bottom/) !== -1)
                  newPosition.top += self.options.style.border.radius;
            };

            if(ieAdjust)
            {
               if(tooltip.corner.search(/top/) !== -1)
                  newPosition.top -= ieAdjust
               else if(tooltip.corner.search(/bottom/) !== -1)
                  newPosition.top += ieAdjust

               if(tooltip.corner.search(/left/) !== -1)
                  newPosition.left -= ieAdjust
               else if(tooltip.corner.search(/right/) !== -1)
                  newPosition.left += ieAdjust

               if(tooltip.corner.search(/leftMiddle|rightMiddle/) !== -1)
                  newPosition.top -= 1
            };

            if(self.options.position.adjust.screen === true)
               newPosition = screenAdjust.call(self, newPosition, target, tooltip);

            if(self.options.position.target === 'mouse' && self.options.position.adjust.mouse === true)
            {
               if(self.options.position.adjust.screen === true && self.elements.tip)
                  mouseAdjust = self.elements.tip.attr('rel');
               else
                  mouseAdjust = self.options.position.corner.tooltip;

               newPosition.left += (mouseAdjust.search(/right/i) !== -1) ? -6 : 6;
               newPosition.top += (mouseAdjust.search(/bottom/i) !== -1) ? -6 : 6;
            }

            if(!self.elements.bgiframe && $.browser.msie && parseInt($.browser.version.charAt(0)) == 6)
            {
               $('select, object').each(function()
               {
                  offset = $(this).offset();
                  offset.bottom = offset.top + $(this).height();
                  offset.right = offset.left + $(this).width();

                  if(newPosition.top + tooltip.dimensions.height >= offset.top
                  && newPosition.left + tooltip.dimensions.width >= offset.left)
                     bgiframe.call(self);
               });
            };

            newPosition.left += self.options.position.adjust.x;
            newPosition.top += self.options.position.adjust.y;

            curPosition = self.getPosition();
            if(newPosition.left != curPosition.left || newPosition.top != curPosition.top)
            {
               returned = self.beforePositionUpdate.call(self, event);
               if(returned === false) return self;

               self.cache.position = newPosition;

               if(animate === true)
               {
                  self.status.animated = true;

                  self.elements.tooltip.animate(newPosition, 200, 'swing', function(){ self.status.animated = false });
               }

               else self.elements.tooltip.css(newPosition);

               self.onPositionUpdate.call(self, event);
               if(typeof event !== 'undefined' && event.type && event.type !== 'mousemove')
                  $.fn.qtip.log.error.call(self, 1, $.fn.qtip.constants.EVENT_POSITION_UPDATED, 'updatePosition');
            };

            return self;
         },

         updateWidth: function(newWidth)
         {
            var hidden;

            if(!self.status.rendered)
               return $.fn.qtip.log.error.call(self, 2, $.fn.qtip.constants.TOOLTIP_NOT_RENDERED, 'updateWidth');

            else if(newWidth && typeof newWidth !== 'number')
               return $.fn.qtip.log.error.call(self, 2, 'newWidth must be of type number', 'updateWidth');

            hidden = self.elements.contentWrapper.siblings().add(self.elements.tip).add(self.elements.button);

            if(!newWidth)
            {
               if(typeof self.options.style.width.value == 'number')
                  newWidth = self.options.style.width.value;

               else
               {
                  self.elements.tooltip.css({ width: 'auto' });
                  hidden.hide();

                  if($.browser.msie)
                     self.elements.wrapper.add(self.elements.contentWrapper.children()).css({ zoom: 'normal' });

                  newWidth = self.getDimensions().width + 1;

                  if(!self.options.style.width.value)
                  {
                     if(newWidth > self.options.style.width.max) newWidth = self.options.style.width.max
                     if(newWidth < self.options.style.width.min) newWidth = self.options.style.width.min
                  };
               };
            };

            if(newWidth % 2 !== 0) newWidth -= 1;

            self.elements.tooltip.width(newWidth);
            hidden.show();

            if(self.options.style.border.radius)
            {
               self.elements.tooltip.find('.qtip-betweenCorners').each(function(i)
               {
                  $(this).width(newWidth - (self.options.style.border.radius * 2));
               })
            };

            if($.browser.msie)
            {
               self.elements.wrapper.add(self.elements.contentWrapper.children()).css({ zoom: '1' });

               self.elements.wrapper.width(newWidth);

               if(self.elements.bgiframe) self.elements.bgiframe.width(newWidth).height(self.getDimensions.height);
            };

            return $.fn.qtip.log.error.call(self, 1, $.fn.qtip.constants.EVENT_WIDTH_UPDATED, 'updateWidth');
         },

         updateStyle: function(name)
         {
            var tip, borders, context, corner, coordinates;

            if(!self.status.rendered)
               return $.fn.qtip.log.error.call(self, 2, $.fn.qtip.constants.TOOLTIP_NOT_RENDERED, 'updateStyle');

            else if(typeof name !== 'string' || !$.fn.qtip.styles[name])
               return $.fn.qtip.log.error.call(self, 2, $.fn.qtip.constants.STYLE_NOT_DEFINED, 'updateStyle');

            self.options.style = buildStyle.call(self, $.fn.qtip.styles[name], self.options.user.style);

            self.elements.content.css( jQueryStyle(self.options.style) );
            if(self.options.content.title.text !== false)
               self.elements.title.css( jQueryStyle(self.options.style.title, true) );

            self.elements.contentWrapper.css({ borderColor: self.options.style.border.color });

            if(self.options.style.tip.corner !== false)
            {
               if($('<canvas>').get(0).getContext)
               {
                  tip = self.elements.tooltip.find('.qtip-tip canvas:first');
                  context = tip.get(0).getContext('2d');
                  context.clearRect(0,0,300,300);

                  corner = tip.parent('div[rel]:first').attr('rel');
                  coordinates = calculateTip(corner, self.options.style.tip.size.width, self.options.style.tip.size.height);
                  drawTip.call(self, tip, coordinates, self.options.style.tip.color || self.options.style.border.color);
               }
               else if($.browser.msie)
               {
                  tip = self.elements.tooltip.find('.qtip-tip [nodeName="shape"]');
                  tip.attr('fillcolor', self.options.style.tip.color || self.options.style.border.color);
               };
            };

            if(self.options.style.border.radius > 0)
            {
               self.elements.tooltip.find('.qtip-betweenCorners').css({ backgroundColor: self.options.style.border.color });

               if($('<canvas>').get(0).getContext)
               {
                  borders = calculateBorders(self.options.style.border.radius)
                  self.elements.tooltip.find('.qtip-wrapper canvas').each(function()
                  {
                     context = $(this).get(0).getContext('2d');
                     context.clearRect(0,0,300,300);

                     corner = $(this).parent('div[rel]:first').attr('rel')
                     drawBorder.call(self, $(this), borders[corner],
                        self.options.style.border.radius, self.options.style.border.color);
                  });
               }
               else if($.browser.msie)
               {
                  self.elements.tooltip.find('.qtip-wrapper [nodeName="arc"]').each(function()
                  {
                     $(this).attr('fillcolor', self.options.style.border.color)
                  });
               };
            };

            return $.fn.qtip.log.error.call(self, 1, $.fn.qtip.constants.EVENT_STYLE_UPDATED, 'updateStyle');
         },

         updateContent: function(content, reposition)
         {
            var parsedContent, images, loadedImages;

            if(!self.status.rendered)
               return $.fn.qtip.log.error.call(self, 2, $.fn.qtip.constants.TOOLTIP_NOT_RENDERED, 'updateContent');

            else if(!content)
               return $.fn.qtip.log.error.call(self, 2, $.fn.qtip.constants.NO_CONTENT_PROVIDED, 'updateContent');

            parsedContent = self.beforeContentUpdate.call(self, content);
            if(typeof parsedContent == 'string') content = parsedContent;
            else if(parsedContent === false) return;

            if($.browser.msie) self.elements.contentWrapper.children().css({ zoom: 'normal' });

            if(content.jquery && content.length > 0)
               content.clone(true).appendTo(self.elements.content).show();

            else self.elements.content.html(content);

            images = self.elements.content.find('img[complete=false]');
            if(images.length > 0)
            {
               loadedImages = 0;
               images.each(function(i)
               {
                  $('<img src="'+ $(this).attr('src') +'" />')
                     .load(function(){ if(++loadedImages == images.length) afterLoad(); });
               });
            }
            else afterLoad();

            function afterLoad()
            {
               self.updateWidth();

               if(reposition !== false)
               {
                  if(self.options.position.type !== 'static')
                     self.updatePosition(self.elements.tooltip.is(':visible'), true);

                  if(self.options.style.tip.corner !== false)
                     positionTip.call(self);
               };
            };

            self.onContentUpdate.call(self);
            return $.fn.qtip.log.error.call(self, 1, $.fn.qtip.constants.EVENT_CONTENT_UPDATED, 'loadContent');
         },

         loadContent: function(url, data, method)
         {
            var returned;

            if(!self.status.rendered)
               return $.fn.qtip.log.error.call(self, 2, $.fn.qtip.constants.TOOLTIP_NOT_RENDERED, 'loadContent');

            returned = self.beforeContentLoad.call(self);
            if(returned === false) return self;

            if(method == 'post')
               $.post(url, data, setupContent);
            else
               $.get(url, data, setupContent);

            function setupContent(content)
            {
               self.onContentLoad.call(self);
               $.fn.qtip.log.error.call(self, 1, $.fn.qtip.constants.EVENT_CONTENT_LOADED, 'loadContent');

               self.updateContent(content);
            };

            return self;
         },

         updateTitle: function(content)
         {
            if(!self.status.rendered)
               return $.fn.qtip.log.error.call(self, 2, $.fn.qtip.constants.TOOLTIP_NOT_RENDERED, 'updateTitle');

            else if(!content)
               return $.fn.qtip.log.error.call(self, 2, $.fn.qtip.constants.NO_CONTENT_PROVIDED, 'updateTitle');

            returned = self.beforeTitleUpdate.call(self);
            if(returned === false) return self;

            if(self.elements.button) self.elements.button = self.elements.button.clone(true);
            self.elements.title.html(content)
            if(self.elements.button) self.elements.title.prepend(self.elements.button);

            self.onTitleUpdate.call(self);
            return $.fn.qtip.log.error.call(self, 1, $.fn.qtip.constants.EVENT_TITLE_UPDATED, 'updateTitle');
         },

         focus: function(event)
         {
            var curIndex, newIndex, elemIndex, returned;

            if(!self.status.rendered)
               return $.fn.qtip.log.error.call(self, 2, $.fn.qtip.constants.TOOLTIP_NOT_RENDERED, 'focus');

            else if(self.options.position.type == 'static')
               return $.fn.qtip.log.error.call(self, 1, $.fn.qtip.constants.CANNOT_FOCUS_STATIC, 'focus');

            curIndex = parseInt( self.elements.tooltip.css('z-index') );
            newIndex = 6000 + $('div.qtip[qtip]').length - 1;

            if(!self.status.focused && curIndex !== newIndex)
            {
               returned = self.beforeFocus.call(self, event);
               if(returned === false) return self;

               $('div.qtip[qtip]').not(self.elements.tooltip).each(function()
               {
                  if($(this).qtip('api').status.rendered === true)
                  {
                     elemIndex = parseInt($(this).css('z-index'));

                     if(typeof elemIndex == 'number' && elemIndex > -1)
                        $(this).css({ zIndex: parseInt( $(this).css('z-index') ) - 1 });

                     $(this).qtip('api').status.focused = false;
                  }
               })

               self.elements.tooltip.css({ zIndex: newIndex });
               self.status.focused = true;

               self.onFocus.call(self, event);
               $.fn.qtip.log.error.call(self, 1, $.fn.qtip.constants.EVENT_FOCUSED, 'focus');
            };

            return self;
         },

         disable: function(state)
         {
            if(!self.status.rendered)
               return $.fn.qtip.log.error.call(self, 2, $.fn.qtip.constants.TOOLTIP_NOT_RENDERED, 'disable');

            if(state)
            {
               if(!self.status.disabled)
               {
                  self.status.disabled = true;
                  $.fn.qtip.log.error.call(self, 1, $.fn.qtip.constants.EVENT_DISABLED, 'disable');
               }

               else  $.fn.qtip.log.error.call(self, 1, $.fn.qtip.constants.TOOLTIP_ALREADY_DISABLED, 'disable');
            }
            else
            {
               if(self.status.disabled)
               {
                  self.status.disabled = false;
                  $.fn.qtip.log.error.call(self, 1, $.fn.qtip.constants.EVENT_ENABLED, 'disable');
               }

               else $.fn.qtip.log.error.call(self, 1, $.fn.qtip.constants.TOOLTIP_ALREADY_ENABLED, 'disable');
            };

            return self;
         },

         destroy: function()
         {
            var i, returned, interfaces;

            returned = self.beforeDestroy.call(self);
            if(returned === false) return self;

            if(self.status.rendered)
            {
               self.options.show.when.target.unbind('mousemove.qtip', self.updatePosition);
               self.options.show.when.target.unbind('mouseout.qtip', self.hide);
               self.options.show.when.target.unbind(self.options.show.when.event + '.qtip');
               self.options.hide.when.target.unbind(self.options.hide.when.event + '.qtip');
               self.elements.tooltip.unbind(self.options.hide.when.event + '.qtip');
               self.elements.tooltip.unbind('mouseover.qtip', self.focus);
               self.elements.tooltip.remove();
            }

            else self.options.show.when.target.unbind(self.options.show.when.event+'.qtip-create');

            if(typeof self.elements.target.data('qtip') == 'object')
            {
               interfaces = self.elements.target.data('qtip').interfaces;
               if(typeof interfaces == 'object' && interfaces.length > 0)
               {
                  for(i = 0; i < interfaces.length - 1; i++)
                     if(interfaces[i].id == self.id) interfaces.splice(i, 1)
               }
            }
            delete $.fn.qtip.interfaces[self.id];

            if(typeof interfaces == 'object' && interfaces.length > 0)
               self.elements.target.data('qtip').current = interfaces.length -1;
            else
               self.elements.target.removeData('qtip');

            self.onDestroy.call(self);
            $.fn.qtip.log.error.call(self, 1, $.fn.qtip.constants.EVENT_DESTROYED, 'destroy');

            return self.elements.target
         },

         getPosition: function()
         {
            var show, offset;

            if(!self.status.rendered)
               return $.fn.qtip.log.error.call(self, 2, $.fn.qtip.constants.TOOLTIP_NOT_RENDERED, 'getPosition');

            show = (self.elements.tooltip.css('display') !== 'none') ? false : true;

            if(show) self.elements.tooltip.css({ visiblity: 'hidden' }).show();
            offset = self.elements.tooltip.offset();
            if(show) self.elements.tooltip.css({ visiblity: 'visible' }).hide();

            return offset;
         },

         getDimensions: function()
         {
            var show, dimensions;

            if(!self.status.rendered)
               return $.fn.qtip.log.error.call(self, 2, $.fn.qtip.constants.TOOLTIP_NOT_RENDERED, 'getDimensions');

            show = (!self.elements.tooltip.is(':visible')) ? true : false;

            if(show) self.elements.tooltip.css({ visiblity: 'hidden' }).show();
            dimensions = {
               height: self.elements.tooltip.outerHeight(),
               width: self.elements.tooltip.outerWidth()
            };
            if(show) self.elements.tooltip.css({ visiblity: 'visible' }).hide();

            return dimensions;
         }
      });
   };

   function construct()
   {
      var self, adjust, content, url, data, method, tempLength;
      self = this;

      self.beforeRender.call(self);

      self.status.rendered = true;

      self.elements.tooltip =  '<div qtip="'+self.id+'" ' +
         'class="qtip '+(self.options.style.classes.tooltip || self.options.style)+'"' +
         'style="display:none; -moz-border-radius:0; -webkit-border-radius:0; border-radius:0;' +
         'position:'+self.options.position.type+';">' +
         '  <div class="qtip-wrapper" style="position:relative; overflow:hidden; text-align:left;">' +
         '    <div class="qtip-contentWrapper" style="overflow:hidden;">' +
         '       <div class="qtip-content '+self.options.style.classes.content+'"></div>' +
         '</div></div></div>';

      self.elements.tooltip = $(self.elements.tooltip);
      self.elements.tooltip.appendTo(self.options.position.container)

      self.elements.tooltip.data('qtip', { current: 0, interfaces: [self] });

      self.elements.wrapper = self.elements.tooltip.children('div:first');
      self.elements.contentWrapper = self.elements.wrapper.children('div:first').css({ background: self.options.style.background });
      self.elements.content = self.elements.contentWrapper.children('div:first').css( jQueryStyle(self.options.style) );

      if($.browser.msie) self.elements.wrapper.add(self.elements.content).css({ zoom: 1 });

      if(self.options.hide.when.event == 'unfocus') self.elements.tooltip.attr('unfocus', true);

      if(typeof self.options.style.width.value == 'number') self.updateWidth();

      if($('<canvas>').get(0).getContext || $.browser.msie)
      {
         if(self.options.style.border.radius > 0)
            createBorder.call(self);
         else
            self.elements.contentWrapper.css({ border: self.options.style.border.width+'px solid '+self.options.style.border.color  });

         if(self.options.style.tip.corner !== false)
            createTip.call(self);
      }

      else
      {
         self.elements.contentWrapper.css({ border: self.options.style.border.width+'px solid '+self.options.style.border.color  });

         self.options.style.border.radius = 0;
         self.options.style.tip.corner = false;

         $.fn.qtip.log.error.call(self, 2, $.fn.qtip.constants.CANVAS_VML_NOT_SUPPORTED, 'render');
      };

      if((typeof self.options.content.text == 'string' && self.options.content.text.length > 0)
      || (self.options.content.text.jquery && self.options.content.text.length > 0))
         content = self.options.content.text;

      else if(typeof self.elements.target.attr('title') == 'string' && self.elements.target.attr('title').length > 0)
      {
         content = self.elements.target.attr('title').replace("\\n", '<br />');
         self.elements.target.attr('title', ''); // Remove title attribute to prevent default tooltip showing
      }

      else if(typeof self.elements.target.attr('alt') == 'string' && self.elements.target.attr('alt').length > 0)
      {
         content = self.elements.target.attr('alt').replace("\\n", '<br />');
         self.elements.target.attr('alt', ''); // Remove alt attribute to prevent default tooltip showing
      }

      else
      {
         content = ' ';
         $.fn.qtip.log.error.call(self, 1, $.fn.qtip.constants.NO_VALID_CONTENT, 'render');
      };

      if(self.options.content.title.text !== false) createTitle.call(self);
      self.updateContent(content);

      assignEvents.call(self);
      if(self.options.show.ready === true) self.show();

      if(self.options.content.url !== false)
      {
         url = self.options.content.url;
         data = self.options.content.data;
         method = self.options.content.method || 'get';
         self.loadContent(url, data, method);
      };

      self.onRender.call(self);
      $.fn.qtip.log.error.call(self, 1, $.fn.qtip.constants.EVENT_RENDERED, 'render');
   };

   function createBorder()
   {
      var self, i, width, radius, color, coordinates, containers, size, betweenWidth, betweenCorners, borderTop, borderBottom, borderCoord, sideWidth, vertWidth;
      self = this;

      self.elements.wrapper.find('.qtip-borderBottom, .qtip-borderTop').remove();

      width = self.options.style.border.width;
      radius = self.options.style.border.radius;
      color = self.options.style.border.color || self.options.style.tip.color;

      coordinates = calculateBorders(radius);

      containers = {};
      for(i in coordinates)
      {
         containers[i] = '<div rel="'+i+'" style="'+((i.search(/Left/) !== -1) ? 'left' : 'right') + ':0; ' +
            'position:absolute; height:'+radius+'px; width:'+radius+'px; overflow:hidden; line-height:0.1px; font-size:1px">';

         if($('<canvas>').get(0).getContext)
            containers[i] += '<canvas height="'+radius+'" width="'+radius+'" style="vertical-align: top"></canvas>';

         else if($.browser.msie)
         {
            size = radius * 2 + 3;
            containers[i] += '<v:arc stroked="false" fillcolor="'+color+'" startangle="'+coordinates[i][0]+'" endangle="'+coordinates[i][1]+'" ' +
               'style="width:'+size+'px; height:'+size+'px; margin-top:'+((i.search(/bottom/) !== -1) ? -2 : -1)+'px; ' +
               'margin-left:'+((i.search(/Right/) !== -1) ? coordinates[i][2] - 3.5 : -1)+'px; ' +
               'vertical-align:top; display:inline-block; behavior:url(#default#VML)"></v:arc>';

         };

         containers[i] += '</div>';
      };

      betweenWidth = self.getDimensions().width - (Math.max(width, radius) * 2);
      betweenCorners = '<div class="qtip-betweenCorners" style="height:'+radius+'px; width:'+betweenWidth+'px; ' +
         'overflow:hidden; background-color:'+color+'; line-height:0.1px; font-size:1px;">';

      borderTop = '<div class="qtip-borderTop" dir="ltr" style="height:'+radius+'px; ' +
         'margin-left:'+radius+'px; line-height:0.1px; font-size:1px; padding:0;">' +
         containers['topLeft'] + containers['topRight'] + betweenCorners;
      self.elements.wrapper.prepend(borderTop);

      borderBottom = '<div class="qtip-borderBottom" dir="ltr" style="height:'+radius+'px; ' +
         'margin-left:'+radius+'px; line-height:0.1px; font-size:1px; padding:0;">' +
         containers['bottomLeft'] + containers['bottomRight'] + betweenCorners;
      self.elements.wrapper.append(borderBottom);

      if($('<canvas>').get(0).getContext)
      {
         self.elements.wrapper.find('canvas').each(function()
         {
            borderCoord = coordinates[ $(this).parent('[rel]:first').attr('rel') ];
            drawBorder.call(self, $(this), borderCoord, radius, color);
         })
      }

      else if($.browser.msie) self.elements.tooltip.append('<v:image style="behavior:url(#default#VML);"></v:image>');

      sideWidth = Math.max(radius, (radius + (width - radius)) )
      vertWidth = Math.max(width - radius, 0);
      self.elements.contentWrapper.css({
         border: '0px solid ' + color,
         borderWidth: vertWidth + 'px ' + sideWidth + 'px'
      })
   };

   function drawBorder(canvas, coordinates, radius, color)
   {
      var context = canvas.get(0).getContext('2d');
      context.fillStyle = color;
      context.beginPath();
      context.arc(coordinates[0], coordinates[1], radius, 0, Math.PI * 2, false);
      context.fill();
   };

   function createTip(corner)
   {
      var self, color, coordinates, coordsize, path;
      self = this;

      if(self.elements.tip !== null) self.elements.tip.remove();

      color = self.options.style.tip.color || self.options.style.border.color;
      if(self.options.style.tip.corner === false) return;
      else if(!corner) corner = self.options.style.tip.corner;

      coordinates = calculateTip(corner, self.options.style.tip.size.width, self.options.style.tip.size.height);

      self.elements.tip =  '<div class="'+self.options.style.classes.tip+'" dir="ltr" rel="'+corner+'" style="position:absolute; ' +
         'height:'+self.options.style.tip.size.height+'px; width:'+self.options.style.tip.size.width+'px; ' +
         'margin:0 auto; line-height:0.1px; font-size:1px;">';

      if($('<canvas>').get(0).getContext)
          self.elements.tip += '<canvas height="'+self.options.style.tip.size.height+'" width="'+self.options.style.tip.size.width+'"></canvas>';

      else if($.browser.msie)
      {
         coordsize = self.options.style.tip.size.width + ',' + self.options.style.tip.size.height;
         path = 'm' + coordinates[0][0] + ',' + coordinates[0][1];
         path += ' l' + coordinates[1][0] + ',' + coordinates[1][1];
         path += ' ' + coordinates[2][0] + ',' + coordinates[2][1];
         path += ' xe';

         self.elements.tip += '<v:shape fillcolor="'+color+'" stroked="false" filled="true" path="'+path+'" coordsize="'+coordsize+'" ' +
            'style="width:'+self.options.style.tip.size.width+'px; height:'+self.options.style.tip.size.height+'px; ' +
            'line-height:0.1px; display:inline-block; behavior:url(#default#VML); ' +
            'vertical-align:'+((corner.search(/top/) !== -1) ? 'bottom' : 'top')+'"></v:shape>';

         self.elements.tip += '<v:image style="behavior:url(#default#VML);"></v:image>';

         self.elements.contentWrapper.css('position', 'relative');
      };

      self.elements.tooltip.prepend(self.elements.tip + '</div>');

      self.elements.tip = self.elements.tooltip.find('.'+self.options.style.classes.tip).eq(0);
      if($('<canvas>').get(0).getContext)
         drawTip.call(self, self.elements.tip.find('canvas:first'), coordinates, color);

      if(corner.search(/top/) !== -1 && $.browser.msie && parseInt($.browser.version.charAt(0)) === 6)
         self.elements.tip.css({ marginTop: -4 });

      positionTip.call(self, corner);
   };

   function drawTip(canvas, coordinates, color)
   {
      var context = canvas.get(0).getContext('2d');
      context.fillStyle = color;

      context.beginPath();
      context.moveTo(coordinates[0][0], coordinates[0][1]);
      context.lineTo(coordinates[1][0], coordinates[1][1]);
      context.lineTo(coordinates[2][0], coordinates[2][1]);
      context.fill();
   };

   function positionTip(corner)
   {
      var self, ieAdjust, paddingCorner, paddingSize, newMargin;
      self = this;

      if(self.options.style.tip.corner === false || !self.elements.tip) return;
      if(!corner) corner = self.elements.tip.attr('rel');

      ieAdjust = positionAdjust = ($.browser.msie) ? 1 : 0;

      self.elements.tip.css(corner.match(/left|right|top|bottom/)[0], 0);

      if(corner.search(/top|bottom/) !== -1)
      {
         if($.browser.msie)
         {
            if(parseInt($.browser.version.charAt(0)) === 6)
               positionAdjust = (corner.search(/top/) !== -1) ? -3 : 1;
            else
               positionAdjust = (corner.search(/top/) !== -1) ? 1 : 2;
         };

         if(corner.search(/Middle/) !== -1)
            self.elements.tip.css({ left: '50%', marginLeft: -(self.options.style.tip.size.width / 2) });

         else if(corner.search(/Left/) !== -1)
            self.elements.tip.css({ left: self.options.style.border.radius - ieAdjust });

         else if(corner.search(/Right/) !== -1)
            self.elements.tip.css({ right: self.options.style.border.radius + ieAdjust });

         if(corner.search(/top/) !== -1)
            self.elements.tip.css({ top: -positionAdjust });
         else
            self.elements.tip.css({ bottom: positionAdjust });

      }
      else if(corner.search(/left|right/) !== -1)
      {
         if($.browser.msie)
            positionAdjust = (parseInt($.browser.version.charAt(0)) === 6) ? 1 : ((corner.search(/left/) !== -1) ? 1 : 2);

         if(corner.search(/Middle/) !== -1)
            self.elements.tip.css({ top: '50%', marginTop: -(self.options.style.tip.size.height / 2) });

         else if(corner.search(/Top/) !== -1)
            self.elements.tip.css({ top: self.options.style.border.radius - ieAdjust });

         else if(corner.search(/Bottom/) !== -1)
            self.elements.tip.css({ bottom: self.options.style.border.radius + ieAdjust });

         if(corner.search(/left/) !== -1)
            self.elements.tip.css({ left: -positionAdjust });
         else
            self.elements.tip.css({ right: positionAdjust });
      };

      paddingCorner = 'padding-' + corner.match(/left|right|top|bottom/)[0];
      paddingSize = self.options.style.tip.size[ (paddingCorner.search(/left|right/) !== -1) ? 'width' : 'height' ];
      self.elements.tooltip.css('padding', 0);
      self.elements.tooltip.css(paddingCorner, paddingSize);

      if($.browser.msie && parseInt($.browser.version.charAt(0)) == 6)
      {
         newMargin = parseInt(self.elements.tip.css('margin-top')) || 0;
         newMargin += parseInt(self.elements.content.css('margin-top')) || 0;

         self.elements.tip.css({ marginTop: newMargin });
      };
   };

   function createTitle()
   {
      var self = this;

      if(self.elements.title !== null) self.elements.title.remove();

      self.elements.title = $('<div class="'+self.options.style.classes.title+'">')
         .css( jQueryStyle(self.options.style.title, true) )
         .css({ zoom: ($.browser.msie) ? 1 : 0 })
         .prependTo(self.elements.contentWrapper);

      if(self.options.content.title.text) self.updateTitle.call(self, self.options.content.title.text);

      if(self.options.content.title.button !== false
      && typeof self.options.content.title.button == 'string')
      {
         self.elements.button = $('<a class="'+self.options.style.classes.button+'" style="float:right; position: relative"></a>')
            .css( jQueryStyle(self.options.style.button, true) )
            .html(self.options.content.title.button)
            .prependTo(self.elements.title)
            .click(function(event){ if(!self.status.disabled) self.hide(event) });
      };
   };

   function assignEvents()
   {
      var self, showTarget, hideTarget, inactiveEvents;
      self = this;

      showTarget = self.options.show.when.target;
      hideTarget = self.options.hide.when.target;

      if(self.options.hide.fixed) hideTarget = hideTarget.add(self.elements.tooltip);

      if(self.options.hide.when.event == 'inactive')
      {
         inactiveEvents = ['click', 'dblclick', 'mousedown', 'mouseup', 'mousemove',
         'mouseout', 'mouseenter', 'mouseleave', 'mouseover' ];

         function inactiveMethod(event)
         {
            if(self.status.disabled === true) return;

            clearTimeout(self.timers.inactive);
            self.timers.inactive = setTimeout(function()
            {
               $(inactiveEvents).each(function()
               {
                  hideTarget.unbind(this+'.qtip-inactive');
                  self.elements.content.unbind(this+'.qtip-inactive');
               });

               self.hide(event);
            }
            , self.options.hide.delay);
         };
      }

      else if(self.options.hide.fixed === true)
      {
         self.elements.tooltip.bind('mouseover.qtip', function()
         {
            if(self.status.disabled === true) return;

            clearTimeout(self.timers.hide);
         });
      };

      function showMethod(event)
      {
         if(self.status.disabled === true) return;

         if(self.options.hide.when.event == 'inactive')
         {
            $(inactiveEvents).each(function()
            {
               hideTarget.bind(this+'.qtip-inactive', inactiveMethod);
               self.elements.content.bind(this+'.qtip-inactive', inactiveMethod);
            });

            inactiveMethod();
         };

         clearTimeout(self.timers.show);
         clearTimeout(self.timers.hide);

         self.timers.show = setTimeout(function(){ self.show(event); }, self.options.show.delay);
      };

      function hideMethod(event)
      {
         if(self.status.disabled === true) return;

         if(self.options.hide.fixed === true
         && self.options.hide.when.event.search(/mouse(out|leave)/i) !== -1
         && $(event.relatedTarget).parents('div.qtip[qtip]').length > 0)
         {
            event.stopPropagation();
            event.preventDefault();

            clearTimeout(self.timers.hide);
            return false;
         };

         clearTimeout(self.timers.show);
         clearTimeout(self.timers.hide);
         self.elements.tooltip.stop(true, true);

         self.timers.hide = setTimeout(function(){ self.hide(event); }, self.options.hide.delay);
      };

      if((self.options.show.when.target.add(self.options.hide.when.target).length === 1
      && self.options.show.when.event == self.options.hide.when.event
      && self.options.hide.when.event !== 'inactive')
      || self.options.hide.when.event == 'unfocus')
      {
         self.cache.toggle = 0;
         showTarget.bind(self.options.show.when.event + '.qtip', function(event)
         {
            if(self.cache.toggle == 0) showMethod(event);
            else hideMethod(event);
         });
      }

      else
      {
         showTarget.bind(self.options.show.when.event + '.qtip', showMethod);

         if(self.options.hide.when.event !== 'inactive')
            hideTarget.bind(self.options.hide.when.event + '.qtip', hideMethod);
      };

      if(self.options.position.type.search(/(fixed|absolute)/) !== -1)
         self.elements.tooltip.bind('mouseover.qtip', self.focus);

      if(self.options.position.target === 'mouse' && self.options.position.type !== 'static')
      {
         showTarget.bind('mousemove.qtip', function(event)
         {
            self.cache.mouse = { x: event.pageX, y: event.pageY };

            if(self.status.disabled === false
            && self.options.position.adjust.mouse === true
            && self.options.position.type !== 'static'
            && self.elements.tooltip.css('display') !== 'none')
               self.updatePosition(event);
         });
      };
   };

   function screenAdjust(position, target, tooltip)
   {
      var self, adjustedPosition, adjust, newCorner, overflow, corner;
      self = this;

      if(tooltip.corner == 'center') return target.position // TODO: 'center' corner adjustment
      adjustedPosition = $.extend({}, position);
      newCorner = { x: false, y: false };

      overflow = {
         left: (adjustedPosition.left < $.fn.qtip.cache.screen.scroll.left),
         right: (adjustedPosition.left + tooltip.dimensions.width + 2 >= $.fn.qtip.cache.screen.width + $.fn.qtip.cache.screen.scroll.left),
         top: (adjustedPosition.top < $.fn.qtip.cache.screen.scroll.top),
         bottom: (adjustedPosition.top + tooltip.dimensions.height + 2 >= $.fn.qtip.cache.screen.height + $.fn.qtip.cache.screen.scroll.top)
      };

      adjust = {
         left: (overflow.left && (tooltip.corner.search(/right/i) != -1 || (tooltip.corner.search(/right/i) == -1 && !overflow.right))),
         right: (overflow.right && (tooltip.corner.search(/left/i) != -1 || (tooltip.corner.search(/left/i) == -1 && !overflow.left))),
         top: (overflow.top && tooltip.corner.search(/top/i) == -1),
         bottom: (overflow.bottom && tooltip.corner.search(/bottom/i) == -1)
      };

      if(adjust.left)
      {
         if(self.options.position.target !== 'mouse')
            adjustedPosition.left = target.position.left + target.dimensions.width;
         else
            adjustedPosition.left = self.cache.mouse.x

         newCorner.x = 'Left';
      }

      else if(adjust.right)
      {
         if(self.options.position.target !== 'mouse')
            adjustedPosition.left = target.position.left - tooltip.dimensions.width;
         else
            adjustedPosition.left = self.cache.mouse.x - tooltip.dimensions.width;

         newCorner.x = 'Right';
      };

      if(adjust.top)
      {
         if(self.options.position.target !== 'mouse')
            adjustedPosition.top = target.position.top + target.dimensions.height;
         else
            adjustedPosition.top = self.cache.mouse.y

         newCorner.y = 'top';
      }

      else if(adjust.bottom)
      {
         if(self.options.position.target !== 'mouse')
            adjustedPosition.top = target.position.top - tooltip.dimensions.height;
         else
            adjustedPosition.top = self.cache.mouse.y - tooltip.dimensions.height;

         newCorner.y = 'bottom';
      };

      if(adjustedPosition.left < 0)
      {
         adjustedPosition.left = position.left;
         newCorner.x = false;
      };
      if(adjustedPosition.top < 0)
      {
         adjustedPosition.top = position.top;
         newCorner.y = false;
      };

      if(self.options.style.tip.corner !== false)
      {
         adjustedPosition.corner = new String(tooltip.corner);
         if(newCorner.x !== false) adjustedPosition.corner = adjustedPosition.corner.replace(/Left|Right|Middle/, newCorner.x);
         if(newCorner.y !== false) adjustedPosition.corner = adjustedPosition.corner.replace(/top|bottom/, newCorner.y);

         if(adjustedPosition.corner !== self.elements.tip.attr('rel'))
            createTip.call(self, adjustedPosition.corner);
      };

      return adjustedPosition;
   };

   function jQueryStyle(style, sub)
   {
      var styleObj, i;

      styleObj = $.extend(true, {}, style);
      for(i in styleObj)
      {
         if(sub === true && i.search(/(tip|classes)/i) !== -1)
            delete styleObj[i];
         else if(!sub && i.search(/(width|border|tip|title|classes|user)/i) !== -1)
            delete styleObj[i];
      };

      return styleObj;
   };

   function sanitizeStyle(style)
   {
      if(typeof style.tip !== 'object') style.tip = { corner: style.tip };
      if(typeof style.tip.size !== 'object') style.tip.size = { width: style.tip.size, height: style.tip.size };
      if(typeof style.border !== 'object') style.border = { width: style.border };
      if(typeof style.width !== 'object') style.width = { value: style.width };
      if(typeof style.width.max == 'string') style.width.max = parseInt(style.width.max.replace(/([0-9]+)/i, "$1"));
      if(typeof style.width.min == 'string') style.width.min = parseInt(style.width.min.replace(/([0-9]+)/i, "$1"));

      if(typeof style.tip.size.x == 'number')
      {
         style.tip.size.width = style.tip.size.x;
         delete style.tip.size.x;
      };
      if(typeof style.tip.size.y == 'number')
      {
         style.tip.size.height = style.tip.size.y;
         delete style.tip.size.y;
      };

      return style;
   };

   function buildStyle()
   {
      var self, i, styleArray, styleExtend, finalStyle, ieAdjust;
      self = this;

      styleArray = [true, {}];
      for(i = 0; i < arguments.length; i++)
         styleArray.push(arguments[i]);
      styleExtend = [ $.extend.apply($, styleArray) ];

      while(typeof styleExtend[0].name == 'string')
      {
         styleExtend.unshift( sanitizeStyle($.fn.qtip.styles[ styleExtend[0].name ]) );
      };

      styleExtend.unshift(true, {classes:{ tooltip: 'qtip-' + (arguments[0].name || 'defaults') }}, $.fn.qtip.styles.defaults);

      finalStyle = $.extend.apply($, styleExtend);

      ieAdjust = ($.browser.msie) ? 1 : 0;
      finalStyle.tip.size.width += ieAdjust;
      finalStyle.tip.size.height += ieAdjust;

      if(finalStyle.tip.size.width % 2 > 0) finalStyle.tip.size.width += 1;
      if(finalStyle.tip.size.height % 2 > 0) finalStyle.tip.size.height += 1;

      if(finalStyle.tip.corner === true)
         finalStyle.tip.corner = (self.options.position.corner.tooltip === 'center') ? false : self.options.position.corner.tooltip;

      return finalStyle;
   };

   function calculateTip(corner, width, height)
   {
      var tips = {
         bottomRight:   [[0,0],              [width,height],      [width,0]],
         bottomLeft:    [[0,0],              [width,0],           [0,height]],
         topRight:      [[0,height],         [width,0],           [width,height]],
         topLeft:       [[0,0],              [0,height],          [width,height]],
         topMiddle:     [[0,height],         [width / 2,0],       [width,height]],
         bottomMiddle:  [[0,0],              [width,0],           [width / 2,height]],
         rightMiddle:   [[0,0],              [width,height / 2],  [0,height]],
         leftMiddle:    [[width,0],          [width,height],      [0,height / 2]]
      };
      tips.leftTop = tips.bottomRight;
      tips.rightTop = tips.bottomLeft;
      tips.leftBottom = tips.topRight;
      tips.rightBottom = tips.topLeft;

      return tips[corner];
   };

   function calculateBorders(radius)
   {
      var borders;

      if($('<canvas>').get(0).getContext)
      {
         borders = {
            topLeft: [radius,radius], topRight: [0,radius],
            bottomLeft: [radius,0], bottomRight: [0,0]
         };
      }

      else if($.browser.msie)
      {
         borders = {
            topLeft: [-90,90,0], topRight: [-90,90,-radius],
            bottomLeft: [90,270,0], bottomRight: [90, 270,-radius]
         };
      };

      return borders;
   };

   function bgiframe()
   {
      var self, html, dimensions;
      self = this;
      dimensions = self.getDimensions();

      html = '<iframe class="qtip-bgiframe" frameborder="0" tabindex="-1" src="javascript:false" '+
         'style="display:block; position:absolute; z-index:-1; filter:alpha(opacity=\'0\'); border: 1px solid red; ' +
         'height:'+dimensions.height+'px; width:'+dimensions.width+'px" />';

      self.elements.bgiframe = self.elements.wrapper.prepend(html).children('.qtip-bgiframe:first');
   };

   $(document).ready(function()
   {
      $.fn.qtip.cache = {
         screen: {
            scroll: { left: $(window).scrollLeft(), top: $(window).scrollTop() },
            width: $(window).width(),
            height: $(window).height()
         }
      };

      var adjustTimer;
      $(window).bind('resize scroll', function(event)
      {
         clearTimeout(adjustTimer);
         adjustTimer = setTimeout(function()
         {
            if(event.type === 'scroll')
               $.fn.qtip.cache.screen.scroll = { left: $(window).scrollLeft(), top: $(window).scrollTop() };
            else
            {
               $.fn.qtip.cache.screen.width = $(window).width();
               $.fn.qtip.cache.screen.height = $(window).height();
            };

            for(i = 0; i < $.fn.qtip.interfaces.length; i++)
            {
               var api = $.fn.qtip.interfaces[i];

               if(api.status.rendered === true
               && (api.options.position.type !== 'static'
               || api.options.position.adjust.scroll && event.type === 'scroll'
               || api.options.position.adjust.resize && event.type === 'resize'))
               {
                  api.updatePosition(event, true);
               }
            };
         }
         , 100);
      })

      $(document).bind('mousedown.qtip', function(event)
      {
         if($(event.target).parents('div.qtip').length === 0)
         {
            $('.qtip[unfocus]').each(function()
            {
               var api = $(this).qtip("api");

               if($(this).is(':visible') && !api.status.disabled
               && $(event.target).add(api.elements.target).length > 1)
                  api.hide(event);
            })
         };
      })
   });

   $.fn.qtip.interfaces = []

   $.fn.qtip.log = { error: function(){ return this; } };
   $.fn.qtip.constants = {};

   $.fn.qtip.defaults = {
      content: {
         prerender: false,
         text: false,
         url: false,
         data: null,
         title: {
            text: false,
            button: false
         }
      },
      position: {
         target: false,
         corner: {
            target: 'bottomRight',
            tooltip: 'topLeft'
         },
         adjust: {
            x: 0, y: 0,
            mouse: true,
            screen: false,
            scroll: true,
            resize: true
         },
         type: 'absolute',
         container: false
      },
      show: {
         when: {
            target: false,
            event: 'mouseover'
         },
         effect: {
            type: 'fade',
            length: 100
         },
         delay: 140,
         solo: false,
         ready: false
      },
      hide: {
         when: {
            target: false,
            event: 'mouseout'
         },
         effect: {
            type: 'fade',
            length: 100
         },
         delay: 0,
         fixed: false
      },
      api: {
         beforeRender: function(){},
         onRender: function(){},
         beforePositionUpdate: function(){},
         onPositionUpdate: function(){},
         beforeShow: function(){},
         onShow: function(){},
         beforeHide: function(){},
         onHide: function(){},
         beforeContentUpdate: function(){},
         onContentUpdate: function(){},
         beforeContentLoad: function(){},
         onContentLoad: function(){},
         beforeTitleUpdate: function(){},
         onTitleUpdate: function(){},
         beforeDestroy: function(){},
         onDestroy: function(){},
         beforeFocus: function(){},
         onFocus: function(){}
      }
   };

   $.fn.qtip.styles = {
      defaults: {
         background: 'white',
         color: '#111',
         overflow: 'hidden',
         textAlign: 'left',
         width: {
            min: 0,
            max: 250
         },
         padding: '5px 9px',
         border: {
            width: 1,
            radius: 0,
            color: '#d3d3d3'
         },
         tip: {
            corner: false,
            color: false,
            size: { width: 13, height: 13 },
            opacity: 1
         },
         title: {
            background: '#e1e1e1',
            fontWeight: 'bold',
            padding: '7px 12px'
         },
         button: {
            cursor: 'pointer'
         },
         classes: {
            target: '',
            tip: 'qtip-tip',
            title: 'qtip-title',
            button: 'qtip-button',
            content: 'qtip-content',
            active: 'qtip-active'
         }
      },
      cream: {
         border: {
            width: 3,
            radius: 0,
            color: '#F9E98E'
         },
         title: {
            background: '#F0DE7D',
            color: '#A27D35'
         },
         background: '#FBF7AA',
         color: '#A27D35',

         classes: { tooltip: 'qtip-cream' }
      },
      light: {
         border: {
            width: 3,
            radius: 0,
            color: '#E2E2E2'
         },
         title: {
            background: '#f1f1f1',
            color: '#454545'
         },
         background: 'white',
         color: '#454545',

         classes: { tooltip: 'qtip-light' }
      },
      dark: {
         border: {
            width: 3,
            radius: 0,
            color: '#303030'
         },
         title: {
            background: '#404040',
            color: '#f3f3f3'
         },
         background: '#505050',
         color: '#f3f3f3',

         classes: { tooltip: 'qtip-dark' }
      },
      red: {
         border: {
            width: 3,
            radius: 0,
            color: '#CE6F6F'
         },
         title: {
            background: '#f28279',
            color: '#9C2F2F'
         },
         background: '#F79992',
         color: '#9C2F2F',

         classes: { tooltip: 'qtip-red' }
      },
      green: {
         border: {
            width: 3,
            radius: 0,
            color: '#A9DB66'
         },
         title: {
            background: '#b9db8c',
            color: '#58792E'
         },
         background: '#CDE6AC',
         color: '#58792E',

         classes: { tooltip: 'qtip-green' }
      },
      blue: {
         border: {
            width: 3,
            radius: 0,
            color: '#ADD9ED'
         },
         title: {
            background: '#D0E9F5',
            color: '#5E99BD'
         },
         background: '#E5F6FE',
         color: '#4D9FBF',

         classes: { tooltip: 'qtip-blue' }
      }
   };
})(jQuery);
var software_page=new Object();software_page.youtube_callback=function(a){this.videos=a.feed.entry||[];this.show_video(0);};software_page.show_video=function(a){if(this.videos.length===0){return;}$("#software-page .youtube-column").show();$("#software-page .videos").empty();$("#software-page .thumbs").empty();$("#software-page .videos").flash({swf:this.videos[a].media$group.media$content[0].url+"&rel=1&border=0&fs=1&autoplay=0",width:288,height:218});$.each(this.videos,function(b,d){var c="";if(b===a){c=' class="selected"';}$("#software-page .youtube .thumbs").append($("<li "+c+'><a href="javascript:void(0);" title="'+d.title.$t+'" '+c+' ><div class="icone-video"></div><img src="'+d.media$group.media$thumbnail[0].url+'" width="83" height="45" alt="'+d.title.$t+'"/></a></li>').click(function(){software_page.show_video(b);}));});};
delegate=function(){return{create:function(a,b){if(typeof(b)!="string"||typeof(a)!="object"||typeof(a[b])!="function"){return null;}return function(){return a[b].apply(a,arguments);};}};}();
/**
 * jCarousel - Riding carousels with jQuery
 *   http://sorgalla.com/jcarousel/
 *
 * Copyright (c) 2006 Jan Sorgalla (http://sorgalla.com)
 * Dual licensed under the MIT (MIT-LICENSE.txt)
 * and GPL (GPL-LICENSE.txt) licenses.
 *
 * Built on top of the jQuery library
 *   http://jquery.com
 *
 * Inspired by the "Carousel Component" by Bill Scott
 *   http://billwscott.com/carousel/
 */

(function(b){b.fn.jcarousel=function(d){return this.each(function(){new a(this,d);});};var c={vertical:false,start:1,offset:1,size:null,scroll:3,visible:null,animation:"normal",easing:"swing",auto:0,wrap:null,initCallback:null,reloadCallback:null,itemLoadCallback:null,itemFirstInCallback:null,itemFirstOutCallback:null,itemLastInCallback:null,itemLastOutCallback:null,itemVisibleInCallback:null,itemVisibleOutCallback:null,buttonNextHTML:"<div></div>",buttonPrevHTML:"<div></div>",buttonNextEvent:"click",buttonPrevEvent:"click",buttonNextCallback:null,buttonPrevCallback:null};b.jcarousel=function(h,f){this.options=b.extend({},c,f||{});this.locked=false;this.container=null;this.clip=null;this.list=null;this.buttonNext=null;this.buttonPrev=null;this.wh=!this.options.vertical?"width":"height";this.lt=!this.options.vertical?"left":"top";var m="",k=h.className.split(" ");for(var g=0;g<k.length;g++){if(k[g].indexOf("jcarousel-skin")!=-1){b(h).removeClass(k[g]);var m=k[g];break;}}if(h.nodeName=="UL"||h.nodeName=="OL"){this.list=b(h);this.container=this.list.parent();if(this.container.hasClass("jcarousel-clip")){if(!this.container.parent().hasClass("jcarousel-container")){this.container=this.container.wrap("<div></div>");}this.container=this.container.parent();}else{if(!this.container.hasClass("jcarousel-container")){this.container=this.list.wrap("<div></div>").parent();}}}else{this.container=b(h);this.list=b(h).find(">ul,>ol,div>ul,div>ol");}if(m!=""&&this.container.parent()[0].className.indexOf("jcarousel-skin")==-1){this.container.wrap('<div class=" '+m+'"></div>');}this.clip=this.list.parent();if(!this.clip.length||!this.clip.hasClass("jcarousel-clip")){this.clip=this.list.wrap("<div></div>").parent();}this.buttonPrev=b(".jcarousel-prev",this.container);if(this.buttonPrev.size()==0&&this.options.buttonPrevHTML!=null){this.buttonPrev=this.clip.before(this.options.buttonPrevHTML).prev();}this.buttonPrev.addClass(this.className("jcarousel-prev"));this.buttonNext=b(".jcarousel-next",this.container);if(this.buttonNext.size()==0&&this.options.buttonNextHTML!=null){this.buttonNext=this.clip.before(this.options.buttonNextHTML).prev();}this.buttonNext.addClass(this.className("jcarousel-next"));this.clip.addClass(this.className("jcarousel-clip"));this.list.addClass(this.className("jcarousel-list"));this.container.addClass(this.className("jcarousel-container"));var j=this.options.visible!=null?Math.ceil(this.clipping()/this.options.visible):null;var l=this.list.children("li");var n=this;if(l.size()>0){var d=0,g=this.options.offset;l.each(function(){n.format(this,g++);d+=n.dimension(this,j);});this.list.css(this.wh,d+"px");if(!f||f.size===undefined){this.options.size=l.size();}}this.container.css("display","block");this.buttonNext.css("display","block");this.buttonPrev.css("display","block");this.funcNext=function(){n.next();};this.funcPrev=function(){n.prev();};this.funcResize=function(){n.reload();};if(this.options.initCallback!=null){this.options.initCallback(this,"init");}if(b.browser.safari){this.buttons(false,false);b(window).bind("load",function(){n.setup();});}else{this.setup();}};var a=b.jcarousel;a.fn=a.prototype={jcarousel:"0.2.3"};a.fn.extend=a.extend=b.extend;a.fn.extend({setup:function(){this.first=null;this.last=null;this.prevFirst=null;this.prevLast=null;this.animating=false;this.timer=null;this.tail=null;this.inTail=false;if(this.locked){return;}this.list.css(this.lt,this.pos(this.options.offset)+"px");var d=this.pos(this.options.start);this.prevFirst=this.prevLast=null;this.animate(d,false);b(window).unbind("resize",this.funcResize).bind("resize",this.funcResize);},reset:function(){this.list.empty();this.list.css(this.lt,"0px");this.list.css(this.wh,"10px");if(this.options.initCallback!=null){this.options.initCallback(this,"reset");}this.setup();},reload:function(){if(this.tail!=null&&this.inTail){this.list.css(this.lt,a.intval(this.list.css(this.lt))+this.tail);}this.tail=null;this.inTail=false;if(this.options.reloadCallback!=null){this.options.reloadCallback(this);}if(this.options.visible!=null){var f=this;var g=Math.ceil(this.clipping()/this.options.visible),e=0,d=0;b("li",this.list).each(function(h){e+=f.dimension(this,g);if(h+1<f.first){d=e;}});this.list.css(this.wh,e+"px");this.list.css(this.lt,-d+"px");}this.scroll(this.first,false);},lock:function(){this.locked=true;this.buttons();},unlock:function(){this.locked=false;this.buttons();},size:function(d){if(d!=undefined){this.options.size=d;if(!this.locked){this.buttons();}}return this.options.size;},has:function(f,g){if(g==undefined||!g){g=f;}if(this.options.size!==null&&g>this.options.size){g=this.options.size;}for(var d=f;d<=g;d++){var h=this.get(d);if(!h.length||h.hasClass("jcarousel-item-placeholder")){return false;}}return true;},get:function(d){return b(".jcarousel-item-"+d,this.list);},add:function(h,o){var k=this.get(h),f=0,n=0;if(k.length==0){var m,k=this.create(h),g=a.intval(h);while(m=this.get(--g)){if(g<=0||m.length){g<=0?this.list.prepend(k):m.after(k);break;}}}else{f=this.dimension(k);}k.removeClass(this.className("jcarousel-item-placeholder"));typeof o=="string"?k.html(o):k.empty().append(o);var l=this.options.visible!=null?Math.ceil(this.clipping()/this.options.visible):null;var d=this.dimension(k,l)-f;if(h>0&&h<this.first){this.list.css(this.lt,a.intval(this.list.css(this.lt))-d+"px");}this.list.css(this.wh,a.intval(this.list.css(this.wh))+d+"px");return k;},remove:function(f){var g=this.get(f);if(!g.length||(f>=this.first&&f<=this.last)){return;}var h=this.dimension(g);if(f<this.first){this.list.css(this.lt,a.intval(this.list.css(this.lt))+h+"px");}g.remove();this.list.css(this.wh,a.intval(this.list.css(this.wh))-h+"px");},next:function(){this.stopAuto();if(this.tail!=null&&!this.inTail){this.scrollTail(false);}else{this.scroll(((this.options.wrap=="both"||this.options.wrap=="last")&&this.options.size!=null&&this.last==this.options.size)?1:this.first+this.options.scroll);}},prev:function(){this.stopAuto();if(this.tail!=null&&this.inTail){this.scrollTail(true);}else{this.scroll(((this.options.wrap=="both"||this.options.wrap=="first")&&this.options.size!=null&&this.first==1)?this.options.size:this.first-this.options.scroll);}},scrollTail:function(d){if(this.locked||this.animating||!this.tail){return;}var e=a.intval(this.list.css(this.lt));!d?e-=this.tail:e+=this.tail;this.inTail=!d;this.prevFirst=this.first;this.prevLast=this.last;this.animate(e);},scroll:function(e,d){if(this.locked||this.animating){return;}this.animate(this.pos(e),d);},pos:function(A){if(this.locked||this.animating){return;}A=a.intval(A);if(this.options.wrap!="circular"){A=A<1?1:(this.options.size&&A>this.options.size?this.options.size:A);}var w=this.first>A;var h=a.intval(this.list.css(this.lt));var B=this.options.wrap!="circular"&&this.first<=1?1:this.first;var E=w?this.get(B):this.get(this.last);var z=w?B:B-1;var C=null,y=0,t=false,D=0;while(w?--z>=A:++z<A){C=this.get(z);t=!C.length;if(C.length==0){C=this.create(z).addClass(this.className("jcarousel-item-placeholder"));E[w?"before":"after"](C);}E=C;D=this.dimension(C);if(t){y+=D;}if(this.first!=null&&(this.options.wrap=="circular"||(z>=1&&(this.options.size==null||z<=this.options.size)))){h=w?h+D:h-D;}}var q=this.clipping();var s=[];var g=0,z=A,r=0;var E=this.get(A-1);while(++g){C=this.get(z);t=!C.length;if(C.length==0){C=this.create(z).addClass(this.className("jcarousel-item-placeholder"));E.length==0?this.list.prepend(C):E[w?"before":"after"](C);}E=C;var D=this.dimension(C);if(D==0){alert("jCarousel: No width/height set for items. This will cause an infinite loop. Aborting...");return 0;}if(this.options.wrap!="circular"&&this.options.size!==null&&z>this.options.size){s.push(C);}else{if(t){y+=D;}}r+=D;if(r>=q){break;}z++;}for(var o=0;o<s.length;o++){s[o].remove();}if(y>0){this.list.css(this.wh,this.dimension(this.list)+y+"px");if(w){h-=y;this.list.css(this.lt,a.intval(this.list.css(this.lt))-y+"px");}}var n=A+g-1;if(this.options.wrap!="circular"&&this.options.size&&n>this.options.size){n=this.options.size;}if(z>n){g=0,z=n,r=0;while(++g){var C=this.get(z--);if(!C.length){break;}r+=this.dimension(C);if(r>=q){break;}}}var k=n-g+1;if(this.options.wrap!="circular"&&k<1){k=1;}if(this.inTail&&w){h+=this.tail;this.inTail=false;}this.tail=null;if(this.options.wrap!="circular"&&n==this.options.size&&(n-g+1)>=1){var u=a.margin(this.get(n),!this.options.vertical?"marginRight":"marginBottom");if((r-u)>q){this.tail=r-q-u;}}while(A-->k){h+=this.dimension(this.get(A));}this.prevFirst=this.first;this.prevLast=this.last;this.first=k;this.last=n;return h;},animate:function(g,d){if(this.locked||this.animating){return;}this.animating=true;var e=this;var f=function(){e.animating=false;if(g==0){e.list.css(e.lt,0);}if(e.options.wrap=="both"||e.options.wrap=="last"||e.options.size==null||e.last<e.options.size){e.startAuto();}e.buttons();e.notify("onAfterAnimation");};this.notify("onBeforeAnimation");if(!this.options.animation||d==false){this.list.css(this.lt,g+"px");f();}else{var h=!this.options.vertical?{left:g}:{top:g};this.list.animate(h,this.options.animation,this.options.easing,f);}},startAuto:function(e){if(e!=undefined){this.options.auto=e;}if(this.options.auto==0){return this.stopAuto();}if(this.timer!=null){return;}var d=this;this.timer=setTimeout(function(){d.next();},this.options.auto*1000);},stopAuto:function(){if(this.timer==null){return;}clearTimeout(this.timer);this.timer=null;},buttons:function(f,e){if(f==undefined||f==null){var f=!this.locked&&this.options.size!==0&&((this.options.wrap&&this.options.wrap!="first")||this.options.size==null||this.last<this.options.size);if(!this.locked&&(!this.options.wrap||this.options.wrap=="first")&&this.options.size!=null&&this.last>=this.options.size){f=this.tail!=null&&!this.inTail;}}if(e==undefined||e==null){var e=!this.locked&&this.options.size!==0&&((this.options.wrap&&this.options.wrap!="last")||this.first>1);if(!this.locked&&(!this.options.wrap||this.options.wrap=="last")&&this.options.size!=null&&this.first==1){e=this.tail!=null&&this.inTail;}}var d=this;this.buttonNext[f?"bind":"unbind"](this.options.buttonNextEvent,this.funcNext)[f?"removeClass":"addClass"](this.className("jcarousel-next-disabled")).attr("disabled",f?false:true);this.buttonPrev[e?"bind":"unbind"](this.options.buttonPrevEvent,this.funcPrev)[e?"removeClass":"addClass"](this.className("jcarousel-prev-disabled")).attr("disabled",e?false:true);if(this.buttonNext.length>0&&(this.buttonNext[0].jcarouselstate==undefined||this.buttonNext[0].jcarouselstate!=f)&&this.options.buttonNextCallback!=null){this.buttonNext.each(function(){d.options.buttonNextCallback(d,this,f);});this.buttonNext[0].jcarouselstate=f;}if(this.buttonPrev.length>0&&(this.buttonPrev[0].jcarouselstate==undefined||this.buttonPrev[0].jcarouselstate!=e)&&this.options.buttonPrevCallback!=null){this.buttonPrev.each(function(){d.options.buttonPrevCallback(d,this,e);});this.buttonPrev[0].jcarouselstate=e;}},notify:function(d){var e=this.prevFirst==null?"init":(this.prevFirst<this.first?"next":"prev");this.callback("itemLoadCallback",d,e);if(this.prevFirst!==this.first){this.callback("itemFirstInCallback",d,e,this.first);this.callback("itemFirstOutCallback",d,e,this.prevFirst);}if(this.prevLast!==this.last){this.callback("itemLastInCallback",d,e,this.last);this.callback("itemLastOutCallback",d,e,this.prevLast);}this.callback("itemVisibleInCallback",d,e,this.first,this.last,this.prevFirst,this.prevLast);this.callback("itemVisibleOutCallback",d,e,this.prevFirst,this.prevLast,this.first,this.last);},callback:function(h,l,d,j,g,f,e){if(this.options[h]==undefined||(typeof this.options[h]!="object"&&l!="onAfterAnimation")){return;}var m=typeof this.options[h]=="object"?this.options[h][l]:this.options[h];if(!b.isFunction(m)){return;}var n=this;if(j===undefined){m(n,d,l);}else{if(g===undefined){this.get(j).each(function(){m(n,this,j,d,l);});}else{for(var k=j;k<=g;k++){if(k!==null&&!(k>=f&&k<=e)){this.get(k).each(function(){m(n,this,k,d,l);});}}}}},create:function(d){return this.format("<li></li>",d);},format:function(g,f){var d=b(g).addClass(this.className("jcarousel-item")).addClass(this.className("jcarousel-item-"+f));d.attr("jcarouselindex",f);return d;},className:function(d){return d+" "+d+(!this.options.vertical?"-horizontal":"-vertical");},dimension:function(i,j){var h=i.jquery!=undefined?i[0]:i;var g=!this.options.vertical?h.offsetWidth+a.margin(h,"marginLeft")+a.margin(h,"marginRight"):h.offsetHeight+a.margin(h,"marginTop")+a.margin(h,"marginBottom");if(j==undefined||g==j){return g;}var f=!this.options.vertical?j-a.margin(h,"marginLeft")-a.margin(h,"marginRight"):j-a.margin(h,"marginTop")-a.margin(h,"marginBottom");b(h).css(this.wh,f+"px");return this.dimension(h);},clipping:function(){return !this.options.vertical?this.clip[0].offsetWidth-a.intval(this.clip.css("borderLeftWidth"))-a.intval(this.clip.css("borderRightWidth")):this.clip[0].offsetHeight-a.intval(this.clip.css("borderTopWidth"))-a.intval(this.clip.css("borderBottomWidth"));},index:function(d,e){if(e==undefined){e=this.options.size;}return Math.round((((d-1)/e)-Math.floor((d-1)/e))*e)+1;}});a.extend({defaults:function(e){return b.extend(c,e||{});},margin:function(i,h){if(!i){return 0;}var g=i.jquery!=undefined?i[0]:i;if(h=="marginRight"&&b.browser.safari){var f={display:"block","float":"none",width:"auto"},d,j;b.swap(g,f,function(){d=g.offsetWidth;});f.marginRight=0;b.swap(g,f,function(){j=g.offsetWidth;});return j-d;}return a.intval(b.css(g,h));},intval:function(d){d=parseInt(d);return isNaN(d)?0:d;}});})(jQuery);
var highlight = {

  init : function(){
    this.animaLogo=null;
    this.carousel;
    this.createEvents();
    this.atchementJcorousel();

  },
  createEvents : function(){
    var $highlight = $("#highlight");
    var $ListDest = $("ul li" , $highlight);
    var $linkImg = $(".link-imagem" , $ListDest);

    $linkImg.bind("mouseenter", function() {
      var $this = $(this);

      $(".botao-navegacao", '#highlight').css({'display' : 'block', 'opacity' : '0.4'});

      $(".proximo", '#highlight').bind("mouseenter", function() {
        $(this).css({'display' : 'block', 'opacity' : '1.0'});
        $(".anterior", '#highlight').css({'display' : 'block', 'opacity' : '0.4'});
      })
      .bind("mouseleave", function() {
        $(".botao-navegacao", '#highlight').css({'display' : 'none', 'opacity' : '0.4'});
      });

      $(".anterior", '#highlight').bind("mouseenter", function() {
        $(this).css({'display' : 'block', 'opacity' : '1.0'});
        $(".proximo", '#highlight').css({'display' : 'block', 'opacity' : '0.4'});
      })
      .bind("mouseleave", function() {
        $(".botao-navegacao", '#highlight').css({'display' : 'none', 'opacity' : '1.0'});
      });
    })
    .bind("mouseleave", function() {
      $(".botao-navegacao", '#highlight').css({'opacity' : '', 'display' : ''})
    });

    $ListDest.show();
  },
  atchementJcorousel : function(){
    var _self = this;

    $("#highlight").jcarousel({
        scroll: 1,
        auto: 4,
        initCallback: delegate.create(this, "mycarousel_initCallback"),
        itemLastInCallback: delegate.create(this, "contTimer"),
        buttonNextHTML: null,
        buttonPrevHTML: null
    });
  },
  mycarousel_initCallback:function(carousel) {
    var _self = this;

      $('.proximo', '#highlight').bind('click', function() {
          carousel.next();
          return false;
      });

      $('.anterior', '#highlight').bind('click', function() {
          carousel.prev();
          return false;
      });
  },
  contTimer:function(carousel){
    this.carousel = carousel;
    $('.carrossel-pagination a').eq(carousel.last - 1).addClass("cur")
    .siblings().css("background-position", "0px").removeClass("cur");

    var valor = Math.floor((carousel.options.auto * 1000) / 14);
    this.count = 1;
    clearInterval( this.animaLogo );

    this.animaLogo = setInterval(delegate.create(this, "positionBackground"), valor, carousel);

  },
  positionBackground:function(carousel){

    var positionBackground = ((this.count+1) * -20);
    $('.cur', $("#highlight")).css("background-position", positionBackground+"px")
    this.count++
    if(this.count>=14) {
      clearInterval( this.animaLogo );
      if(this.carousel.last == this.carousel.options.size){
        this.carousel.scroll(1);
      }

    }

  }

};
(function(f,c){var d=function(h){var g,i=[];for(g in h){if(/string|number/.test(typeof h[g])&&h[g]!==""){i.push(g+'="'+h[g]+'"');}}return i[a]("");},e=function(i){var g,k,j=[],h;if(typeof i=="object"){for(g in i){if(typeof i[g]=="object"){h=[];for(k in i[g]){h.push([k,"=",encodeURIComponent(i[g][k])][a](""));}i[g]=h[a]("&amp;");}if(i[g]){j.push(['<param name="',g,'" value="',i[g],'" />'][a](""));}}i=j[a]("");}return i;},b=false,a="join";f[c]=(function(){try{var g="0,0,0",h=navigator.plugins["Shockwave Flash"]||ActiveXObject;g=h.description||(function(){try{return(new h("ShockwaveFlash.ShockwaveFlash")).GetVariable("$version");}catch(j){}}());}catch(i){}g=g.match(/^[A-Za-z\s]*?(\d+)[\.|,](\d+)(?:\s+[d|r]|,)(\d+)/);return{available:g[1]>0,activeX:h&&!h.name,version:{major:g[1]*1,minor:g[2]*1,release:g[3]*1},hasVersion:function(k){var n=this.version,l="major",m="minor",j="release";k=(/string|number/.test(typeof k))?k.toString().split("."):k||[0,0,0];k=[k[l]||k[0]||n[l],k[m]||k[1]||n[m],k[j]||k[2]||n[j]];return(k[0]<n[l])||(k[0]==n[l]&&k[1]<n[m])||(k[0]==n[l]&&k[1]==n[m]&&k[2]<=n[j]);},expressInstall:"expressInstall.swf",create:function(j){if(!f[c].available||b||!typeof j=="object"||!j.swf){return false;}if(j.hasVersion&&!f[c].hasVersion(j.hasVersion)){j={swf:j.expressInstall||f[c].expressInstall,attrs:{id:j.id||"SWFObjectExprInst",name:j.name,height:Math.max(j.height||137),width:Math.max(j.width||214)},params:{flashvars:{MMredirectURL:location.href,MMplayerType:(f[c].activeX)?"ActiveX":"PlugIn",MMdoctitle:document.title.slice(0,47)+" - Flash Player Installation"}}};b=true;}else{j=f.extend(true,{attrs:{id:j.id,name:j.name,height:j.height||180,width:j.width||320},params:{wmode:j.wmode||"opaque",flashvars:j.flashvars}},j);}if(f[c].activeX){j.attrs.classid=j.attrs.classid||"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000";j.params.movie=j.params.movie||j.swf;}else{j.attrs.type=j.attrs.classid||"application/x-shockwave-flash";j.attrs.data=j.attrs.data||j.swf;}return["<object ",d(j.attrs),">",e(j.params),"</object>"][a]("");}};}());f.fn[c]=function(g){if(typeof g=="object"){this.each(function(){var i=document.createElement(c);var h=f[c].create(g);if(h){i.innerHTML=h;if(i.childNodes[0]){this.appendChild(i.childNodes[0]);}}});}else{if(typeof g=="function"){this.find("object").andSelf().filter("object").each(function(){var i=this,h="jsInteractionTimeoutMs";i[h]=i[h]||0;if(i[h]<660){if(i.clientWidth||i.clientHeight){g.call(this);}else{setTimeout(function(){f(i)[c](g);},i[h]+66);}}});}}return this;};}(jQuery,"flash"));
/**
 * jQuery.ScrollTo - Easy element scrolling using jQuery.
 * Copyright (c) 2007-2009 Ariel Flesler - aflesler(at)gmail(dot)com | http://flesler.blogspot.com
 * Dual licensed under MIT and GPL.
 * Date: 5/25/2009
 * @author Ariel Flesler
 * @version 1.4.2
 *
 * http://flesler.blogspot.com/2007/10/jqueryscrollto.html
 */
;(function(d){var k=d.scrollTo=function(a,i,e){d(window).scrollTo(a,i,e)};k.defaults={axis:'xy',duration:parseFloat(d.fn.jquery)>=1.3?0:1};k.window=function(a){return d(window)._scrollable()};d.fn._scrollable=function(){return this.map(function(){var a=this,i=!a.nodeName||d.inArray(a.nodeName.toLowerCase(),['iframe','#document','html','body'])!=-1;if(!i)return a;var e=(a.contentWindow||a).document||a.ownerDocument||a;return d.browser.safari||e.compatMode=='BackCompat'?e.body:e.documentElement})};d.fn.scrollTo=function(n,j,b){if(typeof j=='object'){b=j;j=0}if(typeof b=='function')b={onAfter:b};if(n=='max')n=9e9;b=d.extend({},k.defaults,b);j=j||b.speed||b.duration;b.queue=b.queue&&b.axis.length>1;if(b.queue)j/=2;b.offset=p(b.offset);b.over=p(b.over);return this._scrollable().each(function(){var q=this,r=d(q),f=n,s,g={},u=r.is('html,body');switch(typeof f){case'number':case'string':if(/^([+-]=)?\d+(\.\d+)?(px|%)?$/.test(f)){f=p(f);break}f=d(f,this);case'object':if(f.is||f.style)s=(f=d(f)).offset()}d.each(b.axis.split(''),function(a,i){var e=i=='x'?'Left':'Top',h=e.toLowerCase(),c='scroll'+e,l=q[c],m=k.max(q,i);if(s){g[c]=s[h]+(u?0:l-r.offset()[h]);if(b.margin){g[c]-=parseInt(f.css('margin'+e))||0;g[c]-=parseInt(f.css('border'+e+'Width'))||0}g[c]+=b.offset[h]||0;if(b.over[h])g[c]+=f[i=='x'?'width':'height']()*b.over[h]}else{var o=f[h];g[c]=o.slice&&o.slice(-1)=='%'?parseFloat(o)/100*m:o}if(/^\d+$/.test(g[c]))g[c]=g[c]<=0?0:Math.min(g[c],m);if(!a&&b.queue){if(l!=g[c])t(b.onAfterFirst);delete g[c]}});t(b.onAfter);function t(a){r.animate(g,j,b.easing,a&&function(){a.call(this,n,b)})}}).end()};k.max=function(a,i){var e=i=='x'?'Width':'Height',h='scroll'+e;if(!d(a).is('html,body'))return a[h]-d(a)[e.toLowerCase()]();var c='client'+e,l=a.ownerDocument.documentElement,m=a.ownerDocument.body;return Math.max(l[h],m[h])-Math.min(l[c],m[c])};function p(a){return typeof a=='object'?a:{top:a,left:a}}})(jQuery);
 /**
 * @author Alexandre Magno
 * @name jflow
 * @filename jquery.jflow.js
 * @type jQuery
 * @projectDescription Uma alternativa aos plugins de slide de elementos
 * @date 07/17/2009
 * @version 1.0 beta
 * @cat Form
 * @require jquery.scrollTo.js
 * @return void
 */

(function(a){a.fn.jflow=function(e){var l={item:".noticia-plantao",itens:5,extra_height:0,inativeClass:"inativo",prev:".widget-plantao-botao-topo a",next:".widget-plantao-botao-rodape a",speed:800};var f=a.extend(l,e);var k=this;var g=0;var i=a(f.item);var d=a(f.item).length;if(d<=f.itens){a(f.next).addClass(f.inativeClass);}var j=0;if(d<f.itens){j=d;}else{j=f.itens;}var b=d-f.itens;var h=i.height()+parseInt(i.css("padding-top"));var c=h*j+parseInt(f.extra_height);k.css({height:c,overflow:"hidden"});a(f.prev).addClass(f.inativeClass).bind("click",function(){if(g>0){g-=f.itens;k.scrollTo(a(f.item).eq(g),f.speed,{onAfter:function(){if(g==0){a(f.prev).addClass(f.inativeClass);}}});a(f.next).removeClass(f.inativeClass);}a(this).blur();return false;});a(f.next).bind("click",function(){if(g<b){g+=f.itens;k.scrollTo(a(f.item).eq(g),f.speed,{onAfter:function(){if(g>=b){a(f.next).addClass(f.inativeClass);}}});a(f.prev).removeClass(f.inativeClass);}a(this).blur();return false;});};})(jQuery);
(function(a){a.fn.popin=function(c,d){var e=a(this);var c=jQuery.extend({duration:1000},c);e.css({position:"absolute",zIndex:9991});if(a(window).height()>e.height()){e.css({top:a(window).height()/2-e.height()/2+a(window).scrollTop()});}else{e.css({top:a(window).scrollTop()+10});}if(a(window).width()>e.width()){e.css({left:a(window).width()/2-e.width()/2});}else{e.css({left:10});}a(window).bind("resize.popin scroll.popin",function(){if(a(this).height()>e.height()){e.css({top:a(this).height()/2-e.height()/2+a(this).scrollTop()});}if(a(this).width()>e.width()){e.css({left:a(this).width()/2-e.width()/2});}});var b=a('<div class="popin-zoom"></div>');b.appendTo("body").css({backgroundColor:"#000",display:"none",height:a(document).height(),width:"100%",opacity:0.6,position:"absolute",top:0,zIndex:9990});if(a(".popin-zoom").length==0){b.appendTo("body");}b.fadeIn(50);e.fadeIn();a.closePopin=function(f){e.hide();b.remove();a(window).unbind(".popin");if(f&&a.typeOf(f)=="function"){f();}};};})(jQuery);

$(document).ready(function() {
  $(".ellipsis").textOverflow();

  var browserUpdate = new BrowserUpdate($("#barra-update"));

  $(".foto .borda-interna").bind("mouseover", function() {
    $(this).siblings().addClass("on")
  }).bind("mouseout", function() {
     $(this).siblings().removeClass("on")
  });

  $("#fale-conosco").html("fale conosco: baixatudo@corp.globo.com");

  $(".lista-com-thumb .conteudo").jcarousel({
    scroll: 1,
    animation: 250,
    initCallback: function(carousel) {
      $('a.anterior', $(carousel.container).parent()).click(function() {
        carousel.prev();
      })

      $('a.proximo', $(carousel.container).parent()).click(function() {
        carousel.next();
      })

      $('.indicacao-pagina a', $(carousel.container).parent()).click(function() {
        carousel.scroll($.jcarousel.intval($(this).attr('title')));
      })
    },
    itemVisibleInCallback: function(carousel, li, index, state) {
      totalPages = $(carousel.list).children().length;

      if (index == 1) {
        $('span.anterior', $(carousel.container).parent()).show();
        $('a.anterior', $(carousel.container).parent()).hide();
      } else {
        $('span.anterior', $(carousel.container).parent()).hide();
        $('a.anterior', $(carousel.container).parent()).show();
      }

      if (index == totalPages) {
        $('span.proximo', $(carousel.container).parent()).show();
        $('a.proximo', $(carousel.container).parent()).hide();
      } else {
        $('span.proximo', $(carousel.container).parent()).hide();
        $('a.proximo', $(carousel.container).parent()).show();
      }

      $('.indicacao-pagina', $(carousel.container).parent()).children().removeClass('on');
      current_page_class = '.indicacao-pagina .i' + index
      $(current_page_class, $(carousel.container).parent()).addClass('on');
    },
    buttonNextHTML: null,
    buttonPrevHTML: null
  });

  if ($('#home-page').length > 0) {
    highlight.init();
  }

  if ($('#software-page').length > 0) {

    $(".article img").bind("click", function() {
      $("#software-page").append('<div class="content-popin" style="width:620px; display:none;"></div>');

      var img = new Image();
      $(img).load(function() {
        $(".content-popin").append(img);

        $(img).unbind("click");
        $(img).bind("click", function() {
          $.closePopin();
          $(".content-popin").remove();
        });

        $(".content-popin").popin();
      });

      $(img).attr("src", $(this).attr("src").replace("/298x/","/620x/"));
    });

    $(".lista-twitter").jflow(
      options = {
        item: '.item-twitter',
        itens: 10,
        extra_height: 9,
        prev: '.widget-twitter-botao-topo a',
        next: '.widget-twitter-botao-rodape a'
      }
    );

    var avatarTwiter = $(".lista-twitter .item-twitter").find("span");
     $.each(avatarTwiter, function(i, val) {
        var srcImage = '<img src="'+$(val).attr("value")+ '" width=48 height=48 />';
        $(val).replaceWith(srcImage);
      });

    $.getScript('http://gdata.youtube.com/feeds/api/videos?q=' + SOFTWARE.relevant_words.join(' ') + '&alt=json-in-script&callback=software_page.youtube_callback&max-results=3&format=5');

    $(".botao-download").bind("click", function(event) {
      try {
        var form = $(this).parent();
        while (form[0].tagName != "FORM") {
          form = form.parent();
        }
        form.submit();
      } finally {
        event.preventDefault();
      }
    });

    $('.downloads img').qtip({
      content: $('.grafico-downloads-full').html(),
      position: {
        corner: {
          target: 'rightMiddle',
          tooltip: 'leftMiddle'
        }
      },
      style: {
        tip: {
          corner: 'leftMiddle',
          size: {x: 10, y: 12}
        },
        padding: 0,
        width: {
          max: 500
        },
        border: {
          width: 4,
          radius: 2,
          color: '#ccc'
        }
      }
    });
  }

  if ($('#bbb-realidade-aumentada').length > 0) {
    $("#listas li").bind("mouseover", function() {
      $(this).css("background-color", "#f5f5f5");
      $(".downloads-os", this).css("display", "block");
    });
    $("#listas li").bind("mouseout", function() {
      $(this).css("background-color", "");
      $(".downloads-os", this).css("display", "");
    });
    $(".pacote-todos").bind("mouseover", function() {
      $(".downloads-os", this).css("display", "block");
    });
    $(".pacote-todos").bind("mouseout", function() {
      $(".downloads-os", this).css("display", "");
    });
  }
});

