// $Id: jquery_madness.js $
/*
** we're using the jQuery based javascript, but our design pattern will be
** the Yui object paradigm which is much better at stability and 
** expandability.
*/
var Ticode = (("undefined" == typeof Ticode) || (!Ticode)) ? {} : Ticode;

(
function ($)
{

Ticode.JqueryMadness = function ()
{
  /*  
  ******************************************************************
  ** private variables available only to methods of the module.
  */

  /*  
  ** private shorthand variables to comon jQuery parts/utilities
  */

  /*  
  ** private shorthand variable for built jQuery objects. set in init()
  */

  /*  
  ** constants used in this module.
  */

  /*  
  ** module state:
  */

  /*  
  ** these are Dom refrences that won't change, they are set by direct
  ** calls when needed, and then used freely after that.
  */

  /*  
  ** ******************************************************************
  ** private methods available only to other methods of the module.
  */

  var that =
    /*
    ** publicly accessible variables where we store AJAX results by
    ** evaluating valid js pointing to these arrays.
    */
    { translations: [] // Ticode.JqueryMadness.translations[]

      /*
      ** public method Ticode.JqueryMadness.move() -- Method moves the 
      **					      themeroller path base
      **  to a more appropriate place in the layout.
      */
    , move: function ()
      {
	var before  = $(  'form#jquery_madness_admin_form '
			+ 'input#edit-tr-alt-path')
	  , obj	= $(this)
	  ;
	$(obj)	  .remove();
	$(before) .before(obj);
      }
    };
      /*
      ** for finding .attr('style', 'background:#ee9933');
      */
	//attr('style', 'background:#ee9933');

  return that;

}(); // the parens here cause the anonymous func to execute and return

Drupal.behaviors.jquery_madness = 
{
  attach: function (context, settings)
  {
    $('form#jquery_madness_admin_form b#tr_path_txt', context)
    
      .once('jquery_madness', Ticode.JqueryMadness.move);
  }
};

}
)(jQuery);
;

/*
 * Superfish v1.4.8 - jQuery menu widget
 * Copyright (c) 2008 Joel Birch
 *
 * Dual licensed under the MIT and GPL licenses:
 * 	http://www.opensource.org/licenses/mit-license.php
 * 	http://www.gnu.org/licenses/gpl.html
 *
 * CHANGELOG: http://users.tpg.com.au/j_birch/plugins/superfish/changelog.txt
 */

;(function($){
	$.fn.superfish = function(op){

		var sf = $.fn.superfish,
			c = sf.c,
			$arrow = $(['<span class="',c.arrowClass,'"> &#187;</span>'].join('')),
			over = function(){
				var $$ = $(this), menu = getMenu($$);
				clearTimeout(menu.sfTimer);
				$$.showSuperfishUl().siblings().hideSuperfishUl();
			},
			out = function(){
				var $$ = $(this), menu = getMenu($$), o = sf.op;
				clearTimeout(menu.sfTimer);
				menu.sfTimer=setTimeout(function(){
					o.retainPath=($.inArray($$[0],o.$path)>-1);
					$$.hideSuperfishUl();
					if (o.$path.length && $$.parents(['li.',o.hoverClass].join('')).length<1){over.call(o.$path);}
				},o.delay);	
			},
			getMenu = function($menu){
				var menu = $menu.parents(['ul.',c.menuClass,':first'].join(''))[0];
				sf.op = sf.o[menu.serial];
				return menu;
			},
			addArrow = function($a){ $a.addClass(c.anchorClass).append($arrow.clone()); };
			
		return this.each(function() {
			var s = this.serial = sf.o.length;
			var o = $.extend({},sf.defaults,op);
			o.$path = $('li.'+o.pathClass,this).slice(0,o.pathLevels).each(function(){
				$(this).addClass([o.hoverClass,c.bcClass].join(' '))
					.filter('li:has(ul)').removeClass(o.pathClass);
			});
			sf.o[s] = sf.op = o;
			
			$('li:has(ul)',this)[($.fn.hoverIntent && !o.disableHI) ? 'hoverIntent' : 'hover'](over,out).each(function() {
				if (o.autoArrows) addArrow( $('>a:first-child',this) );
			})
			.not('.'+c.bcClass)
				.hideSuperfishUl();
			
			var $a = $('a',this);
			$a.each(function(i){
				var $li = $a.eq(i).parents('li');
				$a.eq(i).focus(function(){over.call($li);}).blur(function(){out.call($li);});
			});
			o.onInit.call(this);
			
		}).each(function() {
			var menuClasses = [c.menuClass];
			if (sf.op.dropShadows  && !($.browser.msie && $.browser.version < 7)) menuClasses.push(c.shadowClass);
			$(this).addClass(menuClasses.join(' '));
		});
	};

	var sf = $.fn.superfish;
	sf.o = [];
	sf.op = {};
	sf.IE7fix = function(){
		var o = sf.op;
		if ($.browser.msie && $.browser.version > 6 && o.dropShadows && o.animation.opacity!=undefined)
			this.toggleClass(sf.c.shadowClass+'-off');
		};
	sf.c = {
		bcClass     : 'sf-breadcrumb',
		menuClass   : 'sf-js-enabled',
		anchorClass : 'sf-with-ul',
		arrowClass  : 'sf-sub-indicator',
		shadowClass : 'sf-shadow'
	};
	sf.defaults = {
		hoverClass	: 'sfHover',
		pathClass	: 'overideThisToUse',
		pathLevels	: 1,
		delay		: 800,
		animation	: {opacity:'show'},
		speed		: 'normal',
		autoArrows	: true,
		dropShadows : true,
		disableHI	: false,		// true disables hoverIntent detection
		onInit		: function(){}, // callback functions
		onBeforeShow: function(){},
		onShow		: function(){},
		onHide		: function(){}
	};
	$.fn.extend({
		hideSuperfishUl : function(){
			var o = sf.op,
				not = (o.retainPath===true) ? o.$path : '';
			o.retainPath = false;
			var $ul = $(['li.',o.hoverClass].join(''),this).add(this).not(not).removeClass(o.hoverClass)
					.find('>ul').hide().css('visibility','hidden');
			o.onHide.call($ul);
			return this;
		},
		showSuperfishUl : function(){
			var o = sf.op,
				sh = sf.c.shadowClass+'-off',
				$ul = this.addClass(o.hoverClass)
					.find('>ul:hidden').css('visibility','visible');
			sf.IE7fix.call($ul);
			o.onBeforeShow.call($ul);
			$ul.animate(o.animation,o.speed,function(){ sf.IE7fix.call($ul); o.onShow.call($ul); });
			return this;
		}
	});

})(jQuery);
;
/* Copyright (c) 2006 Brandon Aaron (http://brandonaaron.net)
 * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) 
 * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
 *
 * $LastChangedDate: 2007-06-19 20:25:28 -0500 (Tue, 19 Jun 2007) $
 * $Rev: 2111 $
 *
 * Version 2.1
 */
