


/* config
----------------------------------------*/
$(function(){
	
	$.ajaxSetup({ cache: false });
	
	//go2top
	/*
	$(".go2top").click(function(){
		$("html,body").animate({scrollTop:0},1000);//quart,easeslide,
	});
	*/
	
	//tooltip
	if($("#wau_tooltip").size() < 1){
		$("body").append("<div id='wau_tooltip'><div class='_txt'></div><span class='_agl'></span></div>");
		$(".tip").wau_ToolTip();
	}
	
	_init_FontChange();
	
	/* onFocus=this.blur();
	----------------------------------------*/
	a=document.getElementsByTagName("a");
	for(i=0;i<a.length;i++){
		a[i].onfocus=function(){this.blur();}
	}
	
	/*
	global navi：onaga add 2011.3.4
	同じ配下の場合は選択済みへ
	----------------------------------------*/
	var strHref = window.location.pathname.substr(1);
	var now_dir1 = strHref.substr(0,strHref.indexOf("/"));
	$("a.menulink").each(function(i){
		var a_uri1 = $(this).attr("href").substr(1);
		var a_uri2 = a_uri1.substr(0,a_uri1.indexOf("/"));
		if(a_uri2 == ""){
			a_uri2 = a_uri1;
		}
		if(a_uri2 == now_dir1){
			if((a_uri2=="")&&(now_dir1=="")&&(strHref!="")){
				//DocRootのページかも
			}else{
				$(this).addClass("naviselected");
			}
		}
	});
	
	/*
	サイドメニュー：
	現在閲覧しているURLリンクは選択済みへ
	----------------------------------------*/
	var strHref_now = strHref.substr(strHref.indexOf("/")).substr(1);
	$("#side_submenu a").each(function(i){
		var strAttrHref = $(this).attr("href");
		var strURL = document.URL.substr(document.URL.lastIndexOf("/")).substr(1);
		if(strHref_now == strAttrHref || strAttrHref == strURL){
			$(this).parent().addClass("sc");
			$(this).addClass("sc");
		}
	});
	
	//alert("Settings End!!");
//↓本番ではココから
//	if(window.location.hostname != "au-hikari.ne.jp"){
//		$("body").append("<div id='KARI'>確認用サイト</div>");
//		$("#KARI").css({
//			"position":"fixed",
//			"top":"10px",
//			"left":"8px",
//			"padding":"4px",
//			"background-color":"#cc0000",
//			"color":"#fff"
//		});
//	}
//↑ココまでコメント
});


/* smartRollover
2010/01/08:_offと_onに_scを追加した by WAUKE
----------------------------------------*/
(function(onLoad){
	try{
		window.addEventListener('load', onLoad, false);
	}catch(e){
		window.attachEvent('onload', onLoad);
	}
})(function(){
	//var over = function() { this.src = this.src.replace('_off.', '_on.'); };
	var over = function() { this.src = this.src.replace(/_off.|_sc./g, '_on.'); };
	var out  = function() { this.src = this.src.replace('_on.', '_off.'); };
	var out2  = function() { this.src = this.src.replace('_on.', '_sc.'); };
	var img = document.getElementsByTagName('img');
	for(var i=0, l=img.length; i<l; i++){
		if (!img[i].src.match(/_off\.||_sc\./)) continue;
		if (!img[i].src.match(/_sc\./)){
			img[i].onmouseover = over;
			img[i].onmouseout  = out;
		}else{
			img[i].onmouseover = over;
			img[i].onmouseout  = out2;
		}
    }
});

/*
 * JQuery Plugin: "EqualHeights"
 * by:	Scott Jehl, Todd Parker, Maggie Costello Wachs (http://www.filamentgroup.com)
 * Copyright (c) 2008 Filament Group
 * Licensed under GPL (http://www.opensource.org/licenses/gpl-license.php)
 * Usage Example: $(element).equalHeights();
 * Version: 2.0, 08.01.2008
*/
$.fn.equalHeights = function(px) {
	$(this).each(function(){
		var currentTallest = 0;
		$(this).children().each(function(i){
			if ($(this).height() > currentTallest) { currentTallest = $(this).height(); }
		});
		if (!px || !Number.prototype.pxToEm) currentTallest = currentTallest.pxToEm(); //use ems unless px is specified
		// for ie6, set height since min-height isn't supported
		if ($.browser.msie && $.browser.version == 6.0) { $(this).children().css({'height': currentTallest}); }
		$(this).children().css({'min-height': currentTallest}); 
	});
	return this;
};


