
$(function() {
	$('.pagetop a').click(function() {
		if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) {
			var target = $(this).attr("href");
            target = $(target);
			target = target.length && target;
			if (target.length) {
				var sclpos = 30;
				var scldurat = 1200;
				var targetOffset = target.offset().top - sclpos;
				$('html,body')
					.animate({scrollTop: targetOffset}, {duration: scldurat, easing: "easeOutExpo"});
				return false;
			}
		}
	});
});

$.auto = {
	init: function() {
		for (module in $.auto) {
			if ($.auto[module].init)
				$.auto[module].init();
		}
	}
};

$(document).ready($.auto.init);

$.auto.hide = {
	init: function() {
		$('.Hide').hide();
	}
};

$.auto.hover = {

	init: function() {
		$('.Hover')
			.bind('mouseover', this.enter)
			.bind('mouseout', this.exit)
			.each(this.preload);
	},

	preload: function() {
		this.preloaded = new Image;
		this.preloaded.src = this.src.replace(/^(.+)(\.[a-z]+)$/, "$1_over$2");
	},

	enter: function() {
		this.src = this.src.replace(/^(.+)(\.[a-z]+)$/, "$1_over$2");
	},

	exit: function() {
		this.src = this.src.replace(/^(.+)_over(\.[a-z]+)$/, "$1$2");
	}
};

$.auto.submit = {
	init: function() {
		$('SELECT.Submit').bind('change', this.on_change);
	},

	on_change: function() {
		if (this.value) this.form.submit();
	}
};

$.auto.select = {
	init: function() {
		$('LABEL.Select').each(this.label_action);
		$('INPUT.Select').bind('click', function(){ this.select(); });
	},

	label_action: function() {
		var field = $('#'+this.htmlFor).get(0);
		if (field && field.focus && field.select) {
			$(this).bind('click', function(){ field.focus(); field.select(); });
		}
	}
};

$.auto.tabs = {

	init: function() {

		$('.Tabs').each(function(){
			var f = $.auto.tabs.click;
			var group = this;
			$('.Tab', group).each(function(){
				this.group = group;
				$(this).click(f);
				$('#'+this.id+'_body').hide();
			}).filter(':first').trigger('click');
		});

	},

	click: function() {
		var tab = $('#'+this.id+'_body').get(0);
		$('.Tab', this.group).each(function(){
			$(this).removeClass('Active');
			$('#'+this.id+'_body').hide();
		});

		$(this).addClass('Active');
		$(tab).show();
		this.blur();

		return false;
	}

};




$(function() {
	$('.parm').mouseover(function() {
        $('#'+$(this).parent().attr("class")).show();
		closemenu('#'+$(this).parent().attr("class"));
		return false;
	});
    $('.parm').mouseout(function() {
        $('#'+$(this).parent().attr("class")).hide();
		closemenu('#'+$(this).parent().attr("class"));
		return false;
	});
});
function closemenu(id){
	$(id).mouseover(function() {
        $(this).show();
	});
    $(id).mouseout(function() {
        $(this).hide();
	});
}


/*
$(function(){
    if($('#department .message a').size()!=0){
        $('#department .message a').fancyZoom({
        directory : "../js/zoomimages/",
        closeOnClick: true
        });
        
    }
});
*/

$(function(){
	$('#products .specs_text,#products .specs_text2,#products .inspecs_text2').each(function(i){
		i = i+1;
        if($('#iconlist'+i+' a.spec').size() > 0)
        {
            $('#iconlist'+i+' a.spec').lightBox({
            
            imageLoading: '../../js/images/loading.gif',
            imageBtnClose: '../../js/images/close.gif',
            imageBtnPrev: '../../js/images/prev.gif',
            imageBtnNext: '../../js/images/next.gif'
		    });
        }
	});
});