(function($){$.fn.bgIframe=$.fn.bgiframe=function(s){if($.browser.msie&&parseInt($.browser.version)<=6){s=$.extend({top:'auto',left:'auto',width:'auto',height:'auto',opacity:true,src:'javascript:false;'},s||{});var prop=function(n){return n&&n.constructor==Number?n+'px':n;},html='<iframe class="bgiframe"frameborder="0"tabindex="-1"src="'+s.src+'"'+'style="display:block;position:absolute;z-index:-1;'+(s.opacity!==false?'filter:Alpha(Opacity=\'0\');':'')+'top:'+(s.top=='auto'?'expression(((parseInt(this.parentNode.currentStyle.borderTopWidth)||0)*-1)+\'px\')':prop(s.top))+';'+'left:'+(s.left=='auto'?'expression(((parseInt(this.parentNode.currentStyle.borderLeftWidth)||0)*-1)+\'px\')':prop(s.left))+';'+'width:'+(s.width=='auto'?'expression(this.parentNode.offsetWidth+\'px\')':prop(s.width))+';'+'height:'+(s.height=='auto'?'expression(this.parentNode.offsetHeight+\'px\')':prop(s.height))+';'+'"/>';return this.each(function(){if($('> iframe.bgiframe',this).length==0)this.insertBefore(document.createElement(html),this.firstChild);});}return this;};if(!$.browser.version)$.browser.version=navigator.userAgent.toLowerCase().match(/.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/)[1];})(jQuery);;
﻿/**
* hoverIntent r5 // 2007.03.27 // jQuery 1.1.2+
* <http://cherne.net/brian/resources/jquery.hoverIntent.html>
* 
* @param  f  onMouseOver function || An object with configuration options
* @param  g  onMouseOut function  || Nothing (use configuration options object)
* @author    Brian Cherne <brian@cherne.net>
*/
(function($){$.fn.hoverIntent=function(f,g){var cfg={sensitivity:7,interval:100,timeout:0};cfg=$.extend(cfg,g?{over:f,out:g}:f);var cX,cY,pX,pY;var track=function(ev){cX=ev.pageX;cY=ev.pageY;};var compare=function(ev,ob){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t);if((Math.abs(pX-cX)+Math.abs(pY-cY))<cfg.sensitivity){$(ob).unbind("mousemove",track);ob.hoverIntent_s=1;return cfg.over.apply(ob,[ev]);}else{pX=cX;pY=cY;ob.hoverIntent_t=setTimeout(function(){compare(ev,ob);},cfg.interval);}};var delay=function(ev,ob){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t);ob.hoverIntent_s=0;return cfg.out.apply(ob,[ev]);};var handleHover=function(e){var p=(e.type=="mouseover"?e.fromElement:e.toElement)||e.relatedTarget;while(p&&p!=this){try{p=p.parentNode;}catch(e){p=this;}}if(p==this){return false;}var ev=jQuery.extend({},e);var ob=this;if(ob.hoverIntent_t){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t);}if(e.type=="mouseover"){pX=ev.pageX;pY=ev.pageY;$(ob).bind("mousemove",track);if(ob.hoverIntent_s!=1){ob.hoverIntent_t=setTimeout(function(){compare(ev,ob);},cfg.interval);}}else{$(ob).unbind("mousemove",track);if(ob.hoverIntent_s==1){ob.hoverIntent_t=setTimeout(function(){delay(ev,ob);},cfg.timeout);}}};return this.mouseover(handleHover).mouseout(handleHover);};})(jQuery);;
// $Id: nice_menus.js,v 1.21 2010/06/18 06:14:12 vordude Exp $

// This uses Superfish 1.4.8
// (http://users.tpg.com.au/j_birch/plugins/superfish)

// Add Superfish to all Nice menus with some basic options.
(function ($) {
  $(document).ready(function() {
    $('ul.nice-menu').superfish({
      // Apply a generic hover class.
      hoverClass: 'over',
      // Disable generation of arrow mark-up.
      autoArrows: false,
      // Disable drop shadows.
      dropShadows: false,
      // Mouse delay.
      delay: Drupal.settings.nice_menus_options.delay,
      // Animation speed.
      speed: Drupal.settings.nice_menus_options.speed
    // Add in Brandon Aaron’s bgIframe plugin for IE select issues.
    // http://plugins.jquery.com/node/46/release
    }).find('ul').bgIframe({opacity:false});
    $('ul.nice-menu ul').css('display', 'none');
  });
})(jQuery);
;
/**
* hoverIntent r6 // 2011.02.26 // jQuery 1.5.1+
* <http://cherne.net/brian/resources/jquery.hoverIntent.html>
* 
* @param  f  onMouseOver function || An object with configuration options
* @param  g  onMouseOut function  || Nothing (use configuration options object)
* @author    Brian Cherne brian(at)cherne(dot)net
*/
(function($){$.fn.hoverIntent=function(f,g){var cfg={sensitivity:7,interval:100,timeout:0};cfg=$.extend(cfg,g?{over:f,out:g}:f);var cX,cY,pX,pY;var track=function(ev){cX=ev.pageX;cY=ev.pageY};var compare=function(ev,ob){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t);if((Math.abs(pX-cX)+Math.abs(pY-cY))<cfg.sensitivity){$(ob).unbind("mousemove",track);ob.hoverIntent_s=1;return cfg.over.apply(ob,[ev])}else{pX=cX;pY=cY;ob.hoverIntent_t=setTimeout(function(){compare(ev,ob)},cfg.interval)}};var delay=function(ev,ob){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t);ob.hoverIntent_s=0;return cfg.out.apply(ob,[ev])};var handleHover=function(e){var ev=jQuery.extend({},e);var ob=this;if(ob.hoverIntent_t){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t)}if(e.type=="mouseenter"){pX=ev.pageX;pY=ev.pageY;$(ob).bind("mousemove",track);if(ob.hoverIntent_s!=1){ob.hoverIntent_t=setTimeout(function(){compare(ev,ob)},cfg.interval)}}else{$(ob).unbind("mousemove",track);if(ob.hoverIntent_s==1){ob.hoverIntent_t=setTimeout(function(){delay(ev,ob)},cfg.timeout)}}};return this.bind('mouseenter',handleHover).bind('mouseleave',handleHover)}})(jQuery);;
/* Copyright (c) 2010 Brandon Aaron (http://brandonaaron.net)
 * Licensed under the MIT License (LICENSE.txt).
 *
 * Version 2.1.2
 */
