var sait_domain = "http://file.hoamprize.org";

//##### »ó´Ü³×ºñ
function Mnav(hn,sn,log){
var FlaUrl="/eng/fla/mnav.swf?hn="+hn+"&upass="+sn+"&log="+log;
document.write("<div>");
Flash('MainFla',FlaUrl,'100%','151','#FFFFFF','transparent');
document.write("</div>");
}

//##### »ó´Ü³×ºñ È£¾Ï
function Mnav2(hn,sn,log){
var FlaUrl="/eng/fla/mnav2.swf?hn="+hn+"&upass="+sn+"&log="+log;
document.write("<div>");
Flash('MainFla',FlaUrl,'100%','151','#FFFFFF','transparent');
document.write("</div>");
}

//##### ÁÂÃø³×ºñ
function Snav(h,hn,sn,cn){
var FlaUrl="/eng/fla/snav"+hn+".swf?hn="+hn+"&sn="+sn+"&cn="+cn;
document.write("<div class='ml20 mb50'>");
Flash('SnavFla?',FlaUrl,'213',+h,'#FFFFFF','none');
document.write("</div>");
}

//##### ÁÂÃø³×ºñ È£¾Ï
function Snav4(hn,sn,cn){
var FlaUrl="/eng/fla/snav"+hn+".swf?hn="+hn+"&sn="+sn+"&cn="+cn;
document.write("<div class='ml20 left' style='hright:100%'>");
Flash('SnavFla?',FlaUrl,'213','789','#FFFFFF','none');
document.write("</div>");
}

//##### Ç²ÅÍ
function Footer(cn,sn,log){
document.write("\
<div class='mt10'>\
	<div class='r'><img src='/eng/img/common/copy.gif' class='mt5'></div>\
	<div class='l ml10'>");
	Flash('FamilySite','/eng/fla/navi_f.swf?log='+log,'245','32','#FFFFFF','transparent');
document.write("</div>");
}

//##### Ç²ÅÍ
function mFooter(cn,sn,log){
document.write("\
<div>\
	<div class='l'>");
	Flash('FamilySite','/eng/fla/navi_f.swf?log='+log,'245','32','#FFFFFF','transparent');
document.write("</div><div class='l ml30'><img src='/eng/img/common/copy.gif' class='mt5'></div></div>");
}

function sam0()
{
	SLink("http://www.samsungfoundation.org/html/eng/index.asp","_blank")	//½Ç¼­¹ö¿ë
}

function hoam0()
{
	SLink("http://www.samsungfoundation.org/html/eng/foundation/hoam_foundation.asp","_blank")	//½Ç¼­¹ö¿ë
}

//##### Å¸ÀÌÆ²
document.title="È£¾ÏÀç´Ü";

//##### ºñÁÖ¾ó½ºÅ©¸³Æ®

document.write("<form method=post name=bLaNk style='margin:0;display:none'></form>");

function Top(cn){
document.write("<div style='display:none'>");
Flash('TopFla','/eng/fla/navi_t.swf?IS_MEMBER='+cn,'363','53','#FFFFFF','none');
document.write("</div>");
}



//##### XML¸µÅ©
	var xmlDoc , lineMapStr = "", currentPath="", index = 0;
	var moz = (typeof document.implementation != 'undefined') && (typeof document.implementation.createDocument != 'undefined'); 
	var ie = (typeof window.ActiveXObject != 'undefined'); 

	importXML("/eng/js/menu.xml");
	function importXML(file) { 
		if (moz) { 
			xmlDoc = document.implementation.createDocument("", "", null);
			xmlDoc.async = false;
		} else if (ie) { 
			xmlDoc = new ActiveXObject("Microsoft.XMLDOM"); 
			xmlDoc.async = false;
		}
		xmlDoc.load(file);
	}

	function getLineMapNode(id){
		var menuXpath , node;
		menuXpath = "//menu[@id='" + id + "']";				
		if (moz) { 					
			node = xmlDoc.evaluate(menuXpath, xmlDoc, null, 9,null).singleNodeValue;
		} else if (ie) { 			
			node = xmlDoc.selectSingleNode(menuXpath);	
		}		
		return node;
	}

	function setString(node){
		var spStr = "" , last="";
		var name = node.getAttribute("name");
		var url  = node.getAttribute("url");
		var nodeId  = node.getAttribute("id");

		if(index++ != 0) spStr = "&nbsp;>&nbsp;";
		if(node != xmlDoc.documentElement) 	setString(node.parentNode);
//		lineMapStr += name + spStr;
		if(currentPath != nodeId)
			lineMapStr += "<a href='"+url+"'>"+ name+"</a>" + spStr;
		else
			lineMapStr += "<font style='color:#4D4D4D'>"+ name+"</font>" + spStr;
	}

