/**
 * @name main.js
 * @fileOverview
 * @version 1.0
 * @description
 * <p>(c) FOURDIGIT Inc. Licensed <a href="http://ja.wikipedia.org/wiki/GNU_General_Public_License">GNU General Public License</a>.</p>
 */
//他ライブラリと共存する場合、下の一行削除($無効化)
//jQuery.noConflict();
(function($){
	var config = function () {
	//bodyのクラスにブラウザ情報を追加
		$.addClassUA();
	//easyOverのターゲット設定
		$("img.ahover, input.ahover, .ahoverArea img").easyOver();
	//IE5,6にてPNG有効化 (pngfixの読み込みが必要)
		//$("img[src$=png],p.png").enablePNG();
	//Flash
		//$("object, embed").enableFlash();
	//ポップアップリンクに置換
		$(".commonPop").easyPop();
	//他ドメインリンク時にpageTracker有効化
		//$("a,area").blankLogToGoogle();
	//アンカーリンクをスムージング
		$("a[href^=#]").smoothScroll();
	//対象の要素をスクロールに追従するようにする
		//$("#fixBox").fixPosition("stopperID","normal");
	}

	//onload 追記
	$(function(){
		config();
		
		//TELリンク
		if( navigator.userAgent.search(/iPhone/)!=-1 || navigator.userAgent.search(/Android/)!=-1 ){
			$('.linkTEL').each(function(){
				$(this).wrap('<a href="tel:0555227711"></a>')
			});
		}
		
		//form
		$('#formSearch').each(function(){
			var $form = $(this);
			var today = new Date();
			var today_y = today.getFullYear();
			var today_m = today.getMonth()+1;
			var today_d = today.getDate();
			var per_num = 2;
			var select_y;
			$form.find('select[name="obj_year"]').html('');
			for(var i=0;i<2;i++){
				$form.find('select[name="obj_year"]').append('<option value="'+ (today_y+i) +'">'+ (today_y+i) +'</option>');
			}
			$('select[name="obj_year"]').html(select_y);
			$form.find('select[name="obj_year"] option[value="'+today_y+'"]').attr('selected','selected');
			$form.find('select[name="obj_month"] option[value="'+today_m+'"]').attr('selected','selected');
			$form.find('select[name="obj_day"] option[value="'+today_d+'"]').attr('selected','selected');
			$form.find('select[name="obj_per_num"] option[value="'+per_num+'"]').attr('selected','selected');
			$form.find('#btnSearch').click(function(){
				$form.submit();
				return false;
			});
		});
		
	});

})(jQuery);
