/*
機　　能　　名：myjQuery
作　　成　　日：2010/08/16
作　　成　　者：52WEB WORKS. 上田
更　　新　　日：2010/00/00　---
*/

//******************************************************** 
//*****/


$(function() {
	if($('div#main_images').length){
		$('div#main_images').cycle({
			fx:'fade',
			speed:4000,			//スライド速度
			timeout:1000,		//スライド間隔
			autostop:1,			//自動停止フラグ
			autostopCount:3,	//自動停止スライド番号
			pause:0			//マウスオンで一時停止
		});
	}
});



$(function(){
	
	//フッターの高さを取得して、下部お問い合わせ枠の位置をCSSに反映
	//$('div#container div#container_in_01').css("padding-bottom", $('footer').height() + 100 + "px");
	
	//フッターの高さを取得して、下部お問い合わせ枠の位置をCSSに反映
	$('ul#footer_conetnts_link').css("height", $('ul#footer_conetnts_link').height() + 10 + "px");
	
	//copyrightの高さを取得して、footerの下部paddingをCSSに反映
	$('footer').css("padding-bottom", $('div#copyright').height() + 1 + "px");

});


//保護者専用ログインウィンドウ
function loginSubmit(){
		
		var pswd = $('input#pswd').val();		
		
		//空白を削除
		var patternF = new RegExp("　", "g");
		pswd = pswd.replace(patternF, '');
		
		var patternH = new RegExp(" ", "g");
		pswd = pswd.replace(patternH, '');
		
		
		if(pswd){
			
			//半角を全角に変換して置き換え
			$('input#pswd').val(z2h_word(pswd));
			document.login_form.submit();
		}else{
			alert('パスワードを入力して「ログインする」を押してください。');
		}
}

//半角→全角変換
function z2h_word(src) {
  return src.replace(/([Ａ-Ｚａ-ｚ０-９＿])/g,
    function ($0) {
      return String.fromCharCode($0.charCodeAt(0) - 65248);
    });
}

//パスワード表示・非表示
function chkchk(obj){
	
	var pswd = document.login_form.pswd;
	
	if(obj.checked){
		pswd.type = "text";
	}else{
		pswd.type = "password";
	}	
}



$(function(){		
		var designCredit = $('<div id="div#design_credit"><a href="http://52web-works.com/" target="_blank"><img src="http://52web-works.com/images/52web_credit_img.gif" width="120" height="7" alt="ホームページ制作　大阪" class="btn_c" /></a></div>');
		
		designCredit.css("display","block");
		designCredit.css("width","120px");
		designCredit.css("height","7px");
		designCredit.css("position","absolute");
		designCredit.css("bottom", ($('div#copyright').height() / 2) - 4 + "px");
		designCredit.css("right","0px");
		
		$('div#copyright_in_02').append(designCredit);
});



/* jQueryでタブ切替 */
$(document).ready(function(){
 		
		var defView = $('input#defview').val();
		
		if(defView == 'rec'){
			$('li.rec_tab').addClass("select");
			
			// #tab_contentsの全section要素を非表示
			$("#tab_contents .section").hide();
			
			// #rec_guideフェード表示
			$("#rec_guide").fadeIn();
			
		}else if(defView == 'temp'){
			$('li.temp_tab').addClass("select");
			
			// #tab_contentsの全section要素を非表示
			$("#tab_contents .section").hide();
			
			// #rec_guideフェード表示
			$("#temp_guide").fadeIn();
		}else{
		
		// 初期設定
	 
			// #tab_navの全li要素の中から最初のli要素に.selectを追加
			$("#tab_nav li:first").addClass("select");
	 
			// #tab_contentsの全section要素を非表示
			$("#tab_contents .section").hide();
			
			// #tab_contentsの全section要素の中から最初のsection要素を表示
			$("#tab_contents .section:first").show();
		}
		
		
		// タブ切替処理
		$("#tab_nav li a").click(function () {
										   
			// #tab_navの全li要素のclass属性を削除
			$("#tab_nav li").removeClass("select");
			
			// クリックしたli要素に.selectを追加
			$(this).parent("li").addClass("select");
			
			// #tab_contentsの全section要素を非表示
			$("#tab_contents .section").hide();
			
			// クリックしたタブのインデックス番号と同じsection要素をフェード表示
			$("#tab_contents .section").eq($("#tab_nav li a").index(this)).fadeIn();
		
		
    });
 
});

