// bskwon622 2009.01.23
// ¼öÁ¤»çÇ× : linkUserInfo°ü·Ã ÇÔ¼öµéÀ» userinfo.js·Î ¿Å±è.
// °ü·ÃÆäÀÌÁö : /server/docs/php/include/userinfo.js

//document.domain='nate.com';
try{	document.domain="nate.com"; } catch (e) {}

//OnStart();

//	sp2¼³Ä¡ ¿©ºÎ	¼³Ä¡ÇßÀ¸¸é °ªÀÌ -1ÀÌ ¾Æ´Ï´Ù
//var bInstallSP2 = window.navigator.userAgent.indexOf("SV1");
//var oPopup = window.createPopup();

var objUserInfo = null;
var tmpuser="";
var tmpuser2="";
var posX;
var posY;

document.onmousedown = ch_pos;
function ch_pos(evnt)
{
	posX = event.clientX + document.body.scrollLeft;
	posY = event.clientY + document.body.scrollTop;

	posX = event.clientX;
	return true;

}
// end UserInfo class ------------------------------

function sendProfile(id, cust_mng_num)
{
	var sURL = "http://nateonweb.nate.com/client/profile4.0/view.php?CMN="+cust_mng_num;
	openWindowNoResize(sURL, 'profile', '484', '336');
/*
	var sURL = "http://nateonweb.nate.com/client/profile2/view.php?CMN="+cust_mng_num;
	openWindowNoResize(sURL, 'profile', '484', '336');
*/	
}

function sendProfile40(id, cust_mng_num)
{
	var sURL = "http://nateonweb.nate.com/client/profile4.0/view.php?CMN="+cust_mng_num;
	openWindowNoResize(sURL, 'profile', '484', '336');
}

function sendProfileSub(pCMN, pSubFile)
{
	var sURL = "http://nateonweb.nate.com/profile/fview.php?CMN="+pCMN + "&file=" + pSubFile;
	openWindow3(sURL, pCMN, '727', '515');
}

function openWindow(pURL, pWinName)
{
    w = 500;
    h = 500;
	sx = (screen.width - w)/2;
	sy = (screen.height - h)/2 ;
    mywin = window.open(pURL,pWinName,'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,width='+w+',height='+h+',top='+sy+',left='+sx);
    mywin.focus();
}

function openWindow2(pURL, pWinName)
{
    w = 500;
    h = 500;
	sx = (screen.width - w)/2;
	sy = (screen.height - h)/2 ;
    mywin = window.open(pURL,pWinName,'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=auto,resizable=no,width='+w+',height='+h+',top='+sy+',left='+sx);
    mywin.focus();
}

function openWindow3(pURL, pWinName, pWidth, pHeight)
{
    w = pWidth;
    h = pHeight;
	sx = (screen.width - w)/2;
	sy = (screen.height - h)/2;
	mywin = window.open(pURL,pWinName,'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=auto,resizable=yes,width='+w+',height='+h+',top='+sy+',left='+sx);
    mywin.focus();
}

function openWindowNoResize(pURL, pWinName, pWidth, pHeight)
{
    w = pWidth;
    h = pHeight;
	sx = (screen.width - w)/2;
	sy = (screen.height - h)/2;
	mywin = window.open(pURL,pWinName,'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=auto,resizable=no,width='+w+',height='+h+',top='+sy+',left='+sx);
    mywin.focus();
}

function openWindowToolbar(pURL, pWinName)
{
	mywin = window.open(pURL,pWinName);
    mywin.focus();
}

function GO(pURL)
{
	document.location = pURL;
}

function checkEngNum(pStr) {
    var pattern = /^[a-zA-Z0-9]+$/;
    if(pattern.test(pStr.value) == false)
    	alert("¿µ¹®ÀÚ,¼ýÀÚ·Î¸¸ ÀÔ·ÂÇØ¾ß ÇÕ´Ï´Ù");
}

/************************************************************************
   ³×ÀÌÆ®¿ÂÀÌ Á¤»ó ·Î±×ÀÎ ÁßÀÎÁö ÆÇ´Ü (³×ÀÌ¿ÂÀÌ ¿¬µ¿ ID·Î ·Î±×ÀÎµÇ¾î ÀÖ¾î¾ßÇÔ)
 ************************************************************************/
