﻿// JavaScript Document

$(document).ready(function(){
						   
						   
//トップテロップ						   
$("body#top ul#menu li").each(function(){
							  $(this).hover(
  function () {
    $(this).addClass("fst");
	$(this).append('<img class="gush_top" src="/img/gush_top.png" />');
	$("#gush p,ul#menu li .df").hide();
	
  },
  function () {
    $(this).removeClass("fst");
	$(this).find('.gush_top').hide();
	$("#gush p,ul#menu li .df").show();
  }
);
});


var tip = $("#tip li");
$("#navi li").each(function(i){
$(this).find("img").attr("src",$(this).find("img").attr("src").replace("_n.", "_m."));
$(this).hover( 
  function () {
    tip.eq(i).fadeIn("fast");
	$(this).find("img").attr("src",$(this).find("img").attr("src").replace("_m.", "_r."));
//tip.eq(i).show();
  },
function () {
	tip.eq(i).hide();
	$(this).find("img").attr("src",$(this).find("img").attr("src").replace("_r.", "_m."));
	tip.eq(i).hover(
  function () {
	  $("#navi li").eq(i).find("img").attr("src",$("#navi li").eq(i).find("img").attr("src").replace("_m.", "_r."));
   $(this).show();
  },
  function () {
	  	  $("#navi li").eq(i).find("img").attr("src",$("#navi li").eq(i).find("img").attr("src").replace("_r.", "_m."));
//   $(this).fadeOut("fast");
	    $(this).hide();
  });
  }//outend
);
});

//フォーム選択
var form_id = $("body#body_form.app");
form_id.find("#creapp,#bnkapp,#btn_pagetop").hide();
form_id.find("#bnkbtn").click(function () {
form_id.find("#bnkapp").fadeIn();
form_id.find("#btn_pagetop").show();
form_id.find("#creapp").hide();
});
form_id.find("#crebtn").click(function () {
form_id.find("#creapp").fadeIn();
form_id.find("#btn_pagetop").show();
form_id.find("#bnkapp").hide();
});


//フォーム維持

  if ($.cookie("a")) {//既に対応するcookieを持っていたら  
            $.cookie("a", '', { expires: -1,path:'/' });//cookieを削除  
			form_id.find("#bnkapp,#btn_pagetop").show();
        }
var form_id = $("body#body_form.app");
form_id.find("#bnkapp input").click(function () {
$.cookie("a",1,{expires:7,path:'/'});//cookieをセットする  
});
$("body.sec:not(.app)").load(function () {
$.cookie("a", '', { expires: -1,path:'/' });
});
							  

//MLトルグ
var ser_id = $("body#body_ser");
ser_id.find(".wraptable").hide();
ser_id.find(".opentbl").click(function () {
$(this).next().slideToggle("fast");
});
ser_id.find(".opentbl").toggle(function () {
$(this).find(".dtlopen").attr('src',"/img/ar_close_n.png");
},
function () {
$(this).find(".dtlopen").attr('src',"/img/ar_detail_n.png");

}
);
ser_id.find(".opentbl").hover(function ()  {
 $(this).css("background", "url(/service/img/dot_black_7.gif) repeat-y #def3f4");
},
function () {
 $(this).css("background", "url(/service/img/dot_black_7.gif) repeat-y #c3cfd4");
}
);

//FAQトルグ
var faq_id = $("body#body_faq");
faq_id.find(".wraptable").hide();
faq_id.find(".opentbl").click(function () {
$(this).next().slideToggle("fast");
});
faq_id.find(".opentbl").toggle(function () {
$(this).find(".dtlopen").attr('src',"/img/ar_close_n.png");
},
function () {
$(this).find(".dtlopen").attr('src',"/img/ar_answer_n.png");

}
);
faq_id.find(".opentbl").hover(function () {
 $(this).css("background", "#fff");
},
function () {
 $(this).css("background", "#f5f5f5");
}
);
//HITトルグ
var hit_id = $("body#body_hit");
hit_id.find(".wraptable").hide();
hit_id.find(".opentbl").click(function () {
$(this).next().slideToggle("fast");
});
hit_id.find(".opentbl").toggle(function () {
$(this).find(".dtlopen").attr('src',"/img/ar_close_n.png");
},
function () {
$(this).find(".dtlopen").attr('src',"/img/ar_detail_n.png");
}
);
hit_id.find(".opentbl").hover(function () {
 $(this).css("background", "#fff");
},
function () {
 $(this).css("background", "#f5f5f5");
}
);

//blog toggle
var hit_id = $("body#body_blog");
var c =  $("body").attr("class");
hit_id.find("#morepane li:lt(12)").hide();
if ($.cookie(c)) {
hit_id.find("#morepane").show();
hit_id.find("#open_pane img").attr('src',"/img/ar_bloclose_n.gif");
hit_id.find("#open_pane").toggle(function () {
$(this).find("img").attr('src',"/img/ar_blomore_n.gif");
},
function () {
$(this).find("img").attr('src',"/img/ar_bloclose_n.gif");
}
);
}else{
hit_id.find("#morepane").hide();}
hit_id.find("#open_pane").click(function () {
if ($.cookie(c)) {
$.cookie(c, '', { expires: -1,path:'/' });
        } else {  
$.cookie(c,1,{expires:7,path:'/'});//cookieをセットする  
        }  $(this).next().slideToggle("fast");
});
hit_id.find("#open_pane").toggle(function () {
$(this).find("img").attr('src',"/img/ar_bloclose_n.gif");
},
function () {
$(this).find("img").attr('src',"/img/ar_blomore_n.gif");
}
);

//カレント
var href = location.href.split('#')[0];
//href = href.replace(/[/]$/,'/index.html');
$("#navi li a").each(function() {
if (href.match("/service/rev.html")){}
else  if (href.match(this.href)){
	  $(this).find("img").attr("src",$(this).find("img").attr("src").replace("_m.", "_c."));
	  $(this).removeAttr('href');
	  $(this).parent().unbind("mouseenter").unbind("mouseleave");
}
});//each
$("#snavi li a").each(function() {
  if (href.match(this.href)){
	  $(this).find("img").attr("src",$(this).find("img").attr("src").replace("_n.", "_c."));
	  $(this).removeAttr('href');
}
});//each
$("#topfree_info dd a").each(function() {
	if (href.match(this.href)){
	  $(this).removeAttr('href');
	  $(this).css("color","#338CC7");
	 $(this).hover(function(){
				$(this).css("text-decoration","none")			
							});
}
});

//HIT&BLOGleft ul
var hit_id = $("body#body_hit,body#body_blog");
var href = location.href.split('#')[0];
//href = href.replace(/[/]$/,'/index.html');
hit_id.find('#left_area .leftmenu a').each(function() {
  if (href==this.href){
	  $(this).parent().css("background","url(/service/img/dot_black_7.gif) #FFF repeat-y");
	  $(this).removeAttr('href');
	  $(this).hover(function(){
	  $(this).css("text-decoration","none").css("color","#214f6c");
 });//ho
}//if
else if (href.match("/column/$|/condition/$|/confused/$|/hit/$")){
hit_id.find('#left_area .leftmenu a:eq(0)').parent().css("background","url(/service/img/dot_black_7.gif) #FFF repeat-y");
hit_id.find('#left_area .leftmenu a:eq(0)').removeAttr('href');
hit_id.find('#left_area .leftmenu a:eq(0)').hover(function(){
	$(this).css("text-decoration","none").css("color","#214f6c");
	 });//ho
}
});//each


//疑似クラス
$("body#body_evi .sl_u span,body#body_rev .sl_u span").hover(function () {
 $(this).addClass("hover");
},
function () {
 $(this).removeClass("hover");
}
);

//sincr追記
//$("#footer .cp").append('<p class="mg_T_8 tx11">since 1994/The incorporation of enterprise in 2005.</p>')
$("body:not(#body_form) #header").append('<img id="since" class="png" src="/img/since.png" alt="since 1994/The incorporation of enterprise in 2005." />');
$("body#body_form #header").append('<img id="since" class="png" src="../../img/since.png" alt="since 1994/The incorporation of enterprise in 2005." />');




});/////////readyEND

