﻿function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_goToURL() { //v3.0
  var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
  for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}

function MM_changeProp(objName,x,theProp,theValue) { //v6.0
  var obj = MM_findObj(objName);
  if (obj && (theProp.indexOf("style.")==-1 || obj.style)){
    if (theValue == true || theValue == false)
      eval("obj."+theProp+"="+theValue);
    else eval("obj."+theProp+"='"+theValue+"'");
  }
}


function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

//表示・非表示 イメージ切り替え
function formShowHide(id, image) {
    var disp = document.getElementById(id).style.display;
    if(disp == "block") {
        document.getElementById(id).style.display = "none";
        document.getElementById(image).src = "common/js/images/open.gif";
    }
    else {
        document.getElementById(id).style.display = "block";
        document.getElementById(image).src = "common/js/images/close.gif";
    }
    return false;
}

//表示・非表示 イメージ切り替えタグ用
function formShowHideTag(id, image) {
    var disp = document.getElementById(id).style.display;
    if(disp == "none") {
		document.getElementById(id).style.display = "block";
        document.getElementById(image).src = "common/js/images/close_tag.gif";
    }
    else {
        document.getElementById(id).style.display = "none";
        document.getElementById(image).src = "common/js/images/open_tag.gif";
    }
    return false;
}

//SELECT要素を隠す
function hideselect(){

	var myTRLen = document.getElementsByTagName('select').length;
	var i;
	for(i=0;i<myTRLen;i++){
		
		var mySelect = document.getElementsByTagName('select')[i] ;
		mySelect.style.visibility = 'hidden';
	}
}

function DoViewIFRAME(tid1,tid2,tid3,t) {
document.getElementById(tid1).style.display = "none";
document.getElementById(tid2).style.display = "";
document.getElementById(tid3).style.display = "";
document.getElementById(tid3).innerHTML = '<iframe src="'+t+'" class="iframe"></iframe>';
}
function DoHideIFRAME(tid1,tid2,tid3) {
document.getElementById(tid1).style.display = "none";
document.getElementById(tid2).style.display = "none";
document.getElementById(tid3).style.display = "";
}
function mediaFinish(){
  myRet = confirm("このプレスリクエストを締め切りますか？");
  if ( myRet == true ) alert("プレスリクエストを締め切りました。");
}


function releaseFinish(){
  myRet = confirm("このリリースを締め切りますか？");
  if ( myRet == true ) alert("リリースを締め切りました。");
}

function releaseDelete(){
  myRet = confirm("本当にこのリリースを削除しますか？一度削除した場合、再作成が必要です。");
  if ( myRet == true ) alert("リリースを削除しました。");
}

function prDelete(){
  myRet = confirm("本当にこのPRを削除しますか？一度削除した場合、再作成が必要です。");
  if ( myRet == true ) alert("PRを削除しました。");
//  else                 alert("");
}

function addBookmark(){
  myRet = confirm("ブックマークに登録しますか？");
  if ( myRet == true ) alert("ブックマークに登録しました。");
}

function sendMessage(){
  myRet = confirm("メッセージを送信しますか？");
  if ( myRet == true ) alert("メッセージを送信しました。");
  else                 alert("送信をキャンセルしました");
}
function delMessage(){
  myRet = confirm("メッセージを削除しますか？");
  if ( myRet == true ) alert("メッセージを削除しました。");
}
function delDisp(){
  myRet = confirm("削除しますか？");
  if ( myRet == true ) alert("削除しました。");
}

function show_hide(id) {
 disp = document.all(id).style.display;
  if(disp == "block")
    document.all(id).style.display = "none";
  else
    document.all(id).style.display = "block";
 }


function changeStatus(str) {
ret = confirm('ステータスを変更しますか？\n\n※メッセージ送信後、ステータスが変更されます。');
if (ret==true){
//var elem = document.getElementById('status');
elem = getObj('status_area');
  elem.innerHTML = str;
}else{
 alert("変更をキャンセルしました。");	
}
}

function changeRegistStatus() {
ret = confirm('　登録情報を変更しますか？');
if (ret==true){
}else{
 alert("ステータス変更をキャンセルしました。");	
}
}

function ViewSpaceSelect(tid1,tid2) {
document.getElementById(tid1).style.display = "none";
document.getElementById(tid2).style.display = "none";
}

/* サービスプラン切り替え */
function view(i){
	document.getElementById("test1").style.display="none";
	document.getElementById("test2").style.display="none";
	document.getElementById("test3").style.display="none";
	document.getElementById("test"+i).style.display="block";
}

