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 srcp_del(cnt)
{
	var scr_arr = new Array()
	var num=0;
	var tot_cnt = getCookie("scp_cnt") - 1;

	for(i=1;i<6;i++)
	{
		if(getCookie("scrap"+i) != "" && cnt != i)
		{
			scr_arr[num] = getCookie("scrap"+i);
			num = num + 1;
		}
		setCookie("scrap"+1,"");
	}

	for(i=0;i<scr_arr.length;i++)
	{
		setCookie("scrap"+(i+1),scr_arr[i]);
	}
	setCookie("scp_cnt",tot_cnt);
	alert("Ã¥°¥ÇÇ°¡ »èÁ¦µÇ¾ú½À´Ï´Ù.");
	location.href = document.location;
}

function saveScrap()
{
	if(confirm("ÇöÀçÆäÀÌÁö¸¦ Ã¥°¥ÇÇ¿¡ ÀúÀåÇÏ½Ã°Ú½À´Ï±î?") == true)
	{
		var s_num = "";
		var name = "";
		var value = document.location;

		if(getCookie("scp_cnt") == "")
		{	s_num = 1;}
		else if(getCookie("scp_cnt") > 4)
		{
			alert("Ã¥°¥ÇÇ´Â 5°³±îÁö ÀúÀåÇÒ ¼ö ÀÖ½À´Ï´Ù.\n\n»õ·Î¿î ÆäÀÌÁö¸¦ ÀúÀåÇÏ½Ã·Á¸é\n\n±âÁ¸ ÀúÀåµÈ Ã¥°¥ÇÇ¸¦ »èÁ¦ ÈÄ ÀúÀåÇØ ÁÖ¼¼¿ä.");
			return;
		}
		else
		{	s_num = parseInt(getCookie("scp_cnt"))+1;}

		name = "scrap"+s_num;

		setCookie("scp_cnt",s_num);
		setCookie(name,value);

		alert("ÀúÀåµÇ¾ú½À´Ï´Ù.");
		location.href = value;
	}
}

function setCookie(name,value)
{
	var todayDate = new Date();
  todayDate.setDate( todayDate.getDate() + 1);
  document.cookie = name + "=" + escape( value ) + "; path=/; expires=" + todayDate.toGMTString() + ";" 
}

function goUrl(url)
{
	var gourl = url.replace("#","");
	location.href = gourl;
}
