// JavaScript Document
//文字コードutf-8
//--------------------------------------------------------------------------------------------------
targetForm = new Array("https://www.engross.biz/easydesign/contact/form.php","https://www.engross.biz/easydesign/request/form.php","https://www.engross.biz/easydesign/quotation/form.php");
var googleTag = true;
var accessGetUrl = "http://www.easy-design.jp/log-engross/php/accessget.php";
var accesslogUrlHttp = "http://www.easy-design.jp/log-engross/php/accesslog.php";
var accesslogUrlHttps = "";
//--------------------------------------------------------------------------------------------------
var synkey = "";
var accessLogFlag = true;
var url = (("https:" == document.location.protocol) ? accesslogUrlHttps : accesslogUrlHttp);
var query = window.location.search.substring(1);
var parms = query.split('&');
for (var i=0; i<parms.length; i++) {
	var pos = parms[i].indexOf('=');
	if (pos > 0) {
		var key = parms[i].substring(0,pos);
		var val = parms[i].substring(pos+1);
		if (key == "synkey") synkey = val;
	}
}
if (synkey == "") {
	url = url + "?url=" + encodeURIComponent(location.href) + "&title=" + encodeURIComponent($("title").html());
} else {
	url = url + "?synkey=" + synkey + "&url=" + encodeURIComponent(location.href) + "&title=" + encodeURIComponent($("title").text());
}
document.write("<scr"+"ipt type='text/javascript' src='"+ url +"'></scr"+"ipt>");

$(document).ready(function() {
	for (i=0;i<targetForm.length;i++) {
		var n = location.href.indexOf(targetForm[i]);
		if (n != -1) accessLogFlag = false;
	}
	if (accessLogFlag) {
		for (i=0;i<targetForm.length;i++) {
			$("a[href='"+targetForm[i]+"']").removeAttr("onclick");
			$("a[href='"+targetForm[i]+"']").attr("href","javascript:formMove('"+targetForm[i]+"')");
		}
	}
});
function formMove(targetForm) {
	if ($("#engrossSubmitForm").size() > 0) $("#engrossSubmitForm").remove();
	var parameter = "";
	var res = $.ajax({
		url: accessGetUrl,
		type: "post",
		data: parameter,
		cache: false,
		async: false
	}).responseText;
	$obj = $("<form/>").attr("id","engrossSubmitForm");
	$obj.attr("action",targetForm);
	$obj.attr("method","post");
	//$obj.attr("target","_blank");
	if (googleTag) {
		$obj.submit(function() {
			pageTracker._linkByPost(this)	;		 
		});
	}
	$("body").prepend($obj);
	$("#engrossSubmitForm").html("<input type='hidden' name='engross' value='"+res+"' />");
	$("#engrossSubmitForm").submit();
}

