/***************************************************************************************************
	문자열 공백제거		value.trim()
***************************************************************************************************/
String.prototype.trim = function()
{
	return this.replace(/(^\s*)|(\s*$)/gi, "");
}

/***************************************************************************************************
	문자열 전체치환		value.repAll("a", "b")
****************************************************************************************************/
String.prototype.replaceAll = function(str1, str2)
{
	var temp_str = "";

	if (this.trim() != "" && str1 != str2)
	{
		temp_str = this.trim();
		while (temp_str.indexOf(str1) > -1)
		{
			temp_str = temp_str.replace(str1, str2);
		}
	}
	return temp_str;
}


/***************************************************************************************************

	폼전송시 폼 내용 유효성 체크 (사용자정의 함수 사용가능)

	사용법 : 1. form 태그 onSubmit 속성으로 return fVal(this) 호출)

	         2. 각 form 요소에 alt 속성으로 아래내용을 입력

			    ex> alt="Z||||값을 입력하세요." 또는 alt="F||fName||첨부파일을 입력하세요."

				Z			: 필수입력
				C||함수명|| : 사용자 정의 함수 호출 (this, this.value) 를 매개변수로 전달함
				R||패턴||	: 정규식 사용 유효성 체크
					아래패턴입력, 걸릴경우 true 가 반환됨
					\D : (숫자만 입력) 숫자가 아닌것이 하나라도 있을경우 
					\W : (영문, 숫자, _ 만 입력) 특수문자가 들어갔을경우
					\s : 공백 허용 안함

				CHK : checkbox OR radio , 체크된것이 있는지 체크
				F||jpg||	: 첨부파일 확장자 체크, 필수입력 ( 여러개 입력가능 F||jpg,gif,bmp|| )
				FN||jpg||	: 첨부파일 확장자 체크, 필수입력 아님


				|| 을 구분자로 
					첫번째값이 체크구분
					두번째값이 사용자정의함수, 정규식패턴, 첨부확장자
					세번째값이 false 리턴시 alert 메시지 (첨부파일 확장자의경우 자동으로 출력됨)
		 
****************************************************************************************************/
function fVal(f)
{
	var eObj;	// element 객체
	var args;	// alt 속성 매개변수를 || 기준으로 자른 배열값 (3개)
	var result;	// 유효성 체크 결과 [ true / false ]
	var ext;	// 첨부파일 확자앚
	var tmp, tmp2, tmp3;	// 임시값 적용을 위한 변수, 사용후 항상 초기화 할것. tmp='';
	var i;

	for (i=0; i<f.elements.length ;i++ )
	{
		eObj = f.elements[i];
		eVal = eObj.value;

		if (eObj.tagName == "1TEXTAREA")
		{
			alert("type : " + eObj.type + "\n\n name : " + eObj.name + "\n\n typeof : " + typeof(eObj) + "\n\n value : " + eObj.value + "\n\n innerHTML : " + eObj.innerHTML + "\n\n alt : " + eObj.alt);				
			return false;
		}

		// 폼 요소가 보이지 않거나(display) 비활성화인 경우 체크안함
		if (eObj.disabled || eObj.style.display == "none")	continue;
		// 폼 요소의 alt 값이 정의되지 않았을경우 체크안함
		if (typeof(eObj.alt) == "undefined")	continue;

		args = eObj.alt.split("||", 3);

		if (args[0] == "Z")						// 값 입력여부 체크(공백제거)
		{
			result = eVal.trim();
		}
		else if (args[0] == "C" && args[1])		// 사용자 정의 함수 호출
		{	
			result = eval(args[1] + "(eObj, eVal);");
		}
		else if (args[0] == "R")				// 정규식 패턴 체크
		{
			if (!eVal.trim())
			{
				result = false;
			}
			else
			{
				re = new RegExp(args[1] , "g");
				result = !re.test(eVal);
				if (!result)
				{
					alert("조건에 맞게 " + args[2]);
					eObj.value = "";
					eObj.focus();
					return false;
				}
			}
		}
		else if (args[0] == "CHK")				// 체크박스, 라디오버튼 체크된것 있는지 체크
		{
			result = false;
			
			if (f.elements(eObj.name).length)
			{
				for (j=0; j<f.elements(eObj.name).length ;j++ )
				{
					if (f.elements(eObj.name)[j].checked)
					{
						result = true;
						break;
					}
				}
			}
			else
			{
				if (eObj.checked)
				{
					result = true;
					break;
				}
			}
		
		}
		else if (args[0].substring(0, 1) == "F")	// 첨부파일 확장자 체크, 입력여부 체크
		{

			result = true;

			// 파일이 선택되지 않았을경우
			if (!eVal.trim() && args[0].substring(1,2) != "N")
			{
				result = false;
			}
			
			if (args[1] && eVal.trim() && result != false)
			{
				if (eVal.lastIndexOf('.') != -1)
				{
					ext = eVal.substring(eVal.lastIndexOf('.') + 1, eVal.length);
				}

				tmp = args[1].split(",");

				result = false;
				for (j in tmp)
				{
					if (tmp[j].toLowerCase() == ext.toLowerCase())
					{
						result = true;
						break;
					}
				}
				if (result == false)
				{
					args[2] = args[1] + " 파일만 첨부하세요."
					if (eObj.title)
					{
						args[2] = eObj.title + "는 " + args[2];
					}
					eObj.focus();
				}
			}
		}
		else if (args[0] == "E")		//이메일 유효성 체크
		{
			var exclude=/[^@\-\.\w]|^[_@\.\-]|[\._\-]{2}|[@\.]{2}|(@)[^@]*\1/; 
			var check=/@[\w\-]+\./; 
			var checkend=/\.[a-zA-Z]{2,3}$/; 
			
			if (eObj.value=="")
			{
				alert("请输入 邮件。");
				eObj.focus();
				return false;
			}
			else
			{
				if(((eObj.value.search(exclude) != -1)||(eObj.value.search(check)) == -1)||(eObj.value.search(checkend) == -1))
				{ 
					alert("请输入正确的邮件地址。"); 
					eObj.value="";
					eObj.focus();
					return false;
				} 
				else
				{
					result = true;
				}
			}
		}
		else
		{
			continue;
		}

		if (!result || result == "")
		{
			if (args[2])
			{
				try
				{
					eObj.focus();
				}
				catch (e)	// 보이지않는 object 일경우 true 반환
				{
					continue;
				}
				alert(args[2]);
			}
			return false;
		}
	}
	return true;
}