function path(id){
	try{
		var node = getLineMapNode(id);
		lineMapStr = "";
		index = 0;
		currentPath=id;
		setString(node);
		document.write(lineMapStr);
	}catch(e){
		if(node == null){
			document.write("¾ÆÀÌµð°¡ Á¸Àç ÇÏÁö ¾Ê½À´Ï´Ù : " + id);
		}else{
			document.write("¿¹¿ÜÃ³¸® ¹ß»ý : " +  e);
		}
	}
}

function name(id){
	var node = getLineMapNode(id);
	var name  = node.getAttribute("name");
	document.write(name);
}

//SLink
function SLink(url,target)
{
	//alert(url);
	
	//alert(SecuiSS.getKEYIV());
	
	var f=document.bLaNk;
	if(!target) target="_self";
	f.innerHTML="";

	pos=url.indexOf("?");
	if(pos!=-1)
	{
		action_url=url.substring(0,pos);
		value=url.substring(pos+1,url.length);

		arr = value.split("&");
	
		for(i=0;i<arr.length;i++)
		{
			tmp = arr[i].split("=");
			f.innerHTML+="<input type=hidden name='"+tmp[0]+"' value='"+tmp[1]+"'>";
		}
		f.innerHTML+="<input type=hidden name='__default' value=''>";	
	}
	else
	{
		action_url=url;
	}
/*
	if(SecuiSS.getKEYIV().length > 0)
	{ 
			//alert("Å°ÀÖ´Ù");
		TargetSecuiSubmit(f, action_url, '2', target);
	}
	else
	{
		//alert("Å° ¾ø´Ù");
		TargetSecuiSubmit(f, action_url, '1', target);
	}
*/
		TargetSecuiSubmit(f, action_url, '1', target);
}

function link(){
	var id = "";
	var depth = arguments.length;
	try {
		if(depth==0) return;
		else if(depth==1) id = eval("'"+arguments[0]+"'");
		else if(depth==2) id = eval("'"+arguments[0]+arguments[1]+"'");
		else if(depth==3) id = eval("'"+arguments[0]+arguments[1]+arguments[2]+"'");
		else if(depth==4) id = eval("'"+arguments[0]+arguments[1]+arguments[2]+arguments[3]+"'");

		if(id=="") { alert("ÁØºñÁßÀÔ´Ï´Ù."); }
			
		else { 
		var node = getLineMapNode(id);
		var url  = node.getAttribute("url");
		//location.href=url;		
		SLink( url );
		}

	}catch(e) { 
	alert("»çÀÌÆ® Á¢¼ÓÀÌ ¿øÈ°Ä¡ ¾Ê¾Æ ÁË¼ÛÇÕ´Ï´Ù. \n¸ÞÀÎÆäÀÌÁö·Î ÀÌµ¿ÇÕ´Ï´Ù.");
	location.href="http://hoamprize.samsungfoundation.org";
	 }
}


//#####

/*ActiveX ÇÃ·¡½¬*/
// id: flash id
// url: source url
// w: source width
// h: source height
// t: wmode (none/transparent/opaque)
function Flash(id,url,w,h,bg,t){
document.write("\
<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0' width="+w+" height="+h+" id="+id+">\
<param name='movie' value="+url+" />\
<param name='wmode' value="+t+" />\
<param name='bgcolor' value="+bg+" />\
<param name='allowScriptAccess' value='sameDomain' />\
<param name='quality' value='high' />\
<param name='menu' value='false' />\
<embed src="+url+" wmode="+t+" width="+w+" height="+h+" name="+id+" bgcolor="+bg+" allowScriptAccess='sameDomain' quality='high' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' />\
</object>\
");
}

