
// 2005-09-03
// F5¸¦ ´­·¶À»¶§ iframe ³»ºÎ¸¸ refresh µÇµµ·Ï Ã³¸®
document.onkeydown = trapRefresh;
function trapRefresh()
{
	if (event.keyCode == 116)
	{
		event.keyCode = 0; 
		event.cancelBubble = true; 
		event.returnValue = false;
		//document.location.reload();
	}
}


function reSize()
{
	    var ParentFrame	    =	prwebboard.document.body;
	    var ContentFrame	=	document.all["prwebboard"];
	    ContentFrame.style.height = ParentFrame.scrollHeight + (ParentFrame.offsetHeight - ParentFrame.clientHeight) + 50;
		var postWidth = ParentFrame.scrollWidth + (ParentFrame.offsetWidth - ParentFrame.clientWidth);
	    document.all.MainDiv.innerHTML = "<table height=10 width=" + postWidth + " border=0><tr><td></td></tr></table>";
		//ContentFrame.style.width = ParentFrame.scrollWidth + (ParentFrame.offsetWidth - ParentFrame.clientWidth);
		
}
function reSizeG()
{
	try
	{
	    var ParentFrame	    =	gameiframe.document.body;
	    var ContentFrame	=	document.all["gameiframe"];
	    ContentFrame.style.height = ParentFrame.scrollHeight + (ParentFrame.offsetHeight - ParentFrame.clientHeight);
		//ContentFrame.style.width = ParentFrame.scrollWidth + (ParentFrame.offsetWidth - ParentFrame.clientWidth);		
	}catch(e){}
}
function reSizeF()
{
	    var ParentFrame	    =	prwebboard.document.body;
	    var ContentFrame	=	document.all["prwebboard"];
	    ContentFrame.style.height = ParentFrame.scrollHeight + (ParentFrame.offsetHeight - ParentFrame.clientHeight);
		
}

function reSize0()
{
	    var ParentFrame	    =	prwebboard.document.body;
	    var ContentFrame	=	document.all["prwebboard"];
	    ContentFrame.style.height = ParentFrame.scrollHeight + (ParentFrame.offsetHeight - ParentFrame.clientHeight);
		//ContentFrame.style.width = ParentFrame.scrollWidth + (ParentFrame.offsetWidth - ParentFrame.clientWidth);

		//parent.document.location.href = parent.document.location.href + '#';
}

function reSize2(fno)
{
	    
	    var ParentFrame	    =	eval("CommentFrm" + fno +  ".document.body");
	    var ContentFrame	=	eval("document.all.CommentFrm" +fno);

	    ContentFrame.style.height = ParentFrame.scrollHeight + (ParentFrame.offsetHeight - ParentFrame.clientHeight);
		parent.reSize0();
}

function reSize3(fno)
{
	    
	    var ParentFrame	    =	eval("EventCommentFrm" + fno +  ".document.body");
	    var ContentFrame	=	eval("document.all.EventCommentFrm" +fno);

	    ContentFrame.style.height = ParentFrame.scrollHeight + (ParentFrame.offsetHeight - ParentFrame.clientHeight);
		parent.reSize();
}
function reSize4(obj)
{
	    var ParentFrame	    =	eval(obj+".document.body");
	    var ContentFrame	=	eval("document.all."+obj);
	    ContentFrame.style.height = ParentFrame.scrollHeight + (ParentFrame.offsetHeight - ParentFrame.clientHeight);
}

function paperInit()
{
	    parent.reSize();
	    //parent.document.location.href = '#';
}
function paperInit2()
{
	    parent.reSizeF();
	    //parent.document.location.href = '#';
}
function paperInit_sub(fno)
{
	    parent.reSize2(fno);
	 //parent.document.location.href = parent.document.location.href + '#';
}
function paperInit_eventcomment(fno)
{
	    parent.reSize3(fno);
	 //parent.document.location.href = parent.document.location.href + '#';
}

function strLenCk(str)
{
  var len = 0;
  for (var i=0;i<str.length; i++) {
    var n = str.charCodeAt(i);
    if ((n>= 0)&&(n<256)) {
      len ++;
    } else {
      len += 2;
	}
  }
  return len;
}





function comment_sub(){
		//´ñ±Û ¸®»çÀÌÁî
		parent.document.all["CommentFrm"].style.height = document.body.scrollHeight;
		//self.resizeTo(document.body.scrollWidth+10,document.body.scrollHeight);

		//±Û³»¿ë ¸®»çÀÌÁî [°Ô½ÃÆÇ]
//		parent.self.resizeTo(document.body.scrollWidth,document.body.scrollHeight);
//		parent.prwebboard.document.body.style.height = document.body.scrollHeight;
//	    ContentFrame.style.height = document.all["prwebboard"].scrollHeight + (document.all["prwebboard"].offsetHeight - document.all["prwebboard"].clientHeight);
//		ContentFrame.style.width = ParentFrame.scrollWidth + (ParentFrame.offsetWidth - ParentFrame.clientWidth);
		
		//ÀüÃ¼ ¸®»çÀÌÁî
		parent.comment_parent_resize();

}

function comment_parent_resize(){

	    var ParentFrame	    =	parent.prwebboard.document.body;
	    var ContentFrame	=	parent.document.all["prwebboard"];
	    var AutoHeight = ParentFrame.scrollHeight + (ParentFrame.offsetHeight - ParentFrame.clientHeight);
		
			if(AutoHeight < 400 ){
			ContentFrame.style.height = 400;
			}
			else{
				ContentFrame.style.height = AutoHeight;
			}
}
function paper2Init()
{
		comment_parent_resize();

}


   function goLoginPage()
  {
	if ( arguments.length > 0 )
	{
		document.loginForm.url.value= "/Prweb_user_file/login.asp";
	}
	else
	{
		var tUrl = location.href;
		tUrl = tUrl.replace("#","");
		if (tUrl.indexOf("?") > 0 && tUrl.indexOf("Redirect") < 0){
		      tUrl = tUrl + "&Redirect=Login";
		}
		if (tUrl.indexOf("?") < 0 && tUrl.indexOf("Redirect") < 0){
		      tUrl = tUrl + "?Redirect=Login";
		}
		document.loginForm.url.value= tUrl;
	}

	document.loginForm.submit();
  }

	function settop()
	{
		/* var topurl = document.location.href;
		if (topurl.indexOf('#') > 0)
			document.location.href = document.location.href;
		else
			document.location.href = document.location.href + '#';*/
		window.scrollTo(0,0);
	}

    function Scrollon(pos){
  
	var cpos = 	prwebboard.document.body.scrollLeft;
	var tpos = 0;
    var i = 0;
	if (pos > cpos){

		tpos = pos - cpos;
		while(i<=tpos){
		prwebboard.document.body.scrollLeft += 1;
		i += 1;
		}
	}
	else{
		tpos = cpos - pos;
		while(i<=tpos){
		prwebboard.document.body.scrollLeft -= 1;
		i += 1;
		}
	}

  }