// -------------------------- Version Select ----------------------------
var  bName = navigator.appName;
var  bVer = parseInt(navigator.appVersion);
var  isMinIE4 = (bName == "Microsoft Internet Explorer" && bVer >= 4) ? true : false;
var  isMinIE5 = (isMinIE4 && navigator.appVersion.indexOf("5.") >= 0) ? true : false;
var  isMinNS3 = (bName == "Netscape" && bVer >= 3) ? true : false;
var  isMinNS4 = (bName == "Netscape" && bVer >= 4 && bVer < 5) ? true : false;
var  isMinNS5 = (bName == "Netscape" && bVer >= 5) ? true : false;
var  areaFlg = 0;

// フォルダ表示・非表示
function displayFolder(item, openclose) {
  if (isMinIE4) lyr = eval("document.all." + item + "On");
  if (isMinNS5) lyr = eval("document.getElementById('" + item + "On')");
  if (openclose==1) type = "block";
  else type = "none";
  if (isMinIE4 || isMinNS5)lyr.style.display = type;

  if (isMinIE4) lyr = eval("document.all." + item + "Off");
  if (isMinNS5) lyr = eval("document.getElementById('" + item + "Off')");
  if (openclose==1) type = "none";
  else type = "block";
  if (isMinIE4 || isMinNS5) lyr.style.display = type;
}

// プルダウンメニュー
function showBlock(item) {
  if (isMinIE4) lyr = eval("document.all." + item);
  if (isMinNS5) lyr = eval("document.getElementById('" + item + "')");
  if (isMinIE4 || isMinNS5) lyr.style.display = "block";
}
function hideBlock(item) {
  if (isMinIE4) lyr = eval("document.all." + item);
  if (isMinNS5) lyr = eval("document.getElementById('" + item + "')");
  if (isMinIE4 || isMinNS5) lyr.style.display = "none";
}

function swapImage(id,path) {
  if (isMinIE4) img = eval("document.all." + id);
  if (isMinNS5) img = eval("document.getElementById('" + id + "')");
  if (isMinIE4 || isMinNS5) img.src = path;
}

// -------------------------- cell color change ----------------------------

function swapStyle(cell, onoff){
  var c_name;

  if(cell == null || cell.className == "")
    return false;

  switch(onoff){
  case 1:
    c_name = cell.className + "-on";
    break;
  case 0:
    c_name = cell.className.replace("-on","");
  }
  cell.className = c_name;
  return true;
}

function cellColor(cell, onoff){
  var c_name;

  if(cell == null || cell.className == "")
    return false;

  switch(onoff){
  case 1:
    c_name = cell.className + "-on";
    break;
  case 0:
    c_name = cell.className.replace("-on","");
  }
  cell.className = c_name;
  return true;
}

function cellColor1(cell,color) {
  cell.style.backgroundColor = color;
}

function cellColor0(cell) {
  cell.style.backgroundColor = "";
}

function swapBgFg1(cell,bg,fg) {
  cell.style.backgroundColor = bg;
  cell.style.color = fg;
}

function swapBgFg0(cell) {
  cell.style.backgroundColor = "";
  cell.style.color = "";
}

function cellColorID1(id,color) {
  if (isMinIE4) cell = eval("document.all." + id);
  if (isMinNS5) cell = eval("document.getElementById('" + id + "')");
  if (isMinIE4 || isMinNS5) cell.style.backgroundColor = color;
}

function cellColorID0(id) {
  if (isMinIE4) cell = eval("document.all." + id);
  if (isMinNS5) cell = eval("document.getElementById('" + id + "')");
  if (isMinIE4 || isMinNS5) cell.style.backgroundColor = "";
}

function swapBgImg1(cell, img){
    cell.style.backgroundImage = "url("+img+")";
}

function swapBgImg0(cell, img, flag){
    cell.style.backgroundImage = '';
}

function openSizedWin(url,w,h,targetName){
  newwin = window.open(url, targetName, "width="+w+",height="+h+",menubar=1,scrollbars=1,resizable=1,toolbar=1,location=0,personalbar=0,directories=0,status=0");
  newwin.focus();
}

function openNormalWin(url){
  newwin = window.open(url);
  newwin.focus();
}

