/*
Copyright (c) 2000 NeXTcube, by capri91
*/

function focus_login() {
	document.getElementById('user_login_id').focus();
}

function focus_passwd() {
	document.getElementById('user_login_passwd').focus();
}

function check_submit() {
	if(!document.getElementById('subjectchk').value) {
		alert('제목을 입력하여 주십시요');
		return false;
	}

	if(!document.getElementById('namechk').value) {
		alert('이름을 입력하여 주십시요');
		return false;
	}

	if(!document.getElementById('passwdchk').value) {
		alert('암호를 입력하여 주십시요');
		return false;
	}

	if(!document.getElementById('contentschk').value) {
		alert('내용을 입력하여 주십시요');
		return false;
	}

	if(!document.getElementById('filechk').value) {
		alert('추가할 파일을 선택하여 주십시요');
		return false;
	}

	if(!document.getElementById('nospamchk').value) {
		alert('스팸방지용 보안코드 2자리 숫자를 입력하여 주십시요');
		return false;
	}
}

function xfwin(xfName) {
	var winHandle = window.open(xfName,'xfwin','toolbar=no,scrollbars=yes,resizable=yes,width=700,height=600');

	if(winHandle != null) winHandle.focus();

	return winHandle;
}

function xfiwin(xfName) {
	var winHandle = window.open('','xfiwin','toolbar=no,scrollbars=no,resizable=yes,width=820,height=730');

	if(winHandle != null) {
		var htmlString = '<html><head><title>The X-Files</title></head><body bgcolor=#000000><table width=100% height=710 border=0 align=center><tr><td align=center valign=middle><img src=' + xfName + ' border=0></td></tr></table></body></html>';

		winHandle.document.open();
		winHandle.document.write(htmlString);
		winHandle.document.close();
		winHandle.focus();
	}

	return winHandle;
}

function xfvwin(xfName) {
	var winHandle = window.open('','xfvwin','toolbar=no,scrollbars=no,resizable=yes,width=420,height=320');

	if(winHandle != null) {
		var htmlString = '<html><head><title>The X-Files</title></head><body bgcolor=#000000><table width=100% height=300 border=0 align=center><tr><td align=center valign=middle><embed src="/xfiles/mediaplayer.swf" width="400" height="300" allowscriptaccess="always" allowfullscreen="true" flashvars="file=' + xfName + '&autostart=true&backcolor=0x000000&frontcolor=0xBBBBBB&lightcolor=0xFFFFFF"></td></tr></table></body></html>';

		winHandle.document.open();
		winHandle.document.write(htmlString);
		winHandle.document.close();
		winHandle.focus();
	}

	return winHandle;
}

function imgSizeConv(limit) {
	var imgs = document.getElementsByTagName('img');
	var embeds = document.getElementsByTagName('embed');

	for(i=0; i<imgs.length; i++) {
		if(imgs[i].offsetWidth > limit) {
			imgs[i].width = limit;
		}
	}

	for(i=0; i<embeds.length; i++) {
		if(embeds[i].offsetWidth > limit) {
			embeds[i].width = limit;
		}
	}
}

function imgConv(imgId, imgName) {
	document.images[imgId].src = eval(imgName + ".src");
} 