function ScrollTop(){
	parent.window.scroll(0,0);
}

//»ó´ÜÇÃ·¡½Ã°Ë»ö
function searchAll(keyword){
	SLink("/html/common/search.asp?keyword="+keyword);
}

function download(d_file){
	var nUrl = "/common/pop_filedown1.asp?file1="+d_file;
	newWin = window.open(nUrl,'filedownload','width=310,height=240');
}

function download1(d_file){
	var nUrl = "http://www.samsungfoundation.org/common/pop_filedown.asp?flag=notice&file1="+d_file;
	newWin = window.open(nUrl,'filedownload','width=213,height=200');
}

//¾àµµº¸±âÆË¾÷
function _contact(Tid){
	eval("pop('/html/common/pop_contact.asp?Tid="+Tid+" ','map',600,660) ");
}

function pop(url,name,w,h){ window.open(url,name,'width='+w+',height='+h+',scrollbars=no') } //Popup(½ºÅ©·Ñ¹Ù¾øÀ½)
function pops(url,name,w,h){ window.open(url,name,'width='+w+',height='+h+',scrollbars=yes') } //Popup(½ºÅ©·Ñ¹ÙÀÖÀ½)
function newwin(url){ window.open(url,'new','location=1,directories=1,resizable=1,status=1,toolbar=1,menubar=1,scrollbars=1') } //NewPopup(½ºÅ©·Ñ¹Ù¾øÀ½)

function attach(){ window.open('/html/pop/attach.html','pop1','width=359,height=154,scrollbars=no') } //ÆÄÀÏÃ·ºÎ
function pop_confirm(){ window.open('/html/award/pop_confirm.asp','pop2','width=585,height=475,scrollbars=no') } //¼ö»óÀÚ ÀÎÁõ¿äÃ»

function pop_footer1(){window.open('/html/pop/pop_protect.asp','°³ÀÎÁ¤º¸º¸È£Á¤Ã¥','width=650,height=500,scrollbars=yes') } //Ç²ÅÍ°³ÀÎÁ¤º¸º¸È£Á¤Ã¥
function pop_footer2(){window.open('/html/pop/pop_mailblock.asp','ÀÌ¸ÞÀÏ¹«´Ü¼öÁý°ÅºÎ','width=370,height=235','scrollbars=no') } //ÀÌ¸ÞÀÏ¹«´Ü¼öÁý°ÅºÎ

function library01() {  //È£¾ÏÀÚÀü ´Ù¿î·Îµå
	var d_file = "È£¾ÏÀÚÀü.pdf";
	d_file = sait_domain+"/hoamprize_upload/library/"+d_file;
	newwin(d_file);
}
function library02() {	//È£¾Ï¾î·Ï ´Ù¿î·Îµå
	var d_file = "È£¾Ï¾î·Ï.pdf";
	d_file = sait_domain+"/hoamprize_upload/library/"+d_file;
	newwin(d_file);
}
function library03() {	//»î°ú »ç»ó ´Ù¿î·Îµå
	var d_file = "È£¾ÏÀÇ »î°ú »ç»ó.pdf";
	d_file = sait_domain+"/hoamprize_upload/library/"+d_file;
	newwin(d_file);
}
function library04() {	//°æ¿µ»çÇÐ Á¦ 04Áý ´Ù¿î·Îµå
	var d_file = "°æ¿µ»çÇÐ(Á¦04Áý).pdf";
	d_file = sait_domain+"/hoamprize_upload/library/"+d_file;
	newwin(d_file);
}
function library05() {	//°æ¿µÃ¶ÇÐ ´Ù¿î·Îµå
	var d_file = "È£¾ÏÀÇ °æ¿µÃ¶ÇÐ.pdf";
	d_file = sait_domain+"/hoamprize_upload/library/"+d_file;
	newwin(d_file);
}
function library06() {	//Ã¢Á¶¼ºÀÇ¹®È­ ´Ù¿î·Îµå
	var d_file = "Ã¢Á¶¼ºÀÇ ¹®È­.pdf";
	d_file = sait_domain+"/hoamprize_upload/library/"+d_file;
	newwin(d_file);
}
function library07() {	//°æ¿µ»çÇÐ Á¦ 15Áý ´Ù¿î·Îµå
	var d_file = "°æ¿µ»çÇÐ(Á¦15Áý).pdf";
	d_file = sait_domain+"/hoamprize_upload/library/"+d_file;
	newwin(d_file);
}
function library08() {	//È£¾Ï»ó10³â ´Ù¿î·Îµå
	var d_file = "È£¾Ï»ó10³â.pdf";
	d_file = sait_domain+"/hoamprize_upload/library/"+d_file;
	newwin(d_file);
}