/*
CSS Browser Selector v0.3.1
Rafael Lima (http://rafael.adm.br)
*/
function css_browser_selector(u){var ua = u.toLowerCase(),is=function(t){return ua.indexOf(t)>-1;},g='gecko',w='webkit',s='safari',h=document.getElementsByTagName('html')[0],b=[(!(/opera|webtv/i.test(ua))&&/msie\s(\d)/.test(ua))?('ie ie'+RegExp.$1):is('firefox/2')?g+' ff2':is('firefox/3')?g+' ff3':is('gecko/')?g:/opera(\s|\/)(\d+)/.test(ua)?'opera opera'+RegExp.$2:is('konqueror')?'konqueror':is('chrome')?w+' '+s+' chrome':is('applewebkit/')?w+' '+s+(/version\/(\d+)/.test(ua)?' '+s+RegExp.$1:''):is('mozilla/')?g:'',is('j2me')?'mobile':is('iphone')?'iphone':is('ipod')?'ipod':is('mac')?'mac':is('darwin')?'mac':is('webtv')?'webtv':is('win')?'win':is('freebsd')?'freebsd':(is('x11')||is('linux'))?'linux':'','js']; c = b.join(' '); h.className += ' '+c; return c;}; css_browser_selector(navigator.userAgent);
//* CSS Browser Selector  END


