function CheckUserName(str)
{
	var str_len = 0;
	var char;
	for(var i=0; i<str.length; i++) {
		char = str.charAt(i);
		if((char >= "a" && char <= "z") || (char >= "A" && char <= "Z") || (char >= "0" && char <= "9") || (char >= "가" && char <= "힣") || (char >= "ㄱ" && char <= "ㅎ")) {
			str_len++;
		} else if(char >= "가" && char <= "힣") {
			str_len += 2;
		} else {
			return false;
		}
	}
	if(str_len < 4 || str_len > 20) {
		return false;
	}
	return true;
}
function CheckDomainName(str)
{
	var str_len = 0;
	var char;
	for(var i=0; i<str.length; i++) {
		char = str.charAt(i);
		if((char >= "a" && char <= "z") || (char >= "A" && char <= "Z") || (char >= "0" && char <= "9")) {
			str_len++;
		} else {
			return false;
		}
	}
	if(str_len < 4 || str_len > 20) {
		return false;
	}
	return true;
}
function CheckName(str)
{
	var str_len = 0;
	var char;
	for(var i=0; i<str.length; i++) {
		char = str.charAt(i);
		if((char >= "a" && char <= "z") || (char >= "A" && char <= "Z") || (char >= "0" && char <= "9") || (char >= "가" && char <= "힣") || (char >= "ㄱ" && char <= "ㅎ")) {
			str_len++;
		} else {
			return false;
		}
	}
	if(str_len < 3 || str_len > 20) {
		return false;
	}
	return true;
}

function CheckProfileName(str)
{
	var char;
	if (str.length < 1 || str.length > 30)
	{
		return false;
	}
	for(var i=0; i<str.length; i++) {
		char = str.charAt(i);

		if((char >= "a" && char <= "z") || (char >= "A" && char <= "Z") || (char >= "0" && char <= "9") || (char >= "가" && char <= "힣") || (char >= "ぁ" && char <= "ん") || (char >= "ァ" && char <= "ヾ") || (char >= "ｦ" && char <= "ﾟ") || (char >= "一" && char <= "龥") || (char >= "豈" && char <= "鶴") || (char == " ") || (char == "(") || (char == ")") || (char == "-") || (char == "`") || (char == "'") || (char == "\"") || (char == ".") || (char == "&") || (char == "々"))
		{
		}
		else
		{
			return false;
		}
	}
	
	return true;
}

function EnterKeyDownAction(callbackf)
{
	if(event.keyCode==13) {
		eval(callbackf);
		return false;
	}
	return true;
}
var a;
function AlertDup(responseText, elementId, str_dup_check, dup_msg, nodup_msg, invalid_msg)
{
	
	element = document.getElementById(elementId);
	if(responseText == "DUP") {
		element.className = "style_error1_1";
		element.innerHTML = dup_msg;
		eval(str_dup_check+" = 0 ");
		document.edit_input.confirm.value=0;
		
		//alert("0");
		
		
	} else if(responseText == "NODUP") {
		element.className = "style_notice1_1";
		element.innerHTML = nodup_msg;
        
		eval(str_dup_check+" = 1 ");
		document.edit_input.confirm.value=1;
	
		//alert("1");
		
		
	} else if(responseText == "INVALID") {
		element.className = "style_error1_1";
		element.innerHTML = invalid_msg;
		eval(str_dup_check+" = 0 ");
		document.edit_input.confirm.value=0;
	
		//alert("0");
	} 
	if(responseText == "DUPJOIN") {
		element.className = "style_error1_1";
		element.innerHTML = dup_msg;
		eval(str_dup_check+" = 0 ");
	
		
		//alert("0");
		
		
	} else if(responseText == "NODUPJOIN") {
		element.className = "style_notice1_1";
		element.innerHTML = nodup_msg;
        
		eval(str_dup_check+" = 1 ");
	
	
		//alert("1");
		
		
	} else if(responseText == "INVALIDJOIN") {
		element.className = "style_error1_1";
		element.innerHTML = invalid_msg;
		eval(str_dup_check+" = 0 ");
		
	
		//alert("0");
	} 
	
}
function AlertDupDom(responseText, elementId, str_dup_check, dup_msg, nodup_msg, invalid_msg)
{
	
	element = document.getElementById(elementId);
	if(responseText == "DUP") {
		element.className = "style_error1_1";
		element.innerHTML = dup_msg;
		eval(str_dup_check+" = 0 ");
		
		document.edit_input.confirm_dom.value=0;
		//alert("0");
		
		
	} else if(responseText == "NODUP") {
		element.className = "style_notice1_1";
		element.innerHTML = nodup_msg;
        
		eval(str_dup_check+" = 1 ");
	
		document.edit_input.confirm_dom.value=1;
		//alert("1");
		
		
	} else if(responseText == "INVALID") {
		element.className = "style_error1_1";
		element.innerHTML = invalid_msg;
		eval(str_dup_check+" = 0 ");
	
		document.edit_input.confirm_dom.value=0;
		//alert("0");
	} 
	if(responseText == "DUPJOIN") {
		element.className = "style_error1_1";
		element.innerHTML = dup_msg;
		eval(str_dup_check+" = 0 ");
	
		
		//alert("0");
		
		
	} else if(responseText == "NODUPJOIN") {
		element.className = "style_notice1_1";
		element.innerHTML = nodup_msg;
        
		eval(str_dup_check+" = 1 ");
	
	
		//alert("1");
		
		
	} else if(responseText == "INVALIDJOIN") {
		element.className = "style_error1_1";
		element.innerHTML = invalid_msg;
		eval(str_dup_check+" = 0 ");
		
	
		//alert("0");
	} 
	
}


