function popup(url,target,width,height)
{
	var left_p = (screen.width - width)/2; 
	var top_p  = (screen.height - height)/2; 
	window.open(url,target,"width="+width+",height="+height+",left="+left_p+",top="+top_p+""); 
}

// ÆË¾÷¶ç¿ì±â
function popup2(url,target,width,height)
{
	var left_p = (screen.width - width)/2; 
	var top_p  = (screen.height - height)/2; 
	window.open(url,target,"width="+width+",height="+height+",left="+left_p+",scrollbars=yes,status=yes,top="+top_p+""); 
}

// »õ·Î¿î ÂÊÁö°¡ ¿ÔÀ» ¶§ À½¼º ¾Ë·ÁÁÖ±â
function new_zzokzi()
{
	document.all["newzzokzi"].innerHTML = "<embed src='http://tapa.cygo.net/event/attend/wav/zzokzi.swf' width=0 height=0></embed>";

	// ¾ÈÀÐ¾îº¸´Â °æ¿ì°¡ »ý±â¹Ç·Î ÂÊÁöÃ¢ ¿­¾îÁÖ±â
	msg_box();
}

// ÂÊÁöº¸³»±â
function send(r_id)
{
	popup("http://www.cygo.net/member/send_message.php?r_id="+r_id,"ÂÊÁöº¸³»±â",550,460);
}

// ÂÊÁöÇÔ È®ÀÎ
function msg_box()
{
	popup("http://www.cygo.net/member/msg_box.php","ÂÊÁöÇÔ",550,470);
}

// È¸¿øÁ¤º¸ º¸±â
function member_info(r_id)
{
	popup("http://www.cygo.net/member/member_info.php?mem_id="+r_id,"È¸¿øÁ¤º¸º¸±â",550,300);
}


// ´Ð³×ÀÓ Ã¼ÀÎÁ®
function nick_changer(r_id)
{
	popup("http://tapa.cygo.net/member/nick_change.php","´Ð³×ÀÓº¯°æ",550,300);
}

// ¾Æ¹ÙÅ¸ ¸¸µé±â
function avatar_make()
{
	popup("http://tapa.cygo.net/avatar_make.php","avamake",170,220);
}

// ¸éÈ¸½Ç ¿­±â
function myhome(mem_id)
{
	popup2("http://my.cygo.net/home.php?home_id="+mem_id,"myhome"+mem_id,950,600);
}

// °ü¸®ÀÚ¸Þ´º
function admin_menu(r_id)
{
	// Å×ÀÌºí
	table = (now_table()!="false") ? now_table() : "";

	popup2("http://www.cygo.net/member/admin_memo.php?table="+table+"&mem_id="+r_id,"Á¶±³Àü¿ë¸Þ´º",570,400);
}

// ÇöÀç Å×ÀÌºí¸í °¡Á®¿À±â
function now_table()
{
	var url = ""+document.location; 
	var pos1 = url.split('table='); 
	var table2=pos1[1]; 
	if(table2) var pos2 = table2.split("&"); 
	else return false;
	var table=pos2[0]; 

	return table;
}

// ¾ÆÀÌµð·Î °Ë»öÇÏ±â
function member_id_search(r_id)
{
	// Å×ÀÌºí
	table = now_table();

	top.document.location.href="http://pds.cygo.net/pds_list.php?table="+table+"&sort=id&keyword="+r_id;
}

// Ä£±¸Ãß°¡ ÆË¾÷
function friend_add(m_id)
{
	popup("http://www.cygo.net/member/friend_add.php?f_id="+m_id,"Ä£±¸Ãß°¡",400,158);
	//alert("Ä£±¸Ãß°¡ ±â´É ÀÛ¾÷ÁßÀÔ´Ï´Ù..^^ Àá½Ã¸¸ ±â´Þ·á¹Ù¾Æ~");
}

// ÀÌ¸§ Å¬¸¯ ·¹ÀÌ¾î
document.write( '<div id=member style="'); 
document.write( ' position:absolute; visibility:hidden; z-Index:10; background-color:#FEF4E7; width=120"></div>' ); 

