	/*
	* Method called by VDNA flash app to determine the current domain name (utility function)
	*
	*/
	function VDNA_getCookieDomain()
	{
		var thisDomain = document.domain;
		var domainArr = thisDomain.split(".");
		thisDomain = '.' + domainArr[domainArr.length-2] + "." + domainArr[domainArr.length-1];
		
		return thisDomain;
	}
	
	/*
	* Parse local cookie data
	*
	*/
	function VDNA_GetInfoFromCookie(c_name)
	{
		if (document.cookie.length > 0)
		{
			c_start = document.cookie.indexOf(c_name + "=");
			if (c_start != -1)
			{
				c_start = c_start + c_name.length + 1;
				c_end = document.cookie.indexOf(";", c_start);
				if (c_end == -1) 
				{
					c_end=document.cookie.length;
				}
				return unescape(document.cookie.substring(c_start, c_end));
			}
		}
		return false;
	}

	/*
	* Write data to cookie
	*/
	function VDNA_SetUpInfoCookie(name, infoStr)
	{
		thisDomain = VDNA_getCookieDomain();
	
		// set time, it's in milliseconds
		var today = new Date();
		today.setTime( today.getTime() );	
		var expires_date = new Date( today.getTime() + (360 * 1000 * 60 * 60 * 24) ); // one year
		document.cookie = name + "=" + escape(infoStr) +
						  ";expires=" + expires_date.toGMTString() +
						  ";path=/" +
						  ";domain=" + thisDomain;
	}	
	
	/*
	* Verifies if local cookie exists or not
	*
	*/
	function VDNA_LocalCookieExists(c_name)
	{
		if (document.cookie.length > 0)
		{
			c_start = document.cookie.indexOf(c_name + "=");
			if (c_start != -1)
			{
				return true;
			}
		}
		return false;
	}

	if (!VDNA_LocalCookieExists('vdnaUserPermission')) 
	{
		VDNA_SetUpInfoCookie('vdnaUserPermission', 'true')
	}
