﻿function Go_Daum()
{
	window.location.href="http://www.daum.net";
}
	
function Go_Kids()
{
	window.location.href = "http://kids.daum.net/";
}

function Go_Tycoon()
{
	window.location.href = "http://rich.kids.daum.net/tycoon/";
}

function Go_game_Daum()
{
	parent.location.href="http://www.daum.net";
}
	
function Go_game_Kids()
{
	parent.location.href = "http://kids.daum.net/";
}

function Go_game_Tycoon()
{
	parent.location.href = "http://rich.kids.daum.net/tycoon/";
}




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 BuyItem(typ,Code)
{
	if (make_msg("상점 처리")!=false)
	{
		openWin("http://rich.kids.daum.net/tycoon/pop/BuyItem.asp?typ=" + typ + "&Code=" + Code ,"Buy",100,100,360,350);
	}
}

/*
function OSCheck(width,height)
{	
	webblasare=navigator.appVersion;
	
	if (webblasare.indexOf("Windows NT 5.1")!=-1) 
	{
		window.resizeTo(width,height);
		//document.write(width + ";" + height);
	}
	else
	{
		window.resizeTo(width,(height-20));
		//document.write(width + ";" + height);
	}
}

*/
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));
}
function IncludeFlash(Url1,Url2,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=ShockwaveFlash1><PARAM NAME=movie VALUE='" + Url1 + "'><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 + "' 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='wmode' value='transparent'><PARAM name=flashvars value='" + Val + "'><param name='allowScriptAccess' value='always' /><param name='allowFullScreen' value='false' /><PARAM NAME='movie' VALUE='" + Url1 + "'><param name='quality' value='high' /><PARAM NAME='wmode' VALUE'=transparent' /><PARAM NAME='menu' VALUE='false' /><embed src='" + Url2 + "' quality='high' WIDTH='" + width + "' HEIGHT='" + height + "' name='window_holder' align='' allowScriptAccess='always' allowFullScreen='false' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' wmode='transparent'/></object>");
}


function IncludeFlashValColor(Url1,Url2,Val,width,height,color)
{
	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=" + 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='https://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0' width='" + width + "' height='" + height + "' id='game' align='middle' VIEWASTEXT><param name='allowScriptAccess' value='sameDomain'><param name='movie' value='" + Url1 + "'><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='sameDomain' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer'></object>");
}


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 goto(t) {
		if (t.substr(0, 10) == 'http://hp.'){
			openWin(t, 'hp',0,0, 960, 710);
		} else if (t.substr(0,10) == 'http://clu') {
			self.location.href=t;
		} else if (t.substr(0,10) == 'http://sup') {
			self.location.href=t;
		}
	}

function openWin(theURL,winname, top, left, width, height)
{
	if (make_msg("팝업창 요청" )!=false)
	{
		var newwin = 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');
		newwin.focus();
	}
}

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)
{
	var newwin= 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');
	newwin.focus();
}

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 openAlert(str) {
	alert(str);
}

var numberOfWords = 60;
var chk = true;
var isProfane = new makeArray(numberOfWords);
var word = new makeArray(numberOfWords);
function checkSentence(usersInput) {
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) {
      alert("\'"+word[j]+"\'는(은) 쓸 수 없는 말입니다.");
	  usersInput=false;	
	  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;
}

//게임 초기화를 위한 Func 팝업창에서는 pop=1, id에는 게임이름
function Go_Reset_Game(id)
{
	if (make_msg("초기화 요청")!=false)
	{
		if (window.confirm("초기화를 하면 이 게임의 모든 정보\n(경험치, 레벨, 게임머니, 아이템, 랭킹, 이름 등)\n가 사라지고 게임을 다시 시작하셔야 합니다.\초기화 하시겠습니까?") == true)	{
			if (window.confirm("초기화를 하면 정보를 복구할 수 없습니다.\n정말 초기화 하길 원하십니까?") == true)	{
				window.parent.parent.location.href="http://rich.kids.daum.net/tycoon/game2/game_reset.jsp?gameTyp=" + id ;

			}else{
				return;
			}
		}else	{
			return;
		}
	}
}