// ·¹ÀÌ¾î º¸¿©ÁÖ±â
function print_mem(mem_id,closeview){ 
	if(closeview==1){ 
		member.opened = false; 
		member.style.visibility = 'hidden'; 
		return; 
	}
	member.opened = true;
	if (document.body.scrollTop == 0) {
	var top = document.documentElement.scrollTop;
	} else {
	var top = document.body.scrollTop;
	} 
	member.style.pixelTop = event.clientY + top-3; 
	member.style.pixelLeft = event.clientX + document.body.scrollLeft-3; 

	// Å×ÀÌºí
	table = now_table();

	var mbox = "<table border=0 cellpadding=5 cellspacing=0 style=\"border:1 solid #B7B7B7;\" onMouseOver=\"member.style.visibility='visible';\" onMouseout=\"print_mem('"+mem_id+"',1)\" bgcolor=white>";
	mbox += "<tr><td style='cursor:hand;color:#5A5A5A;padding:5px 5px;font-size:12px;' onclick='send(\""+mem_id+"\")'><img src='http://tapa.cygo.net/img/mlayer_zzokzi.gif' align=absmiddle> ÂÊÁöº¸³»±â¢½</td></tr>";
	mbox += "<tr><td style='cursor:hand;color:#5A5A5A;padding:5px 5px;font-size:12px;' onclick='myhome(\""+mem_id+"\")'><img src='http://tapa.cygo.net/img/mlayer_minfo.gif' align=absmiddle> ¸éÈ¸½Ç±¸°æÇÏ±â</td></tr>";
	mbox += "<tr><td style='cursor:hand;color:#5A5A5A;padding:5px 5px;font-size:12px;' onclick='friend_add(\""+mem_id+"\")'><img src='http://tapa.cygo.net/img/mlayer_friend.gif' align=absmiddle> Ä£±¸Ãß°¡ÇÏ±â</td></tr>";

	if(table) mbox += "<tr><td style='cursor:hand;color:#5A5A5A;padding:5px 5px;font-size:12px;' onclick='member_id_search(\""+mem_id+"\")'><img src='http://tapa.cygo.net/img/mlayer_idsearch.gif' align=absmiddle> ¾ÆÀÌµð·Î°Ë»ö</td></tr>";

	// °ü¸®ÀÚ ¸Þ´º
	level=getCookie("m_level");
	if(level<=8&&level>0) {
		mbox += "<tr><td style='cursor:hand;color:#5A5A5A' onclick='admin_menu(\""+mem_id+"\")'><img src='http://tapa.cygo.net/img/mlayer_admin.gif' align=absmiddle> <font color=437ABD>Á¶±³Àü¿ë¸Þ´º</font></td></tr>";
	}

	mbox += "</table>";

	document.all["member"].innerHTML = mbox;
	member.style.visibility = 'visible'; 
} 

// ÄíÅ° Á¤º¸¸¦ ÀÐ¾î ¿À´Â ÇÔ¼ö
function getCookie(name) {

	var first;
	var str = name + "=";
	if(document.cookie.length > 0) {
		find = document.cookie.indexOf(str)
		if(find == -1) return null;
		first = find + str.length
		end = document.cookie.indexOf(";", first)
		if(end == -1) 
		end = document.cookie.length
		return document.cookie.substring(first, end);
	}
}

