window.onload = function () {
	// Fix PNG for Ie 6
	if ( (/MSIE 6\.0/).test(navigator.userAgent) && !(/MSIE 7\.0/).test(navigator.userAgent) && !(/MSIE 8\.0/).test(navigator.userAgent) ) {	
		DD_belatedPNG.fix(".FixPng");
	}
}

$(document).ready(function(){
	$(window).scrollTop(0);
	if($(".RelatedArticleBox").length > 0) {
		$(".RelatedArticleBox").css({
			top : $(".SubBlogBox").outerHeight() + "px"
		});
		$(window).bind("scroll", function () {
			var _duration = $(window).scrollTop();
			var _heightHeader = $("#headWrapper").outerHeight();
			var _heightMainTop = $("#mainWrapper").outerHeight();
			var _heightSubBlog = $(".SubBlogBox").outerHeight();
			var _spaceTop = 25;
			if(_duration > (0 + _heightSubBlog + _heightHeader + _heightMainTop - _spaceTop)) {
				$(".RelatedArticleBox").stop().animate({
					top : _duration - _heightHeader - _heightMainTop + _spaceTop - 10
				},500);
			} else {
				$(".RelatedArticleBox").stop().animate({
					top : 0 + _heightSubBlog
				},500);
			}
		});		
	}
	
	if($(".BtnSubmit").length > 0) {
		$(".BtnSubmit").bind("mouseover", function() {
			$(this).attr("src","http://augustinteractive.com/wp-content/themes/default/images/btn-submit-hover.gif");
		});
		$(".BtnSubmit").bind("mouseout", function() {
			$(this).attr("src","http://augustinteractive.com/wp-content/themes/default/images/btn-submit.gif");
		});
	}
});

//Auto hide label
function hideLabel(obj,text) {
	$("#" + obj).focus(function() {
		if($(this).val() == text) {
			$(this).val("");
		}
	});
	$("#" + obj).blur(function() {
		if($(this).val() == "") {
			$(this).val(text);
		}
	});
}

function equalHeight(obj) {
	if($(obj).length > 0) {
		$(obj).each(function() {
			var thisObj = $(this);
			var maxHCell = 0;
			$(thisObj).children().each(function() {
				var thisCell = $(this);
				var thisH = thisCell.height();
				if(maxHCell < thisH) {
					maxHCell = thisH;
				}
			});
			$(thisObj).children().height(maxHCell);
		});
	}
}
