



function gameFlashdcr(divid, flash_src,swf_width,swf_height)
{


	HtmlTag = '<OBJECT classid="clsid:166B1BCA-3F9C-11CF-8075-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/director/sw.cab#version=8,5,0,0" width="'+swf_width+'" height="'+swf_height+'">';

	HtmlTag = HtmlTag + '<PARAM name="swStretchStyle" value="fill">	';
	HtmlTag = HtmlTag + '<PARAM name="src" value="'+flash_src+'">';
	HtmlTag = HtmlTag + '<EMBED src="'+flash_src+'" swStretchStyle="fill" PLUGINSPAGE="http://www.macromedia.com/shockwave/download/"  width="'+swf_width+'" height="'+swf_height+'"></EMBED>';

	HtmlTag = HtmlTag + '</OBJECT>';

	/*document.getElementById(divid).innerHTML = HtmlTag;*/

	var aHTML = [];

	aHTML.push(HtmlTag);

	document.getElementById(divid).innerHTML = aHTML.join("");
	

}


/*
ÇÃ·¡½Ã °ÔÀÓ
wmode : window , opaque, transparent
*/

function gameFlash(divid, flash_src,swf_width,swf_height,param_wmode,param_acess,param_network)
{
	if(param_wmode == null) param_wmode = "transparent";
	if(param_acess == null) param_acess = "always"; // always Çã¿ë, never ºÒ°¡, samedomain ÇØ´çµµ¸ÞÀÎ¸¸
	if(param_network == null) param_network = "all"; // all Çã¿ë internal ºÒ°¡
 
	HtmlTag = "<object  id=\'" + flash_src + swf_width + swf_height + "\' type=\'application/x-shockwave-flash\' classid=\'clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\' codebase=\'http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,28,0\' width=\'" + swf_width + "\' height=\'" + swf_height + "\'>";
	HtmlTag = HtmlTag + "<param name=\'allowScriptAccess\' value=\'" + param_acess + "\' />";
	HtmlTag = HtmlTag + "<param name=\'quality\' value=\'high\' />";
	HtmlTag = HtmlTag + "<param name=\'allowNetworking\' value=\'" + param_network + "\' />";
	HtmlTag = HtmlTag + "<param name=\'movie\' value=\'" + flash_src + "\' />";
	HtmlTag = HtmlTag + "<param name=\'wmode\' value=\'" + param_wmode +"\' />";
	HtmlTag = HtmlTag + "<embed src=\'" + flash_src + "\' width=\'" + swf_width + "\' height=\'" + swf_height + "\' allowScriptAccess=\'" + param_acess + "\' allowNetworking=\'" + param_network + "\' wmode=\'" + param_wmode + "\'></embed>";
	HtmlTag = HtmlTag + "</object>";


	/*document.getElementById(divid).innerHTML = HtmlTag;*/

	var aHTML = [];

	aHTML.push(HtmlTag);

	document.getElementById(divid).innerHTML = aHTML.join("");
		
}


function inner_html_tag(divid, tag, op)
{

	
	var aHTML = [];

	aHTML.push(tag);

	

	if(op){
		document.getElementById(divid).innerHTML += aHTML.join("");
	}else{
		document.getElementById(divid).innerHTML = aHTML.join("");
	}

}




function gameFlash_frame(divid, flash_src,swf_width,swf_height,file_type){

	var HtmlTag = '<iframe width="'+swf_width+'" height="'+swf_height+'" src="/System/html/iframe/play_game.html.php?src='+flash_src+'&width='+swf_width+'&height='+swf_height+'&file_type='+file_type+'" frameborder="0" scrolling="no"></iframe>';

	/*document.getElementById(divid).innerHTML = HtmlTag;*/


	var aHTML = [];

	aHTML.push(HtmlTag);

	document.getElementById(divid).innerHTML = aHTML.join("");

}




/*
ÇÃ·¡½Ã
wmode : window , opaque, transparent
*/

