<!--

var j_sid = getCookie("LoginSID");	// 端末ユニーク情報
//alert(j_sid);
//var j_cart_host      = "localhost/charaani";	// カートのURL
//var j_member_host = "localhost/charaani";	// 会員のURL
var j_cart_host      = location.host;	// カートのURL
var j_member_host =  location.host;	// 会員のURL
var j_url;				// 現在のURL
var j_host;
var j_path;
var j_para;
j_host     = "http://" + location.host;
j_path     = location.pathname;
if (location.search == ""){
    j_url_para = "";
}
else{
    j_para     = location.search.substr(1,100).split("&");
    var j_url_para = "";
    var j_para2;
    for ( var i=0; i < j_para.length; i++ ){
          j_para2 = j_para[i].split("=");
          if (j_url_para == ""){
              j_url_para = j_url_para + j_para2[0] + "~" + j_para2[1];
          }
          else{
              j_url_para = j_url_para + "*" + j_para2[0] + "~" + j_para2[1];
          }
    }
}
if ( j_url_para == "" ){
	var j_url = j_host + j_path;
}
else{
	var j_url = j_host + j_path + '***' + j_url_para;
}


// *-------------------------*
// < Cookieの内容を取得>
// *-------------------------*
function getCookie(theName)
{
	theName += "=";	                            //　=を追加して検索の手抜きをする
	theCookie = document.cookie+";";	//　検索時最終項目で-1になるのを防ぐ
	start = theCookie.indexOf(theName);	//　指定された名前を検索する
	if (start != -1)
	{
		end = theCookie.indexOf(";",start);
		return unescape(theCookie.substring(start+theName.length,end));
	}
	return false;
}

// *-------------------------*
// < カート内容の表示 >
// *-------------------------*
function Cart_Check(){
    location.href   = "http://" + j_cart_host  + "/cart_in.asp?host=" + j_host + "&path=" + j_path + "&param=" + j_url_para;
    //location.href   = "http://<%=ini_ShopURL%>/cart_in.asp?site=<%=ini_SITE%>&host=" + j_host + "&path=" + j_path + "&param=" + j_url_para + "&sid=<%=cLoginSID%>";
}

// *-------------------------*
// < カートに入れる >
// *-------------------------*
function cart_in(jprdid){
    location.href   = "http://" + j_cart_host  + "/cart_in.asp?prdid=" + jprdid + "&host=" + j_host + "&path=" + j_path + "&param=" + j_url_para + "&sid=" + j_sid;
    //location.href   = "http://<%=ini_ShopURL%>/cart_in.asp?prdid=" + jprdid + "&site=<%=ini_SITE%>&host=" + j_host + "&path=" + j_path + "&param=" + j_url_para + "&sid=<%=cLoginSID%>";
}

function cart_in_pop(jprdid,jhost,jpath,jpara){
    var j_host;
    var j_path;
    var j_para;

    if (jhost == "" ){
       j_host     = "http://" + opener.location.host;
       j_path     = opener.location.pathname;
       j_para     = opener.location.search.substr(1,100).split("&");
       j_url_para = "";
       for ( var i=0; i < j_para.length; i++ ){
          if (j_url_para == ""){
             j_url_para = j_url_para + j_para[i];
          }
          else{
             j_url_para = j_url_para + "*" + j_para[i];
          }
       }
    }
    else{
       j_host     = jhost;
       j_path     = jpath;
       j_url_para = jpara;
    }
    var j_url = "http://" + j_cart_host  + "/cart_in.asp?prdid=" + jprdid + "&site=<%=ini_SITE%>&host=" + j_host + "&path=" + j_path + "&param=" + j_url_para + "&sid=<%=Session.SessionID%>";
    //alert(j_url);
    opener.location.href   = j_url;
    location.href          = "close.asp";
}

// *-------------------------*
// < カートの数量を変更 >
// *-------------------------*
function cart_upd(doc){
   //alert(document.cyumon.elements[0].value);
   OS_name  = 'Cyumon_Back_site';
   getValueSITE = getCookie(OS_name);
   ix = 0;
   OS_name  = 'cPRDID'+getValueSITE;
   for (i=0;i<=document.cyumon.gyo.value;i++){
         getValue = getCookie(OS_name);
         //alert(getValue);
         str_prdidall = getValue.split("&");
         
         d_prdid = document.cyumon.elements[ix].value;
         ix = ix + 1;
         d_suryo = document.cyumon.elements[ix].value;
         ix = ix + 2;
         //alert(d_prdid + " " + d_suryo);
         c = 0;
         set_prdid = ""
         for (idx=0;idx<str_prdidall.length;idx++){
            str_prdid = str_prdidall[idx].split("=");
            if ( str_prdid[0]==d_prdid){
               c = c + 1;
               if ( c > 1 ){
                   set_prdid = set_prdid + "&";
               }  
               set_prdid = set_prdid + str_prdid[0] + "=" + d_suryo;
            }
            else{
               c = c + 1;
               if ( c > 1 ){
                   set_prdid = set_prdid + "&";
               }  
               set_prdid = set_prdid + str_prdid[0] + "=" + str_prdid[1];
            }
         }
         document.cookie = "cPRDID"+getValueSITE+"=" + set_prdid;
   }
   //alert(set_prdid);
   location.reload();
}

