function cleanDomainList(obj)
{
	var ex_text = obj.value.replace(/\r\n/gi, '').replace(/\r/gi, '').replace(/\n/gi, '').replace(/ /gi, '');
	if (ex_text == "¿¹)°¡ºñ¾ÆÈ«±æµ¿°¡ºñ¾Ælove°¡ºñ¾Æ123" || ex_text == "¿¹)°¡ºñ¾Ægabia³×ÀÌ¹ö»ï¼ºsamsung" || ex_text == "¿¹)°¡ºñ¾Ægabia" || ex_text == "¿¹)°¡ºñ¾Æ" || ex_text == "¿¹)°¡ºñ¾Ægabia°¡ºñ¾Æ.ÇÑ±Û°¡ºñ¾Æ.È¸»ç" || ex_text == "¿¹)°¡ºñ¾Ægabia³×ÀÌ¹ösamsung")
		obj.value = "";
}

function chkKeyword(ff) {
	var str;
	var domain_name	= new Array();
	var char_length = ff.domainList.value.length;
	var start_at = 0;
	if (ff.name == "chg_owner_form")
	{
		var isvalid = /^[°¡-ÆRa-zA-Z0-9\-]+$/;
		var isvalid2 = /^[°¡-ÆRa-zA-Z0-9\-]+(\.ÇÑ±Û|\.È¸»ç|\.±â°ü)$/;
	}
	else
	{
		var isvalid = /^[°¡-ÆRa-zA-Z0-9\-]+(\.ÇÑ±Û|\.È¸»ç|\.±â°ü)?$/;
	}

	for(var i = 0, j = 0; i <= char_length; i++){
		var one_char = ff.domainList.value.charAt(i);
		
		if(one_char == '\n'){
			domain_name[j++] = ff.domainList.value.substring(start_at, i-1);
			start_at = i+1;
		}else if(i == char_length){
			domain_name[j++] = ff.domainList.value.substring(start_at, i);
		}
	}

	if (ff.domainList.value == "") {
		window.alert('°Ë»öÇÒ Å°¿öµå¸¦ ÀÔ·ÂÇÏ¼¼¿ä.');
		ff.domainList.focus();
		return false;
	}

	for(i = 0, valid_domain = 0; i < domain_name.length; i++){
		valid_check = false;
		str = domain_name[i].trim();
		if (str != "") {
			// °ø¹éÃ¼Å©
			if((/[\s]/).test(str)) {
				window.alert("°ø¹éÀº Çã¿ëÇÏÁö ¾Ê½À´Ï´Ù.");
				ff.domainList.focus();
				return false;
			}
			if( str.indexOf("-") == 0 ) {
				window.alert("ÇÏÀÌÇÂ(-)À¸·Î ½ÃÀÛÇÏ´Â Å°¿öµå´Â ½ÅÃ»ÇÏ½Ç¼ö ¾ø½À´Ï´Ù.");
				ff.domainList.focus();
				return false;
			}
			// "-"  À¸·Î ³¡³ª´Â °Í ±ÝÁö
			if( str.lastIndexOf("-") == (str.length-1) ) {
				window.alert("ÇÏÀÌÇÂ(-)À¸·Î ³¡³ª´Â Å°¿öµå´Â ½ÅÃ»ÇÏ½Ç¼ö ¾ø½À´Ï´Ù.");
				ff.domainList.focus();
				return false;
			}
			// ","  À¸·Î ³¡³ª´Â °Í ±ÝÁö
			if( str.lastIndexOf(",") == (str.length-1) ) {
				window.alert("(,)À¸·Î ³¡³ª´Â Å°¿öµå´Â ½ÅÃ»ÇÏ½Ç¼ö ¾ø½À´Ï´Ù.");
				ff.domainList.focus();
				return false;
			}
			// "."  À¸·Î ³¡³ª´Â °Í ±ÝÁö
			if( str.lastIndexOf(".") == (str.length-1) ) {
				window.alert("(.)À¸·Î ³¡³ª´Â Å°¿öµå´Â ½ÅÃ»ÇÏ½Ç¼ö ¾ø½À´Ï´Ù.");
				ff.domainList.focus();
				return false;
			}
			if(!isvalid.test(str)){
				if (ff.name == "chg_owner_form" && isvalid2.test(str))
				{
					window.alert("ÇÑ±Û.ÇÑ±Û Å°¿öµå´Â ¼ÒÀ¯±ÇÀÌÀü ÁØºñÁßÀÔ´Ï´Ù.");
				}
				else
				{
					window.alert("Æ¯¼ö¹®ÀÚ´Â »ç¿ëÇÏ½Ç¼ö ¾ø½À´Ï´Ù\n\n¿©·¯°³ÀÇ Å°¿öµå¸¦ ÀÔ·ÂÇÏ½Ç¶§´Â ´ÙÀ½ÁÙ¿¡ ÀÔ·ÂÇØÁÖ¼¼¿ä.");
				}
				ff.domainList.focus();
				return false;
			}

			valid_domain ++;
		}
	}
	if(valid_domain > 20){
		window.alert('µµ¸ÞÀÎ °³¼ö´Â 20°³¸¦ ³ÑÀ» ¼ö ¾ø½À´Ï´Ù.');
		ff.domainList.focus();
		return false;
	}
	return true;
}

