var IE = false ;
if (window.navigator.appName.indexOf("Explorer") !=-1)
{
    IE = true;
}

function resizeIFrame( iframeName  ) {
        var ParentFrame     =   null;
        if(IE){
            ParentFrame = eval ( iframeName +".document.body" ) ;
        }else{
            ParentFrame = document.getElementById(iframeName).contentDocument.body;
        }
        //var ContentFrame  =   document.all["papermain"];
        var ContentFrame    =   document.getElementById(iframeName) ;
        //ContentFrame.style.height = ParentFrame.scrollHeight + (ParentFrame.offsetHeight - ParentFrame.clientHeight) + 100;
        ContentFrame.style.height = ParentFrame.scrollHeight + (ParentFrame.offsetHeight - ParentFrame.clientHeight)  ;
        //ContentFrame.style.width = ParentFrame.scrollWidth + (ParentFrame.offsetWidth - ParentFrame.clientWidth);


}
function reloadIFrame(iframeName , url ) {
    var ContentFrame    =   document.getElementById(iframeName) ;
    ContentFrame.src = url ;
}
function clearForm( formName) {
    form = eval ( "document." + formName ) ;
    var first = true;
    var catMsg = "";
    var curMsg;
    for(i=0; i< form.length; i++){
        if(form.elements[i].type != "button"
            && form.elements[i].type != "reset"
            && form.elements[i].type != "submit")
        {
            if(form.elements[i].type == "checkbox"
                || form.elements[i].type == "radio"){
                if(form.elements[i].checked){
                    // ÆûÀÇ ³»¿ëÀ» ÃÊ±âÈ­ ÇÏÁö ¾Ê´Â´Ù.
                        form.elements[i].checked = false;
                }else{
                        continue;
                }
            }else if(form.elements[i].type == "select-one"){
                var index = form.elements[i].selectedIndex;
                if(form.elements[i].options[index].value != ""  ){
                }
                else
                {
                }
                // '' °ªÀ» ³Ñ°ÜÁÖ±â À§ÇØ ¸¸¾à __NULL__ÀÌ¸é currMsg ¸¦ '' ·Î ¹Ù²Û´Ù.
                if (form.elements[i].options[index].value == '__NULL__' ) {
                        curMsg = '' ;
                        form.elements[i].options[index].value = curMsg;
                }
                    // ÆûÀÇ ³»¿ëÀ» ÃÊ±âÈ­ ÇÏÁö ¾Ê´Â´Ù.
                form.elements[i].selectedIndex = 0;
            } else
            {
                    form.elements[i].value  = "";
            }
            if(first){
                first = false;
            }else{
            }
        }
    }
}

function setFormValue( fieldName , VALS ) {
    var field = eval ( fieldName + ".value") ;
    field =  VALS ;
}

function xbbs_list() {
    var theForm = document.xbbsform ;
    theForm.action="index.jsp" ;
	theForm.menu.value = "list" ; 
    theForm.submit() ;
}
function xbbs_write() {
    var theForm = document.xbbsform ;
    theForm.action="index.jsp" ;
	theForm.menu.value = "write" ; 
    theForm.submit() ;

}
function xbbs_delete() {
    if ( confirm('Are you sure?') ) {
    var theForm = document.xbbsform ;
    theForm.action="index.jsp" ;
	theForm.menu.value = "delete" ; 
    theForm.submit() ;
    }
}
function xbbs_edit() {
    if ( confirm('Are you sure?') ) {
    var theForm = document.xbbsform ;
    theForm.action="index.jsp" ;
	theForm.menu.value = "edit" ; 
    theForm.submit() ;
    }
}
function xbbs_go(page) {
    var theForm = document.xbbsform ;
    theForm.pnum.value= page ;
    theForm.submit() ;
}
function xbbs_read(serial) {
    var theForm = document.xbbsform ;
    theForm.action="index.jsp" ;
	theForm.menu.value = "read" ; 
    theForm.SEQ.value = serial ;
    theForm.submit() ;
}
function xbbs_reply() {
/*
    var theForm = document.xbbsform ;
    theForm.action="/admin/common/reply_submit.jsp" ;
    theForm.submit() ;
	*/
}

function xbbs_submit() {
//alert("") ;
    var theForm = document.xbbsform ;
    theForm.method="post" ;
    //theForm.action="index.jsp" ;
	//theForm.menu.value = "write_submit" ;
	
	
	if(trim(theForm.UPFILE.value) != "")
	{
	
		strAppVersion = navigator.appVersion;
										
		if (strAppVersion.indexOf('MSIE') != -1 && strAppVersion.substr(strAppVersion.indexOf('MSIE')+5,1) > 4) {
			winstyle = "dialogWidth=400px; dialogHeight:200px; center:yes";
			window.showModelessDialog("/archive/ProgressBar.jsp?" + theForm.FileID.value,null,winstyle);	  
		}
		else {
			winpos = "left=" + ((window.screen.width-380)/2) + ",top=" + ((window.screen.height-110)/2);
			winstyle="width=400,height=200,status=no,toolbar=no,menubar=no,location=no,resizable=no,scrollbars=no,copyhistory=no," + winpos;
			window.open("/archive/ProgressBar.jsp?" + theForm.FileID.value,null,winstyle);	     
		}
	
	}
	 
    theForm.action="write_submit.jsp?ProgressID=" + theForm.FileID.value + "&pSEQ=" + theForm.SEQ.value;
    theForm.enctype="multipart/form-data" ;
    theForm.submit() ;
}
function xbbs_reset() {
    var theForm = document.xbbsform ;
	theForm.reset() ; 
}

function trim(str){
	var count = str.length;
	var len = count;                
	var st = 0;

	while ((st < len) && (str.charAt(st) <= ' '))
	{
		st++;
	}
	while ((st < len) && (str.charAt(len - 1) <= ' '))
	{
		len--;
	}                
	return ((st > 0) || (len < count)) ? str.substring(st, len) : str ;   
}
