
/*----------------------------------------------

	Theme ESTIC CORPORATION.
	http://www.estic.co.jp/
	Description:Common Style Sheet　7-2-2009 (mm-dd-yyyy)
	Version:ver. 1.0

----------------------------------------------*/

function thisYear() {
	weeks=new Array('日','月','火','水','木','金','土');
	today=new Date();
	y=today.getFullYear();
	m=today.getMonth()+1;
	d=today.getDate();
	w=weeks[today.getDay()];
	document.write(y);
	document.close();
}



$(function() {
// for エラー: jQuery.dequeue is not a function
( function( $ ) {
$.dequeue = function( a , b ){
return $(a).dequeue(b);
};
})( jQuery );
});



$(document).ready(function() {

// 現在のページにクラスを追加

	$('#headerNavi').find('a').each(function(){
		if( location.href.indexOf(this.href) != -1) {
			$(this).addClass('current');
		}
	});

	$('#sideNavi').find('a').each(function(){
		if( location.href.indexOf(this.href) != -1) {
			$(this).addClass('current');
		}
	});

	$('#footerNavi').find('a').each(function(){
		if( location.href.indexOf(this.href) != -1) {
			$(this).addClass('current');
		}
	});

// ロールオーバーボタンにクラスを追加
	var conf = {
		className : 'btn',
		postfix : '_over'
	};
	$('img.'+conf.className).hover(
		function() {
			this.originalSrc = this.src;
			this.src = this.originalSrc.replace(/(\.gif|\.jpg|\.png)/,conf.postfix+'$1');
		},
		function() {
			this.src = this.originalSrc;
	});
	$('input.'+conf.className).hover(
		function() {
			this.originalSrc = this.src;
			this.src = this.originalSrc.replace(/(\.gif|\.jpg|\.png)/,conf.postfix+'$1');
		},
		function() {
			this.src = this.originalSrc;
	});

// ページトップへスムーズスクロール
	$('#scrollPageTop a,.scrollPageTop a').click(function() {
		$('#container').ScrollTo(1000, 'easeout');
		return false;
	});

// 新規ウインドウオープン

	$('a.blank,a.external').click(function() {
		//window.open(this.href, '_blank').focus();
		//return false;
		$(this).attr({target: '_blank'}).focus();
	});



	var popupEvent = function(event) {
		var option = 'width=1000,height='+screen.availHeight+',left=0,top=0,scrollbars=yes,resizable=yes,toolbar=yes,menubar=yes,status=yes,location=yes,directories=yes,addressbar=yes';
		window.open(this.href, this.rel, option).focus();
		event.preventDefault();
		event.stopPropagation();
	}
	$('a.popup').each(function(i) {
		$(this).click(popupEvent);
		$(this).keypress(popupEvent);
	});

// フォーカスで消える文字
	$('#Comments')
		.focus(function() {
			$(this).val('');
		})
		.blur(function() {
			if ($(this).val()=='') {
				$(this).val('お問い合わせ内容をどうぞ。')
			};
	});

	$('a[@href$=pdf]').addClass('pdf');
	$('a[@href$=xls]').addClass('xls');
	$('a[@href$=ppt]').addClass('ppt');
	$('a[@href$=doc]').addClass('doc');



	$('input[@type="text"],textarea').hover(
		function() {
			$(this).addClass('hover');
		},
		function() {
			$(this).removeClass('hover');
	});

	$('input[@type="text"],textarea').focus(function() {
		$(this).addClass('focus');
	});

	$('input[@type="text"],textarea').blur(function(){
		$(this).removeClass('focus');
	});

	$('#newGraduateEntryBlock input#submit,#newGraduateEntryBlock input#reset').hover(
		function() {
			$(this).addClass('hoverBtn');
		},
		function() {
			$(this).removeClass('hoverBtn');
	});

	$('#careerEntryBlock input#submit,#careerEntryBlock input#reset').hover(
		function() {
			$(this).addClass('hoverBtn');
		},
		function() {
			$(this).removeClass('hoverBtn');
	});

	$('#requestBlock input#submit,#requestBlock input#reset').hover(
		function() {
			$(this).addClass('hoverBtn');
		},
		function() {
			$(this).removeClass('hoverBtn');
	});

	$('#errorBlock input#back').hover(
		function() {
			$(this).addClass('hoverBtn');
		},
		function() {
			$(this).removeClass('hoverBtn');
	});

	$('#confirmBlock input#send,#confirmBlock input#back').hover(
		function() {
			$(this).addClass('hoverBtn');
		},
		function() {
			$(this).removeClass('hoverBtn');
	});



// サイドナビゲーション　ホールド

	$('#sideNavi dt').click(function(){
		$(this).next('dd').slideToggle('slow')
		.siblings('dd:visible').slideUp('slow');
		$(this).toggleClass('active');
		$(this).siblings('#sideNavi dt').removeClass('active');
	});

	$('#sideNavi dt').hover(
		function() {
			$(this).addClass('hover');
		},
		function() {
			$(this).removeClass('hover');
	});



// カタログ　ブロックリンク

	/*$('#catalog dl').hover(
		function() {
			$(this).addClass('hover');
			$(this).find('dd').addClass('hover');
		},
		function() {
			$(this).removeClass('hover');
			$(this).find('dd').removeClass('hover');
	});*/

	$('a.eBookLink').click(function() {
		//window.open(this.href, 'eBook').focus();
		//return false;
		$(this).attr({target: 'eBook'}).focus();
	});

	/*$('#catalog dl.pdf').click(function(){
		window.location=$(this).find('a').attr('href');return false;
	});

	$('#catalog dl.pdf').click(function() {
		var option = $(this).find('a').attr('href');
		window.open(option, '_blank').focus();
		return false;
	});

	$('#catalog dl.sNut').click(function() {
		var option = $(this).find('a').attr('href');
		window.open(option, 'sNut').focus();
		return false;
	});

	$('#catalog dl.eBook').click(function(){
		var option = $(this).find('a').attr('href');
		window.open(option, 'eBook').focus();
		return false;
	});

	$('#catalog dl.sPress').click(function() {
		var option = $(this).find('a').attr('href');
		window.open(option, 'sPress').focus();
		return false;
	});*/

	$('.sNut img,.eBook img,.sPress img').hover(
		function() {
			this.originalSrc = this.src;
			this.src = this.originalSrc.replace(/(\.gif|\.jpg|\.png)/,'_over'+'$1');
		},
		function() {
			this.src = this.originalSrc;
	});

	$('.sNut a').click(function() {
		$(this).attr({target: 'sNut'}).focus();
		//$(this).attr('target','sNut');
	});

	$('.eBook a').click(function() {
		//window.open(this.href, 'eBook').focus();
		//return false;
		$(this).attr({target: 'eBook'}).focus();
	});

	$('.sPress a').click(function() {
		$(this).attr({target: 'sPress'}).focus();
	});

});