function openBox(e,url,targetName,offsetx,offsety,width,height,scroll){
  //マウスの現在位置
  var mouseXonScreen = null
  var mouseYonScreen = null
  //マウスの現在位置取得
  if(document.all){
     //e4,e5,e6
     mouseXonScreen = window.event.screenX
     mouseYonScreen = window.event.screenY
  } else if(document.layers || document.getElementById ){
     //n4,n6,n7,m1,o6
     mouseXonScreen = e.screenX
     mouseYonScreen = e.screenY
  }
  //マウスの現在位置から何ピクセル離すかをセット
  var setx = mouseXonScreen + offsetx
  var sety = mouseYonScreen + offsety
  //サブウインドウを開く
  //(引数以外のパラメータも下記でセットできます)
  var para =""
           +" left="        +setx
           +",screenX="     +setx
           +",top="         +sety
           +",screenY="     +sety
           +",toolbar="     +0
           +",location="    +0
           +",directories=" +0
           +",status="      +0
           +",menubar="     +0
           +",scrollbars="  +scroll
           +",resizable="   +1
           +",innerWidth="  +width
           +",innerHeight=" +height
           +",width="       +width
           +",height="      +height
    helpwin=window.open(url,targetName,para)
    helpwin.focus()
}

function checkLogout(type, url){
  switch(type){
  case "editting":
    msg = "ログアウトします。\n作業中の内容が失われますがよろしいですか？";
    break;
  default:
    msg = "ログアウトします。 よろしいですか？";
    break;
  }

  if(!window.confirm(msg))
    return;

  location.replace(url);
}

function checkAutoLogin(){
  if(document.form1.autoLogin.checked)
    if(!window.confirm("チェックをつけていると Cookie が保存されます"))
      return;
  location.href="article_submit.html";
}

function checkLogoutAdmin(url){
  msg = "ログアウトします。\n作業中の内容が失われますがよろしいですか？";

  if(!window.confirm(msg))
    return;

  location.replace(url);
}

function checkNG(id, url){
  b = eval("document.all." + id);

  if(b.style.display == "none"){
    b.style.display = "block";
    return;
  }
  location.href = url;
}

function helpWin(url) {
  var doc = window.open("","help","width=500,height=450,menubar=0,scrollbars=0,resizable=0,toolbar=0,location=0,personalbar=0,directories=0,status=0").document;
  doc.open();

  doc.write('<html>\n');
  doc.write('<head>\n');
  doc.write('<base href="http://blog.blwisdom.com/">\n');
  doc.write('<title>ヘルプ</title>\n');
  doc.write('<meta http-equiv=content-type content="text/html; charset=Shift_JIS">\n');
  doc.write('<link type="text/css" rel="stylesheet" href="/css/core.css">\n');
  doc.write('<link type="text/css" rel="stylesheet" href="/guide/guide.css">\n');
  doc.write('</head>\n');
  doc.write('<body>\n');
  doc.write('<div id="petti-window">\n');
  doc.write('<table width="100%" height="450" cellspacing="0" cellpadding="0" border="0">\n');
  doc.write('<tr><td class="title-bar"></td>\n');
  doc.write('\t<td class="title-bar" align="right"></td></tr>\n');
  doc.write('<tr><td colspan="2" height="100%">\n');
  doc.write('\t<iframe src="/help/' + url + '" width="100%" height="100%" frameborder="0" border="0"></iframe></td></tr>\n');
  doc.write('<tr><td colspan="2" id="buttons"><button onclick="javascript:window.close()">閉じる</button></td></tr>\n');
  doc.write('</table>\n');
  doc.write('</div>\n');
  doc.write('</body>\n');
  doc.write('</html>\n');

  doc.close();
  doc.focus();
}

function helpWinRel(url) {
  var doc = window.open("","help","width=500,height=450,menubar=0,scrollbars=0,resizable=0,toolbar=0,location=0,personalbar=0,directories=0,status=0").document;
  doc.open();

  doc.write('<html>\n');
  doc.write('<head>\n');
  doc.write('<title>ヘルプ</title>\n');
  doc.write('<meta http-equiv=content-type content="text/html; charset=Shift_JIS">\n');
  doc.write('<link type="text/css" rel="stylesheet" href="/css/core.css">\n');
  doc.write('<link type="text/css" rel="stylesheet" href="/guide/guide.css">\n');
  doc.write('</head>\n');
  doc.write('<body>\n');
  doc.write('<div id="petti-window">\n');
  doc.write('<table width="100%" height="450" cellspacing="0" cellpadding="0" border="0">\n');
  doc.write('<tr><td class="title-bar"></td>\n');
  doc.write('\t<td class="title-bar" align="right"></td></tr>\n');
  doc.write('<tr><td colspan="2" height="100%">\n');
  doc.write('\t<iframe src="/dm6-image/help/' + url + '" width="100%" height="100%" frameborder="0" border="0"></iframe></td></tr>\n');
  doc.write('<tr><td colspan="2" id="buttons"><button onclick="javascript:window.close()">閉じる</button></td></tr>\n');
  doc.write('</table>\n');
  doc.write('</div>\n');
  doc.write('</body>\n');
  doc.write('</html>\n');

  doc.close();
  doc.focus();
}


