// Different CSS depending on OS (mac/pc)- c Dynamic Drive (www.dynamicdrive.com)
var csstype="inline" //Specify type of CSS to use. "Inline" or "external" 
var mac_css='.sMenuh { letter-spacing: -1px; }'
var pc_css='.sMenu { letter-spacing: 0px; }'
var mactest=navigator.userAgent.indexOf("Mac")!=-1 
if (csstype=="inline"){ 
document.write('<style type="text/css">') 
if (mactest) 
document.write(mac_css) 
else
document.write(pc_css) 
document.write('</style>') 
}
//else if (csstype=="external")


// FontSize
$(document).ready(function() {
	if($.cookie('TEXT_SIZE')) {
		$('body').addClass($.cookie('TEXT_SIZE'));
	}
	$('#switch a').click(function() {
		var textSize = $(this).parent().attr('class');
		$('body').removeClass('sizeS sizeM sizeL').addClass(textSize);
		$.cookie('TEXT_SIZE',textSize, { path: '/', expires: 10000 });
		return false;
	});
});


// jQuery Side Search
$(function(){
	$('#sSearch input.ip').focus(function(){
		$(this).val('').css("color","#333");;
	});
});


// Smoothscroll  ------------ //
var span = 1000;
var effect = 'easeOutQuint';

$(function() {
	var ua = $.browser;
	$("a.scroll, .pagetop a, #qaList a").click(function() {
		if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) {
			$(this).blur();
			var t = navigator.appName.match(/Opera/) ? "html" : "html,body";
			$(t).queue([]).stop();
			var $targetElement = $(this.hash);
			var scrollTo = $targetElement.offset().top;
			if (window.scrollMaxY) {
				var maxScroll = window.scrollMaxY;
			} else {
				var maxScroll = document.documentElement.scrollHeight - document.documentElement.clientHeight;
			}
			if (scrollTo > maxScroll){
				scrollTo = maxScroll;
			}
			$(t).animate({ scrollTop: scrollTo }, span, effect);
			return false;
		}
	});
});


// Fade Image  ------------ //
// Common
$(document).ready(
  function(){
    $("img.imgOver, .imgOver a img, .submit input").hover(function(){
       $(this).fadeTo("fast", 0.7);
    },function(){
       $(this).fadeTo("fast", 1.0);
});});
// Layout
$(document).ready(
  function(){
    $("#hNavi a img, #side a img, #main a img, .pagetop a img").hover(function(){
       $(this).fadeTo("fast", 0.7);
    },function(){
       $(this).fadeTo("fast", 1.0);
});});
$(document).ready(
  function(){
    $(".inqBox a img").hover(function(){
       $(this).fadeTo("fast", 0.3);
    },function(){
       $(this).fadeTo("fast", 1.0);
});});



// jquery Self ------------ //
jQuery(function($) {
var href = location.href.split('#')[0];
$('#hMenu a').each(function() {
  if (href == this.href)
    $(this)
     .addClass("self");
});
});


// jquery Even ------------ //
$(document).ready(function(){
// Common
  $("ul.uList ul li:last-child").addClass("last");
  $("ul.formList li:last-child").addClass("last");
// Layout
  $("ul.sBnr li:last-child").addClass("last");
  $("dl#sService ul ul li:last-child").addClass("last");
// Home
// Contents
// Reference
  $(".tbOdd tr:nth-child(even)").addClass("odd");
  $(".oddClass:odd").addClass("even");
  $(".evenClass:even").addClass("odd");
  $(".oddBlock:nth-child(odd)").addClass("even");
  $(".evenBlock:nth-child(even)").addClass("odd");
});


// jquery EQ  ------------ //
$(document).ready(function(){ 
// Common
// Home
  $("#homeService ul li:eq(0)").addClass("lF");
  $("#homeService ul li:nth-child(3n+1)").addClass("lF");
  $("#homeCase ul li:eq(0)").addClass("lF");
  $("#homeCase ul li:nth-child(4n+1)").addClass("lF");
// Reference
  $(".eq:eq(2)").addClass("eq"); // 3番目にスタイル追加
  $(".nth:nth-child(3n)").addClass("nth"); // 3の倍数にスタイル追加
});