function Img(n,tog){eval("document.m"+n+".src=m"+n+"_"+tog+".src"); } ///*ÀÌ¹ÌÁö ·Ñ¿À¹ö*/

function autoBlur(){
	try{
		if(event.srcElement.tagName=="A"||event.srcElement.tagName=="IMG") document.body.focus(); 
	}catch(e) {}
}
document.onfocusin=autoBlur;

/* ±Û º¸±â */
var old=''; 
function opinion(name) 
{ 
	submenu=eval("opinion_"+name+".style"); 
	if(old!=submenu) 
	{ 
		if(old!='') 
		{ 
			old.display='none'; 
		} 
		submenu.display='block'; 
		old=submenu;
	} 
	else 
	{ 
		submenu.display='none'; 
		old=''; 
	} 
}

function roundTable(objID) { ///*¶ó¿îµåÅ×ÀÌºí*/
	var obj = document.getElementById(objID);
	var Parent, objTmp, Table, TBody, TR, TD;
	var bdcolor, bgcolor, Space;
	var trIDX, tdIDX, MAX;
	var styleWidth, styleHeight;

	// get parent node
	Parent = obj.parentNode;
	objTmp = document.createElement('SPAN');
	Parent.insertBefore(objTmp, obj);
	Parent.removeChild(obj);

	// get attribute
	bdcolor = obj.getAttribute('rborder');
	bgcolor = obj.getAttribute('rbgcolor');
	radius = parseInt(obj.getAttribute('radius'));
	if (radius == null || radius < 1) radius = 1;
	else if (radius > 6) radius = 6;

	MAX = radius * 2 + 1;

	/*
	create table {{
	*/
	Table = document.createElement('TABLE');
	TBody = document.createElement('TBODY');

	Table.cellSpacing = 0;
	Table.cellPadding = 0;

	for (trIDX=0; trIDX < MAX; trIDX++) {
		TR = document.createElement('TR');
		Space = Math.abs(trIDX - parseInt(radius));
		for (tdIDX=0; tdIDX < MAX; tdIDX++) {
			TD = document.createElement('TD');

			styleWidth = '1px'; styleHeight = '1px';
			if (tdIDX == 0 || tdIDX == MAX - 1) styleHeight = null;
			else if (trIDX == 0 || trIDX == MAX - 1) styleWidth = null;
			else if (radius > 2) {
				if (Math.abs(tdIDX - radius) == 1) styleWidth = '2px';
				if (Math.abs(trIDX - radius) == 1) styleHeight = '2px';
			}

			if (styleWidth != null) TD.style.width = styleWidth;
			if (styleHeight != null) TD.style.height = styleHeight;

			if (Space == tdIDX || Space == MAX - tdIDX - 1) TD.style.backgroundColor = bdcolor;
			else if (tdIDX > Space && Space < MAX - tdIDX - 1)  TD.style.backgroundColor = bgcolor;

			if (Space == 0 && tdIDX == radius) TD.appendChild(obj);
			TR.appendChild(TD);
		}
		TBody.appendChild(TR);
	}

	/*
	}}
	*/

	Table.appendChild(TBody);

	// insert table and remove original table
	Parent.insertBefore(Table, objTmp);
}

//

