/**************************************************************************************************
* 파일 다중첨부 
**************************************************************************************************/
function addcase(Cnt, plusCnt) {
	if(plusCnt == 1){
		alert("파일첨부는 "+Cnt+"개까지 가능합니다.");
		return;
	}

	if(document.getElementsByName("userfile").length == plusCnt){
		alert("파일첨부는 "+Cnt+"개까지 가능합니다.");
		return;
	}
	var cHtml = ""; 

	var Tbl = document.getElementById('uploadView'); 
	var tRow = Tbl.insertRow(); 

	cHtml +=" <input type=file name=userfile style='width:400px;margin-left:3px' class='input'>" ; 

	tRow.insertCell().innerHTML += cHtml; 
	return; 
}


function chk_search(form)
{
	if(form_chk_value(form.keyword, "검색어를")==false)return;
	form.submit();
}



/**************************************************************************************************
* FAQ 관련
**************************************************************************************************/
var old='';
function Faq_menu(name){
	submenu=eval('submenu_prodeval'+name+'.style');

	if(old!=submenu)
	{
		if(old!='')
		{
			old.display='none';
		}
		submenu.display='block';
		old=submenu;
	}
	else
	{
		submenu.display='none';
		old='';
	}
}
/*************************************************************************************************
* 
*************************************************************************************************/
function rss_copy_clip(meintext) { 
	if (window.clipboardData) {
		window.clipboardData.setData("Text", meintext); 
	} else if (window.netscape) {
		netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect'); 

		var clip = Components.classes['@mozilla.org/widget/clipboard;1'].createInstance(Components.interfaces.nsIClipboard); 
		if (!clip) return; 

		var trans = Components.classes['@mozilla.org/widget/transferable;1'].createInstance(Components.interfaces.nsITransferable); 
		if (!trans) return; 

		trans.addDataFlavor('text/unicode'); 

		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 (!clipid) return false; 

		clip.setData(trans,null,clipid.kGlobalClipboard); 
	} 
	alert("RSS 주소가 복사되었습니다. RSS Reader 프로그램에 입력하시기 바랍니다."); 
	return false; 
} 


/*************************************************************************************************
* 글내용 아이프레임 크기
*************************************************************************************************/
var IE = false ;
	if (window.navigator.appName.indexOf("Explorer") !=-1){
	IE = true;
}

function resizeIfr(obj, minHeight) {
	minHeight = minHeight || 10;


	try {
		var getHeightByElement = function(body) {
			var last = body.lastChild;
			try {
				while (last && last.nodeType != 1 || !last.offsetTop) last = last.previousSibling;
				return last.offsetTop+last.offsetHeight;
			} catch(e) {
				return 0;
			}
			
		}
				
		var doc = obj.contentDocument || obj.contentWindow.document;
		if (doc.location.href == 'about:blank') {
			obj.style.height = minHeight+'px';
			return;
		}
		

		if (/MSIE/.test(navigator.userAgent)) {
			var h = doc.body.scrollHeight;
		} else {
			var s = doc.body.appendChild(document.createElement('DIV'))
			s.style.clear = 'both';

			var h = s.offsetTop;
			s.parentNode.removeChild(s);
		}

		if (h < minHeight) h = minHeight;
	
		obj.style.height = h + 'px';
		if (typeof resizeIfr.check == 'undefined') resizeIfr.check = 0;
		if (typeof obj._check == 'undefined') obj._check = 0;


			setTimeout(function(){ resizeIfr(obj,minHeight) }, 200); // check 5 times for IE bug

	} catch (e) {
		//alert(e);
	}
	
}

