// ÆË¾÷
function open_popup(url, wid, hei, scroll, winName)
{
	var url = url;
	var posi = "width="+ wid +",height="+hei+",toolbar=no,location=no,status=no,menubar=no,top=10,left=50,scrollbars=" + scroll +",resizable=no" ;
	if (winName == "")
	{
		winName = popup
	}
	var win = window.open(url,winName,posi);
	win.focus();
}
//ÀÌ¹ÌÁö url ¾Ë¾Æ¿À±â 
function findImgUrl(str)
{
	var oldImgUrl = document.images[str].src;
	var findText = "/";
	var findTextNum = oldImgUrl.lastIndexOf(findText) + 1;
	return(oldImgUrl.substring(0,findTextNum));
}

//ÀÌ¹ÌÁö ¿À¹ö
function imgOver(imgName)
{
		newImgUrl = findImgUrl(imgName);
		document.images[imgName].src = newImgUrl + imgName + "on.gif";
}

//ÀÌ¹ÌÁö ¾Æ¿ô
function imgOut(imgName)
{
		newImgUrl = findImgUrl(imgName);
		document.images[imgName].src = newImgUrl + imgName + "off.gif";
}

// ÇÃ·¡½¬ 
function showFlashObject(objID, objSource, objWidth, objHeight, objQuality, objWmode, objBgcolor)
{
	/* Default Value Setting */
	if (objID == "") objID = 'ShockwaveFlash1';
	if (objWidth == "") objWidth = '0';
	if (objHeight == "") objHeight = '0';
	if (objQuality == "") objQuality = 'best';
	if (objWmode == "") {
		objWmode = 'transparent';
	} else {
		objWmode = '';
	}
	/* Flash 8.0 version */
	document.write('<OBJECT id="' + objID + '" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"');
	document.write('type="application/x-shockwave-flash" ');
	document.write('data="' + objSource + '" ');
	document.write('codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" ');
	document.write('WIDTH="' + objWidth + '" HEIGHT="' + objHeight + '">');
	document.write('<PARAM NAME=menu value=false>');
	document.write('<PARAM NAME=allowScriptAccess value=always>');
	document.write('<PARAM NAME=wmode value="'+ objWmode +'">');
	document.write('<PARAM NAME=movie VALUE="'+ objSource +'">');
	document.write('<PARAM NAME=quality VALUE="'+ objQuality +'">');
	document.write('<PARAM NAME=bgcolor VALUE="'+ objBgcolor +'">');
	document.write('<embed allowScriptAccess="always" swLiveConnect="true" src="' + objSource + '" menu="false" quality="' + objQuality + '" wmode="' + objWmode + '" bgcolor="' + objBgcolor + '" width="' + objWidth + '" height="' + objHeight + '" type="application/x-shockwave-flash" pluginspace="http://www.macromedia.com/go/getflashplayer">');
	document.write('</OBJECT>');
}


function bluring() {
	try{
		if(event.srcElement.tagName=="A"||event.srcElement.tagName=="IMG") document.body.focus();
	}
	catch(e){}
}

document.onfocusin=bluring;

function openBookClub()
{
	var o = center_open_window("BookClud","/yesyoungdo/bookclub/psp_index.jsp",0,0,630,250,0,0,0,0,0,0);
}

function center_open_window(name, url, left, top, width, height, toolbar, menubar, statusbar, scrollbar, resizable, location)
{
	var winleft = (screen.width - width) / 2;
	var wintop = (screen.height - height) / 2;
	
	toolbar_str = toolbar ? 'yes' : 'no';
	menubar_str = menubar ? 'yes' : 'no';
	statusbar_str = statusbar ? 'yes' : 'no';
	scrollbar_str = scrollbar ? 'yes' : 'no';
	resizable_str = resizable ? 'yes' : 'no';
	location_str = location ? 'yes' : 'no';
	var WO = window.open(url, name, 'left='+winleft+',top='+wintop+',width='+width+',height='+height+',toolbar='+toolbar_str+',menubar='+menubar_str+',status='+statusbar_str+',scrollbars='+scrollbar_str+',resizable='+resizable_str+',location='+location_str+',dependent=yes');
	WO.focus();
	return WO;
}

function open_window(name, url, left, top, width, height, toolbar, menubar, statusbar, scrollbar, resizable,location)
{
	toolbar_str = toolbar ? 'yes' : 'no';
	menubar_str = menubar ? 'yes' : 'no';
	statusbar_str = statusbar ? 'yes' : 'no';
	scrollbar_str = scrollbar ? 'yes' : 'no';
	resizable_str = resizable ? 'yes' : 'no';
	location_str = location ? 'yes' : 'no';
	var WO = window.open(url, name, 'left='+left+',top='+top+',width='+width+',height='+height+',toolbar='+toolbar_str+',menubar='+menubar_str+',status='+statusbar_str+',scrollbars='+scrollbar_str+',resizable='+resizable_str+',location='+location_str+',dependent=yes');
	WO.focus();
	return WO;
}

function setCookie(name,value)
{
	var argc = setCookie.arguments.length;
	var argv = setCookie.arguments;

	var expires = (argc > 2) ? argv[2] : null;
	var path = (argc > 3) ? argv[3] : null;
	var domain = (argc > 4) ? argv[4] : null;
	var secure = (argc > 5) ? argv[5] : false;
	
	document.cookie = name + "=" + escape(value) +
		((expires==null) ? "" : ("; expires=" + expires.toGMTString())) +
		((path==null) ? "" : ("; path=" + path)) +
		((domain==null) ? "" : ("; domain=" + domain)) +
		((secure==true) ? "; secure" : "");
}

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 delCookie(name)
{
	var exp = new Date();  
	exp.setTime(exp.getTime() - 1);  
	var cval = getCookie(name);  
	document.cookie = name + "=" + cval + "; expires=" + exp.toGMTString();
}

function clearCookies()
{
	if (document.cookie != "") {
		thisCookie = document.cookie.split(";");
		expireDate = new Date();
		expireDate.setDate(expireDate.getDate()-1);
		
		for (i=0; i<thisCookie.length; i++)
		{
			cookieName = thisCookie[i].split("=")[0]
			document.cookie = cookieName + "=;expires=" + expireDate.toGMTString()
		}
	}
}