function hangulChkKeyword(ff) {
	var str;
	var domain_name	= new Array();
	var char_length = ff.domainList.value.length;
	var start_at = 0;
	var isvalid = /^[°¡-ÆRa-zA-Z0-9\-]+(\.ÇÑ±Û|\.È¸»ç|\.±â°ü)?$/;
	var numeric = '1234567890';
	var special = ' ~!@#$%^&*()_=+|\\{}[];:"\'`<>,.?\/';
	var alpha = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
	
	for(var i = 0, j = 0; i <= char_length; i++){
		var one_char = ff.domainList.value.charAt(i);
		
		if(one_char == '\n'){
			domain_name[j++] = ff.domainList.value.substring(start_at, i-1);
			start_at = i+1;
		}else if(i == char_length){
			domain_name[j++] = ff.domainList.value.substring(start_at, i);
		}
	}

	if (ff.domainList.value == "") {
		window.alert('°Ë»öÇÒ Å°¿öµå¸¦ ÀÔ·ÂÇÏ¼¼¿ä.');
		ff.domainList.focus();
		return false;
	}

	for(i = 0, valid_domain = 0; i < domain_name.length; i++){
		valid_check = false;
		str = domain_name[i].trim();
		if (str != "") {
			// °ø¹éÃ¼Å©
			
			if(str.length < 2 || str.length > 17) {
				window.alert("ÇÑ±Û Å°¿öµå µµ¸ÞÀÎÀº 2ÀÚ~17ÀÚ±îÁö ½ÅÃ»ÇÒ ¼ö ÀÖ½À´Ï´Ù.");
				ff.domainList.focus();
				return false;
			}
			
			if((/[\s]/).test(str)) {
				window.alert("°ø¹éÀº Çã¿ëÇÏÁö ¾Ê½À´Ï´Ù.");
				ff.domainList.focus();
				return false;
			}
			if( str.indexOf("-") == 0 ) {
				window.alert("ÇÏÀÌÇÂ(-)À¸·Î ½ÃÀÛÇÏ´Â Å°¿öµå´Â ½ÅÃ»ÇÏ½Ç¼ö ¾ø½À´Ï´Ù.");
				ff.domainList.focus();
				return false;
			}
			// "-"  À¸·Î ³¡³ª´Â °Í ±ÝÁö
			if( str.lastIndexOf("-") == (str.length-1) ) {
				window.alert("ÇÏÀÌÇÂ(-)À¸·Î ³¡³ª´Â Å°¿öµå´Â ½ÅÃ»ÇÏ½Ç¼ö ¾ø½À´Ï´Ù.");
				ff.domainList.focus();
				return false;
			}
			// ","  À¸·Î ³¡³ª´Â °Í ±ÝÁö
			if( str.lastIndexOf(",") == (str.length-1) ) {
				window.alert("(,)À¸·Î ³¡³ª´Â Å°¿öµå´Â ½ÅÃ»ÇÏ½Ç¼ö ¾ø½À´Ï´Ù.");
				ff.domainList.focus();
				return false;
			}
			// "."  À¸·Î ³¡³ª´Â °Í ±ÝÁö
			if( str.lastIndexOf(".") == (str.length-1) ) {
				window.alert("(.)À¸·Î ³¡³ª´Â Å°¿öµå´Â ½ÅÃ»ÇÏ½Ç¼ö ¾ø½À´Ï´Ù.");
				ff.domainList.focus();
				return false;
			}
			if(!isvalid.test(str)){
				window.alert("Æ¯¼ö¹®ÀÚ´Â »ç¿ëÇÏ½Ç¼ö ¾ø½À´Ï´Ù\n\n¿©·¯°³ÀÇ Å°¿öµå¸¦ ÀÔ·ÂÇÏ½Ç¶§´Â ´ÙÀ½ÁÙ¿¡ ÀÔ·ÂÇØÁÖ¼¼¿ä.");
				ff.domainList.focus();
				return false;
			}

			if ( !checkHangulKeyword(str, numeric+alpha+'.-', 63) ) {
				window.alert(str+"Å°¿öµå´Â ÇÑ±ÛÀÌ ¹Ýµå½Ã ÇÑÀÚ¶óµµ Æ÷ÇÔµÇ¾î ÀÖ¾î¾ß ÇÏ¸ç \n\n¿µ¹®, ¼ýÀÚ, ÇÏÀÌÇÂ ¶Ç´Â ÀÌÀÇ Á¶ÇÕ¸¸À¸·Î ±¸¼ºµÉ ¼ö ¾ø½À´Ï´Ù.");
				ff.domainList.focus();
				return false;
			}

			valid_domain ++;
		}
	}
	if(valid_domain > 20){
		window.alert('µµ¸ÞÀÎ °³¼ö´Â 20°³¸¦ ³ÑÀ» ¼ö ¾ø½À´Ï´Ù.');
		ff.domainList.focus();
		return false;
	}
	return true;
}

