// JavaScript Document
var rank  = 10;
var tax   = 0.05;
var _home = '';

function _$(tagId){
	return document.getElementById(tagId);
}
function $(tagId){
	return document.getElementById(tagId);
}
function go2cart(param1, param2){
	var cate_no = param1;
	var item_jan = param2;
	var width = screen.width;
	
	if(cate_no + "" == "" || cate_no + "" == "undefined"){
		cate_no = 0;
	}
	
	if(item_jan + "" == "" || item_jan + "" == "undefined"){
		//location.href = "/cgi-bin/shop_index.cgi?category=" + cate_no + "&storeID=0&buyingID=1&swh=" + width;
		window.location.href = _home + "/?m=cart&category=" + cate_no + "&storeID=0&buyingID=1";
	}
	else{
		window.location.href = _home + "/?m=cart&category=" + cate_no + "&storeID=0&buyingID=1&jan=" + item_jan;
	}
}

function openCompany(){
	var url = "http://www.beny.co.jp/company_info/co-guide/co-guide-idx.html";
	w=window.open(url,"textwin","scrollbars=1,toolbar=0,menubar=0,location=0,directories=0,resizable=1,status=0,width=800,height=650,");
	if(navigator.appVersion.charAt(0)>=4) { w.focus() };
}

function go2customer(){
	window.location.href = "https://www2.beny.co.jp/member/shop/customer/cst_login.asp";
}

function go2ordersts(){
	showPopWin('https://www2.beny.co.jp/member/shop/customer/cst_status.asp', 300, 400, null);
}

function go2form(){
	showPopWin('https://www2.beny.co.jp/member/shop/cart/form.asp', 517, 450, null);
}

function commonPopWindow(url, myw, myh){
	showPopWin(url, myw, myh, null);
}

function refresh(){
	window.location.reload();
}

function linkOpen(path, myw, myh){
	w=window.open(path,"textwin","scrollbars=1,toolbar=0,menubar=0,location=0,directories=0,resizable=1,status=0,width=" + myw + ",height=" + myh + ",");
  if(navigator.appVersion.charAt(0)>=4) { w.focus() };
}

function linkOpen2(path, myw, myh, win){
	w=window.open(path, win,"scrollbars=1,toolbar=0,menubar=0,location=0,directories=0,resizable=1,status=0,width=" + myw + ",height=" + myh + ",");
  if(navigator.appVersion.charAt(0)>=4) { w.focus() };
}

function windowCloser(){
	window.opener = window;
	var win = window.open(location.href,"_self");
	win.close();
}

function mv(_page){
	window.location.href = _home + _page + "/";
}

function swfObjWrapper(url, id, w, h){
	var swfurl = url;
	var flashvars = {};
	var params = {
		menu:'false',
		quality:'high',
		wmode:'transparent',
		allowfullscreen:'true',
		allowScriptAccess:'always'
	}
	var attributes = {};
	swfobject.embedSWF(swfurl, id, w, h, "9,0.0", _home + "/contents/objects/swfs/pc/expressInstall.swf", flashvars, params, attributes);
}

function getBrowserHeight() {
        if ( window.innerHeight ) {
                return window.innerHeight;
        }
        else if ( document.documentElement && document.documentElement.clientHeight != 0 ) {
                return document.documentElement.clientHeight;
        }
        else if ( document.body ) {
                return document.body.clientHeight;
        }
        return 0;
}

function getBrowserWidth() {
        if ( window.innerWidth ) {
                return window.innerWidth;
        }
        else if ( document.documentElement && document.documentElement.clientWidth != 0 ) {
                return document.documentElement.clientWidth;
        }
        else if ( document.body ) {
                return document.body.clientWidth;
        }
        return 0;
}
function logging(str1, str2, str3){
	var xmlhttp = createXMLHttpRequest(function(){});
  
	if(xmlhttp){
		senddata = "item=" + escape(str1) + "&JAN=" + escape(str2) + "&action=" + escape(str3);
		xmlhttp.open("POST", _home + "/cgi-bin/get_log.cgi", true);
		xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); 
		xmlhttp.send(senddata);
	}
}
// --‘——¿ŒvŽZ-- //
function dispChg(arg){
	var ondo = document.getElementsByName('ondo');
	var area = arg;
	var value = (ondo == 1 && area != 99) ? Number($('c' + area).innerHTML) : 0;

	if(area == 99){
		$('charges').innerHTML = '0';
		return;
	}

	for(var i=0; i<ondo.length; i++){
		if(ondo[i].checked && ondo[i].value == 1){
			value = Number(String($('c' + area).innerHTML));
			break;
		}
	}
	
	$('charges').innerHTML = (Number(String($('n' + area).innerHTML)) + value);
}

