
/*-----------------------------------------------

  * Filename:      custom.js
  * Description:   Javascript Tips.
  * Version:       2010-07-06 (YYYY-MM-DD)
  * Website:       http://www.fukarasu.jp/
  * Auther:        みやなび
  * Copyright:     平良一訓

-------------------------------------------------*/


/*
 * EX: 写真切り替え
 * Update: (2010-07-08) by shimoji.
 * Infomation: original
 * Page: index.html
 * 
 */


jQuery(function(){
	$('#slideshow li:nth-child(1)').click(function(){
		$('#slideshow li').css('opacity','1');
		$(this).css('opacity','0.8');
		$('#main-picture img').animate({
			marginLeft: '-514px'
		});
	});
	$('#slideshow li:nth-child(2)').click(function(){
		$('#slideshow li').css('opacity','1');
		$(this).css('opacity','0.8');
		$('#main-picture img').animate({
			marginLeft: '-1028px'
		});
	});
	$('#slideshow li:nth-child(3)').click(function(){
		$('#slideshow li').css('opacity','1');
		$(this).css('opacity','0.8');
		$('#main-picture img').animate({
			marginLeft: '-1542px'
		});
	});
});





/*
 * EX: 写真切り替え
 * Update: (2010-07-08) by shimoji.
 * Infomation: http://bxgalleryplugin.com/
 * Page: Category
 * 
 */


jQuery(function(){
	$('.bxGallery').bxGallery({
		maxwidth: '390',              // if set, the main image will be no wider than specified value (in pixels)
		maxheight: '',             // if set, the main image will be no taller than specified value (in pixels)
		thumbwidth: 130,           // thumbnail width (in pixels)
		thumbcrop: false,          // if true, thumbnails will be a perfect square and some of the image will be cropped
		croppercent: .35,          // if thumbcrop: true, the thumbnail will be scaled to this 
								   // percentage, then cropped to a square
		thumbplacement: 'bottom',  // placement of thumbnails (top, bottom, left, right)
		thumbcontainer: '400',        // width of the thumbnail container div (in pixels)
		opacity: .7,               // opacity level of thumbnails
		load_text: '',             // if set, text will display while images are loading
		load_image: 'http://www.fukarasu.jp/images/spinner.gif',
		                           // image to display while images are loading
		wrapperclass: 'outer'      // classname for outer wrapping div
	});
});





/*
 * EX: checkbox color design
 * Update: (2010-06-10) 
 * Infomation: my original
 * 
 */


jQuery(function(){
	$(':checked').closest('label').addClass('chekd');
	$('label').click(function(){
		$('label').removeClass('chekd');
		$(':checked').closest('label').addClass('chekd');
	});
});





/*
 * 
 * EX: Style for input, TextArea, select.
 * Update: 1/15,2009
 * Infomation: my original
 * 
 */

jQuery(function(){
	$('input[type=password], input[type=text]').addClass('jText');
	$('input[type=password], input[type=text], textarea').focus(function(){
		$(this).addClass('jFocus');
	});
	$('input[type=password], input[type=text], textarea').blur(function(){
		if ($(this).find('.jFocus')) {
			$(this).removeClass('jFocus');
		}
	});
});





/*
 * Ex: allows the user to extend the textarea element/area within the web page whenever they feel.
 * update: 1/21,2009
 * info: http://plugins.jquery.com/project/TextAreaResizer
 * 
 */

jQuery(function(){
	if ($('textarea').length){
		$('textarea:not(.processed)').TextAreaResizer();
	};
});





/*
 * jQuery rollover plugin
 * Version 1.0  (04/11/2008) by Atlanta Jones.
 * Version 1.1  (15/12/2008) by shimoji (miyanavi).
 * 
 * Examples at: http://www.atlantajones.com/2007/09/27/easy-reusable-image-rollovers-with-jquery/
 * Copyright (c) 2008 Kush M.
 */

jQuery(function(){

	$('#nav img').each(function() {
		// Set the original src
		rollsrc = $(this).attr('src');
		rollON = rollsrc.replace(/^(.+)(\.[a-z]+)$/, '$1_ro$2');
		$('<img>').attr('src', rollON);
	});

	$('#nav a').mouseover(function(){
		imgsrc = $(this).children('img').attr('src');
		matches = imgsrc.match(/_ro/);

		if (!matches) {
		imgsrcON = imgsrc.replace(/^(.+)(\.[a-z]+)$/, '$1_ro$2'); // strip off extension
		$(this).children('img').attr('src', imgsrcON);
		}

	});

	$('#nav a').mouseout(function(){
		$(this).children('img').attr('src', imgsrc);
	});

});

