/*
  Columnize Plugin for jQuery
  Version: v0.10

  Copyright (C) 2008-2010 by Lutz Issler

  Systemantics GmbH
  Am Lavenstein 3
  52064 Aachen
  GERMANY

  Web:    www.systemantics.net
  Email:  hello@systemantics.net

  This plugin is distributed under the terms of the
  GNU Lesser General Public license. The license can be obtained
  from http://www.gnu.org/licenses/lgpl.html.

*/

(function() {
	var cloneEls = new Object();
	var numColsById = new Object();
	var uniqueId = 0;

	function _layoutElement(elDOM, settings, balance) {
		// Some semi-global variables
		var colHeight;
		var colWidth;
		var col;
		var currentColEl;
		var cols = new Array();
		var colNum = 0;
		var colSet = 0;

		var el = jQuery(elDOM);

		// Save numCols property for this element
		// (needed for pagination)
		numColsById[elDOM.id] = settings.columns;

		// Remove child nodes
		el.empty();

		// Macro function (with side effects)
		function _newColumn() {
			colNum++;

			// Add a new column
			col = document.createElement("DIV");
			col.className = settings.column;
			el.append(col);
			currentColEl = col;
			colWidth = jQuery(col).width();
			cols.push(col);

			// Add the same subnode nesting to the new column
			// as there was in the old column
			for (var j=0; j<subnodes.length; j++) {
				newEl = subnodes[j].cloneNode(false);
				if (j==0 || innerContinued) {
					jQuery(newEl).addClass(settings.continued);
				}
				currentColEl.appendChild(newEl);
				currentColEl = newEl;
			}
		}

		// Returns the margin-bottom CSS property of a certain node
		function _getMarginBottom(currentColEl) {
			var marginBottom = parseInt(jQuery(currentColEl).css("marginBottom"));
			if (marginBottom.toString()=='NaN'){
				marginBottom = 0;
			}
			var currentColElParents = jQuery(currentColEl).parents();
			for (var j=0; j<currentColElParents.length; j++) {
				if (currentColElParents[j]==elDOM) {
					break;
				}
				var curMarginBottom = parseInt(jQuery(currentColElParents[j]).css("marginBottom"));
				if (curMarginBottom.toString()!='NaN'){
					marginBottom = Math.max(marginBottom, curMarginBottom);
				}
			}
			return marginBottom;
		}

		// Advance to next sibling on el or a parent level
		function _skipToNextNode() {
			while (currentEl && currentColEl && !currentEl.nextSibling) {
				currentEl = currentEl.parentNode;
				currentColEl = currentColEl.parentNode;
				var node = subnodes.pop();
				// Hack: delete the previously saved HREF
				if (node=="A") {
					href = null;
				}
			}
			if (currentEl) {
				currentEl = currentEl.nextSibling;
			}
		}

		// Take the height from the element to be layouted
		var maxHeight = settings.height
			? settings.height
			: parseInt(el.css("maxHeight"));
		if (balance || isNaN(maxHeight) || maxHeight==0) {
			// We are asked to balance the col lengths
			// or cannot get the column length from the container,
			// so chose a height that will produce >numCols< columns
			col = document.createElement("DIV");
			col.className = settings.column;
			jQuery(col).append(jQuery(cloneEls[elDOM.id]).html());
			el.append(col);
			var lineHeight = parseInt(el.css("lineHeight"));
			if (!lineHeight) {
				// Assume a line height of 120%
				lineHeight = Math.ceil(parseInt(el.css("fontSize"))*1.2);
			}
			colHeight = Math.ceil(jQuery(col).height()/settings.columns);
			if (colHeight%lineHeight>0) {
				colHeight += lineHeight;
			}
			elDOM.removeChild(col);
			if (maxHeight>0 && colHeight>maxHeight) {
				// Balance only to max-height
				colHeight = maxHeight;
			}
		} else {
			colHeight = maxHeight;
		}

		// Take the minimum height into account
		var minHeight = settings.minHeight
			? settings.minHeight
			: parseInt(el.css("minHeight"));
		if (minHeight) {
			colHeight = Math.max(colHeight, minHeight);
		}

		// Start with first child of the initial node
		var currentEl = cloneEls[elDOM.id].children(":first")[0];
		var subnodes = new Array();
		var href = null;
		var lastNodeType = 0;
		_newColumn();
		if (colHeight==0 || colWidth==0) {
			// We cannot continue with zero height or width
			return false;
		}
		while (currentEl) {
			if (currentEl.nodeType==1) {
				// An element node
				var newEl;
				var $currentEl = jQuery(currentEl);
				if ($currentEl.hasClass("dontSplit")
					|| $currentEl.is(settings.dontsplit)) {
					// Don't split this node. Instead, clone it completely
					var newEl = currentEl.cloneNode(true);
					currentColEl.appendChild(newEl);
					if (col.offsetHeight>colHeight) {
						// The column gets too long, start a new colum
						_newColumn();
					}
					_skipToNextNode();
				} else {
					// Clone the node and append it to the current column
					var newEl = currentEl.cloneNode(false);
					currentColEl.appendChild(newEl);
					if (col.offsetHeight-_getMarginBottom(currentColEl)>colHeight) {
						// The column gets too long, start a new colum
						currentColEl.removeChild(newEl);
						var toBeInsertedEl = newEl;
						_newColumn();
						currentColEl.appendChild(toBeInsertedEl);
						newEl = toBeInsertedEl;
					}
					if (currentEl.firstChild) {
						subnodes.push(currentEl.cloneNode(false));
						currentColEl = newEl;
						currentEl = currentEl.firstChild;
					} else {
						_skipToNextNode();
					}
				}
				lastNodeType = 1;
			} else if (currentEl.nodeType==3) {
				// A text node
				var newEl = document.createTextNode("");
				currentColEl.appendChild(newEl);
				// Determine the current bottom margin
				var marginBottom = _getMarginBottom(currentColEl);
				// Append word by word
				var words = currentEl.data.split(" ");
				for (var i=0; i<words.length; i++) {
					if (lastNodeType==3) {
						newEl.appendData(" ");
					}
					newEl.appendData(words[i]);
					currentColEl.removeChild(newEl);
					currentColEl.appendChild(newEl);
					if (col.offsetHeight-marginBottom>colHeight) {
						// el column is full
						// Remove the last word
						newEl.data = newEl.data.substr(0, newEl.data.length-words[i].length-1);

						// Remove the last node if empty
						var innerContinued;
						if (jQuery(currentColEl).text()=="") {
							jQuery(currentColEl).remove();
							innerContinued = false;
						} else {
							innerContinued = true;
						}

						// Start a new column
						_newColumn();

						// Add a text node at the bottom level
						// in order to continue the column
						newEl = document.createTextNode(words[i]);
						currentColEl.appendChild(newEl);
					}
					lastNodeType = 3;
				}
				_skipToNextNode();
				lastNodeType = 0;
			} else {
				// Any other node (comments, for instance)
				_skipToNextNode();
				lastNodeType = currentEl.nodeType;
			}
		}
		return cols;
	};

	jQuery.fn.columnize = function(settings) {
		settings = jQuery.extend({
			column: "column",
			continued: "continued",
			columns: 2,
			balance: true,
			height: false,
			minHeight: false,
			cache: true,
			dontsplit: ""
		}, settings);
		this.each(function () {
			var jthis = jQuery(this);

			var id = this.id;
			if (!id) {
				// Get a new id
				id = "jcols_"+uniqueId;
				this.id = id;
				uniqueId++;
			}

			if (!cloneEls[this.id] || !settings.cache) {
				cloneEls[this.id] = jthis.clone(true);
			}

			// Layout the columns
			var cols = _layoutElement(this, settings, settings.balance);
			if (!cols) {
				// Layout failed, restore the object's contents
				jthis.append(cloneEls[this.id].children().clone(true));
			}
		});
		return this;
	}
})();
;
/**
 * Set all passed elements to the same height as the highest element.
 * 
 * Copyright (c) 2010 Ewen Elder
 * Dual licensed under the MIT and GPL licenses:
 * http://www.opensource.org/licenses/mit-license.php
 * http://www.gnu.org/licenses/gpl.html
 *
 * @author: Ewen Elder <glomainn at yahoo dot co dot uk> <ewen at jainaewen dot com>
 * @version: 1.0
 * 
 * @todo: Recaluclate height if extra content is loaded into one of the elements after it has been resized
 *        possibly detect if the highest column has a fixed CSS height to being with or is set to 'auto'; if set to auto
 *        then leave as auto so that it well expend or contract naturally as it would normally.
**/ 