(function(a){a.fn.bgiframe=(a.browser.msie&&/msie 6\.0/i.test(navigator.userAgent)?function(d){d=a.extend({top:"auto",left:"auto",width:"auto",height:"auto",opacity:true,src:"javascript:false;"},d);var c='<iframe class="bgiframe"frameborder="0"tabindex="-1"src="'+d.src+'"style="display:block;position:absolute;z-index:-1;'+(d.opacity!==false?"filter:Alpha(Opacity='0');":"")+"top:"+(d.top=="auto"?"expression(((parseInt(this.parentNode.currentStyle.borderTopWidth)||0)*-1)+'px')":b(d.top))+";left:"+(d.left=="auto"?"expression(((parseInt(this.parentNode.currentStyle.borderLeftWidth)||0)*-1)+'px')":b(d.left))+";width:"+(d.width=="auto"?"expression(this.parentNode.offsetWidth+'px')":b(d.width))+";height:"+(d.height=="auto"?"expression(this.parentNode.offsetHeight+'px')":b(d.height))+';"/>';return this.each(function(){if(a(this).children("iframe.bgiframe").length===0){this.insertBefore(document.createElement(c),this.firstChild)}})}:function(){return this});a.fn.bgIframe=a.fn.bgiframe;function b(c){return c&&c.constructor===Number?c+"px":c}})(jQuery);;
/*
 * Superfish v1.4.8 - jQuery menu widget
 * Copyright (c) 2008 Joel Birch
 *
 * Dual licensed under the MIT and GPL licenses:
 *   http://www.opensource.org/licenses/mit-license.php
 *   http://www.gnu.org/licenses/gpl.html
 *
 * CHANGELOG: http://users.tpg.com.au/j_birch/plugins/superfish/changelog.txt
 */

(function($){
  $.fn.superfish = function(op){
    var sf = $.fn.superfish,
      c = sf.c,
      $arrow = $(['<span class="',c.arrowClass,'"> &#187;</span>'].join('')),
      over = function(){
        var $$ = $(this), menu = getMenu($$);
        clearTimeout(menu.sfTimer);
        $$.showSuperfishUl().siblings().hideSuperfishUl();
      },
      out = function(){
        var $$ = $(this), menu = getMenu($$), o = sf.op;
        clearTimeout(menu.sfTimer);
        menu.sfTimer=setTimeout(function(){
          o.retainPath=($.inArray($$[0],o.$path)>-1);
          $$.hideSuperfishUl();
          if (o.$path.length && $$.parents(['li.',o.hoverClass].join('')).length<1){over.call(o.$path);}
        },o.delay);
      },
      getMenu = function($menu){
        var menu = $menu.parents(['ul.',c.menuClass,':first'].join(''))[0];
        sf.op = sf.o[menu.serial];
        return menu;
      },
      addArrow = function($a){ $a.addClass(c.anchorClass).append($arrow.clone()); };

    return this.each(function() {
      var s = this.serial = sf.o.length;
      var o = $.extend({},sf.defaults,op);
      o.$path = $('li.'+o.pathClass,this).slice(0,o.pathLevels).each(function(){
        $(this).addClass([o.hoverClass,c.bcClass].join(' '))
          .filter('li:has(ul)').removeClass(o.pathClass);
      });
      sf.o[s] = sf.op = o;

      $('li:has(ul)',this)[($.fn.hoverIntent && !o.disableHI) ? 'hoverIntent' : 'hover'](over,out).each(function() {
        if (o.autoArrows) addArrow( $('>a:first-child',this) );
      })
      .not('.'+c.bcClass)
        .hideSuperfishUl();

      var $a = $('a',this);
      $a.each(function(i){
        var $li = $a.eq(i).parents('li');
        $a.eq(i).focus(function(){over.call($li);}).blur(function(){out.call($li);});
      });
      o.onInit.call(this);

    }).each(function() {
      var menuClasses = [c.menuClass];
      if (sf.op.dropShadows  && !($.browser.msie && $.browser.version < 7)) menuClasses.push(c.shadowClass);
      $(this).addClass(menuClasses.join(' '));
    });
  };

  var sf = $.fn.superfish;
  sf.o = [];
  sf.op = {};
  sf.IE7fix = function(){
    var o = sf.op;
    if ($.browser.msie && $.browser.version > 6 && o.dropShadows && o.animation.opacity!=undefined)
      this.toggleClass(sf.c.shadowClass+'-off');
    };
  sf.c = {
    bcClass: 'sf-breadcrumb',
    menuClass: 'sf-js-enabled',
    anchorClass: 'sf-with-ul',
    arrowClass: 'sf-sub-indicator',
    shadowClass: 'sf-shadow'
  };
  sf.defaults = {
    hoverClass: 'sfHover',
    pathClass: 'overideThisToUse',
    pathLevels: 1,
    delay: 800,
    animation: {opacity:'show'},
    speed: 'normal',
    autoArrows: true,
    dropShadows: true,
    disableHI: false, // true disables hoverIntent detection
    onInit: function(){}, // callback functions
    onBeforeShow: function(){},
    onShow: function(){},
    onHide: function(){}
  };
  $.fn.extend({
    hideSuperfishUl : function(){
      var o = sf.op,
        not = (o.retainPath===true) ? o.$path : '';
      o.retainPath = false;
      var $ul = $(['li.',o.hoverClass].join(''),this).add(this).not(not).removeClass(o.hoverClass)
          .find('>ul').hide().css('visibility','hidden');
      o.onHide.call($ul);
      return this;
    },
    showSuperfishUl : function(){
      var o = sf.op,
        sh = sf.c.shadowClass+'-off',
        $ul = this.addClass(o.hoverClass)
          .find('>ul:hidden').css('visibility','visible');
      sf.IE7fix.call($ul);
      o.onBeforeShow.call($ul);
      $ul.animate(o.animation,o.speed,function(){ sf.IE7fix.call($ul); o.onShow.call($ul); });
      return this;
    }
  });
})(jQuery);;
/*
 * Supersubs v0.2b - jQuery plugin - LAST UPDATE: MARCH 23rd, 2011
 * Copyright (c) 2008 Joel Birch
 *
 * Jan 16th, 2011 - Modified a little in order to work with NavBar menus as well.
 *
 * Dual licensed under the MIT and GPL licenses:
 *   http://www.opensource.org/licenses/mit-license.php
 *   http://www.gnu.org/licenses/gpl.html
 *
 * This plugin automatically adjusts submenu widths of suckerfish-style menus to that of
 * their longest list item children. If you use this, please expect bugs and report them
 * to the jQuery Google Group with the word 'Superfish' in the subject line.
 *
 */

