//20090411 22:35 ÃÖÁ¾

function Left(str, n)
{
	if (n <= 0)
	{	
		return "";
	}
	else if (n > String(str).length)
	{
		return str;
	}
	else
	{
		return String(str).substring(0,n);
	}
}

function Right(str, n)
{
	if (n <= 0)
	{
		return "";
	}
	else if (n > String(str).length)
	{
		return str;
	}
	else 
	{
	     var iLen = String(str).length;
	     return String(str).substring(iLen, iLen - n);
	}
}

function MyMopet()
{
	window.location.href="/shop/My_mpitem.asp";
}


function go_club(url)
{
	window.open(url);
}

function go_LogOut()
{
	window.location.href="/logOut.asp";
}

function go_Story_View(id,id2)
{
	window.open('http://story.vvvic.com/main.asp?BCode=' + id + '&BNum=' + id2,'Story');
}

//#####°ÔÀÓ ¸ÞÀÎ »ó´Ü È£Ãâ ºÎºÐ#####



function Go_Explain(gtyp)
{
	openWin("/game/GameExplain.asp?typ=" + gtyp,"Exp",100,100,400,400);
}


//°ÔÀÓ ÃÊ±âÈ­¸¦ À§ÇÑ Func ÆË¾÷Ã¢¿¡¼­´Â pop=1, id¿¡´Â °ÔÀÓÀÌ¸§
function Go_Reset_Game(id,pop)
{
	if (window.confirm("ÃÊ±âÈ­¸¦ ÇÏ¸é ÀÌ °ÔÀÓÀÇ ¸ðµç Á¤º¸\n(°æÇèÄ¡, ·¹º§, °ÔÀÓ¸Ó´Ï, ºñÁê¾ÆÀÌÅÛ, °ÔÀÓ¸Ó´Ï ¾ÆÀÌÅÛ, ·©Å·, ÀÌ¸§ µî)\n°¡ »ç¶óÁö°í °ÔÀÓÀ» ´Ù½Ã ½ÃÀÛÇÏ¼Å¾ß ÇÕ´Ï´Ù.\ÃÊ±âÈ­ ÇÏ½Ã°Ú½À´Ï±î?") == true)	{
		if (window.confirm("ÃÊ±âÈ­¸¦ ÇÏ¸é Á¤º¸¸¦ º¹±¸ÇÒ ¼ö ¾ø½À´Ï´Ù.\nÁ¤¸» ÃÊ±âÈ­ ÇÏ±æ ¿øÇÏ½Ê´Ï±î?") == true)	{
			window.location.href="/game2/game_reset.asp?Typ=" + id + "&Pop=" + pop;
		}else{
			return;
		}
	}else	{
		return;
	}
}

//##################################
function IDSearch()
{
	//window.alert("¾ÆÀÌµðÆÐ½º¿öµåÃ£±â");
	openWin('/member/find/find_id01.asp','find','100','100','645','250');
}

function MemberJoin()
{
	window.location.href = "/member/MemberJoin/Join_Start.asp";
}

function MemberJoin2()
{
	window.location.href = "/member/MemberJoin/Join_Start.asp";
}

//·Î±×ÀÎÈÄ ¸µÅ©
function MyOffice()
{
	openWin('/MyOffice/main.asp','MyOffice','50','50','645','750');
}

function Login_CkURL(paramVal)
{
		openWin('/MyOffice/main.asp?typ=' + paramVal,'MyOffice','50','50','645','750');
	
}

function go_office(id)
{
	if (id != "")
	{
		openWin('/MyOffice/youroffice.asp?uid=' + id,'YourOffice','10','10','645','750');
	}
}

function go_office_Friend(id,val)
{
	if (id != "")
	{
		openWin('/MyOffice/youroffice.asp?uid=' + id + '&Pos=' + val,'YourOffice','10','10','645','750');
	}
}

function Go_GPShop()
{
	window.location.href="/shop/GPItemShop.asp";
}