(function ($)
{
	$.fn.equalHeightColumns = function (options)
	{
		var height, elements;
		
		options = $.extend({}, $.equalHeightColumns.defaults, options);
		height = options.height;
		elements = $(this);
		
		$(this).each
		(
			function ()
			{
				// Apply equal height to the children of this element??
				if (options.children)
				{
					elements = $(this).children(options.children);
				}
				
				// If options.height is 0, then find which element is the highest.
				if (!options.height)
				{
					// If applying to this elements children, then loop each child element and find which is the highest.
					if (options.children)
					{
						elements.each
						(
							function ()
							{
								// If this element's height is more than is store in 'height' then update 'height'.
								if ($(this).height() > height)
								{
									height = $(this).height();
								}
							}
						);
					}
					
					else
					{
						// If this element's height is more than is store in 'height' then update 'height'.
						if ($(this).height() > height)
						{
							height = $(this).height();
						}
					}
				}
			}
		);
		
		
		// Enforce min height.
		if (options.minHeight && height < options.minHeight)
		{
			height = options.minHeight;
		}
		
		
		// Enforce max height.
		if (options.maxHeight && height > options.maxHeight)
		{
			height = options.maxHeight;
		}
		
		
		// Animate the column's height change.
		elements.animate
		(
			{
				height : height
			},
			options.speed
		);
		
		return $(this);
	};
	
	
	$.equalHeightColumns = {
		version : 1.0,
		defaults : {
			children : false,
			height : 0,
			minHeight : 0,
			maxHeight : 0,
			speed : 0
		}
	};
})(jQuery);;
(function($) {
    Drupal.behaviors.pom_wvl = {
        attach: function(context, settings) {
            /**
	     * Subscriptions slider
	     */
            //hide attachment by default & possition absolute
            $(".view-even-submissions .attachment-before").css("display", "none");
            $(".view-even-submissions .attachment-before").css("position", "absolute"); //mouseout/over event
            $('#block-views-even-submissions-block').mouseout(function() {
                $(".view-even-submissions .attachment-before").css("display", "none");
            }).mouseover(function() {
                var width = 0 - $(".view-even-submissions .attachment-before").outerWidth(true); //console.log(width);
                $(".view-even-submissions .attachment-before").css("left", width);
                $(".view-even-submissions .attachment-before").css("display", "block");
            });
        }
    };
}(jQuery))
;
(function ($) {
  Drupal.behaviors.exampleModule = {
    attach: function (context, settings) {
	

	//equal height for columns
	function equalHeight(group) {
	var tallest = 0;
	group.each(function() {
		var thisHeight = $(this).height();
		if(thisHeight > tallest) {
			tallest = thisHeight;
		}
	});
	group.height(tallest);
	}
	equalHeight($('.front .region-content .block-views'));
		
	//decrease body width on news page if picture exists
	jQuery('.view-news-press .views-field-field-news-pic img').parents('.views-field').next('.body-wrapper').addClass('has-image');
	
	//add 'active' class to menu list that contains active link
	$('.region-sidebar-first .content ul.menu li a.active').parent().addClass('active');

	//add wrapper for first-level active link in left menubar
	$('body .region-sidebar-first .content ul.menu li.expanded.active > a, body .region-sidebar-first .content ul.menu li.expanded.active-trail > a').wrap('<span class="first-level-active"></span>');
	
	//add 'checked' class for parent of selected checkbox
	jQuery('.form-checkboxes .form-item input:checked').parent().addClass('checked');
	jQuery('.form-checkboxes .form-item input').change(function(){
	  if(jQuery(this).parent().hasClass('checked')){
	    jQuery(this).parent().removeClass('checked');
	  }
	  else{
	    jQuery(this).parent().addClass('checked');
	  }
	});
	
	//add classes with indexes to qtip blocks for better theming 
	/*
	jQuery('#top-menu .content ul.menu li a').mouseenter(function(){
	  jQuery('.qtip .qtip-contentWrapper ul.menu li a.active').parent().addClass('active');
	  var pom_item_index = jQuery(this).parent().index();
	  jQuery('.qtip').each(function(){
		var pom_qtip_attr = jQuery(this).attr('qtip');
		  jQuery(this).addClass('index' + pom_qtip_attr);
	  });
	  jQuery('.qtip').hover(
		function () {
		  jQuery('#top-menu .content ul.menu li a').each(function(){
		    if(jQuery(this).parent().index() == jQuery('.qtip-active').attr('qtip')){
			  jQuery(this).addClass('hover');
			}
		  });
		},
        function () {
        jQuery('#top-menu .content ul.menu li a').removeClass('hover');
      });
	});
	jQuery('#top-menu .content ul.menu li a').each(function(){
	var index = jQuery(this).parent().index();
	var panel_index = jQuery('.panels-wrapper .menu-minipanels a.active').parents('.menu-minipanels').index();
	if(index == panel_index){
	jQuery(this).addClass('active-trail');
	}
	});
	*/
	//add hover state for top menu when subsection is opened
	$('#top-menu ul.om-menu > li > a').mouseenter(function(){
	$('#top-menu .block-menu_block ul.menu li.separator').each(function(){
	var height = $(this).next().height();
	$(this).height(height);
	});
	});
	jQuery('.om-maximenu-content').hover(
		function () {
		  jQuery(this).prev().addClass('hover');
		},
        function () {
        jQuery(this).prev().removeClass('hover');
    });
	$('#top-menu .block-menu_block ul.menu li a.active').parents('.om-maximenu-content').prev().addClass('active');
	
	//related persons multiple view - row height
	jQuery('.view-related-persons .views-row-even').each(function(){
    jQuery(this).after('<div class="clear"></div>');
	});

	//events exposed filters - replace 'month' and 'year' selectboxes
	jQuery('#block-views-exp-events-page .form-item-datum-value-month').each(function(){
	  var year = jQuery(this).prev();
	  jQuery(this).after(year);
	  jQuery(this).prev().remove();
	});
	
	//hide session field if no content
	jQuery('.node-event .field-name-field-session .field-items').each(function(){
	  if(jQuery(this).html() == ''){
		jQuery(this).parent().parent().hide();
	  }
	});
	
	//hide sessions view if no content
	jQuery('.view-sessions .views-field-field-session .field-content').each(function(){
	if(jQuery(this).text()==''){
      jQuery(this).parents('.view-sessions').hide();
	}
	});
	
	//form text behavior
	jQuery('#content .form-text').each(function(){
	//jQuery(this).prev('label').find('.form-required ').html('');
	if(jQuery(this).attr('value')== ''){
	jQuery(this).attr('value', jQuery(this).prev('label').text());
	}
	else{
	jQuery(this).css('color', '#000000');
	}
	jQuery(this).prev('label').hide();
	});
	jQuery('#content .form-text').focus(function(){
	  if(jQuery(this).attr('value')== jQuery(this).prev('label').text()){
		 jQuery(this).attr('value', '');
		 jQuery(this).css('color', '#000000');
	  }
	});
	jQuery('#content .form-text').blur(function(){
	  if(jQuery(this).attr('value')== ''){
		jQuery(this).attr('value', jQuery(this).prev('label').text());
		jQuery(this).css('color', '#adadad');
	  }
	});
	
	jQuery('#content .form-submit').hover(
	  function(){
	    jQuery(this).parents('form').find('.form-text').each(function(){
		  if(jQuery(this).attr('value')== jQuery(this).prev('label').text()){
		  jQuery(this).attr('value', '');
	      }  
		});
	  }, 
	  function(){
	    jQuery(this).parents('form').find('.form-text').each(function(){
		  if(jQuery(this).attr('value') == ''){
		  jQuery(this).attr('value', jQuery(this).prev('label').text());
	      }
	    });
	  }
	);
	
	//theme webform checkboxes
	jQuery('.webform-component .form-checkboxes .form-item input').hide().after('<span class="checkbox"></span>');
	jQuery('.webform-component .form-checkboxes .form-item span.checkbox').click(function(){
	  if(jQuery(this).hasClass('checked')){
        jQuery(this).removeClass('checked');
        jQuery(this).prev('input').attr('checked', false);
	  }
	  else{
	    jQuery(this).addClass('checked');
	    jQuery(this).prev('input').attr('checked', true);
	  }
	});
	
  jQuery('.webform-component .form-checkboxes .form-item input.form-checkbox').change(function(){
	  if(jQuery(this).next('span.checkbox').hasClass('checked')){
        jQuery(this).next('span.checkbox').removeClass('checked');
	  }
	  else{
	    jQuery(this).next('span.checkbox').addClass('checked');
	  }
	});

	
	
	}
  };
}(jQuery))



;

