// 健康家族ドメイン名称
var _kenkouDomain = "www.kenkoukazoku.co.jp";
var _ninnikuDomain = "www.550229.jp";
var _kurozuDomain = "www.962.jp";
var _servletPath = "https://www.kenkoukazoku.co.jp/eshop/servlet/entry";

// 画面名：「注文はこちら」アンカー
// 機能：注文の先頭画面移動用HIDDENパラメータ記述
function writeTopURL(){
    document.write("<form name=\"syohinList\" action=\"" + _servletPath + "\" method=\"post\" target=\"_self\">");
    document.write("<input type=\"hidden\" name=\"action\" value=\"GoDspSyohinLst\">");
    document.write("<input type=\"hidden\" name=\"bean\" value=\"Order\">");
    document.write("<input type=\"hidden\" name=\"topURL\" value=\"" + document.URL + "\">");
    document.write("</form>");
    document.write("<form name=\"anchor\" action=\"" + _servletPath + "\" method=\"post\" target=\"_self\">");
    document.write("<input type=\"hidden\" name=\"action\" value=\"\">");
    document.write("<input type=\"hidden\" name=\"bean\" value=\"\">");
    document.write("<input type=\"hidden\" name=\"P\" value=\"\">");
    document.write("<input type=\"hidden\" name=\"membermenu_backtojsp\" value=\"\">");
    document.write("<input type=\"hidden\" name=\"orderhistory_backtojsp\" value=\"\">");
    document.write("<input type=\"hidden\" name=\"login_backtojsp\" value=\"\">");
    document.write("<input type=\"hidden\" name=\"regularorder_backtojsp\" value=\"\">");
    document.write("<input type=\"hidden\" name=\"point_backtojsp\" value=\"\">");
    document.write("<input type=\"hidden\" name=\"usrchg_backtojsp\" value=\"\">");
    document.write("<input type=\"hidden\" name=\"topURL\" value=\"" + document.URL + "\">");
    document.write("</form>");
}

// 画面名：注文の先頭画面へ
// @param topURL トップＵＲＬ
// 機能：確認ダイアログ表示
function goOrder(){

    for( i=0 ; i<document.forms.length; i++ ){
        //alert("forms[" + i + "] = " + document.forms[i].name );
        if( document.forms[i].name == "syohinList" ){
            document.forms[i].submit();
            return;
        }
    }

}

// 画面名：「サンプル注文はこちら」アンカー
// 機能：サンプル注文の先頭画面移動用HIDDENパラメータ記述
function writeSampleURL(){
    document.write("<form name=\"Sample\" action=\"" + _servletPath + "\" method=\"post\" target=\"_self\">");
    document.write("<input type=\"hidden\" name=\"action\" value=\"GoDspSampleLst\">");
    document.write("<input type=\"hidden\" name=\"bean\" value=\"Sample\">");
    document.write("<input type=\"hidden\" name=\"topURL\" value=\"" + document.URL + "\">");
    document.write("</form>");
}

// 画面名：サンプル注文の先頭画面へ
// 機能：確認ダイアログ表示
function goSample(){

    for( i=0 ; i<document.forms.length; i++ ){
        //alert("forms[" + i + "] = " + document.forms[i].name );
        if( document.forms[i].name == "Sample" ){
            document.forms[i].submit();
            return;
        }
    }

}

// 画面名：「注文はこちら」(商品指定)アンカー
// 機能：注文の先頭画面移動用HIDDENパラメータ記述
function writeSyohinURL(itemName){
    document.write("<form name=\"syohin\" action=\"" + _servletPath + "\" method=\"post\" target=\"_self\">");
    document.write("<input type=\"hidden\" name=\"action\" value=\"GoDspSyohinLst\">");
    document.write("<input type=\"hidden\" name=\"topURL\" value=\"" + _kenkouDomain + "\">");
    document.write("<input type=\"hidden\" name=\"" + itemName +"\" value=\"ON\">");
    document.write("<input type=\"hidden\" name=\"bean\" value=\"Order\">");
    document.write("</form>");
}
// 2006.05.01 ADD-ST n.mine
// 画面名：「注文はこちら」(商品指定)アンカー
// 機能：次画面遷移
function writeSyohinURL2(itemName){
    document.write("<form name=\"syohin\" action=\"" + _servletPath + "\" method=\"post\" target=\"_self\">");
    document.write("<input type=\"hidden\" name=\"action\" value=\"GoDspSyohinLst\">");
    document.write("<input type=\"hidden\" name=\"topURL\" value=\"" + _kenkouDomain + "\">");
    document.write("<input type=\"hidden\" name=\"" + itemName +"\" value=\"ON\">");
    document.write("<input type=\"hidden\" name=\"bean\" value=\"Order\">");
    document.write("</form>");
    for( i=0 ; i<document.forms.length; i++ ){
        if( document.forms[i].name == "syohin" ){
            document.forms[i].submit();
            return;
        }
    }
    
}
// 2006.05.01 ADD-ED n.mine
// 画面名：注文の先頭画面(商品指定)へ
// 機能：確認ダイアログ表示
function goSyohin(){

    for( i=0 ; i<document.forms.length; i++ ){
        //alert("forms[" + i + "] = " + document.forms[i].name );
        if( document.forms[i].name == "syohin" ){
            document.forms[i].submit();
            return;
        }
    }

}

function getKenkouPath(addPath){
    var retPath = "";
    retPath = "http://" + _kenkouDomain + addPath;
    location.href = retPath;
}