function Go_MyMopet()
{
	window.alert("ÁØºñÁßÀÔ´Ï´Ù.");
}

//»ó´Ü GNBLink
function logout() {
		if (window.confirm("·Î±×¾Æ¿ô ÇÏ½Ã°Ú½À´Ï±î?") == false ) return;
		window.location.href="/logout.asp";
}

function login() {
	window.location.href="/login.asp";
}

function charge3(way) {
	openWin2('http://pay.vvvic.com/payment.asp', 'charge','100','100','510','440');
}

function HomeConnect()	{
	window.external.AddFavorite(parent.location.href, document.title);
}

//iframe »çÀÌÁî Á¶Àý¿ë
function resizeFrame(ifr_id,re)
{
	var ifr= document.getElementById(ifr_id) ;
	var innerBody = ifr.contentWindow.document.body;
	var innerHeight = innerBody.scrollHeight + (innerBody.offsetHeight - innerBody.clientHeight);

	if (ifr.style.height != innerHeight)
	{
		ifr.style.height = innerHeight;
	}
}

//########°æ¸Å°ü·Ã##############
function openAuction(ANum)
{
	openWin("./Auction_Bid_List.asp?ANum=" + ANum,"Auction",100,100,550,620);
}

function openAuction2(ANum)
{
	openWin("./Auction_Bid_List2.asp?ANum=" + ANum,"Auction",100,100,550,635);
}

function TenderView(ANum)
{
	openWin("./Tender.asp?ANum=" + ANum,"Auction",100,100,550,640);
}

function TenderView2(ANum)
{
	openWin("./Tender2.asp?ANum=" + ANum,"Auction",100,100,550,640);
}
//########°æ¸Å°ü·Ã##############


function IncludeFlash(Url1,Url2,width,height)
{
	document.write("<OBJECT classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000'  codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,124,0' WIDTH='" + width + "' HEIGHT='" + height + "' id=ShockwaveFlash1><PARAM NAME=movie VALUE='" + Url1 + "'><PARAM NAME='AllowScriptAccess' VALUE='always'><PARAM NAME='quality' VALUE=high><PARAM NAME=bgcolor VALUE=#FFFFFF><PARAM NAME=wmode VALUE=transparent><PARAM NAME=menu VALUE=false><EMBED src='" + Url2 + "' quality=high wmode='transparent' bgcolor=#FFFFFF  WIDTH='" + width + "' HEIGHT='" + height + "' ALIGN='' TYPE='application/x-shockwave-flash' PLUGINSPAGE='http://www.macromedia.com/go/getflashplayer'></EMBED></OBJECT>");

}
	
function IncludeFlashVal(Url1,Url2,Val,width,height)
{
	//document.write("<OBJECT classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='https://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0' WIDTH='" + width + "' HEIGHT='" + height + "' id='window_150125'><PARAM NAME=movie VALUE='" + Url1 + "'><PARAM name=flashvars value='" + Val + "'><PARAM NAME='wmode' VALUE=transparent><PARAM NAME=quality VALUE=high><PARAM NAME=bgcolor VALUE=#FFFFFF><EMBED src='" + Url2 + "' quality=high bgcolor=#FFFFFF  WIDTH='" + width + "' HEIGHT='" + height + "' NAME='window_holder' ALIGN='' TYPE='application/x-shockwave-flash' PLUGINSPAGE='http://www.macromedia.com/go/getflashplayer'></EMBED></OBJECT>");
	document.write("<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,124,0' WIDTH='" + width + "' HEIGHT='" + height + "' id='window_150125'><PARAM name=flashvars value='" + Val + "'><param name='allowScriptAccess' value='always' /><param name='allowFullScreen' value='false' /><PARAM NAME='movie' VALUE='" + Url1 + "'><PARAM NAME='AllowScriptAccess' VALUE='always'><param name='quality' value='high' /><param name='bgcolor' value='#ffffff' /><PARAM NAME='wmode' VALUE='transparent' /><PARAM NAME='menu' VALUE='false' /><embed src='" + Url2 + "' quality='high' bgcolor='#ffffff' WIDTH='" + width + "' HEIGHT='" + height + "' name='window_holder' align='' allowScriptAccess='always' allowFullScreen='false' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' /></object>");
}


