// ==============================================================
// モード付加単純サブミット
// ==============================================================
function fncSubmitAddMode(mode) {
		document.forms[0].mode.value = mode;
		document.forms[0].submit();
}

// ==============================================================
// 詳細押下イベント
// ==============================================================

function fncSubComicDtl(file) {	
	// サブウィンドウの大きさと開く位置の指定
	l = 0; // 表示するx座標
	t = 0; // 表示するy座標
	w = 350; // 横幅
	h = 400; // 縦幅
  x = (screen.width - w) / 2;
  y = (screen.height - h) / 2;
  NewWinC = window.open(file,"NewWindow",
    "screenX="+"400"+",screenY="+y+",left="+x+",top="+y+",width="+w+",height="+h+",menubar=0,toolbar=0,resizable=1,location=0,directories=0,status=0,scrollbars=1,titlebar=no");
	NewWinC.focus();
}

// ==============================================================
// ログカウントアップ
// ==============================================================
function fncCountUpLog(file) {
	// オブジェクトの生成
	//非同期通信
	var xmlhttp = false;
	try {
	 xmlhttp = new ActiveXObject('Microsoft.XMLHTTP');
	} catch (e) {
	 xmlhttp = false;
	}
	if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
	 xmlhttp = new XMLHttpRequest();
	}
	if (xmlhttp) {
  
		//GET送信
		xmlhttp.open('GET', file);
	
		xmlhttp.onreadystatechange = function() {
			if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
//					var disp = document.getElementById('disp');
//					disp.innerHTML=xmlhttp.responseText;
			}
		}

		xmlhttp.send(null);

	}
}	

// ==============================================================
// innerHtml
// ==============================================================
function fncInnerHtml(e){
	if(document.all || document.getElementById){ //IEとNN6用
		if(document.all){
			document.all["default"].innerHTML = document.all["empty"].innerHTML;
			document.all["inner_main"].innerHTML = document.all[e].innerHTML;
		}else{
			document.getElementById("default").innerHTML = document.getElementById("empty").innerHTML;
			document.getElementById("inner_main").innerHTML = document.getElementById(e).innerHTML;
		}
	}
}

// ==============================================================
// URLエンコード
// ==============================================================
//URL Encode (UTF-8)
function encodeURL(str) {
  var character = '';
  var unicode   = '';
  var string    = '';
  var i         = 0;

  for (i = 0; i < str.length; i++) {
    character = str.charAt(i);
    unicode   = str.charCodeAt(i);

    if (character == ' ') {
      string += '+';
    } else {
      if (unicode == 0x2a || unicode == 0x2d || unicode == 0x2e || unicode == 0x5f || ((unicode >= 0x30) && (unicode <= 0x39)) || ((unicode >= 0x41) && (unicode <= 0x5a)) || ((unicode >= 0x61) && (unicode <= 0x7a))) {
        string = string + character;
      } else {
        if ((unicode >= 0x0) && (unicode <= 0x7f)) {
          character   = '0' + unicode.toString(16);
          string += '%' + character.substr(character.length - 2);
        } else if (unicode > 0x1fffff) {
          string += '%' + (oxf0 + ((unicode & 0x1c0000) >> 18)).toString(16);
          string += '%' + (0x80 + ((unicode & 0x3f000) >> 12)).toString(16);
          string += '%' + (0x80 + ((unicode & 0xfc0) >> 6)).toString(16);
          string += '%' + (0x80 + (unicode & 0x3f)).toString(16);
        } else if (unicode > 0x7ff) {
          string += '%' + (0xe0 + ((unicode & 0xf000) >> 12)).toString(16);
          string += '%' + (0x80 + ((unicode & 0xfc0) >> 6)).toString(16);
          string += '%' + (0x80 + (unicode & 0x3f)).toString(16);
        } else {
          string += '%' + (0xc0 + ((unicode & 0x7c0) >> 6)).toString(16);
          string += '%' + (0x80 + (unicode & 0x3f)).toString(16);
        }
      }
    }
  }

  return string;
}

// ==============================================================
// オンマウス/オンクリック色付けイベント
// ==============================================================
function fncSetColorOnMouse(id){

	if( document.getElementById(id).className == ''){
	 document.getElementById(id).style.backgroundColor = '#FFF0F5';
	}
}

function fncSetColorOffMouse(id){
	if( document.getElementById(id).className == ''){
	 document.getElementById(id).style.backgroundColor = '#FFFFFF';
	}	
}

function fncSetColorOnClick(id,roopCnt){

  for(i=0;i<roopCnt;i++){
		var id_name = 'row' + (i+1);
		if( document.getElementById(id_name).className != ''){ 
			document.getElementById(id_name).style.backgroundColor = '#FFFFFF';
			document.getElementById(id_name).className = '';
			break;
		}
  }
  
 document.getElementById(id).style.backgroundColor = '#F0FFFF';
 document.getElementById(id).className = 'TURNED_BLUE';

}

// ==============================================================
// AMAZON情報関連ボタン押下イベント
// ==============================================================
function fncEcsChangePageUser(page,page_mode,mode) {

	document.USER_ECS.ECS_PAGE.value = page;	
	document.USER_ECS.ECS_PG_MODE.value = page_mode;		
	document.USER_ECS.MODE.value = mode;
	document.USER_ECS.submit();
}