function go_game(id)
{
	if (make_msg("이동 요청")!=false)
	{
		//게임하기
		if (id == 'food')
		{
			window.open("http://rich.kids.daum.net/tycoon/game2/FoodShop3/gamemain.jsp","vvvpop","scrollbars=no,fullscreen=yes");
		}
		else if (id == 'rich')
		{
			window.open("http://rich.kids.daum.net/tycoon/game2/richOfDirt2/gamemain.jsp","vvvpop","scrollbars=no,fullscreen=yes");
		}
		else if (id == 'flower')
		{
		   window.open("http://rich.kids.daum.net/tycoon/game2/flower/main.jsp","vvvpop","scrollbars=no,fullscreen=yes");
		}
		else
		{
			return;
		}
	}
}

function go_game_exp(id)
{
	if (make_msg("맛보기")!=false)
	{
		//게임맛보기
		if (id == 'food')
		{
			window.open("http://rich.kids.daum.net/tycoon/game2/FoodShop3/foodshop_exp.jsp","vvvpop","scrollbars=no,fullscreen=yes");
		}
		else if (id == 'rich')
		{
			window.open("http://rich.kids.daum.net/tycoon/game2/richOfDirt2/dirt_exp.jsp","vvvpop","scrollbars=no,fullscreen=yes");
		}
		else if (id == 'flower')
		{
			window.open("http://rich.kids.daum.net/tycoon/game2/flower/main_demo.jsp","vvvpop","scrollbars=no,fullscreen=yes");			
		}
		else
		{
			return;
		}
	}
}

function go_help(id)
{
	if (make_msg("설명")!=false)
	{
		//설명하기
		if (id == 'rich')
		{
			openWin("http://rich.kids.daum.net/tycoon/game2/richOfDirt2/dirt_tutorial.jsp","vvvpop", 30, 100, 740, 650);
		}
		else if (id == 'food')
		{
			openWin("http://rich.kids.daum.net/tycoon/game2/FoodShop3/foodshop_tutorial.jsp","vvvpop", 30, 100, 820, 660);
		}
		else if (id == 'flower')
		{
			openWin("http://rich.kids.daum.net/tycoon/game2/flower/flower_tutorial.jsp","vvvpop", 30, 100, 820, 660);			
		}
		else
		{
			return;
		}
	}
}

function setPng24(obj) 
{
    obj.width=obj.height=1;
    obj.className=obj.className.replace(/\bpng24\b/i,'');
    obj.style.filter =
    "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+ obj.src +"',sizingMethod='image');"
    obj.src=''; 
    return '';
}