function checkHangulKeyword(target,astr,lmax) {
  	var i;
  	var t = target;
  	if (astr.length >= 1) {
        	for (i=0; i<t.length; i++)
                	if(astr.indexOf(t.substring(i,i+1))<0) {
        			return true;
      			}
  	}
    return false;
}

function onChkWhois() {
	var str;
	var isvalid = /^[°¡-ÆRa-zA-Z0-9\-]+$/;
	with (document.regist_form)
	{
		domain_name = domainList.value;
		if (domain_name == "")
		{
			window.alert('Á¶È¸ÇÒ Å°¿öµå¸¦ ÀÔ·ÂÇÏ¼¼¿ä.');
			domainList.focus();
			return false;
		}
		if (domain_name != "") {
			// °ø¹éÃ¼Å©
			if((/[\s]/).test(domain_name)) {
				window.alert("°ø¹éÀº Çã¿ëÇÏÁö ¾Ê½À´Ï´Ù.");
				//ff.domainList.value = "";
				domainList.focus();
				return false;
			}
			if( domain_name.indexOf("-") == 0 ) {
				window.alert("ÇÏÀÌÇÂ(-)À¸·Î ½ÃÀÛÇÏ´Â Å°¿öµå´Â Á¶È¸ÇÏ½Ç¼ö ¾ø½À´Ï´Ù.");
				domainList.focus();
				return false;
			}
			if(!isvalid.test(domain_name)){
				window.alert("Æ¯¼ö¹®ÀÚ´Â »ç¿ëÇÏ½Ç¼ö ¾ø½À´Ï´Ù\n\n¿©·¯°³ÀÇ Å°¿öµå¸¦ ÀÔ·ÂÇÏ½Ç¶§´Â ´ÙÀ½ÁÙ¿¡ ÀÔ·ÂÇØÁÖ¼¼¿ä.");
				domainList.focus();
				return false;
			}
			// "-"  À¸·Î ³¡³ª´Â °Í ±ÝÁö
			if( domain_name.lastIndexOf("-") == (domain_name.length-1) ) {
				window.alert("ÇÏÀÌÇÂ(-)À¸·Î ³¡³ª´Â Å°¿öµå´Â Á¶È¸ÇÏ½Ç¼ö ¾ø½À´Ï´Ù.");
				domainList.focus();
				return false;
			}
			// ","  À¸·Î ³¡³ª´Â °Í ±ÝÁö
			if( domain_name.lastIndexOf(",") == (domain_name.length-1) ) {
				window.alert("(,)À¸·Î ³¡³ª´Â Å°¿öµå´Â Á¶È¸ÇÏ½Ç¼ö ¾ø½À´Ï´Ù.");
				domainList.focus();
				return false;
			}
			// "."  À¸·Î ³¡³ª´Â °Í ±ÝÁö
			if( domain_name.lastIndexOf(".") == (domain_name.length-1) ) {
				window.alert("(.)À¸·Î ³¡³ª´Â Å°¿öµå´Â Á¶È¸ÇÏ½Ç¼ö ¾ø½À´Ï´Ù.");
				domainList.focus();
				return false;
			}
		}
		return true;
	}
}