(function($){ // $ will refer to jQuery within this closure

  $.fn.supersubs = function(options){
    var opts = $.extend({}, $.fn.supersubs.defaults, options);
	// return original object to support chaining
    return this.each(function() {
      // cache selections
      var $$ = $(this);
      // support metadata
      var o = $.meta ? $.extend({}, opts, $$.data()) : opts;
      // get the font size of menu.
      // .css('fontSize') returns various results cross-browser, so measure an em dash instead
      var fontsize = $('<li id="menu-fontsize">&#8212;</li>').css({
        'padding' : 0,
        'position' : 'absolute',
        'top' : '-99999em',
        'width' : 'auto'
      }).appendTo($$).width(); //clientWidth is faster, but was incorrect here
      // remove em dash
      $('#menu-fontsize').remove();

      // Jump on level if it's a "NavBar"
      if ($$.hasClass('sf-navbar')) {
        $$ = $('li > ul', $$);
      }
      // cache all ul elements 
      $ULs = $$.find('ul:not(.sf-megamenu)');
      // loop through each ul in menu
      $ULs.each(function(i) {
        // cache this ul
        var $ul = $ULs.eq(i);
        // get all (li) children of this ul
        var $LIs = $ul.children();
        // get all anchor grand-children
        var $As = $LIs.children('a');
        // force content to one line and save current float property
        var liFloat = $LIs.css('white-space','nowrap').css('float');
        // remove width restrictions and floats so elements remain vertically stacked
        var emWidth = $ul.add($LIs).add($As).css({
          'float' : 'none',
          'width'  : 'auto'
        })
        // this ul will now be shrink-wrapped to longest li due to position:absolute
        // so save its width as ems. Clientwidth is 2 times faster than .width() - thanks Dan Switzer
        .end().end()[0].clientWidth / fontsize;
        // add more width to ensure lines don't turn over at certain sizes in various browsers
        emWidth += o.extraWidth;
        // restrict to at least minWidth and at most maxWidth
        if (emWidth > o.maxWidth)    { emWidth = o.maxWidth; }
        else if (emWidth < o.minWidth)  { emWidth = o.minWidth; }
        emWidth += 'em';
        // set ul to width in ems
        $ul.css('width',emWidth);
        // restore li floats to avoid IE bugs
        // set li width to full width of this ul
        // revert white-space to normal
        $LIs.css({
          'float' : liFloat,
          'width' : '100%',
          'white-space' : 'normal'
        })
        // update offset position of descendant ul to reflect new width of parent
        .each(function(){
          var $childUl = $('>ul',this);
          var offsetDirection = $childUl.css('left')!==undefined ? 'left' : 'right';
          $childUl.css(offsetDirection,emWidth);
        });
      });

    });
  };
  // expose defaults
  $.fn.supersubs.defaults = {
    minWidth: 9, // requires em unit.
    maxWidth: 25, // requires em unit.
    extraWidth: 0 // extra width can ensure lines don't sometimes turn over due to slight browser differences in how they round-off values
  };

})(jQuery); // plugin code ends;
/*
* Supposition v0.2 - an optional enhancer for Superfish jQuery menu widget - LAST UPDATE: MARCH 23rd, 2011
*
* Copyright (c) 2008 Joel Birch - based mostly on work by Jesse Klaasse and credit goes largely to him.
* Special thanks to Karl Swedberg for valuable input.
* 
* Dec 28th, 2010 - Modified for the Superfish project for Drupal (http://drupal.org/project/superfish)
*
* jQuery version: 1.3.x or higher.
*
* Dual licensed under the MIT and GPL licenses:
* 	http://www.opensource.org/licenses/mit-license.php
* 	http://www.gnu.org/licenses/gpl.html
*/