function PrintFlash(flash_src,swf_width,swf_height,param_wmode,param_acess)
{
	if(param_wmode == null) param_wmode = "transparent";
	if(param_acess == null) param_acess = "always";
 
	HtmlTag = "<object  id=\'" + flash_src + swf_width + swf_height + "\' type=\'application/x-shockwave-flash\' classid=\'clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\' codebase=\'http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,28,0\' width=\'" + swf_width + "\' height=\'" + swf_height + "\'>";
	HtmlTag = HtmlTag + "<param name=\'allowScriptAccess\' value=\'" + param_acess + "\' />";
	HtmlTag = HtmlTag + "<param name=\'quality\' value=\'high\' />";
	HtmlTag = HtmlTag + "<param name=\'movie\' value=\'" + flash_src + "\' />";
	HtmlTag = HtmlTag + "<param name=\'wmode\' value=\'" + param_wmode +"\' />";
	HtmlTag = HtmlTag + "<embed src=\'" + flash_src + "\' width=\'" + swf_width + "\' height=\'" + swf_height + "\' allowScriptAccess=\'" + param_acess + "\' wmode=\'" + param_wmode + "\'></embed>";
	HtmlTag = HtmlTag + "</object>";
	document.write(HtmlTag);
}


/*
ÇÃ·¡½Ã
wmode : window , opaque, transparent
*/

function PrintFlash_innerhtml(divid, flash_src,swf_width,swf_height,param_wmode,param_acess)
{
	if(param_wmode == null) param_wmode = "transparent";
	if(param_acess == null) param_acess = "always";
 
	HtmlTag = "<object  id=\'" + flash_src + swf_width + swf_height + "\' type=\'application/x-shockwave-flash\' classid=\'clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\' codebase=\'http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,28,0\' width=\'" + swf_width + "\' height=\'" + swf_height + "\'>";
	HtmlTag = HtmlTag + "<param name=\'allowScriptAccess\' value=\'" + param_acess + "\' />";
	HtmlTag = HtmlTag + "<param name=\'quality\' value=\'high\' />";
	HtmlTag = HtmlTag + "<param name=\'movie\' value=\'" + flash_src + "\' />";
	HtmlTag = HtmlTag + "<param name=\'wmode\' value=\'" + param_wmode +"\' />";
	HtmlTag = HtmlTag + "<embed src=\'" + flash_src + "\' width=\'" + swf_width + "\' height=\'" + swf_height + "\' allowScriptAccess=\'" + param_acess + "\' wmode=\'" + param_wmode + "\'></embed>";
	HtmlTag = HtmlTag + "</object>";
	
	/*document.getElementById(divid).innerHTML = HtmlTag;*/


	var aHTML = [];

	aHTML.push(HtmlTag);

	document.getElementById(divid).innerHTML = aHTML.join("");

}



/*ÀÌ¹ÌÁöÃ¢ ¶ç¿ì±â */
function imgWin(ref,src,w,h) 
{

	var scroll;
	ref = ref+'/popwin/image_view.html.php?src='+src+'&width='+w+'&height='+h+'';
	
	if(h >= 740) {
		h = 740;
		scroll = "yes";
	}

	var window_left = (screen.width-w)/2;
	var window_top = (screen.height-h)/2-50;

	var openwin = window.open(ref,"imgWin",'width='+w+',height='+h+', resizable=no, scrollbars='+scroll+', status=no, top=' + window_top + ',left=' + window_left + '');

	openwin.focus();
}

/*°ÔÀÓ¸Þ´º, °ÔÀÓ¾÷·Îµå ÂÊ*/
function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}

/*·Î±×ÀÎ È­¸éÀ¸·Î*/
function jumplogin(ref) 
{
	if (confirm("·Î±×ÀÎ ÇÏ½Ã°Ú½À´Ï±î?"))
		parent.location.href=ref;

}