function onOwnerComplete(user_id, number, ordnum) {
	window.open("../wowauth/wowauth_step1.php?input_id="+user_id+"&input_number="+number+"&ordernum="+ordnum+"&service_name=keyword", "WowAuth","menubar=no,toolbar=no, location=no,directories=no,resizable=no,status=no,width=410, height=310, left=50, top=50");
}

// Å°¿öµå ÈÄÀÌÁî
var whois_keyword_info = function(keyword)
{
	if(keyword == "")
	{
		alert("Å°¿öµå¸¦ ÀÔ·ÂÇØÁÖ¼¼¿ä");
		return false;
	}
	sURL = "/keyword/whois/keyword_whois.php?keyword="+keyword;
	window.open(sURL, "NameServer", "left=" + (window.screen.availWidth/2 - 200) + ",top=" + (window.screen.availHeight/2 - 220) + ",directories=no, location=no, menubar=no, resizable=no, scrollbars=0, status=no, titlebar=no, toolbar=no,width=533,height=490");
}


// ½ÅÃ»¼­ ÀÎ¼â
var onPrint = function()
{
	var f = document.change;
	f.target = "_print";
	f.action = "owner_transfer_form_print.php";
	f.submit();
}

//
var request_form_data = "";
var showRequestFormPrint = function()
{
	//
	var RequestFormList = document.getElementById("RequestFormList");

	//
	var now_width = window.document.body.clientWidth/2;
	RequestFormList.style.left = now_width - 44;
	RequestFormList.style.top = 450;
	$("#RequestFormList").show();

	//
	if (!request_form_data && request_form_data.length == 0)
	{
		$("#request_form_list").html("<tr><td height=\"30\" colspan=\"4\" class=\"table1\"><img src=\"/images/regist/progress.gif\" border=\"0\" align='absmiddle' style='margin-left:2px'> Loading...</td></tr>");

		//
		$.ajax ({
			type: "POST",
			url: "/inc/ajax_lib/get_change_owner_form_list.php",
			data: "change_owner_type=keyword",
			dataType: "html",
			success: function(msg){
				request_form_data = msg;
				$("#request_form_list").html(msg);
			}
		});
	}
	else
	{
		$("#request_form_list").html(request_form_data);
	}
}
//
var hideRequestFormPrint = function()
{
	//
	var RequestFormList = document.getElementById("RequestFormList");

	//
	RequestFormList.style.left = 0;
	RequestFormList.style.top = 0;
	$("#RequestFormList").hide();
}
//
var printRequestForm = function(ordernum)
{
	var f = document.change_owner_form;

	f.ordernum.value = ordernum;

	f.target = "_print";
	f.action = "owner_transfer_form_print.php";
	f.submit();
}

//
var clickKeyword = function (type, keyword)
{
	document.form.keyword.value = keyword;
	if (type == "recomm")
	{
		document.form.action = "./recommend_index.php";
	}
	else if (type == "drop")
	{
		document.form.action = "./delkeyword_index.php";
	}
	document.form.submit ();
}

//
var getKeywordList = function (type, kind, value)
{
	//
	$("#keyword_list").empty();
	document.keyword_list_form.all_check.checked = false;

	//
	tbody  = getObject('keyword_list');
	row  = document.createElement("tr");

	//
	cell = document.createElement("td");
	cell.setAttribute("align", "left");
	cell.setAttribute("colSpan", "7");
	cell.setAttribute("height", "35");
	cell.className = "table1";
	cell.innerHTML = "&nbsp; <img src=\"/images/regist/progress.gif\" border=\"0\" align='absmiddle'> &nbsp; °Ë»öÁß...";

	//
	row.appendChild(cell);
	tbody.appendChild(row);

	//
	var form = document.keyword_form;

	if (kind == "cate")
	{
		form.cate_id.value        = value;
		form.page.value           = "1";
		form.search_keyword.value = "";
	}
	else if (kind == "page")
	{
		form.page.value           = value;
	}
	else if (kind == "search")
	{
		form.cate_id.value        = "";
		form.page.value           = "1";
		if (value)
		{
			form.search_keyword.value = value;
		}
	}

	//
	var cate_id = form.cate_id.value;
	var page    = form.page.value;
	var keyword = form.search_keyword.value;

	var post_data = "";
	post_data  = "type=" + type;
	post_data += "&page=" + page;
	post_data += "&cate_id=" + cate_id;
	post_data += "&keyword=" + keyword;

	//
	$.ajax ({
		type: "POST",
		url: "/inc/ajax_lib/get_dn_keyword_list.php",
		data: post_data,
		dataType: "json",
		success: function(msg){
			$("#keyword_list").empty();
			
			if (type == "recomm" || type == "best" || type == "weekly")
			{
				setRecommKeywordList (msg);
			}
			else if (type == "drop")
			{
				setDropKeywordList (msg);
			}
			
			page_per_count = 10;
			if (type == "best") page_per_count = 30;
			
			if (type != "weekly")
			{
				setPageNavigator (type, page, page_per_count, msg.total_count);
			}
		}
	});

	return false;
}

