function setCookie(name, value, expiredays) {
	var todayDate = new Date();
	todayDate.setDate( todayDate.getDate() + expiredays );
	document.cookie = name + "=" + escape( value ) + "; path=/; expires=" + todayDate.toGMTString() + ";"
}

function getCookie(name) {
var nameOfCookie = name + "=";
var x = 0;
	while ( x <= document.cookie.length )
	{
		var y = (x+nameOfCookie.length);
		if ( document.cookie.substring( x, y ) == nameOfCookie ) {
		if ( (endOfCookie=document.cookie.indexOf( ";", y )) == -1 )
		endOfCookie = document.cookie.length;
		return unescape( document.cookie.substring( y, endOfCookie ) );
	}
	x = document.cookie.indexOf( " ", x ) + 1;
	if ( x == 0 )
		break;
	}
	return "";
}

function openwin(pUrl,pName,pScroll,pWidth,pHeight,pLeft,pTop)
{
	newwin = window.open(pUrl,pName,"width="+pWidth+", height="+pHeight+", left="+pLeft+", top="+pTop+", scrollbars="+pScroll+", toolbars=no, status=no");
	newwin.focus();
}
function myTrim(str){
	str = str.replace(/\s/g,"");
	return str;
}
function isnum(NUM){
	for(var i=0;i<NUM.length;i++)
	{
		achar = NUM.substring(i,i+1);
		if( achar < "0" || achar > "9" )
			return false;
	}
	return true;
}

function spampop(url,name,width,height,scrollbars,resizable) {
	msgWindow=window.open(url,name,'scrollbars='+scrollbars+',resizable='+resizable+',width='+width+',height='+height);
	msgWindow.focus();
}

function sitemap(url,name,width,height,scrollbars,resizable) {
	SiteMapWindow=window.open(url,name,'scrollbars='+scrollbars+',resizable='+resizable+',width='+width+',height='+height);
	SiteMapWindow.focus();
}

function pop(msg) {

	var nav = (document.layers);
	var iex = (document.all);
	var skn = (nav) ? document.topdeck : topdeck.style;
	if (nav) document.captureEvents(Event.MOUSEMOVE);
	document.onmousemove = get_mouse;

	var content ="<TABLE BORDER=0 CELLSPACING=1 BGCOLOR=#000000><TR><TD BGCOLOR=#FFFFE1 style='padding:4 5 2 5;'><FONT COLOR=#222222>"+msg+"</CENTER></FONT></TD></TR></TABLE>";

	if (nav) {
		skn.document.write(content);
		skn.document.close();
		skn.visibility = "visible";
	} else if (iex) {
		document.all("topdeck").innerHTML = content;
		skn.visibility = "visible";
	}
}

function get_mouse(e) {

	var nav = (document.layers);
	var iex = (document.all);
	var skn = (nav) ? document.topdeck : topdeck.style;
	if (nav) document.captureEvents(Event.MOUSEMOVE);
	document.onmousemove = get_mouse;

	var x = (nav) ? e.pageX : event.x+document.body.scrollLeft;
	var y = (nav) ? e.pageY : event.y+document.body.scrollTop;
	skn.left = x+8;
	skn.top  = y+18;
}

function popkill() {

	var nav = (document.layers);
	var iex = (document.all);
	var skn = (nav) ? document.topdeck : topdeck.style;
	if (nav) document.captureEvents(Event.MOUSEMOVE);
	document.onmousemove = get_mouse;

	if (nav) {
		skn.document.write('');
		skn.document.close();
	} else if (iex) {
		document.all("topdeck").innerHTML = '';
	}

	skn.visibility = "hidden";
}

