(function ($) {
// VERTICALLY ALIGN FUNCTION
$.fn.vAlign = function() {
	return this.each(function(i){
	var ah = $(this).height();
	var ph = $(this).parent().height();
	var mh = (ph - ah) / 2;
	$(this).css('margin-top', mh);
	});
};
})(jQuery);

$(document).ready(function(){
	$('ul.slideshow').innerfade({animationtype: 'fade',speed: 2000,timeout: 5000,type: 'sequence',containerheight: '328px'});
	$('#two ul li.valign').wrapInner("<div class='valign'>","</div>");
	$('#two ul li.valign li a').addClass("sublink");
	// $('.fourColumns, .threeColumns, .twoColumns').append('<div class="clear"></div>');
	$('div.valign').vAlign();
	$("li.valign a.sublink").click(function(){
	   window.location=$(this).attr("href"); return false;
	});
	$("li.valign").click(function(){
	   window.location=$(this).find("a").attr("href"); return false;
	});
	
	$("li.valign").hover(function() {
		$(this).stop();
		$(this).css("cursor","pointer");
		if($(this).find("a").attr("href")==undefined) {$(this).css("cursor","default"); return false}
    	$(this).css("background-color","#CECECE");
		},function() {
		$(this).stop();
    	$(this).css("background","none");
	});

	$(".valignyyy a").hover(function() {
		$(this).stop();
    	$(this).parents("li.valign").css("background-color","#CECECE");
},function() {
		$(this).stop();
    	$(this).parents("li.valign").css("background","none");
	});
	
});