(function($){
  $.fn.supposition = function(){
    var $w = $(window), /*do this once instead of every onBeforeShow call*/
    _offset = function(dir) {
      return window[dir == 'y' ? 'pageYOffset' : 'pageXOffset']
      || document.documentElement && document.documentElement[dir=='y' ? 'scrollTop' : 'scrollLeft']
      || document.body[dir=='y' ? 'scrollTop' : 'scrollLeft'];
    },
    onHide = function(){
      this.css({Top:'',Right:'',Bottom:'',Left:''});
    },
    onBeforeShow = function(){
      this.each(function(){
        var $u = $(this);
        $u.css('display','block');
        var menuWidth = $u.width(),
        menuParentWidth = $u.closest('li').outerWidth(true),
        menuParentLeft = $u.closest('li').offset().left,
        totalRight = $w.width() + _offset('x'),
        menuRight = $u.offset().left + menuWidth,
        exactMenuWidth = (menuRight > (menuParentWidth + menuParentLeft)) ? menuWidth - (menuRight - (menuParentWidth + menuParentLeft)) : menuWidth;  
        if ($u.parents('.sf-js-enabled').hasClass('rtl')) {
          if (menuParentLeft < exactMenuWidth) {
            $u.css('left', menuParentWidth + 'px');
            $u.css('right', 'auto');
          }
        }
        else {
          if (menuRight > totalRight && menuParentLeft > menuWidth) {
            $u.css('right', menuParentWidth + 'px');
            $u.css('left', 'auto');
          }
        }
        var windowHeight = $w.height(),
        offsetTop = $u.offset().top,
        menuParentHeight = $u.parent().outerHeight(true),
        menuHeight = $u.height(),
        baseline = windowHeight + _offset('y');
        var expandUp = ((offsetTop + menuHeight > baseline) && (offsetTop > menuHeight));
        if (expandUp) {
          $u.css('bottom', menuParentHeight + 'px');
          $u.css('top', 'auto');
        }
        $u.css('display','none');
      });
    };

    return this.each(function() {
    var o = $.fn.superfish.o[this.serial]; /* get this menu's options */

    /* if callbacks already set, store them */
    var _onBeforeShow = o.onBeforeShow,
    _onHide = o.onHide;

    $.extend($.fn.superfish.o[this.serial],{
    onBeforeShow: function() {
    onBeforeShow.call(this); /* fire our Supposition callback */
    _onBeforeShow.call(this); /* fire stored callbacks */
    },
    onHide: function() {
    onHide.call(this); /* fire our Supposition callback */
    _onHide.call(this); /* fire stored callbacks */
    }
    });
    });
  };
})(jQuery);;
/*
 * sf-Touchscreen v1.0b - Provides touchscreen compatibility for the jQuery Superfish plugin. - LAST UPDATE: MARCH 23rd, 2011
 *
 * Developer's notes:
 * Built as a part of the Superfish project for Drupal (http://drupal.org/project/superfish) 
 * Found any bug? have any cool ideas? contact me right away! http://drupal.org/user/619294/contact
 *
 * jQuery version: 1.3.x or higher.
 *
 * Dual licensed under the MIT and GPL licenses:
 *   http://www.opensource.org/licenses/mit-license.php
 *   http://www.gnu.org/licenses/gpl.html
*/

(function($){
  $.fn.sftouchscreen = function() {
    // Return original object to support chaining.
    return this.each( function() {
      // Select hyperlinks from parent menu items.
      $(this).find('li > ul').closest('li').children('a').each( function() {
	    var $item = $(this);
        // No .toggle() here as it's not possible to reset it.
        $item.click( function(event){
	      // Already clicked? proceed to the URI.
          if ($item.hasClass('sf-clicked')) {
            var $uri = $item.attr('href');
            window.location = $uri;
          }
          else {
            event.preventDefault();
            $item.addClass('sf-clicked');
          }
        }).closest('li').mouseleave( function(){
          // So, we reset everything.
          $item.removeClass('sf-clicked');
        });
	  });
    });
  };
})(jQuery);;
/*
** we're using the jQuery based javascript, but our design pattern will be
** the Yui object paradigm which is much better at stability and 
** expandability.
*/
var Ticode = (("undefined" == typeof Ticode) || (!Ticode)) ? {} : Ticode;