function CreateYears(select_obj, selected_year)
{
	select_obj.options.add(new Option("-------",0));
	for(i=109; i>=0; i--) 
		select_obj.options.add(new Option(i+1900,i+1900));
	
	ChooseSelectValue(select_obj, selected_year, "value");
}

function CreateTimes(select_obj, selected_time)
{
	for(i=0; i<24; i++)
		select_obj.options.add(new Option((i+1) + ":00"), i+1);
		
	ChooseSelectValue(select_obj, selected_time, "value");
}

function ChooseSelectValue(select_obj, select_value, type)
{
	if(type == "value"){
		for(i=0; i<select_obj.options.length; i++) {
			if(select_obj.options[i].value == select_value) {
				select_obj.options[i].selected = true;
				break;
			}
		}
	} else if(type == "text"){
		for(i=0; i<select_obj.options.length; i++) {
			if(select_obj.options[i].text == select_value) {
				select_obj.options[i].selected = true;
				break;
			}
		}
	}
}
function ChooseSelectValueInter(select_obj, select_value, type)
{
	if(type == "value"){
		for(i=0; i<select_obj.options.length; i++) {
			if(select_obj.options[i].value == select_value) {
				
				select_obj.options[i].selected = true;
				break;
			}
		}
	} else if(type == "text"){
		for(i=0; i<select_obj.options.length; i++) {
			if(select_obj.options[i].text == select_value) {
				select_obj.options[i].selected = true;
				break;
			}
		}
	}
}

//
var W3CDOM = (document.createElement && document.getElementsByTagName);
function initFileUploads() {
	if (!W3CDOM) return;
	var fakeFileUpload = document.createElement('span');
	fakeFileUpload.className = 'fakefile';
	fakeFileUpload.appendChild(document.createElement('input'));
	var image = document.createElement('img');
	image.src='http://img.nowprofile.com/v1/btn/btn_find_shpro_img.gif'; 
	image.align="absmiddle"; 
	image.className='imgP';
	fakeFileUpload.appendChild(image);
	var x = document.getElementsByTagName('input');
	for (var i=0;i<x.length;i++) {
		if (x[i].type != 'file') continue;
		if (x[i].parentNode.className != 'fileinputs' && x[i].parentNode.className != 'fileinputs2') continue;
		x[i].className = 'file hidden';
		
		var clone = fakeFileUpload.cloneNode(true);
		x[i].parentNode.appendChild(clone);
		
		x[i].relatedElement = clone.getElementsByTagName('input')[0];
		x[i].onchange = x[i].onmouseout = function () {
			this.relatedElement.value = this.value;
		}
		x[i].onselect = function () {
			this.relatedElement.select();
		}
	}
}