/**
 * 指定されたCheckBoxのName属性名より、チェック状態と
 * なっているCheckBoxのCountを取得する。
 *
 * @param ctrlObj CheckBoxのコントロールオブジェクト
 * @return チェック状態のコントロール数
 */
function getCountForCheckedCheckBox( ctrlObj ) {

  var nRet = 0; // 返却値
  // 1.入力値チェック
  if ( ctrlObj == null ) {
    return nRet;
  }

  var nCount = 0;
  if(ctrlObj.type == "checkbox"){
    if ( ctrlObj.checked == true ) {
      nCount = 1;
    }
  }else{
    // 2.コントロールの個数を取得
    var len = ctrlObj.length;
    // 3.チェック状態のCheckBoxをカウント
    for ( var i=0; i<len; i++ ) {
      if ( ctrlObj[i].checked == true ) {
        nCount = nCount + 1;
      }
    }
  }

  nRet = nCount;
  return nRet;
}

/**
 * 指定されたCheckBoxのName属性名より、チェック状態と
 * なっているCheckBoxの先頭にフォーカスをセットする。
 *
 * @param ctrlObj CheckBoxのコントロールオブジェクト
 * @return 正常：true, 異常：false
 */
function setForcusForCheckedCheckBox( ctrlObj ) {

  var bRet = false; // 返却値
  // 1.入力値チェック
  if ( ctrlObj == null ) {
    return bRet;
  }
  // 2.コントロールの個数を取得
  var len = ctrlObj.length;
  // 3.チェック状態のCheckBoxをカウント
  var nCount = 0;
  for ( var i=0; i<len; i++ ) {
    if ( ctrlObj[i].checked == true ) {
      ctrlObj[i].focus();
      bRet = true;
      break;
    }
  }

  return bRet;
}

function url(topdomain, track, css ) {
  tburl_openWin(topdomain, track, css);
}

function tburl_openWin(topdomain, track, css){
  var trackback = window.open("","","Width=500,Height=250");
  trackback.document.open();
  trackback.document.write('<html lang="ja">\n');
  trackback.document.write('<head>\n');
  trackback.document.write('<base href="http://' + topdomain + '" />\n');
  trackback.document.write('<meta http-equiv="Content-Type" content="text/html; charset=Shift_JIS" />\n');
  trackback.document.write('<title>トラックバックURL表示</title>\n');
  trackback.document.write('<meta http-equiv="Content-Scripdt-Type" content="text/javascript" />\n');
  trackback.document.write('<meta http-equiv="Content-Style-Type" content="text/css" />\n');
  trackback.document.write('<link href="/css/articles.new/common.css" rel="stylesheet" type="text/css" />\n');
  trackback.document.write('<link href="/' + css + '" rel="stylesheet" type="text/css" />\n');
  trackback.document.write('</head>\n');
  trackback.document.write('<body>\n');
  trackback.document.write('<table id="miniwin" cellspacing="1" cellpadding="0" border="0">\n');
  trackback.document.write('<tr><td class="message">トラックバック用URL </td></tr>\n');
  trackback.document.write('<tr><td><div class="url">' + track + '</div></td></tr>\n');
  trackback.document.write('<tr><td class="message" height="100%">\n');
  trackback.document.write('<p><span class="notice">注意）</span>\n');
  trackback.document.write('ブログ管理者の以下の設定により、受信制限される可能性があります。\n');
  trackback.document.write('<ul style="list-style-type:disc;margin:auto;padding:0.3em 0em;">\n');
  trackback.document.write('<li>記事本文中に対象記事ページへのリンクがない場合</li>\n');
  trackback.document.write('<li>URLや記事タイトル、本文中に管理者が指定した文字列を含む場合</li>\n');
  trackback.document.write('<li>全トラックバック保留設定をしている場合</li>\n');
  trackback.document.write('</ul></p>\n');
  trackback.document.write('  <p>送付したい記事のトラックバックのフォームから投稿するだけで送付できます。<br />\n');
  trackback.document.write('  トラックバックURLもご利用できます。</p>\n');
  trackback.document.write('  </td></tr>\n');
  trackback.document.write('<tr><td class="buttons"><input type="button" value="閉じる" onClick="javascript:window.close()" /></td></tr>\n');
  trackback.document.write('</table>\n');
  trackback.document.write('</body>\n');
  trackback.document.write('</html>\n');

  trackback.document.close();

  trackback.document.focus();
}
function blink() {
  if (!document.all) { return; }
  for (i = 0; i < document.all.length; i++) {
    obj = document.all(i);
    if (obj.className == "blink") {
      if (obj.style.visibility == "visible") {
        obj.style.visibility = "hidden";
      } else {
        obj.style.visibility = "visible";
      }
    }
  }
  setTimeout("blink()", 800);
}