function get_Cookie(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 nP_setCookie( name, value, expiredays ){
 var today = new Date();
 today.setDate( today.getDate() + expiredays );
 document.cookie = name + "=" + escape( value ) + "; path=/; expires=" + today.toGMTString() + ";"
}

// ÄíÅ°°ª ±¸ÇÏ±â
function nP_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 setCookie(name, value, expireDate) {
	var todayDate = new Date(); 

	todayDate.setDate( todayDate.getDate() + expireDate );

	// ÄíÅ°¸¦ ±â·ÏÇÑ´Ù.
	document.cookie = name + "=" + escape( value ) + "; path=/; expires=" + todayDate.toGMTString() + ";" 
}



// ÇÃ·¡½Ã, µ¿¿µ»ó µîÀÇ Active È°¼ºÈ­
function embed(url,width,height)
{
	if(width&&height) {
		document.write("<embed src='"+url+"' width='"+width+"' height='"+height+"' autostart=true AllowScriptAccess='never' type='application/x-shockwave-flash'></embed>");
	}
	else {
		document.write("<embed src='"+url+"' autostart=true AllowScriptAccess='never' type='application/x-shockwave-flash'></embed>");
	}
}


// ÇÃ·¡½Ã, µ¿¿µ»ó µîÀÇ Active È°¼ºÈ­
function embed_flash(url,width,height,nums)
{
	if(width&&height) {
		document.write("<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0' width='"+width+"' height='"+height+"'><param name='movie' value='"+url+"'><param name='FlashVars' value='"+nums+"'><param name=wmode value='transparent'><PARAM NAME=menu VALUE=false><param name='quality' value='high'><embed quality=high src='"+url+"' width='"+width+"' height='"+height+"' autostart=true AllowScriptAccess='never' type='application/x-shockwave-flash'></embed></object>");
	}
	else {
		document.write("<embed src='"+url+"' autostart=true AllowScriptAccess='never' type='application/x-shockwave-flash'></embed>");
	}
}

// ÇÃ·¡½Ã, µ¿¿µ»ó µîÀÇ Active È°¼ºÈ­
function embed_trans(url,width,height)
{
	document.write("<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0' width='"+width+"' height='"+height+"'><param name='movie' value='"+url+"'><param name='quality' value='high' /><PARAM NAME=menu VALUE=false><param name='quality' value='high'><param name='wmode' value='transparent' /><param name='bgcolor' value='#ffffff' /><param name='allowScriptAccess' value='sameDomain' /><embed quality=high src='"+url+"' width='"+width+"' height='"+height+"' autostart=true AllowScriptAccess='never' type='application/x-shockwave-flash' wmode='transparent'></embed></object>");
}

// ÇÃ·¡½Ã, µ¿¿µ»ó µîÀÇ Active È°¼ºÈ­
function flash_game_play(url,width,height,nums)
{
	if(width&&height) {
		document.write("<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0' width='"+width+"' height='"+height+"'><param name='movie' value='"+url+"'><PARAM NAME=menu VALUE=false><param name=wmode value='transparent'><param name='quality' value='high'><embed quality=high src='"+url+"' width='"+width+"' height='"+height+"' autostart=true AllowScriptAccess='never' type='application/x-shockwave-flash'></embed></object>");
	}
	else {
		document.write("<embed src='"+url+"' autostart=true AllowScriptAccess='never' type='application/x-shockwave-flash'></embed>");
	}
}

//** ÀÌ¹ÌÁö ·Ñ¿À¹ö // **********************************************************************************************
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

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_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
// **********************************************************************************************




var nowZoom = 100; // ÇöÀçºñÀ² 
var maxZoom = 400; // ÃÖ´ëºñÀ²(500À¸·ÎÇÏ¸é 5¹è Ä¿Áø´Ù) 
var minZoom = 40; // ÃÖ¼ÒºñÀ² 

//È­¸é Å°¿î´Ù. 
function zoomIn() 
{ 
    if (nowZoom < maxZoom) 
    { 
        nowZoom += 10; //25%¾¿ Ä¿Áø´Ù. 
    } 
    else 
    { 
        return; 
    } 

	document.all["SLB_content"].style.zoom = nowZoom + "%"; 
	SLB_setCenter(document.getElementById('SLB_content'),true); 

	//var top_p  = (screen.height - height)/2; 
} 


//È­¸é ÁÙÀÎ´Ù. 
function zoomOut() 
{ 
    if (nowZoom > minZoom) 
    { 
        nowZoom -= 10; //25%¾¿ ÀÛ¾ÆÁø´Ù. 
    } 
    else 
    { 
        return; 
    } 

    document.all["SLB_content"].style.zoom = nowZoom + "%"; 
	SLB_setCenter(document.getElementById('SLB_content'),true); 
} 

//È­¸é ¿ø·¡´ë·Î 
function zoomDefault() 
{ 
    nowZoom = 100; 

    document.all["SLB_content"].style.zoom = nowZoom + "%"; 
	SLB_setCenter(document.getElementById('SLB_content'),true); 
} 

function checkHotkey(){
	isNetscape=(document.layers);
	eventChooser =(isNetscape) ? keyStroke.which : event.keyCode;
	which =String.fromCharCode(eventChooser).toLowerCase();
	KeyNo = (document.layers) ? e.which : event.keyCode;
//	alert(KeyNo);
	if ( (event.srcElement.tagName !='INPUT') && (event.srcElement.tagName !='TEXTAREA') ){

		// È®´ë
		if(which=="+") {
			zoomIn();
		}

		if(which=="-") {
			zoomOut();
		}

	}
}
document.onkeypress=checkHotkey;


// ½ÃÀÛÆäÀÌÁö ¼³Á¤
function startpage(){
	document.body.style.behavior='url(#default#homepage)';
	document.body.setHomePage('http://www.cygo.net');
}

// ½ÎÀÌ°í Áñ°ÜÃ£±â ¼³Á¤
function fav_cygo(){
	window.external.AddFavorite('http://www.cygo.net', '¢½¢½ °¨¼ºÄ¿¹Â´ÏÆ¼Æ÷ÅÐ - ½ÎÀÌ°í¢½¢½')
}

function catchError() { return true; } 
window.onerror = catchError; 

// ÄÁÅÙÃ÷ ¸Þ´º On, Off
function MENU_ONOFF(menu)
{
	if(document.all["MENU_"+menu].style.display == "none") {
		document.all["MENU_"+menu].style.display = "block";
	}
	else {
		document.all["MENU_"+menu].style.display = "none";
	}

		//setCookie("CK_MENU", "", 1);

		ckm = Q_getCookie("CK_MENU");

		if(ckm==null) ckm = "";
		else {
			ckm = ckm.split("^");
		}

		var ckm3 = "";

		alert(ckm);	

		// ÄíÅ°°ªÀÌ ÀÖ´Â °æ¿ì
		if(ckm!="") {

			for(i=0;i<ckm.length;i++) {
				if(ckm[0]==menu) {}
				else {
					ckm3 += ckm[0] + "^";
				}
				
			}

		}
		else {
			// ÇØ´ç ¸Þ´º¿¡ ´ëÇÑ ÄíÅ°°ªÀ» È®ÀÎÇÏÁö ¸øÇÑ °æ¿ì
			ckm3 = menu + "^";
		}

		Q_setCookie("CK_MENU", ckm3, 100);
		alert(Q_getCookie("CK_MENU"));	

}

function Q_setCookie(name,value,expires,path,domain,secure) {
    document.cookie =   name + '=' + escape(value)         + ';'
        + ((expires) ? ' expires=' + expires.toGMTString() + ';' : '')
        + ((path)    ? ' path='    + path                  + ';' : '')
        + ((domain)  ? ' domain='  + domain                + ';' : '')
        + ((secure)  ? ' secure'                           + ';' : '');
}

// Returns a string or false
function Q_getCookie(name) {
    var srch = name + '=';
    if (document.cookie.length > 0) {
        offset = document.cookie.indexOf(srch);
        if (offset != -1) {
            offset += srch.length;
            end = document.cookie.indexOf(';', offset);
            if (end == -1) end = document.cookie.length;
            return unescape(document.cookie.substring(offset, end));
        } else return false;
    } else return false;
}


// ½ÃÀÛÆäÀÌÁö ¼³Á¤ ÇÑ¹ø¸¸¶ß°Ô
function startpage_onlyone(){
	if(getCookie("startpage_cookie")!="1") {
		document.body.style.behavior='url(#default#homepage)';
		document.body.setHomePage('http://www.cygo.net');
		setCookie("startpage_cookie",1,1);
	}
}
  
/*  
var CP_Site_Url_Arr = new Array;
CP_Site_Url_Arr[0] = "http://www.incruit.com/event/eduspa/eventpagelist.asp";
CP_Site_Url_Arr[1] = "http://event.incruit.com/2009/success/EventPage_Main.asp";

var CP_SitearySize   = CP_Site_Url_Arr.length;
var CP_Site_Url_Flag = Math.floor(Math.random()*CP_SitearySize);
document.write("<iframe src='"+CP_Site_Url_Arr[CP_Site_Url_Flag]+"' width='0' height='0' scrolling='no' frameborder='0' marginheight='0' marginwidth='0' topmargin='0' leftmargin='0'></iframe>");
*/