function WriteAll(arr)
{
	for(i=0; i<arr.length; i++) 
		document.write(arr[i].value);
}

function HideDiv(div_id)
{
	obj_div = document.getElementById(div_id);
	obj_div.style.display = "none";	
}
function ChangeDiv(div_id)
{
	obj_div = document.getElementById(div_id);
	if(obj_div.style.display == "none") {
		obj_div.style.display = "block";
		return 1;
	} else {
		obj_div.style.display = "none";
		return 0;
	}
}

function trim(s) {
  s += ''; // 숫자라도 문자열로 변환
  return s.replace(/^\s*|\s*$/g, '');
}

function PostImageControl(idx, width, height, maxminisize, maxwidth)
{
	post_images[idx] = new Object();
	post_images[idx].real_width = width;
	post_images[idx].real_height = height;
	if(width > maxwidth) {
		post_images[idx].real_width = maxwidth;
		post_images[idx].real_height = height * (maxwidth / width);
	}
	post_images[idx].mini_width = post_images[idx].real_width;
	post_images[idx].mini_height = post_images[idx].real_height;
	if(post_images[idx].real_width > post_images[idx].real_height && post_images[idx].real_width > maxminisize) {
		post_images[idx].mini_width = maxminisize;
		post_images[idx].mini_height = height * (maxminisize / width);
	}
	if(post_images[idx].real_height > post_images[idx].real_width && post_images[idx].real_height > maxminisize) {
		post_images[idx].mini_height = maxminisize;
		post_images[idx].mini_width = width * (maxminisize / height);

	}		
	document.getElementById("post_image"+idx).width = post_images[idx].mini_width;
	document.getElementById("post_image"+idx).height = post_images[idx].mini_height;
}

function ConvertImageSize(idx)
{
	var img = document.getElementById("post_img_" + idx);
	if (img.src.indexOf("thm") > 0)
	{
		img.src = img.src.replace(/thm/gi, "big");
	}
	else
	{
		img.src = img.src.replace(/big/gi, "thm");
	}
}

function WriteComment(user_id, post_id, type)
{
	var comment = document.getElementById("comment_"+post_id).value
	if (comment == "")
	{
		alert("댓글을 입력해주십시오.");
		return;
	}
	CallAjax("/user/comment.ajax.php?type=" + type + "&post_id=" + post_id + "&user_id=" + user_id + "&comment=" + encodeURIComponent(comment), "DisplayComment(" + post_id + ", responseText)");
}

function GetComment(user_id, post_id, type)
{
	var target = document.getElementById("div_comment_" + post_id);
	if (target.style.display == "")
	{
		var button = document.getElementById("comment_button_" + post_id)
		button.src = "http://img.nowprofile.com/v1/icon/ico_re_spread.gif";
		button.title = "댓글 열기";
		target.style.display = "none";
		target.innerHTML = '';
		return;
	}
	CallAjax("/user/comment.ajax.php?type=" + type + "&post_id=" + post_id + "&user_id=" + user_id, "DisplayComment(" + post_id + ", responseText)");
}

function DeleteComment(user_id, post_id, comment_id, writer_id, type)
{
	if (confirm("삭제하시겠습니까?"))
		CallAjax("/user/comment.ajax.php?type=" + type + "&comment_id=" + comment_id + "&post_id=" + post_id + "&user_id=" + user_id, "DisplayComment(" + post_id + ", responseText)");
}

function DisplayComment(post_id, text)
{
	var target = document.getElementById("div_comment_" + post_id);
	target.innerHTML = text;
	target.style.display = "";
	
	var button = document.getElementById("comment_button_" + post_id)
	button.src = "http://img.nowprofile.com/v1/icon/ico_re_unfold.gif";
	button.title = "댓글 닫기";
	
	var count = document.getElementById("comment_count_" + post_id);
	count.innerHTML = document.getElementById("comment_count_new_" + post_id).value;
}