function isNateonRun()
{
    var flag;
    flag=false;

    try {
		var str = '';
		if(OnStart())
		{
			// ³×ÀÌÆ®¿Â ·Î±×ÀÎ ¾ÆÀÌµð¿Í web¾ÆÀÌµð¿¡ µû¶ó ±¸ºÐ
		    str = NateOnApiAtx.GetMyInfo("my:id");
		}
        if(str != "")
            flag=true;
    }
    catch(e) {}

    return flag;
}
//	ÀÚ½ÅÀÇ ÆÄÀÏ¹æÀÌ³ª ¹Ì´ÏÈ¨ÇÇµîÀ» ¶ç¿ï¶§ È®ÀÎÇÑ´Ù
function checkSameID()
{
	var str = '';
	if ( OnStart() )
	{
		// ³×ÀÌÆ®¿Â ·Î±×ÀÎ ¾ÆÀÌµð¿Í web¾ÆÀÌµð¿¡ µû¶ó ±¸ºÐ
	    str = NateOnApiAtx.GetMyInfo("my:id");
	}
	else
	{
		return false;
	}
	//	´Ù¸¥ ¾ÆÀÌµð·Î ·Î±×ÀÎÁßÀÌ°Å³ª ·Î±×ÀÎÇÏÁö ¾ÊÀº °æ¿ì¶ó¸é
	if(str == '')
	{
		//	¼³Ä¡Ã¢ ¶ç¿ì±â
		// bskwon622 2009.01.08
		// ¾È³» ¹®±¸ ¼öÁ¤
//		alert("³×ÀÌÆ®¿Â¿¡ ·Î±×ÀÎÇÏÁö ¾ÊÀ¸¼Ì°Å³ª ´Ù¸¥ ¾ÆÀÌµð·Î ·Î±×ÀÎ ÁßÀÌ½Ê´Ï´Ù.\n\n¿äÃ»ÇÏ½Å ±â´ÉÀº ³×ÀÌÆ®¿Â¿¡ ·Î±×ÀÎÇÏ¼Å¾ß¸¸ »ç¿ë°¡´ÉÇÑ ¸Þ´ºÀÔ´Ï´Ù.");
		alert("³×ÀÌÆ®¿Â¿¡ ·Î±×ÀÎÇÏÁö ¾ÊÀ¸¼Ì°Å³ª ´Ù¸¥ ¾ÆÀÌµð·Î ·Î±×ÀÎ ÁßÀÌ½Ê´Ï´Ù.\n\n³×ÀÌÆ®¿Â ·Î±×ÀÎÈÄ »ç¿ëÇÏ¼¼¿ä.");
		return false;
	}
	else
	{
		return true;
	}
}

