function write_check() {
	wf = eval("document.wform");
	if(wf.name != null && wf.name.value=="") {
		alert('ÀÌ¸§À» ÀÔ·ÂÇÏ¿© ÁÖ¼¼¿ä.');
		wf.name.focus(); 
		return false;
	}
	if(wf.passwd != null && wf.passwd.value=="") {
		alert('ºñ¹Ð¹øÈ£¸¦ ÀÔ·ÂÇÏ¿© ÁÖ¼¼¿ä.');
		wf.passwd.focus(); 
		return false;
	}
	if(wf.subject != null && wf.subject.value=="") {
		alert('Á¦¸ñÀ» ÀÔ·ÂÇÏ¿© ÁÖ¼¼¿ä.');
		wf.subject.focus(); 
		return false
	}
	return true;
}

function pwCheck_submit() {
	if(document.forms["wform"].userPasswd.value == "") {
		alert("ºñ¹Ð¹øÈ£¸¦ ÀÔ·ÂÇÏ¿© ÁÖ¼¼¿ä");
		document.forms["wform"].userPasswd.focus();
		return false;
	}
	return true;
}

function c_write_submit() {
	if(document.forms["wform"].name.value == "") {
		alert("ÀÌ¸§À» ÀÔ·ÂÇÏ¿© ÁÖ¼¼¿ä");
		document.forms["wform"].name.focus();
		return false;
	}
	if(document.forms["wform"].passwd.value == "") {
		alert("ºñ¹Ð¹øÈ£¸¦ ÀÔ·ÂÇÏ¿© ÁÖ¼¼¿ä");
		document.forms["wform"].passwd.focus();
		return false;
	}
	return true;
}

function comment_window(url) {
	var width = 400;
	var height = 300;

	style = "toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no";
	window_open(url, "comment_write", width, height, style);
}

//////////////////////////////////////////////////////////////////////////////////////////
// ½æ³×ÀÏ ¸®½ºÆ® º¸¿©ÁÖ±â
function thumbnail_list_init() {
	var url = "./thumbnail_list.php";
	var where = document.location.search.substr(1); 
	var parameter = where;

	var user_func = "thumbnail_list_result";
	var loader_func = "thumbnail_list_loader_check";
	callServerGet(url, parameter, user_func, loader_func);
	return false;;
}

function thumbnail_list(where) {
	var url = "./thumbnail_list.php";
	var parameter = where;

	var user_func = "thumbnail_list_result";
	var loader_func = "thumbnail_list_loader_check";
	callServerGet(url, parameter, user_func, loader_func);
	return false;;
}

// °¡Á®¿Â °á°ú¸¦ È­¸é¿¡ º¸¿©ÁÝ´Ï´Ù.
function thumbnail_list_result(response) {
	var thumbnail_list = "";
	if(response) thumbnail_list = response.parseJSON();

	thumbCount = thumbnail_list.length;

	for(i=0; i < 5; i++) {
		aID = "thumb_item" + (i+1);
		aID2 = "thumb_blank" + (i+1);

		if(i < thumbCount) {
			document.getElementById(aID).style.backgroundImage = "url('"+thumbnail_list[i].thumb_image+"')";
			document.getElementById(aID).style.backgroundRepeat  = "no-repeat";
			
			document.getElementById(aID2).onclick = function() {
				var a = this.id.replace(/[^0-9]*/gi, '') - 1;
				location.href= thumbnail_list[a].thumb_link;

			}
		} else {
			document.getElementById(aID).style.backgroundImage = "url('./image/star_img.gif')";
			document.getElementById(aID2).onclick = function() {
				var a = this.id.replace(/[^0-9]*/gi, '') - 1;
				location.href= "javascript:alert('ÀÚ·á°¡ ¾ø½À´Ï´Ù.')";
			}
		}
	}
	document.getElementById("thumb_paging").innerHTML = thumbnail_list[0].thumb_paging;
}

// display="none" ÀÏ¶§ ·¹ÀÌ¾î¸¦ ¼û±â°í display="block"ÀÏ¶§ ·¹ÀÌ¾î¸¦ º¸¿©ÁÝ´Ï´Ù.
function thumbnail_list_loader_check(display) {
	if(display == "none") {
		document.getElementById("thumb_loader").style.display  = "none";
	} else {
		document.getElementById("thumb_loader").style.display  = "block";
	}
}

function getBounds(tag) 
{ 
    var ret = new Object(); 
    if(document.all) { 
        var rect = tag.getBoundingClientRect(); 
        ret.left = rect.left + (document.documentElement.scrollLeft || document.body.scrollLeft); 
        ret.top = rect.top + (document.documentElement.scrollTop || document.body.scrollTop); 
        ret.width = rect.right - rect.left; 
        ret.height = rect.bottom - rect.top; 
    } else { 
        var box = document.getBoxObjectFor(tag); 
        ret.left = box.x; 
        ret.top = box.y; 
        ret.width = box.width; 
        ret.height = box.height; 
    } 
    return ret; 
} 

// ¸¶¿ì½º ¿Ã¶ó°¬À»¶§ ÁÂ¿ì ÀÌµ¿ < > ¸¶Å©µµ Ç¥½Ã
function pageMove() {
	var contentsObj = document.getElementById("read_content");
	var leftObj =  document.getElementById("leftDiv");
	var rightObj =  document.getElementById("rightDiv");
	var contentsHeight = contentsObj.offsetHeight;

	leftObj.style.height = contentsHeight + "px";
	rightObj.style.height = contentsHeight + "px";

	leftObj.style.backgroundImage="url(./image/blank.gif)";
	rightObj.style.backgroundImage="url(./image/blank.gif)";

	contentsObj.zIndex = 0;
	leftObj.zIndex = 1000;
	rightObj.zIndex = 2000;

	// ¸¶¿ì½º ¿Ã¶ó °¬À»¶§
	leftObj.onmouseover = function() {
		leftObj.style.backgroundImage="url(./image/blank.gif)";
		leftObj.style.cursor="pointer";
	}
	rightObj.onmouseover = function() {
		rightObj.style.backgroundImage="url(./image/blank.gif)";
		rightObj.style.cursor="pointer";
	}

	// ¸¶¿ì½º°¡ ³»·Á °¬À»¶§
	leftObj.onmouseout = function() {
		leftObj.style.backgroundImage="url(./image/blank.gif)";
		leftObj.style.cursor="";
	}
	rightObj.onmouseout = function() {
		rightObj.style.backgroundImage="url(./image/blank.gif)";
		rightObj.style.cursor="";
	}

	// Å¬¸¯ÇÏ¿´À»¶§
	leftObj.onclick = function() {
		document.location.href = document.getElementById("aPrev").href;
	}
	rightObj.onclick = function() {
		document.location.href = document.getElementById("aNext").href;
	}

}