jQuery(function(){
	
	//サイドメニュースクロール
	$('#movelay').scrollFollow({
 		speed: 350
	});
	
	//PNG透過処理
	$('img[src$=png]').pngfix();
	
	//各ボタンhover
	$("img, input:image")
		.hover(
			function () {
				$(this).attr('src',$(this).attr('src').replace("/off/", "/on/"));
			},
			function () {
				$(this).attr('src',$(this).attr('src').replace("/on/", "/off/"));
			}
		)
	;
	//Ajaxで大地域の詳細地域を配列で取得、変更
	$("td select[name='u[area1]']")
		.change(
			function () {
				//ajaxで詳細地域配列を取得
				$.ajax({
					type: "POST",
					data: 'area1=' + $(this).val(),
					url: "./js/ajax_select_area2.php",
					dataType: "script",
					success: function(){
						$("td select[name='u[area2]']")
							.empty()
						;
						for(keys in columns) {
							$("td select[name='u[area2]']")
									.append(
										$('<option>')
											.attr({ value: keys })
												.text(columns[keys])
									)
							;
						}
						return true;
					}
				});
			}
		)
	;
	// 詳細ページwindow.open
	$("div.list_new a, div.list_access a")
		.click(
			function() {
				if ($(this).attr('class') != 'popup') {
					obj = window.open( $(this).attr('href'), '_blank', 'width=620, height=700, menubar=no, scrollbars=yes, resizable=no, toolbar=no');
					obj.focus();
					return false;
				}
			}
		)
	;
	// スポンサー一覧window.open
	$("body#tos.common div.list dl.text_page_box dd a")
		.click(
			function() {
				obj = window.open( $(this).attr('href'), 'sp', 'width=500, height=650, menubar=no, scrollbars=yes, resizable=no, toolbar=no');
				obj.focus();
				return false;
			}
		)
	;
	
	// モバイル版URL送信window.open
	$('div#movelay form#mobileTransfer')
		.submit(
			function() {
				obj = window.open('', 'mT', 'width=490,height=450, menubar=no, scrollbars=no, resizable=no, toolbar=no');
				obj.focus();
				$(this).submit();
				return false;
			}
		)
	;
	
	// サブウインドウを閉じるボタン
	$("p.closeBtn a img, div#send p a img")
		.click(
			function () {
				window.close();
			}
		)
	;
});

