﻿
function getCookie(c_name) {

    if (document.cookie.length > 0) {
        if (document.cookie.indexOf(c_name) != -1) {
            return true;
        }
    }
    return false;
}

$(document).ready(function () {
setTimeout(function () {
    checkCookie();
}, 5000);
});

function setCookie(c_name, value, exdays) {
    var exdate = new Date();
    exdate.setDate(exdate.getDate() + exdays);
    var c_value = escape(value) + ((exdays == null) ? "" : "; expires=" + exdate.toUTCString());
    document.cookie = c_name + "=" + c_value;
}

function checkCookie()
{
    var ipco = getCookie("cvb");

    if (!getCookie("cvb")) {


    $.post("/home/ciri/" + getLang(), function (data) {


        $.post("/home/cShipment/" + getLang(), { pid: data.countryCode }, function (data) {
            setCookie("cvb", data.countryCode, 365);
            RefreshCart();
        });
        
    }, 'json');

  
    
    
  }
}
