/// 

function f_ReadCookie(cookieName)
{
    if (cookieName == "" )
    {
         return;
    }
    var theCookie=""+document.cookie+(("/") ? "; path=" + "/" : "") ;
    var ind=theCookie.indexOf(cookieName);
    if (ind==-1 || cookieName=="") return "";
    var ind1=theCookie.indexOf(';',ind);
    if (ind1==-1) ind1=theCookie.length;
    return unescape(theCookie.substring(ind+cookieName.length+1,ind1));
        /**** read cookie ****/

        /***** Cookie Check function call  ****/
        f_WriteCookie("ckTmp","Y"); // write temp. cookie
        sVal = f_ReadCookie("ckTmp"); // read this value again
        if (sVal != "Y")
        {
                return false;
        }
        return true;
}

function f_WriteCookie(name, value)
{
        if (name == "")
        {
                return false;
        }

        if (value != null)
        {
                var curCookie = name + "=" + escape(value) + (("/") ? "; path=" + "/" :
"") //+
                document.cookie = curCookie;
        }
}// write cookie


function isCookiesEnabled()
{ 
        // Cookie Check function call 
        f_WriteCookie("ckTmp","Y"); // write temp. cookie
        sVal = f_ReadCookie("ckTmp"); // read this value again<br>
        if (sVal != "Y")
        {
                return false;
        }
        return true;
}

var hasCookies = isCookiesEnabled();

function checkCookies(lang){
	
	if (!isCookiesEnabled()){
		var msg = lang==2 ? "Моля активирайте вашите cookies за да използвате потребителската секция на сайта!"
								: "Please enable your cookies in order to use user section of this site!" ;
		alert(msg);
		return false;
	}
	return true;
}
