/**
 * 引数をチェックし、alartを表示する
 * 現状はtextareaの未入力チェックのみ
 *   
 * @param チェックするformのオブジェクト
 */
function argCheck(obj){
    if(obj.type=="textarea" || obj.type=="text"){
        if(obj.value.length < 1){
            alert('内容が指定されていません');
            return false;
        }else{
            return true;
        }
    }else{
        alert(obj.value.length);
    }
}

// 入力値が、正の整数かどうかチェック（0〜9チェック）
function cm_isPosInteger(inputVal) {
  inputStr = "" + inputVal;
  for (var i = 0; i < inputStr.length; i++) {
    var oneChar = inputStr.charAt(i);
    if (oneChar < "0" || oneChar > "9") {
      return false;
    }
  }
  return true;
}

////////////////////////////////////////////////////////////
// 入力値が、null、または空かをチェックする
function cm_isEmpty(inputStr) {
  if (inputStr == null || inputStr == "") {
    return true;
  }
  return false;
}

////////////////////////////////////////////////////////////
// 入力値が、小数点を含む整数かチェックする
function cm_isNumber(inputVal) {
    oneDecimal = false ;
    inputStr = "" + inputVal;
    for (var i = 0; i < inputStr.length; i++) {
        var oneChar = inputStr.charAt(i);
        if (oneChar == "." && !oneDecimal) {
            oneDecimal = true;
            continue;
        }
        if (oneChar < "0" || oneChar > "9") {
            return false;
        }
    }
    return true;
}

////////////////////////////////////////////////////////////
// delete the space at begin and end ;
function cm_deleteSpaceLeftAndRight(strin)
{
    if (strin == null )
    {
       return "";
    }
    var bFlag = true;
    var strReturnValue = "";

    while(bFlag){
      if(strin.length <= 0){
          break;
      }
      var strStart = strin.substring(0,1);
      var strEnd = strin.substring(strin.length - 1);
      if( strEnd == "　" || strEnd == " " ){
        strin = strin.substring(0,strin.length - 1);
      }
      else if( strStart == "　" || strStart == " " ){
        strin = strin.substring(1,strin.length);
      }
      else{
        bFlag = false;
      }
    }
    strReturnValue = strin;
    return strReturnValue;
}

////////////////////////////////////////////////////////////
// trim 0  at begin;
function trim0(strnum)
{
	var i=0;
	if(strnum.length==0)
	{
		return '';
	}
	
	while(strnum.charAt(i)=='0')
	{
		i++;
	}
	return strnum.substring(i);
}

////////////////////////////////////////////////////////////
//add 0 at begin;
function add0(strin,length){
	if( strin.length < length){
	while(strin.length <length){
		strin="0"+strin;
	}
    }
    return strin;
}


function inquiry(logicname){
	document.toiawase.EcLogicName.value = logicname;
	/*
	if(document.getElementById("inquiry_jenre_id") != null ) {
		document.toiawase.jenre_id.value = document.getElementById("inquiry_jenre_id").value;
	}
	if(document.getElementById("inquiry_cat_id_1") != null) {
		document.toiawase.cat_id_1.value = document.getElementById("inquiry_cat_id_1").value;
	}
	if(document.getElementById("inquiry_cat_id_2") != null) {
		document.toiawase.cat_id_2.value = document.getElementById("inquiry_cat_id_2").value;
	}
	if(document.getElementById("inquiry_cat_id_3") != null) {
		document.toiawase.cat_id_3.value = document.getElementById("inquiry_cat_id_3").value;
	}
	if(document.getElementById("inquiry_jenre") != null) {
		document.toiawase.jenre.value = document.getElementById("inquiry_jenre").value;
	}
	if(document.getElementById("inquiry_cat_name_1") != null) {
		document.toiawase.cat_name_1.value = document.getElementById("inquiry_cat_name_1").value;
	}
	if(document.getElementById("inquiry_cat_name_2") != null) {
		document.toiawase.cat_name_2.value = document.getElementById("inquiry_cat_name_2").value;
	}
	if(document.getElementById("inquiry_cat_name_3") != null) {
		document.toiawase.cat_name_3.value = document.getElementById("inquiry_cat_name_3").value;
	}
	*/
	document.toiawase.submit();
}

   //商品を選ぶに遷移
	function selectgoods(){
		document.navigator_cart.EcLogicName.value="cart.toTop";
		document.navigator_cart.submit();
	}
	//カート確認に遷移
	function cartconfirm(){
		document.navigator.EcLogicName.value="cart.display";
		document.navigator.submit();
	}
	//届先情報商品確認数量に遷移
	function todokeshouhin(){
		document.navigator.EcLogicName.value="menu.toKakuninGmn";
		document.navigator.submit();
	}
	//決済依頼主情報に遷移
	function kessaiiraiinput(){
		document.navigator.EcLogicName.value="koubai.editKessaiirai";
		document.navigator.submit();
	}
	//決済依頼主情報に遷移
	function kessaiiraiinput2(){
		document.navigator.EcLogicName.value="koubai.editKessaiirai2";
		document.navigator.submit();
	}
	//支払い方法指定に遷移
	function siharaiinput(){
		document.navigator.EcLogicName.value="koubai.siharai";
		document.navigator.submit();
	}

//外商 add by zhaohp 2005/07/04
   //商品を選ぶに遷移
	function selectgoods_Merchant(){
		document.navigator.EcLogicName.value="cart.toTop_Merchant";
		document.navigator.submit();
	}
	//カート確認に遷移
	function cartconfirm_Merchant(){
		document.navigator.EcLogicName.value="cart.display_Merchant";
		document.navigator.submit();
	}
	//届先情報商品確認数量に遷移
	function todokeshouhin_Merchant(){
		document.navigator.EcLogicName.value="menu.toKakuninGmn_Merchant";
		document.navigator.submit();
	}
	//決済依頼主情報に遷移
	function kessaiiraiinput_Merchant(){
		document.navigator.EcLogicName.value="koubai.kessaiirai_Merchant";
		document.navigator.submit();
	}
	//支払い方法指定に遷移
	function siharaiinput_Merchant(){
		document.navigator.EcLogicName.value="koubai.siharai_Merchant";
		document.navigator.submit();
	}
	
	 //入会店舗選択遷移
	function shopselect(){
		document.navigator.EcLogicName.value="tomonokai.shopselect";
		document.navigator.submit();
	}
	 //入会コース選択遷移
	function courseselect(){
		document.navigator.EcLogicName.value="tomonokai.courseselect";
		document.navigator.submit();
	}
	
	//入会会員ログイン遷移
	function kaiinLogin(){
		document.navigator.EcLogicName.value="tomonokai.kaiinloginreturn";
		document.navigator.submit();
	}