/************************************************************
	DESC	입력폼 글자수 제한(byte) onPropertyChange 이벤트시 함수 호출
	INPUT
			obj : 체크할 input 객체
			maxLength : 제한 byte
			name : 현재 byte 수 표시할 영역 id
************************************************************/
	function flimitLen(obj,maxLength, name){
		var val = obj.value;
		if (val !== "")
		{
			var valLength=0;
			for(var i=0; i<val.length ; i++)
			{
				if( escape(val.charAt(i)).length > 3 )
				{
					vn_length = 2;
				}
				else if (val.charAt(i) == '<' || val.charAt(i) == '>')
				{
					vn_length = 4;
				}
				else
				{
					vn_length = 1 ;
				}
				valLength += vn_length;
			}
		}
		else
		{
			valLength = 0;
		}

		if (name)
		{
			document.getElementById(name).innerHTML = valLength;
		}

		if (valLength > maxLength)
		{

			alert(maxLength+"byte 이하로 작성하세요");

			do
			{	
				i--;

				if( escape(val.charAt(i)).length > 3 )
				{
					vn_length = 2;
				}
				else if (val.charAt(i) == '<' || val.charAt(i) == '>')
				{
					vn_length = 4;
				}
				else
				{
					vn_length = 1 ;
				}
				valLength -= vn_length;

			}
			while (valLength > maxLength);

			obj.value = val.substring(0,i);

		}
	}
/************************************************************/

