/*#####################################################################################

IFRAME Resize°ü·Ã Âü°í»çÇ×

1) ÇöÀç¹®¼­ /_css/cafe_base_script.js ÆÄÀÏÀº ¸ðµç Ä«Æä¹®¼­¿¡ °øÅëÀ¸·Î Ãß°¡µÇ¾î¾ß ÇÑ´Ù.

2) iframeÀÇ ³»¿ëº¯°æ½Ã °¢ ¹®¼­ÇÏ´Ü¿¡ exsitParentIFrame(ifrName)ÇÔ¼ö¸¦ È£ÃâÇÏ¿©
   iframeÀ» ResizeÇÑ´Ù.

3) °Ô½ÃÆÇ°ú°°ÀÌ Æ¯Á¤ ¿µ¿ªÀ» °¨Ãß°Å³ª Ç¥ÃâÇÏ´Âµî iframe³»ÀÇ ¹®¼­¿¡ height°ªÀÌ º¯ÇÒ°æ¿ì¿¡µµ 
   °¢ javascriptÇÔ¼ö ³»ºÎ¿¡¼­ exsitParentIFrame(ifrName)ÇÔ¼ö¸¦ È£ÃâÇÏ¿©
   iframeÀ» ResizeÇÑ´Ù.

4) iframeÀÇ Name,ID´Â ¸ðµÎ µ¿ÀÏÇÏ°Ô »ç¿ëÇÑ´Ù.(index.phpÂüÁ¶)

setInterval()À» »ç¿ëÇÏÁö¾ÊÀ½
#####################################################################################*/


// iframe ÃÖ´ëÅ©±â 
var mpWidthSize = 590 ; // »ç¿ëÀÚ ÆäÀÌÁöÀÇ iframe width°ª
var apWidthSize = 781 ; // °ü¸®ÀÚ ÆäÀÌÁöÀÇ iframe width°ª

var frmWidth = 590;
var frmHeight= 400;
var frmMinSize = screen.availHeight-200;
function resizeIframe(ifrName,maType){
	if(maType == null || maType == ""){
		maType = "mp";
	}
	
	try{
		
		// IE ÀÏ°æ¿ì¸¸
		if(document.all){
			var ifrBody   = document.frames(ifrName).document.body;
			var ifrID = document.all(ifrName);	
		}else{
			return false;
		}
		
		if(maType=="ap") frmWidth  = apWidthSize; 
		else frmWidth = mpWidthSize;

		var frmHeight = ifrBody.scrollHeight; 
		if(frmHeight < frmMinSize) frmHeight = frmMinSize;


		ifrID.style.height = frmHeight;
		ifrID.style.width = frmWidth;
	}catch (e){
	
	}
}

function exsitParentIFrame(ifrName,maType){
	if(maType == null || maType == ""){
		maType = "mp";
	}

	if(parent && parent != this && parent.resizeIframe != null){
		parent.resizeIframe(ifrName,maType);

	}
}



// iframeÀÌ Æ÷Ä¿½º¸¦ °¡Áö°í ÀÖÀ»°æ¿ì F5¸¦ ´­·¶À»¶§ iframe ³»ºÎ¸¸ refresh µÇµµ·Ï Ã³¸®
// ±×¿Ü¿¡´Â ÀüÃ¼ refresh°¡µÊ.
document.onkeydown = f5Refresh;
function f5Refresh(){
	if (event.keyCode == 116){
		event.keyCode = 0; 
		event.cancelBubble = true; 
		event.returnValue = false;
		document.location.reload();
	}
}



/* ÀÚ½ÅÀÌ °¡ÀÔÇÑ Ä«Æä ¹Ù·Î°¡±â */
function goMyCafe(gourl){
	
	var form = document.myFAV;
	var tmpStr = form.myCafeList.options[form.myCafeList.selectedIndex].value;
	if(tmpStr != null && tmpStr != '-1'){
		top.location.href = gourl+"/"+tmpStr;
	}
}