/* 新規プレス登録時切り替え */
function radioChangeCompanyName() {
	if(document.form1.company_name_flg[0].checked == true) {
	  document.form1.company_name.disabled = true;
	  document.form1.company_name.style.backgroundColor='#CCCCCC';
	  document.form1.company_name.value = "";

	} else if(document.form1.company_name_flg[1].checked == true) {
	  document.form1.company_name.disabled = false;
	  document.form1.company_name.style.backgroundColor='#FFFFFF';

	} else {
	  document.form1.company_name.value = "";

	  document.form1.company_name.disabled = false;
	  document.form1.company_name.style.backgroundColor='#FFFFFF';
	}
}

function radioChangeMediaName() {
	if(document.form1.media_name_flg[0].checked == true) {
	  document.form1.media_name.disabled = true;
	  document.form1.media_name.style.backgroundColor='#CCCCCC';
	  document.form1.media_name.value = "";

	} else if(document.form1.media_name_flg[1].checked == true) {
	  document.form1.media_name.disabled = false;
	  document.form1.media_name.style.backgroundColor='#FFFFFF';

	} else {
	  document.form1.media_name.value = "";

	  document.form1.media_name.disabled = false;
	  document.form1.media_name.style.backgroundColor='#FFFFFF';
	}
}
/* 企業情報編集画面：上場区分選択による入力欄の表示切替 */
function optionChange_devision() {
	if(document.form1.devision.options.value == 0) {
	  document.form1.trade_code.disabled = true;
	  document.form1.trade_code.style.backgroundColor='#CCCCCC';
	  document.form1.trade_code.value = "";
	} else {
	  trade_code="";
	  document.form1.trade_code.value = trade_code;
	  document.form1.trade_code.disabled = false;
	  document.form1.trade_code.style.backgroundColor='#FFFFFF';
	}
}

/* プレス　基本情報確認：プレス種類「その他」選択時の表示切替 */
function optionChange_Other() {


//　「その他」以外を選択したとき
if(document.form1.media_type[6].checked == 0) {
	  
	  document.form1.other_text.value = "";
	  document.form1.other_text.readonly = true;
	  document.form1.other_text.disabled = true;
	  document.form1.other_text.style.border="0px solid #FFFFFF";

	  document.form1.media_name.readOnly = true;
	  document.form1.media_name.style.display = "block";
	  document.form1.media_name.style.border="1x solid #666666";
      document.form1.media_name.style.backgroundColor='#FFFFFF';
	  document.getElementById("other_type").style.display = "none";

//　「その他」を選択したとき
} if(document.form1.media_type[6].checked != 0) {

	  document.form1.other_text.readOnly = false;
	  document.form1.other_text.disabled = false;
	  document.form1.other_text.style.border="1px solid #666666";
	  document.form1.media_name.readOnly = false;
	  document.form1.media_name.style.backgroundColor='#FFFFFF';
	  document.form1.media_name.style.border='1px solid #000000';
	  document.getElementById("other_type").style.display = "block";
}
}

/* チェックボックス全選択 */
function allcheck(targetForm,flag){
  for(n=0;n<=targetForm.length-1;n++){
    if(targetForm.elements[n].type == "checkbox"){
      targetForm.elements[n].checked = flag;
    }
  }
}

/* チェックボックス全選択、全解除　*/

// 全て選択押下処理
function fnc_all_click(objAll){

	// 全ての要素に対して
	for(var i=0;i<document.sample.length;i++){
		//チェックボックスであれば
		if(document.sample[i].type=="checkbox"){
			document.sample[i].checked = objAll.checked;
		}
	}

}

// 全て選択以外の押下処理
function fnc_mbr_click(objMbr){

	// チェックボックスのチェックが外れたら『全て選択』のチェックを外す
	if(objMbr.checked == false){
		document.sample.chk_all.checked = false;
		return;
	}

	for(var i=0;i<document.sample.length;i++){
		//チェックボックスであれば
		if(document.sample[i].type=="checkbox"){
			// 『全て選択』以外全てチェックされていたら
			// 『全て選択』をチェックする
			if(document.sample[i].checked==false
			                 &&
			   document.sample[i].name!="chk_all"){
				return;
			}
		}
	}

	document.sample.chk_all.checked = true;

}

/* 記事ネタTAGテキストエリア追加 */
function setTagData(param)
{
CR = String.fromCharCode(13);
txt = document.form1.tagText.value + param + CR;
document.form1.tagText.value = txt;
}

/* 記事ネタTAGテキストエリア行数固定 */
function chk(str){ 
var l = str.length; 
var m = l - 1; 
var n = l - 2; 
var o = escape(str.charAt(m)); 
var p = escape(str.charAt(n)); 
if((o=='%0A')&&(p=='%0D')){ 
    var estr = escape(str); 
    var en = estr.length; 
    var em = en - 6; 
    var estr2 = estr.slice(0,em); 
    str = unescape(estr2); 
} 
else{ 
    str = str.slice(0,m); 
}     
document.tagForm.tagText.value = str; 
} 