function OnStart() {
	//³×ÀÌÆ®¿Â activex½ÇÇà
	try
	{
		NateOnApiAtx.StartNateOn();
		return true;
	}
	catch(e)
	{
		//	¼³Ä¡Ã¢ ¶ç¿ì±â
		answer = confirm("³×ÀÌÆ®¿ÂÀ» ¼³Ä¡ÇÏ½Ã¸é Æí¸®ÇÑ ±â´É°ú ¸¸³ª½Ç ¼ö ÀÖ½À´Ï´Ù.\n\n³×ÀÌÆ®¿ÂÀ» ¼³Ä¡ÇÏ½Ã°Ú½À´Ï±î?");
		if(answer)
		{
			openWindow3('http://nateonweb.nate.com/download/nateon_install.php', 'install', '200', '200');
			return false;
		}
	  	return false;
	}
}
//	SMSº¸³»±â
function sendSMS(pUserID, pCMN, pSendNum)
{
	// ³×ÀÌÆ®¿Â ·Î±×ÀÎ ¿©ºÎ È®ÀÎ
	var bLogon = checkSameID();
	if(bLogon)
	{
		NateOnApiAtx.PopupAnyWindow("Sms", pUserID, "");
	}
	else if( GetCookie('user_id_full') != '' )
    {
		var sURL = 'http://nateonweb.nate.com/profile/sms_send.php?SendNum=' + pSendNum + '&TargetCMN=' + pCMN;
		openWindow3(sURL, 'mobile', '400', '450');
    }
}
//	Mailº¸³»±â
function sendMail(pEmail, pUserID)
{
	// ³×ÀÌÆ®¿Â ·Î±×ÀÎ ¿©ºÎ È®ÀÎ
	var bLogon = checkSameID();
	if(bLogon)
	{
		NateOnApiAtx.PopupAnyWindow("Mail", pEmail, "");
	}
	else if( GetCookie('user_id_full') != '' )
	{
		//subject
		var sURL = 'http://mail.nate.com/NateMailSendMgr.php?act=wmail_html_form&to=' + pEmail + '&flag=close';
		openWindow3(sURL,'mail',680, 500);
	}
}
//	Memoº¸³»±â
function sendMemo(pUserID)
{
	// ³×ÀÌÆ®¿Â ·Î±×ÀÎ ¿©ºÎ È®ÀÎ
	var bLogon = checkSameID();
	if(bLogon)
	{
		NateOnApiAtx.PopupAnyWindow("LiteMemo", pUserID, "");
	}
	else if( GetCookie('user_id_full') != '' )
	{
		var param, urls;
		param = '';
		if(pUserID) param += '&targetid=' + pUserID;

		urls = 'http://memo.nate.com/memo/SendMessage_popup.jsp?' + param;
		openWindow3(urls,'memo','520','350');
	}
}
//	¹Ì´ÏÈ¨ÇÇ º¸³»±â
function sendCYWORLD(pUserID, pUserCMN)
{
	var sURL = 'http://nateonweb.nate.com/profile/minihompi_send.php?TargetCMN=' + pUserCMN;
	openWindow3(sURL, 'minihomepi', '940', '530');
}
//	¹Ì´ÏÈ¨ÇÇ ¾ÆÀÌÅÛ º¸±â
function sendCYWORLDItem(pURL)
{
	var sURL = 'http://nateonweb.nate.com/profile/cyworlditem_send.php?URL=' + escape(pURL);
	openWindow3(sURL, '_new', '426','430');
}
//	³×ÀÌÆ®¿Â ½ÇÇà
function loadNateON()
{
	var str = '';
	if(OnStart())
	{
		// ³×ÀÌÆ®¿Â ·Î±×ÀÎ ¾ÆÀÌµð¿Í web¾ÆÀÌµð¿¡ µû¶ó ±¸ºÐ
	    str = NateOnApiAtx.GetMyInfo("my:id");

		if(str == '')
		{
			//	¼³Ä¡Ã¢ ¶ç¿ì±â
			answer = confirm("³×ÀÌÆ®¿Â¿¡ ·Î±×ÀÎÇÏ½Ã°Ú½À´Ï±î?");
			if(answer) {
				openWindow3('http://nateonweb.nate.com/download/nateon_install.php', 'install', '200', '200');
			}
		}
	}
}
//	ÃßÃµÄ£±¸ Å¬¸¯½Ã
function loadRecomm()
{
	// ³×ÀÌÆ®¿Â ·Î±×ÀÎ ¿©ºÎ È®ÀÎ
	var bLogon = checkSameID();
	if(bLogon)
	{
	    str = NateOnApiAtx.GetMyInfo("my:id");
		NateOnApiAtx.PopupAnyWindow("RecommendBuddy", str, "1");
	}
}
//	ÆÄÀÏ¹æ º¸³»±â
function sendFileRoom(pUserID, pCMN)
{
	// ³×ÀÌÆ®¿Â ·Î±×ÀÎ ¿©ºÎ È®ÀÎ
	var bLogon = checkSameID();
	if(bLogon)
	{
		NateOnApiAtx.PopupAnyWindow("OpenFileRoom", pUserID, "");
	}
}
//	BGM¼³Á¤Ã¢ º¸³»±â
function sendBGM(pUserID)
{
	// ³×ÀÌÆ®¿Â ·Î±×ÀÎ ¿©ºÎ È®ÀÎ
	var bLogon = checkSameID();
	if(bLogon)
	{
		var sURL = 'http://nateonweb.nate.com/profile/bgm_send.php';
		openWindow3(sURL, 'bgm', '700', '450');
	}
}
//	Ä£±¸¿äÃ»
//	pService = (user_context, profile, joinfriend, school, msncyworld)
//	¼­ºñ½ºÁ¾·ù¿¡ µû¶ó Åë°è »ý¼º
function sendFriend(pUserID, pService)
{
	// ³×ÀÌÆ®¿Â ·Î±×ÀÎ ¿©ºÎ È®ÀÎ
	var bLogon = checkSameID();
	if(bLogon)
	{
		//Åë°è »ý¼ºÃ¢
		// 2007.10.16 bskwon622 - »ç¿ëÇÏÁö ¾Ê´Â ÄÚµå¶ó ÆÇ´ÜµÇ¾î Á¦°ÅÇÔ.
		//var sService = 'nateonweb_ndr.nate.com/invitation/' + pService;
		//window.open("http://nateonweb.nate.com/client/profile/statimg.php?service="+sService,"statimg","top=20000,left=20000,width=1,height=1");
		//Å¬¶ó Ä£±¸¿äÃ» ÇÁ·Î¼¼½º
		NateOnApiAtx.PopupAnyWindow("AddBuddy", pUserID, "");
	}
	else
	{
	    user_id_full = GetCookie('user_id_full');
	    if(user_id_full == null)
	    {
	    	// 2008.12.30 bskwon622 ³×ÀÌÆ®¿Â ºñ·Î±×ÀÎ½Ã alertÃ¢ÀÌ µÎ¹ø ¶°¼­, ¾Æ·¡ alertÀº ÄÚ¸àÆ® Ã³¸®ÇÔ
	    	//alert('·Î±×ÀÎ ÇÏ¼Å¾ß »ç¿ëÇÏ½Ç ¼ö ÀÖ´Â ±â´ÉÀÔ´Ï´Ù.\n\n·Î±×ÀÎ ÇÏ¼¼¿ä');
	    	return;
	    }
		else
		{
			go_add_buddy(pUserID, pService);
		}
	}
}


