
window.onload = function() {
	setFooter();
}

window.onresize = function() {
	setFooter();
}

// Return the viewable height of the window.
function getWindowHeight() {
	var windowHeight = 0;
	
	if (typeof(window.innerHeight) == 'number') {
		windowHeight = window.innerHeight;
	} else {
		if (document.documentElement && document.documentElement.clientHeight) {
			windowHeight = document.documentElement.clientHeight;
		} else {
			if (document.body && document.body.clientHeight) {
				windowHeight = document.body.clientHeight;
			}
		}
	}
	
	return windowHeight;
}

// Place the footer element at the bottom of the page.
function setFooter() {
	if (document.getElementById) {
		var windowHeight = getWindowHeight();
		
		if (windowHeight > 0) {
			// Get the height of the header, sidebar and content panes.
			var headerHeight = document.getElementById('header').offsetHeight;
			var sidebarHeight = document.getElementById('sidebar').offsetHeight;
			var contentHeight = document.getElementById('content').offsetHeight;
			
			// Get the id of the footer pane.
			var footerElement = document.getElementById('footer');
			var footerTopPadding = 30;
			
			if (document.URL.search(/index.php/) != -1
							|| document.URL.search('.com/dev2\/?$') != -1
							|| document.URL.search('.net/dev2\/?$') != -1) {
				var indexElementHeight = document.getElementById('indexMainContent').offsetHeight;
				var searchbarHeight = document.getElementById('searchbar').offsetHeight;
				
				contentHeight = indexElementHeight + searchbarHeight;
			}
			
			// 
			if (sidebarHeight > contentHeight)
				footerElement.style.top = (sidebarHeight + headerHeight + footerTopPadding) + 'px';
				//footerElement.style.top = '0px';
			else
				footerElement.style.top = (contentHeight + headerHeight + footerTopPadding) + 'px';
				//footerElement.style.top = '0px';
			
			// Bring the footer element back to the front.
			footerElement.style.display = 'block';
		}
	}
}

// Hides an element based upon a specified ID
function hideElement(id) {
	if (document.getElementById) { // DOM3 = IE5, NS6
		document.getElementById(id).style.display = 'none';
	} else {
		if (document.layers) { // Netscape 4
			document.id.display = 'none';
		} else { // IE 4
			document.all.id.style.display = 'none';
		}
	}
}

// Shows an element based upon a specified ID
function showElement(id) {
	if (document.getElementById) { // DOM3 = IE5, NS6
		document.getElementById(id).style.display = 'block';
	} else {
		if (document.layers) { // Netscape 4
			document.id.display = 'block';
		} else { // IE 4
			document.all.id.style.display = 'block';
		}
	}
}


function log_logo_view (logo_id, team, logo_add_date) {
  var xmlhttp = false;
  /*@cc_on @*/
  /*@if (@_jscript_version >= 5)
  // JScript gives us Conditional compilation, we can cope with old IE versions.
  // and security blocked creation of the objects.
    try {
      xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
    } catch (e) {
      try {
        xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
      } catch (E) {
        xmlhttp = false;
      }
    }
  @end @*/
  if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
    try {
      xmlhttp = new XMLHttpRequest();
    } catch (e) {
      xmlhttp = false;
    }
  }
  if (!xmlhttp && window.createRequest) {
    try {
      xmlhttp = window.createRequest();
    } catch (e) {
      xmlhttp = false;
    }
  }

  if (xmlhttp) {
    xmlhttp.open("GET", "/log_logo_click.php?l=" + logo_id + "&t=" + team + "&d=" + logo_add_date, false);
    xmlhttp.send(null);
  }
}