function themeSearchForm() {
  var bRet = true;
  var obj = document.themesearch.searchstring.value;
        if (obj == "")
          bRet = false;
  return bRet;
}

function circleSearchForm() {
  var bRet = true;
  var obj = document.searchforms.circleSearchKey.value;
        if (obj == "")
          bRet = false;
  return bRet;
}

function topLinks(){
}

function footCopyright(){
}

function include_free_space(){
}

function include_free_space_news(){
}

/**
 * ブーメランコメントするときの文字数チェック
 */
function articlePageValueCheck1(){
  var bRet = true;
  var obj1 = document.atcl1.title.value;
  var obj2 = document.atcl1.textbody.value;
  var textlength = obj2.length;

  if(obj1 == "" && obj2 == ""){
    alert("タイトルまたは本文を入力してください。");
    bRet = false;
  }

  if(textlength > 20000){
    alert("本文は20000文字以内で入力してください。");
    bRet = false;
  }

  return bRet;
}

/**
 * 認証コメント書き込みの文字数チェック
 */
function articlePageValueCheck2(commentFlg){
  var bRet = true;
  var obj1 = document.atcl2.comment.value;
  var obj2 = document.atcl2.nickname.value;
  var textlength = obj1.length;

  if(obj1 == "" || obj2 == ""){
    alert("コメントまたはニックネームを入力してください。");
    bRet = false;
  }

  if(bRet == true){
    if(textlength > 500){
      alert("コメントは500文字以内で入力してください。");
      bRet = false;
    }
  }

  return bRet;
}

/**
 * 通常コメント書き込みの文字数チェック
 */
function articlePageValueCheck3(){
  var bRet = true;
  var obj1 = document.atcl2.comment.value;
  var obj2 = document.atcl2.nickname.value;
  var textlength = obj1.length;

  if(obj1 == "" || obj2 == ""){
    alert("コメントまたはニックネームを入力してください。");
    bRet = false;
  }

  if(bRet == true){
    if(textlength > 500){
      alert("コメントは500文字以内で入力してください。");
      bRet = false;
    }
  }

  msg = "コメント内容はこのページに書き込まれます。よろしいですか？";

  if(bRet == true){
    if(window.confirm(msg)){
      document.atcl2.comment.focus();
      return bRet;
    }else{
      document.atcl2.comment.focus();
      bRet = false;
    }
  }

  return bRet;
}

/**
 * ブーメランコメントするときの文字数チェック
 */
function themePortalValueCheck(){
  var bRet = true;
  var obj1 = document.portal1.title.value;
  var obj2 = document.portal1.textbody.value;
  var textlength = obj2.length;

  if(obj1 == "" && obj2 == ""){
    alert("タイトルまたは本文を入力してください。");
    bRet = false;
  }

  if(textlength > 20000){
    alert("本文は20000文字以内で入力してください。");
    bRet = false;
  }

  return bRet;
}

function onMySubmit(formObj, url) {
  formObj.action=url;
  formObj.submit();
}

