function focus_id(){
	var idbox = document.all["id"];
	if(idbox){
		idbox.focus();
	}
}

function link(i){
	window.status=i;
}

function print_frame(wf){
	wf.focus();
	window.print();
}

function FuncName(){
	alert('ÁØºñÁßÀÎ ¸Þ´ºÀÔ´Ï´Ù');
	return;
}

function getCookie( name )
{
	var nameOfCookie = name + "=";
	var x = 0;
	while ( x <= document.cookie.length ){
		var y = (x+nameOfCookie.length);
		if ( document.cookie.substring( x, y ) == nameOfCookie ){
			if ( (endOfCookie=document.cookie.indexOf( ";", y )) == -1 )
				endOfCookie = document.cookie.length;
				return unescape( document.cookie.substring( y, endOfCookie ) );
		}
		x = document.cookie.indexOf( " ", x ) + 1;
		if ( x == 0 )
			break;
	}
	return "";
}

function pop_cookie_window(pop_nm,Cookie_nm,width,height){
	if ( getCookie(Cookie_nm) != 'done' ) {
	window.open('/Notice/'+pop_nm,Cookie_nm,'toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=yes,width='+width+',height='+height+',left=0,top=0');
	}
}

function pop_cookie_window2(pop_nm,Cookie_nm,width,height){
	if ( getCookie(Cookie_nm) != 'done' ) {
	window.open('/Notice/'+pop_nm,Cookie_nm,'toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=yes,width='+width+',height='+height+',left=570,top=0');
	}
}

function pop_cookie_windowfree(pop_nm,Cookie_nm,width,height,w,h){
	if ( getCookie(Cookie_nm) != 'done' ) {
	window.open('/Notice/'+pop_nm,Cookie_nm,'toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=yes,width='+width+',height='+height+',left='+w+',top='+h);
	}
}

function __ws__(id){
 
 document.write(id.innerHTML);id.id="";

}


function IsAlpha(str, idx)
{
	if(IsLower(str,idx) || IsUpper(str,idx))
	{
		return true;
	}
	return false;
}

function IsNumber(str){
	var regEx = new RegExp("^[0-9]+$", "i");

	if ( regEx.test(str) ){
		return true;
	}else{
		return false;
	}
}

function IsAlphaNumeric(str, idx)
{
	if(IsAlpha(str,idx) || IsNumber(str,idx))
	{
		return true;
	}
	return false;
}


function IsLower(str, idx)
{
	if(str.charCodeAt(idx) >= 97 && str.charCodeAt(idx) <= 122)
	{
		return true;
	}
	return false;
}

function IsUpper(str, idx)
{
	if(str.charCodeAt(idx) >= 65 && str.charCodeAt(idx) <= 90)
	{
		return true;
	}
	return false;
}

function ChangeParameter(obj){
	var addstr;
	var RealURL	= location.href; 
	var strURL	= RealURL.toLowerCase();
	var s;
	var e;
	var column = obj.name;
	var value	 = obj.value;

	//ÆÄ¶ó¸ÞÅ¸°¡ ¾øÀ¸¸é
	if(strURL.indexOf(column.toLowerCase()+"=")==-1){
		RealURL = AddParameter(RealURL,column+"="+value);
	}else{
		s = strURL.indexOf(column.toLowerCase()+"=");
		e = strURL.indexOf("&",s)==-1?strURL.length:strURL.indexOf("&",s);
		RealURL = RealURL.replace(RealURL.substring(s,e),column+"="+value);
	}

	//gotopage ÆÄ¶ó¸ÞÅ¸¸¦ »èÁ¦ÇÑ´Ù
	if(strURL.indexOf("gotopage=")!=-1){
		s = strURL.indexOf("gotopage=");
		e = strURL.indexOf("&",s)==-1?strURL.length:strURL.indexOf("&",s)+1;
		RealURL = RealURL.replace(RealURL.substring(s,e),"");
	}

	location.href=RealURL;
}

function AddParameter(str,p){
	if(str.indexOf("?")==-1){
		str += "?"+p;
	}else{
		str += "&"+p;
	}
	return str;
}

function LineUp(column){
	var addstr;
	var strURL = location.href.toLowerCase();
	var s;
	var e;

	//Ä®·³ ¹Ù²Ù±â
	if(strURL.indexOf("ordercolumn=")==-1){
		strURL = AddParameter(strURL,"ordercolumn="+column);
	}else{
		s = strURL.indexOf("ordercolumn=");
		e = strURL.indexOf("&",s)==-1?strURL.length:strURL.indexOf("&",s);
		strURL = strURL.replace(strURL.substring(s,e),"ordercolumn="+column);
	}


	//asc,desc ¹Ù²Ù±â
	if(strURL.indexOf("orderflow=")==-1){
		strURL = AddParameter(strURL,"orderflow=desc");
	}else{
		//** desc¶ó¸é
		if(strURL.indexOf("=desc")!=-1){
			s = strURL.indexOf("orderflow=");
			e = strURL.indexOf("&",s)==-1?strURL.length:strURL.indexOf("&",s);
			strURL = strURL.replace(strURL.substring(s,e),"orderflow=asc");
		//** desc°¡ ¾Æ´Ï¶ó¸é
		}else{
			s = strURL.indexOf("orderflow=");
			e = strURL.indexOf("&",s)==-1?strURL.length:strURL.indexOf("&",s);
			strURL = strURL.replace(strURL.substring(s,e),"orderflow=desc");
		}
	}
	location.href=strURL;
}

