﻿function makeTopMenu()
{
// AddItem(id, text, hint, location);
// AddSubItem(idParent, text, hint, location);

	//var rootUrl = "file:///C:/kwk_d/web/menuMoving/submenuWithJavaScript1";
	var rootUrl = "http://"+document.domain+"/bbs";

	var menuColor = "#000000";	
	//var menuColor = "#000080";	
	var submenuColor = "#ddeeff";
	//var submenuColor = "#ddddff";
	var  submenuHlColor = "#ffffff";
	
	menu = new Menu(menuColor, submenuColor, submenuHlColor);
	
	menu.rootUrl = rootUrl;
	
//	menu.addItem("home", "Home", null, "home.htm");
	menu.addItem("product", "제품정보", null, "document/product/sanalyst.htm");
	menu.addItem("sales", "구입정보", null, "document/sales/price.htm");
	menu.addItem("support", "고객지원", null,  "myBoard.php?id=dataroom");	
//	menu.addItem("law", "관련법규", null,  "document/law/solarAccess.htm");
	menu.addItem("board", "게시판", null,  "myBoard.php?id=notice");
//	menu.addItem("contact", "Contact Us", null,  "contactUs.htm");
//	menu.addItem("manage", "통계", null,  "myNalog.php");
	
	
//	menu.addSubItem("home", "Home", null, "home.htm");
	
	menu.addSubItem("product", "Sanalyst 소개", null, "document/product/sanalyst.htm");
	menu.addSubItem("product", "SanalystBase", null, "document/product/sanalystBase.htm");
	menu.addSubItem("product", "SanalystView", null, "document/product/sanalystView.htm");
	menu.addSubItem("product", "SanalystGrade", null, "document/product/sanalystGrade.htm");
	menu.addSubItem("product", "시스템 요구사양", null, "document/product/require.htm");
			
	
	menu.addSubItem("sales", "가격정보", null,  "document/sales/price.htm");
//	menu.addSubItem("sales", "라이센스 정책", null,  "document/sales/price.htm");
	menu.addSubItem("sales", "구입문의", null,  "myBoard.php?id=buyndemo");
//	menu.addSubItem("sales", "판매대리점", null,  "document/product/dealer.htm");
	menu.addSubItem("sales", "고객사", null,  "document/sales/user.htm");


	menu.addSubItem("support", "자료실", null,  "myBoard.php?id=dataroom");	
	menu.addSubItem("support", "다운로드", null,  "myBoard.php?id=download");	
	menu.addSubItem("support", "묻고 답하기", null,  "myBoard.php?id=qna");	
	menu.addSubItem("support", "위도/경도 찾기", null, "latLng.php");	

//	menu.addSubItem("law", "일조권", null,  "document/law/solarAccess.htm");

 	menu.addSubItem("board", "공지사항", null,  "myBoard.php?id=notice");	
 	menu.addSubItem("board", "건축환경 자료실", null,  "myBoard.php?id=law");	
  	menu.addSubItem("board", "자유게시판", null,  "myBoard.php?id=freeboard");	
// 	menu.addSubItem("board", "공지사항", null,  "document/board/notice.htm");	
//  	menu.addSubItem("board", "자유게시판", null,  "document/board/freeboard.htm");	
	
//	menu.addSubItem("contact", "Contact Us", null,  "contactUs.htm");
 
//	menu.addSubItem("manage", "통계", null,  "myNalog.php");

	menu.showMenu();
}


function makeSideMenu()
{
	var menu = new SideMenu();
}

// resize tables as window resizes 
	function ResizeMainTable()
	{
		var mt = eval("menuTable");
//		var st = eval("splitTable");
		var t = eval("mainTable");
//		var div0 = eval("scrollDiv0");
		var div = eval("scrollDiv");
		var rt = eval("rightTable");

		margin = 15; // 브라우저의 스크롤바가 사라지지 않는 경우 이값을 증가시키면 해결	
		h = document.body.clientHeight - document.body.topMargin - (/*eval(st.height) + */eval(mt.height) + eval(rt.height) + margin);

//		var scrollTop0 = eval(div0.scrollTop);
		var scrollTop = eval(div.scrollTop);
		
		if(h < 20) return;
			
		t.height = h - 10;
		
				
//		div0.scrollTop = scrollTop0;
		div.scrollTop = scrollTop;

 	}
	function InitWindow()
	{
		ResizeMainTable();
		//window.resizeTo(1024, 768);
 	}
 	

 	function SubmenuClicked(obj)
 	{
 	}
 	function SubmenuOver(obj)
 	{
 		obj.bgColor="#ffffff";
 		window.status = this;
 	}

 	function SubmenuOut(obj)
 	{
 		obj.bgColor="";
 		window.status = this;
 	}

var boardFrame;
function resizeFrame(iframe)
{
	boardFrame = iframe;
	
	var innerBody = iframe.contentWindow.document.body;
	var innerHeight = innerBody.scrollHeight + (innerBody.offsetHeight - innerBody.clientHeight);
	iframe.style.height = innerHeight;
	
	this.scrollTo(1,1);
//	var div0 = eval("scrollDiv0");
//	div0.scrollTop = 0;
	var div = eval("scrollDiv");
	div.scrollTop = 0;
}

var bodyTrue;
var iframe;

// print 전/후 처리 handler
function beforePrint()
{
	bodyTrue = document.body.innerHTML;
   	document.body.innerHTML = eval("scrollDiv").innerHTML;
} 

function afterPrint()
{  
	document.body.innerHTML = bodyTrue;                   
} 
//window.onbeforeprint = beforePrint;    
//window.onafterprint = afterPrint;
function iframeAfterPrint()
{
		iframe.go(1);
}

function printContents()
{
	if(eval("iframe") == "[object]")
	{
//		iframe.onafterprint = iframeAfterPrint;

		iframe.focus();
		iframe.print();
		iframe.go(1);
	}
	else	
	{
		bodyTrue = document.body.innerHTML;
	   	document.body.innerHTML = eval("scrollDiv").innerHTML;
		window.print();
		document.body.innerHTML = bodyTrue;                   
	}

}
