/*
***************************************************
	JS関数群
	Atsushi Yamazaki(at4@jc4.so-net.ne.jp)
***************************************************
	2008/06/30	諸般
***************************************************
*/

// main menu表示を固定
function setMenu(where) {
	if(where=='') return;
	
	menu	= document.getElementById('main_' + where);
	menu.onmouseover	= null;
	menu.onmouseout		= null;
	menu.src			= '/img/button_main_' + where + '_02.gif';
}

// 写真を開く
function openPhotoWindow(imgPath, width, height) {
	imgPath	= escape(imgPath);
	width	= (width > screen.availWidth) ? screen.availWidth : width;
	height	= (height > screen.availHeight) ? screen.availHeight: height;
	
	window.open('show_img.php?imgPath='+imgPath, 'newWin', 'toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=yes,width='+width+',height='+height+'');
}

// フォーム用ボタン
function btnConForm() {
	var inputs	= document.getElementsByTagName('input');
	for(i=0; i<inputs.length; i++) {
		btn	= inputs[i];
		if(btn.getAttribute('class')=='button' ||
		   btn.getAttribute('class')=='sbutton' ||
		   btn.getAttribute('className')=='button' ||
		   btn.getAttribute('className')=='sbutton') {
			   
			btn.onmouseover	= btn.onmouseup = function() {
				this.style.color			= '#484848';
				this.style.borderColor		= '#abadb3';
				this.style.backgroundColor	= '#eeeeee';
				return false;
			};
			
			btn.onmousedown = function() {
				this.style.color			= '#fff';
				this.style.borderColor		= '#abadb3';
				this.style.backgroundColor	= '#bbbec9';
				return false;
			}
			
			btn.onmouseout	= function() {
				this.style.color			= '#7f7f7f';
				this.style.borderColor		= '#dddddd';
				this.style.backgroundColor	= '#FFF';
			   	return false;
			};
		}
	}
}


/**************************************************/

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];}
}


MM_preloadImages(
	'/img/button_main_profile_02.gif',
	'/img/button_main_works_02.gif',
	'/img/button_main_photo_02.gif',
	'/img/button_main_writing_02.gif',
	'/img/button_main_blog_02.gif',
	'/img/button_main_biblo_02.gif',
	'/img/button_main_review_02.gif',
	'/img/button_main_critique_02.gif',
	'/img/button_main_contact_02.gif',
	'/img/button_main_english_02.gif',
	'/img/button_main_japanese_02.gif',
	'/img/img_allow_link_02.gif',
	'/img/img_bullet.gif',
	'/img/img_bullet_contact.gif');
