function goFindPassword(){
	var windowWidth="400";
	var windowHeight="260";
    var ah = screen.availHeight;
    var aw = screen.availWidth;
    var xc = (aw - windowWidth) / 2;
    var yc = (ah - windowHeight) / 2;
	yc=100;
	xc=100;

	var find_pw = window.open("/ft2/member/find_pw.html","find_pw","width="+windowWidth+", height="+windowHeight+", top="+yc+",left="+xc);
}


function goFindID(){
	var windowWidth="400";
	var windowHeight="260";
    var ah = screen.availHeight;
    var aw = screen.availWidth;
    var xc = (aw - windowWidth) / 2;
    var yc = (ah - windowHeight) / 2;
	yc=200;
	xc=200;

	var find_id = window.open("/ft2/member/find_id.html","find_id","width="+windowWidth+", height="+windowHeight+", top="+yc+",left="+xc);
}

function goChangeMemberInfo(){
	var windowWidth="500";
	var windowHeight="550";
    var ah = screen.availHeight;
    var aw = screen.availWidth;
    var xc = (aw - windowWidth) / 2;
    var yc = (ah - windowHeight) / 2;
	yc=100;
	xc=100;

	var member = window.open("/ft2/member/join.html","member","width="+windowWidth+", height="+windowHeight+", top="+yc+",left="+xc);
}

function goLogout(){
  location.replace('/ft2/member/prc_action.html?mode=logout');
}

function goLogin(){
	var windowWidth="470";
	var windowHeight="315";
    var ah = screen.availHeight;
    var aw = screen.availWidth;
    var xc = (aw - windowWidth) / 2;
    var yc = (ah - windowHeight) / 2;
	yc=100;
	xc=100;
	var login = window.open("/ft2/member/login.html","login","width="+windowWidth+", height="+windowHeight+", top="+yc+",left="+xc);
}


function goFormLoad(){
	try{
		document.getElementById("spanFlash01").innerHTML = "<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0' width='303' height='173'><param name='movie' value='/images/flash_main.swf'><param name='quality' value='high'><PARAM NAME='WMode' VALUE='Transparent'><embed src='/images/flash_main.swf' quality='high' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' width='303' height='173'></embed></object>";
	}catch(e){}	
}

function goClose(){

	if(confirm("Do you want to close this window?")){
		window.close();	
	}
}

function zipcode_check(){
  window.open('/inc/popup_postintro.html','search','resizable=no,scrollbars=yes, width=468,height=340'); 
}

function commaSplit(srcNumber) {
	var txtNumber = '' + srcNumber;
	if (isNaN(txtNumber) || txtNumber == "") {
		alert("Input number please");
		try{
			fieldName.select();
			fieldName.focus();
		}catch(e){}
	} else {
		var rxSplit = new RegExp('([0-9])([0-9][0-9][0-9][,.])');
		var arrNumber = txtNumber.split('.');
		arrNumber[0] += '.';
		do {
			arrNumber[0] = arrNumber[0].replace(rxSplit, '$1,$2');
		} while (rxSplit.test(arrNumber[0]));

		if (arrNumber.length > 1) {
			return arrNumber.join('');
		}else {
			return arrNumber[0].split('.')[0];
	      }
   }
}

function getRadioValue(objForm,objRadio,dV) {

	var defaultValue;
	if (getRadioValue.arguments.length>=3) defaultValue=dV;
	else defaultValue=-1

	var iSellCode,bNoItem;
	iSellCode=defaultValue;
	if (objForm=='') objForm="_no form_"
	if (objRadio=='') objRadio="_no radio_"
	if (document.forms(objForm)==null) return iSellCode;
	if (document.forms(objForm).elements(objRadio)==null) return iSellCode;

	var i;
	bNoItem=true;
	for (i=0;i<1000;i++) {
		if (document.forms(objForm).elements(objRadio)[i]==null) break;
		bNoItem=false;
		if (document.forms(objForm).elements(objRadio)[i].checked) {
			iSellCode=document.forms(objForm).elements(objRadio)[i].value;
			break;
		}
	}
	if (bNoItem) {
		if (document.forms(objForm).elements(objRadio)!=null) {
			if (document.forms(objForm).elements(objRadio).checked) {
				iSellCode=document.forms(objForm).elements(objRadio).value;
			}
		}
	}
	return iSellCode;
}