//팝업 윈도우
function fPopUp(theURL,winName,features) { 
  window.open(theURL,winName,features);
}

//팝업 윈도우 Center
function fPopCenter(url, w, h, winName, option)
{
	if (!winName)
	{
		winName = Math.floor(Math.random()*100000);
	}
	if (option)
	{
		option = ", " + option;
	}
	
    var winl = (screen.availWidth - w) / 2;
	var wint = (screen.availHeight - h) / 2;
    window.open(url,winName,'width='+w+', height='+h+',top='+wint+',left=' + winl + option);	//+", scrollbars=yes"
}

// 전체 선택, 전체 선택 취소...(checkbox)
function fCheckAll(theFrm,objname,my, checked, val)
{
	var checkedsw;

	if (!checked)
	{
		if (my.tagName != "INPUT")
		{
			my.checked = !my.checked;
		}
		checkedsw = my.checked;
	}
	else
	{
		checkedsw = checked;
	}

	for( var i=0; i< theFrm.elements.length; i++)
	{
		var e = theFrm.elements[i];
		if (val)
		{
			if(e.name == objname && e.value==val)
			{
				e.checked = checkedsw;
			}
			else
			{
				e.checked = !checkedsw;
			}
		}
		else
		{
			if(e.name == objname) e.checked = checkedsw;
		}
	}
	return;
}

// 리스트 상에서 선택된 것이 있는지 없는지 체크하는 루틴
function fChkChecked(theFrm,objname)
{
	var submitNoFlag = 1;
	for(i = 0; i < theFrm.elements.length; ++i)
	{		
		if(theFrm.elements[i].name == objname)
		{
			if(theFrm.elements[i].checked == true)
			{
				submitNoFlag = 0;
				break;
			}
		}
	}
	// 선택된 대상이 없는 경우
	if(submitNoFlag == 1) {
		alert("선택된 항목이 없습니다");
		return false;
	}

	return true;
}

// 입력값 자리수 체크하여 다음 입력폼으로 넘기기
function checkLen(current, length, next) 
{
	if (current.value.length == length)
	{
		next.focus();
	}
}

/************************************************************
	DESC	숫자만 입력받고 3자리마다 , 콤마 출력
	INPUT
			obj : 체크할 input 객체
			dot : 3자리 콤마 출력 여부 (아무값이나 있으면 출력)
************************************************************/
	var fChkNum_lastVal;
	function fChkNum(obj, dot)
	{
		if (obj.value == fChkNum_lastVal || fChkNum_lastVal == "ing")
		{
			return;
		}
		fChkNum_lastVal = "ing";

		var val = obj.value.trim();
		var retval;
		if (dot)
		{
			retval = "";
			val = val.replaceAll(",", "");
			for (var i = val.length-1; i >= 0; i--)
			{ 
				retval = val.charAt(i) + retval; 
				if (i != 0 && i%3 == val.length%3)
				{
					retval = "," + retval;
				}
			} 
		}
		else
		{
			retval = val;
		}

		if (val && isNaN(val))
		{
			retval = "";
			alert("숫자만 입력하세요.");
		}
		fChkNum_lastVal = retval;
		obj.value = retval;
		obj.focus();
	}
/************************************************************/

/*
숫자 세자리 콤마 리턴
*/
function fGetNumDot(val)
{	
	val = String(val);
	var retval = "";
	val = val.replaceAll(",", "");
	if (val.length > 3)
	{
		for (var i = val.length-1; i >= 0; i--)
		{ 
			retval = val.charAt(i) + retval; 
			if (i != 0 && i%3 == val.length%3)
			{
				retval = "," + retval;
			}
		}
		return retval;
	}
	else
	{
		return val;
	}

}


