function check_login() {
	var check_log=document.loginform;
	if (!check_log.memberid.value) {
		alert ('È¸¿ø ¾ÆÀÌµð¸¦ ÀÔ·ÂÇØ ÁÖ¼¼¿ä');
		check_log.memberid.focus();
		return false;
		}
	if (!check_log.passwd.value) {
	alert ('ºñ¹Ð¹øÈ£¸¦ ÀÔ·ÂÇØ ÁÖ¼¼¿ä');
	check_log.passwd.focus();
	return false;
	}
}

function OpenAnotherWin(szhref){
	AnotherWin = window.open(szhref,"AnotherWin", 
	"toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,width=370,height=330");
}

var nk = 0;
function rndhphoto(){
	setTimeout("hphotoChange()",2000);
}

function hphotoChange(now){
	max = hphoto.length;
	hphoto[nk].style.display='none';

	++nk;
	nk=nk==max?0:nk;

	hphoto[nk].style.display='block';

	if(!now)rndhphoto();
}

var o = 0;
function ondhphoto(){
	setTimeout("ophotoChange()",2500);
}

function ophotoChange(now){
	max = ophoto.length;
	ophoto[o].style.display='none';

	++o;
	o=o==max?0:o;

	ophoto[o].style.display='block';

	if(!now)ondhphoto();
}