function setCookie(name,value) {


	document.cookie = name + "=" + escape( value ) + "; path=/;"
}

function getCookie(name){

	name=name+'=';
	var tmp = document.cookie;
	var sidx = tmp.indexOf(name);
	if(sidx == -1) return '';
	sidx = sidx + name.length;
	var eidx = tmp.indexOf(';', sidx);
	if(eidx == -1)eidx = tmp.length;
	return unescape(tmp.substring(sidx, eidx));
}
function m2p(m) {


	return Math.round(m*0.3025*100)/100;
}
function p2m(p) {

	return Math.round(p/0.3025*100)/100;
}
function m2y(m) {

	return Math.round(m*1.0936*100)/100;
}
function y2m(y) {

	return Math.round(y*0.9144*100)/100;
}
function selectAll(obj) {


	try{
	if (obj.type!='hidden'&&obj.style.display!='none') {
		obj.focus();
		if (!obj.readOnly) obj.select();
	}
	}catch(e){}
}
function toNextObj(obj1,len,obj2) {

	if (obj1!=null&&obj2!=null) {
		if (obj1.value.length>=len) selectAll(obj2);
	}
}

function checkFunc(func,value) {
	var aTemp;
	if (func=='') return '';
	var aTemp=(func+'////////').split("/");
	switch (aTemp[0]) {
	case 'noneorlen' :
		if (value.length==0||value.length==parseInt(aTemp[1])) return '';
		return aTemp[2];
	case 'checklen' :
		if (value.length==parseInt(aTemp[1])) return '';
		return aTemp[2];
	default          :
		return 'unknown function applyed';
	}
}

function checkVar(obj,strNE,iFloat,strNN,iMin,iMax,strOF) {


	var value,pow;
	var aTemp,func,szAlert;
	if (typeof(obj)=='undefined') return true;
	value=obj.value.replace(/^[ ]+/g,'').replace(/[ ]+$/g,'');
	if (value==''&&strNE=='') return true;
	aTemp=(strNE+'##').split('##');
	strNE=aTemp[0];
	func=aTemp[1];
	if (value=='') {
		if (strNE!='') {
			alert(strNE);
			
			selectAll(obj);
			return false;
		}
		selectAll(obj);
		return true;
	}
	if ((szAlert=checkFunc(func,value))!='') {
		alert(szAlert);
		selectAll(obj);
		return false;
	}
	if (typeof(strNN)!='undefined') {
		if (iFloat==0) value=parseInt(obj.value,10);
		else {
			value=parseFloat(obj.value);
			if (!isNaN(value)) {
				pow=Math.pow(10,iFloat);
				value=Math.round(value*pow)/pow;
			}
		}
		if (isNaN(value)) {
			if (strNN!='') alert(strNN);
			selectAll(obj);
			return false;
		}
		if (iFloat!=9) obj.value=value;
		if ((szAlert=checkFunc(func,''+value))!='') {
			alert(szAlert);
			selectAll(obj);
			return false;
		}
		if (obj.value<0) {
			alert('Please input + number');
			selectAll(obj);
			return false;
		}
		if (typeof(iMin)!='undefined') {
			if (parseInt(obj.value)<parseInt(iMin)) {
				if (strOF!='') alert(strOF);
				selectAll(obj);
				return false;
			}
		}
		if (typeof(iMax)!='undefined') {
			if (parseInt(obj.value)>parseInt(iMax)) {
				if (strOF!='') alert(strOF);
				selectAll(obj);
				return false;
			}
		}

}

	return true;
}
function retManAge(szJumin1,szJumin2) {

	today		= new Date();
	sysDate		= today.toLocaleString();
	sysYear		= sysDate.slice(6,10);
	sysMonDay	= sysDate.slice(0,2) + sysDate.slice(3,5);

	regYear		= szJumin1.slice(0,2);
	regMonDay	= szJumin1.slice(2,6);
	regSex		= szJumin2.slice(0,1);

	if(regSex=="1" || regSex=="2") regYear="19"+regYear; else regYear = "20"+regYear;

	iAge=parseFloat(sysYear)-parseFloat(regYear)-1;
	iMon=parseFloat(sysMonDay)-parseFloat(regMonDay);

	if(iMon>=0)	iAge=iAge+1;

	return iAge;
}