function copy_clip(meintext,msg) {
	if (window.clipboardData)
	{ 
		if (meintext == "" )
		{
				alert("복사할 내용이 없습니다.\n");
				return false;
		}
		// the IE-manier
		window.clipboardData.setData("Text", meintext);

		// waarschijnlijk niet de beste manier om Moz/NS te detecteren;
		// het is mij echter onbekend vanaf welke versie dit precies werkt:
	}
	else if (window.netscape)
	{
		// dit is belangrijk maar staat nergens duidelijk vermeld:
		// you have to sign the code to enable this, or see notes below
		netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');

		// maak een interface naar het clipboard
		var clip = Components.classes['@mozilla.org/widget/clipboard;1'].createInstance(Components.interfaces.nsIClipboard);
		if (!clip) return;

		// maak een transferable
		var trans = Components.classes['@mozilla.org/widget/transferable;1'].createInstance(Components.interfaces.nsITransferable);
		if (!trans) return;

		// specificeer wat voor soort data we op willen halen; text in dit geval
		trans.addDataFlavor('text/unicode');

		// om de data uit de transferable te halen hebben we 2 nieuwe objecten nodig om het in op te slaan
		var str = new Object();
		var len = new Object();

		var str = Components.classes["@mozilla.org/supports-string;1"].createInstance(Components.interfaces.nsISupportsString);

		var copytext=meintext;

		str.data=copytext;

		trans.setTransferData("text/unicode",str,copytext.length*2);

		var clipid=Components.interfaces.nsIClipboard;

		if (!clip) return false;

		clip.setData(trans,null,clipid.kGlobalClipboard);
	}
	if (msg == "") {
		alert("클립보드로 복사하였습니다.\n");
	}
	else {
		alert(msg);
	}
	return false;
}


// 이미지 리사이즈(object, 최대width, 최대height)
function fImgResize( img, max_width, max_height)
{
	var gOBJimg1; 

	gOBJimg1= new Image(); 
	gOBJimg1.src=(img.src);
	
	if((gOBJimg1.width!=0)&&(gOBJimg1.height!=0))
	{ 
		
		var width = gOBJimg1.width;
		var height = gOBJimg1.height;

		var temp = 0; 
		if (!max_width)
		{
			max_width= 600;   // 이미지의 최대 크기     
		}
		if (!max_height)
		{
			max_height= 400;   // 이미지의 최대 크기     
		}

		if ( width > max_width ) {  // 이미지가 600보다 크다면 너비를 600으로 맞우고 비율에 맞춰 세로값을 변경한다.      
			height = height/(width / max_width);
			width = max_width;     
		}
		if ( height > max_height ) 
		{  // 이미지가 400보다 크다면 너비를 400으로 맞우고 비율에 맞춰 세로값을 변경한다.      
			width = width/(height / max_height);
			height = max_height;
		}
		img.width = width;
		img.height = height;

	}
	else
	{ 
		controller="fImgResize('"+img+"')"; 
		intervalID=setTimeout(controller,100); 
		return;
	} 
} 

/************************************************************
	이미지 원본보기 팝업
************************************************************/
	function imgPopUp(img){ 
	  img1= new Image(); 
	  img1.src=(img); 
	  imgControll(img); 
	} 

	function imgControll(img){ 
	  if((img1.width!=0)&&(img1.height!=0)){ 
		viewImage(img); 
	  } 
	  else{ 
		controller="imgControll('"+img+"')"; 
		intervalID=setTimeout(controller,20); 
	  } 
	} 

	function viewImage(img) {
		var W=img1.width;
		var H=img1.height;
		var S  = "no";

		if (screen.width < W || screen.height < H)
		{
			S = "yes";

			if(screen.width <= W)
			{
				W = screen.width - 17;
			}
			else
			{
				W = W + 17;
			}
			
			if(screen.height <= H)
			{
				H = screen.height - 40;
			}
			else
			{
				H = H + 17;
			}
		}

		var winl = (screen.width - W) / 2 - 5;
		var wint = (screen.height - H) / 2 - 10;
		
		O="width="+W+",height="+H+",top="+wint+",left="+winl + ",scrollbars=" + S;

		imgWin=window.open("","",O);
		
		imgWin.document.write("<html><meta http-equiv='Content-Type' content='text/html; charset=utf-8'><head><title>이미지 크게보기</title></head>");
		imgWin.document.write("<body topmargin=0 leftmargin=0'>");
		imgWin.document.write("<table align='center' valign='middle' height='100%' cellpadding='0' cellspacing='0'><tr><td><img src='"+img+"' onclick='self.close()' title='닫기' style='cursor:pointer'></td></tr></table>");
		imgWin.document.write("</body></html>");
		imgWin.document.close();
	}
