//Open thumbnail image in larger window
function OpenWindow(pFileName,pTitle,pCaption,pWidth,pHeight) {
NewWindow=window.open("","Image","width=" + pWidth + ",height=" + pHeight + ",screenX=25,screenY=25,left=25,top=25");
NewWindow.document.write ('
');
NewWindow.document.write ('' + pTitle + '');
NewWindow.document.write ("");
NewWindow.document.write ('' + pTitle + '
');
NewWindow.document.write ("
(Click image or outside frame to close image)");
NewWindow.document.close();
//In Netscape bring the window to the front
if(navigator.appName.substring(0,8) == "Netscape") NewWindow.focus();
}
// Cookie functions from Fareham webshop project - Added 19th Nov 2011 */
function getCartID() {
var part1 = Math.ceil(Math.random() * 100);
var part2 = Math.ceil(Math.random() * 10000);
return part1 + "-" + part2;
}
// Fixed length cookie value generator
function makeKey(length) {
var chars="ABCDEFGHJKLMNPQRSTUVWXYZ0123456789";
var keyval = '';
for(var i=0; i < length; i++) {
keyval = keyval + chars.charAt(Math.random() * 34 - 1)
}
return keyval;
}
// Return named cookie value, null if not set
function readCookie(name) {
var lookupName = 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(lookupName) == 0) return c.substring(lookupName.length,c.length);
}
return null;
}
function createCookie(name,days) {
if (days) {
var date = new Date();
date.setTime(date.getTime()+(days*24*60*60*1000));
var expires = "; expires="+date.toGMTString();
var cookieVal = makeKey(7);
} else {
var expires = ";";
}
document.cookie = name+"="+cookieVal+"; "+expires+"; path=/";
alert('Cookie '+name+' set to '+cookieVal);
}
function setSiteCookie(name, days) {
if (readCookie(name)) {
alert('Cookie ' + name + ' already set');
} else {
createCookie(name,days);
}
}
// Attach to temporary button to validate individual cookie values
function showCookie(name) {
var cookieVal = readCookie(name)
if (cookieVal) {
alert(cookieVal);
} else {
alert('Cookie ' + name + ' not defined');
}
}
// Erase named cookie by setting date in the past
// Not necessary as we just allow them to expire
function eraseCookie(name) {
createCookie(name,-1);
}