//Æ¯Á¤¿µ¿ª ÀÎ¼âÇÏ±â
function printDiv () {
	if (document.all && window.print) {
		window.onbeforeprint = beforeDivs;
		window.onafterprint = afterDivs;
		document.body.style.backgroundImage='url()';
		window.print();
	}
}
function beforeDivs () {
	if (document.all) {
		Body.style.display = 'none';
		objSelection.innerHTML = document.all['print_contents'].innerHTML; // ÀÌ°÷¿¡¼­ ID¸¦ ÁöÁ¤
	}
}
function afterDivs () {
	if (document.all) {
		Body.style.display = 'block';
		objSelection.innerHTML = "";
	}
}


function _gotoPage(objForm,p,filename){
	//objForm.target = "main";
	//objForm.action = filename
	objForm.page.value=p;
	//objForm.submit();
	TargetSecuiSubmit(objForm , filename , '2', '_self');
}

function _gotoPage2(objForm,p,filename){
	//objForm.target = "_self";
	//objForm.action = filename
	objForm.page.value=p;
	//objForm.submit();
	//alert("test");
	TargetSecuiSubmit(objForm , filename , '2', '_self');
}
function _gotoPage3(objForm,p,filename){
	objForm.target = "_self";
	objForm.action = filename
	objForm.page.value=p;
	objForm.submit();
}
//¾ÆÀÌÇÁ·¹ÀÓ
function iframe_resize(){
	var objBody	    =	ifrm.document.body;
	var objFrame	=	document.getElementById("ifrm");
		
	objFrame.style.height = objBody.scrollHeight + (objBody.offsetHeight - objBody.clientHeight);
	if (window.navigator.appName == "Microsoft Internet Explorer")
		objFrame.style.width = '643';
	else
		objFrame.style.width = '674';
/*
	var objBody	    =	document.all["ifrm"].document.body;
	var objFrame	=	document.all["ifrm"];
	objFrame.style.height = objBody.scrollHeight + (objBody.offsetHeight - objBody.clientHeight);
	objBody.body.style.height = objBody.scrollHeight
	objFrame.style.width = '502'
	document.all.ifrm.style.height= 1600;
	window.scrollTo(0,0);
	tHeight=document.all.ifrm.document.body.style.height;
*/
}

//¾ÆÀÌÇÁ·¹ÀÓ ÀÌº´Ã¶
function iframe_resize2(){
	var objBody	    =	ifrm2.document.body;
	var objFrame	=	document.all["ifrm2"];
	objFrame.style.height = objBody.scrollHeight + (objBody.offsetHeight - objBody.clientHeight)
	if (window.navigator.appName == "Microsoft Internet Explorer")
		objFrame.style.width = '514'
	else
		objFrame.style.width = '532'
}

var ifrContentsTimer; 
function resizeRetry() {
	var objFrame	=	parent.document.getElementById("ifrm");
	if (window.navigator.appName == "Microsoft Internet Explorer")
	{
		if(document.documentElement.readyState == "complete") { 
			clearInterval(ifrContentsTimer); 
		}else { 
			resizeFrame(); 
		} 
	}else{
		objFrame.style.height = "500";
		objFrame.scrolling = true;
		clearInterval(ifrContentsTimer); 
	}
} 
function resizeFrame(){
	self.resizeTo(document.body.scrollWidth + (document.body.offsetWidth-document.body.clientWidth), parseInt(document.body.scrollHeight)+10); 
}

function setSelectBox(selName){
	sel = eval("document.all."+selName);

	borderColor = sel.bordercolor;
	selWidth = parseInt(sel.width);
	bgColor = sel.bgcolor;
	rectLeft = selWidth-2;
	spanWidth = selWidth;

	//span tag
	header  = "<span style='position:relative;margin-right:0px;";
	header += "width:"+spanWidth+";height:18px;border:1px solid "+borderColor+";background-color:"+bgColor+";'>\n";
	header += "<span style='position: absolute;left:0px;top:-2px;";
	header += "width:"+selWidth+";height:17px;clip:rect(2,"+rectLeft+",18,2);'>\n";
	footer = "</span></span>";

	sel.style.backgroundColor = bgColor;
	sel.style.width = selWidth;

	sel.outerHTML = header+sel.outerHTML+footer;
}