$(function() {
	if($('.sendmail').size() > 0)
    {
		title = new Array();
		title['companytour'] = '%81y%89%EF%8E%D0%8C%A9%8Aw%81z';//【会社見学】
		title['showroom'] = '%81y%83V%83%87%81%5B%83%8B%81%5B%83%80%8C%A9%8Aw%81z';//【ショールーム見学】
		title['recruit'] = '%81y%8d%cc%97p%82%c9%8a%d6%82%b7%82%e9%82%a8%96%e2%82%a2%8d%87%82%b9%81z';//【採用に関するお問い合せ】
		
		title_utf = new Array();
		title_utf['companytour'] = '%e3%80%90%e4%bc%9a%e7%a4%be%e8%a6%8b%e5%ad%a6%e3%80%91';//【会社見学】
		title_utf['showroom'] = '%e3%80%90%e3%82%b7%e3%83%a7%e3%83%bc%e3%83%ab%e3%83%bc%e3%83%a0%e8%a6%8b%e5%ad%a6%e3%80%91';//【ショールーム見学】
		title_utf['recruit'] = '%e3%80%90%e6%8e%a1%e7%94%a8%e3%81%ab%e9%96%a2%e3%81%99%e3%82%8b%e3%81%8a%e5%95%8f%e3%81%84%e5%90%88%e3%81%9b%e3%80%91';//【採用に関するお問い合せ】
		
		body = new Array();
		body['companytour'] = "%82%b1%82%cc%93x%82%cd%89%ef%8e%d0%8c%a9%8aw%82%cc%97%5c%96%f1%82%f0%82%a2%82%bd%82%be%82%ab%97L%93%ef%82%a4%82%b2%82%b4%82%a2%82%dc%82%b7%81B%0d%0a%90%bd%82%c9%82%a8%8e%e8%90%94%82%c5%82%b7%82%aa%81A%89%ba%8bL%93%e0%97e%82%f0%93%fc%97%cd%82%cc%8f%e3%81A%82%b2%95%d4%90M%82%ad%82%be%82%b3%82%a2%81B%0d%0a%8c%e3%93%fa%92S%93%96%8e%d2%82%e6%82%e8%8am%94F%82%cc%82%b2%98A%97%8d%82%f0%82%b3%82%b9%82%c4%92%b8%82%ab%82%dc%82%b7%81B%0d%0a%81%a6%8f%ae%81A%83%81%81%5b%83%8b%82%cc%8c%8f%96%bc%82%cd%82%bb%82%cc%82%dc%82%dc%82%c9%82%c4%81A%82%b2%95%d4%90M%82%a8%8a%e8%82%a2%82%b5%82%dc%82%b7%81B%0d%0a%0d%0a%81%a1%89%ef%8e%d0%96%bc%81F%0d%0a%81%a1%8b%c6%8e%ed%81F%0d%0a%81%a1%92S%93%96%8e%d2%8e%81%96%bc%81F%0d%0a%81%a1%98A%97%8d%90%e6%81iTEL%81EE%2dmail%81j%0d%0a%81%a1%90l%90%94%81F%0d%0a%81%a1%8c%a9%8aw%90%e6%81i%96%7b%8e%d0%8dH%8f%ea%81E%83x%83g%83i%83%80%8dH%8f%ea%81j%81F%0d%0a%81%a1%8c%a9%8aw%8a%f3%96%5d%93%fa%81F%0d%0a%81%a1%8c%a9%8aw%96%da%93I%81F";//この度は会社見学の予約をいただき有難うございます。\n誠にお手数ですが、下記内容を入力の上、ご返信ください。\n後日担当者より確認のご連絡をさせて頂きます。\n※尚、メールの件名はそのままにて、ご返信お願いします。\n\n■会社名：\n■業種：\n\n■担当者氏名：\n\n■連絡先（TEL・E-mail）：\n\n■人数：\n\n■見学先（本社工場・ベトナム工場）：\n\n■見学希望日：\n\n■見学目的：
		body['showroom'] = "%82%b1%82%cc%93x%82%cd%83V%83%87%81%5b%83%8b%81%5b%83%80%82%cc%97%5c%96%f1%82%f0%82%a2%82%bd%82%be%82%ab%97L%93%ef%82%a4%82%b2%82%b4%82%a2%82%dc%82%b7%81B%0d%0a%90%bd%82%c9%82%a8%8e%e8%90%94%82%c5%82%b7%82%aa%81A%89%ba%8bL%93%e0%97e%82%f0%93%fc%97%cd%82%cc%8f%e3%81A%82%b2%95%d4%90M%82%ad%82%be%82%b3%82%a2%81B%0d%0a%8c%e3%93%fa%92S%93%96%8e%d2%82%e6%82%e8%8am%94F%82%cc%82%b2%98A%97%8d%82%f0%82%b3%82%b9%82%c4%92%b8%82%ab%82%dc%82%b7%81B%0d%0a%81%a6%8f%ae%81A%83%81%81%5b%83%8b%82%cc%8c%8f%96%bc%82%cd%82%bb%82%cc%82%dc%82%dc%82%c9%82%c4%81A%82%b2%95%d4%90M%82%a8%8a%e8%82%a2%82%b5%82%dc%82%b7%81B%0d%0a%0d%0a%81%a1%89%ef%8e%d0%96%bc%81F%0d%0a%81%a1%8b%c6%8e%ed%81F%0d%0a%81%a1%92S%93%96%8e%d2%8e%81%96%bc%81F%0d%0a%81%a1%98A%97%8d%90%e6%81iTEL%81EE%2dmail%81j%81F%0d%0a%81%a1%90l%90%94%81F%0d%0a%81%a1%8c%a9%8aw%8a%f3%96%5d%93%fa%8e%9e%81F%0d%0a%81%a1%8c%a9%8aw%96%da%93I%81F";//この度はショールームの予約をいただき有難うございます。\n誠にお手数ですが、下記内容を入力の上、ご返信ください。\n後日担当者より確認のご連絡をさせて頂きます。\n※尚、メールの件名はそのままにて、ご返信お願いします。\n\n■会社名：\n\n■業種：\n\n■担当者氏名：\n\n■連絡先（TEL・E-mail）：\n\n■人数：\n\n■見学希望日時：\n\n■見学目的：";
		body['recruit'] = '';
		
		body_utf = new Array();
		body_utf['companytour'] = "%e3%81%93%e3%81%ae%e5%ba%a6%e3%81%af%e4%bc%9a%e7%a4%be%e8%a6%8b%e5%ad%a6%e3%81%ae%e4%ba%88%e7%b4%84%e3%82%92%e3%81%84%e3%81%9f%e3%81%a0%e3%81%8d%e6%9c%89%e9%9b%a3%e3%81%86%e3%81%94%e3%81%96%e3%81%84%e3%81%be%e3%81%99%e3%80%82%0d%0a%e8%aa%a0%e3%81%ab%e3%81%8a%e6%89%8b%e6%95%b0%e3%81%a7%e3%81%99%e3%81%8c%e3%80%81%e4%b8%8b%e8%a8%98%e5%86%85%e5%ae%b9%e3%82%92%e5%85%a5%e5%8a%9b%e3%81%ae%e4%b8%8a%e3%80%81%e3%81%94%e8%bf%94%e4%bf%a1%e3%81%8f%e3%81%a0%e3%81%95%e3%81%84%e3%80%82%0d%0a%e5%be%8c%e6%97%a5%e6%8b%85%e5%bd%93%e8%80%85%e3%82%88%e3%82%8a%e7%a2%ba%e8%aa%8d%e3%81%ae%e3%81%94%e9%80%a3%e7%b5%a1%e3%82%92%e3%81%95%e3%81%9b%e3%81%a6%e9%a0%82%e3%81%8d%e3%81%be%e3%81%99%e3%80%82%0d%0a%e2%80%bb%e5%b0%9a%e3%80%81%e3%83%a1%e3%83%bc%e3%83%ab%e3%81%ae%e4%bb%b6%e5%90%8d%e3%81%af%e3%81%9d%e3%81%ae%e3%81%be%e3%81%be%e3%81%ab%e3%81%a6%e3%80%81%e3%81%94%e8%bf%94%e4%bf%a1%e3%81%8a%e9%a1%98%e3%81%84%e3%81%97%e3%81%be%e3%81%99%e3%80%82%0d%0a%0d%0a%e2%96%a0%e4%bc%9a%e7%a4%be%e5%90%8d%ef%bc%9a%0d%0a%e2%96%a0%e6%a5%ad%e7%a8%ae%ef%bc%9a%0d%0a%e2%96%a0%e6%8b%85%e5%bd%93%e8%80%85%e6%b0%8f%e5%90%8d%ef%bc%9a%0d%0a%e2%96%a0%e9%80%a3%e7%b5%a1%e5%85%88%ef%bc%88TEL%e3%83%bbE%2dmail%ef%bc%89%0d%0a%e2%96%a0%e4%ba%ba%e6%95%b0%ef%bc%9a%0d%0a%e2%96%a0%e8%a6%8b%e5%ad%a6%e5%85%88%ef%bc%88%e6%9c%ac%e7%a4%be%e5%b7%a5%e5%a0%b4%e3%83%bb%e3%83%99%e3%83%88%e3%83%8a%e3%83%a0%e5%b7%a5%e5%a0%b4%ef%bc%89%ef%bc%9a%0d%0a%e2%96%a0%e8%a6%8b%e5%ad%a6%e5%b8%8c%e6%9c%9b%e6%97%a5%ef%bc%9a%0d%0a%e2%96%a0%e8%a6%8b%e5%ad%a6%e7%9b%ae%e7%9a%84%ef%bc%9a";
		body_utf['showroom'] = "%e3%81%93%e3%81%ae%e5%ba%a6%e3%81%af%e3%82%b7%e3%83%a7%e3%83%bc%e3%83%ab%e3%83%bc%e3%83%a0%e3%81%ae%e4%ba%88%e7%b4%84%e3%82%92%e3%81%84%e3%81%9f%e3%81%a0%e3%81%8d%e6%9c%89%e9%9b%a3%e3%81%86%e3%81%94%e3%81%96%e3%81%84%e3%81%be%e3%81%99%e3%80%82%0d%0a%e8%aa%a0%e3%81%ab%e3%81%8a%e6%89%8b%e6%95%b0%e3%81%a7%e3%81%99%e3%81%8c%e3%80%81%e4%b8%8b%e8%a8%98%e5%86%85%e5%ae%b9%e3%82%92%e5%85%a5%e5%8a%9b%e3%81%ae%e4%b8%8a%e3%80%81%e3%81%94%e8%bf%94%e4%bf%a1%e3%81%8f%e3%81%a0%e3%81%95%e3%81%84%e3%80%82%0d%0a%e5%be%8c%e6%97%a5%e6%8b%85%e5%bd%93%e8%80%85%e3%82%88%e3%82%8a%e7%a2%ba%e8%aa%8d%e3%81%ae%e3%81%94%e9%80%a3%e7%b5%a1%e3%82%92%e3%81%95%e3%81%9b%e3%81%a6%e9%a0%82%e3%81%8d%e3%81%be%e3%81%99%e3%80%82%0d%0a%e2%80%bb%e5%b0%9a%e3%80%81%e3%83%a1%e3%83%bc%e3%83%ab%e3%81%ae%e4%bb%b6%e5%90%8d%e3%81%af%e3%81%9d%e3%81%ae%e3%81%be%e3%81%be%e3%81%ab%e3%81%a6%e3%80%81%e3%81%94%e8%bf%94%e4%bf%a1%e3%81%8a%e9%a1%98%e3%81%84%e3%81%97%e3%81%be%e3%81%99%e3%80%82%0d%0a%0d%0a%e2%96%a0%e4%bc%9a%e7%a4%be%e5%90%8d%ef%bc%9a%0d%0a%e2%96%a0%e6%a5%ad%e7%a8%ae%ef%bc%9a%0d%0a%e2%96%a0%e6%8b%85%e5%bd%93%e8%80%85%e6%b0%8f%e5%90%8d%ef%bc%9a%0d%0a%e2%96%a0%e9%80%a3%e7%b5%a1%e5%85%88%ef%bc%88TEL%e3%83%bbE%2dmail%ef%bc%89%ef%bc%9a%0d%0a%e2%96%a0%e4%ba%ba%e6%95%b0%ef%bc%9a%0d%0a%e2%96%a0%e8%a6%8b%e5%ad%a6%e5%b8%8c%e6%9c%9b%e6%97%a5%e6%99%82%ef%bc%9a%0d%0a%e2%96%a0%e8%a6%8b%e5%ad%a6%e7%9b%ae%e7%9a%84%ef%bc%9a";
		body_utf['recruit'] = '';
		
		maito = new Array();
		maito['companytour'] = "info@daikan.ne.jp";
		maito['showroom'] = "info@daikan.ne.jp";
		maito['recruit'] = "job@daikan.ne.jp";
		
		var type = $('.sendmail').attr('href');
		
		var subject = title[type];
		var subject_utf = title_utf[type];
		var body = body[type];
		var body_utf = body_utf[type];
		var to = maito[type];
        //alert('mailto:'+to+'?subject='+subject+'&body='+body);
        //location.href = 'mailto:'+to+'?subject='+subject+'&body='+body;
        
		$('.sendmail').attr('href','mailto:'+to+'\?subject='+subject+'&body='+body);
		
		$('.sendmail_utf').attr('href','mailto:'+to+'\?subject='+subject_utf+'&body='+body_utf);
        //alert($('.sendmail').parent().html());
	}
});

