//フォントサイズ変更
jQuery(function($){
    var history = $.cookie('fontSize');
    var elm = $('body');
    (!history)? elm.addClass('font-m'):elm.addClass(history);
    $('dd','#header_fontsize').click(function(){
        var setFontSize = this.id;
    	$.cookie('fontSize', setFontSize);
        elm.removeClass().addClass(setFontSize);
    });
});

//ロールオーバースクリプト
jQuery(function($){
     $('a img').hover(function(){
        $(this).attr('src', $(this).attr('src').replace('_off.', '_on.'));
          }, function(){
             if (!$(this).hasClass('currentPage')) {
             $(this).attr('src', $(this).attr('src').replace('_on.', '_off.'));
        }
   });
});


//ツールチップ
jQuery(function($){
$(".business_item_list a").hover(function() {
	$(".business_item_list li").css("z-index","1");/*For IE*/
	$(this).parent("li").css("z-index","2");/*For IE*/
	$(this).next("span").animate({opacity: "show", top: "110"}, "slow");}, function() {
		$(this).next("span").animate({opacity: "hide", top: "120"}, "fast");
	});
});

//ページアップ
jQuery($(function(){
   $('a[href^=#]').click(function() {
      var speed = 800;// ミリ秒
      var href= $(this).attr("href");
      var target = $(href == "#" || href == "" ? 'html' : href);
      var position = target.offset().top;
      $($.browser.safari ? 'body' : 'html').animate({scrollTop:position}, speed, 'swing');
      return false;
   });
}));

jQuery($(function() {
	$(".popup").click(function(){
		window.open(this.href, "WindowName","width=600,height=500,resizable=no,scrollbars=no");
		return false;
	});
}));

//Color Box
/*$(document).ready(function(){
  $(".colorbox_map").colorbox({scrolling:false,iframe:true,innerWidth:600, innerHeight:440});
});*/


/* XHTML/HTML要素生成 */
function createHTMLElement(tagname) {
	return ( document.createElementNS )
		? document.createElementNS('http://www.w3.org/1999/xhtml', tagname)
		: document.createElement(tagname);
}

//PNG fix & FancyZoom
window.onload = function(){
var userAgent = window.navigator.userAgent.toLowerCase();
var appVersion = window.navigator.appVersion.toLowerCase();
if (userAgent.indexOf("msie") > -1) {
	if (appVersion.indexOf("msie 6.0") > -1 || appVersion.indexOf("msie 7.0") > -1) {
		var nhead = document.getElementsByTagName('head')[0];
		var nlink   = createHTMLElement('link');
		nlink.type  = 'text/javascript';
		nlink.href  = '/js/DD_belatedPNG_0.0.8a-min.js';
		nhead.appendChild(nlink);
	}
}
};


//////////////////////////////////////////////////////////////////
ad = $.extend({
	notOpenURL:'a[href^="http://www.denkyosha.co.jp/"],a[href^="https://www.denkyosha.co.jp/"]',
	domain:'http://www.denkyosha.co.jp/',
	s_domain:'https://www.denkyosha.co.jp/'
});
$(function(){
$('ul#content_menu').gnavActive();
});

$('a[href$=".pdf"],a[href$=".mpg"],a[href$=".doc"],a[href$=".docx"],a[href$=".xls"],a[href$=".xlsx"],a[href$=".wmv"]').css('text-decoration','none').not('a[href^="http://"],a[href^="https://"]').click(function(){
		window.open(this.href, '_blank');
		return false;
	});



$.fn.gnavActive=function(){
	var pagePath = location.href.replace(ad.domain,'/');
	var s_pagePath = location.href.replace(ad.s_domain,'/');
	return this.each(function(){
		$(this).find('a').each(function(){
			var myURL=$(this).attr('href');
			if((myURL==pagePath) || (myURL==s_pagePath)){
				$(this).children('img').attr('src', $(this).children('img').attr('src').replace('_off.', '_on.'));
				$(this).hover(function() {
							$(this).children('img').attr('src', $(this).children('img').attr('src').replace('_off.', '_on.'));
					});
			};
			
		});
		var expAdd='/ir/information-archive.html';
			if(pagePath==expAdd){
				$('ul#content_menu').find('a').each(function(){
					var myAttr=$(this).attr('title');
					if(myAttr=='IR資料'){
						$(this).children('img').attr('src', $(this).children('img').attr('src').replace('_off.', '_on.'));
						}
					});
			};
		
	});
	
}