//	ÆÄÀÏ¹æ ¼³Á¤Ã¢ ¿­±â	È«½ÂÀÏ
function openFileRoom()
{
	// ³×ÀÌÆ®¿Â ·Î±×ÀÎ ¿©ºÎ È®ÀÎ
	var bLogon = checkSameID();
	if(bLogon)
	{
		NateOnApiAtx.PopupAnyWindow("OpenFileRoom", NateOnApiAtx.GetMyInfo("my:id"), "");
	}
}
//	¹Ì´ÏÈ¨ÇÇ ¼³Á¤Ã¢ ¿­±â
function openCYWORLD()
{
	// ³×ÀÌÆ®¿Â ·Î±×ÀÎ ¿©ºÎ È®ÀÎ
	var bLogon = checkSameID();
	if(bLogon)
	{
		NateOnApiAtx.PopupAnyWindow("OptionWnd","","OP_MINIHOME")
	}
}
//	¾×¼ÇÂÊÁöÃ¢ ¿­±â
function openActionMemo(pUserID, pTemplate)
{
	// ³×ÀÌÆ®¿Â ·Î±×ÀÎ ¿©ºÎ È®ÀÎ
	var bLogon = checkSameID();
	if(bLogon)
	{
		//alert('PopupAnyWindow');
		NateOnApiAtx.PopupAnyWindow("ActionMemo",pUserID,pTemplate);
	}
}

//	MemoÇÔ ¿­±â
function openMemo()
{
	agent=navigator.userAgent.toLowerCase();
	isIE=(agent.indexOf('msie')!=-1);
	
	if (isIE == false) {
		alert("ÁË¼ÛÇÕ´Ï´Ù. \nº» ±â´ÉÀº ÀÎÅÍ³Ý ÀÍ½ºÇÃ·Î·¯¿¡¼­¸¸ ÀÛµ¿µË´Ï´Ù. ");
		return;
	}
	else {
		// ³×ÀÌÆ®¿Â ·Î±×ÀÎ ¿©ºÎ È®ÀÎ
		var bLogon = checkSameID();
		if(bLogon)
		{
			//alert('PopupAnyWindow');
			NateOnApiAtx.PopupAnyWindow("TMsgBox",'','MSG');
		}
	}
}
//	MailÇÔ ¿­±â
function openMail()
{
	// ³×ÀÌÆ®¿Â ·Î±×ÀÎ ¿©ºÎ È®ÀÎ
	var bLogon = checkSameID();
	if(bLogon)
	{
		NateOnApiAtx.PopupAnyWindow("TMsgBox",'','MAIL');
	}
	else if( GetCookie('user_id_full') != '' )
	{
		top.document.location = 'http://mail.nate.com/index.html?mailHome=1';
	}
}