today = new Date();
var tyear = today.getYear(), tmonth = today.getMonth()+1, tday = today.getDate();
function setDate(val){
	if (val != "all"){
		var stmonth, stday;
		pday = tday - eval(val);
		date = new Date(tyear,tmonth,pday);
		stmonth = date.getMonth();
		stday = date.getDate();
		if (stmonth < 10) stmonth = "0" + stmonth;
		if (stmonth == 00) stmonth = "01";
		if (stday < 10) stday = "0" + stday;
		if (stday == 00) stday = "01";
		search_result.s_day.value = date.getYear() + '-' + stmonth + '-' + stday;
	} else {
		search_result.s_day.value = "2000-11-15";
	}
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function check_comment() {
	var check_comm=document.comm;
	if (!check_comm.member_name.value) {
		alert ('ÀÌ¸§À» ÀÔ·ÂÇØ ÁÖ¼¼¿ä');
		check_comm.member_name.focus();
		return false;
	}

	if (!check_comm.subject.value) {
		alert ('Á¦¸ñÀ» ÀÔ·ÂÇØ ÁÖ¼¼¿ä');
		check_comm.subject.focus();
		return false;
	}

	if (!check_comm.comment.value) {
		alert ('³»¿ëÀ» ÀÔ·ÂÇØ ÁÖ¼¼¿ä');
		check_comm.comment.focus();
		return false;
	}
 

	if (!check_comm.del_pass.value) {
		alert ('µ¶ÀÚÀÇ°ß »èÁ¦½Ã ÇÊ¿äÇÕ´Ï´Ù. ºñ¹Ð¹øÈ£¸¦ ÀÔ·ÂÇØ ÁÖ¼¼¿ä');
		check_comm.del_pass.focus();
		return false;
	}

}

function setCookie(name,value,expires) { 
	document.cookie=name + "=" + escape(value) + ((expires == null)? "" : (" ; expires=" + expires.toGMTString()));
}

function getCookie(name) { 
	var arg = name + "="; 
	var alen = arg.length; 
	var clen = document.cookie.length; 
	var i = 0; while(i< clen) { 
	var j = i + alen; 
	if(document.cookie.substring(i,j)==arg){ 
		var end = document.cookie.indexOf(";",j);
		if(end == -1) end = document.cookie.length; 
		return unescape(document.cookie.substring(j,end)); 
		}
		i=document.cookie.indexOf(" ",i)+1;
		if (i==0) break;
		} 
		return null;
}

function getFontCookie() { 
	var cookie = getCookie("news_font_size");
	if ( cookie == null ) return 16;
	if ( cookie.length ) return cookie; else return 16; 
}

function scaleFont(val) {
	var content, lineHeight; 
	content = document.getElementById("content"); 

	if (val > 0) {
		if (fontSize <= 18) { 
			fontSize = fontSize + val; 
			lineHeight = fontSize+Math.round(1.1*fontSize); 
			content.style.fontSize = fontSize + "px"; 
		} 
	} else {
		if (fontSize > 12) { 
			fontSize = fontSize + val; 
			lineHeight = fontSize+Math.round(1.1*fontSize); 
			content.style.fontSize = fontSize + "px"; 
		} 
	} 
	var mydate = new Date; 
	mydate.setDate(mydate.getDate()+1000); 
	//setCookie("news_font_size", fontSize, mydate); 
}

var fontSize = parseInt(getFontCookie());

function Add_edu() {

	var checkRow = edu.rows.length;
	if (checkRow > 30){
		alert("´õÀÌ»ó Ãß°¡ÇÒ¼ö ¾ø½À´Ï´Ù.")
		return;
	}

	var eduRow=edu.insertRow(checkRow);
	var aRows=edu.rows;
	var aCells=eduRow.cells;
	var TargetCell1 = aRows(eduRow.rowIndex).insertCell(aCells.length);
	var TargetCell2 = aRows(eduRow.rowIndex).insertCell(aCells.length);
	var TargetCell3 = aRows(eduRow.rowIndex).insertCell(aCells.length);

	eduRow.style.backgroundColor = "#f7f7f7"
	TargetCell1.align = "center"
	TargetCell2.align = "left"
	TargetCell3.align = "center"

	imgname = eduRow.rowIndex + 1

	TargetCell1.innerHTML="-±×¸²"+imgname+"-<br>-±×¸²"+imgname+"¼³¸í-<br><br><@"+imgname+">";
	TargetCell2.innerHTML="<input type=file name='file[]' size='50' class='input' style='width=80%;' onFocus='preview_new(this);'><input type='checkbox' name='pts"+imgname+"' value='Y'>ÃÖÀûÈ­<br><textarea name='img_con[]' cols='50' class='txtbox'></textarea><br><input type=radio name='malign"+imgname+"' value='L' checked><img src='/img/align_left.gif' align='absmiddle'><input type=radio name='malign"+imgname+"' value='C'><img src='/img/align_center.gif' align='absmiddle'><input type=radio name='malign"+imgname+"' value='R'><img src='/img/align_right.gif' align='absmiddle'>";
	TargetCell3.innerHTML=" ";
}


function Del_edu() {
	var myCheckRow = edu.rows.length;

	if (myCheckRow > 0) {
		document.all.edu.deleteRow()
	} else {
		alert("´õÀÌ»ó »èÁ¦ÇÒ ¼ö ¾ø½À´Ï´Ù.")
	}
}

function preview_new(obj,num){
	var preview="pre"+num;

	img = obj.value;
	if (img.length == 0) return;
	idx = img.lastIndexOf("\\");
	filename = img.substring(idx+1);
	idx2 = filename.lastIndexOf(".");
	ext = filename.substring(idx2+1);
	ext2 = ext.toLowerCase();
	if( ext2 != "jpg" && ext2 != "gif" & ext2 != "jpeg" ){
		alert('ÆÄÀÏÈ®ÀåÀÚ°¡ jpg³ª gif Çü½ÄÀÌ ¾Æ´Õ´Ï´Ù.\nÀÌ ÆÄÀÏÀº ¾÷·Îµå¸¦ ÇÒ ¼ö ¾ø½À´Ï´Ù.');
		obj.select();
	} else{
		preview.innerHTML = "<table width='110' border='0' cellpadding='5' cellspacing='1' bgcolor='#CCCCCC'><tr><td align='center' valign='middle' bgcolor='#FFFFFF'><img src=\"file://" + img + "\" width=120></td></tr></table>";
	}
}

function addon(t) {
	var old = document.insertform.title1;
	old.value = old.value + t;
}

function doc(){
	AnotherWin = window.open("/event/event.php3?sub=1","AnotherWin","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,width=616,height=700");
}

function flash_logo() {
	window.open("http://www.galleria.co.kr","AnotherWin","");
}

// Image Window Auto Resize
//<a href="javascript:showImgWin('http://jsguide.net/images/exam.jpg')">ÀÌ¹ÌÁö º¸±â</a>
var imgObj = new Image();
function showImgWin(imgName)
{
	imgObj.src = imgName;
	setTimeout("createImgWin(imgObj)", 100);
}
function createImgWin(imgObj)
{
	var window_left = (screen.width-imgObj.width)/2;
	var window_top = (screen.height-imgObj.height)/2;

	if (!imgObj.complete)
	{
		setTimeout("createImgWin(imgObj)", 100);
		return;
	}
	imageWin = window.open("", "imageWin","width=" + imgObj.width + ",height=" + imgObj.height + ',top=' + window_top + ',left=' + window_left );
	imageWin.document.write("<html><body style='margin:0'>");
	imageWin.document.write("<img src='" + imgObj.src + "' onclick=self.close() style=cursor:hand>");
	imageWin.document.write("</body><html>");
	imageWin.document.title = 'ÀÌ¹ÌÁö È®´ëº¸±â';
	imageWin.focus();
}
