var myBrowser = navigator.userAgent
var myVersion = getBrowserVersion();
if(myBrowser.indexOf('Netscape') != -1){
	//
}else if((myBrowser.indexOf('Safari') != -1) && (myVersion <= 1)){
	//
	}else{
	//SuckerTree Horizontal Menu (Sept 14th, 06)
//By Dynamic Drive: http://www.dynamicdrive.com/style/

var menuids=["mainlevel"] //Enter id(s) of SuckerTree UL menus, separated by commas

function buildsubmenus_horizontal(){
for (var i=0; i<menuids.length; i++){
  var ultags=document.getElementById(menuids[i]).getElementsByTagName("ul")
    for (var t=0; t<ultags.length; t++){
		if (ultags[t].parentNode.parentNode.id==menuids[i]){ //if this is a first level submenu
			ultags[t].style.top="30px" //dynamically position first level submenus to be height of main menu item
			ultags[t].parentNode.getElementsByTagName("a")[0].className="mainfoldericon"
		}
		else{ //else if this is a sub level menu (ul)
		  ultags[t].style.left="123px" //position menu to the right of menu item that activated it
    	ultags[t].parentNode.getElementsByTagName("a")[0].className="subfoldericon"
		}
    ultags[t].parentNode.onmouseover=function(){
    this.getElementsByTagName("ul")[0].style.visibility="visible"
    }
    ultags[t].parentNode.onmouseout=function(){
    this.getElementsByTagName("ul")[0].style.visibility="hidden"
    }
    }
  }
}

if (window.addEventListener)
window.addEventListener("load", buildsubmenus_horizontal, false)
else if (window.attachEvent)
window.attachEvent("onload", buildsubmenus_horizontal)

}



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 MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function getBrowserName()
{
    var aName  = navigator.appName.toUpperCase();
    if (aName.indexOf("NETSCAPE") >= 0)       return "Netscape";
}

function getBrowserVersion()
{
	var browser = getBrowserName();
	var version = 0;
	var s = 0;
	var appVer  = navigator.appVersion;
	if (browser == "Netscape")
	{
		s = appVer.indexOf(" ",0);
		version = eval(appVer.substring(0,s));
	}
	return version;
}

appName = getBrowserName();
version = getBrowserVersion();
if((appName == "Netscape")&&(version >= 3)&&(version < 5))document.write('<style>body{background-color:#FFFFFF;}</style>');

function ttlValue(){

// 設定開始

// 商品1
var price1 = document.orderform.prd1.selectedIndex * 170; // 単価を設定
document.orderform.subtotal1.value = price1; // 小計を表示

// 商品2
var price2 = document.orderform.prd2.selectedIndex * 950; // 単価を設定
document.orderform.subtotal2.value = price2; // 小計を表示

// 商品3
var price3 = document.orderform.prd3.selectedIndex * 1800; // 単価を設定
document.orderform.subtotal3.value = price3; // 小計を表示

// 商品4
var price4 = document.orderform.prd4.selectedIndex * 380; // 単価を設定
document.orderform.subtotal4.value = price4; // 小計を表示

// 商品5
var price5 = document.orderform.prd5.selectedIndex * 250; // 単価を設定
document.orderform.subtotal5.value = price5; // 小計を表示

// 都道府県
var prefec = document.orderform.pref.value;
if(prefec =="福岡県"){document.orderform.postage.value = "0";}
else if(prefec =="佐賀県"||prefec =="長崎県"||prefec =="熊本県"||prefec =="大分県"||prefec =="宮崎県"||prefec =="鹿児島県"){document.orderform.postage.value = "300";}
else if(prefec =="北海道"||prefec =="青森県"||prefec =="岩手県"||prefec =="宮城県"||prefec =="秋田県"||prefec =="山形県"||prefec =="福島県"||prefec =="沖縄県"){document.orderform.postage.value = "1200";}
else {document.orderform.postage.value = "600";}


// 送料
var postage = document.orderform.postage.value;
document.orderform.postage.value = postage; // 送料を表示
postageNum = eval(postage);

// 商品合計を計算
var prdtotal = price1 + price2 + price3 + price4 + price5;
//5000円以上購入
if(prdtotal >= 5000){document.orderform.postage.value = "0"; postageNum = 0;}
// 支払方法と金額
var paymeth = document.orderform.pay.value;
if(paymeth =="代金引換"&&prdtotal >= 1&&prdtotal < 10000){document.orderform.daibiki.value = 315;}
else if(paymeth =="代金引換"&&prdtotal >= 10000&&prdtotal < 30000){document.orderform.daibiki.value = 420;}
else if(paymeth =="代金引換"&&prdtotal >= 30000&&prdtotal < 100000){document.orderform.daibiki.value = 630;}
else if(paymeth =="代金引換"&&prdtotal >= 100000&&prdtotal <= 300000){document.orderform.daibiki.value = 1050;}
else {document.orderform.daibiki.value = 0;}
var daibiki = document.orderform.daibiki.value;
daibikiNum = eval(daibiki);


// 総合計を計算
var total = price1 + price2 + price3 + price4 + price5 + postageNum + daibikiNum;

// 設定終了

document.orderform.prd_total.value = prdtotal; // 合計を表示
document.orderform.field_total.value = total; // 総合計を表示

}