var setRecommKeywordList = function (rsp)
{
	tbody  = getObject('keyword_list');

	if (rsp.keyword_list.length == 0)
	{
		row  = document.createElement("tr");

		cell = document.createElement("td");
		cell.setAttribute("align", "center");
		cell.setAttribute("colSpan", "4");
		cell.setAttribute("height", "35");
		cell.className = "table1";
		cell.innerHTML = "°Ë»öÇÑ Å°¿öµå°¡ Á¸ÀçÇÏÁö ¾Ê½À´Ï´Ù.";
		row.appendChild(cell);

		//
		tbody.appendChild(row);
		return;
	}

	//
	row  = document.createElement("tr");

	// 
	cell = document.createElement("td");
	cell.setAttribute("align", "center");
	cell.setAttribute("height", "5");
	cell.className = "table3";
	cell.innerHTML = "<img src='/images/keyword/2008/space.gif' width='1' height='1'>";
	row.appendChild(cell);

	// 
	cell = document.createElement("td");
	cell.className = "table3";
	cell.innerHTML = "<img src='/images/keyword/2008/space.gif' width='1' height='1'>";
	row.appendChild(cell);

	// 
	cell = document.createElement("td");
	cell.setAttribute("align", "center");
	cell.className = "table3";
	cell.innerHTML = "<img src='/images/keyword/2008/space.gif' width='1' height='1'>";
	row.appendChild(cell);

	// 
	cell = document.createElement("td");
	cell.setAttribute("align", "center");
	cell.className = "table3";
	cell.innerHTML = "<img src='/images/keyword/2008/space.gif' width='1' height='1'>";
	row.appendChild(cell);

	tbody.appendChild(row);

	//
	avail_cnt = 0;
	for (var i=0; i<rsp.keyword_list.length; i++)
	{
		if (rsp.keyword_list[i].avail == 1)
		{
			avail_cnt ++;
			checkbox = "<input type='checkbox' name='keyword[]' value='" + rsp.keyword_list[i].keyword + "'>";
			avail    = "<font color='#F65100'>½ÅÃ»°¡´É</font>";
			button   = "<img src='/images/keyword/2008/btn001.gif' width='67' height='20' border='0' style='cursor:pointer' onclick=\"registKeyword('" + rsp.keyword_list[i].keyword + "');\">";
		}
		else if (rsp.keyword_list[i].avail == 2)
		{
			checkbox = "&nbsp;";
			avail    = "À¯º¸¾î";
			button   = "-";
		}
		else
		{
			checkbox = "&nbsp;";
			avail    = "½ÅÃ»ºÒ°¡";
			button   = "<img src='/images/keyword/2009/btn_appoint.gif' width='67' height='19' border='0' style='cursor:pointer' onclick=\"reservedKeyword('" + rsp.keyword_list[i].keyword + "');\">";
		}

		//
		row  = document.createElement("tr");

		// 
		cell = document.createElement("td");
		cell.setAttribute("align", "center");
		cell.setAttribute("width", "5%");
		cell.setAttribute("height", "25");
		cell.className = "table1 ";
		cell.innerHTML = checkbox;
		row.appendChild(cell);

		// 
		cell = document.createElement("td");
		//cell.setAttribute("width", "50%");
		cell.setAttribute("style", "padding-left:10px;");
		cell.className = "table2 left10";
		cell.innerHTML = rsp.keyword_list[i].keyword;
		row.appendChild(cell);

		// 
		cell = document.createElement("td");
		cell.setAttribute("align", "center");
		cell.setAttribute("width", "15%");
		cell.className = "table2";
		cell.innerHTML = avail;
		row.appendChild(cell);

		// 
		cell = document.createElement("td");
		cell.setAttribute("align", "center");
		cell.setAttribute("width", "15%");
		cell.className = "table2";
		cell.innerHTML = button;
		row.appendChild(cell);

		//
		tbody.appendChild(row);
	}

	document.keyword_list_form.avail_cnt.value = avail_cnt;
}