function getKenkouPathSSL(addPath){
    var retPath = "";
    retPath = "https://" + _kenkouDomain + addPath;
    location.href = retPath;
}

function getNinnikuPath(addPath){
    var retPath = "";
    retPath = "http://" + _ninnikuDomain + addPath;
    location.href = retPath;
}

function getKurozuPath(addPath){
    var retPath = "";
    retPath = "http://" + _kurozuDomain + addPath;
    location.href = retPath;
}

function getAction(){
    return _servletPath;
}

// 画面名：商品のポップアップ表示
// 機能：確認ダイアログ表示
function goPopupProduct(htmlPath){
var productPath = "";

    productPath = "http://" + _kenkouDomain + "/products/" + htmlPath;
    window.open(productPath ,'subwin','scrollbars=yes,resizable=yes, width=600, height=520');

}

// 画面名：「戻る」ボタン及びアンカー処理用HIDDENパラメータ記述
// 機能：「戻る」ボタン及びアンカー用HIDDENパラメータ記述
function writeBackURL( actionName, beanName, pageName){
    document.write("<form name=\"Back\" action=\"" + _servletPath + "\" method=\"post\" target=\"_self\">");
    document.write("<input type=\"hidden\" name=\"action\" value=\"" + actionName + "\">");
    document.write("<input type=\"hidden\" name=\"bean\" value=\"" + beanName + "\">");
    document.write("<input type=\"hidden\" name=\"P\" value=\"" + pageName + "\">");
    document.write("</form>");
}

// 「戻る」ボタン及びアンカー処理
// 機能：確認ダイアログ表示
function goBack(formName, pageName, actionName, beanName ){

    for( i=0 ; i<document.forms.length; i++ ){
        //alert("forms[" + i + "] = " + document.forms[i].name );
        if( document.forms[i].name == formName ){
            document.forms[i].P.value = pageName;
            document.forms[i].action.value = actionName;
            document.forms[i].bean.value = beanName;
            document.forms[i].submit();
            return;
        }
    }
}
// 画面名：アンカーリンク処理（会員専用メニュー及び注文履歴用）
// 機能：指定画面へ遷移
function doAnchor(mode,backJSP){
// javascript:doAnchor('member_kiyaku','')
	document.anchor.P.value = "";
    //会員専用メニュー
    if( mode == "member" ){
        document.anchor.action.value = "GoDispMypage";
        document.anchor.bean.value = "";
        document.anchor.membermenu_backtojsp.value = "";
        document.anchor.orderhistory_backtojsp.value = "";
        document.anchor.submit();
    //新規会員登録    
    }else if( mode == "new_member" ){
    	document.anchor.P.value = "";
        document.anchor.action.value = "GoDspNewMemberKiyaku";
        document.anchor.bean.value = "Init";
        document.anchor.login_backtojsp.value = "";
        document.anchor.membermenu_backtojsp.value = "";
        document.anchor.submit();
    //ログイン
    }else if( mode == "member_login" ){
    	document.anchor.P.value = "";
        document.anchor.action.value = "GoDspMemberLogin";
        document.anchor.bean.value = "Init";
        document.anchor.login_backtojsp.value = "GOMEMBER";
        document.anchor.membermenu_backtojsp.value = "";
        document.anchor.submit();
    //登録情報変更
    }else if( mode == "usrchg" ){
        document.anchor.action.value = "GoUpdCustomer";
        document.anchor.bean.value = "Init";
        document.anchor.orderhistory_backtojsp.value = "";
        document.anchor.usrchg_backtojsp.value = "GOMEMBER";
        document.anchor.submit();
    //注文履歴
    }else if( mode == "history" ){
        document.anchor.action.value = "GoDspOrderHistory";
        document.anchor.bean.value = "Order";
        document.anchor.orderhistory_backtojsp.value = "GOMEMBER";
        document.anchor.usrchg_backtojsp.value = "";
        document.anchor.submit();
     //ポイント交換
    }else if( mode == "point" ){
    	document.anchor.P.value = "";
        document.anchor.action.value = "GoPresentRequest";
        document.anchor.bean.value = "Customer";
        document.anchor.point_backtojsp.value = "GOMEMBER";
        document.anchor.membermenu_backtojsp.value = "";
        document.anchor.submit();        
    //定期変更
    }else if( mode == "regular_order" ){
    	document.anchor.P.value = "";
        document.anchor.action.value = "GoRegularOrderDisp";
        document.anchor.bean.value = "Init";
        document.anchor.regularorder_backtojsp.value = "GOMEMBER";
        document.anchor.membermenu_backtojsp.value = "";
        document.anchor.submit();  
    //会員メニュー会員規約用アンカー
    }else if( mode == "member_kiyaku" ){
        document.anchor.action.value = "GoDspMemberKiyaku";
        document.anchor.bean.value = "Init";
        document.anchor.membermenu_backtojsp.value = "GOMEMBER";
        document.anchor.orderhistory_backtojsp.value = "";
        document.anchor.submit();
    //会員専用ページについて
    }else if( mode == "about_member" ){
        document.anchor.P.value = "GOABOUT_MEMBER";
        document.anchor.action.value = "";
        document.anchor.bean.value = "";
        document.anchor.membermenu_backtojsp.value = "";
        document.anchor.orderhistory_backtojsp.value = "";
        document.anchor.submit();
    }
}