/************************************************************
	이미지 원본보기 팝업
************************************************************/

//파일명 확장자 가져오기
function getExtend(filename) 
{
    temp_image=filename.split(".");
    size=temp_image.length;
    return temp_image[size-1];
}

/*
현재 시간 출력하기
*/
function TimeDate(id) 
{
	currentDate = new Date();				//실제 시간과 날짜 얻기

	hours = currentDate.getHours();       //시간과 날짜 부분 나누기
	minutes = currentDate.getMinutes();
	sec = currentDate.getSeconds();

	year = (currentDate.getYear());
	if (document.layers){
	year = year + 1900;
	}
	month = (currentDate.getMonth() + 1);
	day = currentDate.getDate();

	clock = 0; 

	window.document.getElementById(id).innerHTML = year + '-' + month + '-' + day + ' ' + hours + ':' + minutes + ':' +  sec;
	window.setTimeout ("TimeDate()",1000);   
}

function replace( str, pattern, replace) {  
	   var s = 0; 
	   var e = 0; 
	   var result = "";

	   while ((e = str.indexOf(pattern, s)) >= 0) { 
		   result = result + str.substring(s, e);
		   result = result + replace; 	
		   s = e + pattern.length;  
	   }  
	    result = result + str.substring(s);
	   return result;
}  

// TEXT BOX 의 값을 받아서 특정문자를 삭제한다.
// arg0 : 폼의 값, arg1 : 제거대상
// 사용법 : removeStr(document.form_name.input_name.value, '제거대상');
// form.con_fdate.value = removeStr(form.con_fdate.value, '/');

function removeStr( arg0, arg1 )
{
    if( arg0 == "" || arg1 == "" ) return "";

    var str = arg0;

    var i = 0;
    var pos_str = 0;
    var rtn_str = "";

    while( i < str.length ) {
        pos_str = str.indexOf(arg1,i);

        if( pos_str == -1 ) {
            rtn_str += str.substring(i, str.length );
            break;
        }else {
            rtn_str += str.substring(i, pos_str );
            i = pos_str+1;
        }
    }
    return rtn_str;
}

//이메일체크 
function fChkEmail(obj)
{
    var exclude=/[^@\-\.\w]|^[_@\.\-]|[\._\-]{2}|[@\.]{2}|(@)[^@]*\1/; 
    var check=/@[\w\-]+\./; 
    var checkend=/\.[a-zA-Z]{2,3}$/; 
    
    if (obj.value=="")
	{
        alert("이메일을 입력해 주세요.");
        obj.focus();
        return false;
    }
	else
    {
		if(((obj.value.search(exclude) != -1)||(obj.value.search(check)) == -1)||(obj.value.search(checkend) == -1))
		{ 
			alert("정상적인 이메일 주소를 입력해 주세요."); 
			obj.value="";
			obj.focus();
			return false;
		} 
    }
	return true;
}
// 최근 1주일이 선택되면 날짜 변경 및 전체 체크 해제
function chkLimit(frm,limit) 
{
	frm.sch_all.checked=false;
	today = new Date();

	frm.myy.value = today.getYear();
	frm.mmm.value = today.getMonth()+1;
	frm.mdd.value = today.getDate();

	if (limit == 1)
	{
		schday = new Date(today.getYear(), today.getMonth(), today.getDate()-7);
	}else if (limit == 2){
		schday = new Date(today.getYear(), today.getMonth(), today.getDate()-14);
	}else{
		schday = new Date(today.getYear(), today.getMonth()-1, today.getDate());
	}

	frm.nyy.value = schday.getYear();
	frm.nmm.value = schday.getMonth()+1;
	frm.ndd.value = schday.getDate();
}