function IncludeFlashValColor(Url1,Url2,Val,width,height,color)
{
	document.write("<OBJECT classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,124,0' WIDTH='" + width + "' HEIGHT='" + height + "' id='window_150125'><PARAM NAME=movie VALUE='" + Url1 + "'><PARAM name=flashvars value='" + Val + "'><PARAM NAME='AllowScriptAccess' VALUE='always'><PARAM NAME='wmode' VALUE=transparent><PARAM NAME=quality VALUE=high><PARAM NAME=bgcolor VALUE=#FFFFFF><EMBED src='" + Url2 + "' quality=high bgcolor=" + color + "  WIDTH='" + width + "' HEIGHT='" + height + "' NAME='window_holder' ALIGN='' TYPE='application/x-shockwave-flash' PLUGINSPAGE='http://www.macromedia.com/go/getflashplayer'></EMBED></OBJECT>");
}

function IncludeFlashGame(Url1,Url2,width,height)
{
	document.write("<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,124,0' width='" + width + "' height='" + height + "' id='game' align='middle' VIEWASTEXT><param name='allowScriptAccess' value='always'><param name='movie' value='" + Url1 + "'><PARAM NAME='AllowScriptAccess' VALUE='always'><param name='quality' value='high'><param name='bgcolor' value='#ffffff'><embed src='" + Url2 + "' quality='high' bgcolor='#ffffff' width='" + width + "' height='" + height + "' name='game' align='middle' allowScriptAccess='always' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer'></object>");
}

function ShowOfficeEditBox(logno) {
	window.alert("show");
	try{
		var tagElem = $('tagName_'+logno);
		tagElem.style.display = "none";
		var tagEditElem = $('edit_tagName_'+logno);
		tagEditElem.style.display = "block";
	}catch(e){}
}
function HideOfficeEditBox(logno) {
	try{
		var tagElem = $('tagName_'+logno);
		tagElem.style.display = "block";
		var tagEditElem = $('edit_tagName_'+logno);
		tagEditElem.style.display = "none";
	}catch(e){}
}

function setEmbed() 
{ 
  var obj = new String; 
  var parameter = new String; 
  var embed = new String; 
  var html = new String; 
  var allParameter = new String; 
  var clsid = new String; 
  var codebase = new String; 
  var pluginspace = new String; 
  var embedType = new String; 
  var src = new String; 
  var width = new String; 
  var height = new String; 

    
  this.init = function( getType , s ,w , h ) { 
      
      if ( getType == "flash") 
      { 

        clsid = "D27CDB6E-AE6D-11cf-96B8-444553540000";        
        codebase = "https://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0"; 
        pluginspage = "https://www.macromedia.com/go/getflashplayer"; 
        embedType = "application/x-shockwave-flash"; 
	      parameter += '<param name="movie" value="'+ s + '">\n';
  	    parameter += '<param name="quality" value="high">\n';

      } 
      else if (getType == "wmv") 
      { 
        clsid = "22D6F312-B0F6-11D0-94AB-0080C74C7E95";
        codebase = "http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,5,715"; 
        pluginspage = "http://www.microsoft.com/windows/mediaplayer/download/default.asp"; 
        embedType = "application/x-oleobject"; 
        parameter += '<param name="Filename" value="'+ s + '">\n';

      } 
 			else {}           
      
      src = s; 
      width = w; 
      height = h; 
  } 
  
  this.parameter = function( parm , value ) {      
      parameter += '<param name="'+parm +'" value="'+ value + '">\n';        
      allParameter += ' '+parm + '="'+ value+'"'; 
  }  
  
  this.show = function() { 
      if ( clsid ) 
      { 
        obj = '<object classid="clsid:'+ clsid +'" codebase="'+ codebase +'" width="'+ width +'" height="'+ height +'">\n'; 
      }       
      embed = '<embed src="' + src + '" pluginspage="'+ pluginspage + '" type="'+ embedType + '" width="'+ width + '" height="'+ height +'"'+ allParameter +' ></embed>\n'; 
      
      if ( obj ) 
      { 
        embed += '</object>\n'; 
      } 
      
      html = obj + parameter + embed;       
      document.write( html );  
  } 
  
} 


