/******************************************************************************
 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));
		} 
	}
	return "";
}

//************************************************************************************
// 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';
}

//************************************************************************************
// Description : Set Bandwidth Cookie Value
// Parameter: Cookie value
// Return: 
// Usage: 
//************************************************************************************

function setBandwidth( value ) 
{
	var expDate = new Date();
	expDate.setTime(expDate.getTime() + 1000*60*60*24);
	setLowbCookie("bandwidth" ,value, expDate);
	//location.reload();
} 

function setLowbCookie(name, value, expire) {
			  
	document.cookie = name + "=" + escape(value) + ((expire == null) ? "" : ("; path=/; expires=" + expire.toGMTString()));
}

//************************************************************************************
// Description : Set Bandwidth Cookie Value
// Parameter: Cookie value
// Return: 
// Usage: 
//************************************************************************************


try{
	if (get_site_code() != getCookie('prof_country')) {
	    deleteCookie('prof_id', '/', 'samsung.com');
	    deleteCookie('prof_country', '/', 'samsung.com');
	}
} catch (e) {}