//Analytics
  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-24095619-1']);
  _gaq.push(['_trackPageview']);

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();




//ブラウザの取得
var Win=(navigator.userAgent.indexOf("Win")!=-1);
var Mac=(navigator.userAgent.indexOf("Mac")!=-1);
var Explorer5=(navigator.userAgent.indexOf("MSIE 5")!=-1);
var Explorer50=(navigator.userAgent.indexOf("MSIE 5.0")!=-1);
var Explorer55=(navigator.userAgent.indexOf("MSIE 5.5")!=-1);
var Explorer6=(navigator.userAgent.indexOf("MSIE 6")!=-1);
var Netscape=(navigator.appName.indexOf("Netscape")!=-1);
var opera=(navigator.userAgent.indexOf("Opera")!=-1);
var Version=navigator.appVersion.charAt(0);


//ブラウザの振り分け
if(Win && Explorer6){	//Win IE6
//	DD_belatedPNG.fix('img,.img_rigth'); //PNG適用する要素,id,class  
}


//別ウィンドウオープン
function MM_openBrWindow(theURL,winName,features) { //v2.0
//  window.open(theURL,winName,"width=800,height=700,scrollbars=yes");
  window.open(theURL,winName,features);
}


//ロールオーバー
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

//印刷
function print_button(){
  print();
}


//ブックマーク 
function addBookmark(title,url) {
	if( document.all ) {
		window.external.AddFavorite( url, title);
	} else if (window.sidebar) {
		window.sidebar.addPanel(title, url,"");
	} else if( window.opera && window.print ) {
		return true;
	}
} 


/*--------------------------------------------------------------------------*
 *  
 *  heightLine JavaScript Library beta4
 *  
 *  MIT-style license. 
 *  
 *  2007 Kazuma Nishihata 
 *  http://www.webcreativepark.net
 *  
 *--------------------------------------------------------------------------*/
new function(){
	
	function heightLine(){
	
		this.className="heightLine";
		this.parentClassName="heightLineParent"
		reg = new RegExp(this.className+"-([a-zA-Z0-9-_]+)", "i");
		objCN =new Array();
		var objAll = document.getElementsByTagName ? document.getElementsByTagName("*") : document.all;
		for(var i = 0; i < objAll.length; i++) {
			var eltClass = objAll[i].className.split(/\s+/);
			for(var j = 0; j < eltClass.length; j++) {
				if(eltClass[j] == this.className) {
					if(!objCN["main CN"]) objCN["main CN"] = new Array();
					objCN["main CN"].push(objAll[i]);
					break;
				}else if(eltClass[j] == this.parentClassName){
					if(!objCN["parent CN"]) objCN["parent CN"] = new Array();
					objCN["parent CN"].push(objAll[i]);
					break;
				}else if(eltClass[j].match(reg)){
					var OCN = eltClass[j].match(reg)
					if(!objCN[OCN]) objCN[OCN]=new Array();
					objCN[OCN].push(objAll[i]);
					break;
				}
			}
		}
		
		//check font size
		var e = document.createElement("div");
		var s = document.createTextNode("S");
		e.appendChild(s);
		e.style.visibility="hidden"
		e.style.position="absolute"
		e.style.top="0"
		document.body.appendChild(e);
		var defHeight = e.offsetHeight;
		
		changeBoxSize = function(){
			for(var key in objCN){
				if (objCN.hasOwnProperty(key)) {
					//parent type
					if(key == "parent CN"){
						for(var i=0 ; i<objCN[key].length ; i++){
							var max_height=0;
							var CCN = objCN[key][i].childNodes;
							for(var j=0 ; j<CCN.length ; j++){
								if(CCN[j] && CCN[j].nodeType == 1){
									CCN[j].style.height="auto";
									max_height = max_height>CCN[j].offsetHeight?max_height:CCN[j].offsetHeight;
								}
							}
							for(var j=0 ; j<CCN.length ; j++){
								if(CCN[j].style){
									var stylea = CCN[j].currentStyle || document.defaultView.getComputedStyle(CCN[j], '');
									var newheight = max_height;
									if(stylea.paddingTop)newheight -= stylea.paddingTop.replace("px","");
									if(stylea.paddingBottom)newheight -= stylea.paddingBottom.replace("px","");
									if(stylea.borderTopWidth && stylea.borderTopWidth != "medium")newheight-= stylea.borderTopWidth.replace("px","");
									if(stylea.borderBottomWidth && stylea.borderBottomWidth != "medium")newheight-= stylea.borderBottomWidth.replace("px","");
									CCN[j].style.height =newheight+"px";
								}
							}
						}
					}else{
						var max_height=0;
						for(var i=0 ; i<objCN[key].length ; i++){
							objCN[key][i].style.height="auto";
							max_height = max_height>objCN[key][i].offsetHeight?max_height:objCN[key][i].offsetHeight;
						}
						for(var i=0 ; i<objCN[key].length ; i++){
							if(objCN[key][i].style){
								var stylea = objCN[key][i].currentStyle || document.defaultView.getComputedStyle(objCN[key][i], '');
									var newheight = max_height;
									if(stylea.paddingTop)newheight-= stylea.paddingTop.replace("px","");
									if(stylea.paddingBottom)newheight-= stylea.paddingBottom.replace("px","");
									if(stylea.borderTopWidth && stylea.borderTopWidth != "medium")newheight-= stylea.borderTopWidth.replace("px","")
									if(stylea.borderBottomWidth && stylea.borderBottomWidth != "medium")newheight-= stylea.borderBottomWidth.replace("px","");
									objCN[key][i].style.height =newheight+"px";
							}
						}
					}
				}
			}
		}
		
		checkBoxSize = function(){
			if(defHeight != e.offsetHeight){
				changeBoxSize();
				defHeight= e.offsetHeight;
			}
		}
		changeBoxSize();
		setInterval(checkBoxSize,1000)
		window.onresize=changeBoxSize;
	}
	
	function addEvent(elm,listener,fn){
		try{
			elm.addEventListener(listener,fn,false);
		}catch(e){
			elm.attachEvent("on"+listener,fn);
		}
	}
	addEvent(window,"load",heightLine);
}