/* °Ô½ÃÆÇ¿¡ µî·ÏÇÑ ÀÌ¹ÌÁöÀÇ ¸ðµå »çÀÌÁö¸¦ ifram Å©±â¸¦ ³Ñ¾î°¡Áö ¾Ê°ÔÇÑ´Ù. */
/* ÀÌ¹ÌÁö Å©±â´Â ÃÖ´ë 535px ÀÌ´Ù(ÀÌ ÀÌ»ç¿øÇÒ°æ¿ì °Ô½ÃÆÇ ÄÚµù ºÎºÐÀ» ¼öÁ¤ÇØ¾ßÇÔ */
function boardImgResize(size){
  try{
	var imgObjs = document.all('boardContentArea').getElementsByTagName("IMG");
	for(i=0;i<imgObjs.length;i++){
		if(imgObjs[i].width > size) imgObjs[i].width = size;
	}
  }catch(e){
  } 

}



/* °³ÀÎ ÀÚ·á½Ç º¸±â */
function popMyHome(userID){
	/*
	if(userID!=''){
		var winLoc = "http://my.acuve.net/_my/_my_check.php?myID="+userID;
		window.open(winLoc,'myHome');
	}else{
		alert("·Î±×ÀÎ ÇÏ¼Å¾ß ÇÕ´Ï´Ù.");
	}
	*/
}


/* Ä£±¸ Ãß°¡ÇÏ±â */
function popFriend(uID,fID){
	/*
	if(uID==''){
		alert("·Î±×ÀÎ ÇÏ¼Å¾ß ÇÕ´Ï´Ù.");
	}else{

		if(uID == fID){
			alert("º»ÀÎÀ» Ä£±¸·Î Ãß°¡ÇÒ¼ö ¾ø½À´Ï´Ù.");
		}else{
			var winLoc = "http://acuve.net/_manager/my_friend_search.php?mode=search&userID="+uID+"&friendID="+fID;
			window.open(winLoc , 'myFriend' , "width=430,height=450,scrollbars=yes");
		}
	}
	*/
}


/* ÀÌ¸ÞÀÏ ¹ß¼Û */
function popEmail(userID){
	var winLoc = "http://cafe.narasoft.com/_pop_email.php?userID="+userID;
	window.open(winLoc,'pEmail',"width=500,height=410,top=10,scrollbars=no");
}



/* Ä£±¸Ãß°¡,°³ÀÎÀÚ·á½Ç,ÀÌ¸ÞÀÏ È÷µç¸Þ´º */
function msgposit(){
   message_small.style.posLeft = event.x ;
   message_small.style.posTop = event.y;
}
function msghide(){
  
   if(window.event.srcElement.tagName.toLowerCase() != "span"){
	   message_small.innerHTML="";
   }
   //message_small.style.visibility='hidden'
}
function msgset(uID,fID){
   var text;
   text ="<table width=95 border=0 cellspacing=1 cellpadding=0 bgcolor=#B6B6B6>";
   text+="   <tr>";
   text+="       <td bgcolor='#FFFFFF' align='center'>";
   text+="       <table width=89 border=0 cellspacing=0 cellpadding=0 border=0>";
   text+="       <tr><td bgcolor='#ffffff' height=2></td></tr>";
//   text+="       <tr height=24><td style='cursor:hand' onMouseOver=\"this.style.backgroundColor='ffffff'\" onMouseOut=\"this.style.backgroundColor='ffffff'\">&nbsp;&nbsp;<span onClick=\"popFriend('"+uID+"','"+fID+"');\"><font color='#404040'>Ä£±¸µî·Ï</font></span></td></tr>";
//   text+="       <tr><td bgcolor='ffffff' height=1 align='center'0><img src='/_image/tech/dotline2.gif'></td></tr>";
   text+="       <tr height=24><td style='cursor:hand' onMouseOver=\"this.style.backgroundColor='ffffff'\" onMouseOut=\"this.style.backgroundColor='ffffff'\">&nbsp;&nbsp;<span onClick=\"popEmail('"+fID+"');\"><font color='#404040'>ÀÌ¸ÞÀÏ</font></span></td></tr>";
   text+="       <tr><td bgcolor='#ffffff' height=2></td></td>";
   text+="       </table>";
   text+="       </td>";
   text+="   </tr>";
   text+="</table>";
   message_small.innerHTML=text;
}