function PageCheck(chkval)
{
	if(chkval=="undefined")
	{
		document.all["main"].src="./doc/BuyView.jsp";
	}
	else if(chkval==1)
	{
		document.all["main"].src="./doc/Checkparam.jsp";
	}
	else if(chkval==2)
	{
		document.all["main"].src="./doc/Data_Process.jsp";
	}
	else if(chkval==3)
	{
		document.all["main"].src="./doc/Char_view.jsp";
	}
	else if(chkval==4)
	{
		document.all["main"].src="./doc/flow_load.jsp";
	}
	else if(chkval==5)
	{
		document.all["main"].src="./doc/Level_Chk.jsp";
	}
	else if(chkval==6)
	{
		document.all["main"].src="./doc/Flower_Chk.jsp";
	}
	else if(chkval==7)
	{
		document.all["main"].src="./doc/Money_Chk.jsp";
	}
	else if(chkval==8)
	{
		document.all["main"].src="./doc/Game_Sa.jsp";
	}
	else if(chkval==9)
	{
		document.all["main"].src="./doc/Req_Chk.jsp";
	}
	else if(chkval==10)
	{
		document.all["main"].src="./doc/intro_Load.jsp";
	}
}

	//광장, 개념충전소 이동메뉴
	function go_sub(id)
	{
		if (make_msg("페이지 이동 요청")!=false)
		{
			if (id == 'tycoon')
			{
				window.parent.location.href="http://rich.kids.daum.net/tycoon/rich_charge.jsp";
			}
			else if (id == 'character')
			{
				window.parent.location.href="http://rich.kids.daum.net/tycoon/rich_charge_character.jsp";
			}
			else if (id == 'tutor')
			{
				//window.location.href="./rich_charge_tutor.jsp";
				openWin("http://rich.kids.daum.net/tycoon/game_tutorial.jsp", "rich_popup", 50,120,978,640);
			}
			else if (id == 'each')
			{
				window.parent.location.href="http://rich.kids.daum.net/tycoon/rich_charge_each.jsp";
			}
			else if (id == 'faq')
			{
				window.parent.location.href="http://bbs.kids.daum.net/gaia/do/kids/cp/tycoon/faq/list?bbsId=k202";
			}
			else if (id == 'notice')
			{
				window.parent.location.href="http://bbs.kids.daum.net/gaia/do/kids/cp/tycoon/notice/list?bbsId=k201";
			}
			else if (id == 'daily')
			{
				window.parent.location.href="http://rich.kids.daum.net/tycoon/rich_plaza_daily.jsp";
			}
			else if (id == 'success')
			{
				window.parent.location.href="http://bbs.kids.daum.net/gaia/do/kids/cp/tycoon/story/list?bbsId=k203";
			}
			else if (id == 'qna')
			{
				window.parent.location.href="http://bbs.kids.daum.net/gaia/do/kids/cp/tycoon/qna/list?bbsId=k204";
			}
			else if (id == 'mygame')
			{
				window.parent.location.href="http://bbs.kids.daum.net/gaia/do/kids/cp/tycoon/mygame/list?bbsId=k205";
			}
			else if (id == 'rank')
			{
				window.parent.location.href="http://rich.kids.daum.net/tycoon/rich_plaza_rank.jsp";
			}
			else
			{
				return;
			}
		}
	}
	
	function go_main()
	{
		if (make_msg("메인으로 이동")!=false)
		{
			window.parent.location.href="http://rich.kids.daum.net/tycoon/main.jsp";
		}
	}
	
	function go_shop()
	{
		if (make_msg("주사위 샵")!=false)
		{
			//주사위샵
			openWin("http://rich.kids.daum.net/tycoon/pop/diceshop.jsp", "rich_popup", 50,280,610,603);
		}
	}

	function go_bank()
	{
		if (make_msg("은행")!=false)
		{
			//은행
			openWin("http://rich.kids.daum.net/tycoon/pop/bankmain.jsp", "rich_popup", 50,280,610,603);
		}
	}

	function go_plaza()
	{
		if (make_msg("광장")!=false)
		{
			//window.parent.location.href="http://rich.kids.daum.net/tycoon/rich_plaza.jsp";
			go_sub('notice');
		}
	}

	function go_tycoon()
	{
		if (make_msg("타이쿤 게임")!=false)
		{
			window.parent.location.href="http://rich.kids.daum.net/tycoon/index.jsp";
		}		
	}

	function go_charge()
	{
		if (make_msg("개념 충전소")!=false)
		{
			window.parent.location.href="http://rich.kids.daum.net/tycoon/rich_charge.jsp";
		}		
	}

	function go_diary()
	{
		if (make_msg("다이어리")!=false)
		{
			window.parent.location.href="http://rich.kids.daum.net/tycoon/index.jsp";
		}		
	}

	function make_msg(id)
	{
		try{
			if (document.msg.msgview(id)!=false)
			{
				return true;
			}
		}
		catch(e)
		{
			return true;
		}
	}

	function make_msg2(id)
	{
		make_msg(id);
	}