/**********************************************************
 * To add dropup class for dropdowns to open upside
 **********************************************************
* Source Copyright 2014 Author                            *
* Unauthorized reproduction is not allowed                *
* Author: JPK Software Solutions Pvt. Ltd.                *
* Email: sales@visionhelpdesk.com                         *
* Owner: www.visionhelpdesk.com                           *
**********************************************************/

var windowHeight = $(window).height(); 
$(".vis_mass_action_footer .btn-group").each(function() {
  var dropDownMenuHeight, 
	  rect = this.getBoundingClientRect(); 
  // only toggle menu's that are visible on the current page
  if (rect.top > windowHeight) {
	return;
  }
  // if you know height of menu - set on parent, eg. `data-menu="100"`
  dropDownMenuHeight = $(this).data('menu');
  if (dropDownMenuHeight == null) {
	dropDownMenuHeight = $(this).children('.dropdown-menu').height(); 
  }
  $(this).toggleClass("dropup", ((windowHeight - rect.bottom) < (280)) && (rect.top > dropDownMenuHeight));
});