//WCCC Global JS functions

function showAlerts() {
	$('div.site_alert').fadeIn('slow');
	$('div.site_alert').each(function() {
		var myId=$(this).attr('id');
		$(this).find('a.close').click(function(){$('#'+myId).fadeOut('slow')});});
}

function initHoverWindow() {
	$('a.hoverWindow').each(function(index){
		var href=$(this).attr('href');
		$(this).attr('href','javascript:void(0)');
		$(this).click(function(){
			$('body').append('<div id="win_'+index+'" class="winPos"><div class="subWin"></div></div>');
			$('#win_'+index+' div.subWin').load(href, function(){
				$('#contact_form form').ajaxForm(
					function(){alert('Message Sent!');
					$('div.winPos').remove();
				});
			});
		});
	});
}

$(function(){
	showAlerts();
	initHoverWindow();
});