﻿var openDivID = '';
var setDivID = '';
flag = false;
Lyid = null;
myObj= null;
flagOnload = false;
document.onmousemove = move_Ly;
document.onmouseup = move_Out;
document.onmouseover = move_Over;

function message(msg){
window.alert(msg);
}

function get_Browser(Lyid){
//-- kj 20080228 change start
//  if (document.getElementById) mObj=document.getElementById(Lyid).style; // N6
//  else if (document.all) mObj=document.all[Lyid].style; // IE
//  else if (document.layers) mObj=document[Lyid]; // N4
  if (document.all) mObj=document.all[Lyid].style; // IE
  else if (document.getElementById && document.getElementById(Lyid)) mObj=document.getElementById(Lyid).style; // N6
  else if (document.layers) mObj=document[Lyid]; // N4
  else mObj = null;
//-- kj 20080228 change end
  return mObj;
}



function move_In(n){
  flag = true; Lyid = n; 
  myObj = get_Browser(Lyid);
  document.body.style.cursor="w-resize";
  //document.form1.text_filename.value = "x=" + event.x;
}

function move_Out(){
  flag = false;
  document.body.style.cursor="default";
  //$.cookie('mxwd',value=M_x,{ expires: 7 }); //test ************* 追加1120    ************************ // s cookieを使用しないため削除
}

function move_Over(){
  if (flag==false) return;
}


// kj20080228 change start
//function move_Ly(){
function move_Ly(e){
// kj20080228 change end
  if (flag==false) return;

// kj20080228 change start
//  M_x=event.x;
  if( document.all ) M_x=event.x;
  else M_x = e.clientX;
// kj20080228 change end

  //M_y=event.y;

  if( M_x < 200 ) {
    M_x = 200;
  }
  if( M_x > 500 ) { //**********追加1120*****************
    M_x = 500;
  }

// kj20080228 add start
//  if( !myObj ) myObj = get_Browser("left_column");
// kj20080228 add end

  myObj.width = M_x + "px"; //オブジェクトの左からの位置 X座標
  allObj = get_Browser("allfolder");
  folObj = get_Browser("folderlist");
  extObj = get_Browser("extchk");
  tabObj = get_Browser("tab_op");
  tabgObj = get_Browser("tabsG");

  allObj.width = M_x + "px";
  folObj.width = M_x + "px";
  extObj.width = M_x + "px";
  tabObj.width = M_x + "px";
  tabgObj.width = M_x + "px";

  //document.form1.text_filename.value = "x=" + M_x + " y=" + M_y;

  resize_Object(); //-- kj

  return false;
}

var openDivID = '';
var setDivID = '';
function chBubble( DivID, smoreUrl ) {
setDivID = document.getElementById(DivID);
if(openDivID != '')
{
openDivID.innerHTML = '';
openDivID.style.display = "none";
}
if(openDivID == setDivID)
{
openDivID.innerHTML = '';
openDivID.style.display = "none";
openDivID = '';
}
else
{
setDivID.innerHTML = '<iframe src="' + smoreUrl + '" width=100% height=200px scrolling=yes name=_Frame></iframe>';
setDivID.style.display = "block";
openDivID = setDivID;
}
}


function MM_showHideLayers() { //v6.0
var i,p,v,obj,args=MM_showHideLayers.arguments;
for (i=0; i<(args.length-2); i+=3)
{
	len = args[i].indexOf("*");
	if(len > 0)
	{
		for(j=0;j<50;j++)
		{
			if ((obj=MM_findObj(args[i].replace("*", j)))!=null)
			{
				v=args[i+2];
				if (obj.style)
				{
					obj=obj.style; v=(v=='show')?'block':(v=='hide')?'none':v;
				}
				obj.display=v;
			}
		}
	}
	else
	{
		if ((obj=MM_findObj(args[i]))!=null) 
		{
			v=args[i+2];
			if (obj.style)
			{
				obj=obj.style; v=(v=='show')?'block':(v=='hide')?'none':v;
			}
			obj.display=v;
		}
	}
}
}


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;
}


var theForm = document.forms['form1'];//クリアボタン
if (!theForm) {
theForm = document.form1;
}

function text_clear() {
if (!theForm.onsubmit || (theForm.onsubmit() != false)) {
theForm.text_filename.value = "";
theForm.text_keywords.value = "";
}
}

function dummywait( ){ //フォルダスクロール
}

function checkBrowser() { //sブラウザを判断し、イベントを切り替える(追加)
  var uName = navigator.userAgent;
  var Browser;
  if (uName.indexOf("Firefox") > -1) {
    return window.addEventListener("onload", initialscroll, false);
  }
  if (uName.indexOf("MSIE") > -1) {
    return window.attachEvent("onload", initialscroll);
  }
// 20110704 kg Add Start
  if (uName.indexOf("Android") > -1) {
    windows.scrollTo(0,1);
  }
// 20110704 kg Add End
}


checkBrowser()
function initialscroll() {
  obj = document.getElementById('scroll_current');
    if(obj != null) {
      obj2 = document.getElementById('folderlist');
      for(i=0;i<10;i++) {
        y = obj.offsetTop;
        if( y >= 0 ) {
          break;
        }
        setTimeout("dummywait",100);
      }
      obj2.scrollTop = y-100;
    }
}



