$(window).load(function() {
    $(".imageAdjust").each(function(i) {
        adjustImageCenter(this);
    });
});

$(document).ready(function() {
    
    //Banner images gallery
    $('#photos').cycle({
        fx: 'fade',
        timeout: 5000
    });
    
	//The function of the special font
	$("ul.sf-menu").superfish({
	    animation: { height: 'show' },   // slide-down effect without fade-in 
	    delay: 5000                    // 1.2 second delay on mouseout 
	});
});

function adjustImageCenter(obj) {
    //Get the Image & Parent Elements
    var img = $(obj)[0];
    var width = img.width;
    var height = img.height;
    var p = $(obj).parent()[0];
    var pHeight = parseFloat(p.style.height.replace('px', ''));
    var pWidth = parseFloat(p.style.width.replace('px', ''));

    //alert("img_w:" + width + " | img_h:" + height + " | p_w:" + pWidth + " | p_h:" + pHeight); 

    //Difference
    var heightDiff = height - pHeight;
    var widthDiff = width - pWidth;

    // set image to be positioned centered/middle of container
    $(obj).css("marginTop", -heightDiff / 2).css("marginLeft", -widthDiff / 2);
}