// *-------------------------*
// < カート内容を全て削除する >
// *-------------------------*
function cart_del(jpara){
   OS_name  = 'Cyumon_Back_site';
   getValueSITE = getCookie(OS_name);
   document.cookie = "DELETE=" + jpara;
   if (jpara=="ALL"){
      document.cookie="cPRDID"+getValueSITE+"=;expires=Thu, 01-Jan-70 00:00:01 GMT";
   }
   else{
      OS_name  = 'cPRDID'+getValueSITE;
      getValue = getCookie(OS_name);
      str_prdidall = getValue.split("&");
      set_prdid = ""
      c = 0;
      for (i=0;i<str_prdidall.length;i++){
         str_prdid = str_prdidall[i].split("=");
         if ( str_prdid[0]==jpara){
         }
         else{
            c = c + 1;
            if ( c > 1 ){
                set_prdid = set_prdid + "&";
            }  
            set_prdid = set_prdid + str_prdid[0] + "=" + str_prdid[1];
         }
       }
       //alert("cPRDID"+getValueSITE + "=" + set_prdid);
       document.cookie = "cPRDID"+getValueSITE + "=" + set_prdid;
   }
   document.cookie = "cDELFLG=DEL";
   location.reload();
}

// *-------------------------*
// < 商品詳細画面表示>
// *-------------------------*
//function syosai_open(prdid){
//        j_url = "ditails.asp?prdid=" + prdid;
//       location.href = j_url;
//}
function syosai_open(prdid){
        w_height = screen.availHeight
        w_width  = screen.availWidth
        j_height = 500;
        j_width  = 680;
        w_y = parseInt(( w_height - j_height ) / 2 );
        w_x = parseInt(( w_width  - j_width  ) / 2 );
        j_url = "ditails.asp?prdid=" + prdid;
        w_name = window.open( j_url, "WindowOpen", "titlebar=no,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=" + j_width + ",height=" + j_height + ",left=" + w_x + ",top=" + w_y);
        }

// *-------------------------*
// < ログイン >
// *-------------------------*
function memberlogin()
{
    location.href = "http://" + j_member_host + "/member_login.asp?bkurl=" + j_url + "&sid=" + j_sid;
}
function memberlogin2()
{
  var vDoc = document.login;

  var  sTR_jaccount =    vDoc.txID.value;
  var  sTR_jpass    =    vDoc.txPASS.value;

  if (sTR_jaccount == ""){
     alert("ログインＩＤを入力して下さい。");
     vDoc.txID.focus();
     return false;
  }
  else{
     if (sTR_jpass == ""){
        alert("パスワードを入力して下さい。");
        vDoc.txPASS.focus();
        return false;
     }
     else{
        vDoc.txMYURL.value  = j_url;
        return true;
     }
     //location.href = "http://" + j_member_host + "/member_login.asp?bkurl=" + j_url + "&sid=" + j_sid;
  }
}

// *-------------------------*
// < ログオフ >
// *-------------------------*
function memberlogoff()
{
    //alert("http://" + j_member_host + "/member_logoff.asp?bkurl=" + j_url + "&sid=" + j_sid);
    location.href = "http://" + j_member_host + "/member_logoff.asp?bkurl=" + j_url + "&sid=" + j_sid;
}

// *-------------------------*
// < パスワード変更 >
// *-------------------------*
function passent()
{
    location.href = "http://" + j_member_host + "/member_passid.asp?bkurl=" + j_url  + "&sid=" + j_sid;
}

// *-------------------------*
// < 会員登録 >
// *-------------------------*
function memberkiyaku()
{
    location.href = "http://" + j_member_host + "/member_kiyaku.asp?bkurl=" + j_url + "&sid=" + j_sid;
}

// *-------------------------*
// < 会員変更 >
// *-------------------------*
function memberent()
{
    location.href = "https://" + j_member_host + "/member_ent.asp?bkurl=" + j_url + "&sid=" + j_sid;
    //location.href = "http://" + j_member_host + "/member_ent.asp?bkurl=" + j_url + "&sid=" + j_sid;
}


//-->
