$(function(){
	$('#top-navigation img')
		.css( {backgroundPosition: "0 0"} )
		.mouseover(function(){
			if($(this).attr('class')!='active'){
				$(this).stop().animate({opacity: 0}, {duration:250});
			}
		})
		.mouseout(function(){
			if($(this).attr('class')!='active'){
				$(this).stop().animate({opacity: 1}, {duration:450});
			}
		});	
	
	// Contact form fields
	
	$(".inputer").each(function(){
		if($(this).val()!=""){
			//$(this).css('background-image', 'url('+ cssdir +'/images/contact-input-bg.jpg)');
			$(this).css('background-position', '0px -66px');
		}
	});
	
	$(".inputer").bind('focus', function() {
    if($(this).val()=="" || $(this).val()==/\s*/){
      //$(this).css('background-image', 'url('+ cssdir +'/images/contact-' + this.name + '-focus-bg.jpg)');
      $(this).css('background-position', '0px -33px');
    }
	});
	
	$(".inputer").bind('blur', function() {
		if($(this).val()=="" || $(this).val()==/\s*/){
			//$(this).css('background-image', 'url('+ cssdir +'/images/contact-' + this.name + '-bg.jpg)');
			$(this).css('background-position', '0px 0px');
		}
	});
	
	$(".inputer").bind('keyup', function() {
		if($(this).val()=="" || $(this).val()==/\s*/){
			//$(this).css('background-image', 'url('+ cssdir +'/images/contact-' + this.name + '-focus-bg.jpg)');
			$(this).css('background-position', '0px -33px');
		} else {
      //$(this).css('background-image', 'url('+ cssdir +'/images/contact-input-bg.jpg)');
      $(this).css('background-position', '0px -66px');
		}
	});
	
});