function onAuthCommentSubmit(formObj, url1, url2) {
  var bRet = true;
  var obj1 = formObj.comment.value;
  var obj2 = formObj.nickname.value;
  var textlength = obj1.length;

  if(obj1 == "" || obj2 == ""){
    alert("コメントまたはニックネームを入力してください。");
    bRet = false;
  }

  if(bRet == true){
    if(textlength > 500){
      alert("コメントは500文字以内で入力してください。");
      bRet = false;
    }
  }

  msg = "あなたのブログへのリンクを作成しますか？\n[キャンセル]または[No]を押すと通常のコメントになります。";

  if(bRet == true){
    if(window.confirm(msg)){
      formObj.comment.focus();
      formObj.action=url1;
      formObj.submit();
    }else{
      formObj.comment.focus();
      formObj.action=url2;
      formObj.submit();
    }
  }

  return bRet;
}

// sidebar.jsに渡すコンポーネント内各要素表示件数
var news_news_disp_num = 5;
var theme_category_disp_num = 10;
var comment_disp_num = 5;
var trackback_disp_num = 5;

// sidebar.jsがエラーを起こさないためのダミーメソッド
function include_comment_list(num) {

}

function include_trackback_list(num) {

}

function include_webry_seal() {
}
function checkAll(f, v) {
  var e = f.newsidList;
  if(e != null){
    if (e.value)
      e.checked = v;
    else
      for (i=0; i<e.length; i++)
        e[i].checked = v;
  }
}
function include_news_webry_seal(){
}
function include_calendar(){
}
function include_album(){
}

function commentAreaExpansion(id,bt,textcols,textrows){
   if (document.getElementById){
    if (areaFlg!=1){
      areaFlg=1;
      tar=document.getElementById(id);
      tar.cols=textcols;
      tar.rows=textrows;
      var bt=document.getElementById(bt);
      bt.innerHTML = '<img src="/images/manage/textarea_contract.gif" width="13" height="13" align="absmiddle" border="0" alt="" /> 書き込み欄を元に戻す';
    }else {
      tar.cols=textcols;
      tar.rows=textrows / 2;
      bt=document.getElementById(bt);
      bt.innerHTML = '<img src="/images/manage/textarea_expand.gif" width="13" height="13" align="absmiddle" border="0"alt="" /> 書き込み欄を拡大';
      areaFlg=0;
    }
  }
}

// プレビュー表示用のパラメータを生成する(画面変更差分なし)
function createPreviewParmNoDiff(form, previewCode, previewtime) {
	return createPreviewParm(form, false, false, previewCode, previewtime);	
}