function PoPResize() 
{ 
    var Dwidth = parseInt(document.body.scrollWidth); 
    var Dheight = parseInt(document.body.scrollHeight); 
    var divEl = document.createElement("div"); 
    divEl.style.position = "absolute"; 
    divEl.style.left = "0px"; 
    divEl.style.top = "0px"; 
    divEl.style.width = "100%"; 
    divEl.style.height = "100%"; 

    document.body.appendChild(divEl); 

    window.resizeBy(Dwidth-divEl.offsetWidth, Dheight-divEl.offsetHeight); 
    document.body.removeChild(divEl); 
} 

function Open_MyGift(id)
{
	//openWin("/MyInfo/gift/MyGift.asp?GameTyp=" + id,"MyGift",100,200,550,530);
	openWin('/MyOffice/main.asp?typ=MYPRESENT','MyOffice','50','50','645','750');

}

function PBuyItem(typ,Code)
{
	if (typ == 'Mopet')
	{
		openWin2("/Shop/PBuyItem.asp?typ=" + typ + "&Code=" + Code ,"Buy",100,100,370,360);
	}else{
		openWin("/Shop/PBuyItem.asp?typ=" + typ + "&Code=" + Code ,"Buy",100,100,360,350);
	}
}


function BuyItem(typ,Code)
{
	if (typ == 'Mopet')
	{
		openWin2("/Shop/BuyItem.asp?typ=" + typ + "&Code=" + Code ,"Buy",100,100,370,360);
	}else{
		openWin("/Shop/BuyItem.asp?typ=" + typ + "&Code=" + Code ,"Buy",100,100,360,350);
	}
}


function setCookie(name, value, expires, path, domain, secure) {
  var curCookie = name + "=" + escape(value) +
    ((expires) ? "; expires=" + expires.toGMTString() : "") +
    ((path) ? "; path=" + path : "") +
    ((domain) ? "; domain=" + domain : "") +
    ((secure) ? "; secure" : "");
  document.cookie = curCookie;
}

function getCookie(name) {
  var dc = document.cookie;
  var prefix = name + "="
  var begin = dc.indexOf("; " + prefix);
  if (begin == -1) {
    begin = dc.indexOf(prefix);
    if (begin != 0) return null;
  } else {
    begin += 2
  }
  var end = document.cookie.indexOf(";", begin);
  if (end == -1) end = dc.length;
  return unescape(dc.substring(begin + prefix.length, end));
}

function openWin(theURL,winname, top, left, width, height)
{
	window.open(theURL,winname, 'top=' +top+ ', left=' +left+ ',Toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no, width=' +width+ ', height=' +height+', resizable=0');
}

function openWin_1(theURL,winname, top, left, width, height)
{
	window.open(theURL,winname, 'top=' +top+ ', left=' +left+ ',Toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no, width=' +width+ ', height=' +height+', resizable=0');
}

function openWin2(theURL,winname, top, left, width, height)
{
	window.open(theURL,winname, 'top=' +top+ ', left=' +left+ ',Toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes, width=' +width+ ', height=' +height+', resizable=0');
}

function openWin3(theURL,winname, top, left, width, height)
{
	window.open(theURL,winname, 'top=' +top+ ', left=' +left+ ',Toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes, width=' +width+ ', height=' +height+', resizable=0');
}

