/**
 * Equal Heights Plugin
 * Equalize the heights of elements. Great for columns or any elements
 * that need to be the same size (floats, etc).
 * 
 * Version 1.0
 * Updated 12/10/2008
 *
 * Copyright (c) 2008 Rob Glazebrook (cssnewbie.com) 
 *
 * Usage: $(object).equalHeights([minHeight], [maxHeight]);
 * 
 * Example 1: $(".cols").equalHeights(); Sets all columns to the same height.
 * Example 2: $(".cols").equalHeights(400); Sets all cols to at least 400px tall.
 * Example 3: $(".cols").equalHeights(100,300); Cols are at least 100 but no more
 * than 300 pixels tall. Elements with too much content will gain a scrollbar.
 * 
 */

(function($) {
	$.fn.equalHeights = function(minHeight, maxHeight) {
		tallest = (minHeight) ? minHeight : 0;
		this.each(function() {
			if($(this).height() > tallest) {
				tallest = $(this).height();
			}
		});
		if((maxHeight) && tallest > maxHeight) tallest = maxHeight;
		return this.each(function() {
			$(this).height(tallest);
		});
	}
})(jQuery);;
/**
 * 'Label in Field' Plugin
 * Place the label of a field inside the field and hide the label
 * A class 'labeltext' is placed on the field when the label is shown inside this field
 * 
 * Version 1.0
 * Updated 10/11/2011
 *
 * Copyright (c) 2011 Tim Van den Broeck - and Karma point for Tom VDE
 *
 * Usage: $(object).labelInField();
 * Use a unique ID for each object - NOT like this: $('.field').labelInField();
 * Example: $('#edit-search-block-form--2').labelInField();
 * 
 */

(function($) {
	$.fn.labelInField = function() {
    var textField = $(this);
    var labelText = textField.prev('label').text();
    if (labelText) {
      // set text and remove label
      textField.val(labelText).addClass('labeltext');
      textField.prev('label').css('display', 'none');
      
      // remove text on focus
      textField.focus(function() {
        if (textField.val() == labelText) {
          textField.val('').removeClass('labeltext');
        }
      });
      // add label on blur
      textField.blur(function() {
        if (textField.val() == '') {
          textField.val(labelText).addClass('labeltext');
        }
      });
      // remove labelText on form submit
      textField.parents('form:first').submit(function() {
        console.log('hupsa');
        if (textField.val() == labelText) {
          textField.val('');
        }
      });
    }
  }
})(jQuery);;
(function($) {

$(document).ready(function() {
  var themepath = Drupal.settings.basePath + Drupal.settings.jsvars['theme'];
  
  // Login form
  /*$('#block-user-login #edit-name').labelInField();
  $('#block-user-login #edit-pass').labelInField();*/
  $('#block-search-form .form-text').labelInField();

  // 
  $('#sidebar-first-bottom .block:last').addClass('block-last');
  
  // mailchimp
  $('#edit-lists-d7a3350a16').attr('checked','checked');
  $('.form-item-fields-MMERGE5').hide();
  $('#edit-lists-0606f56d27').change(function() {
    if ($('#edit-lists-0606f56d27').attr('checked')) {
      $('.form-item-fields-MMERGE5').show();
    } else {
      $('.form-item-fields-MMERGE5').hide();
    }
  });
  
  // equal heights
  $('.introblock').equalHeights();
  $('.introblock .content').equalHeights();
});

})(jQuery);;