/* ½Å°í */
function bad_replay_add(cgroup, board_name, replay_table, uniq_id)
{

proc.location.href = '/System/html/iframe/bad_reply_add.proc.php?bid='+uniq_id+'&cgroup='+cgroup+'&board_name='+board_name+'&replay_table='+replay_table;



}

/* ½Å°íÇÏ±âÃ¢ ¶ç¿ì±â */
function complainWin(ref,type,id) 
{
	var window_left = (screen.width-800)/2;
	var window_top = (screen.height-600)/2;
	var ref = ref+ "/popwin/complain.html.php?id="+id+"&type="+type;
	var openwin = window.open(ref,"complainWin",'width=460,height=300, resizable=$resize, status=no, top=' + window_top + ',left=' + window_left + '');
	openwin.focus();
}



/* ÀÏ¹Ý Ã¢ ¶ç¿ì±â  460*300 */
function PopWin(Win_name,ref) 
{
	var window_left = (screen.width-800)/2;
	var window_top = (screen.height-600)/2;
	var openwin = window.open(ref,Win_name,'width=460,height=300, resizable=no, status=no, top=' + window_top + ',left=' + window_left + '');
	openwin.focus();
}

/* ÀÏ¹Ý Ã¢ ¶ç¿ì±â */
function PopWin2(Win_name,ref, width, height, left, top)
{
	if(left == null) {
		var window_left = (screen.width-800)/2;
	} else {
		var window_left = left;
	}

	if(top == null) {
		var window_top = (screen.height-800)/2;
	} else {
		var window_top = top;
	}
	
	var openwin = window.open(ref,Win_name,'width='+width+',height='+height+', resizable=no, status=no, top=' + window_top + ',left=' + window_left + '');
	openwin.focus();
}




/* »èÁ¦ ÇÒ²¸? */

function goDel(ref,comment) 
{

	if(confirm(comment)) location.href=ref;

}


/* url ·Î ÇØ´çÆäÀÌÁö¿¡¼­ »Ñ·ÁÁÖ´Â°ªÀ»°¡Á®¿Â´Ù*/
function getHttprequest(URL) {
	var xmlhttp = null;
	if(window.XMLHttpRequest) {
		xmlhttp = new XMLHttpRequest();
	} else {
		xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
	}
	xmlhttp.open('GET', URL,false);
	xmlhttp.onreadystatechange = function() {
		if(xmlhttp.readyState==4 && xmlhttp.status == 200 && xmlhttp.statusText=='OK') {
			responseText = xmlhttp.responseText;
		}
	}
	xmlhttp.send('');
	return responseText = xmlhttp.responseText;
}


/* ¹®ÀÚ¿­ °ø¹éÀ» ¸ðµÎ ¾ø¾Û´Ï´Ù.*/
function Space_All(str)
{
  var index, len
           
  while(true)
  {
   index = str.indexOf(" ")
   // °ø¹éÀÌ ¾øÀ¸¸é Á¾·áÇÕ´Ï´Ù.
   if (index == -1) break
   // ¹®ÀÚ¿­ ±æÀÌ¸¦ ±¸ÇÕ´Ï´Ù.
   len = str.length
   // °ø¹éÀ» Àß¶ó³À´Ï´Ù.
   str = str.substring(0, index) + str.substring((index+1),len)
  }
   
  return str;
}