function ChangeComment(post_id, comment_id)
{
	document.getElementById("comment_" + post_id + "_" + comment_id).value = document.getElementById("span_text_" + post_id + "_" + comment_id).innerHTML;
	document.getElementById("div_text_" + post_id + "_" + comment_id).style.display = "none";
	document.getElementById("div_edit_" + post_id + "_" + comment_id).style.display = "block";
}

function CancelComment(post_id, comment_id)
{
	document.getElementById("div_edit_" + post_id + "_" + comment_id).style.display = "none";
	document.getElementById("div_text_" + post_id + "_" + comment_id).style.display = "block";
}

function EditComment(user_id, post_id, comment_id, type)
{
	var comment = document.getElementById("comment_" + post_id + "_" + comment_id).value
	if (comment == "")
	{
		alert("댓글을 입력해주십시오.");
		return;
	}
	CallAjax("/user/comment.ajax.php?type=" + type + "&post_id=" + post_id + "&user_id=" + user_id + "&comment_id=" + comment_id + "&comment=" + encodeURIComponent(comment), "DisplayComment(" + post_id + ", responseText)");
}

function WritePost()
{
	if(trim(document.posting.content.value) == "") return;
		document.posting.submit();
}

function RemoveAllOptions(obj_select)
{
	for(var i=obj_select.options.length-1; i>=0; i--)
			obj_select.options[i] = null;
}

function GetLineInfo(region_id, choose_line, choose_town)
{
	
    if(region_id == "선택") {
		RemoveAllOptions(document.getElementById("sel_line"));
		RemoveAllOptions(document.getElementById("sel_town"));
		document.getElementById("sel_line").options[0] = new Option("----", "0");
		document.getElementById("sel_town").options[0] = new Option("----", "0");
	}

	if(region_id == "0") {
		RemoveAllOptions(document.getElementById("sel_line"));
		RemoveAllOptions(document.getElementById("sel_town"));
		document.getElementById("sel_line").options[0] = new Option("----", "0");
		document.getElementById("sel_town").options[0] = new Option("----", "0");
	} else {
		CallAjax("/map/town_"+region_id+".xml", "UpdateLineSelectBox(responseText, 'sel_line', '"+choose_line+"', '"+choose_town+"')");
	}
}
function GetInterLineInfo(region_id, choose_line, choose_town)
{
	
	
    if(region_id == "선택") {
		RemoveAllOptions(document.getElementById("select_line"));
		RemoveAllOptions(document.getElementById("select_town"));
		document.getElementById("select_line").options[0] = new Option("----", "0");
		document.getElementById("select_town").options[0] = new Option("----", "0");
	}

	if(region_id == "0") {
		RemoveAllOptions(document.getElementById("select_line"));
		RemoveAllOptions(document.getElementById("select_town"));
		document.getElementById("select_line").options[0] = new Option("----", "0");
		document.getElementById("select_town").options[0] = new Option("----", "0");
	} else {
		CallAjax("/map/town_"+region_id+".xml", "UpdateInterLineSelectBox(responseText, 'select_line', '"+choose_line+"', '"+choose_town+"')");
	}
}

function GetTownInfo(line_id, choose_town)
{
	obj_region = document.getElementById("sel_region");
	CallAjax("/map/town_" + obj_region.options[obj_region.selectedIndex].value + "_" + line_id + ".xml", "UpdateTownSelectBox(responseText, 'sel_town', '"+choose_town+"')");
}
function GetInterTownInfo(line_id, choose_town)
{
	obj_region = document.getElementById("select_region");
	CallAjax("/map/town_" + obj_region.options[obj_region.selectedIndex].value + "_" + line_id + ".xml", "UpdateInterTownSelectBox(responseText, 'select_town', '"+choose_town+"')");
}