//	ÀÌ¸ðÆ¼ÄÜ ¹Ù·Î ÀúÀåÇÏ±â
function sendEmoticon(pURL)
{
	alert("¼­ºñ½º ÁØºñÁßÀÔ´Ï´Ù");
	return;

	// ³×ÀÌÆ®¿Â ·Î±×ÀÎ ¿©ºÎ È®ÀÎ
	var bLogon = checkSameID();
	if(bLogon)
	{
		//	³×ÀÌÆ®¿Â ¹öÀü È®ÀÎ
		var sVersion = NateOnApiAtx.GetMyInfo("my:version");
		//	3.0³ª°¡¸é 3.0.0.0À¸·Î °íÄ¡±â
		if(sVersion < '3.0.0.0')
		{
			//var result = confirm('3.0ÀÌ»ó¸¸ »ç¿ëÇÏ½Ç ¼ö ÀÖ´Â ±â´ÉÀÔ´Ï´Ù.\n\n»õ·Î¿î ³×ÀÌÆ®¿ÂÀ» ¸¸³ª½Ã¸é ´Ù¾çÇÑ ±â´É°ú ¸¸³ª½Ç ¼ö ÀÖ½À´Ï´Ù.\n\n»õ·Î¿î ¹öÀüÀ¸·Î ¾÷µ¥ÀÌÆ® ÇÏ½Ã°Ú¾î¿ä?');
			//if(result)
			//	alert('³×ÀÌÆ®¿Â ¾÷±×·¹ÀÌµå');
			alert('³×ÀÌÆ®¿Â 3.0ÀÌ»ó¸¸ »ç¿ëÇÏ½Ç ¼ö ÀÖ´Â ±â´ÉÀÔ´Ï´Ù.');
		}
		else
		{
			openWindow3(pURL,'down', 316, 160);
		}
	}
}

////////////////////////
function SetCookie(sName, sValue)
{
  document.cookie = sName + "=" + escape(sValue) ;
}

function GetCookie(sName)
{
  var aCookie = document.cookie.split("; ");
  for (var i=0; i < aCookie.length; i++)
  {
    var aCrumb = aCookie[i].split("=");
    if (sName == aCrumb[0])
      return unescape(aCrumb[1]);
  }
  return null;
}


//	¸ÞÀÎ¿¡¼­ ·Î±×ÀÎ Ã³¸®½Ã
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 ;
}
var base64list = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';

function base64encode(s)
{
  var t = '', p = -6, a = 0, i = 0, v = 0, c;

  while ( (i < s.length) || (p > -6) ) {
    if ( p < 0 ) {
      if ( i < s.length ) {
        c = s.charCodeAt(i++);
        v += 8;
      } else {
        c = 0;
      }
      a = ((a&255)<<8)|(c&255);
      p += 8;
    }
    if ( v > 0 )
      t += base64list.charAt((a>>p)&63);
    else
      t += base64list.charAt(64);
    p -= 6;
    v -= 6;
  }
  return t;
}

function base64decode(s)
{
  var t = '', p = -8, a = 0, q = 0, c, m, n;

  for( var i = 0; i < s.length; i++ ) {
    c = base64list.indexOf(s.charAt(i));
    if ( c < 0 )
      continue;
    a = (a<<6)|(c&63);
    p += 6;
    if ( p >= 0 ) {
      c = (a>>p)&255;
      if ( c > 0 )
        t += String.fromCharCode(c);
      a &= 63;
      p -= 8;
    }
  }
  return t;
}
function login_init()
{
	//·ÎÁ÷»èÁ¦
}
function getCookieVal (offset)
{
   var endstr = document.cookie.indexOf (";", offset);
   if (endstr == -1) endstr = document.cookie.length;
   return document.cookie.substring(offset, endstr);
}

function getCookie (name)
{
   var arg = name + "=";
   var alen = arg.length;
   var clen = document.cookie.length;
   var i = 0;
   while (i < clen) {   //while open
      var j = i + alen;
      if (document.cookie.substring(i, j) == arg)
         return getCookieVal (j);
      i = document.cookie.indexOf(" ", i) + 1;
      if (i == 0) break;
   }    //while close
   return null;
}