/*±âÁØ ³¯Â¥ºÎÅÍ ´õÇÏ±â »©±â*/
function getNextWeek(v,t,join_m){ //³¯Â¥½ºÆ®¸µ°ú, ÀÏÂ÷¸¦ ÆÄ¶ó¸ÞÅÍ·Î ¹Þ´Â´Ù
  var str=new Array(); //¹è¿­
  var date_array=v.split(join_m); //³¯Â¥¸¦ - ±¸ºÐÀÚ·Î ³ª´©¾î ¹è¿­·Î º¯È¯
  var new_date=new Date(date_array[0],date_array[1]-1,date_array[2]); //µ¥ÀÌÆ®°´Ã¼ »ý¼º
  var next_date=new_date.valueOf()+1000*60*60*24*t; //tÀÏÈÄ, (À½¼ö¸é ÀüÀÏ)ÀÇ Å¸ÀÓ½ºÅÆÇÁ¸¦ ¾ò´Â´Ù
  var last_date=new Date(next_date); //ÀÇ·ÚÇÑ³¯ÀÇ µ¥ÀÌÆ®°´Ã¼ »ý¼º
 
  var year = last_date.getYear(); //³â
  var year = ""+year;

  if(year.substring(0,2) == '10'){//ÆÄÀÌ¾îÆø½º¿¡¼± 2009³âÀÌ 109³âÀ¸·Î ³ª¿Â´Ù ÀÓ½Ã·Î Àû¿ëÇß´Ù
	year = '200'+year.substring(2,3);
  }

  var month = last_date.getMonth()+1; //¿ù
  if(month < 10)month = '0'+month;
  var day = last_date.getDate(); //ÀÏ
   if(day < 10)day = '0'+day;

  var return_value = year + join_m +  month + join_m + day;

  return return_value;
}













/*¿ìÃø ¿À´ÃÇÑ°ÔÀÓ*/
today_game_play_num = 0;

var today_game_play_display;

function today_game_play(num){
	
	if(today_game_play_display == 'off')return;

	var data = getHttprequest('/System/gameangel/today_game_play.proc.php?start='+num);

	if(data.length <5)return;//µ¥ÀÌÅ¸°¡ ¾ø´Ù

	document.getElementById('today_game_play_content').innerHTML = data;	
	today_game_play_num = num;
}

/*today_game_play(today_game_play_num);*/

/*rss »õÃ¢¸µÅ©*/
function win_blank(url){
	window.open(url,'_blank');
}


function confirm_go(msg, url){

	var q = confirm(msg);

	if(q == true){
		location.href = url;
	}

}




function IsNumber(num) {
	for(var i = 0; i < num.length; i++) {
		var chr = num.substr(i,1);
		if(chr < '0' || chr > '9') {            
			return false;
		}
   }

	return true;

}

/*±ÛÀÚ ¼ö Á¦ÇÑ*/
function word100(form,count,name,msg)
{
	var cnts_length = eval("form."+name+".value.length;");

	eval("cnts_letter.innerHTML = '<b>' + cnts_length + '</b>';");

	if (cnts_length >= count)
	{
		alert(msg+" ±ÛÀº "+count+"ÀÚ±îÁö¸¸ ÀÔ·ÂÇÒ ¼ö ÀÖ½À´Ï´Ù.");
		eval("form."+name+".value = form."+name+".value.substring(0, "+count+");");
		eval("cnts_letter.innerHTML = '<b>' + form."+name+".value.length + '</b>';");
		eval("form."+name+".focus();");
		return false;
	}

}

/*  ÀÌ¹ÌÁö ¾÷·Îµå Àü¿¡ ½æ³×ÀÏ ÀÌ¹ÌÁö º¸±â */
function AddFile()
{
	var objTbl = document.all["tblAttFiles"];
	var objRow = objTbl.insertRow();
	var objCell = objRow.insertCell();

	objCell.innerHTML =
  "<img width=120 src='<?=$img_dir?>/img_blank_120x90.gif'>" +
  "<input type=file onChange='CkImageVal()' name=capture>";
	document.recalc();
}

function CkImageVal() {

	var oInput = event.srcElement;
	var fname = oInput.value;

	if((/(.jpg|.jpeg|.gif|.png)$/i).test(fname))
	  oInput.parentElement.children[0].src = fname;
	else
		alert('ÀÌ¹ÌÁö´Â gif, jpg, png ÆÄÀÏ¸¸ °¡´ÉÇÕ´Ï´Ù.');

}