//날짜가 선택되면 다른조건 체크 해제
function dateSch(frm)
{
	for (i=0;i<=2;i++)
	{
		frm.schlimit[i].checked = false;
	}
	frm.sch_all.checked = true;
}




/**
 * Time 스트링을 자바스크립트 Date 객체로 변환
 * parameter time: Time 형식의 String
 */
function toTimeObject(time) { //parseTime(time)
    var year  = time.substr(0,4);
    var month = time.substr(4,2) - 1; // 1월=0,12월=11
    var day   = time.substr(6,2);
    var hour  = time.substr(8,2);
    var min   = time.substr(10,2);
 
    return new Date(year,month,day,hour,min);
}

/**
 * 자바스크립트 Date 객체를 Time 스트링으로 변환
 * parameter date: JavaScript Date Object
 */
function toTimeString(date) { //formatTime(date)
    var year  = date.getFullYear();
    var month = date.getMonth() + 1; // 1월=0,12월=11이므로 1 더함
    var day   = date.getDate();
    var hour  = date.getHours();
    var min   = date.getMinutes();
 
    if (("" + month).length == 1) { month = "0" + month; }
    if (("" + day).length   == 1) { day   = "0" + day;   }
    if (("" + hour).length  == 1) { hour  = "0" + hour;  }
    if (("" + min).length   == 1) { min   = "0" + min;   }
 
    return ("" + year + month + day + hour + min)
}
 

/**
 * 주어진 Time 과 y년 m월 d일 h시 차이나는 Time을 리턴
 * ex) var time = form.time.value; //'20000101000'
 *     alert(shiftTime(time,0,0,-100,0));
 *     => 2000/01/01 00:00 으로부터 100일 전 Time
 */
function shiftTime(time,y,m,d,h) { //moveTime(time,y,m,d,h)
    var date = toTimeObject(time);
 
    date.setFullYear(date.getFullYear() + y); //y년을 더함
    date.setMonth(date.getMonth() + m);       //m월을 더함
    date.setDate(date.getDate() + d);         //d일을 더함
    date.setHours(date.getHours() + h);       //h시를 더함
 
    return toTimeString(date);
}

/**
 * 자바스크립트 Date 객체를 Time 스트링으로 변환 YYYY-MM-DD
 * parameter date: JavaScript Date Object
 */
function dateToString(date)
{


    var year  = date.getFullYear();
    var month = date.getMonth() + 1; // 1월=0,12월=11이므로 1 더함
    var day   = date.getDate();
 
    if (("" + month).length == 1) { month = "0" + month; }
    if (("" + day).length   == 1) { day   = "0" + day;   }
 
    return (year + "-" + month + "-" + day);
}



// 페이지 이동
function fGoUrl(url)
{
	location.href = url;
}


// 플래시 출력
function fFlash(url, w, h, nownum)
{
	var sHtml;

	if (url && w && h)
	{
		sHtml = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="' + w + '" height="' + h + '">';
		sHtml += '<param name="movie" value="' + url + '">';
		sHtml += '<param name="quality" value="high">';
		sHtml += '<param name="wmode" value="transparent">';
		sHtml += '<param name="FlashVars" value="nownum=' + nownum + '">';
		sHtml += '<embed src="' + url + '" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="' + w + '" height="' + h + '"></embed>';
		sHtml += '</object>';

		document.write(sHtml);
	}
}


// 동영상 출력
function fMovie(url, w, h)
{
	var sHtml;

	if (url && w && h)
	{
		sHtml = '<embed src="' + url + '" width="' + w + '" height="' + h + '"></embed>';
		document.write(sHtml);
	}
}

