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(){
	//equalHeight(".Object");
	
	$("#nav > ul > li").each(function() {
		var _li = $(this);
		var _a = _li.children().eq(0);
		var _sub = _li.find("ul");
		_li.bind("mouseover",function() {
			_sub.show();
			_a.addClass("Hover");
		});
		_li.bind("mouseout",function() {
			_sub.hide();
			_a.removeClass("Hover");
		});
	});
	
	equalHeight(".LocationList");
	hideLabel("zipcode","Zip Code");
	hideLabel("state","State");
	hideLabel("address","Address");
	hideLabel("city","City");
	
	//front page slides rotator
	if ($('.slides-rotator .view-content > div.views-row').size() > 1) {
		$('.slides-rotator .view-content').cycle({
			fx:      'fade',
			speed:   1300,
			timeout: 8000,
			//pager:   '.slides-pager'
		});
	}
});

//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);
		});
	}
}
