|
<script> |
|
jQuery(function($) { |
|
function getHostName(url) { |
|
var match = url.match(/:\/\/(www[0-9]?\.)?(.[^/:]+)/i); |
|
if (match != null && match.length > 2 && typeof match[2] === 'string' && match[2].length > 0) { |
|
return match[2]; |
|
} |
|
else { |
|
return null; |
|
} |
|
} |
|
|
|
function getDomain(url) { |
|
var hostName = getHostName(url); |
|
var domain = hostName; |
|
|
|
if (hostName != null) { |
|
var parts = hostName.split('.').reverse(); |
|
|
|
if (parts != null && parts.length > 1) { |
|
domain = parts[1] + '.' + parts[0]; |
|
|
|
if (hostName.toLowerCase().indexOf('.co.uk') != -1 && parts.length > 2) { |
|
domain = parts[2] + '.' + domain; |
|
} |
|
} |
|
} |
|
return domain; |
|
} |
|
function checkCookieEu() |
|
{ |
|
var consent = getCookieEu("COOKIE_CONSENT"); |
|
|
|
if (consent == null || consent == "" || consent == undefined) { |
|
$('#cookie-directive-container').show(); |
|
} |
|
} |
|
|
|
function setCookieEu(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 + ";domain=" + getDomain(window.location.href) + ";path=/"; |
|
|
|
$('#cookie-directive-container').hide('slow'); |
|
} |
|
|
|
function getCookieEu(c_name) |
|
{ |
|
var i,x,y,ARRcookies=document.cookie.split(";"); |
|
for (i=0;i<ARRcookies.length;i++) { |
|
x=ARRcookies[i].substr(0,ARRcookies[i].indexOf("=")); |
|
y=ARRcookies[i].substr(ARRcookies[i].indexOf("=")+1); |
|
x=x.replace(/^\s+|\s+$/g,""); |
|
if (x==c_name) { |
|
return unescape(y); |
|
} |
|
} |
|
} |
|
|
|
checkCookieEu(); |
|
|
|
$("#cookie-accept-button").click(function() { |
|
setCookieEu("COOKIE_CONSENT", 1, 365); |
|
}); |
|
}); |
|
</script> |