/******************************************************************************
 Copyright (c) 2007 Samsung Electronics. All Rights Reserved.
 Project: Samsung.com Site Renewal(2007.01~07)

 File Name : sitecode.js
 Description : Cookie Get/Delete
 Author : Sanghun Jeong
 Since : 2007.06.05
 
 Modification Information
 Mod Date        Modifier         Description
 ----------      --------         ---------------------------
 2007.06.05      Sanghun Jeong    Initial creation 
******************************************************************************/

//************************************************************************************
// Description : Get Cookie Value
// Parameter: Cookie name
// Return: Cookie value
// Usage: 
//************************************************************************************
function getCookie(name) 
{
	var search = name + "=";
	if (document.cookie.length > 0) 
	{
		offset = document.cookie.indexOf(search);
		if (offset != -1)
		{
			offset += search.length;
			end = document.cookie.indexOf(";", offset);
			if (end == -1)
			end = document.cookie.length;
			return unescape(document.cookie.substring(offset, end));
		} 
	}
}

//************************************************************************************
// Description : Delete/Expire Cookie Value
// Parameter: Cookie name
// Return: 
// Usage: 
//************************************************************************************
function deleteCookie(name, path, domain)
{
	if (getCookie(name))
		document.cookie = name + '=' +
			((path) ? ';path=' + path : '') +
			((domain) ? ';domain=' + domain : '' ) +
			';expires=Thu, 01-Jan-1970 00:00:01 GMT';
}