// プレビュー表示用のパラメータを生成する。
function createPreviewParm(form, diffFlg, timerFlg, previewCode, previewtime) {  
  // パラメータ(記事ID, プレビーコード)  
  var newsid = form.newsid.value;
  var param = "?newsid=" + newsid + "&previewCode=" + previewCode + "&previewtime=" + previewtime;
  
  // 画面からの変更差分を表示するかチェック
  if (diffFlg) {    
  	param = param + "&diffDispFlg=" + diffFlg;
  
	//デザインテンプレ	
  	var selecttemplateid = form.selecttemplateid.value;
  	var selectcategory = form.selectcategory.value;
  	param = param + "&selecttemplateid=" + selecttemplateid;
  	param = param + "&selectcategory=" + selectcategory;
  	
  	// 表記時刻
  	var contributionDate = form.contribution_date_flg;
  	var contributionFlg = false;
  	for ( var i=0; i<contributionDate.length; i++ ) {
  	  if ( contributionDate[i].checked ) {
 		var contribution_date_flg = contributionDate[i].value;
        param = param + "&contribution_date_flg=" + contribution_date_flg;
        contributionFlg = true;
      }
  	}
  	if(!contributionFlg) {
  		var contribution_date_flg = contributionDate.value;
        param = param + "&contribution_date_flg=" + contribution_date_flg;
  	}  	
	var contribution_date = form.contribution_date.value;  
	param = param + "&contribution_date=" + contribution_date;
  	
  	// 予約時刻  	
  	if (timerFlg) {
  		var timerUpd = form.timer_upd_flg;
  	
	  	for ( var i=0; i<timerUpd.length; i++ ) {
	  	  if ( timerUpd[i].checked ) {
	 		var timer_upd_flg = timerUpd[i].value;
	        param = param + "&timer_upd_flg=" + timer_upd_flg;
	      }
	  	}  	
	  	var timerUpdDate = form.timerUpdDate.value;  
	  	param = param + "&timerUpdDate=" + timerUpdDate;
  	}
  	
  	// 既存テーマ
  	var themeObj = form.themeid;
  	if (themeObj != null && themeObj.length) {
  		for ( var i=0; i<themeObj.length; i++ ) {
			if ( themeObj[i].checked ) {
		      var themeid = themeObj[i].value;
			  param = param + "&themeid=" + themeid;
		    }      
  	    } 
  	 } else if(themeObj != null) {
  	  	if ( themeObj.checked ) {
		      var themeid = themeObj.value;
			  param = param + "&themeid=" + themeid;
		}
  	 }
  	  
  	// 新規テーマ
  	var themeOptionObj = form.themeoptionid;
  	var themeOptionObj2 = form.themeoptionname;  
  	for ( var i=0; i<themeOptionObj2.length; i++ ) {
  		if ( themeOptionObj[i].checked) {
    		var themeoptionid = themeOptionObj[i].value
    		param = param + "&themeoptionid=" + themeoptionid;
  		}
    	var themeoptionname = themeOptionObj2[i].value;
    	param = param + "&themeoptionnamePreview=" + encodeURIComponent(themeoptionname);
  	}  
  	// コメント
  	if (form.commentCheckBoxFlg.checked){
  		var commentCheckBoxFlg = form.commentCheckBoxFlg.value; 
  		param = param + "&commentCheckBoxFlg=" + commentCheckBoxFlg;
  	}  
  	if (form.commentURLCheckBoxFlg.checked){
  		var commentURLCheckBoxFlg = form.commentURLCheckBoxFlg.value; 
  		param = param + "&commentURLCheckBoxFlg=" + commentURLCheckBoxFlg;
  	}  
  	var commentRadio = form.commentRadioFlg;	
  	for ( var i=0; i<commentRadio.length; i++ ) {
  	  	if ( commentRadio[i].checked) {
 			var commentRadioFlg = commentRadio[i].value;
        	param = param + "&commentRadioFlg=" + commentRadioFlg;
      	}
  	}  
  	// トラックバック
  	if (form.trackbackflg.checked) {
  		var trackbackflg = form.trackbackflg.value;
  		param = param + "&trackbackflg=" + trackbackflg;
  	} 
  	
  	// テーマポータル
  	if (form.theme_portal_disp_flg.checked) {
  		var theme_portal_disp_flg = form.theme_portal_disp_flg.value;
  		param = param + "&theme_portal_disp_flg=" + theme_portal_disp_flg;
  	}	
  	// 関連テーマ
  	if (form.related_news_list_flg.checked) {
  		var related_news_list_flg = form.related_news_list_flg.value;
  		param = param + "&related_news_list_flg=" + related_news_list_flg;
  	}
  }
  
  return param;
}

// WEBページプレビュー表示用のパラメータを生成する(画面変更差分なし)
function createWebPagePreviewParmNoDiff(form, previewCode, previewtime) {
	return createWebPagePreviewParm(form, false, false, previewCode, previewtime);	
}

// WEBページプレビュー表示用のパラメータを生成する。
function createWebPagePreviewParm(form, diffFlg, timerFlg, previewCode, previewtime) {  
  // パラメータ(記事ID, プレビーコード)  
  var newsid = form.newsid.value;
  var param = "?newsid=" + newsid + "&previewCode=" + previewCode + "&webpageFlg=true" + "&previewtime=" + previewtime;
  
  // 画面からの変更差分を表示するかチェック
  if (diffFlg) {    
  	param = param + "&diffDispFlg=" + diffFlg;
  
	//デザインテンプレ	
  	var selecttemplateid = form.selecttemplateid.value;
  	var selectcategory = form.selectcategory.value;
  	param = param + "&selecttemplateid=" + selecttemplateid;
  	param = param + "&selectcategory=" + selectcategory;
  	
  	// 表記時刻
  	var contributionDate = form.contribution_date_flg;
  	var contributionFlg = false;
  	for ( var i=0; i<contributionDate.length; i++ ) {
  	  if ( contributionDate[i].checked ) {
 		var contribution_date_flg = contributionDate[i].value;
        param = param + "&contribution_date_flg=" + contribution_date_flg;
        contributionFlg = true;
      }
  	}
  	if(!contributionFlg) {
  		var contribution_date_flg = contributionDate.value;
        param = param + "&contribution_date_flg=" + contribution_date_flg;
  	}  	
	var contribution_date = form.contribution_date.value;  
	param = param + "&contribution_date=" + contribution_date;
  	
  	// 予約時刻  	
  	if (timerFlg) {
  		var timerUpd = form.timer_upd_flg;
  	
	  	for ( var i=0; i<timerUpd.length; i++ ) {
	  	  if ( timerUpd[i].checked ) {
	 		var timer_upd_flg = timerUpd[i].value;
	        param = param + "&timer_upd_flg=" + timer_upd_flg;
	      }
	  	}  	
	  	var timerUpdDate = form.timerUpdDate.value;  
	  	param = param + "&timerUpdDate=" + timerUpdDate;
  	}
  }
  
  return param;
}

