$(document).ready(function(){
	//INPUT ELEMENTS	
		var st = '#263035';
		var en = '#636a6e';
		var fn = '#999da0';
		
		$('input[type=hidden]').each(function(){
			$(this).css('display', 'none');
		});
			
		$(':input').focus(function(){
			if($(this).val() == $(this).attr('rel')){
				$(this).css('color', en);
				$(this).keydown(function(){
					if($(this).val() == $(this).attr('rel')){					
						$(this).val('');
						$(this).css('color', st);
					}
				});
			}
		}).blur(function(){
			if($(this).val() == '' || $(this).val() == $(this).attr('rel')){
				var atty = $(this).attr('rel');
				$(this).val(atty).css('color', fn);
			}
		});
		
		//CHECKBOX
		$('input[type=checkbox]').each(function(){
			$(this).css({'display' : 'inline', 'width' : 'auto', 'padding' : '0px', 'margin-right' : '5px'});
		});
	//INPUT ELEMENTS
	
	//buttons
	$('.buttons').click(function(){
		window.location = $(this).attr('rel');
	});
	
	//FIND LOGO
	$('#logo').css('cursor', 'pointer').bind({
		click: function(){
			window.location = './?page=home';	
		},
		mouseenter: function(){
			$(this).fadeTo(500, 0.5);
		},
		mouseleave: function(){
			$(this).fadeTo(500, 1.0);
		}
	});
	
	$('#foot_logo').css('cursor', 'pointer').bind({
		click: function(){
			window.location = './?page=home';	
		},
		mouseenter: function(){
			$(this).fadeTo(500, 0.5);
		},
		mouseleave: function(){
			$(this).fadeTo(500, 1.0);
		}
	});
	
	//church info container
	$('.churchInfo').find('td:even').addClass('churchEven').end().find('td:odd').addClass('churchOdd');
	$('.churchContainer a').toggle(function(){
		if($(this).attr('href') != undefined){
			window.open($(this).attr('href'));
		}
		$(this).next().slideDown('slow');
	},function(){
		$(this).next().slideUp('fast');	
	});
	
	//cleaning up margins
	$('#navbar a').eq(0).css('margin-left', '0px').end().last().css('margin-right', '0px');
	$('.buttons').last().css('margin-right', '0px').end().bind({
		mouseenter: function(){
			$(this).css('border-color', '#f7f5f2');
		},
		mouseleave: function(){
			$(this).css('border-color', '#c0b7a8');
		}
	});
});
