function showAnketa() {
    if (checkCookie("anketaAtbildeta")) return;
    alert_box2    = document.createElement("div");
    var sauklis   = document.createElement("p");
    var ffp       = document.createElement("p");
    var saite     = document.createElement("a");
    var closePasive = document.createElement("img");
    saite.href = "http://www.aiknc.lv/anketa/";
    saite.appendChild(document.createTextNode("Lai aizpildītu anketu, klikšķini šeit"));
    ffp.style.textAlign = "center";
    sauklis.appendChild(document.createTextNode("Aicinām aizpildīt aptaujas anketu par AIKNC darbību."));
    ffp.appendChild(saite);
    closePasive.src = "/images/ClosePopupInactive.gif";
    closePasive.onclick = hideAnketa;
    closePasive.style.position = "absolute";
    closePasive.style.right = "5px";
    alert_box2.appendChild(closePasive);
    alert_box2.appendChild(sauklis);
    alert_box2.appendChild(ffp);
    alert_box2.style.position = "absolute";
    alert_box2.style.left  = "auto";
    alert_box2.style.right = "0.75em";
    if (window.navigator.appName=="Microsoft Internet Explorer") {
        alert_box2.style.top   = "25%";
    } else {
        alert_box2.style.top   = "auto";
    }
    alert_box2.style.bottom = "auto";
    alert_box2.style.width = "25%";
    alert_box2.style.zIndex= "2";
    alert_box2.style.backgroundColor = "white";
    alert_box2.style.borderWidth="1px";
    alert_box2.style.borderColor="black";
    alert_box2.style.borderStyle="solid";
    alert_box2.style.padding= "0.5em";
    alert_box2.style.marginTop = "2.5em";

    document.body.insertBefore(alert_box2,document.body.firstChild);
    window.setTimeout(hideAnketa, 20000);
}

function hideAnketa() {
  alert_box2.style.display = "none";
}

function createCookie(name,value,days) {
        if (days) {
                var date = new Date();
                date.setTime(date.getTime()+(days*24*60*60*1000));
                var expires = "; expires="+date.toGMTString();
        }
        else var expires = "";
        document.cookie = name+"="+value+expires+"; path=/; domain=aiknc.lv";
}

function readCookie(name) {
        var nameEQ = name + "=";
        var ca = document.cookie.split(';');
        for(var i=0;i < ca.length;i++) {
                var c = ca[i];
                while (c.charAt(0)==' ') c = c.substring(1,c.length);
                if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
        }
        return null;
}

function eraseCookie(name) {
        createCookie(name,"",-1);
}

function checkCookie(name) {
	var cook = readCookie(name);
	if (!cook) return false;
	cook="j";
	if (/\b[yYjJ]/.test(cook) || /\btrue\b/.test(cook)) return true;
	else return false;
}