function checkEMail(obj,strNN) {



	if (typeof(obj)=='undefined') return true;

	var value=obj.value;
	if(!value.length) return true;
	if(value.indexOf('@')==-1) {
		alert(strNN);
		selectAll(obj);
		return false;
	}

	var temp=value.split('.');
    for (var i in temp) {
		if(temp[i]=='com' || temp[i]=='net' || temp[i]=='org')	return true;
		else if((temp[i]=='co'&&temp[++i]=='kr') || (temp[--i]=='ac'&&temp[++i]=='kr'))	return true;
    }
	alert(strNN);
	selectAll(obj);
	return false;
}

function chkMsgLen(obj,msg_len,strLT) {


	var k;
	var str;
    var disp_str;
	var len;
	var temp;
	var tot_cnt;

	str		=obj.value;
	len		=str.length;
	tot_cnt =0;
    disp_str = "";
    for (k=0;k<len;k++){
        temp=str.charAt(k);
        if (escape(temp).length>4)  {tot_cnt+=2;}
        else						{tot_cnt++;}
        if (tot_cnt<=msg_len) {disp_str=disp_str+temp;}
    }
    if(msg_len<=tot_cnt)
    {
        alert(strLT);
		obj.value=disp_str;
        return false;
    }
    return true;
}

function openpostother(URL) {
	var szURL;
	szURL=('&'+(URL.toLowerCase())).replace(/[ ]+/g,'');
	if (szURL.indexOf('&Iparformname=')==-1) URL='Iparformname=SellType&'+URL;
	if (szURL.indexOf('&Iparzipcode1=')==-1) URL='Iparzipcode1=ZipCode1&'+URL;
	if (szURL.indexOf('&Iparzipcode2=')==-1) URL='Iparzipcode2=ZipCode2&'+URL;
	if (szURL.indexOf('&Iparozipcode1=')==-1) URL='Iparozipcode1=OZipCode1&'+URL;
	if (szURL.indexOf('&Iparozipcode2=')==-1) URL='Iparozipcode2=OZipCode2&'+URL;
	if (szURL.indexOf('&Ipardongname=')==-1) URL='Ipardongname=DongName&'+URL;
	if (szURL.indexOf('&Ipardongflag=')==-1) URL='Ipardongflag=DongFlag&'+URL;
	if (szURL.indexOf('&Iparaptname=')==-1) URL='Iparaptname=AptName&'+URL;

	openpost(URL);
}
function getValue(szContent,szName) {
	var iStart,iEnd;
	szName=szName+'=';
	while (1) {
		iEnd=szContent.length;
		iStart=szContent.indexOf(szName);
		if (iStart==-1) return '';
		if (iStart==0||szContent.charAt(iStart-1)==';') break;
		szContent=szContent.substring(iStart+1,iEnd);
	}
	szContent=szContent.substring(iStart,iEnd);
	iEnd=szContent.indexOf(';');
	szContent=szContent.substring(0,iEnd);
	return szContent.split(szName)[1];
}
function makeItem() {
	this.value='';
	return this;
}
function makeArray(n) {
	var i;
	this.length=n;
	for (i=0;i<n;i++) this[i]=new makeItem();
	return this;
}
//----------------------------------------------------------------------------------------------------
function getRowIndex(obj) {
	while (1) {
		if (obj==null) break;
		if (obj.tagName=='TR') break;
		obj=obj.parentElement;
	}
	if (obj==null) return -1;
	return obj.rowIndex;
}
function insertRow(szTableName,iIOffset) {
	var objTBL,objTR,iOff;
	objTBL=document.all[szTableName];
	if (objTBL==null) return null;
	if (typeof(iIOffset)=='undefined') iOffset=0; else iOffset=iIOffset;
	objTR=objTBL.insertRow(objTBL.rows.length-iOffset);
	return objTR;
}
function insertCol(objTR,vclass,valign,vvalue) {
	objTD=objTR.insertCell();
	objTD.className=vclass;
	objTD.align=valign;
	objTD.innerHTML=vvalue;
	return objTD;
}
function addContentRow(szFormName,szFieldName,szContent) {
	var obj;
	obj=document.all[szFormName];
	if (obj==null) return '';
	if (szFieldName!='') obj=obj[szFieldName];
	if (obj==null) return '';
	obj.value+='::'+szContent;
	return obj.value;
}
function addContentCol(szContent,szName,szValue) {
	return szContent+szName+'='+szValue+';';
}
function deleteRow(szTableName,iRow,iIRowPerContent) {
	var iRowPerContent,objTBL,i;
	if (typeof(iIRowPerContent)=='undefined') iRowPerContent=1; else iRowPerContent=iIRowPerContent;
	objTBL=document.all[szTableName];
	if (objTBL==null) return 0;
	for (i=0;i<iRowPerContent;i++) objTBL.deleteRow(iRow);
	return i;
}
function deleteContentRow(szFormName,szFieldName,iIndex) {
	var obj,i,aszContent,szContent,szReturn;
	obj=document.all[szFormName];
	if (obj==null) return '';
	if (szFieldName!='') obj=obj[szFieldName];
	if (obj==null) return '';

	szReturn='';

	if (iIndex<0) return szReturn;
	aszContent=obj.value.split('::');
	for (i=1,szContent='';i<aszContent.length;i++)
		if (i-1!=iIndex) szContent+=('::'+aszContent[i]); else szReturn=aszContent[i];
	obj.value=szContent;

	return szReturn;
}
function deleteContentHit(objElement,szTableName,szFormName,szFieldName,iIHeadings,iIRowPerContent) {
	var iRowPerContent,iHeadings,iRow;
	if (typeof(iIRowPerContent)=='undefined') iRowPerContent=1; else iRowPerContent=iIRowPerContent;
	if (typeof(iIHeadings)=='undefined') iHeadings=0; else iHeadings=iIHeadings;

	iRow=getRowIndex(objElement);
	if (iRow==-1) return '';

	deleteRow(szTableName,iRow,iRowPerContent);
	return deleteContentRow(szFormName,szFieldName,(iRow-iHeadings)/iRowPerContent);
}

