= 0 || a.lastIndexOf(‘iPhone’) >= 0)
return 0;
if (a.lastIndexOf(‘iPad’) >= 0)
return 1;
if (a.lastIndexOf(‘Android’) >= 0)
return 2;
return 3;
}
var bw = browserType();
function setDatePublished(strDate)
{
var node = document.getElementById(‘date_published’);
var year = strDate.substr(0, 4);
var month = strDate.substr(4, 2);
var day = strDate.substr(6, 2);
var hour = strDate.substr(9, 2);
var min = strDate.substr(11, 2);
var secs = strDate.substr(13, 2);
var dd = new Date();
var offset;
dd.setUTCFullYear(year, month – 1, day);
dd.setUTCHours(hour, min, secs);
strDate = dd.toLocaleString();
offset = strDate.lastIndexOf(‘ UTC’);
if (offset > 0)
strDate = strDate.substring(0, offset);
node.textContent = strDate;
}
function VectorLength(x, y)
{
x = parseFloat(x);
y = parseFloat(y);
return Math.sqrt((x*x) + (y*y));
}
function VectorLengthNormalized(x, y)
{
x = parseFloat(x);
y = parseFloat(y);
var length = VectorLength(x, y);
x = x / length;
y = y / length;
return VectorLength(x, y);
}
function nearestMediaForSize(component, mediaSize)
{
var mediaVec = VectorLength(mediaSize.height, mediaSize.width);
var nearest = null;
var nearestVec = 0;
var elementChildren = component.firstElementChild;
var latest = elementChildren;
while (elementChildren != null && latest.nextElementSibling == null)
{
var item = elementChildren;
var width = parseFloat(item.getAttribute(‘width’), 10);
var height = parseFloat(item.getAttribute(‘height’), 10);
var role = item.getAttribute(‘role’);
var href = item.getAttribute(‘href’);
elementChildren = elementChildren.firstElementChild;
latest = item;
if (role != null)
{
if (role.search(‘@2x’) != -1)
{
width /= 2;
height /= 2;
}
var imgVec = VectorLength(height, width);
if (nearestVec == 0)
{
nearest = item;
nearestVec = imgVec;
}
else if (Math.abs(imgVec – mediaVec)
–
BEN STANSALL
setImageWidth(“photo3”);
From watercolour painting to restoration projects in Transylvania, Charles has had seven decades to develop a wide range of hobbies and interests.
His passion for saving the planet and organic farming — once mocked as cranky — is now seen as well ahead of his time.
But a tendency to lobby his personal views on subjects such as contemporary architecture has prompted questions over his judgement.
– Architecture –
In the 1980s, Charles mounted a crusade against “ugly” modern architecture, decrying a proposed extension to the National Gallery on Trafalgar Square in London as a “monstrous carbuncle”. The planned design was scrapped.
Despite mockery, he put his philosophy into practice by backing construction of a model village called Poundbury on…