
function 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 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=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 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 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_openBrWindow(theURL,winName,features) { //v2.0
  var obj = window.open(theURL,winName,features);
  obj.focus();
}

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];}
}


//////////////////////////////////////////////////////////////////


var timer;


function openMenu(prm1,prm2){
	var timer;
	var dy = 0;
	
	obj = $(prm1);
	obj2 = $(prm2);
	
	//alert(obj.offsetHeight + " - " + (obj2.offsetHeight/2));
	
	if( obj.offsetHeight >= (obj2.offsetHeight/2) ){
		var n = obj2.offsetHeight;
		dy = -10;
	}else{
		var n = 0;
		dy = 10;		
	}
			
	var moveText= function(){
	
		n +=dy;		
		
		if(n >= obj2.offsetHeight && dy > 0){
			n = obj2.offsetHeight;
			clearInterval(timer);

		}else if(n <= 0 && dy < 0){
			n = 0;
			clearInterval(timer);
		}
		
		obj.style.height = n + "px";

	}	
	
	
	timer = setInterval(moveText,1);
}

/////////////////////////////////////////////////////
function openMenu1(prm1,prm2){
	

	if(document.all){
		obj = document.all(prm1);
		obj2 = document.all(prm2);
	}else if(document.getElementById){
		obj = document.getElementById(prm1);
		obj2 = document.getElementById(prm2);
	}

	var n = obj.offsetHeight;
	var timer;



	if( obj.offsetHeight >= obj2.offsetHeight + 10){
		var dy =-10;
	}else{
		var dy =10;		
	}


	var moveText1 = function(){
			
			n += dy;		
			
			if(n >= obj2.offsetHeight + 10){
				n = obj2.offsetHeight + 10;
				clearInterval(timer);
			}

			
			if(n <= 165){
				n = 165;
				clearInterval(timer);
			}

			obj.style.height = n + "px";	
	}



	timer = setInterval(moveText1,1);
}

//////////////////////////////////////////

function tagMenu(prm1){
	if(document.all){
		obj = document.all("bookListTitle");
		obj2 = document.all("bookListImage");
	}else if(document.getElementById){
		obj = document.getElementById("bookListTitle");
		obj2 = document.getElementById("bookListImage");
	}
	
	if(prm1 == 1){
		obj.style.display = "block";
		obj2.style.display = "none";
	}else{
		obj.style.display = "none";
		obj2.style.display = "block";
	}
}

function tagChenge(obj,ob,prm,loop){
	for(i=1; i<=loop; i++ ){
		var obja = $(obj + i);
		var objb = $(ob + i);
		
		if(prm==i){
			obja.style.display="block";
					
			//objb.style = "width:150px; float:left;padding:5px;margin:0; background:url('../images/tg_invite01.jpg') no-repeat;";
			/*
			objb.style.width = "350px"; 
			
			objb.style.float = "left";
			objb.style.padding = "5px";
			objb.style.margin = "0"; 
			*/
			objb.style.backgroundImage = "url('../images/tg_invite01.jpg')";
			objb.style.color = "#ffffff";
			
		}else{
			obja.style.display = "none";
			
			//objb.style = "width:150px;float:left;padding:5px; background:url('../images/tg_invite02.jpg') no-repeat;";
			/*
			objb.style.width = "350px"; 
			
			objb.style.float"left";
			objb.style.padding"5px"; 
			*/
			objb.style.backgroundImage = "url('../images/tg_invite02.jpg')";
			objb.style.color = "#666666";
			
		}
		
	}
	
}


function formShowHide(id, image) {
    var disp = document.getElementById(id).style.display;
    if(disp == "block") {
        document.getElementById(id).style.display = "none";
//        document.getElementById(image).src = "img/form/add_16.gif";
    }
    else {
        document.getElementById(id).style.display = "block";
//        document.getElementById(image).src = "img/form/remov_16.gif";
    }
    return false;
}

function mailpop() {
	window.location.href = "mailto:mi-te-support@mi-te.jp";
}

///////////////////////// オブジェクトの座標取得
function objPos(eremID){
  if(typeof(eremID)=="object") var offsetTrail = eremID;
  else var offsetTrail = $(eremID);

  var offsetLeft = 0;
  var offsetTop = 0;

  while(offsetTrail){
   offsetLeft += offsetTrail.offsetLeft;
   offsetTop += offsetTrail.offsetTop;
   offsetTrail = offsetTrail.offsetParent;
  }

  if(navigator.userAgent.indexOf("Mac") != -1 && 
  typeof document.body.leftMargin != "undefined"){
   offsetLeft += document.body.leftMargin;
   offsetTop += document.body.topMargin;
  }

  return{ left:offsetLeft , top:offsetTop }

}

//////////// ブラウザサイズ取得 ///////////////////////////////
function brsSize(){
 if (document.all) {
  if(window.opera){
   brsHeight = document.body.clientHeight;
   brsWidth = document.body.clientWidth;
  }else{
   brsHeight = document.documentElement.clientHeight;
   brsWidth = document.documentElement.clientWidth;
  }
 } else if (document.getElementById && !document.all || document.layers) {
   brsHeight = window.innerHeight;
   brsWidth = window.innerWidth;
 }
 return { height:brsHeight , width:brsWidth };
}

/// レイヤー半透明 ///////////////////////////////////////////
function layerAlpha(objName,alpha){
	
  if(typeof(eremID)=="object") var obj = objName;
  else var obj = $(objName);
  
	//var obj = $(objName);
	if(window.ActiveXObject) {
		obj.style.filter = "alpha(opacity="+alpha+")";
	}else{
		obj.style.opacity = alpha / 100;
	
		obj.style.MozOpacity = alpha / 100;
	}
}

function booksearch(){
	var prm = $("keyword").value;
	rt = prm.stripTags();
	rt = encodeURIComponent(rt);
	window.location.href = "/mi-te_library.php?booksearch=" + rt;
}


/////////////////////////////////////////////////////////////////////////

function swfObj(url,prm){
	var prot = window.location.protocol;
	var rnd = '';
//	var rnd = '?rnd=' + Math.random();
	
	var htm = "";
	htm += '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="'+ prot +'//download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0" width="'+ prm.width +'" height="'+ prm.height +'" title="">';
	htm += '<param name="movie" value="'+ url + rnd +'" />';
	htm += '<param name="quality" value="high" />';
	
	if(prm.wmode != undefined){
		htm += '<param name="wmode" value="' + prm.wmode +'" />';
		var wmode = ' wmode="' + prm.wmode + '"';
	}else{
		var wmode = "";
	}

	htm += '<embed src="' + url + rnd + '" quality="high" pluginspage="'+ prot +'//www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="'+ prm.width +'" height="'+ prm.height +'"' + wmode +'></embed>';
	htm += '</object>';
	
	document.write(htm);
}