
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function NewWindow(mypage, myname, w, h, scroll)
{
	var win = null;
	
	LeftPosition=(screen.width) ? (screen.width-w)/2 : 0;
	TopPosition=(screen.height) ? (screen.height-h)/2 : 0;				
	settings='height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',resizable=no, scrollbars=' + scroll;

	win=window.open(mypage,myname,settings);
	return win;
}


//경고창 띄우기 s=>메세지, t=>제목, 
function clubErrMessage(s,t){
	window.showModalDialog("/park/club/error.jsp?title="+t+"&msg="+s,"","dialogHeight:256px;dialogWidth:288px;edge:raised;center:yes;help:no;resizable:no;status:no;scroll:no;unadorned:no");
}

//이미지 사이즈 변환
function resize_image(e, max_width){
	var max_width, max_width;
	var width = e.width;
	if(e.width > max_width) 
	{
		e.width = max_width;
		e.hegith = (e.height * max_width) / width;
	}	
}


// 메인 팝업창 
function mainOpenPop(theURL, winName, features){
	var replacePopup = true;
	var PopupWin = window.open(theURL, winName, features, replacePopup);
	PopupWin.focus();
}

// 이미지 보기 팝업, 2004.06.25
function viewImgPop(path,file){
	var popname = 'ImgView';
	var url =  '/common/pop_img_view.asp?fPath='+ path +'&fName='+ file;
	var imgFile = path +'/'+file;
	var scrollYN='1';
	var popstate = '';
		popstate += 'width=100,';
		popstate += 'height=100,';
		popstate += 'left=100,';
		popstate += 'top=100,';
		popstate += 'fullscreen=no,';
		popstate += 'channelmode=no,';
		popstate += 'toolbar=no,';
		popstate += 'location=no,';
		popstate += 'directories=no,';
		popstate += 'status=no,';
		popstate += 'menubar=no,';
		popstate += 'scrollbars='+ scrollYN +', ';
		popstate += 'resizable=no,';
		popstate += 'titlebar=no,';
		popstate += 'hotkeys=no';
	var PopupWin = window.open(url,popname,popstate);
	PopupWin.focus();
	return;
}

// Modeless형식의 메시지를 보여줌, 2004.06.25
function errModeless(msg){
	if(msg=='') msg='오류가 발생하였습니다';
	window.showModelessDialog("/library/popup/notice.php",msg,"dialogWidth:296px; dialogHeight:220px; center=yes; screenTop=yes; scroll=no; status=no; help=no;");
}
// window open 형식의 메시지를 보여줌, 2006.06.25
function openErrPop(msg){
	if(msg=='') msg='오류가 발생하였습니다';
	window.open('/common/message_pop.asp?msg='+ msg ,'err_page','width=290,height=195,left=100,top=100');
}

// 우편번호검색 , 2004.06.26, hoon
// => searchZipCode('1',document.PageForm)
function searchZipCode(flag,obj){
//	window.open('/pop/zip_search.asp','','width=418, height=300, scrollbars=yes');
	var intWidth = 418;
	var intHeight = 300;
	var urlPopup = '/pop/zip_search.asp?flag='+flag;
	var namePopup = 'SearchPostCode';
	var featuresPopup = '';
		featuresPopup += 'width='+intWidth+',';
		featuresPopup += 'height='+intHeight+',';
		featuresPopup += 'left='+((window.document.body.clientWidth-intWidth)/2)+',';
		featuresPopup += 'top='+((window.document.body.clientHeight-intHeight)/2)+',';
		featuresPopup += 'fullscreen=no,';
		featuresPopup += 'channelmode=no,';
		featuresPopup += 'toolbar=no,';
		featuresPopup += 'location=no,';
		featuresPopup += 'directories=no,';
		featuresPopup += 'status=1,';
		featuresPopup += 'menubar=no,';
		featuresPopup += 'scrollbars=yes,';
		featuresPopup += 'resizable=no,';
		featuresPopup += 'titlebar=no,';
		featuresPopup += 'hotkeys=no';
	var replacePopup = true;

	var PopupWin = window.open(urlPopup, namePopup, featuresPopup, replacePopup);
	PopupWin.focus();
	window.status = window.defaultStatus;
	return ;
}

// 아이디 찾기
function goSearchMemId(gubn){
	var opSearchMemId = window.open('/pop/id_search.asp','','width=400, height=270, status=1');
	opSearchMemId.focus();
	if(gubn=='1'){
		window.close();
	}
}

