function MM_findObj(sCtrl)
{
  // Added an as alias for old calls
  return $(sCtrl);
}

function SetVisibility(oObj,sValue)
{
	if (oObj)
	  oObj.style.display = sValue;
}

function ShowElement(sEleName)
{
  //oObj = MM_findObj(sEleName);
  SetVisibility($(sEleName),'');
}

function HideElement(sEleName)
{
  oObj = MM_findObj(sEleName);
  SetVisibility(oObj,'none');
}

function HideElementSlow(sCtrl,sCtrl2)
{
  oObj = $(sCtrl); // Object to scroll
  oObj2 = $(sCtrl2); // Object to hide instantly.
  nOrgHeight = oObj2.clientHeight;
  oObj.style.height = nOrgHeight + 'px';
  oObj.style.overflow = 'hidden';
  nDelta = Math.round(nOrgHeight / 10);
  OnHideElementSlowTick(sCtrl,nDelta,nOrgHeight);
  SetVisibility(oObj2,'none');
}

function OnHideElementSlowTick(sCtrl,nDelta,nOrgHeight)
{
  oObj = $(sCtrl);
  nCurHeight = oObj.style.height;
  
  if (typeof(nCurHeight) == 'string')
  {
    if (nCurHeight.indexOf('px',0) != -1)
    {
      // Strip 'px' out of string for our use.
      re = /px/i;
      nCurHeight = nCurHeight.replace(re, ""); 
    }

    if (nCurHeight.indexOf('pt',0) != -1)
    {
      // Strip 'px' out of string for our use.
      re = /pt/i;
      nCurHeight = nCurHeight.replace(re, ""); 
    }
  }

  if (nCurHeight == 0)
  {
    HideElement(sCtrl);
    oObj.style.height = ''; // reset height;
    oObj.style.overflow = '';
    return;
  }
  
  nNewHeight = nCurHeight - nDelta;
  if (nNewHeight < 0)
   nNewHeight = 0;
  oObj.style.height = nNewHeight + 'px';
  
	// Create timer to fire again.
	hTmr = window.setTimeout('OnHideElementSlowTick(\'' + sCtrl + '\',' + nDelta + ',\'' + nOrgHeight + '\')',10);
}

function validate_email(email) {
   var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
   var address = email;
   if(reg.test(address) == false) {
      return false;
   }
   return true;
}

function in_array(needle, haystack, argStrict) {
    var key = '', strict = !!argStrict;

    if (strict) {
        for (key in haystack) {
            if (haystack[key] === needle) {
                return true;
            }
        }
    } else {
        for (key in haystack) {
            if (haystack[key] == needle) {
                return true;
            }
        }
    }
    return false;
}


