/* casa-cabeza.aspx obra-nueva-viviendas.aspx */
$(window).load(function () {

	var nMaxH = 0;

	$(".item").hover(function (a) {

		var jThis = $(this);
//		$(".item").css({
//			backgroundColor: "#F3EEE4"
//		});
		jThis.css({
			backgroundColor: "#FFCC7F"
		});
	
	}, function () {

		var jThis = $(this);
		jThis.css({
			backgroundColor: "#F3EEE4"
		});
	
	}).click(function () {
	
		var jThis = $(this);
		var jHref = jThis.find(".href");
		var sLink = jHref.html();
		location.href= sLink;
	
	}).css({ cursor: "pointer" });
	
//	.each(function (a, b) {

//		if(nMaxH>0) {
//			var jThis = $(this);
//			jThis.find(".box").css({ lineHeight: nMaxH+"px" });
//			jThis.css({ height: nMaxH });
//		}
		
//	});

//	$(".box").each(function (a, b) {
//
//		var jThis = $(this);
//		var jSpan = jThis.find("span");
//		jSpan.each(function (a, b) {
//		alert( ((jThis.height()-$(b).height())/2) )
//			$(b).css({
//				display: "block",
//				paddingTop: ((jThis.height()-$(b).height())/2)
//			});
//		});
//	
//	});

});

$(window).load(function () {

	$(".item").each(function (a, b) {
	
		var jThis = $(this);
		var jImg  = jThis.find("img");
		if(typeof(jImg.attr("src"))!="undefined") {
//			jThis.find(".box").css({ lineHeight: jImg.height()+"px" });
			jThis.css({ height: jImg.height() });
			jSpan = jThis.find(".box");
			jSpan.each(function (a, b) {
				var nPT =((jThis.height()-$(b).height())/2);
				if(nPT<0) {
					nPT =((100-$(b).height())/2);
					jThis.height(100);
				}
				$(b).css({
					display: "block",
					paddingTop: nPT
				});
			});
//			nMaxH = Math.max(nMaxH, jImg.height());
		} else {
			var np = jThis.find(".box:last span").length;
			jThis.css({ height: np==1 ? 50 : 75 });
			jSpan = jThis.find(".box");
			jSpan.each(function (a, b) {
				$(b).css({
					display: "block",
					paddingTop: ((jThis.height()-$(b).height())/2)
				});
			});
		}
		
	})

});