(
function ($)
{

/**
*
*  Javascript sprintf
*  http://www.webtoolkit.info/
*
*
**/
Ticode.sprintfWrapper =
{
    
  gexp:
    new RegExp(/(%([%]|(\-)?(\+|\x20)?(0)?(\d+)?(\.(\d)?)?([bcdfosxX])))/g)

, init : function ()
  {
    if (typeof arguments == "undefined")  { return null; }
    if (1 > arguments.length)		  { return null; }
    if (typeof arguments[0] != "string")  { return null; }
    if (typeof RegExp == "undefined")	  { return null; }

    var exp		= Ticode.sprintfWrapper.gexp
      , convert		= Ticode.sprintfWrapper.convert
      , string		= arguments[0]
      , matches		= new Array()
      , strings		= new Array()
      , convCount	= 0
      , stringPosStart	= 0
      , stringPosEnd	= 0
      , matchPosEnd	= 0
      , newString	= ''
      , match		= null
      , neg		= false
      , arg		= ''
      , code		= null
      , i		= null
      ;
    while (match = exp.exec(string))
    {
      if (match[9]) { convCount += 1; }

      stringPosStart	      = matchPosEnd;
      stringPosEnd	      = exp.lastIndex - match[0].length;
      strings[strings.length] = string.substring( stringPosStart,
						  stringPosEnd);
      neg = (0 > parseInt(arguments[convCount])) ? true : false;
      arg = String(arguments[convCount])


      matchPosEnd	      = exp.lastIndex;
      matches[matches.length] = { match:      match[0]
				, left:	      match[3] ? true : false
				, sign:	      match[4] || ''
				, pad:	      match[5] || ' '
				, min:	      match[6] || 0
				, precision:  match[8]
				, code:	      match[9] || '%'
				, negative:   neg
				, argument:   arg
				};
    }
    strings[strings.length] = string.substring(matchPosEnd);

    if (matches.length == 0)		    { return string;  }
    if (convCount > (arguments.length - 1)) { return null;    }

    match = i = null;

    for (i=0; i < matches.length; i++)
    {
      if      ('%' == matches[i].code)	{ substitution = '%' }
      else if ('b' == matches[i].code)
      {
	matches[i].argument =
	  String(Math.abs(parseInt(matches[i].argument)).toString(2));

	substitution = convert(matches[i], true);
      }
      else if ('c' == matches[i].code)
      {
	matches[i].argument =
	  String(
	    String.fromCharCode(
	      parseInt(Math.abs(parseInt(matches[i].argument)))));

	substitution = convert(matches[i], true);
      }
      else if ('d' == matches[i].code)
      {
	matches[i].argument =
	  String(Math.abs(parseInt(matches[i].argument)));

	substitution = convert(matches[i]);
      }
      else if ('f' == matches[i].code)
      {
	matches[i].argument =
	  String(
	    Math.abs(parseFloat(matches[i].argument)		    ).
	    toFixed(matches[i].precision ? matches[i].precision : 6));

	substitution = convert(matches[i]);
      }
      else if ('o' == matches[i].code)
      {
	matches[i].argument =
	  String(Math.abs(parseInt(matches[i].argument)).toString(8));

	substitution = convert(matches[i]);
      }
      else if ('s' == matches[i].code)
      {
	matches[i].argument =
	  matches[i].argument.
	    substring(0,
		      matches[i].precision ?
		      matches[i].precision : matches[i].argument.length);

	substitution = convert(matches[i], true);
      }
      else if ('x' == matches[i].code)
      {
	matches[i].argument =
	  String(Math.abs(parseInt(matches[i].argument)).toString(16));

	substitution = convert(matches[i]);
      }
      else if ('X' == matches[i].code)
      {
	matches[i].argument =
	  String(Math.abs(parseInt(matches[i].argument)).toString(16));
	  
	substitution = convert(matches[i]).toUpperCase();
      }
      else
      {
	substitution = matches[i].match;
      }
      newString += strings[i];
      newString += substitution;
    }
    newString += strings[i];

    return newString;
  }
  
, convert : function (match, nosign)
  {
    if (nosign) { match.sign = '';				  }
    else	{ match.sign = match.negative ? '-' : match.sign; }

    var l = match.min - match.argument.length + 1 - match.sign.length
      ;
    var pad = new Array((l < 0) ? 0 : l).join(match.pad)
      ;
    if (!match.left)
    {
      if (match.pad == '0' || nosign)
      {
	return match.sign + pad + match.argument;
      }
      else
      {
	return pad + match.sign + match.argument;
      }
    }
    else
    {
      if (match.pad == '0' || nosign)
      {
	return match.sign + match.argument + pad.replace(/0/g, ' ');
      }
      else
      {
	return match.sign + match.argument + pad;
      }
    }
  }
}

Ticode.System = function ()
{
  /*  
  ******************************************************************
  ** private variables available only to methods of the module.
  */
  var c_do  = false
    , w_do  = false
    , p_do  = false
    , s_do  = false
    , g_do  = false
    , dtop  = null
    ;
  /*  
  ** private shorthand variables to comon YUI/Prototype parts/utilities
  */

  /*  
  ** private shorthand variable for built YUI objects. set in init()
  */
  
  /*  
  ** constants used in this module.
  */

  /*  
  ** module state:
  */
  var once  = false
    , id    = 0
    ;
  /*  
  ** these are Dom refrences that won't change, they are set by direct
  ** calls when needed, and then used freely after that.
  */
  var chalkboard  = null
    ;

  /*  
  ** ******************************************************************
  ** private methods available only to other methods of the module.
  */

  /*
  ** generic page based event handler
  */
  var event_handler = function (ev)
  {
    var el  = null
      , val = 0
      , whc = 0;

    if ((!ev) || (!(el = ev.target)))
    {
      return;
    }
    el = $(el);

    while (el != dtop)
    {
      $('#debug').append('<h1>val = ' + val + ', id: ' + el[0]['id']
                        + '</h1><h2>"Graphics" for id = '
                        + '</h2><h2>"DIV" for tag Name = '
                        + ('DIV' == el[0]['tagName'])
                        + '</h2><h2>el.hasClass() = '
                        + el.hasClass('clickable') + '</h2><ul>'
                        + '<li>tagName: ' + el[0]['tagName'] + '</li>'
                        + '</ul>');
      /*
      ** handle click's
      */
      if (!el)
      {
        break;
      }
      if ('click' == ev.type)
      {
        if (('DIV' == el[0]['tagName']) && (el.hasClass('clickable')))
        {
          if ('clickhere' == el[0]['id'])
          {
            if (c_do)
            {
              $('#debug').append('<h4>here hiding</h4>');
              $('#show, #boxes, #grow1').hide('slow');
            }
            else
            {
              $('#debug').append('<h4>here showing</h4>');
              $('#show, #boxes, #grow1').show('slow');
            }
            c_do = !c_do
            break;
          }
          if (('Graphics'     == el[0]['id']) ||
              ('Web-Design'   == el[0]['id']) ||
              ('Programming'  == el[0]['id']) ||
              ('SEO'          == el[0]['id']))
          {
            $('#grow2, #grow3, #grow4, #grow5').hide('slow');

            if ('Graphics' == el[0]['id'])
            {
              whc = 'g_do';

              if (!(val = g_do))
              {
                $('#grow2').show('slow');
              }
            }
            else if ('Web-Design' == el[0]['id'])
            {
              whc = 'w_do';

              if (!(val = w_do))
              {
                $('#grow3').show('slow');
              }
            }
            else if ('Programming' == el[0]['id'])
            {
              whc = 'p_do';

              if (!(val = p_do))
              {
                $('#grow4').show('slow');
              }
            }
            else
            {
              whc = 's_do';

              if (!(val = s_do))
              {
                $('#grow5').show('slow');
              }
            }
            g_do = w_do = p_do = s_do = false;

            eval(whc + '  = !val');
            break;
          }
        }
      }
      else if ('change' == ev.type)
      {
      }
      else if ('keyup' == ev.type)
      {
      }
      val++;

      el = $(el).parent();
      if ((!(val % 10)) && (confirm('quit')))
      {
        break;
      }
    }
  };

  var that =
    /*
    ** publicly accessible variables where we store AJAX results by
    ** evaluating valid js pointing to these arrays.
    */
    { translations: [] // Ticode.System.translations[]

      /*
      ** Public Ticode.System.erudiate() -- Erudiate means to instruct or
      **				    teach us.  Here we mean teaching
      **    us about the contents of some obscure object in an easy to use
      **    jQuery dialog.  This function builds the dialog, or resets it.
      **
      **  @param  mixed	  obj	- The object to display.
      **  @param  string  name	- The name of the object we will display.
      **  @return null
      **  @side-effect	- Opens a dialog filled with information about the
      **		  object item.
      */
    , erudiate:	function (obj, name)
      {
	var content = null
	  ;
	if (!chalkboard) // Ticode object private scope item.
	{
	  chalkboard = $('<div id="tic_sys_chalkboard"></div>');

	  $(document).append(chalkboard);
	  $(chalkboard).dialog( { autoOpen: false 
				, modal:    true 
				, width:    539 
				, height:   254 
				});
	}
	content = that.imbue(obj, name);

	$(chalkboard).html(content.html());
	$(chalkboard).dialog('open');
      }

      /*
      ** Public Ticode.System.imbue() - Imbue is another word for 'to teach'
      **				or 'instuct'.  In this case we mean
      **    to show us the contents of some obscure object in an html layout
      **    that we ajaxify to expand on sub items by click.
      **
      **  @param  mixed	  obj	- The object to display.
      **  @param  string  name	- The name of the object we will display.
      **  @return object	- The jQuery HTML object for display.
      */
    , imbue:  function (obj, name)
      {
	var fieldset  = null
	  , legend    = null
	  , div	      = null
	  , index     = null
	  , item      = null
	  , ul	      = null
	  , part      = null
	  , d_id      = 'tic_sys-d-' + id
	  , click     = null
	  , b_id      = null
	  , expand    = null
	  ;
	click = function ()
	{
	  $('#' + d_id).toggle();
	};
	id++;

	fieldset  = $('<fieldset></fieldset>');
	legend	  = $('<legend>' + name + '</legend>');
	div	  = $('<div id="' + d_id + '"></div>');

	// Interior contents

	ul = $('<ul>' + (typeof obj) + ' contents:<br /></ul>');

	if (('object' == typeof obj) || ('array' == typeof obj))
	{
	  for (index in obj)
	  {
	    item = obj[index];

	    if (undefined == item)
	    {
	      part = $('<li><b>.' + index + '</b> = undefined</li>');
	    }
	    else if ('integer' == typeof item)
	    {
	      part = $('<li><b>.' + index + '</b> = ' + item + '</li>');
	    }
	    else if ('string' == typeof item)
	    {
	      part = $('<li><b>.' + index + '</b> = "' + item + '"</li>');
	    }
	    else if ('array' == typeof item)
	    {
	      b_id    = 'tic_sys-b-' + id;
	      expand  = function ()
	      {
		var content = that.imbue(item, index)
		  ;
		$('#' + b_id).parent().html(content);
	      };
	      id++;
	      part = $(	'<li><b id="' + b_id + '">.' + index +
			'</b> (array click to expand)</li>');

	      $('#:not(.ticode_system-processed)').click(expand).
		      addClass('ticode_system-processed');
	    }
	    else if ('object' == typeof item)
	    {
	      if (('nextSibling'    != index) && ('document'	!= index) &&
		  ('parentElement'  != index) && ('namespaces'	!= index) &&
		  ('parentTextEdit' != index) && ('ownerElement'!= index) &&
		  ('ownerDocument'  != index) && ('offsetParent'!= index) &&
		  ('previousSibling'!= index) && ('parentNode'	!= index))
	      {
		b_id    = 'tic_sys-b-' + id;
		expand  = function ()
		{
		  var content = that.imbue(item, index)
		    ;
		  $('#' + b_id).parent().html(content);
		};
		id++;
		part = $(	'<li><b id="' + b_id + '">.' + index +
			  '</b> (object click to expand)</li>');

		$('#:not(.ticode_system-processed)').click(expand).
			addClass('ticode_system-processed');
	      }
	    }
	    else 
	    {
	      part = $(	'<li><b>.' + index +
			'</b> item type of [' + (typeof item) +
			'] is not explicitly handled by function ' +
			'Ticode.System.imbue</li>');
	    }
	    $(ul).append(part);
	  }
	}
	else if ('integer' == typeof obj)
	{
	  $(ul).append('<em>' + obj + '</em>');
	}
	else if ('string' == typeof obj)
	{
	  $(ul).append('<i>"' + obj + '"</i>');
	}
	div.hide();

	$(legend).filter(':not(.ticode_system-processed)').click(click).
		  addClass('ticode_system-processed');

	$(fieldset).append(legend);
	$(fieldset).append(div);

	return fieldset;
      }

      /*
      ** Public Ticode.System.imagefix() -- Makes sure the hspace and 
      **				    vspace values are taken with
      **    higher priority than reset.css stylesheet.
      **
      **  Our wysiwyg tool gives the user the power to set a spacing
      **  to an image, be either vertical or horizontal.  Problem is that
      **  drupal adds a clear.css stylesheet that will override those
      **  values.  We can set divs and classes to allow margins, but you
      **  cannot expect regular users to learn those tricks, so we need
      **  to keep basic tools for them.  This function will take those
      **  values and convert them to margin rules directly added to the
      **  tag, so they can have the top-most priority.
      */
    , imagefix:	function ()
      {
	var style   = $(this).attr('style');
	var hspace  = $(this).attr('hspace');
	var vspace  = $(this).attr('vspace');

	// We will extend the style property for the image tag (if there
	// is something).  Just make sure we have the current style value
	// or empty string as default.
	//
	if ('undefined' == typeof(style))
	{
	  style = '';
	}

	// Check if we have a manually added hspace *or* vspace to use
	// If so, add the appropiate margin to the image.
	//
	if (0 < hspace)
	{
	  style	+= ' margin-left:'+hspace+'px; margin-right:'+hspace+'px;';
	}
	if (0 < vspace)
	{
	  style	+= ' margin-top:'+vspace+'px; margin-bottom:'+vspace+'px;';
	}

	// Set the new (or modified) style to the image tag (only if there
	// is an actual change.
	//
	if ((0 < hspace) || (0 < vspace))
	{
	  $(this).attr('style', style);
	}
      }

    };
      /*
      ** for finding .attr('style', 'background:#ee9933');
      */
        //attr('style', 'background:#ee9933');

  return that;

}(); // the parens here cause the anonymous func to execute and return

Drupal.behaviors.ticode_system  = 
{
  attach: function (context, settings)
  {
    if (undefined = Ticode.System.sprintf)
    {
      Ticode.System.sprintf = Ticode.sprintfWrapper.init;
    }

    $('form#system-modules fieldset.collapsible:not(.collapsed)')
      .addClass('collapsed');

    // Add support to hspace and vspace properties set to images by
    // wysiwyg tool.
    //
    $('img', context)	  .once('ticode_system', Ticode.System.imagefix);
  }
};

}
)(jQuery);

