var myDispAgent = navigator.userAgent;                   // エージェント取得
var myDispTop = myDispAgent.indexOf("MSIE",0);               // IE チェック

function alterImage(elem, img){
    elem.onerror = null;
    elem.src = img;
}

function searchMode(mode){
    var freeword = document.getElementById('freeword');
    var tagword = document.getElementById('tagword');
    if(mode == 'tagword'){
        freeword.style.display = 'none';
        tagword.style.display = 'block';
    }else{
        freeword.style.display = 'block';
        tagword.style.display = 'none';
    }
    return false;
}

/* Goods Detail Page */
function openDtlWin(temp_url, w, h){
    if(w == null){
        w = 450;
    }
    if(h == null){
        h = 450;
    }
    var dw = window.open(temp_url, "large", "height=" + h + ",width=" + w + ",status=no,toolbar=no,menubar=no,location=no,resizable=yes,scroll=yes");
    dw.focus();
    return false;
}

function addGoodsToCart(form){
	//ブラウザがIEの場合
	if (myDispTop != -1)
	{
		var state = document.readyState;
		if(state == "uninitialized" || state == "loading")
		{
			return false;
		}
	}
    form.ORD_TP.value = 1;
    return ok(form);
}

function directOrder(form){
    form.ORD_TP.value = 2;
    return ok(form);
}

function addGoodsToRsv(form){
    form.ORD_TP.value = "CART_RSV_GOODS";
    return ok(form);
}

function addWishList(form){
    form.ORD_TP.value = "CART_WISH_LIST";
    return ok(form);
}

function moveToGoods(goodsNo, grpId, att1, att2){
    location.href="?GOODS_NO=" + goodsNo + "&ATT_GRP_ID=" + grpId + "&ATT1_CD=" + att1 + "&ATT2_CD=" + att2;
}
function submitExe(form){
    form.submit();
    return;
}