// 비밀번호 찾기
function goSearchMemPwd(gubn){
	var opSearchMemPwd = window.open('/pop/pw_search.asp','','width=400, height=270, status=1')
	opSearchMemPwd.focus();
	if(gubn=='1'){
		window.close();
	}
}


// 메인 팝업창 
function mainOpenPop(theURL, winName, features){
	var replacePopup = true;
	var PopupWin = window.open(theURL, winName, features, replacePopup);
	PopupWin.focus();
}



// 파일 업로드 팝업, 2005/07/04 
function openUploadPopup(menuCd,headIdx){
	var WIP = window.open("/silicone2007/kcc_webadmin/common/fileupload/popup_fileupload.asp?menuCd="+ menuCd +"&heaIdx="+ headIdx,"IWin","menubar=no,scrollbars=no,width=350,height=250,status=1");	
	WIP.focus();
}


// 파일 업로드 팝업, 2005/07/04 
function openBbsPreview(obj){
	var WIP = window.open("/silicone2007/kcc_webadmin/common/bbs/bbs_preview.asp?obj="+obj,"IWin","menubar=no,scrollbars=1,width=714,height=600,status=1");
	WIP.focus();
}

function winPrint(){
	if(confirm("인쇄시에는 왼쪽여백 : 4.5, 오른쪽여백 : 4.5로 설정해 주세요.")){
		print();	
	}
}

function alertEnjoy() {
  alert('응모기간이 마감되었습니다.');
}
function setPng24(obj) { 
    obj.width=obj.height=1; 
    obj.className=obj.className.replace(/\bpng24\b/i,''); 
    obj.style.filter = 
    "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+ obj.src+"',sizingMethod='image');" 
    obj.src='';  
    return ''; 
}

// 회원정보 보기 팝업 띄우기
function memView(seq,Flag){
//	window.open('/pop/zip_search.asp','','width=418, height=300, scrollbars=yes');
	var intWidth = 800;
	var intHeight = 470;
	if (Flag == 'Y'){
		var urlPopup = '/webadmin/member/memView.asp?MIDX='+ seq ;
	}else if (Flag == 'N'){
		var urlPopup = '/webadmin/member/memOutView.asp?MIDX='+ seq ;
	}

	var namePopup = 'memInfoView';
	var featuresPopup = '';
		featuresPopup += 'width='+intWidth+',';
		featuresPopup += 'height='+intHeight+',';
		featuresPopup += 'left='+((window.document.body.clientWidth-intWidth)/2)+',';
		featuresPopup += 'top='+((window.document.body.clientHeight-intHeight)/2)+',';
		featuresPopup += 'fullscreen=no,';
		featuresPopup += 'channelmode=no,';
		featuresPopup += 'toolbar=no,';
		featuresPopup += 'location=no,';
		featuresPopup += 'directories=no,';
		featuresPopup += 'status=1,';
		featuresPopup += 'menubar=no,';
		featuresPopup += 'scrollbars=yes,';
		featuresPopup += 'resizable=no,';
		featuresPopup += 'titlebar=no,';
		featuresPopup += 'hotkeys=no';
	var replacePopup = true;

	var PopupWin = window.open(urlPopup, namePopup, featuresPopup, replacePopup);
	PopupWin.focus();
	window.status = window.defaultStatus;
	return ;
}

// 회원정보 보기 팝업 띄우기
function memView2(id,Flag){
//	window.open('/pop/zip_search.asp','','width=418, height=300, scrollbars=yes');
	var intWidth = 800;
	var intHeight = 470;
	var urlPopup = '/webadmin/member/memView2.asp?id='+ id ;

	var namePopup = 'memInfoView';
	var featuresPopup = '';
		featuresPopup += 'width='+intWidth+',';
		featuresPopup += 'height='+intHeight+',';
		featuresPopup += 'left='+((window.document.body.clientWidth-intWidth)/2)+',';
		featuresPopup += 'top='+((window.document.body.clientHeight-intHeight)/2)+',';
		featuresPopup += 'fullscreen=no,';
		featuresPopup += 'channelmode=no,';
		featuresPopup += 'toolbar=no,';
		featuresPopup += 'location=no,';
		featuresPopup += 'directories=no,';
		featuresPopup += 'status=1,';
		featuresPopup += 'menubar=no,';
		featuresPopup += 'scrollbars=yes,';
		featuresPopup += 'resizable=no,';
		featuresPopup += 'titlebar=no,';
		featuresPopup += 'hotkeys=no';
	var replacePopup = true;

	var PopupWin = window.open(urlPopup, namePopup, featuresPopup, replacePopup);
	PopupWin.focus();
	window.status = window.defaultStatus;
	return ;
}
//var con_home_https = "https://oksusu2010.lhsoft.co.kr:453";
var con_home_https = "https://www.oksusutea.com:8182";
var con_home_http = "http://www.oksusutea.com";