function OpenWin(file) { 
  var url='/upload/ENG_guide/html/detail.html?code='+file; 
  window.open(url,'detail','width=620,height=430');
}

function OpenWin2(file) { 
  var url='/upload/ENG_guide/html/detail02.html?code='+file; 
  window.open(url,'detail','width=620,height=430');
}

function MakeWin(file,URL,WIDTH, HEIGHT) { 
  var url=URL+'?code='+file;
  var scale = 'width='+WIDTH+', height='+HEIGHT;   
  window.open(url,'detail',scale);
}

function deleteContentHas(szName,szValue,szTableName,szFormName,szFieldName,iIHeadings,iIRowPerContent) {
	var iRowPerContent,iHeadings,iRow,iDeleted;
	iDeleted=0;
	if (typeof(iIRowPerContent)=='undefined') iRowPerContent=1; else iRowPerContent=iIRowPerContent;
	if (typeof(iIHeadings)=='undefined') iHeadings=0; else iHeadings=iIHeadings;

	var obj,aszTemp,i,szTemp;
	szTemp='';
	obj=document.all[szFormName];
	if (obj==null) return '';
	if (szFieldName!='') obj=obj[szFieldName];
	if (obj==null) return '';
	aszTemp=obj.value.split('::');
	for (i=1;i<aszTemp.length;i++) {
		if (getValue(aszTemp[i],szName)==''+szValue) {
			iRow=(i-1-iDeleted)*iRowPerContent+iHeadings;
			deleteRow(szTableName,iRow,iRowPerContent);
			szTemp=szTemp+'::'+deleteContentRow(szFormName,szFieldName,(iRow-iHeadings)/iRowPerContent);
		}
	}
	return szTemp;
}


