Resources/public/js/jquery.clickmenu.js
author ymh <ymh.work@gmail.com>
Fri, 26 Sep 2014 10:04:40 +0200
changeset 136 f209fcb0df6c
parent 53 22377c9e2eae
permissions -rwxr-xr-x
Added tag V00.18 for changeset ab728cb3632c
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
53
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
     1
/* clickMenu - v0.1.6
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
     2
 * Copyright (c) 2007 Roman Weich
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
     3
 * http://p.sohei.org
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
     4
 *
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
     5
 * Changelog: 
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
     6
 * v 0.1.6 - 2007-09-06
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
     7
 *	-fix: having a link in the top-level menu would not open the menu but call the link instead
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
     8
 * v 0.1.5 - 2007-07-07
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
     9
 *	-change/fix: menu opening/closing now through simple show() and hide() calls - before fadeIn and fadeOut were used for which extra functions to stop a already running animation were created -> they were 
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
    10
 *			buggy (not working with the interface plugin in jquery1.1.2 and not working with jquery1.1.3 at all) and now removed
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
    11
 *	-change: removed option: fadeTime
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
    12
 *	-change: now using the bgiframe plugin for adding iframes in ie6 when available
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
    13
 * v 0.1.4 - 2007-03-20
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
    14
 *	-fix: the default options were overwritten by the context related options
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
    15
 *	-fix: hiding a submenu all hover- and click-events were unbound, even the ones not defined in this plugin - unbinding should work now
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
    16
 * v 0.1.3 - 2007-03-13
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
    17
 *	-fix: some display problems ie had when no width was set on the submenu, so on ie the width for each submenu will be explicitely set
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
    18
 *	-fix: the fix to the ie-width-problem is a fix to the "ie does not support css min-width stuff" problem too which displayed some submenus too narrow (it looked just not right)
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
    19
 *	-fix: some bugs, when user the was too fast with the mouse
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
    20
 * v 0.1.2 - 2007-03-11
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
    21
 *	-change: made a lot changes in the traversing routines to speed things up (having better memory usage now as well)
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
    22
 *	-change: added $.fn.clickMenu.setDefaults() for setting global defaults
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
    23
 *	-fix: hoverbug when a main menu item had no submenu
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
    24
 *	-fix: some bugs i found while rewriting most of the stuff
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
    25
 * v 0.1.1 - 2007-03-04
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
    26
 *	-change: the width of the submenus is no longer fixed, its set in the plugin now
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
    27
 *	-change: the submenu-arrow is now an img, not the background-img of the list element - that allows better positioning, and background-changes on hover (you have to set the image through the arrowSrc option)
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
    28
 *	-fix: clicking on a clickMenu while another was already open, didn't close the open one
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
    29
 *	-change: clicking on the open main menu item will close it
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
    30
 *	-fix: on an open menu moving the mouse to a main menu item and moving it fastly elsewere hid the whole menu
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
    31
 * v 0.1.0 - 2007-03-03
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
    32
 */
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
    33
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
    34