function UpdateLineSelectBox(responseText, select_id, choose_line, choose_town)
{
	try
	{
		obj_select = document.getElementById(select_id);
		RemoveAllOptions(obj_select);
		var jsXmlDom = new REXML(responseText);
		
		var result_node = jsXmlDom.rootElement;
		if(result_node.name != "RESULTSET")
		{
			throw new Error("잘못된 xml정보입니다."+result_node.name);
		}
		for(i=0; i<result_node.childElements.length; i++)
		{
			p_node = result_node.childElements[i];
			obj_select.options.add(new Option(p_node.childElements[1].getText(), p_node.childElements[0].getText()));
		}
		
		//라인 선택 후 바로 타운도 바뀌도록
		if (choose_line == "undefined" || choose_line == "" || choose_line == "undefined" || choose_town == "")
			GetTownInfo(1);
		else
		{
			ChooseSelectValue(document.getElementById("sel_line"), choose_line, "text");
			var sel_town = document.getElementById("sel_line");
			GetTownInfo(sel_town.options[sel_town.selectedIndex].value, choose_town);
		}
		return true;
	}
	catch(e)
	{
		alert("error! code0001 : "+e.message);	
		return false;
	}
}
function UpdateInterLineSelectBox(responseText, select_id, choose_line, choose_town)
{
	try
	{
		obj_select = document.getElementById(select_id);
		RemoveAllOptions(obj_select);
		var jsXmlDom = new REXML(responseText);
		
		var result_node = jsXmlDom.rootElement;
		if(result_node.name != "RESULTSET")
		{
			throw new Error("잘못된 xml정보입니다."+result_node.name);
		}
		for(i=0; i<result_node.childElements.length; i++)
		{
			p_node = result_node.childElements[i];
			obj_select.options.add(new Option(p_node.childElements[1].getText(), p_node.childElements[0].getText()));
		}
		
		//라인 선택 후 바로 타운도 바뀌도록
		if (choose_line == "undefined" || choose_line == "" || choose_line == "undefined" || choose_town == "")
			GetInterTownInfo(1);
		else
		{
			ChooseSelectValueInter(document.getElementById("select_line"), choose_line, "text");
			var select_town = document.getElementById("select_line");
			GetInterTownInfo(select_town.options[select_town.selectedIndex].value, choose_town);
		}
		return true;
	}
	catch(e)
	{
		alert("error! code0001 : "+e.message);	
		return false;
	}
}

function UpdateTownSelectBox(responseText, select_id, choose_town)
{
	
	try{
		obj_select = document.getElementById(select_id);
		RemoveAllOptions(obj_select);
		
		var jsXmlDom = new REXML(responseText);

		var result_node = jsXmlDom.rootElement;
		if(result_node.name != "RESULTSET") alert("error");//throw e;
		arr_towns = new Array();
		for(i=0; i<result_node.childElements.length; i++) {
			p_node = result_node.childElements[i];
			town_info = new Object();
			town_info.id = p_node.childElements[0];
			town_info.name = p_node.childElements[1];
			town_info.position_x = p_node.childElements[2];
			town_info.position_y = p_node.childElements[3];
			town_info.zoomlevel = p_node.childElements[4];
			arr_towns.push(town_info);

		}
        
		for(i=0; i<arr_towns.length; i++) 
			obj_select.options.add(new Option(arr_towns[i].name.text, arr_towns[i].id.text));

		if(choose_town != "undefined" && choose_town != "")
		{
			ChooseSelectValue(document.getElementById("sel_town"), choose_town, "value");
		} else {
			if(obj_select.options.length > 0) {
				obj_select.options[0].selected = true;
				if(obj_select.onchange)
					obj_select.onchange();
			}
		}
		
		return true;
	}catch(e){
		alert("error! code0002 : "+e.message);
		return false;	
	}
}

