//=================================================================================================================================
// 롤오버 스크립트
//=================================================================================================================================
function overColor(td){
	if(document.getElementById||(document.all && !(document.getElementById))){
		td.style.backgroundColor="#f7f7f7";
//		td.style.cursor="hand";
	}
}

function outColor(td){
	if(document.getElementById||(document.all && !(document.getElementById))){
		td.style.backgroundColor="#ffffff";//마우스가 내려왔을때의 색상 설정
//		td.style.cursor="hand";
	}
}

function download(fname, str_root){
	location.href="../common/fdownload.jsp?strDownPath="+fname+"&str_root="+str_root;
}


//폼입력시 비워있는지 여부 체크
function ChkEmpty(checkText, alertStr){
	if (checkText.value == "")
	{
		alert(alertStr);
		checkText.focus();
		return (false);
	}
}



//이미지 resize
//사용법 : <img src="111.jpg" onload="Rsize(this, 667, 10000, 1)"> 
function imgRsize(img, rW, rH){
var iW = img.width;
var iH = img.height;
var g = new Array;
if(iW < rW && iH < rH) { // 가로세로가 축소할 값보다 작을 경우
g[0] = iW; 
g[1] = iH; 
} else {
if(img.width > img.height) { // 원크기 가로가 세로보다 크면
g[0] = rW;
g[1] = Math.ceil(img.height * rW / img.width);
} else if(img.width < img.height) { //원크기의 세로가 가로보다 크면
g[0] = Math.ceil(img.width * rH / img.height);
g[1] = rH;
} else {
g[0] = rW;
g[1] = rH;
}
if(g[0] > rW) { // 구해진 가로값이 축소 가로보다 크면
g[0] = rW;
g[1] = Math.ceil(img.height * rW / img.width);
}
if(g[1] > rH) { // 구해진 세로값이 축소 세로값가로보다 크면
g[0] = Math.ceil(img.width * rH / img.height);
g[1] = rH;
}
}
g[2] = img.width; // 원사이즈 가로
g[3] = img.height; // 원사이즈 세로
return g;
}

function Rsize(img, ww, hh, aL){
var tt = imgRsize(img, ww, hh);
        if(img.width > ww || img.height > hh){ // 가로나 세로크기가 제한크기보다 크면
            img.width = tt[0]; // 크기조정
            img.height = tt[1];
		}
		img.alt = '클릭하시면 원본이미지를 보실수있습니다.';
		if(aL){ // 자동링크 on
				img.onclick = function(){
				   /*
					wT = Math.ceil((screen.width - tt[2])/2.6); // 클라이언트 중앙에 이미지위치.
					wL = Math.ceil((screen.height - tt[3])/2.6);
					mm = window.open("", 'viewOrig', 'width='+tt[2]+',height='+tt[3]+',top='+wT+',left='+wL);
					var doc = mm.document;
					doc.body.style.margin = 0; // 마진제거
					doc.body.style.cursor = "hand";
					var previewimg = doc.createElement("img");
					previewimg.src = img.src;
					doc.body.appendChild(previewimg);
					doc.body.onmousedown = function(){ mm.close();}
					doc.title = 'NUX';
*/
					var img_view = img; 
					var x = x + 20 ; 
					var y = y + 30 ; 
					htmlz = "<html><head><title>이미지원본보기</title><style>body{margin:0;cursor:hand;}</style></head><body scroll=auto onload='width1=document.all.Timage.width;if(width1>1024)width1=1024;height1=document.all.Timage.height;if(height1>768)height1=768;top.window.resizeTo(width1+30,height1+54);' onclick='top.window.close();'><img src='"+img_view.src+"'  title='클릭하시면 닫힙니다.' name='Timage' id='Timage'></body></html>" 
					imagez = window.open('', "image", "width="+ 100 +", height="+ 100 +", top=0,left=0,scrollbars=auto,resizable=1,toolbar=0,menubar=0,location=0,directories=0,status=1"); 
					imagez.document.open(); 
					imagez.document.write(htmlz) 
					imagez.document.close(); 
				}
				img.style.cursor = "hand";
		}
        
}



//******* 빌더 link 처리 ***************
//01. 기본개설정보
function goStep1(){
	form1.action = "m02_02_step01_view.jsp";
	form1.submit();
}
//02. 메뉴관리
function goStep2(){
	form1.action = "m02_02_step02_make.jsp";
	form1.submit();
}
//03. 디자인 관리
function goStep3(){
	form1.action = "m02_02_step03_list.jsp";
	form1.submit();
}
//04. 회원관리
function goStep4(){	
	url	 = "pop_hompyuserlevel.jsp?hp_id="+form1.hp_id.value;
	strop = "width=600,height=650,scrollbars=1,toolbar=0,resizable=0";
	w=open(url, "SEARCHMEMBER", strop);
	//w.moveTo(0,0);
	w.focus();
}
//05. 컨텐츠 관리
function goStep5(){
	form1.action = "m02_02_step05_list.jsp";
	form1.submit();
}
//06. 댓글관리
function goStep6(){
	form1.action = "m02_02_step06_list.jsp";
	form1.submit();
}
//07. 팝업관리
function goStep7(){	
	form1.action = "m02_02_step03_modify_popup.jsp";
	form1.submit();
}