String.prototype.trim = function () {
	return this.replace(/(^\s*)|(\s*$)/gi, "");
}

function findStringNum(Str, needle){
	var tempNum		= 0;
	var returnNum	= 0;

	if(Str.indexOf(needle) == -1){
		returnNum = 0;
	}else{
		if(Str.indexOf(needle) > -1 && (Str.indexOf(needle) == Str.lastIndexOf(needle))){
			returnNum = 1;
		}else{
			for(;Str.indexOf(needle, tempNum++) < Str.lastIndexOf(needle);){
				tempNum =	Str.indexOf(needle,tempNum);
				returnNum++;
			}
		}
	}
	return returnNum;
}

function openWin(popnm,url,width,height,scroll){
	var win = window.open(url,popnm,'toolbar=no,location=no,status=no,menubar=no,scrollbars='+scroll+',resizable=no,width='+width+',height='+height+',left=80,top=40');
	win.focus();
}

function leftPad(source, targetLength, padChar) {
	if (!padChar) {
		padChar = " ";
	}
	if (source.length < targetLength)
	{
		var padding = "";

		while (padding.length + source.length < targetLength)
			padding += padChar;

		return padding + source;
	}

	return source;
}

function rightPad(source, targetLength, padChar) {
	while (source.length < targetLength)
		source += padChar;

	return source;
}

function openAdminPostCode(){
	var url = "SystemMngr.asp?ex=zipcode"
	var popnm = "zipcode";
	var width = "400";
	var height = "500";
	var scroll = "yes";
	var win = window.open(url, popnm,'toolbar=no,location=no,status=no,menubar=no,scrollbars='+scroll+',resizable=no,width='+width+',height='+height+',left=80,top=40');
	win.focus();
}

function searchPostCode(formName, ZipCodeName, AddrName){
	var url = "/Publish/Member.asp?ex=zipcode&formName="+formName+"&AddrName="+AddrName+"&ZipCodeName="+ZipCodeName
	var popnm = "zipcode";
	var width = "400";
	var height = "500";
	var scroll = "yes";
	var win = window.open(url, popnm,'toolbar=no,location=no,status=no,menubar=no,scrollbars='+scroll+',resizable=no,width='+width+',height='+height+',left=80,top=40');
	win.focus();
}
function CommaIn(input) {
	var coreVal = eval(input).value.replace(/,/gi,"");	// ¸ÕÀú comma ¸¦ Á¦°Å
	eval(input).value = putComma(coreVal);
}

function CommaOut(input) {
	eval(input).value = eval(input).value.replace(/,/gi,"");
}

/**
*	ÄÞ¸¶¼³Á¤.
*/

function putComma(input) {
	var num = input;

	if (num < 0) {
		num *= -1;
		var minus = true
	}else{
		var minus = false
	}

	var dotPos = (num+"").split(".")
	var dotU = dotPos[0]
	var dotD = dotPos[1]
	var commaFlag = dotU.length%3

	if(commaFlag) {
		var out = dotU.substring(0, commaFlag)
		if (dotU.length > 3) out += ","
	}
	else var out = ""

	for (var i=commaFlag; i < dotU.length; i+=3) {
		out += dotU.substring(i, i+3)
		if( i < dotU.length-3) out += ","
	}

	if(minus) out = "-" + out
	if(dotD) return out + "." + dotD
	else return out
}

function ListingByDate(period, frm, obj1, obj2){
	var today		= new Date();
	var startDate;
	var endDate;

	if(period==0){
		startDate	= '';
		endDate		= '';
	}else if(period==1){
		startDate	= today;
		endDate		= today;
	}else{
		startDate	= new Date(today.getFullYear(), today.getMonth(), today.getDate()-period);
		endDate		= today;
	}
	if(startDate!=''){
		obj1.value = toTimeString(startDate);
	}else{
		obj1.value = '';
	}
	if(endDate!=''){
		obj2.value = toTimeString(endDate);
	}else{
		obj2.value = '';
	}
	if(frm.action.indexOf("EX")) frm.action = frm.action.replace("EX","LI");
	frm.target = "";
	frm.submit();
}

function goOrderLoc(locNum){
	if(locNum=="0"){
		location.href="MyPage.asp?ex=order&subFn=home";
	}else if(locNum=="1"){
		location.href="MyPage.asp?ex=order&subFn=allLi";
	}else if (locNum=="2"){
		location.href="MyPage.asp?ex=order&subFn=orderLi";
	}else if (locNum=="3"){
		location.href="MyPage.asp?ex=order&subFn=cancelLi";
	}
}


function toTimeString(date) { //formatTime(date)
	var year  = date.getFullYear();
	var month = date.getMonth() + 1; // 1¿ù=0,12¿ù=11ÀÌ¹Ç·Î 1 ´õÇÔ
	var day   = date.getDate();
	var hour  = date.getHours();
	var min   = date.getMinutes();

	if (("" + month).length == 1) { month = "0" + month; }
	if (("" + day).length   == 1) { day   = "0" + day;   }
	if (("" + hour).length  == 1) { hour  = "0" + hour;  }
	if (("" + min).length   == 1) { min   = "0" + min;   }

	//return ("" + year + month + day + hour + min)
	return ("" + year + "-" + month + "-" + day);
}