// オブジェクトのID(絵文字貼り付け対象ID)
var object_id;
var udomain;

// 絵文字ボタンを表示する
function insertEmoji(portal, userDir, id, dirFlg){
	object_id = id;
	if(dirFlg == 1) {
		udomain = userDir;
	} else {
		udomain = portal + "/" + userDir;
	}
	document.write(
		"<td class='m'><a href=\"javascript:void(0)\" onclick=\"openBox(event,'http://' +udomain+ '/palette.html?id=' + object_id,'eplt',0,0,400,238,0);\"><img src=\"/images/manage/tag_emoji.gif\" width=\"59\" height=\"19\" border=\"0\" align=\"absmiddle\" alt=\"［絵文字］絵文字パレットから選んで入力します\" /></a></td>"
		)

}

// 絵文字パレット表示
function palette_open(){  
	var param = location.search;
	var url = location.href;
		
	if(param.length > 0) {
		var type;
  		var start = param.indexOf("type=") + 5;
		var end = param.indexOf("&", start);
		
		if(end > 0 && start > 4){					
			type = param.substring(start, end);			
			url = url.replace("type=" + type,"");
		}else if(start > 4){
			type = param.substring(start, param.length);
		}else{
			type = "webry";
			url += "&";
		}
		url = url.replace("type=" + type,"");	
	}else{
		type = "webry";
		url += "?";
	}

	document.open();
	  
	document.write('<table class="p-tabs" cellpadding="0" cellspacing="0" border="0">\n');
	if(type == "webry"){  
		document.write("<tr><td><a href=\"" + url + "type=webry" + "\"><img src=\"/images/manage/etab11.gif\" width=\"92\" height=\"25\" alt=\"ウェブリ\" /></a></td>\n");
		document.write("<td><a href=\"" + url + "type=docomo" + "\"><img src=\"/images/manage/etab20.gif\" width=\"92\" height=\"25\" alt=\"docomo\" /></a></td>\n");
		document.write("<td><a href=\"" + url + "type=hdeco" + "\"><img src=\"/images/manage/etab40.gif\" width=\"92\" height=\"25\" alt=\"星デコ\" /></a></td>\n");
		document.write("<td><a href=\"" + url + "type=deka" + "\"><img src=\"/images/manage/etab30.gif\" width=\"92\" height=\"25\" alt=\"デカ絵文字\" /></a></td>\n");
	}else if(type == "docomo"){  
		document.write("<tr><td><a href=\"" + url + "type=webry" + "\"><img src=\"/images/manage/etab10.gif\" width=\"92\" height=\"25\" alt=\"ウェブリ\" /></a></td>\n");
		document.write("<td><a href=\"" + url + "type=docomo" + "\"><img src=\"/images/manage/etab21.gif\" width=\"92\" height=\"25\" alt=\"docomo\" /></a></td>\n");
		document.write("<td><a href=\"" + url + "type=hdeco" + "\"><img src=\"/images/manage/etab40.gif\" width=\"92\" height=\"25\" alt=\"星デコ\" /></a></td>\n");
		document.write("<td><a href=\"" + url + "type=deka" + "\"><img src=\"/images/manage/etab30.gif\" width=\"92\" height=\"25\" alt=\"デカ絵文字\" /></a></td>\n");
	}else if(type == "hdeco"){
		document.write("<tr><td><a href=\"" + url + "type=webry" + "\"><img src=\"/images/manage/etab10.gif\" width=\"92\" height=\"25\" alt=\"ウェブリ\" /></a></td>\n");
		document.write("<td><a href=\"" + url + "type=docomo" + "\"><img src=\"/images/manage/etab20.gif\" width=\"92\" height=\"25\" alt=\"docomo\" /></a></td>\n");
		document.write("<td><a href=\"" + url + "type=hdeco" + "\"><img src=\"/images/manage/etab41.gif\" width=\"92\" height=\"25\" alt=\"星デコ\" /></a></td>\n");
		document.write("<td><a href=\"" + url + "type=deka" + "\"><img src=\"/images/manage/etab30.gif\" width=\"92\" height=\"25\" alt=\"デカ絵文字\" /></a></td>\n");
	}else if(type == "deka"){
		document.write("<tr><td><a href=\"" + url + "type=webry" + "\"><img src=\"/images/manage/etab10.gif\" width=\"92\" height=\"25\" alt=\"ウェブリ\" /></a></td>\n");
		document.write("<td><a href=\"" + url + "type=docomo" + "\"><img src=\"/images/manage/etab20.gif\" width=\"92\" height=\"25\" alt=\"docomo\" /></a></td>\n");
		document.write("<td><a href=\"" + url + "type=hdeco" + "\"><img src=\"/images/manage/etab40.gif\" width=\"92\" height=\"25\" alt=\"星デコ\" /></a></td>\n");
		document.write("<td><a href=\"" + url + "type=deka" + "\"><img src=\"/images/manage/etab31.gif\" width=\"92\" height=\"25\" alt=\"デカ絵文字\" /></a></td>\n");		
	}
	document.write('<td align="right" valign="top" width="100%"><a href="javascript:window.close();"><img src="/images/manage/pclose.gif" width="15" height="15" alt="閉じる" /></a></td></tr>\n');
	document.write('</table>\n');
	document.write('<div class="p-outer">\n');
	document.write('<div class="p-inner scroll" id="emoji-container"></div>\n');
	document.write('</div>\n');
	document.write('<script type="text/javascript">');  
	document.write('	emojiPalette();\n');
	document.write('</script>\n'); 
	  
	document.close();

}