var setDropKeywordList = function (rsp)
{
	tbody  = getObject('keyword_list');

	if (rsp.keyword_list.length == 0)
	{
		row  = document.createElement("tr");

		cell = document.createElement("td");
		cell.setAttribute("align", "center");
		cell.setAttribute("colSpan", "7");
		cell.setAttribute("height", "35");
		cell.className = "table1";
		cell.innerHTML = "°Ë»öÇÑ Å°¿öµå°¡ Á¸ÀçÇÏÁö ¾Ê½À´Ï´Ù.";
		row.appendChild(cell);

		//
		tbody.appendChild(row);
		return;
	}

	//
	row  = document.createElement("tr");

	// 
	cell = document.createElement("td");
	cell.setAttribute("align", "center");
	cell.setAttribute("height", "5");
	cell.className = "table3";
	cell.innerHTML = "<img src='/images/keyword/2008/space.gif' width='1' height='1'>";
	row.appendChild(cell);

	// 
	cell = document.createElement("td");
	cell.className = "table3";
	cell.innerHTML = "<img src='/images/keyword/2008/space.gif' width='1' height='1'>";
	row.appendChild(cell);

	// 
	cell = document.createElement("td");
	cell.setAttribute("align", "center");
	cell.className = "table3";
	cell.innerHTML = "<img src='/images/keyword/2008/space.gif' width='1' height='1'>";
	row.appendChild(cell);

	// 
	cell = document.createElement("td");
	cell.setAttribute("align", "center");
	cell.className = "table3";
	cell.innerHTML = "<img src='/images/keyword/2008/space.gif' width='1' height='1'>";
	row.appendChild(cell);

	// 
	cell = document.createElement("td");
	cell.setAttribute("align", "center");
	cell.className = "table3";
	cell.innerHTML = "<img src='/images/keyword/2008/space.gif' width='1' height='1'>";
	row.appendChild(cell);

	// 
	cell = document.createElement("td");
	cell.setAttribute("align", "center");
	cell.className = "table3";
	cell.innerHTML = "<img src='/images/keyword/2008/space.gif' width='1' height='1'>";
	row.appendChild(cell);

	// 
	cell = document.createElement("td");
	cell.setAttribute("align", "center");
	cell.className = "table3";
	cell.innerHTML = "<img src='/images/keyword/2008/space.gif' width='1' height='1'>";
	row.appendChild(cell);

	tbody.appendChild(row);

	//
	avail_cnt = 0;
	for (var i=0; i<rsp.keyword_list.length; i++)
	{
		//
		row  = document.createElement("tr");

		// 
		cell = document.createElement("td");
		cell.setAttribute("align", "center");
		cell.setAttribute("width", "5%");
		cell.setAttribute("height", "25");
		cell.className = "table1";
		cell.innerHTML = "<input type='checkbox' name='keyword[]' value='" + rsp.keyword_list[i].keyword + "'>";
		row.appendChild(cell);

		// 
		cell = document.createElement("td");
		cell.setAttribute("width", "31%");
		cell.setAttribute("style", "padding-left:10px;");
		cell.className = "table2 left10";
		cell.innerHTML = rsp.keyword_list[i].keyword;
		row.appendChild(cell);

		// 
		cell = document.createElement("td");
		cell.setAttribute("align", "center");
		cell.setAttribute("width", "12%");
		cell.className = "table2";
		cell.innerHTML = rsp.keyword_list[i].product;
		row.appendChild(cell);

		// 
		cell = document.createElement("td");
		cell.setAttribute("align", "center");
		cell.setAttribute("width", "14%");
		cell.className = "table2";
		cell.innerHTML = rsp.keyword_list[i].expiredate;
		row.appendChild(cell);

		// 
		cell = document.createElement("td");
		cell.setAttribute("align", "center");
		cell.setAttribute("width", "14%");
		cell.className = "table2";
		cell.innerHTML = rsp.keyword_list[i].deletedate;
		row.appendChild(cell);

		// 
		cell = document.createElement("td");
		cell.setAttribute("align", "center");
		cell.setAttribute("width", "8%");
		cell.className = "table2";
		cell.innerHTML = "<font color='#F65100'>" + rsp.keyword_list[i].leftday + "</font>";
		row.appendChild(cell);

		// 
		cell = document.createElement("td");
		cell.setAttribute("align", "center");
		cell.setAttribute("width", "16%");
		cell.className = "table2";
		cell.innerHTML = "<img src='/images/keyword/2008/btn002.gif' width='97' height='19' border='0' style='cursor:pointer' onclick=\"wishKeyword('" + rsp.keyword_list[i].keyword + "');\">";
		row.appendChild(cell);

		//
		tbody.appendChild(row);

		avail_cnt ++;
	}

	document.keyword_list_form.avail_cnt.value = avail_cnt;
}