var mikExp = /[$\\@\\\#%\^\&\*\(\)\[\]\+\_\{\}\`\~\=\|]/;
function dodacheck(val) {
	var strPass = val.value;
	var strLength = strPass.length;
	var lchar = val.value.charAt((strLength) - 1);
	if(lchar.search(mikExp) != -1) {
		var tst = val.value.substring(0, (strLength) - 1);
		val.value = tst;
	}
}





// for AJAX (http://wiki.javajigi.net/pages/viewpage.action?pageId=3919)

	// check available browser
	//
	// @sample        if(chkAjaBrowser()){ location.href='nonajax.htm' }
	// @sample        oj = new chkAjaBrowser();if(oj.bw.safari){ /* Safari  */ }
	// @return        true|false
	//
	function chkAjaBrowser()
	{
		var a,ua = navigator.userAgent;
		this.bw= { 
		  safari    : ((a=ua.split('AppleWebKit/')[1])?a.split('(')[0]:0)>=124 ,
		  konqueror : ((a=ua.split('Konqueror/')[1])?a.split(';')[0]:0)>=3.3 ,
		  mozes     : ((a=ua.split('Gecko/')[1])?a.split(" ")[0]:0) >= 20011128 ,
		  opera     : (!!window.opera) && ((typeof XMLHttpRequest)=='function') ,
		  msie      : (!!window.ActiveXObject)?(!!createHttpRequest()):false 
		}
		return (this.bw.safari||this.bw.konqueror||this.bw.mozes||this.bw.opera||this.bw.msie)
	}
	

	////
	// XMLHttpRequest Object Create
	//
	// @sample        oj = createHttpRequest()
	// @return        XMLHttpRequest Object(Instance)
	//
	function createHttpRequest()
	{
		if(window.ActiveXObject){
			 //Win e4,e5,e6
			try {
				return new ActiveXObject("Msxml2.XMLHTTP") ;
			} catch (e) {
				try {
					return new ActiveXObject("Microsoft.XMLHTTP") ;
				} catch (e2) {
					return null ;
	 			}
	 		}
		} else if(window.XMLHttpRequest){
			 //Win Mac Linux m1,f1,o8 Mac s1 Linux k3
			return new XMLHttpRequest() ;
		} else {
			return null ;
		}
	}

	function sendRequest(callback,data,method,url,async,sload,user,password)
	{
		//XMLHttpRequest Object
		var oj = createHttpRequest();
		if( oj == null ) return null;

		var sload = (!!sendRequest.arguments[5])?sload:false;
		if(sload || method.toUpperCase() == 'GET')url += "?";
		if(sload)url=url+"t="+(new Date()).getTime();
		

		var bwoj = new chkAjaBrowser();
		var opera	  = bwoj.bw.opera;
		var safari	  = bwoj.bw.safari;
		var konqueror = bwoj.bw.konqueror;
		var mozes	  = bwoj.bw.mozes ;

		if(opera || safari || mozes){
			oj.onload = function () { callback(oj); }
		} else {
		
			oj.onreadystatechange =function () 
			{
				if ( oj.readyState == 4 ){
					callback(oj);
				}
			}
		}

		//URL ENCODING
		data = uriEncode(data)
		if(method.toUpperCase() == 'GET') {
			url += data
		}
		
		//open METHOD
		oj.open(method,url,async,user,password);

		//Header application/x-www-form-urlencoded setting
		setEncHeader(oj)

		//Debug
		//alert("////jslb_ajaxxx.js//// \n data:"+data+" \n method:"+method+" \n url:"+url+" \n async:"+async);
		
		//send METHOD
		oj.send(data);

		//URI ENCODING HEADER SETTING
		function setEncHeader(oj){
	
			//HEADER application/x-www-form-urlencoded setting
			// @see  http://www.asahi-net.or.jp/~sd5a-ucd/rec-html401j/interact/forms.html#h-17.13.3
			// @see  #h-17.3
			//   ( default enctype "application/x-www-form-urlencoded")
			var contentTypeUrlenc = 'application/x-www-form-urlencoded; charset=UTF-8';
			if(!window.opera){
				oj.setRequestHeader('Content-Type',contentTypeUrlenc);
			} else {
				if((typeof oj.setRequestHeader) == 'function')
					oj.setRequestHeader('Content-Type',contentTypeUrlenc);
			}	
			return oj
		}

		//URL ENCODING
		function uriEncode(data){

			if(data!=""){
				//&,= split & encode
				var encdata = '';
				var datas = data.split('&');
				for(i=1;i<datas.length;i++)
				{
					var dataq = datas[i].split('=');
					encdata += '&'+encodeURIComponent(dataq[0])+'='+encodeURIComponent(dataq[1]);
				}
			} else {
				encdata = "";
			}
			return encdata;
		}


		return oj
	}