// 絵文字パレットの作成
function emojiPalette() {
	var param = location.search;
	if(param.length > 0){
		var id;
		var type;
		var start; 
		var end; 
		start = param.indexOf("id=");
		end = param.indexOf("&", start);
		
		if(end > 0 && start > 0){			
			 id = param.substring(start+"id=".length, end);
		
		}else if (start > 0){
			 id = param.substring(start+"id=".length, param.length);

		}else{
			id="";
		}
		start = param.indexOf("type=");
		end = param.indexOf("&", start);
		
		if(end > 0 && start > 0){			
			 type = param.substring(start+"type=".length, end);
		
		}else if(start > 0){
			 type = param.substring(start+"type=".length, param.length);

		}else{
			type = "webry";
		}		
		makeEmojiPalette2("emoji-container", type, id);
	} else {
		makeEmojiPalette2("emoji-container", "webry" , "");
	}
}

var pcDispCookie = "PC_DISP_FLG_SP=ON";

// SPﾈﾇﾀﾚﾂﾘ･ﾜ･ｿ･ﾉｽｼｨ
function dispSpChangeButton(pcPortalDomain) {

}


// SPﾈﾇﾀﾚﾂﾘ･ﾜ･ｿ･ｲ｡ｲｼ
function onClickSpChange(pcPortalDomain) {
   var co = document.cookie;

   if (co != null || co.indexOf(pcDispCookie) > 0 ) {
       // alert("cookie====>>> "+ document.cookie);
       var udomain = location.hostname;
       document.cookie = createPcCookieStr(-10, udomain, pcPortalDomain);
       // alert("delete cookie====>>> "+ document.cookie);
   }

   location.reload(true);

}

// PCｱﾜﾍ･ﾕ･鬣ｰﾊｸｻﾎ､ﾎｺﾀｮ
function createPcCookieStr(year, userDomain, pcPortalDomain) {
    var expiredate = new Date();
    expiredate.setFullYear(expiredate.getFullYear() + year);

    var tmp = pcDispCookie + "; expires="+ expiredate.toGMTString() + ";";

    var domain;
    if(userDomain.indexOf(pcPortalDomain) > 0) {
        domain = pcPortalDomain;
    } else {    
        domain = userDomain
    }

    tmp += "domain=" + domain + "; path=" + "/" + ";";
    // alert("create cookie ===>> " + tmp);

    return tmp;
}