var checkAllKeyword = function (checked)
{
	var avail_cnt = parseInt(document.keyword_list_form.avail_cnt.value);
	if (avail_cnt == 0)
	{
		alert ("°Ë»öÇÑ Å°¿öµå°¡ Á¸ÀçÇÏÁö ¾Ê½À´Ï´Ù.");
	}
	else if (avail_cnt == 1)
	{
		var keyword = document.keyword_list_form['keyword[]'];
		keyword.checked = checked;
	}
	else 
	{
		var keyword = document.keyword_list_form['keyword[]'];
		for (var i=0; i<keyword.length; i++)
		{
			keyword[i].checked = checked;
		}
	}
}

var registKeyword = function (keyword)
{
	var form = document.select_regist_form;
	form.domainList.value = keyword;
	form.submit ();
}

var selectRegistKeyword = function ()
{
	var avail_cnt = parseInt(document.keyword_list_form.avail_cnt.value);
	var form = document.select_regist_form;
	var keyword_list = "";

	if (avail_cnt == 0)
	{
		alert ("°Ë»öÇÑ Å°¿öµå°¡ Á¸ÀçÇÏÁö ¾Ê½À´Ï´Ù.");
		return;
	}
	else if (avail_cnt == 1)
	{
		var keyword = document.keyword_list_form['keyword[]'];
		keyword_list = keyword.value;
	}
	else 
	{
		var keyword = document.keyword_list_form['keyword[]'];
		for (var i=0; i<keyword.length; i++)
		{
			if (keyword[i].checked)
			{
				keyword_list += keyword[i].value + "\n";
			}
		}
	}

	if (!keyword_list) 
	{
		alert ("µî·ÏÇÒ Å°¿öµå ¼±ÅÃÇÏ¼¼¿ä.");
		return;
	}
	form.domainList.value = keyword_list;

	form.submit ();
}

var wishKeyword = function (keyword)
{
	//
	post_data = "command=add&domain[]=" + keyword;

	//
	$.ajax({
		type: "POST",
		url: "/inc/ajax_lib/mywish_domain.php",
		data: post_data,
		dataType: "html",
		success: function(msg) {
			if (msg.indexOf("·Î±×ÀÎ ÈÄ »ç¿ë") > 0)
			{
				alert ("·Î±×ÀÎ ÈÄ »ç¿ëÇÏ½Ç ¼ö ÀÖ½À´Ï´Ù.");
				return;
			}
			if (confirm ("Wish List¿¡ ¼º°øÀûÀ¸·Î ÀúÀåÇÏ¿´½À´Ï´Ù.\n Wish List ÆäÀÌÁö·Î ÀÌµ¿ÇÏ½Ã°Ú½À´Ï±î?"))
			{
				location.href="/mydomain/mydomain_wishlist.php";
				return;
			}
		}
	});
}