function openWin4(theURL,winname, top, left, width, height)
{
	window.open(theURL,winname, 'top=' +top+ ', left=' +left+ ',Toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=yes, width=' +width+ ', height=' +height+', resizable=0');
}

function openWin_r(theURL,winname, top, left, width, height)
{
	window.open(theURL,winname, 'top=' +top+ ', left=' +left+ ',Toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no, width=' +width+ ', height=' +height+', resizable=1');
}

function openHP(id, bn, c) {
	//alert('ÇöÀç È¨ÇÇ´Â ¼­ºñ½º Á¡°ËÁßÀÔ´Ï´Ù..(¼Ò¿ä½Ã°£20ºÐ)');
	openWin('http://hp.vvvic.zzarit.com/hp2.asp?hpid='+id+'&boardnum='+bn+'&cat='+c,'hp',0,0,940,650)
}
function openFish(id, bn, c) {
	//alert('ÇöÀç È¨ÇÇ´Â ¼­ºñ½º Á¡°ËÁßÀÔ´Ï´Ù..(¼Ò¿ä½Ã°£20ºÐ)');
	openWin('http://hp.vvvic.zzarit.com/hpfish.asp?hpid='+id,0,0,940,650)
}


function checkSentence(usersInput) 
{
			var numberOfWords = 60;
			var chk = true;
			var isProfane = new makeArray(numberOfWords);
			var word = new makeArray(numberOfWords);
			var RetVal = "";
			
			var temp = usersInput;
			temp = temp.toLowerCase();

			word[1] = "shit";
			word[2] = "fuck";
			word[3] = "asshole";
			word[4] = "cunt";
			word[5] = "suck";
			word[6] = "pussy";
			word[7] = "cock";
			word[8] = "cum";
			word[9] = "penis";
			word[10] = "sux";
			word[11] = "dick";
			word[12] = "bitch";
			word[13] = "damn";
			word[14] = "sucker";
			word[15] = "fucker";
			word[16] = "ºù½Å";
			word[17] = "°³»õ³¢";
			word[18] = "°³ÀÚ½Ä";
			word[19] = "°³½¦ÀÌ";
			word[20] = "ÀÌ»õ³¢";
			word[21] = "Àú»õ³¢";
			word[22] = "±×»õ³¢";
			word[23] = "¾¾ÆÈ";
			word[24] = "¾¾¹ß";
			word[25] = "¾¾¹ú";
			word[26] = "½ÃÆÈ";
			word[27] = "½Ã¹ß";
			word[28] = "½Ã¹ú";
			word[29] = "¾¾ºÎ¶ö";
			word[30] = "¾¾ºÎ·²";
			word[31] = "¾Ã";
			word[32] = "½Ê»õ³¢";
			word[33] = "½Ê»õ";
			word[34] = "½Ê½¦ÀÌ";
			word[35] = "18³ð";
			word[36] = "18³Ñ";
			word[37] = "18³â";
			word[38] = "Á¿";
			word[39] = "Á½";
			word[40] = "¹ÌÄ£³ð";
			word[41] = "¹ÌÄ£³Ñ";
			word[42] = "¹ÌÄ£³â";
			word[43] = "¹ÌÄ£»õ³¢";
			word[44] = "º´½Å";
			word[45] = "¿ÀÀÔ";
			word[46] = "¿°º´";
			word[47] = "¿¥º´";
			word[48] = "Áö¶ö";
			word[49] = "¼½½º";
			word[50] = "›ä";
			word[51] = "Á¥ÅÊÀÌ";
			word[52] = "»¡Åë";
			word[53] = "ºü±¸¸®";
			word[54] = "»¡¾Æ";
			word[55] = "ÀÚÁö";
			word[56] = "º¸Áö";
			word[57] = "º¯ÅÂ";
			word[58] = "º¯ ÅÂ";
			word[59] = "º¯,ÅÂ";
			word[60] = "º¯  ÅÂ";


			for (var j = 1; j <= numberOfWords; j++) 
			{
				isProfane[j] = temp.indexOf(word[j]);
			}
	
			for (var j = 1; j <= numberOfWords; j++) 
			{
			   if (isProfane[j] != -1) 
			   {
			      usersInput = "[" + word[j] + "] is a prohibited word. Please refrain from using profanity";
			      j = numberOfWords + 1;
			   }  
			   else 
			   {
				  usersInput="true";	
			   }
			}
      return usersInput;
}