/* 20060804-wmode add */
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, wm) {

      if( getType == "flash") {
        clsid = "D27CDB6E-AE6D-11cf-96B8-444553540000";
        codebase = "http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0";
        pluginspage = "http://www.macromedia.com/go/getflashplayer";
        embedType = "application/x-shockwave-flash";
      }
      parameter += "<param name=\"movie\" value=\""+ s + "\">\n";
      parameter += "<param name=\"quality\" value=\"high\">\n";
      parameter += "<param name=\"wmode\" value=\"transparent\">\n";
      parameter += "<param name=\"menu\" value=\"false\">\n";

      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 ExecutionTime() {
    this.start_time = 0;
    this.start = function() { this.start_time = (new Date()).getTime(); }
    this.from_start = function() { var curr_time = (new Date()).getTime(); return ( curr_time - this.start_time ) / 1000; }
}


// »ç¿ëÀÚ Layer ÆË¾÷¸Þ´º
	var select_obj;
	function PO_layerAction(name, status) {
		var obj=document.all[name];
		var _tmpx,_tmpy, marginx, marginy;
		_tmpx = event.clientX + parseInt(obj.offsetWidth);
		_tmpy = event.clientY + parseInt(obj.offsetHeight);
		_marginx = document.body.clientWidth - _tmpx;
		_marginy = document.body.clientHeight - _tmpy ;
		if(_marginx < 0)
			_tmpx = event.clientX + document.body.scrollLeft + _marginx ;
		else
			_tmpx = event.clientX + document.body.scrollLeft ;
		if(_marginy < 0)
			_tmpy = event.clientY + document.body.scrollTop + _marginy +20;
		else
			_tmpy = event.clientY + document.body.scrollTop ;
		obj.style.posLeft=_tmpx-13;
		obj.style.posTop=_tmpy-12;
		if(status=='visible') {
			if(select_obj) {
				select_obj.style.visibility='hidden';
				select_obj=null;
			}
			select_obj=obj;
		}else{
			select_obj=null;
		}
		obj.style.visibility=status;
	}

	function print_POlayer(layername, nickname, uid, userid) {
		var printHeight = 0;
		var printMain="";

		printMain = printMain +	"<tr onMouseOver=this.style.backgroundColor='#E3F9FF' onMouseOut=this.style.backgroundColor='' onMousedown=openwin('/popup/point_profile.asp?uid=" + uid + "','point_profile','no','320','270','200','270');><td style=font-family:±¼¸²;font-size:9pt height=18 nowrap>&nbsp;<img src=http://images.payopen.co.kr/2004/community/layer_icon_userinfo.gif width=19 height=14 border=0 align=absmiddle>&nbsp;&nbsp;È¸¿øÁ¤º¸ º¸±â&nbsp;&nbsp;</td></tr>";
		printHeight = printHeight + 16;
		printMain = printMain +	"<tr onMouseOver=this.style.backgroundColor='#E3F9FF' onMouseOut=this.style.backgroundColor='' onMousedown=openwin('/popup/message.asp?nickname=" + nickname + "&uid=" + uid + "&userid=" + userid + "','message','no','400','460','530','270');><td style=font-family:±¼¸²;font-size:9pt height=18 nowrap>&nbsp;<img src=http://images.payopen.co.kr/2004/community/layer_icon_msg.gif width=19 height=14 border=0 align=absmiddle>&nbsp;&nbsp;ÂÊÁö º¸³»±â&nbsp;&nbsp;</td></tr>";
		printHeight = printHeight + 16;
		printMain = printMain +	"<tr onMouseOver=this.style.backgroundColor='#E3F9FF' onMouseOut=this.style.backgroundColor='' onMousedown=openwin('/popup/present_pearl_pop.asp?nickname=" + nickname + "&uid=" + uid + "&userid=" + userid + "','present_pearl','no','420','350','530','270');><td style=font-family:±¼¸²;font-size:9pt height=18 nowrap>&nbsp;<img src=http://images.payopen.co.kr/2004/community/layer_icon_pearl.gif width=19 height=14 border=0 align=absmiddle>&nbsp;&nbsp;ÁøÁÖ ¼±¹°ÇÏ±â&nbsp;&nbsp;</td></tr>";
		printHeight = printHeight + 16;

		var printHeader = "<div id='"+layername+"' style='position:absolute; left:10px; top:25px; width:127; height: "+printHeight+"; z-index:1; visibility: hidden' onMousedown=PO_layerAction('"+layername+"','hidden')><table border=0><tr><td colspan=3 onMouseover=PO_layerAction('"+layername+"','hidden') height=3></td></tr><tr><td width=5 onMouseover=PO_layerAction('"+layername+"','hidden') rowspan=2>&nbsp;</td><td height=5></td></tr><tr><td><table style=cursor:hand border='0' cellspacing='1' cellpadding='0' bgcolor='#808080' width=100% height=100%><tr><td valign=top bgcolor=white><table border=0 cellspacing=0 cellpadding=3 width=100% height=100%>";
		var printFooter = "</table></td></tr></table></td><td width=5 rowspan=2 onMouseover=PO_layerAction('"+layername+"','hidden')>&nbsp;</td></tr><tr><td colspan=3 height=10 onMouseover=PO_layerAction('"+layername+"','hidden')></td></tr></table></div>";

		document.writeln(printHeader+printMain+printFooter);
	}

	function print_POlayerCommunity(layername, nickname, uid, userid) {
		var printHeight = 0;
		var printMain="";

		printMain = printMain +	"<tr onMouseOver=this.style.backgroundColor='#E3F9FF' onMouseOut=this.style.backgroundColor='' onMousedown=openwin('/popup/point_profile.asp?uid=" + uid + "','point_profile','no','320','270','200','270');><td style=font-family:±¼¸²;font-size:9pt height=18 nowrap>&nbsp;<img src=http://images.payopen.co.kr/2004/community/layer_icon_userinfo.gif width=19 height=14 border=0 align=absmiddle>&nbsp;&nbsp;È¸¿øÁ¤º¸ º¸±â&nbsp;&nbsp;</td></tr>";
		printHeight = printHeight + 16;
		printMain = printMain +	"<tr onMouseOver=this.style.backgroundColor='#E3F9FF' onMouseOut=this.style.backgroundColor='' onMousedown=openwin('/popup/message.asp?nickname=" + nickname + "&uid=" + uid + "&userid=" + userid + "','message','no','400','460','530','270');><td style=font-family:±¼¸²;font-size:9pt height=18 nowrap>&nbsp;<img src=http://images.payopen.co.kr/2004/community/layer_icon_msg.gif width=19 height=14 border=0 align=absmiddle>&nbsp;&nbsp;ÂÊÁö º¸³»±â&nbsp;&nbsp;</td></tr>";
		printHeight = printHeight + 16;
		printMain = printMain +	"<tr onMouseOver=this.style.backgroundColor='#E3F9FF' onMouseOut=this.style.backgroundColor='' onMousedown=location.href='/community/search/?clkflag=1&field=3&keyword=" + nickname + "&action=schview';><td style=font-family:±¼¸²;font-size:9pt height=18 nowrap>&nbsp;<img src=http://images.payopen.co.kr/2004/community/layer_icon_find.gif width=19 height=14 border=0 align=absmiddle>&nbsp;&nbsp;ÀÌ¸§À¸·Î °Ë»ö&nbsp;&nbsp;</td></tr>";
		printHeight = printHeight + 16;
		printMain = printMain +	"<tr onMouseOver=this.style.backgroundColor='#E3F9FF' onMouseOut=this.style.backgroundColor='' onMousedown=openwin('/popup/present_pearl_pop.asp?nickname=" + nickname + "&uid=" + uid + "&userid=" + userid + "','present_pearl','no','420','350','530','270');><td style=font-family:±¼¸²;font-size:9pt height=18 nowrap>&nbsp;<img src=http://images.payopen.co.kr/2004/community/layer_icon_pearl.gif width=19 height=14 border=0 align=absmiddle>&nbsp;&nbsp;ÁøÁÖ ¼±¹°ÇÏ±â&nbsp;&nbsp;</td></tr>";
		printHeight = printHeight + 16;
		var printHeader = "<div id='"+layername+"' style='position:absolute; left:10px; top:25px; width:127; height: "+printHeight+"; z-index:1; visibility: hidden' onMousedown=PO_layerAction('"+layername+"','hidden')><table border=0><tr><td colspan=3 onMouseover=PO_layerAction('"+layername+"','hidden') height=3></td></tr><tr><td width=5 onMouseover=PO_layerAction('"+layername+"','hidden') rowspan=2>&nbsp;</td><td height=5></td></tr><tr><td><table style=cursor:hand border='0' cellspacing='1' cellpadding='0' bgcolor='#808080' width=100% height=100%><tr><td valign=top bgcolor=white><table border=0 cellspacing=0 cellpadding=3 width=100% height=100%>";
		var printFooter = "</table></td></tr></table></td><td width=5 rowspan=2 onMouseover=PO_layerAction('"+layername+"','hidden')>&nbsp;</td></tr><tr><td colspan=3 height=10 onMouseover=PO_layerAction('"+layername+"','hidden')></td></tr></table></div>";

		document.writeln(printHeader+printMain+printFooter);
	}
/**/


function Main_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, wm) {

      if( getType == "flash") {
        clsid = "D27CDB6E-AE6D-11cf-96B8-444553540000";
        codebase = "http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0";
        pluginspage = "http://www.macromedia.com/go/getflashplayer";
        embedType = "application/x-shockwave-flash";
      }
      parameter += "<param name=\"movie\" value=\""+ s + "\">\n";
      parameter += "<param name=\"quality\" value=\"high\">\n";
      parameter += "<param name=\"wmode\" value=\"transparent\">\n";
      parameter += "<param name=\"menu\" value=\"false\">\n";

	  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.all.flash_chart.innerHTML = html;
			//$("flash_chart").html(html);
  }
}