var selectWishKeyword = function ()
{
	var avail_cnt = parseInt(document.keyword_list_form.avail_cnt.value);
	var form = document.select_regist_form;
	var post_data = "";

	if (avail_cnt == 0)
	{
		alert ("°Ë»öÇÑ Å°¿öµå°¡ Á¸ÀçÇÏÁö ¾Ê½À´Ï´Ù.");
		return;
	}
	else if (avail_cnt == 1)
	{
		var keyword = document.keyword_list_form['keyword[]'];
		post_data = "domain[]="+keyword.value;
	}
	else 
	{
		var keyword = document.keyword_list_form['keyword[]'];
		var keyword_list = "";
		for (var i=0; i<keyword.length; i++)
		{
			if (keyword[i].checked)
			{
				if (post_data) post_data += "&";
				post_data = "domain[]="+keyword[i].value;
			}
		}
	}

	if (!post_data) 
	{
		alert ("À§½Ã¸®½ºÆ®¿¡ ´ãÀ» Å°¿öµå ¼±ÅÃÇÏ¼¼¿ä.");
		return;
	}

	//
	post_data = "command=add&" + post_data;

	//
	$.ajax({
		type: "POST",
		url: "/inc/ajax_lib/mywish_domain.php",
		data: post_data,
		dataType: "html",
		success: function(msg) {
			if (msg.indexOf("·Î±×ÀÎ ÈÄ »ç¿ë") > 0)
			{
				alert ("·Î±×ÀÎ ÈÄ »ç¿ëÇÏ½Ç ¼ö ÀÖ½À´Ï´Ù.");
				return;
			}
			if (confirm ("Wish List¿¡ ¼º°øÀûÀ¸·Î ÀúÀåÇÏ¿´½À´Ï´Ù.\n Wish List ÆäÀÌÁö·Î ÀÌµ¿ÇÏ½Ã°Ú½À´Ï±î?"))
			{
				location.href="/mydomain/mydomain_wishlist.php";
				return;
			}
		}
	});
}

var reservedKeyword = function (keyword)
{
	obj = window.open("./popup_appoint.php?keyword="+keyword, "reservedKeyword", "left=" + (window.screen.availWidth/2 - 200) + ",top=" + (window.screen.availHeight/2 - 220) + ",directories=no, location=no, menubar=no, resizable=no, scrollbars=0, status=no, titlebar=no, toolbar=no,width=650,height=710");
	obj.focus();
}

var setPageNavigator = function (type, page, view_cnt, total_cnt)
{
	var page_navigator = "";
	var page_cnt = Math.ceil(total_cnt / view_cnt);
	var start_page;
	var end_page;

	if (page_cnt == 0)
	{
		$("#page_navigator").html('');
		return;
	}

	//
	start_page = page - 4;

	if (start_page < 1)
	{
		start_page = 1;
	}

	//
	end_page = start_page + 8;
	if (end_page >= page_cnt)
	{
		end_page = page_cnt;
	}

	//
	start_page = end_page - 8;

	if (start_page < 1)
	{
		start_page = 1;
	}

	//
	if (page > 1)
	{
		page_navigator += "<img src=\"/images/keyword/2008/paging_first.gif\" align=\"absmiddle\" onClick=\"getKeywordList('" + type + "', 'page', '1')\" style=\"cursor:pointer\"> ";
		page_navigator += "<img src=\"/images/keyword/2008/paging_prev.gif\" align=\"absmiddle\" onClick=\"getKeywordList('" + type + "', 'page', '" + (page - 1) + "')\" style=\"cursor:pointer\"> ";
	}
	else
	{
		page_navigator += "<img src=\"/images/keyword/2008/paging_first.gif\" align=\"absmiddle\"> ";
		page_navigator += "<img src=\"/images/keyword/2008/paging_prev.gif\" align=\"absmiddle\"> ";
	}

	//
	for (i = start_page; i <= end_page; i++)
	{
		if (page == i)
		{
			page_navigator += "<b>" + i + "</b> ";
		}
		else
		{
			page_navigator += "<span onClick=\"getKeywordList('" + type + "', 'page', '" + i + "')\" style=\"cursor:pointer\">" + i + "</span> ";
		}
	}

	//
	if (page < page_cnt)
	{
		page_navigator += "<img src=\"/images/keyword/2008/paging_next.gif\" align=\"absmiddle\" onClick=\"getKeywordList('" + type + "', 'page', '" + (parseInt(page) + 1) + "')\" style=\"cursor:pointer\"> ";
		page_navigator += "<img src=\"/images/keyword/2008/paging_last.gif\" align=\"absmiddle\" onClick=\"getKeywordList('" + type + "', 'page', '" + page_cnt + "')\" style=\"cursor:pointer\"> ";
	}
	else
	{
		page_navigator += "<img src=\"/images/keyword/2008/paging_next.gif\" align=\"absmiddle\"> ";
		page_navigator += "<img src=\"/images/keyword/2008/paging_last.gif\" align=\"absmiddle\"> ";
	}

	$("#page_navigator").html(page_navigator);
}
