Spanish legal cookies notice

In Spain law required add a cookies use notice at the start the web, this JS is to place at the top of index.php file and comply with internet laws. It's only visible to Spanish IP's.

<!DOCTYPE html>
<html class="no-js" lang="en-US">
<head><title>AVISO</title></head>
<body>
<div id="barritaloca" style="display:none;position:fixed;left:0px;right:0px;bottom:0px;width:100%;min-height:40px;background: #333333;color:#dddddd;z-index: 99999;">
<div style="width:100%;position:absolute;padding-left:5px;font-family:verdana;font-size:12px;top:30%;">
    Usamos cookies propias y de terceros para mostrar publicidad personalizada seg&uacute;n su navegaci&oacute;n. Si continua navegando consideramos que acepta el uso de cookies.
    <a href="javascript:void(0);" style="padding:4px;background:#4682B4;text-decoration:none;color:#fff;" onclick="PonerCookie();"><b>OK</b></a>
    <a href="www.exemple.com/privacy/" target="_blank" style="padding-left:5px;text-decoration:none;color:#ffffff;">M&aacute;s informaci&oacute;n</a>
</div>
</div>
<script>
    function getCookie(c_name){
        var c_value = document.cookie;
        var c_start = c_value.indexOf(" " + c_name + "=");
        if (c_start == -1){
            c_start = c_value.indexOf(c_name + "=");
        }
        if (c_start == -1){
            c_value = null;
        }else{
            c_start = c_value.indexOf("=", c_start) + 1;
            var c_end = c_value.indexOf(";", c_start);
            if (c_end == -1){
                c_end = c_value.length;
            }
            c_value = unescape(c_value.substring(c_start,c_end));
        }
        return c_value;
    }

    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 getgeoip(json){
        if (json.country_code=="ES" && getCookie('aviso')!="1") {
            document.getElementById("barritaloca").style.display="block";
        }

    }

    function PonerCookie(){
        setCookie('aviso','1',365);
        document.getElementById("barritaloca").style.display="none";
    }
</script>
<script type="application/javascript" src="http://www.telize.com/geoip?callback=getgeoip"></script&gt;
</body>
</html>

CHANGES
- Change Line 9 "www.exemple.com/privacy/" for your privacy web page
- To put the bar up change Line 4 "position:fixed" for "position:relative"

Bar text in english: "
We use own and third party cookies to display personalized publicity by navigation. If you continue browse consider to accept the cookies use."

Via: http://forobeta.com/tutoriales/200436-aviso-de-cookies-espana-y-demas-paises.html