function checkInput() {
	var form = document.f_login;

	if ( trim(form.ID.value) == '' ) {
		alert('¾ÆÀÌµð¸¦ ÀÔ·ÂÇÏ¼¼¿ä.');
		form.ID.focus();
		return;
	}
	if ( trim(form.PASSWD.value) == '' ) {
		alert('ºñ¹Ð¹øÈ£¸¦ ÀÔ·ÂÇÏ¼¼¿ä.');
		form.PASSWD.focus();
		return;
	}

	if ( form.domain[1].selected == true) {
		form.ID.value =form.ID.value + "@lycos.co.kr";
		form.sso.value="false";
	}
	else if ( form.domain[2].selected == true) {
		form.ID.value =form.ID.value + "@netsgo.com";
		form.sso.value="false";
	}
	else{
	}

	if ( form.ssl.checked == true ){
		form.action = 'https://xo.nate.com/servlets/LoginServlet';
	}
	else {
		form.action = 'https://xo.nate.com/servlets/LoginServlet';
	}


	form.submit();
}


//	ÇÔ´ë¸®´ÔÇÑÅ× ¾ê±âÇÏ°í school.js·Î ¿Å±â±â
	function goMySchool(str1, str2, str3, str4, str5, str6, str7, str8, str9, str10, str11){
		document.leftmenuFrm.s_type.value = str1;
		document.leftmenuFrm.country_code.value = str2;
		document.leftmenuFrm.city_code.value = str3;
		document.leftmenuFrm.school_code.value = str4;
		document.leftmenuFrm.school_name.value = str5;
		document.leftmenuFrm.school_entry_year.value = str6;
		document.leftmenuFrm.school_grade.value = str7;
		document.leftmenuFrm.school_class.value = str8;
		document.leftmenuFrm.class_code.value = str9;
		document.leftmenuFrm.class_name.value = str10;
		document.leftmenuFrm.depart_code.value = str11;

		document.leftmenuFrm.target = "";
		document.leftmenuFrm.action = "/school/friend_myschool.php?ex=1";
		document.leftmenuFrm.submit();
	}
	function goSchoolList(str1, str2, str3, str4, str5, str6, str7, str8, str9, str10, str11){
		document.listFrm.s_type.value = str1;
		document.listFrm.country_code.value = str2;
		document.listFrm.city_code.value = str3;
		document.listFrm.school_code.value = str4;
		document.listFrm.school_name.value = str5;
		document.listFrm.entry_year.value = str6;
		document.listFrm.school_grade.value = str7;
		document.listFrm.school_class.value = str8;
		document.listFrm.class_code.value = str9;
		document.listFrm.class_name.value = str10;
		document.listFrm.depart_code.value = str11;

		document.listFrm.target = "";
		document.listFrm.action = "/school/main_school.php";
		document.listFrm.submit();
	}

// Ä£±¸Ãß°¡
function go_add_buddy(str, pService){
  if(pService == "") pService = "user_context";

  //Åë°è »ý¼ºÃ¢
  var sService = 'nateonweb_ndr.nate.com/invitation/' + pService;
  //alert(sService);

  window.open("http://nateonweb.nate.com/school/school_add_buddy.php?ToID="+str+"&service="+sService,"school_add_buddy","top=20000,left=20000,width=200,height=200");
}

// Ä£±¸Ãß°¡
function go_add_buddy_content(str1, str2, pService){
  if(pService == "") pService = "user_context";

  //Åë°è »ý¼ºÃ¢
  var sService = 'nateonweb_ndr.nate.com/invitation/' + pService;
  //alert(sService);

  window.open("http://nateonweb.nate.com/school/school_add_buddy.php?ToID="+str1+"&proposal="+str2+"&service="+sService,"school_add_buddy","top=20000,left=20000,width=200,height=200");
}

function dummy()
{
}

function getResizedImage(max_w, max_h, width, height, enlarge)
{
	var new_width = width, new_height = height;

	if ( typeof(height) == "undefined" || height == 0 || typeof(width) == "undefined" || width == 0 )
	{
		new_width = max_w;
		new_height = max_h;
	}
	else
	{
		var ratio_w = max_w / width;
		var ratio_h = max_h / height;

		if ( ratio_w * height <= max_h )
		{
			if ( (ratio_w > 1) && enlarge || ratio_w <= 1 )
			{
				new_width = max_w;
				new_height = Math.round(ratio_w * height);
			}
		}
		else
		{
			if ( (ratio_h > 1) && enlarge || ratio_h <= 1 )
			{
				new_width = Math.round(ratio_h * width);
				new_height = max_h;
			}
		}
	}

	return new Array(new_width, new_height);
}
