$(function(){
	//現在居るファイル名取得	   
	var currentFile = location.href.split('/').pop();
	
	//ua取得
	var ua = navigator.userAgent;
	
	//thickbox	
	$('div.entry-body a'+'[href$=jpg],[href$=png],[href$=gif],[href$=JPG],[href$=PNG],[href$=GIF],[href$=jpeg],[href$=JPEG]').addClass('thickbox').attr('rel','group');
	
	
	
	//wink
	$('p.next a img').hover(function(){
		$(this).css('opacity', '0.3');
		$(this).css('filter', 'alpha(opacity=30)');
		$(this).fadeTo('slow', 1.0);
	});


//グローバルメニューhover時のに画像表示
	$('#ghmenu a[href$=/] , #gfmenu a[href$=/]').hover(function(){
	$(this).append('<p class="blowbg1"><img src="http://www.cmgroup.jp/img/glo-gmenu-blow1.png" alt="高価買取のワケと速報・お知らせ" /></p>')
	},function(){
			 $('p.blowbg1').remove();
		});
	
//グローバルメニューhover時のに画像表示
	$('#ghmenu a[href$=area.php],#gfmenu a[href$=area.php]').hover(function(){
	$(this).append('<p class="blowbg2"><img src="http://www.cmgroup.jp/img/glo-gmenu-blow2.png" alt="弊社スタッフ出張査定無料です!" /></p>')
	},function(){
			 $('p.blowbg2').remove();
		});
			
//グローバルメニューhover時のに画像表示
	$('#ghmenu a[href$=flow.php],#gfmenu a[href$=flow.php]').hover(function(){
	$(this).append('<p class="blowbg3"><img src="http://www.cmgroup.jp/img/glo-gmenu-blow3.png" alt="お客様の必要書類と査定の流れ" /></p>')
	},function(){
			 $('p.blowbg3').remove();
		});
			
//グローバルメニューhover時のに画像表示
	$('#ghmenu a[href$=zirei.php],#gfmenu a[href$=zirei.php]').hover(function(){
	$(this).append('<p class="blowbg4"><img src="http://www.cmgroup.jp/img/glo-gmenu-blow4.png" alt="ビックリ高価買取事例紹介" /></p>')
	},function(){
			 $('p.blowbg4').remove();
		});
			
//グローバルメニューhover時のに画像表示
	$('#ghmenu a[href$=qanda.php],#gfmenu a[href$=qanda.php]').hover(function(){
	$(this).append('<p class="blowbg5"><img src="http://www.cmgroup.jp/img/glo-gmenu-blow5.png" alt="気になる事を検索する" /></p>')
	},function(){
			 $('p.blowbg5').remove();
		});		
//グローバルメニューhover時のに画像表示
	$('#ghmenu a[href$=inquire.php],#gfmenu a[href$=inquire.php]').hover(function(){
	$(this).append('<p class="blowbg6"><img src="http://www.cmgroup.jp/img/glo-gmenu-blow6.png" alt="気になる事を問い合わせる" /></p>')
	},function(){
			 $('p.blowbg6').remove();
		});		
			
	
	
//フッター直売中古車一覧hover時のに画像表示
	$('div#sub-fmenu a[href$=car.php]').hover(function(){
	$('div#sub-fmenu').append('<p class="sub-fmenubg"><img src="http://www.cmgroup.jp/img/glo-footcarbg.png" alt="少しだけ国内直売しています" /></p>')
	},function(){
			 $('p.sub-fmenubg').remove();
		});
	
//フッター直売中古車一覧hover時のに画像表示
	$('div#sub-fmenu a[href$=auction.php]').hover(function(){
	$('div#sub-fmenu').append('<p class="sub-fmenubg"><img src="http://www.cmgroup.jp/img/glo-footaucbg.png" alt="お探しの中古車がある場合" /></p>')
	},function(){
			 $('p.sub-fmenubg').remove();
		});

//ヘッダー直売中古車一覧hover時のに画像表示
	$('div#sub-hmenu a[href$=car.php]').hover(function(){
	$('div#sub-hmenu').append('<p class="sub-hmenubg"><img src="http://www.cmgroup.jp/img/glo-footcarbg.png" alt="少しだけ国内直売しています" /></p>')
	},function(){
			 $('p.sub-hmenubg').remove();
		});
	
//ヘッダー直売中古車一覧hover時のに画像表示
	$('div#sub-hmenu a[href$=auction.php]').hover(function(){
	$('div#sub-hmenu').append('<p class="sub-hmenubg"><img src="http://www.cmgroup.jp/img/glo-footaucbg.png" alt="お探しの中古車がある場合" /></p>')
	},function(){
			 $('p.sub-hmenubg').remove();
		});

	$('a.naka').css({display: 'none'});
		
	//fancybox(lightbox)
//	try{
//		$("div a").fancybox({
//			'zoomOpacity' : true,'overlayShow' : false,'zoomSpeedIn' : 500,'zoomSpeedOut' : 500});
//	}catch(e){}


	//書類がない場合のテーブル
	$('table.syoruinotfind tr:nth-child(even)').addClass('even');
	
	
	//ビックリ買取事例のテーブル
	$('div.zirei-wrap table tr:nth-child(even)').addClass('even');
	
	
	//オークション説明のテーブル
	$('table.setumei tr:nth-child(even)').addClass('even');
	
	
	//オークション説明のテーブル
	$('table.kaisya tr:nth-child(even)').addClass('even');
	
	//サイトマップの高さheight-Line
	$('div.sitemap dl').addClass('heightLine-group');
	
	
	
	//直売中古車のサムネ画像の高さheight-Line
	$('div.entry-photo-thumbnail ul li').addClass('heightLine-group');
	
	
	//中古車直売車輌詳細のサムネイル
	$('div.entry-photo-thumbnail li:nth-child(odd)').addClass('odd');
	
	
	//査定・申し込みフォームのテーブル
	$('div.mailform table tr:nth-child(even)').addClass('even');
	
	
	//form-label
	
	$('div.mailform label').hover(function(){
			 $(this).addClass('labelback');
		},function(){
			 $(this).removeClass('labelback');
		});
	
	//rollover
	$('a img').each(function(){
		var imgSrc = $(this).attr('src');
		//smartRollover
		if(imgSrc.match(/(.*)_off(\..*)/)){
			var repSrc = RegExp.$1+'_on'+RegExp.$2;
			$('<img />').attr('src',repSrc);
			$(this).hover(function(){
				$(this).attr('src',repSrc);
				$(this).css({opacity: '1',filter: 'alpha(opacity=100)'});
			},function(){
				$(this).attr('src',imgSrc);
			});
		//ロールオーバーが無い場合は、透明度80%
		}else if(!$(this).hasClass('not')){
			$(this).hover(function(){
					$(this).css({
						opacity: '0.8',
						filter: 'alpha(opacity=80)'
					});
			},function(){
					$(this).css({
						opacity: '1',
						filter: 'alpha(opacity=100)'
					});
			}
			
			);
		}
	});
	
	//タイプ1.submit押した感 & smartrollover
	$('input.search-box-go').mousedown(function(){
		$(this).css({position:'relative',top:'1px',left:'1px'});
	}).mouseup(function(){
		$(this).css({position:'static'});
	}).mouseout(function(){
		$(this).css({position:'static'});
	}).hover(function(){
		$(this).css({background:'url(http://www.cmgroup.jp/img/qan-searchbtbg_on.jpg) no-repeat left top'});
	},function(){
		$(this).css({background:'url(http://www.cmgroup.jp/img/qan-searchbtbg_off.jpg) no-repeat left top'});
	});
	
//LPOフォーム内サブミット
	$('table#lpoform input.submit')
	  .hover(function(){
		$(this).attr('src',$(this).attr('src').replace(/^(.*)_off.(.*)$/,'$1_on.$2'));
	},function(){
		$(this).attr('src',$(this).attr('src').replace(/^(.*)_on.(.*)$/,'$1_off.$2'));
	});
	
	
	
	//タイプ1.submit押した感 & smartrollover
	$('form p.submit input')
	/*
	.mousedown(function(){
		$(this).css({position:'relative',top:'1px',left:'1px'});
	}).mouseup(function(){
		$(this).css({position:'static'});
	}).mouseout(function(){
		$(this).css({position:'static'});
	})*/
	  .hover(function(){
		$(this).attr('src',$(this).attr('src').replace(/^(.*)_off.(.*)$/,'$1_on.$2'));
	},function(){
		$(this).attr('src',$(this).attr('src').replace(/^(.*)_on.(.*)$/,'$1_off.$2'));
	});
	
	/* 
	//タイプ2.submit押した感 & ウィンク
	$('form p.submit input').mousedown(function(){
		$(this).css({position:'relative',top:'1px',left:'1px'});
	}).mouseup(function(){
		$(this).css({position:'static'});
	}).mouseout(function(){
		$(this).css({position:'static'});
	})
	  .hover(function(){
		$(this).css({opacity:0.2});
		$(this).fadeTo('slow',1.0);
	});
	*/

});