(function($)
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
    35
{
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
    36
	var defaults = {
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
    37
		onClick: function(){
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
    38
			$(this).find('>a').each(function(){
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
    39
				if ( this.href )
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
    40
				{
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
    41
					window.location = this.href;
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
    42
				}
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
    43
			});
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
    44
		},
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
    45
		arrowSrc: '',
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
    46
		subDelay: 300,
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
    47
		mainDelay: 10
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
    48
	};
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
    49
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
    50
	$.fn.clickMenu = function(options) 
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
    51
	{
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
    52
		var shown = false;
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
    53
		var liOffset = ( ($.browser.msie) ? 4 : 2 );
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
    54
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
    55
		var settings = $.extend({}, defaults, options);
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
    56
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
    57
		var hideDIV = function(div, delay)
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
    58
		{
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
    59
			//a timer running to show the div?
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
    60
			if ( div.timer && !div.isVisible )
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
    61
			{
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
    62
				clearTimeout(div.timer);
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
    63
			}
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
    64
			else if (div.timer)
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
    65
			{
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
    66
				return; //hide-timer already running
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
    67
			}
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
    68
			if ( div.isVisible )
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
    69
			{
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
    70
				div.timer = setTimeout(function()
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
    71
				{
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
    72
					//remove events
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
    73
					$(getAllChilds(getOneChild(div, 'UL'), 'LI')).unbind('mouseover', liHoverIn).unbind('mouseout', liHoverOut).unbind('click', settings.onClick);
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
    74
					//hide it
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
    75
					$(div).hide();
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
    76
					div.isVisible = false;
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
    77
					div.timer = null;
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
    78
				}, delay);
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
    79
			}
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
    80
		};
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
    81
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
    82
		var showDIV = function(div, delay)
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
    83
		{
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
    84
			if ( div.timer )
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
    85
			{
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
    86
				clearTimeout(div.timer);
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
    87
			}
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
    88
			if ( !div.isVisible )
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
    89
			{
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
    90
				div.timer = setTimeout(function()
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
    91
				{
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
    92
					//check if the mouse is still over the parent item - if not dont show the submenu
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
    93
					if ( !checkClass(div.parentNode, 'hover') )
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
    94
					{
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
    95
						return;
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
    96
					}
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
    97
					//assign events to all div>ul>li-elements
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
    98
					$(getAllChilds(getOneChild(div, 'UL'), 'LI')).mouseover(liHoverIn).mouseout(liHoverOut).click(settings.onClick);
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
    99
					//positioning
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   100
					if ( !checkClass(div.parentNode, 'main') )
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   101
					{
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   102
						$(div).css('left', div.parentNode.offsetWidth - liOffset);
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   103
					}
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   104
					//show it
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   105
					div.isVisible = true; //we use this over :visible to speed up traversing
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   106
					$(div).show();
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   107
					if ( $.browser.msie ) //fixing a display-bug in ie6 and adding min-width
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   108
					{
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   109
						var cW = $(getOneChild(div, 'UL')).width();
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   110
						if ( cW < 100 )
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   111
						{
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   112
							cW = 100;
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   113
						}
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   114
						$(div).css('width', cW);
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   115
					}
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   116
					div.timer = null;
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   117
				}, delay);
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   118
			}
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   119
		};
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   120
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   121
		//same as hover.handlehover in jquery - just can't use hover() directly - need the ability to unbind only the one hover event
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   122
		var testHandleHover = function(e)
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   123
		{
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   124
			// Check if mouse(over|out) are still within the same parent element
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   125
			var p = (e.type == "mouseover" ? e.fromElement : e.toElement) || e.relatedTarget;
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   126
			// Traverse up the tree
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   127
			while ( p && p != this )
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   128
			{
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   129
				try
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   130
				{ 
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   131
					p = p.parentNode;
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   132
				}
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   133
				catch(e)
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   134
				{ 
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   135
					p = this;
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   136
				}
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   137
			}
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   138
			// If we actually just moused on to a sub-element, ignore it
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   139
			if ( p == this )
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   140
			{
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   141
				return false;
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   142
			}
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   143
			return true;
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   144
		};
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   145
		
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   146
		var mainHoverIn = function(e)
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   147
		{
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   148
			//no need to test e.target==this, as no child has the same event binded
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   149
			//its possible, that a main menu item still has hover (if it has no submenu) - thus remove it
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   150
			var lis = getAllChilds(this.parentNode, 'LI');
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   151
			var pattern = new RegExp("(^|\\s)hover(\\s|$)");
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   152
			for (var i = 0; i < lis.length; i++)
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   153
			{
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   154
				if ( pattern.test(lis[i].className) )
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   155
				{
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   156
					$(lis[i]).removeClass('hover');
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   157
				}
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   158
			}
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   159
			$(this).addClass('hover');
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   160
			if ( shown )
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   161
			{
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   162
				hoverIn(this, settings.mainDelay);
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   163
			}
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   164
		};
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   165
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   166
		var liHoverIn = function(e)
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   167
		{
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   168
			if ( !testHandleHover(e) )
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   169
			{
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   170
				return false;
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   171
			}
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   172
			if ( e.target != this )
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   173
			{
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   174
				//look whether the target is a direct child of this (maybe an image)
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   175
				if ( !isChild(this, e.target) )
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   176
				{
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   177
					return;
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   178
				}
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   179
			}
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   180
			hoverIn(this, settings.subDelay);
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   181
		};
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   182
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   183
		var hoverIn = function(li, delay)
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   184
		{
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   185
			var innerDiv = getOneChild(li, 'DIV');
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   186
			//stop running timers from the other menus on the same level - a little faster than $('>*>div', li.parentNode)
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   187
			var n = li.parentNode.firstChild;
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   188
			for ( ; n; n = n.nextSibling ) 
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   189
			{
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   190
				if ( n.nodeType == 1 && n.nodeName.toUpperCase() == 'LI' )
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   191
				{
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   192
					var div = getOneChild(n, 'DIV');
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   193
					if ( div && div.timer && !div.isVisible ) //clear show-div timer
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   194
					{
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   195
						clearTimeout(div.timer);
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   196
						div.timer = null;
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   197
					}
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   198
				}
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   199
			}
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   200
			//is there a timer running to hide one of the parent divs? stop it
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   201
			var pNode = li.parentNode;
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   202
			for ( ; pNode; pNode = pNode.parentNode ) 
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   203
			{
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   204
				if ( pNode.nodeType == 1 && pNode.nodeName.toUpperCase() == 'DIV' )
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   205
				{
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   206
					if (pNode.timer)
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   207
					{
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   208
						clearTimeout(pNode.timer);
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   209
						pNode.timer = null;
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   210
						$(pNode.parentNode).addClass('hover');
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   211
					}
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   212
				}
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   213
			}
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   214
			//highlight the current element
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   215
			$(li).addClass('hover');
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   216
			//is the submenu already visible?
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   217
			if ( innerDiv && innerDiv.isVisible )
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   218
			{
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   219
				//hide-timer running?
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   220
				if ( innerDiv.timer )
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   221
				{
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   222
					clearTimeout(innerDiv.timer);
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   223
					innerDiv.timer = null;
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   224
				}
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   225
				else
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   226
				{
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   227
					return;
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   228
				}
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   229
			}
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   230
			//hide all open menus on the same level and below and unhighlight the li item (but not the current submenu!)
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   231
			$(li.parentNode.getElementsByTagName('DIV')).each(function(){
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   232
				if ( this != innerDiv && this.isVisible )
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   233
				{
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   234
					hideDIV(this, delay);
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   235
					$(this.parentNode).removeClass('hover');
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   236
				}
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   237
			});
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   238
			//show the submenu, if there is one
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   239
			if ( innerDiv )
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   240
			{
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   241
				showDIV(innerDiv, delay);
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   242
			}
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   243
		};
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   244
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   245
		var liHoverOut = function(e)
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   246
		{
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   247
			if ( !testHandleHover(e) )
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   248
			{
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   249
				return false;
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   250
			}
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   251
			if ( e.target != this )
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   252
			{
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   253
				if ( !isChild(this, e.target) ) //return only if the target is no direct child of this
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   254
				{
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   255
					return;
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   256
				}
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   257
			}
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   258
			//remove the hover from the submenu item, if the mouse is hovering out of the menu (this is only for the last open (levelwise) (sub-)menu)
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   259
			var div = getOneChild(this, 'DIV');
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   260
			if ( !div )
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   261
			{
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   262
				$(this).removeClass('hover');
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   263
			}
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   264
			else 
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   265
			{
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   266
				if ( !div.isVisible )
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   267
				{
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   268
					$(this).removeClass('hover');
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   269
				}
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   270
			}
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   271
		};
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   272
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   273
		var mainHoverOut = function(e)
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   274
		{
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   275
			//no need to test e.target==this, as no child has the same event binded
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   276
			//remove hover
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   277
			var div = getOneChild(this, 'DIV');
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   278
			var relTarget = e.relatedTarget || e.toElement; //this is undefined sometimes (e.g. when the mouse moves out of the window), so dont remove hover then
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   279
			var p;
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   280
			if ( !shown )
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   281
			{
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   282
				$(this).removeClass('hover');
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   283
			}
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   284
			else if ( !div && relTarget ) //menuitem has no submenu, so dont remove the hover if the mouse goes outside the menu
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   285
			{
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   286
				p = findParentWithClass(e.target, 'UL', 'clickMenu');
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   287
				if ( p.contains(relTarget))
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   288
				{
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   289
					$(this).removeClass('hover');
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   290
				}
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   291
			}
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   292
			else if ( relTarget )
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   293
			{
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   294
				//remove hover only when moving to anywhere inside the clickmenu
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   295
				p = findParentWithClass(e.target, 'UL', 'clickMenu');
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   296
				if ( !div.isVisible && (p.contains(relTarget)) )
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   297
				{
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   298
					$(this).removeClass('hover');
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   299
				}
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   300
			}
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   301
		};
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   302
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   303
		var mainClick = function()
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   304
		{
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   305
			var div = getOneChild(this, 'DIV');
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   306
			if ( div && div.isVisible ) //clicked on an open main-menu-item
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   307
			{
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   308
				clean();
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   309
				$(this).addClass('hover');
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   310
			}
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   311
			else
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   312
			{
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   313
				hoverIn(this, settings.mainDelay);
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   314
				shown = true;
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   315
				$(document).bind('mousedown', checkMouse);
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   316
			}
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   317
			return false;
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   318
		};
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   319
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   320
		var checkMouse = function(e)
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   321
		{
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   322
			//is the mouse inside a clickmenu? if yes, is it an open (the current) one?
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   323
			var vis = false;
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   324
			var cm = findParentWithClass(e.target, 'UL', 'clickMenu');
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   325
			if ( cm )
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   326
			{
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   327
				$(cm.getElementsByTagName('DIV')).each(function(){
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   328
					if ( this.isVisible )
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   329
					{
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   330
						vis = true;
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   331
					}
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   332
				});
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   333
			}
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   334
			if ( !vis )
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   335
			{
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   336
				clean();
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   337
			}
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   338
		};
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   339
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   340
		var clean = function()
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   341
		{
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   342
			//remove timeout and hide the divs
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   343
			$('ul.clickMenu div.outerbox').each(function(){
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   344
				if ( this.timer )
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   345
				{
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   346
					clearTimeout(this.timer);
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   347
					this.timer = null;
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   348
				}
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   349
				if ( this.isVisible )
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   350
				{
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   351
					$(this).hide();
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   352
					this.isVisible = false;
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   353
				}
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   354
			});
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   355
			$('ul.clickMenu li').removeClass('hover');
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   356
			//remove events
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   357
			$('ul.clickMenu>li li').unbind('mouseover', liHoverIn).unbind('mouseout', liHoverOut).unbind('click', settings.onClick);
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   358
			$(document).unbind('mousedown', checkMouse);
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   359
			shown = false;
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   360
		};
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   361
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   362
		var getOneChild = function(elem, name)
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   363
		{
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   364
			if ( !elem )
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   365
			{
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   366
				return null;
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   367
			}
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   368
			var n = elem.firstChild;
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   369
			for ( ; n; n = n.nextSibling ) 
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   370
			{
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   371
				if ( n.nodeType == 1 && n.nodeName.toUpperCase() == name )
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   372
				{
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   373
					return n;
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   374
				}
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   375
			}
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   376
			return null;
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   377
		};
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   378
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   379
		var getAllChilds = function(elem, name)
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   380
		{
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   381
			if ( !elem )
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   382
			{
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   383
				return [];
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   384
			}
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   385
			var r = [];
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   386
			var n = elem.firstChild;
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   387
			for ( ; n; n = n.nextSibling ) 
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   388
			{
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   389
				if ( n.nodeType == 1 && n.nodeName.toUpperCase() == name )
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   390
				{
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   391
					r[r.length] = n;
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   392
				}
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   393
			}
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   394
			return r;
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   395
		};
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   396
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   397
		var findParentWithClass = function(elem, searchTag, searchClass)
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   398
		{
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   399
			var pNode = elem.parentNode;
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   400
			var pattern = new RegExp("(^|\\s)" + searchClass + "(\\s|$)");
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   401
			for ( ; pNode; pNode = pNode.parentNode )
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   402
			{
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   403
				if ( pNode.nodeType == 1 && pNode.nodeName.toUpperCase() == searchTag && pattern.test(pNode.className) )
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   404
				{
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   405
					return pNode;
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   406
				}
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   407
			}
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   408
			return null;
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   409
		};
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   410
		
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   411
		var checkClass = function(elem, searchClass)
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   412
		{
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   413
			var pattern = new RegExp("(^|\\s)" + searchClass + "(\\s|$)");
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   414
			if ( pattern.test(elem.className) )
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   415
			{
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   416
				return true;
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   417
			}
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   418
			return false;
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   419
		};
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   420
		
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   421
		var isChild = function(elem, childElem)
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   422
		{
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   423
			var n = elem.firstChild;
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   424
			for ( ; n; n = n.nextSibling ) 
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   425
			{
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   426
				if ( n == childElem )
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   427
				{
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   428
					return true;
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   429
				}
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   430
			}
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   431
			return false;
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   432
		};
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   433
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   434
	    return this.each(function()
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   435
		{
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   436
			//add .contains() to mozilla - http://www.quirksmode.org/blog/archives/2006/01/contains_for_mo.html
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   437
			if (window.Node && Node.prototype && !Node.prototype.contains)
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   438
			{
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   439
				Node.prototype.contains = function(arg) 
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   440
				{
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   441
					return !!(this.compareDocumentPosition(arg) & 16);
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   442
				};
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   443
			}
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   444
			//add class
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   445
			if ( !checkClass(this, 'clickMenu') )
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   446
			{
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   447
				$(this).addClass('clickMenu');
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   448
			}
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   449
			//add shadows
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   450
			$('ul', this).shadowBox();
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   451
			//ie6? - add iframes
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   452
			if ( $.browser.msie && (!$.browser.version || parseInt($.browser.version) <= 6) )
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   453
			{
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   454
				if ( $.fn.bgiframe )
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   455
				{
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   456
					$('div.outerbox', this).bgiframe();
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   457
				}
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   458
				else
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   459
				{
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   460
					/* thanks to Mark Gibson - http://www.nabble.com/forum/ViewPost.jtp?post=6504414&framed=y */
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   461
					$('div.outerbox', this).append('<iframe style="display:block;position:absolute;top:0;left:0;z-index:-1;filter:mask();' + 
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   462
									'width:expression(this.parentNode.offsetWidth);height:expression(this.parentNode.offsetHeight)"/>');
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   463
				}
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   464
			}
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   465
			//assign events
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   466
			$(this).bind('closemenu', function(){clean();}); //assign closemenu-event, through wich the menu can be closed from outside the plugin
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   467
			//add click event handling, if there are any elements inside the main menu
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   468
			var liElems = getAllChilds(this, 'LI');
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   469
			for ( var j = 0; j < liElems.length; j++ )
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   470
			{
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   471
				if ( getOneChild(getOneChild(getOneChild(liElems[j], 'DIV'), 'UL'), 'LI') ) // >div>ul>li
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   472
				{
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   473
					$(liElems[j]).click(mainClick);
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   474
				}
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   475
			}
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   476
			//add hover event handling and assign classes
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   477
			$(liElems).hover(mainHoverIn, mainHoverOut).addClass('main').find('>div').addClass('inner');
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   478
			//add the little arrow before each submenu
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   479
			if ( settings.arrowSrc )
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   480
			{
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   481
				$('div.inner div.outerbox', this).before('<img src="' + settings.arrowSrc + '" class="liArrow" />');
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   482
			}
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   483
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   484
			//the floating list elements are destroying the layout..so make it nice again..
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   485
			$(this).wrap('<div class="cmDiv"></div>').after('<div style="clear: both; visibility: hidden;"></div>');
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   486
	    });
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   487
	};
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   488
	$.fn.clickMenu.setDefaults = function(o)
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   489
	{
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   490
		$.extend(defaults, o);
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   491
	};
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   492
})(jQuery);
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   493
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   494
(function($)
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   495
{
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   496
	$.fn.shadowBox = function() {
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   497
	    return this.each(function()
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   498
		{
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   499
			var outer = $('<div class="outerbox"></div>').get(0);
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   500
			if ( $(this).css('position') == 'absolute' )
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   501
			{
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   502
				//if the child(this) is positioned abolute, we have to use relative positioning and shrink the outerbox accordingly to the innerbox
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   503
				$(outer).css({position:'relative', width:this.offsetWidth, height:this.offsetHeight});
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   504
			}
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   505
			else
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   506
			{
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   507
				//shrink the outerbox
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   508
				$(outer).css('position', 'absolute');
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   509
			}
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   510
			//add the boxes
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   511
			$(this).addClass('innerBox').wrap(outer).
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   512
					before('<div class="shadowbox1"></div><div class="shadowbox2"></div><div class="shadowbox3"></div>');
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   513
	    });
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   514
	};
22377c9e2eae First step of column management in document tag list. Little debug on js for move up down.
cavaliet
parents:
diff changeset
   515
})(jQuery);