/*===================================================
	
	DEPOC JavaScript Function Version:5.00
	
		depoc function.js
		include jquery
		
		Copyright (c) 2011 DEPOC Inc.
		http://depoc.jp
		
		Update:11/09/03
	
===================================================*/

$(function(){
	$("a img[class!='current']").hover(
		function(){
			$(this).fadeTo(120, 0.6);
		},
		function(){
			$(this).fadeTo(200, 1);
		}
	);
});




/*---------------------------------------------------
	RollOver
---------------------------------------------------*/
$(function() {
	$("#company #side-navi li:eq(1) img").addClass("current");
	$("#service #side-navi li:eq(2) img").addClass("current");
	$("#contact #side-navi li:eq(3) img").addClass("current");
});

$(function(){
	$(".current").each(function(){
		var newSrc = $(this).attr('src').replace("_off.", "_on.");
		$(this).attr("src", newSrc);
	});
});
$(document).ready(function(){
	$("img,input").mouseover(function(){
		if ($(this).attr("src")){
			$(this).attr("src",$(this).attr("src").replace("_off.", "_on."));
		}
	});
	$("img[class!='current'],input").mouseout(function(){
		if ($(this).attr("src")){
			$(this).attr("src",$(this).attr("src").replace("_on.", "_off."));
		}
	});
});


/*---------------------------------------------------
	SmoothLink
---------------------------------------------------*/
$(function () {
	if (! $.browser.safari) {
		$('#pagetop').click(function () {
			$(this).blur();
			$('html,body').animate({ scrollTop: 0 }, 500,'swing');
			return false;
		});
	}
});




/*---------------------------------------------------
	Fixed
	include jquery.exFixed.js
---------------------------------------------------*/
$(function(){
	$('#index #footer').exFixed();
	$('#pagetop').exFixed();
});

/*---------------------------------------------------
	Fixed
	include jquery.exFixed.js
---------------------------------------------------*/
/*
$(function() {
	$(document).ready(function(){
		$(document).pngFix();
	});
});
*/
/*---------------------------------------------------
	Popup
---------------------------------------------------*/
window.onload=autoPOP;

function autoPOP()
{
	var x = document.getElementsByTagName('a');
	for (var i=0;i<x.length;i++)
	{
		if (x[i].getAttribute('className') == 'popup01' || x[i].getAttribute('class') == 'popup01')
		{
			x[i].onclick = function () {
				return winOpen2(this.href,'popWin','800','650');
			}
		}
		if (x[i].getAttribute('className') == 'popup02' || x[i].getAttribute('class') == 'popup02')
		{
			x[i].onclick = function () {
				return winOpen2(this.href,'popWin2','787','685');
			}
		}
	}
};

function winOpen(url,windowname,width,height) {
	var features="location=no,menubar=no,toolbar=no,status=no,resizable=no,scrollbars=no";
	if (width) {
		if (window.screen.width > width)
			features+=", left="+(window.screen.width-width)/2;
		else width=window.screen.width;
		features+=", width="+width;
	}
	if (height) {
		if (window.screen.height > height)
			features+=", top="+(window.screen.height-height)/2;
		else height=window.screen.height;
		features+=", height="+height;
	}
	wn=window.open(url,windowname,features);
	wn.focus();
	return false;
}
function winOpen2(url,windowname,width,height) {
	var features="location=no,menubar=no,toolbar=no,status=no,resizable=no,scrollbars=yes";
	if (width) {
		if (window.screen.width > width)
			features+=", left="+(window.screen.width-width)/2;
		else width=window.screen.width;
		features+=", width="+width;
	}
	if (height) {
		if (window.screen.height > height)
			features+=", top="+(window.screen.height-height)/2;
		else height=window.screen.height;
		features+=", height="+height;
	}
	wn=window.open(url,windowname,features);
	wn.focus();
	return false;
}

/*---------------------------------------------------
	.send
---------------------------------------------------*/
$(function () {
	$(".send").click(function () {
		$("#mailform").replaceWith("<p>" + "この度はお問い合せ頂き誠にありがとうございました。<br>改めて担当者よりご連絡をさせていただきます。" + "</p>");
	});
});