/*====================================================================================================
//////////////////////////////////////////////////////////////////////////////////////////////////////

 Author : http://www.yomotsu.net
 created: 2007/03/13
 update : 2008/01/21
 Licensed under the GNU Lesser General Public License version 2.1

//////////////////////////////////////////////////////////////////////////////////////////////////////
====================================================================================================*/
var yomotsuRollover = {
	
	main : function() {
		var img = document.images, ipt = document.getElementsByTagName('input'), i, preLoadImg = [];
		// img elements
		for (i = 0; i <img.length; i++) {
			if ((img[i].src.match(/.*_n\./))||(img[i].style.filter)){
				preLoadImg[preLoadImg.length] = new Image;
				preLoadImg[preLoadImg.length-1].src = img[i].src.replace('_n.', '_r.');

				img[i].onmouseover = yomotsuRollover.over;
				img[i].onmouseout  = yomotsuRollover.out;
				try {img[i].addEventListener('click', yomotsuRollover.click, false);}
				catch(e){img[i].attachEvent('onclick', (function(el){return function(){yomotsuRollover.click.call(el);};})(img[i]));}
			}
		}
		// input[image] elements
		for (i = 0; i <ipt.length; i++) {
			if ((ipt[i].src.match(/.*_n\./))&&(ipt[i].getAttribute('type')=='image')){
				preLoadImg[preLoadImg.length] = new Image;
				preLoadImg[preLoadImg.length-1].src = img[i].src.replace('_n.', '_r.');

				ipt[i].onmouseover = yomotsuRollover.over;
				ipt[i].onmouseout  = yomotsuRollover.out;
				try {ipt[i].addEventListener('click', yomotsuRollover.click, false);}
				catch(e){ipt[i].attachEvent('onclick', (function(el){return function(){yomotsuRollover.click.call(el);};})(ipt[i]));}
			}
		}
	}
	,
	
	over : function() {
		var imgSrc, preLoadImgSrc;
		if((this.style.filter)&&(this.style.filter.match(/_n\.png/)))//(IE5.5-6 && png)
			this.style.filter = this.style.filter.replace('_n.png', '_r.png');
		else
			this.src = this.src.replace('_n.', '_r.');
	},

	out : function(){
		if((this.style.filter)&&(this.style.filter.match(/_r\.png/)))//(IE5.5-6 && png)
			this.style.filter = this.style.filter.replace('_r.png', '_n.png');
		else
			this.src = this.src.replace('_r.', '_n.');
	},
	
	click : function(){
		if((this.style.filter)&&(this.style.filter.match(/_r\.png/)))//(IE5.5-6 && png)
			this.style.filter = this.style.filter.replace('_r.png', '_n.png');
		else
			this.src = this.src.replace('_r.', '_n.');
	},

	addEvent : function(){
		try {
			window.addEventListener('load', this.main, false);

		} catch (e) {
			window.attachEvent('onload', this.main);

		}
	}
}

yomotsuRollover.addEvent();

new function(){			
function bb(){
$(".bb").each(
  function () {
   this.onmouseout = function(){ yomotsuRollover; return false; };
   this.onmouseover = function(){ yomotsuRollover; return false; };
  }); 
		}
			function addEvent(elm,listener,fn){
		try{
			elm.addEventListener(listener,fn,false);
		}catch(e){
			elm.attachEvent("on"+listener,fn);
		}
	}
addEvent(window,"load",bb)
}



