// Need to know what's being run (sigh)
var ua = navigator.userAgent.toLowerCase()
var isSafari = (ua.indexOf('safari') != - 1)
var isMacIE = (ua.indexOf('msie') != - 1) && (ua.indexOf('mac_') != - 1)
var isWinIE = (ua.indexOf('msie') != - 1) && (ua.indexOf('windows') != - 1)

// Move the flowers at the bottom and do a few other things
function moveFlowers() {
	var el

	// Make sure the right side is long enough
	el = $('content-body')
	if (el != null) {
		if (el.offsetHeight < 200) {
			el.style.height = '200px'
		}
	}

	// IE tweaks
	if (isWinIE) {
		if (el = $('sidebar')) {
			el.style.top = '-3px'
		}
		if (el = $('home')) {
			el.style.top = '-3px'
		}
		if (el = $('letter-title')) {
			el.style.top = '-3px'
		}
		if (el = $('giving-title')) {
			el.style.top = '-3px'
		}
		if (el = $('faq-title')) {
			el.style.top = '-3px'
		}
		if (el = $('news-title')) {
			el.style.top = '-3px'
		}
	}

	// Adjust the height of the sidebar
	var h = $('main').offsetHeight - 40
	h += 40
	try {	h -= adjust	}	catch(err) { }
	$('sidebar').style.height = h + 'px'

/*
	// The flower in the header
	var sf = $('small-flower')
	sf.style.top = '-' + (getRealTop(sf) - 97) + 'px'
	sf.style.left = '92px'
*/
}

function getRealTop(el) {
	var yPos = el.offsetTop - (el.scrollTop ? el.scrollTop : 0) + (isSafari || isMacIE ? 0 : getScrollTop())
	tempEl = el.offsetParent
	while (tempEl != null) {
		yPos += tempEl.offsetTop - (tempEl.parentNode.scrollTop == null ? 0 : tempEl.parentNode.scrollTop)
		tempEl = tempEl.offsetParent
	}
	return(yPos)
}

function getScrollTop() {
  var y
  if (self.pageYOffset) // all except Explorer
    {
      y = self.pageYOffset;
    }
  else if (document.documentElement && document.documentElement.scrollTop)
    // Explorer 6 Strict
    {
      y = document.documentElement.scrollTop;
    }
  else if (document.body) // all other Explorers
    {
      y = document.body.scrollTop;
    }

  return(y)
}

function $(el) {
	return(document.getElementById(el))
}