/* getURLParam
----------------------------------------*/
function getURLParam(strParamName){
	var strReturn = "";
	var strHref = window.location.href;
	if ( strHref.indexOf("?") > -1 ){
		var strQueryString = strHref.substr(strHref.indexOf("?")).toLowerCase();
		var aQueryString = strQueryString.split("&");
		for ( var iParam = 0; iParam < aQueryString.length; iParam++ ){
			if (
				aQueryString[iParam].indexOf(strParamName.toLowerCase() + "=") > -1 ){
				var aParam = aQueryString[iParam].split("=");
				strReturn = aParam[1];
				break;
			}
		}
	}
	//WAUKE_add
	if ( strHref.indexOf(strParamName) > -1 ){
		strReturn = strHref.substr(strHref.indexOf(strParamName));
		//strReturn = strHref.substr(strHref.indexOf(strParamName)).substr(1);
	}
	return unescape(strReturn);
}


/* menu onaga add 2011.3.4
----------------------------------------*/
var menu=function(){
	var t=15,z=50,s=6,a;
	function dd(n){this.n=n; this.h=[]; this.c=[]}
	dd.prototype.init=function(p,c){
		a=c; var w=document.getElementById(p), s=w.getElementsByTagName('ul'), l=s.length, i=0;
		for(i;i<l;i++){
			var h=s[i].parentNode; this.h[i]=h; this.c[i]=s[i];
			h.onmouseover=new Function(this.n+'.st('+i+',true)');
			h.onmouseout=new Function(this.n+'.st('+i+')');
		}
	}
	dd.prototype.st=function(x,f){
		var c=this.c[x], h=this.h[x], p=h.getElementsByTagName('a')[0];
		clearInterval(c.t); c.style.overflow='hidden';
		if(f){
			p.className+=' '+a;
			if(!c.mh){c.style.display='block'; c.style.height=''; c.mh=c.offsetHeight; c.style.height=0}
			if(c.mh==c.offsetHeight){c.style.overflow='visible'}
			else{c.style.zIndex=z; z++; c.t=setInterval(function(){sl(c,1)},t)}
		}else{p.className=p.className.replace(a,''); c.t=setInterval(function(){sl(c,-1)},t)}
	}
	function sl(c,f){
		var h=c.offsetHeight;
		if((h<=0&&f!=1)||(h>=c.mh&&f==1)){
			if(f==1){c.style.filter=''; c.style.opacity=1; c.style.overflow='visible'}
			clearInterval(c.t); return
		}
		var d=(f==1)?Math.ceil((c.mh-h)/s):Math.ceil(h/s), o=h/c.mh;
		c.style.opacity=o; c.style.filter='alpha(opacity='+(o*100)+')';
		c.style.height=h+(d*f)+'px'
	}
	return{dd:dd}
}();

/*
_init_FontChange
add 2012.01.06 by WAUKE
----------------------------------------*/
function _init_FontChange(){
	if( !navigator.cookieEnabled ){ return; }
	//trace(">>_init_FontChange()");
	
	//chk
	var lnks = $("#hdr_fs_s,#hdr_fs_m,#hdr_fs_l");
	if(lnks.size() != 3){ return; }
	
	//init
	var wrapper = $("#wrapper");
	var keyName = 'FS';
	var _FS = 'm';
	var sizes = {'s':80, 'm':100, 'l':130 };
	
	//show Eles
	$("#hdr_fs_T,#hdr_fs_s,#hdr_fs_m,#hdr_fs_l").show();
	
	//getV
	_FS = $.cookie(keyName);
	if(!_FS || !sizes[_FS]){
		_FS = 'm';
		$.cookie(keyName, _FS, {path:'/', expires:1});//days
	}
	lnks.removeClass("on");
	$("#hdr_fs_"+_FS).addClass("on");
	wrapper.css({"font-size":sizes[_FS]+"%"});
	
	//bind->click
	lnks.click(function(){
		var k = $(this)[0].id.replace(/hdr_fs_/, '');
		if(_FS != k){
			_FS = k;
			//trace("_FS:"+_FS);
			$.cookie(keyName, _FS, {path:'/', expires:1});//days
			lnks.removeClass("on");
			$(this).addClass("on");
			wrapper.css({"font-size":sizes[_FS]+"%"});
		}
	});
	
	lnks.wau_ToolTip();
	
};


//trace
function trace(data){ if(window.console){ console.log(data); } };


/*------------------------------------------------
Cookie plugin
Copyright (c) 2006 Klaus Hartl (stilbuero.de)
Dual licensed under the MIT and GPL licenses:
http://www.opensource.org/licenses/mit-license.php
http://www.gnu.org/licenses/gpl.html
------------------------------------------------*/
jQuery.cookie=function(name,value,options){if(typeof value!='undefined'){options=options||{};if(value===null){value='';options.expires=-1;}var expires='';if(options.expires&&(typeof options.expires=='number'||options.expires.toUTCString)){var date;if(typeof options.expires=='number'){date=new Date();date.setTime(date.getTime()+(options.expires*24*60*60*1000));}else{date=options.expires;}expires='; expires='+date.toUTCString();}var path=options.path?'; path='+(options.path):'';var domain=options.domain?'; domain='+(options.domain):'';var secure=options.secure?'; secure':'';document.cookie=[name,'=',encodeURIComponent(value),expires,path,domain,secure].join('');}else{var cookieValue=null;if(document.cookie&&document.cookie!=''){var cookies=document.cookie.split(';');for(var i=0;i<cookies.length;i++){var cookie=jQuery.trim(cookies[i]);if(cookie.substring(0,name.length+1)==(name+'=')){cookieValue=decodeURIComponent(cookie.substring(name.length+1));break;}}}return cookieValue;}};

