// JavaScript Document

//ロールオーバー*********************************************

//.jpg
function rollOver_jpg(_obj){
	var newFile = _obj.src.substring(0,_obj.src.length-7);
	newFile = newFile+"_mo.jpg";
	_obj.src = newFile;
}

function rollOut_jpg(_obj){
	var newFile = _obj.src.substring(0,_obj.src.length-7);
	newFile = newFile+"_ob.jpg";
	_obj.src = newFile;
}

//.gif
function rollOver_gif(_obj){
	var newFile = _obj.src.substring(0,_obj.src.length-7);
	newFile = newFile+"_mo.gif";
	_obj.src = newFile;
}

function rollOut_gif(_obj){
	var newFile = _obj.src.substring(0,_obj.src.length-7);
	newFile = newFile+"_ob.gif";
	_obj.src = newFile;
}

//ウィンドウオープン*********************************************

function myOpWin(theURL) { //v2.0
  var fs = 'toolbar=no,'
	+'location=no,'
	+'status=no,'
	+'menubar=no,'
	+'scrollbars=yes,'
	+'resizable=yes,'
	+'width=530,'
	+'height=440'; 
	theWind = window.open(theURL,'Qt',fs);
	window.theWind.focus();
}


//ウィンドウクローズ*********************************************

function CloseWin(){
    window.close();
}

//フラッシュ読み込み*********************************************

function swftop(){
document.write ('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="840" height="240">');
document.write ('<param name="movie" value="./images/index.swf" />');
document.write ('<param name="quality" value="high" />');
document.write ('<embed src="./images/index.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="840" height="240"></embed>');
document.write ('</object>');
}


//金額計算にて使用***********************************************

function send()
{
	document.cart1.action="cart_sel00.html";
	document.cart1.submit();
}

function kounyu_kingaku(ix,jx,cart_flg_x){

	price = document.cart1.elements['cart_Qty[' + ix +']'].value * document.cart1.elements['cart_Price[' + ix + ']'].value;
	document.getElementById('dsp_cart_kingaku[' + ix + ']').innerHTML = '\\' + String(price).replace(/^([+-]?\d+)(\d\d\d)/,"$1,$2"); 

	del_flg = cart_flg_x;
	del_flg2 = new Array();
	del_flg2 = del_flg.split(",");

	total = 0;
	for( var i = 0;　i < jx+1; i++ ){
	   if(del_flg2[i]){
	      if(del_flg2[i] == "0"){	
		 if(document.cart1.elements['cart_Qty[' + i +']']){
       	            price2 = document.cart1.elements['cart_Qty[' + i +']'].value * document.cart1.elements['cart_Price[' + i + ']'].value;	
		    document.getElementById('dsp_cart_kingaku[' + i + ']').innerHTML = '\\' + String(price2).replace(/^([+-]?\d+)(\d\d\d)/,"$1,$2"); 
	            total += price2;
		 }
	      }	
           }
	}
//商品合計
	document.getElementById('dsp_cart_newtotal').innerHTML = '\\' + String(total).replace(/^([+-]?\d+)(\d\d\d)/,"$1,$2");
//割引5％
	waribiki5 = Math.floor(total * 0.05) * -1;
//送料
	if(total < 5000){
	   sendfee = 840;
	}else{
	   sendfee = 0;
	}
	document.getElementById('dsp_cart_sendfee').innerHTML = '\\' + String(sendfee).replace(/^([+-]?\d+)(\d\d\d)/,"$1,$2");
//代引手数料
	temp_total = total;				// ０％割引
	if (temp_total < 10000)	{daibikifee = 315;}
	if ((temp_total >= 10000) && (temp_total < 30000)){daibikifee = 420;}
	if ((temp_total >= 30000) && (temp_total < 100000)){daibikifee = 630;}
	if (100000 <= temp_total) {daibikifee = 1050;}

	temp_total = Math.floor(total * 0.95);		// ５％割引
	if ((temp_total) < 10000)	{daibikifee_5 = 315;}
	if (((temp_total) >= 10000) && ((temp_total) < 30000)){daibikifee_5 = 420;}
	if (((temp_total) >= 30000) && ((temp_total) < 100000)){daibikifee_5 = 630;}
	if (100000 <= (temp_total)) {daibikifee_5 = 1050;}
	document.getElementById('dsp_cart_daibikifee').innerHTML = '\\' + String(daibikifee).replace(/^([+-]?\d+)(\d\d\d)/,"$1,$2");
//支払合計金額(WEB利用登録がまだ)
	total1 = total + sendfee + daibikifee;
	document.getElementById('dsp_cart_total1').innerHTML = '\\' + String(total1).replace(/^([+-]?\d+)(\d\d\d)/,"$1,$2");
//支払合計金額(WEB利用登録済み)
	total2 = total + sendfee + daibikifee + waribiki5;
	document.getElementById('dsp_cart_total2').innerHTML = '\\' + String(total2).replace(/^([+-]?\d+)(\d\d\d)/,"$1,$2");
}