function makeArray(n) {
   this.length = n;
   for (var i = 1; i<=n; i++) {
       this[i] = new String();
   }
   return this;
}

//ÂÊÁö¸¦ º¸³»´Â Ã¢À» ¶ç¿î´Ù
function sendMsg(id) {
	openWin('/MyInfo/msg/msg_write_popup.asp?r_uid=' + id ,'msg' , 50,100,450,400);
}
//Ä£±¸ ½ÅÃ» Ã¢À» ¶ç¿î´Ù
function sendFriend(id)	{
	openWin('/MyInfo/friend/friend_req_popup.asp?ruid=' + id ,'friend' , 50,100,350,320);
}

//°ÔÀÓ ÃÊ±âÈ­¸¦ À§ÇÑ Func ÆË¾÷Ã¢¿¡¼­´Â pop=1, id¿¡´Â °ÔÀÓÀÌ¸§
function Go_Reset_Game(id,pop)
{
	if (window.confirm("ÃÊ±âÈ­¸¦ ÇÏ¸é ÀÌ °ÔÀÓÀÇ ¸ðµç Á¤º¸\n(°æÇèÄ¡, ·¹º§, °ÔÀÓ¸Ó´Ï, ºñÁê¾ÆÀÌÅÛ, °ÔÀÓ¸Ó´Ï ¾ÆÀÌÅÛ, ·©Å·, ÀÌ¸§ µî)\n°¡ »ç¶óÁö°í °ÔÀÓÀ» ´Ù½Ã ½ÃÀÛÇÏ¼Å¾ß ÇÕ´Ï´Ù.\ÃÊ±âÈ­ ÇÏ½Ã°Ú½À´Ï±î?") == true)	{
		if (window.confirm("ÃÊ±âÈ­¸¦ ÇÏ¸é Á¤º¸¸¦ º¹±¸ÇÒ ¼ö ¾ø½À´Ï´Ù.\nÁ¤¸» ÃÊ±âÈ­ ÇÏ±æ ¿øÇÏ½Ê´Ï±î?") == true)	{
			window.parent.parent.location.href="/game2/game_reset.asp?Typ=" + id + "&Pop=" + pop;
		}else{
			return;
		}
	}else	{
		return;
	}
}

//¼±¹°ÇÏ±â¸¦ ´©¸£¸é ¾È³»¸¸ ÇÑ´Ù	
function sendPres(){
	alert('¾ÆÀÌÅÛ¼¥¿¡¼­ ±¸ÀÔÇÏ¼Å¾ß ÇÕ´Ï´Ù.\nºñÁê ¼±¹°Àº ¸ÞÀÎÈ­¸éÀÇ ºñÁê¼±¹° ¹öÆ°À» ÀÌ¿ëÇÏ¼¼¿ä^^');
}

function OSCheck(nWidth,nHeight)
{	

	var strAgent = navigator.userAgent.toLowerCase();
	var bIE = (strAgent.indexOf("msie") != -1);
	var bXP = (strAgent.indexOf("nt 5.1") != -1);
	var bIE7 = (strAgent.indexOf("msie 7.0") != -1);
	var bSafari = (strAgent.indexOf("konqueror") != -1 || strAgent.indexOf("safari") != -1);
	var bFirefox = (strAgent.indexOf("firefox")!= -1);
	window.resizeTo(nWidth, nHeight + (bXP ? (bIE7 ? 75: 45) : 0));
}