/*------------------------------------------------
wau_SlideBox
Copyright (C) WAUKE.Y All Rights Reserved.
------------------------------------------------*/
(function(a){a.fn.wau_SlideBox=function(b){var c=a.extend({showIndex:0,waite:0,showNav:true,bindAfter:null,copyright:"WAUKE"},b);this.each(function(){var b=c.waite*1e3;var d;var e=true;var f=a(this);var g=null;var h=null;var i=null;var j=null;var k=c.showIndex;var l=function(){f.wrapInner("<div class='wau_SlideBox_Wrap'></div>");g=f.find(".wau_SlideBox_Wrap");h=f.find("img");if(h.size()<1){h.show();return}g.css({width:f.width()+"px",height:f.height()+"px"});if(c.showNav){var e=a("<div class='wau_SlideBox_Nav'></div>");for(var l=0;l<h.size();l++){e.append("<span tabIndex='1'>"+(l+1)+"</span>")}f.append(e);f.css({height:f.height()+25+"px"});i=e.find("span");i.click(m);i.hide()}j=a("<div class='wau_SlideBox_Ldg'></div>");j.css({top:f.height()/2+"px",left:f.width()/2-16+"px"});f.append(j);h.wau_load({fnc_step:function(a,b){},fnc_loaded:function(){j.hide();if(c.showNav){i.show();i.removeClass("n").eq(k).addClass("n")}h.hide().eq(k).show();if(b>0){clearTimeout(d);d=setTimeout(function(){n()},b)}if(c.bindAfter){c.bindAfter(f)}}})};var m=function(){var c=a(this).index();if(c!=k||e){k=c;i.removeClass("n").eq(k).addClass("n");h.hide().eq(k).show();if(b>0){clearTimeout(d);d=setTimeout(function(){n()},b)}}};var n=function(){e=false;h.eq(k).fadeOut();k++;if(k>=h.length){k=0}h.eq(k).stop().fadeIn("fast",function(){e=true;if(c.showNav){i.removeClass("n").eq(k).addClass("n")}h.hide().eq(k).show();clearTimeout(d);d=setTimeout(function(){n()},b)})};l()});return this}})(jQuery);

/*------------------------------------------------
wau_ToolTip
Copyright (C) WAUKE.Y All Rights Reserved.
------------------------------------------------*/
eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('(3(a){a.y.z=3(b){2 c=a.A({B:C,D:E,5:8,9:8,n:8,F:o,G:"H"},b);p.I(3(){2 b=a(p);2 d=a("#J");2 e=d.K(".L");d.t();2 f=10;2 g=M;2 h=10;2 i=10;2 j=0;2 k=0;2 l=3(){4(!b.q("6")){r o}4(b.q("6").N<1){r o}b.7(0).s=b.q("6");4(c.n){b.7(0).s=c.n}b.7(0).6="";b.O(3(a){4(c.5){d.P(c.5)}2 f=b.7(0).s;f=f.Q(/　/g,"<R />");e.S(f);d.T();4(c.9){e.U(c.9)}m(a)},3(){e.V();d.t();4(c.5){d.W(c.5)}}).X(3(a){m(a)})};2 m=3(b){j=b.Y+f;k=b.Z+g;4(j+d.u()+h>a(v).w()){j=a(v).w()-h-d.u()}d.11({12:j+"x",13:k+"x"})};l()});r p}})(14);',62,67,'||var|function|if|parentClass|title|get|null|parentAppend||||||||||||||content|false|this|attr|return|def_title|hide|outerWidth|window|width|px|fn|wau_ToolTip|extend|config|true|zindex|1e3|docMode|copyright|WAUKE|each|wau_tooltip|children|_txt|20|length|hover|addClass|replace|br|html|show|append|empty|removeClass|mousemove|pageX|pageY||css|left|top|jQuery'.split('|'),0,{}));

/*------------------------------------------------
wau_load
Copyright (C) WAUKE.Y All Rights Reserved.
------------------------------------------------*/
(function(a){a.fn.wau_load=function(b){var c=a.extend({fnc_loaded:null,fnc_step:null,copyright:"WAUKE"},b);var d=false;var e=0;var f=a(this);f.one("load",function(){e++;if(c.fnc_step){c.fnc_step(e,f.length)}if(e>=f.length&&!d){d=true;if(c.fnc_loaded){c.fnc_loaded()}}}).each(function(){if(this.complete){a(this).trigger("load")}})}})(jQuery);