//¿ìÆí¹øÈ£ ÆË¾÷ : ref:°æ·Î, form:ºÎ¸ðÆû, input_zipcode:ÀÔ·ÂÇÒ ºÎ¸ðÀÇ ¿ìÆí¹øÈ£ ÆûÀÌ¸§, input_addr:ÀÔ·ÂÇÒ ºÎ¸ðÀÇ ÁÖ¼Ò ÆûÀÌ¸§
function ZipWindow(ref,form,input_zipcode,input_addr) {
	var window_left = (screen.width-640)/2;
	var window_top = (screen.height-480)/2;
	ref = ref + "?input_zipcode=" + input_zipcode + "&opener_form=" + form + "&input_addr=" + input_addr;      
	window.open(ref,"zipWin",'width=460,height=300,status=no,top=' + window_top + ',left=' + window_left + '');
}

//¾ÆÀÌµð°Ë»ö ÆË¾÷ : ref:°æ·Î, form:ºÎ¸ðÆû, input_id_checked: °ËÁõµÈ ¾ÆÀÌµð Æû
function IDWindow(ref,form,input_id_checked) {
	var window_left = (screen.width-320)/2;
	var window_top = (screen.height-240)/2;
	ref = ref + "?input_id_checked=" + input_id_checked + "&opener_form=" + form;      
	window.open(ref,"idWin",'width=460,height=300,status=no,top=' + window_top + ',left=' + window_left + '');
}

/* ÆäÀÌÁö ¸Ç À§·Î */
function pageTop()
{
	document.documentElement('body').scrollTop = 0;

/*alert(document.documentElement.scrollTop);*/

}












var new_pocket_start;
/*Æ÷ÄÏ¿¡¼­È£ÃâÀº parent ÀÌ´Ù*/
var pocket_target = 'self';

function new_pocket_start_add(num){

	/*if(num == 4)num = 221;*/
	
	new_pocket_start = num;

	new_upndown_div();

}


/*ÇÏ´Ü Æ÷ÄÏ·¹ÀÌ¾îÅ©±âÁ¶Àý*/
function new_upndown_div() {
	
	/*flash_game_new_pocket_layer Æ÷ÄÏ·¹ÀÌ¾î¿¡ ÅÂ±×°¡ ¾ø´Ù´Â¶æ*/
	if(pocket_target == 'self' && !document.getElementById("flash_game_new_pocket_layer").innerHTML){

		inner_html_tag('flash_game_new_pocket_layer', '<iframe width="890" height="221" marginheight="0" marginwidth="0" scrolling="no" frameborder="0" src="/System/html/iframe/pocket.html"></iframe>');
	}
	
	flash_game_new_pocket_layer_tag_state = 'yes';

	if(pocket_target == 'self'){
		var now_botom = parseInt(document.getElementById("flash_game_new_pocket_layer").style.bottom.replace('px',''));
	}else if(pocket_target == 'parent'){
		var now_botom = parseInt(parent.document.getElementById("flash_game_new_pocket_layer").style.bottom.replace('px',''));
	}

	var plau_num = 18;
	
	var now_num;

	var tid;


	/*¿Ã¸®±â*/
	if(now_botom < new_pocket_start){

		  if(new_pocket_start-now_botom < 100)plau_num = 12;
		  if(new_pocket_start-now_botom < 50)plau_num = 6;
		  if(new_pocket_start-now_botom < 20)plau_num = 3;
		  if(new_pocket_start-now_botom < 10)plau_num = 1;

		  now_num = now_botom+plau_num;
		
		

		  


	 	  if(pocket_target == 'self'){
			  document.getElementById("flash_game_new_pocket_layer").style.bottom = now_num+'px';
		  }else if(pocket_target == 'parent'){
			  parent.document.getElementById("flash_game_new_pocket_layer").style.bottom = now_num+'px';
		  }


		  tid=setTimeout(new_upndown_div,1); //1ÃÊÈÄ aÇÔ¼ö ½ÇÇà - Àç±ÍÈ£Ãâ
		
	/*³»¸®±â*/
	}else if(now_botom > new_pocket_start){
		  
/*alert(new_pocket_start+now_botom);*/
		  /*
		  if(new_pocket_start+now_botom > -200){
			  plau_num = 12;
		  }else if(new_pocket_start+now_botom > -300){
			  plau_num = 6;
		  }else if(new_pocket_start+now_botom > -400){
			  plau_num = 3;
		  }else if(new_pocket_start+now_botom > -500){
			  plau_num = 1;		 
		  }
		  */
			
		  if(new_pocket_start+now_botom > 100){
			  plau_num = 5;
		  }else if(new_pocket_start+now_botom > 50){
			  plau_num = 3;
		  }else if(new_pocket_start+now_botom > 20){
			  plau_num = 2;
		  }else if(new_pocket_start+now_botom > 10){
			  plau_num = 1;		 
		  }
		  
		  

		  now_num = now_botom-plau_num;
		
		

	 	  if(pocket_target == 'self'){
			  document.getElementById("flash_game_new_pocket_layer").style.bottom = now_num+'px';
		  }else if(pocket_target == 'parent'){
			  parent.document.getElementById("flash_game_new_pocket_layer").style.bottom = now_num+'px';
		  }

		  tid=setTimeout(new_upndown_div,1); //1ÃÊÈÄ aÇÔ¼ö ½ÇÇà - Àç±ÍÈ£Ãâ

	/*¿Ï·á*/
	}else{
		clearTimeout(tid);
	}


	
	
}









