var theContainer;
var theBody;

function getHeight(){
	var windowHeight, yScroll;

        if (window.innerHeight && window.scrollMaxY) {
                yScroll = window.innerHeight + window.scrollMaxY;
        } else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
                yScroll = document.body.scrollHeight;
        } else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
                yScroll = document.body.offsetHeight;
        }

        if (self.innerHeight) { // all except Explorer
                windowHeight = self.innerHeight;
        } else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
                windowHeight = document.documentElement.clientHeight;
        } else if (document.body) { // other Explorers
                windowHeight = document.body.clientHeight;
        }

        // for small pages with total height less then height of the viewport
		if(yScroll < windowHeight){pageHeight = windowHeight;}
		else {pageHeight = yScroll;}
	
	
	theBody = document.getElementsByTagName("body")[0];
	theContainer = document.getElementById("tmp_container");
	if(theContainer){theContainer.style.height = pageHeight + 'px';}
}

var t;
function changeBackground(color){
	theContainer = document.getElementById("tmp_container");
	clearTimeout(t);
	if(!detectMacFirefox2()){
		t = setTimeout(
		function(){
			theContainer.className = color;
			$("#tmp_container").hide();
			$("#tmp_container").fadeIn("400");
			var r = setTimeout(
				function(){
					theBody.className = color;	
					$("#tmp_container").hide();
			}, "320");
		}, '350');
	}
	if(detectMacFirefox2()){
		t = setTimeout(
		function(){
			theContainer.className = color;
			var r = setTimeout(
				function(){
					theBody.className = color;	
				}, "320");
		}, '350');
	}
}

window.onload = getHeight;

function detectMacFirefox2() {
  var ua = navigator.userAgent.toLowerCase();
  if (/firefox[\/\s](\d+\.\d+)/.test(ua)) {
    var firefox_version = new Number(RegExp.$1);
    if (firefox_version < 3 && ua.indexOf('mac') != -1) {
      return true;
    }
  }
  return false;
}

function riaTrack(eventName, eventType, eventId) {
// NOTE: used for Rich Internet Application Tracking - FlashTrackAction and AJAX Track
  dcsMultiTrack('DCSext.eventname', eventName, 'DCSext.eventtype', eventType, 'DCSext.eventid', eventId);
}