$(function() {
    var nowpage = $('body').attr('id');
    if(nowpage != "")
    {
        if($("#leftsub_men"+nowpage).size() > 0)
        {
            
            $("#leftsub_men"+nowpage).show();
        }
    }
    
	$('#menu_block .leftopenmenu').click(function() {
		
		var bid = $(this).attr('href');
		
		if($("#"+bid).is(':hidden')){
		    $("#"+bid).show(500);
		}
		else
		{
			$("#"+bid).hide(500);
		}
		
		return false;
	});
});




$(function() {
	if($('#indeximages').size() > 0)
	{
		$('#indeximages').hide();
		$('#indeximages').fadeIn(6000,fadebox());
		
	}
});


function fadebox(){
    $('#indeximages').crossSlide({sleep: 6,fade: 2},
    [
        {src: 'images/index/1.jpg'},
        {src: 'images/index/2.jpg'},
        {src: 'images/index/3.jpg'},
        {src: 'images/index/4.jpg'},
        {src: 'images/index/5.jpg'},
        {src: 'images/index/6.jpg'},
        {src: 'images/index/7.jpg'},
        {src: 'images/index/8.jpg'},
        {src: 'images/index/9.jpg'},
        {src: 'images/index/10.jpg'},
        {src: 'images/index/11.jpg'},
        {src: 'images/index/12.jpg'},
        {src: 'images/index/13.jpg'}
    ]);
}

$(function(){
    if($('.change_sineimg').size() > 0)
	{
        $('.overimagebox_n01 img').eq(0).nextAll().hide();
        $('.overimagebox_n02 img').eq(0).nextAll().hide();
        $('.overimagebox_n03 img').eq(0).nextAll().hide();
        $('.overimagebox_n04 img').eq(0).nextAll().hide();
        $('.change_sineimg li').mouseover(function() {
            var id = $(this).parent().attr('id');
            
            var no = $(this).attr('class');
            
            var spno = no.split(' ');
            no = spno[0];
            $('.overimagebox_'+id+' img').hide();
            $('.overimagebox_'+id+' img.'+no).show();
        });
        $('.change_sineimg li').mouseout(function() {
            var id = $(this).parent().attr('id');
            var photo = $('.overimagebox_'+id+' img');
            photo.hide();
            photo.filter(':first').show();
        });
    }
});