/*¿ìÃø ¿À´ÃÇÑ°ÔÀÓ ¸®½ºÆ®*/
var today_play_fgames_now_num = 0;
var today_play_view_num = 3;//º¸¿©ÁÙ°¹¼ö

function today_play_fgames(num){



if(num < 0)return;

var my_play_fgame_data = getCookie('my_play_fgame');
var my_play_fgame_data_array = new Array();
var tag = '';
var limit_num;

if(my_play_fgame_data){

	my_play_fgame_data = unescape(my_play_fgame_data);

	my_play_fgame_data_array = my_play_fgame_data.split(',');
	my_play_fgame_data_array = my_play_fgame_data_array.reverse();//¿ª¼øÀ¸·Î º¯°æ

	var my_play_fgame_data_array_count = my_play_fgame_data_array.length-1;
	
	if(num > my_play_fgame_data_array_count)return;


	if(num){
		limit_num = num;
	}else{
		limit_num = 0;
	}

	var count = limit_num+today_play_view_num;


	for(i=limit_num; i < count; i++){
		if(my_play_fgame_data_array[i]){


			/*list(cgroup, uid, capture, cid, title)*/
			this_game = 	my_play_fgame_data_array[i].split('::');
			
			/* " ¸¦ ¸ðµÎ Á¦°ÅÇÑ´Ù*/
			this_game[4]=this_game[4].replace(/\"/g, ""); 

			if(this_game[0] == 'game_self'){
				tag += '<a href="http://fg.gameangel.com/'+this_game[3]+this_game[1]+'"><img src="http://img.gameangel.com/fg/game/no_image.gif" width="70" height="53" alt="'+this_game[4]+'" style="margin-top:3px; border:1px solid #000000;" /></a>';
			}else{
				tag += '<a href="http://fg.gameangel.com/'+this_game[3]+this_game[1]+'"><img src="http://img.gameangel.com/@files/capture/'+this_game[0]+'/home_'+this_game[2]+'" width="70" height="53" alt="'+this_game[4]+'" style="margin-top:3px; border:1px solid #000000;" /></a>';
			}


		}	
	}
	

	today_play_fgames_now_num = num;

}


var aHTML = [];

aHTML.push(tag);

document.getElementById("today_play_fgames_list").innerHTML = aHTML.join("");

}
