/**
 * Borwser navigator userAgent
 */
var userAgent = navigator.userAgent;
/**
 * Microsoft Internet Exprorer index
 */
var MSIEIndex = userAgent.indexOf('MSIE');
/**
 * Microsoft Internet Exprorer Version6
 */
var isIE6 = (userAgent.substring(MSIEIndex+5,MSIEIndex+8)== '6.0') ? true : false;
/**
 * Microsoft Internet Exprorer Version7
 */
var isIE7 = (userAgent.substring(MSIEIndex+5,MSIEIndex+8)== '7.0') ? true : false;
/**
 * Ensures the button width is less than or equal to the specified width
 * @param {String} identifierSuffix : The suffix for the identifier of the button
 * @param {Integer} maxWidth : The maximum width of the button in pixels
 */
checkButtonWidth = function(identifierPrefix,identifierSuffix,maxWidth)
{
  var buttonElement = document.getElementById(identifierPrefix+"ContainerLeft"+identifierSuffix);
  if(buttonElement.offsetWidth >= maxWidth)
  {
    buttonElement.style.width = maxWidth; // To have the horizontal scaling as per given maxWidth parameter
    var containerOffsetHeight = buttonElement.offsetHeight;
    var trHeight = document.getElementById(identifierPrefix+"Tr"+identifierSuffix).style;
    if(MSIEIndex > -1 && isIE6){
      trHeight.height=containerOffsetHeight-6; // To have the vertical scaling in arrow section
    }else if(MSIEIndex > -1 && isIE7){
      trHeight.height=containerOffsetHeight-7; // To have the vertical scaling in arrow section
    }else{
      trHeight.height=containerOffsetHeight-4; // To have the vertical scaling in arrow section
    }
  }
};