/*--------------------------------------------------------------------------*
 *  ロールオーバー
 *--------------------------------------------------------------------------*/

new function(){
	function imageReplace(){
		var btnClassName = "btn";
		var objAll = document.getElementsByTagName ? document.getElementsByTagName("*") : document.all;
		for (var i = 0; i < objAll.length; i++) {
			var btn=false;
			var eltClass = objAll[i].className.split(/\s+/);
			for (var j = 0; j < eltClass.length; j++) {
				if (eltClass[j] == btnClassName)btn = true;
			}
			if(btn == true){
				if(objAll[i].originalSrc){
					objAll[i].rolloverSrc = objAll[i].originalSrc.replace(/(\.gif|\.jpg|\.png)$/,"_on$1");
						objAll[i].onmouseover = function(){
							this.style.filter ="progid:DXImageTransform.Microsoft.AlphaImageLoader(src="+this.rolloverSrc+",sizingMethod='scale')";
						}
						objAll[i].onmouseout = function(){
							this.style.filter ="progid:DXImageTransform.Microsoft.AlphaImageLoader(src="+this.originalSrc+",sizingMethod='scale')";
						}
				}else{
					if(objAll[i].nodeName=="IMG"){
						objAll[i].originalSrc = objAll[i].src
						objAll[i].rolloverSrc = objAll[i].src.replace(/(\.gif|\.jpg|\.png)$/,"_on$1")
						objAll[i].onmouseover = function(){
							this.src = this.rolloverSrc;
						}
						objAll[i].onmouseout = function(){
							this.src = this.originalSrc;
						}
					}
				}
			}
		}
	}
		function addEvent(elm,listener,fn){
		try{
			elm.addEventListener(listener,fn,false);
		}catch(e){
			elm.attachEvent("on"+listener,fn);
		}
	}
	addEvent(window,"load",imageReplace)
}

/**
 * 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') { // name and value given, set cookie
        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(); // use expires attribute, max-age is not supported by IE
        }
        // CAUTION: Needed to parenthesize options.path and options.domain
        // in the following expressions, otherwise they evaluate to undefined
        // in the packed version for some reason...
        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 { // only name given, get cookie
        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]);
                // Does this cookie string begin with the name we want?
                if (cookie.substring(0, name.length + 1) == (name + '=')) {
                    cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
                    break;
                }
            }
        }
        return cookieValue;
    }
};

/* Copyright (c) 2008 Kean Loong Tan http://www.gimiti.com/kltan
 * Licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
 * jFlow
 * Version: 1.2 (July 7, 2008)
 * Requires: jQuery 1.2+
 */
 
