
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;
}

function NewWindow_Ord(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;

	window.open(mypage,myname,settings);
    
	/*var cidx = "0/22";
	var ccnt ="2";
	var ord_opt1="가정용";
	var ord_opt2="black";
	var delivery = "3000";
	var sendflag="0";
	var dname ="아무개";
	var dtel="02-501-0560"
	var dhp ="010-000-0000";
	var demail ="yuki@lh.co.kr";
	var dcomment="테스트";
	var dzip = "135-010";
	var daddr = "서울시 강남구 논현동";
	var daddr2 ="202-16";
	var upoint = "10000";
	var pay ="5000";
	var way = "2";
	orderPay(cidx,ccnt,ord_opt1,ord_opt2,delivery,sendflag,dname,dtel,dhp,demail,dzip,daddr,daddr2,upoint,pay,way);*/
	
}

//경고창 띄우기 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();	
	}
}




//ele 해당 엘리먼트를 보이기 설정
function tabVisible(id)
	{
		var tab1 = document.getElementById("tab1").style.display = "none";
	    var tab2 = document.getElementById("tab2").style.display = "none";
	    var tab3 = document.getElementById("tab3").style.display = "none";
		var tab4 = document.getElementById("tab4").style.display = "none";
	    
	    document.getElementById(id).style.display = "";
	}

// 팝업로그인 관련
function PopLogin(flag,bUrl){
	if (flag=="0"){ // 로그인 팝업 띄우기
		NewWindow("/popup/pop_login.asp?bUrl="+bUrl, "popLogin", "425", "500", "N");
	}else if  (flag=="1"){ // 회원가입 페이지로 이동
		opener.location.href="/member/certification.asp";
		self.close();
    }else if  (flag=="2"){ // ID/ 비번 찾기
		opener.location.href="/member/find_idpass.asp";
		self.close();
    }else if (flag=="3"){ // 로그인 팝업 띄우기
		NewWindow("/popup/pop_login.asp?flag=home", "popLogin", "425", "500", "N");
	}

}

// 투명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 ''; 
} 

// TOP 클래시 영역변경
function topAreaChange(mode) {
  if(mode == "over") {
    $("gnbWrapTop").className = "gnbWrap2";
  } else if(mode == "over2") {
    $("gnbWrapTop").className = "gnbWrap3";
  } else if(mode == "out") {
    $("gnbWrapTop").className = "gnbWrap";
  }
}

// 카테고리 영역 변경
function menuAreaChange(mode) {
  if(mode == "over") {
    $("categoryDiv").className = "subMenu2";
  } else if(mode == "over2") {
    $("categoryDiv").className = "subMenu3";
  } else if(mode == "out") {
    $("categoryDiv").className = "subMenu";
  }
}

// 서비스/제휴문의
function serviceQna() {
  NewWindow("/popup/pop_cooperation.asp", "serviceQna", "629", "672", "N");
}


/* 팝업창띄우기 */
function winOpen(file,wid,hei){

	if(file==""){ alert('페이지 준비중'); return false;}

	window.open(file, 'add', 'status=no, toolbar=no, location=no, menubar=no, directories=no, resizeable=no, scrollbars=yes, width='+wid+', height='+hei+',top=200,left=400');
}


//document.oncontextmenu = function (e) {
//  alert("상품이미지 무단도용방지를 위하여\n\n마우스 오른쪽 버튼을 사용하실 수 없습니다!");
//  return false;
//}
//document.onselectstart = function (e) {
//  return false;
//}


/* top */
function topMove(){
	 document.documentElement.scrollTop = 0 +"px";
}

// 폼값과 에디트의 값을 초기화
function formReset(formName) {
  if(confirm('게시글을 새로 작성하시겠습니까?')) {
    eval("document."+formName).reset();
    myeditor.resetEditArea('');
  }
}

// scroll 
window.onresize = function() {
	if (!window.opener)
	{
		if (eval(document.body.clientWidth) < 1000) {
			document.body.style.overflow = 'auto';
			}
		else {
			document.body.style.overflow = 'auto';
			}
	}
}

window.onload = function() {
	if (!window.opener)
	{
		if (eval(document.body.clientWidth) < 1000) {
			document.body.style.overflow = 'auto';
			}
		else {
			document.body.style.overflow = 'auto';
			}
	}
}

