function mm_preloadimages() { //v3.0
  var d=document; if(d.images){ if(!d.mm_p) d.mm_p=new Array();
    var i,j=d.mm_p.length,a=mm_preloadimages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.mm_p[j]=new image; d.mm_p[j++].src=a[i];}}
}

function mm_swapimgRestore() { //v3.0
  var i,x,a=document.mm_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function mm_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=mm_findObj(n,d.layers[i].document);
  if(!x && d.getElementByid) x=d.getElementByid(n); return x;
}

function mm_swapimage() { //v3.0
  var i,j=0,x,a=mm_swapimage.arguments; document.mm_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=mm_findObj(a[i]))!=null){document.mm_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function keisan(){

	// 設定開始

	var tax = 5; // 消費税率

	// 商品1
	var price1 = document.mailform.goods1.selectedIndex * 198000; // 単価を設定
	document.mailform.field1.value = price1; // 小計を表示

	// 商品2
	var price2 = document.mailform.goods2.selectedIndex * 59800; // 単価を設定
	document.mailform.field2.value = price2; // 小計を表示

	// 商品3
	var price3 = document.mailform.goods3.selectedIndex * 12800; // 単価を設定
	document.mailform.field3.value = price3; // 小計を表示
	
	// 商品4
	var price4 = document.mailform.goods4.selectedIndex * 15000; // 単価を設定
	document.mailform.field4.value = price4; // 小計を表示
	
	// 商品5
	var price5 = document.mailform.goods5.selectedIndex * 19800; // 単価を設定
	document.mailform.field5.value = price5; // 小計を表示
	
	// 商品6
	var price6 = document.mailform.goods6.selectedIndex * 19800; // 単価を設定
	document.mailform.field6.value = price6; // 小計を表示
	
	// 商品7
	var price7 = document.mailform.goods7.selectedIndex * 1280; // 単価を設定
	document.mailform.field7.value = price7; // 小計を表示
	
	// 商品8
	var price8 = document.mailform.goods8.selectedIndex * 9800; // 単価を設定
	document.mailform.field8.value = price8; // 小計を表示
	
	// 商品9
	var price9 = document.mailform.goods9.selectedIndex * 9800; // 単価を設定
	document.mailform.field9.value = price9; // 小計を表示

	// 合計を計算
	var total1 = price1 + price2 + price3 + price4 + price5 + price6 + price7 + price8 + price9;
	var mainte = price1 + price2 + price3 + price4 + price5 + price6;

	// 設定終了

	document.mailform.field_total1.value = total1; // 合計を表示

	var tax2 = Math.round(total1 * 0.05);
	document.mailform.field_tax.value = tax2; // 消費税を表示
	
	var maintetax = Math.round(mainte * 0.05);

	document.mailform.field_total2.value = total1 + tax2; // 税込合計を表示
	document.mailform.maintenance.value = Math.round((mainte + maintetax) * 0.1); // 月額保守料金を表示

}

function externalLinks() {
	if (!document.getElementsByTagName) return;
	var anchors = document.getElementsByTagName("a");
	for (var i=0; i<anchors.length; i++) {
	var anchor = anchors[i];
	if (anchor.getAttribute("href") &&
	anchor.getAttribute("rel") == "external")
	anchor.target = "_blank";
	}
}
window.onload=externalLinks;