// ****************************************************************************
// *** lmLib version 1.0                                                    ***
// *** -------------------------------------------------------------------- ***
// ***                                                                      ***
// *** Javascript library used for the lmWEB application.                   ***
// ***                                                                      ***
// ****************************************************************************

function setTall(col1, col2, col3) {
  // by Paul@YellowPencil.com and Scott@YellowPencil.com
  // modified by Thomas K. Nielsen, LOGICMEDIA aps

	if (document.getElementById) {
		// the divs array contains references to each column's div element
		var divs = new Array(document.getElementById(col1), document.getElementById(col2));
    if (typeof col3 != "undefined") { divs[2] = document.getElementById(col3); }
		
		// determine the maximum height out of all columns specified
		var maxHeight = 0;
		for (var i = 0; i < divs.length; i++) {
			if (divs[i] && divs[i].offsetHeight > maxHeight) maxHeight = divs[i].offsetHeight;
		}
		
		// set all columns to maximum height
		for (var i = 0; i < divs.length; i++) {
			if (divs[i]) divs[i].style.height = maxHeight + 'px';

			// if the browser's working in standards-compliant mode, the height property
			// sets the height excluding padding, so we figure the padding out by subtracting the
			// old maxHeight from the new offsetHeight, and compensate!
			if (divs[i] && divs[i].offsetHeight > maxHeight) {
				divs[i].style.height = (maxHeight - (divs[i].offsetHeight - maxHeight)) + 'px';
			}
		}
	}
}


var iMenuTimeout

function fnMenu(objJSON) {
	if(objJSON) {
		if(objJSON.show) {
			clearTimeout(iMenuTimeout);
			iMenuTimeout = 0;
			
			objMenus = document.getElementById('menu').getElementsByTagName('ul')
			for(i = 0; i < objMenus.length; i++) {
				objMenu = objMenus[i];
				if(objMenu.style.display == 'block' && objMenu.id != '') {
					objMenu.style.display = 'none';
				}
			}
			
			objMenu = document.getElementById('menu' + objJSON.id);
			if(objMenu) {
				if(objMenu.innerHTML) {
					objMenu.style.display = 'block';
					objMenu.style.left = objJSON.menu.offsetLeft + 'px';
					objMenu.style.borderWidth = '4px';
				}
			}
		} else {
			if(iMenuTimeout == 0 && objMenu) iMenuTimeout = setTimeout('objMenu.style.display = "none"',500);
		}
	}
}

  function isEmpty(str) {
    if ((str.length==0) || (str==null)) 
      { return true; }
    else 
      { return false; }
  }

  function isValidEmail(str) {
    if (str.length >0) {
  	  i=str.indexOf("@")
  	  j=str.indexOf(".",i)
      k=str.indexOf(",")
      kk=str.indexOf(" ")
      jj=str.lastIndexOf(".")+1
      len=str.length
  
      if ((i>0) && (j>(1+1)) && (k==-1) && (kk==-1) && (len-jj >=2) && (len-jj<=3)) {
        return true;
      }	else {
        return false;
      }
    }
  }