function UpdateInterTownSelectBox(responseText, select_id, choose_town)
{
	
	try{
		obj_select = document.getElementById(select_id);
		RemoveAllOptions(obj_select);
		
		var jsXmlDom = new REXML(responseText);

		var result_node = jsXmlDom.rootElement;
		if(result_node.name != "RESULTSET") alert("error");//throw e;
		arr_towns = new Array();
		for(i=0; i<result_node.childElements.length; i++) {
			p_node = result_node.childElements[i];
			town_info = new Object();
			town_info.id = p_node.childElements[0];
			town_info.name = p_node.childElements[1];
			town_info.position_x = p_node.childElements[2];
			town_info.position_y = p_node.childElements[3];
			town_info.zoomlevel = p_node.childElements[4];
			arr_towns.push(town_info);

		}
        
		for(i=0; i<arr_towns.length; i++) 
			obj_select.options.add(new Option(arr_towns[i].name.text, arr_towns[i].id.text));

		if(choose_town != "undefined" && choose_town != "")
		{
			ChooseSelectValue(document.getElementById("select_town"), choose_town, "value");
		} else {
			if(obj_select.options.length > 0) {
				obj_select.options[0].selected = true;
				if(obj_select.onchange)
					obj_select.onchange();
			}
		}
		
		return true;
	}catch(e){
		alert("error! code0002 : "+e.message);
		return false;	
	}
}
function GetTownPosition(town_id)
{
	if(town_id == 0) {
		var town = new Object();
		town.position_x = new Object();
		town.position_y = new Object();
		town.zoomlevel = new Object();
		town.position_x.text = "0";
		town.position_y.text = "0";
		town.zoomlevel.text = "15";
		return town;
	}
	for(i=0; i<arr_towns.length; i++) {
		if(arr_towns[i].id.text == town_id) 
			return arr_towns[i];
	}
}

function MoveSelectedItem(obj_select, move_type, idx)
{
	var i;
	var select_count = 0;
	var sel_index = idx;
	
	if(idx < 0) {
		sel_index = obj_select.selectedIndex;
		for(i=sel_index; i<obj_select.options.length; i++) {
			if(obj_select.options[i].selected == true) select_count++;
		}
		if(select_count > 1) return;
	}
	
	if(move_type == "first") {
		for(i=sel_index; i>0; i--)
			SwapItem(obj_select, i, i-1);
	} else if(move_type == "up") {
		if(sel_index != 0){
			SwapItem(obj_select, sel_index, sel_index-1);
		}
	} else if(move_type == "down") {
		if(sel_index < obj_select.options.length-1) {
			SwapItem(obj_select, sel_index, sel_index+1);
		}
	} else if(move_type == "last") {
		for(i=sel_index; i<obj_select.options.length-1; i++)
			SwapItem(obj_select, i, i+1);
	}
}

function SwapItem(obj_select, idx1, idx2)
{
	var temp = new Option();
	temp.value = obj_select.options[idx1].value;
	temp.text = obj_select.options[idx1].text;
	obj_select.options[idx1].value = obj_select.options[idx2].value;
	obj_select.options[idx1].text = obj_select.options[idx2].text;
	obj_select.options[idx2].value = temp.value;
	obj_select.options[idx2].text = temp.text;
	obj_select.options.selectedIndex = idx2;
}

function SelectAll(obj_sel)
{
	var i;
	for(i=0; i<obj_sel.options.length; i++)
		obj_sel.options[i].selected = true;
}

function ValidateEmail(email) {
	var check1 = /(@.*@)|(\.\.)|(@\.)|(\.@)|(^\.)/;  
    var check2 = /^[a-zA-Z0-9\-\.\_]+\@[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,4})$/; 
     
    if ( !check1.test(email) && check2.test(email) ) { 
        return true; 
    } else { 
        return false; 
    } 
} 

function Search()
{
	var keyword = document.getElementById("search_keyword").value;
	
	if (keyword == "가게나 지하철역명을 입력하세요")
	{
		document.getElementById("search_keyword").value = "";
		alert("검색어를 입력해주십시오.");
		return false;		
	}
	
	if(keyword.length < 2 || keyword.length >=30)
	{
		alert("검색어의 길이는 두자리 이상이어야 합니다.");
		return false;
	}
	location.href = "/search.result.php?search_keyword="+encodeURI(keyword);
}

function OpenStoreWindow(obj_map, store_id) 
{
	obj_map.OpenTargetWindow(store_id);
}
function CloseStoreWindow(obj_map, store_id) 
{
	obj_map.CloseTargetWindow(store_id);
}

function GoBookmarkPage(obj)
{
	if (obj.selectedIndex == 0)
		return;	
	if (obj.options[obj.selectedIndex].parentNode.id == "optgr_store")
		document.location = "/store/index.php?store_id="+obj.options[obj.selectedIndex].value;
	else if (obj.options[obj.selectedIndex].parentNode.id == "optgr_town")
		document.location = "/town/index.php?town_id="+obj.options[obj.selectedIndex].value;
}