/*
	 2010.02.17   by 심재훈
	 textarea 글제수 제한   
   byteCheck(cont, vByte, textLen)
	 byteCheck(textarea ID, 길이 표현 ID, 글자수)	 
*/
function byteCheck(cont, vByte, textLen){
  var maxByte = textLen;
  var obj = $(cont);
  var len = getByteLength(obj);
  $(vByte).innerHTML = len;

  if ( len > maxByte) {
   alert(maxByte+" Byte 까지 가능합니다.");
   cutText(obj, obj.value, cont, vByte, textLen);
	}
 }

function getByteLength(input) {
	var byteLength = 0;
	for (var inx = 0; inx < input.value.length; inx++) {
			var oneChar = escape(input.value.charAt(inx));
			if ( oneChar.length == 1 ) {
					byteLength ++;
			} else if (oneChar.indexOf("%u") != -1) {
					byteLength += 2;
			} else if (oneChar.indexOf("%") != -1) {
					byteLength += oneChar.length/3;
			}
	}
	return byteLength;
} 

function cutText(obj, txt, cont, vByte, textLen){
  var tmpStr;
  var temp=0;
  var onechar;
  var tcount;
  var thisText
  var lastByte

  tcount = 0;
  tmpStr = new String(txt);
  temp = tmpStr.length;

  for(k=0;k<temp;k++){
   onechar = tmpStr.charAt(k);
   if(escape(onechar).length > 4)
    tcount += 2;
   else if(onechar!='\r')
    tcount +=1;
   if(tcount > textLen){
    tmpStr = tmpStr.substring(0,k);

    thisText = tmpStr.substring(0, k);
    obj.value = thisText;
		var len = getByteLength($(cont));
		$(vByte).innerHTML = len;
    break;
   }
  }
 }

/*
   2010.02.17  by 심재훈
	 파일 첨부 이미지 버튼 
	 fnChange(input 파일 name, input 텍스트 name)
*/
function fnChange(fId, tId) {

		var text = eval("document.PageForm."+tId); 
		var file = eval("document.PageForm."+fId);

		text.value = file.value;
		text.focus();
}

/* FAQ */
function initToggle(tabContainer) {
	triggers = tabContainer.getElementsByTagName("a");

	for(i = 0; i < triggers.length; i++) {
		if (triggers.item(i).href.split("#")[1])
			triggers.item(i).targetEl = document.getElementById(triggers.item(i).href.split("#")[1]);

		if (!triggers.item(i).targetEl)
			continue;

		triggers.item(i).targetEl.style.display = "none";
		triggers.item(i).onclick = function () {
			if (tabContainer.current == this) {
				this.targetEl.style.display = "none";
				tabContainer.current = null;
			} else {
				if (tabContainer.current) {
					tabContainer.current.targetEl.style.display = "none";
				}
				this.targetEl.style.display = "";
				tabContainer.current = this;
			}
			return false;
		}
	}
}

/* toggle Layer */
function toggle(ele){ /* 노드 감추기/보이기 */
	if(typeof ele == "string") ele = document.getElementById(ele);
	// css의 display 값 받아오기
	var value = null;
	if(ele.currentStyle) var value = ele.currentStyle['display'];
	else if(document.defaultView.getComputedStyle) var value = document.defaultView.getComputedStyle(ele,null)['display'];
	// none일때와 아닐때 다르게 먹이기
	if(value != "none") (ele.style.display != 'none') ? ele.style.display = 'none' : ele.style.display = '';
	else (ele.style.display != 'block') ? ele.style.display = 'block' : ele.style.display = ''
	return false;
}

/* png */
function setPng24(obj) {
 obj.width=obj.height="1";
 obj.className=obj.className.replace(/\bpng24\b/i,"");
 obj.style.filter= "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+ obj.src +"',sizingMethod='image');"
 obj.src=""; 
 return "";
}