$(function(){
    init();
});

function init() {    
    // Blur on focus
    $('a').focus(function() { this.blur(); });
    
    $("#mainNav ul li:last a").addClass("last");
    $("#subnav ul li:last a").addClass("last");
	$("#sections div:last").addClass("last");
    $('h1').each(function(){
    	$(this).html(
    			$(this).html().replace("|", "<span>|</span>")
    			)
    });
    $("h1:contains('|')").addClass("noTrans");
    $('label.required').append(' <em>*</em>');
    
    $('a.lightbox').lightBox({
    		imageLoading: '/asset/images/lightbox-ico-loading.gif',
    		imageBtnClose: '/asset/images/lightbox-btn-close.gif',
    		imageBtnPrev: '/asset/images/lightbox-btn-prev.gif',
    		imageBtnNext: '/asset/images/lightbox-btn-next.gif',
			fixedNavigation:true
    }); // Select all links with lightbox class
    
    $("img.popup").wrap("<div></div>");
    $("li#mainNavigation_node10135 a").attr('href', "/Portfolio/Residentail");
	// alert( 	$("li#mainNavigation_node10135 a").attr('href') );

}

function imageHeight(img) {
	var h = img.height;
	var oh = $(img).parent().height();
	//console.log( "h = " + h );
	//console.log( "oh = " + oh );	
	//var mt = (h + (oh - h)) / 2;
	var mt = ((oh - h) / 2);
	//console.log( "mt = " + mt );	
	if( h > oh ) {
		$(img).css("margin-top", + mt + "px");	
	}
	else {
		// console.log( oh - h );
		var vspace = ( oh - h )  / 2;
		$(img).attr("vspace",vspace);	
	}
}

/*
(function ($) {
// VERTICALLY ALIGN FUNCTION
$.fn.vAlign = function() {
	return this.each(function(i){
	var ah = $(this).height();
	var ph = $(this).parent().height();
	console.log( "ah = " + ah );
	console.log( "ph = " + ph );
	if( ah > ph ) {
		var mh = (ah  - ph);
		$(this).css('margin-top', -mh);
	} else {
		var mh = (ph - ah);
		$(this).css('margin-top', mh);
	}
	
	
	});
};
})(jQuery);
*/