function AddStore(town_id)
{
	document.location = "/store/add.php?town_id="+town_id;
}

function stripHTMLtag(string) {
   var objStrip = new RegExp();
   objStrip = /[<][^>]*[>]/gi;
   return string.replace(objStrip, "");
}
//키코드 인식//
function Keycode(e){
var result;
if(window.event)
result = window.event.keyCode;
else if(e)
result = e.which;
return result;
}


function BrowserCheck() {

    appname = navigator.appName;
    useragent = navigator.userAgent;

    if (appname == "Microsoft Internet Explorer") appname = "IE";
        IE55 = (useragent.indexOf("MSIE 5.5") > 0);    // 5.5 버전
        IE6 = (useragent.indexOf("MSIE 6") > 0);    // 6 버전
        IE7 = (useragent.indexOf("MSIE 7") > 0);    // 7 버전
        IE8 = (useragent.indexOf("MSIE 8") > 0);    // 8 버전

    if (appname == "IE" && (IE55 || IE6 || IE7 || IE8)) {
        //alert("마우스 오른쪽 버튼을 클릭해서 즐겨찾기 추가 메뉴를 선택하시고 즐겨찾기 모음에 추가해 주세요~");
		if(confirm("마우스 오른쪽 버튼을 클릭해서 즐겨찾기 추가 메뉴를 선택하신 후 \n즐겨찾기 모음에 추가해 주세요~\n더 자세한 설명을 보시겠습니까?")){
			window.location.href="/help/piping.help.php";
		}
    }else{
        alert("파이핑하기 버튼을 마우스로 끌어서 브라우저바에 올려 놓으세요~");
	}
}

function check(obj,result) {
	if (a != obj.value) {
		updateChar(obj,result);
		
		a = obj.value;
		
		
		
	} else {
		
		
	}
	
	
 

 
}



function updateChar(obj,result) {
     
    
    document.getElementById(result).innerHTML = calculate_msglen(obj);
	
	
	
	
}


function calculate_msglen(obj) {
     var nbytes = 0;
     var message = obj.value;    

     for (i=0; i<message.length; i++) {
          var ch = message.charAt(i);
       

          if(escape(ch).length > 4) {
               nbytes += 1; 
          } else if (ch == '\n') {
               if (message.charAt(i-1) != '\r') {
                    nbytes += 1;
               }
          } else if (ch == '<' || ch == '>') {
               nbytes += 1;
          } else {
                nbytes += 1;
		  }
		  
     }

  if(nbytes>255)
	{
	  alert("255자를 넘을수 없습니다.");
	
		obj.value=obj.value.substring(0,255);
		obj.focus();
	   
	}
     return nbytes;
}
//////인증키 스크립트///
function Mobile_auth_key()
{
	CallAjax("/user/mobile.auth.key.php", "Display(responseText)");
}
function Display(responseText)
{
	var target = document.getElementById("user_info_edit");
	target.innerHTML = responseText;
}

function Mobile_change_auth_key()
{
	CallAjax("/user/mobile.auth.key.php", "DisplayResult(responseText)");
}
function DisplayResult(responseText)
{
	var target = document.getElementById("user_info_edit");
	target.innerHTML = responseText;
}
function Confirm(key)
{
   CallAjax("/user/mobile.confirm.ajax.php?str_key="+key, "Display_Con(responseText)");
}
function Display_Con(responseText)
{
	var target = document.getElementById("user_info_edit");
	target.innerHTML = responseText;
}
function Confirm_Btn(key)
{
	CallAjax("/user/mobile.confirm.ajax.php?str_key="+key, "Display_Btn(responseText)");
	//alert(responseText);  
}
function Display_Btn(responseText2)
{
	var target = document.getElementById("user_info_edit");
	target.innerHTML = responseText2;
}
function Mobile_delete()
{
	 if(confirm("등록된 휴대폰 번호를 삭제하시겠습니까?")){
		CallAjax("/user/mobile.confirm.ajax.php?delete=1", "Display_Btn(responseText)");
	}
}
