
/* Image Rollover
--------------------------------------*/

$(function(){
	$('img.rollover, .rollover img, input.rollover')
	.not('[src*="_o."]')
	.mouseover(function(){
		$(this).attr('src',$(this).attr('src').replace(/^(.+)(\.[a-z]+)$/, '$1_o$2'));
	})
	.mouseout(function(){
		$(this).attr('src',$(this).attr('src').replace(/^(.+)_o(\.[a-z]+)$/, '$1$2'));
	})
	.each(function(){ //プリロード設定
		$('<img>').attr('src',$(this).attr('src').replace(/^(.+)(\.[a-z]+)$/, '$1_o$2'));
	})
	$('img.current')
	.mouseover(function(){
		$(this).attr('src',$(this).attr('src').replace(/^(.+)_c(\.[a-z]+)$/, '$1_o$2'));
	})
	.mouseout(function(){
		$(this).attr('src',$(this).attr('src').replace(/^(.+)_o(\.[a-z]+)$/, '$1_c$2'));
	})
	.each(function(){ //プリロード設定
		$('<img>').attr('src',$(this).attr('src').replace(/^(.+)_c(\.[a-z]+)$/, '$1_o$2'));
	})
});

/* Opacity
--------------------------------------*/

$(function(){
	$('.opacity')
	.mouseover(function(){
		$(this).stop().fadeTo('fast', 0.5);
	})
	.mouseout(function(){
		$(this).stop().fadeTo('normal', 1);
	});
});

/* Default Text Fields
--------------------------------------*/

$(function(){
	$('.defaultText').focus(function(srcc){
		if ($(this).val() == $(this)[0].title){
			$(this).removeClass('defaultTextActive');
			$(this).val('');
		}
	});
	$('.defaultText').blur(function(){
		if ($(this).val() == ''){
			$(this).addClass('defaultTextActive');
			$(this).val($(this)[0].title);
		}
	});
    	$('.defaultText').blur();
});


/* Focus Form
--------------------------------------*/

$(function(){
	$('input[type="text"], input[type="password"], textarea, select').addClass('idle')
	.focus(function(){
		$(this).addClass('focus');
	})
	.blur(function(){
		$(this).removeClass('focus');
	});
});