function msgset_new(uID,fID){
   var text;
   text ="<table width=95 border=0 cellspacing=1 cellpadding=0 bgcolor=#B6B6B6 >";
   text+="   <tr>";
   text+="       <td bgcolor='#FFFFFF' align='center'>";
   text+="       <table width=89 border=0 cellspacing=0 cellpadding=0 border=0>";
   text+="       <tr><td bgcolor='#ffffff' height=2></td></tr>";
   text+="       <tr height=24><td style='cursor:hand' onMouseOver=\"this.style.backgroundColor='ffffff'\" onMouseOut=\"this.style.backgroundColor='ffffff'\">&nbsp;&nbsp;<span onClick=\"goblog('"+fID+"')\"><font color='#404040'>ºí·Î±×°¡±â</font></span></td></tr>";
   text+="       <tr><td bgcolor='ffffff' height=1 align='center'0><img src='/_image/tech/dotline2.gif'></td></tr>";
   text+="       <tr height=24><td style='cursor:hand' onMouseOver=\"this.style.backgroundColor='ffffff'\" onMouseOut=\"this.style.backgroundColor='ffffff'\">&nbsp;&nbsp;<span onClick=\"sendpaper('"+fID+"')\"><font color='#404040'>ÂÊÁöº¸³»±â</font></span></td></tr>";
   text+="       <tr><td bgcolor='ffffff' height=1 align='center'0><img src='/_image/tech/dotline2.gif'></td></tr>";
   text+="       <tr height=24><td style='cursor:hand' onMouseOver=\"this.style.backgroundColor='ffffff'\" onMouseOut=\"this.style.backgroundColor='ffffff'\">&nbsp;&nbsp;<span onClick=\"popEmail('"+fID+"')\"><font color='#404040'>ÀÌ¸ÞÀÏ</font></span></td></tr>";
   text+="       <tr><td bgcolor='#ffffff' height=2></td></td>";
   text+="       </table>";
   text+="       </td>";
   text+="   </tr>";
   text+="</table>";
   message_small.innerHTML=text;
}
function sendpaper(fID){
	var win;
	win=window.open("http://www.thesenior.co.kr/member/member_my_paper_send.html?from="+fID);
	win.focus();
}
function goblog(fID){
	var win;
	win=window.open("http://blog.thesenior.co.kr/"+fID);
	win.focus();
}
function popChatting(userID,userName,cafeUserName,gender,age,cafeName){
	/*
	//alert("http://engine.acuve.net/videocafe/?cid="+userID+"&cname="+userName+"&calias="+cafeUserName+"&csex="+gender+"&ctitle="+cafeName);
	window.open("http://engine.acuve.net/videocafe/?cid="+userID+"&cname="+userName+"&calias="+cafeUserName+"&csex="+gender+"&cage="+age+"&ctitle="+cafeName, 'VideoPlusWindow', 'scrollbasrs=1, width=850, height=570, top=0, left=0, status=no, resize=yes, resizable');
	*/
}


function open_chat_window(arg){
	if(arg==""){
		alert("·Î±×ÀÎÈÄ ÀÌ¿ëÀÌ °¡´ÉÇÕ´Ï´Ù.");
	}else{
		var win;
		win=window.open("http://www.thesenior.co.kr/ns_chat/chat/chat_login.php","_chatwindows",",width=700,height=600,toolbars=no,scrollbars=yes");
		win.focus();
	}
}

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 cafe_frameinit(minHeight)
{
	try 
	{
		var timeArray = new Array(200, 500, 1500, 3500, 7000, 12000, 20000);
		//alert("1_blog_frameinit, timeArray.length="+timeArray.length);
		for(var i=0; i < timeArray.length; i++){
			setTimeout('_blog_frameinit(\''+minHeight+'\')', timeArray[i]);
		}
		if(self.name!=null && self.name=="blog_body"){
			top.window.scrollTo(0,0);
		}
	}catch (e) {}
}
