// xOpacity r1, Copyright 2006-2007 Michael Foster (Cross-Browser.com)

// Part of X, a Cross-Browser Javascript Library, Distributed under the terms of the GNU LGPL



function xOpacity(e, o)

{

  var set = xDef(o);

  //  if (set && o == 1) o = .9999; // FF1.0.2 but not needed in 1.5

  if(!(e=xGetElementById(e))) return 2; // error

  if (xStr(e.style.opacity)) { // CSS3

    if (set) e.style.opacity = o + '';

    else o = parseFloat(e.style.opacity);

  }

	//tc change 4-4-10
  else if (xStr(e.style.filter)) { // IE8.0+

    if (set) e.style.filter = 'alpha(opacity=' + (100 * o) + ')';

    else if (e.filters)
		{
		
		 if( e.filters.alpha) { o = e.filters.alpha.opacity / 100; }
		}

  }
	/* original code
  else if (xStr(e.style.filter)) { // IE5.5+

    if (set) e.style.filter = 'alpha(opacity=' + (100 * o) + ')';

    else if (e.filters && e.filters.alpha) { o = e.filters.alpha.opacity / 100; }

  }*/

  else if (xStr(e.style.MozOpacity)) { // Gecko before CSS3 support

    if (set) e.style.MozOpacity = o + '';

    else o = parseFloat(e.style.MozOpacity);

  }

  else if (xStr(e.style.KhtmlOpacity)) { // Konquerer and Safari

    if (set) e.style.KhtmlOpacity = o + '';

    else o = parseFloat(e.style.KhtmlOpacity);

  }

  return isNaN(o) ? 1 : o; // if NaN, should this return an error instead of 1?

}