window.onload = function ts() { //t //結果初期ウインドウのサイズ
  //M_x = $.cookie('mxwd'); // s cookieに保存しない
  M_x = "200";              // s cookieに保存しな場合の初期値(追加)
  //if(M_x == null)         // s cookieを使用しないため削除
  //{                       //
  //M_x = 200;              //
  //}                       //
  flagOnload = true;

  myObj = get_Browser("left_column");
  allObj = get_Browser("allfolder");
  folObj = get_Browser("folderlist");
  extObj = get_Browser("extchk");
  tabObj = get_Browser("tab_op");
  tabgObj = get_Browser("tabsG");

//-- kj 20080228 add start
//  if( !myObj || !allObj ) return;
//-- kj 20080228 add end

  myObj.width = M_x + "px"; //オブジェクトの左からの位置 X座標
  allObj.width = M_x + "px";
  folObj.width = M_x + "px";
  extObj.width = M_x + "px";
  tabObj.width = M_x + "px";
  tabgObj.width = M_x + "px";

  resize_Object(); //-- kj
}

//-- kj 
// リサイズ時の処理
//-- kj 20080228 change start
//window.onresize = function resize() {
window.onresize = function resize() {
  resize_Object();
}

function resize_Object() {
//-- kj 20080228 change end
  if( !flagOnload ) return;

  myObj = get_Browser("left_column");
  allObj = get_Browser("allfolder");
  folObj = get_Browser("folderlist");
  extObj = get_Browser("extchk");
  tabObj = get_Browser("tab_op");
  tabgObj = get_Browser("tabsG");
  listObj = get_Browser("listarea");
  sttlObj = get_Browser("sttl");//追
  tabsFObj = get_Browser("tabsF");//追

//-- kj 20080228 add start
  if( !myObj || !allObj ) return;
//-- kj 20080228 add end

  if( window.innerHeight > 0 ) {
    height = window.innerHeight;
    width = window.innerWidth;
  } else if( document.documentElement.clientHeight > 0 ) {
    height = document.documentElement.clientHeight;
    width = document.documentElement.clientWidth;
  } else if( document.body.clientHeight > 0 ) {
    height = document.body.clientHeight;
    width = document.body.clientWidth;
  }
  
  // フッターのサイズ
  explrh = height - 200;
  if( explrh < 200 ) {
    explrh = 200;
  }

  //myObj.height = height;
  //allObj.height = height;
  folObj.height = explrh + "px";
  extObj.height = explrh + "px";
  tabObj.height = explrh + "px";
  //tabgObj.height = height;
  listObj.height = parseInt( folObj.height ) + 70  + "px";
  explrw = parseInt( folObj.width );
  //document.form1.text_filename.value = "width=" + width + " obj=" + explrw;
  listObj.width = width - explrw - 15  + "px"; //縦スクロールバーの位置
  sttlObj.width = width - explrw - 35  + "px"; //追 sttl横幅
  tabsFObj.width = width - explrw - 35  + "px"; //追 

}
//-- kj 

// ドロップダウンメニューの表示・非表示
function OpenMenu(id){ 
  document.getElementById( id ).style.visibility = 'visible';
}
function CloseMenu(id){ 
  document.getElementById( id ).style.visibility = 'hidden';
}

//検索オプション用
function Clear() {
  document.form1.elements["startyear"].value = "";
  document.form1.elements["startmonth"].value = "";
  document.form1.elements["startday"].value = "";
  document.form1.elements["endyear"].value = "";
  document.form1.elements["endmonth"].value = "";
  document.form1.elements["endday"].value = "";
  return false;
}

function ChkBoxDoc( cnt ){
	ChkFlg = '';
	for(i=0; i<cnt; i++){
		if(document.form1.elements["chkbox_Extension1_" + i ].checked == false) { ChkFlg = '1'; break; }
		else ChkFlg = '0';
	}
	if(ChkFlg == 1){
		for(i=0; i<cnt; i++) document.form1.elements["chkbox_Extension1_" + i ].checked = true;
	}
	else{
		for(i=0; i<cnt; i++) document.form1.elements["chkbox_Extension1_" + i ].checked = false;
	}
	return false;
}

function ChkBoxImg( cnt ){
	ChkFlg = '';
	for(i=0; i<cnt; i++){
		if(document.form1.elements["chkbox_Extension2_" + i ].checked == false) { ChkFlg = '1'; break; }
		else ChkFlg = '0';
	}
	if(ChkFlg == 1){
		for(i=0; i<cnt; i++) document.form1.elements["chkbox_Extension2_" + i ].checked = true;
	}
	else{
		for(i=0; i<cnt; i++) document.form1.elements["chkbox_Extension2_" + i ].checked = false;
	}
	return false;
}

function ChkBoxEtc( cnt ){
	ChkFlg = '';
	for(i=0; i<cnt; i++){
		if(document.form1.elements["chkbox_Extension3_" + i ].checked == false) { ChkFlg = '1'; break; }
		else ChkFlg = '0';
	}
	if(ChkFlg == 1){
		for(i=0; i<cnt; i++) document.form1.elements["chkbox_Extension3_" + i ].checked = true;
	}
	else{
		for(i=0; i<cnt; i++) document.form1.elements["chkbox_Extension3_" + i ].checked = false;
	}
	return false;
}

function Back(sUrl){
	location.href = sUrl;
	return false;
}


function send_method_get() //********追加0129********
{
    document.form1.action = "search.aspx";
    document.form1.method = "get";
    document.form1.submit();
}