//////////////////////////////////////////////////////////////////////
$(function(){

	//用語の解説、Q&A
	$(".description").css("display","none");

$(".word .show").click(function(){

		if($("+.description",this).css("display")=="block"){
			$("+.description",this).css("display","none");
				$("a",this).text("+ 解説を見る");
	}else if($("+.description",this).css("display")=="none"){
			$("+.description",this).css("display","block");
			$("a",this).text("- 解説を閉じる");
		}

});

$(".faq .show").click(function(){

		if($("+.description",this).css("display")=="block"){
			$("+.description",this).css("display","none");
				$("a",this).text("+ 回答を見る");
	}else if($("+.description",this).css("display")=="none"){
			$("+.description",this).css("display","block");
			$("a",this).text("- 回答を閉じる");
		}

});



//ドロップダウンメニュー//

	$("#header ul.submenu").hide();
	$("ul.menu_langage li").hover(function(){
		$("ul:not(:animated)",this).slideDown("normal");
	},function(){
		$("ul",this).slideUp("fast");
	});


//ナビゲーションのカレントディレクトリ//
// クラス名を取得
	var class_name = $("body").attr("class");
	current_name = "#navi_"+class_name;

	$("a",current_name).addClass("active");


//検索
	$("select.search_select").change(function(){
		searc_url = $(this).val();
		$(this).parents("form").attr("action",searc_url)
	});


});




//スクロール
function getScroll(){
	var x, y;
	if(document.all !== void 0){ // IE4, IE5, IE6
		x = document.body.scrollLeft;
		y = document.body.scrollTop;
	}else if(document.layers !== void 0 || (navigator.userAgent.indexOf("Opera") != -1 || window.opera !== void 0)){ // NN4, Opera6
		x = window.pageXOffset;
		y = window.pageYOffset;
	}else if(navigator.userAgent.indexOf("Gecko") != -1){ // NS6, Mozilla
		x = window.scrollX;
		y = window.scrollY;
	}else{
		x = y = 0;
	}
	return {x: x, y: y};
}

var SCROLL ;
var divCountScroller = 30 ;

function scroller( x, y, edging, count ){
	if( count === void 0 ){
		count = 0 ;
		SCROLL = getScroll();
	}
	if( count++ < divCountScroller ){
		var c = count/divCountScroller ;
		var nx = SCROLL.x+( x-SCROLL.x )*( c+edging/(100*Math.PI)*Math.sin( Math.PI*c ) );
		var ny = SCROLL.y+( y-SCROLL.y )*( c+edging/(100*Math.PI)*Math.sin( Math.PI*c ) );
		
		window.scrollTo( nx, ny );
		setTimeout( "scroller("+x+","+y+","+edging+","+count+");", 3 );
	}

}