(function($) {

	$.fn.jFlow = function(options) {
		var opts = $.extend({}, $.fn.jFlow.defaults, options);
		var randNum = Math.floor(Math.random()*11);
		var jFC = opts.controller;
		var jFS =  opts.slideWrapper;
		var jSel = opts.selectedWrapper;

		var cur = 0;
		var maxi = $(jFC).length;
		// sliding function
		var slide = function (dur, i) {
			$(opts.slides).children().css({
				overflow:"hidden"
			});
			$(opts.slides + " iframe").hide().addClass("temp_hide");
			$(opts.slides).animate({
				marginLeft: "-" + (i * $(opts.slides).find(":first-child").width() + "px")}, 
				opts.duration*(dur),
				opts.easing,
				function(){
					$(opts.slides).children().css({
						overflow:"auto"
					});
					$(".temp_hide").show();
				}
			);
			
		}
		$(this).find(jFC).each(function(i){
			$(this).click(function(){
				if ($(opts.slides).is(":not(:animated)")) {
					$(jFC).removeClass(jSel);
					$(this).addClass(jSel);
					var dur = Math.abs(cur-i);
					slide(dur,i);
					cur = i;
				}
			});
		});	
		//複数カスタム
		$(this).find(".jFlowControl2").each(function(i){
			$(this).click(function(){
				if ($(opts.slides).is(":not(:animated)")) {
					$(jFC).removeClass(jSel);
					$(this).addClass(jSel);
					var dur = Math.abs(cur-i);
					slide(dur,i);
					cur = i;
				}
			});
		});	
		$(this).find(".jFlowControl3").each(function(i){
			$(this).click(function(){
				if ($(opts.slides).is(":not(:animated)")) {
					$(jFC).removeClass(jSel);
					$(this).addClass(jSel);
					var dur = Math.abs(cur-i);
					slide(dur,i);
					cur = i;
				}
			});
		});	
		$(this).find(".jFlowControl4").each(function(i){
			$(this).click(function(){
				if ($(opts.slides).is(":not(:animated)")) {
					$(jFC).removeClass(jSel);
					$(this).addClass(jSel);
					var dur = Math.abs(cur-i);
					slide(dur,i);
					cur = i;
				}
			});
		});	
		$(this).find(".jFlowControl5").each(function(i){
			$(this).click(function(){
				if ($(opts.slides).is(":not(:animated)")) {
					$(jFC).removeClass(jSel);
					$(this).addClass(jSel);
					var dur = Math.abs(cur-i);
					slide(dur,i);
					cur = i;
				}
			});
		});	
		$(this).find(".jFlowControl6").each(function(i){
			$(this).click(function(){
				if ($(opts.slides).is(":not(:animated)")) {
					$(jFC).removeClass(jSel);
					$(this).addClass(jSel);
					var dur = Math.abs(cur-i);
					slide(dur,i);
					cur = i;
				}
			});
		});	
		//カスタムend
		$(opts.slides).before('<div id="'+jFS.substring(1, jFS.length)+'"></div>').appendTo(jFS);
		
		$(opts.slides).find("div").each(function(){
			$(this).before('<div class="jFlowSlideContainer"></div>').appendTo($(this).prev());
		});
		
		//initialize the controller
		$(jFC).eq(cur).addClass(jSel);
		
		var resize = function (x){
			$(jFS).css({
				position:"relative",
				width: opts.width,
				height: opts.height,
				overflow: "hidden"
			});
			//opts.slides or #mySlides container
			$(opts.slides).css({
				position:"relative",
				width: $(jFS).width()*$(jFC).length+"px",
				height: $(jFS).height()+"px",
				overflow: "hidden"
			});
			// jFlowSlideContainer
			$(opts.slides).children().css({
				position:"relative",
				width: $(jFS).width()+"px",
				height: $(jFS).height()+"px",
				"float":"left",
				overflow:"auto"
			});
			
			$(opts.slides).css({
				marginLeft: "-" + (cur * $(opts.slides).find(":eq(0)").width() + "px")
			});
		}
		
		// sets initial size
		resize();

		// resets size
		$(window).resize(function(){
			resize();						  
		});
		
		$(opts.prev).click(function(){
			if ($(opts.slides).is(":not(:animated)")) {
				var dur = 1;
				if (cur > 0)
					cur--;
				else {
					cur = maxi -1;
					dur = cur;
				}
				$(jFC).removeClass(jSel);
				slide(dur,cur);
				$(jFC).eq(cur).addClass(jSel);
			}
		});
		
		$(opts.next).click(function(){
			if ($(opts.slides).is(":not(:animated)")) {
				var dur = 1;
				if (cur < maxi - 1)
					cur++;
				else {
					cur = 0;
					dur = maxi -1;
				}
				$(jFC).removeClass(jSel);
				slide(dur, cur);
				$(jFC).eq(cur).addClass(jSel);
			}
		});
	};
	
	$.fn.jFlow.defaults = {
		controller: ".jFlowControl", // must be class, use . sign
		slideWrapper : "#jFlowSlide", // must be id, use # sign
		selectedWrapper: "jFlowSelected",  // just pure text, no sign
		easing: "swing",
		duration: 400,
		width: "100%",
		prev: ".jFlowPrev", // must be class, use . sign
		next: ".jFlowNext" // must be class, use . sign
	};
	
})(jQuery);
//上に戻る
$(function () {
//    if (! $.browser.safari) {
		var b =$("body#body_evi")
        b.find(".jFlowControl2,.jFlowControl3,.jFlowControl4,.jFlowControl5,.jFlowControl6, .sl_u i.btm").click(function () {
            $(this).blur();
            $('html,body').animate({ scrollTop: 600 }, 'slow');
            return false;
        });
//    }
});
$(function () {
//     if (! $.browser.safari) {
		var b =$("body#body_rev")
        b.find(".jFlowControl2,.jFlowControl3,.jFlowControl4,.jFlowControl5,.jFlowControl6, .sl_u i.btm").click(function () {
            $(this).blur();
            $('html,body').animate({ scrollTop: 360 }, 'slow');
            return false;
        });
//     }
});



