$(document).ready(function() {
	var header_nav = document.getElementById("header_nav");
	if(header_nav) {
		var num_children = header_nav.childNodes.length;
		var channel_list = Array(); // Will contain all 4 channel box elements.
		var num_channel = 0;
		var timeoutID;
	}
	
	//
	// Sets up the hover events
	// Gets all of the top channels.
	//
	// does a display block on the example content.
	//
	for(var i=0; i<num_children; i++) {
		// Gets all of the top_box elements.
		if(header_nav.childNodes[i].className) {
			var class_list = header_nav.childNodes[i].className.split(" ");

			if(class_list[0] == "top_box") {
				var num_nodes = header_nav.childNodes[i].childNodes.length;
				for(var j=0; j<num_nodes; j++) {
					// Gets the content box inside of the "top_box"
					if(header_nav.childNodes[i].childNodes[j].className == "content") {
						header_nav.childNodes[i].content = header_nav.childNodes[i].childNodes[j];
						header_nav.childNodes[i].example = header_nav.childNodes[i].childNodes[j].getElementsByTagName("div")[0];
					}
				}

				channel_list[num_channel++] = header_nav.childNodes[i];
/*					
				header_nav.childNodes[i].onmouseover = function() {
					// turn this off for non instant 
					this.example.style.display = "block";
					this.content.style.paddingBottom = "0px";

					var self = this;
					timeoutID = window.setTimeout(function(){
						self.example.style.display = "block";
						self.content.style.paddingBottom = "0px";					
					}, 1000);
				}

				// When the mouse leaves the box, set it back to normal and
				// make sure that the popup does NOT appear.
				header_nav.childNodes[i].onmouseout = function() {
					this.example.style.display = "none";
					this.content.style.paddingBottom = "14px";
					window.clearTimeout(timeoutID);
				}
*/
			}
		} // if header_nav.childNodes[i]
	}



/*

	// does a bunch of fun animations
	$('#header_nav .top_box').hover(function(){ 
		$(this).find('.content').css("paddingBottom", 0);
		$(this).find('.example').animate({opacity: 'toggle'}, "fast");
	},function(){
		$(this).find('.example').animate({opacity: 'toggle'}, "fast", function(){
			$(this).parent().css("paddingBottom", 14);
		});
	});

*/





	$('.top_box .content').click(function(){ 
		document.location = $(this).find("a").attr("href");
	});





/*
	// This hilights the button, but jquery kinda sux and is trippin out when 
	// the cursor rapidly ends up on a textarea box.
	//
	$('.top_box a.go').hover(function(){ 
		if($(this).find("span")[2]) { 
			$(this).find("span")[2].style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='/images/header/go_hover.png', sizingMethod='scale')";
		} else {
			$(this).find("img").attr("src","/images/header/go_hover.png");
		}
	},function(){
		if($(this).find("span")[2]) { 
			$(this).find("span")[2].style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='/images/header/go_normal.png', sizingMethod='scale')";
		} else {
			$(this).find("img").attr("src","/images/header/go_normal.png");
		}
	});
*/





/*
	// Hilights the go button when the cursor is over the blue box.
	// along with a png fix.
	$('.top_box .content').hover(function(){ 
		if($(this).find("span")[2]) { 
			$(this).find("span")[2].style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='/images/header/go_hover.png', sizingMethod='scale')";
		} else {
			$(this).find("img").attr("src","/images/header/go_hover.png");
		}

		$(this).find(".title").css("color", "#F79218");

	},function(){
		if($(this).find("span")[2]) { 
			$(this).find("span")[2].style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='/images/header/go_normal.png', sizingMethod='scale')";
		} else {
			$(this).find("img").attr("src","/images/header/go_normal.png");
		}
		
		$(this).find(".title").css("color", "#FFFFFF");
	});
*/
});