// 동영상 출력 디자인 컨트롤러용
function fMovieDesign(url, w, h, id)
{
	var sHtml;

	if (url && w && h)
	{

		sHtml = '<object id="' + id + '" classid="CLSID:22D6f312-B0F6-11D0-94AB-0080C74C7E95" width="' + w + '" height="' + h + '" >';
		sHtml += '<param name="AutoStart" value="true">';
		sHtml += '<param name="TransparentAtStart" value="True">';
		sHtml += '<param name="ShowControls" value="0">';
		sHtml += '<param name="ShowDisplay" value="0">';
		sHtml += '<param name="ShowStatusBar" value="1">';
		sHtml += '<param name="AutoSize" value="1">';
		sHtml += '<param name="AnimationAtStart" value="false">';
		sHtml += '<param name="FileName" value="' + url + '">';
		sHtml += '</object>';


		//sHtml = '<embed src="' + url + '" width="' + w + '" height="' + h + '" id="' + id + '"></embed>';
		document.write(sHtml);
	}
}

function fMovieChange(id, url)
{
	if (id)
	{
		document.getElementById(id).FileName = url;
	}
}

function fMovieStop(id)
{
	if (id)
	{
		try 
		{
			document.getElementById(id).stop();
		}
		catch ( Exception ) {}
	}
}
function fMoviePlay(id)
{
	if (id)
	{
		try 
		{
			document.getElementById(id).play();
		}
		catch ( Exception ) {}
	}
}
function fMoviePause(id)
{

	if (id)
	{
		try 
		{
			document.getElementById(id).pause();
		}
		catch ( Exception ) {}
	}
}



// 첨부파일 다운로드
function fDown(bc, seq)
{
	var f = document.fileDownForm;
	f.bc.value = bc;
	f.seq.value = seq;

	//f.target="_blank";
	f.submit();
//	location.href="/lib/download.asp?ph=" + ph + "&fn=" + fn + "&nm=" + nm;
}

//특정영역 인쇄하기
function fPrintView(id, w, h)
{
	var url;
	var param;
	param = "width=" + w + ",height=" + h + ",menubar=0,resizable=1,scrollbars=no,status=1";
	printWindow = window.open("","printform",param)
	printWindow.document.open();
	printWindow.document.write("<html>");
	printWindow.document.write("<meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\">");
	printWindow.document.write("<body style='margin:0 0 0 0' onLoad='window.print(); window.close();'>");
	printWindow.document.write(document.getElementById(id).outerHTML);
	printWindow.document.close();
}


// document.getElementById
function fGetId(id)
{
	return document.getElementById(id);
}

// document.getElementsByName
function fGetName(name)
{
	return document.getElementsByName(name);
}




// iframe resize
function fResizeFrame(iframeObj, mode)
{
	var innerBody = iframeObj.contentWindow.document.body;
	innerBody.scrollHeight;
	var innerHeight = innerBody.scrollHeight + (innerBody.offsetHeight - innerBody.clientHeight);
	var innerWidth = innerBody.scrollWidth + (innerBody.offsetWidth - innerBody.clientWidth);
	iframeObj.style.height = innerHeight;
	if (mode == "x")
	{
		iframeObj.style.width = innerWidth;				
	}

}

// 웹 에디터로 작성한 글 iframe 으로 출력하기.
function fViewEditorContent(width, id, height)
{

	var sHtml;

	if (!width)
	{
		width = 650;
	}

	if (!id)
	{
		id = "bbsEditorContent";
	}

	if (id.length > 0)
	{
		if (height)
		{
			sHtml = "<iframe id=\"bbsViewFrame\" width=\"" + width + "\" height=\"" + height + "\"  onLoad=\"this.contentWindow.document.write(fGetId('" + id + "').innerHTML); \" frameborder=\"0\"></iframe>";
			//sHtml = "<iframe id=\"bbsViewFrame\" width=\"" + width + "\" height=\"" + height + "\" onLoad=\"this.contentWindow.document.write(fGetId('" + id + "').innerHTML); frameborder=\"0\"></iframe>";
		}
		else
		{
			sHtml = "<iframe id=\"bbsViewFrame\" width=\"" + width + "\" onLoad=\"this.contentWindow.document.write(fGetId('" + id + "').innerHTML); fResizeFrame(this);\" frameborder=\"0\"></iframe>";
		}


		document.write(sHtml);
	}



}