;
(function ($) {

/**
 * Toggle the visibility of a fieldset using smooth animations.
 */
Drupal.toggleFieldset = function (fieldset) {
  var $fieldset = $(fieldset);
  if ($fieldset.is('.collapsed')) {
    var $content = $('> .fieldset-wrapper', fieldset).hide();
    $fieldset
      .removeClass('collapsed')
      .trigger({ type: 'collapsed', value: false })
      .find('> legend span.fieldset-legend-prefix').html(Drupal.t('Hide'));
    $content.slideDown({
      duration: 'fast',
      easing: 'linear',
      complete: function () {
        Drupal.collapseScrollIntoView(fieldset);
        fieldset.animating = false;
      },
      step: function () {
        // Scroll the fieldset into view.
        Drupal.collapseScrollIntoView(fieldset);
      }
    });
  }
  else {
    $fieldset.trigger({ type: 'collapsed', value: true });
    $('> .fieldset-wrapper', fieldset).slideUp('fast', function () {
      $fieldset
        .addClass('collapsed')
        .find('> legend span.fieldset-legend-prefix').html(Drupal.t('Show'));
      fieldset.animating = false;
    });
  }
};

/**
 * Scroll a given fieldset into view as much as possible.
 */
Drupal.collapseScrollIntoView = function (node) {
  var h = document.documentElement.clientHeight || document.body.clientHeight || 0;
  var offset = document.documentElement.scrollTop || document.body.scrollTop || 0;
  var posY = $(node).offset().top;
  var fudge = 55;
  if (posY + node.offsetHeight + fudge > h + offset) {
    if (node.offsetHeight > h) {
      window.scrollTo(0, posY);
    }
    else {
      window.scrollTo(0, posY + node.offsetHeight - h + fudge);
    }
  }
};

Drupal.behaviors.collapse = {
  attach: function (context, settings) {
    $('fieldset.collapsible', context).once('collapse', function () {
      var $fieldset = $(this);
      // Expand fieldset if there are errors inside, or if it contains an
      // element that is targeted by the uri fragment identifier. 
      var anchor = location.hash && location.hash != '#' ? ', ' + location.hash : '';
      if ($('.error' + anchor, $fieldset).length) {
        $fieldset.removeClass('collapsed');
      }

      var summary = $('<span class="summary"></span>');
      $fieldset.
        bind('summaryUpdated', function () {
          var text = $.trim($fieldset.drupalGetSummary());
          summary.html(text ? ' (' + text + ')' : '');
        })
        .trigger('summaryUpdated');

      // Turn the legend into a clickable link, but retain span.fieldset-legend
      // for CSS positioning.
      var $legend = $('> legend .fieldset-legend', this);

      $('<span class="fieldset-legend-prefix element-invisible"></span>')
        .append($fieldset.hasClass('collapsed') ? Drupal.t('Show') : Drupal.t('Hide'))
        .prependTo($legend)
        .after(' ');

      // .wrapInner() does not retain bound events.
      var $link = $('<a class="fieldset-title" href="#"></a>')
        .prepend($legend.contents())
        .appendTo($legend)
        .click(function () {
          var fieldset = $fieldset.get(0);
          // Don't animate multiple times.
          if (!fieldset.animating) {
            fieldset.animating = true;
            Drupal.toggleFieldset(fieldset);
          }
          return false;
        });

      $legend.append(summary);
    });
  }
};

})(jQuery);
;
(function ($) {

$(document).ready(function() {

  // Accepts a string; returns the string with regex metacharacters escaped. The returned string
  // can safely be used at any point within a regex to match the provided literal string. Escaped
  // characters are [ ] { } ( ) * + ? - . , \ ^ $ # and whitespace. The character | is excluded
  // in this function as it's used to separate the domains names.
  RegExp.escapeDomains = function(text) {
    return (text) ? text.replace(/[-[\]{}()*+?.,\\^$#\s]/g, "\\$&") : '';
  }

  // Attach onclick event to document only and catch clicks on all elements.
  $(document.body).click(function(event) {
    // Catch the closest surrounding link of a clicked element.
    $(event.target).closest("a,area").each(function() {

      var ga = Drupal.settings.googleanalytics;
      // Expression to check for absolute internal links.
      var isInternal = new RegExp("^(https?):\/\/" + window.location.host, "i");
      // Expression to check for special links like gotwo.module /go/* links.
      var isInternalSpecial = new RegExp("(\/go\/.*)$", "i");
      // Expression to check for download links.
      var isDownload = new RegExp("\\.(" + ga.trackDownloadExtensions + ")$", "i");
      // Expression to check for the sites cross domains.
      var isCrossDomain = new RegExp("^(https?|ftp|news|nntp|telnet|irc|ssh|sftp|webcal):\/\/.*(" + RegExp.escapeDomains(ga.trackCrossDomains) + ")", "i");

      // Is the clicked URL internal?
      if (isInternal.test(this.href)) {
        // Is download tracking activated and the file extension configured for download tracking?
        if (ga.trackDownload && isDownload.test(this.href)) {
          // Download link clicked.
          var extension = isDownload.exec(this.href);
          _gaq.push(["_trackEvent", "Downloads", extension[1].toUpperCase(), this.href.replace(isInternal, '')]);
        }
        else if (isInternalSpecial.test(this.href)) {
          // Keep the internal URL for Google Analytics website overlay intact.
          _gaq.push(["_trackPageview", this.href.replace(isInternal, '')]);
        }
      }
      else {
        if (ga.trackMailto && $(this).is("a[href^=mailto:],area[href^=mailto:]")) {
          // Mailto link clicked.
          _gaq.push(["_trackEvent", "Mails", "Click", this.href.substring(7)]);
        }
        else if (ga.trackOutbound && this.href) {
          if (ga.trackDomainMode == 2 && isCrossDomain.test(this.href)) {
            // Top-level cross domain clicked. document.location is handled by _link internally.
            _gaq.push(["_link", this.href]);
          }
          else if (ga.trackOutboundAsPageview) {
            // Track all external links as page views after URL cleanup.
            // Currently required, if click should be tracked as goal.
            _gaq.push(["_trackPageview", '/outbound/' + this.href.replace(/^(https?|ftp|news|nntp|telnet|irc|ssh|sftp|webcal):\/\//i, '').split('/').join('--')]);
          }
          else {
            // External link clicked.
            _gaq.push(["_trackEvent", "Outbound links", "Click", this.href]);
          }
        }
      }
    });
  });
});

})(jQuery);
;

