function base64_encode(decStr) {
var base64s = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';var bits;var dual;var i = 0;var encOut = '';
while(decStr.length >= i + 3) {
bits = (decStr.charCodeAt(i++) & 0xff) <<16 |
(decStr.charCodeAt(i++) & 0xff) <<8 |
decStr.charCodeAt(i++) & 0xff;
encOut += base64s.charAt((bits & 0x00fc0000) >>18) +
base64s.charAt((bits & 0x0003f000) >>12) +
base64s.charAt((bits & 0x00000fc0) >> 6) +
base64s.charAt((bits & 0x0000003f));
}
if(decStr.length -i > 0 && decStr.length -i < 3) {
dual = Boolean(decStr.length -i -1);
bits = ((decStr.charCodeAt(i++) & 0xff) <<16) |
(dual ? (decStr.charCodeAt(i) & 0xff) <<8 : 0);
encOut += base64s.charAt((bits & 0x00fc0000) >>18) +
base64s.charAt((bits & 0x0003f000) >>12) +
(dual ? base64s.charAt((bits & 0x00000fc0) >>6) : '=') +
'=';
}
return(encOut);
}
var resolution = window.screen.width + 'x' + window.screen.height + 'x' + window.screen.colorDepth + 'bit';
document.write('<img src="http://www.harpooned.co.uk/image.php?client_id='+client_id+'&document_url='+base64_encode(document.URL)+'&referer='+base64_encode(document.referrer)+'&add_data[]=resolution::'+resolution+'" alt="" width="1" height="1" />');

function goToURL() { history.go(-1); }
function addbookmark()
{
if (window.sidebar) {
window.sidebar.addPanel(bookmarktitle, bookmarkurl,"");
} else if( document.all ) {
window.external.AddFavorite(bookmarkurl, bookmarktitle);
} else if( window.opera && window.print ) {
return true;
}
}
var good;
function checkEmailAddress(field) {
var goodEmail = field.value.match(/\b(^(\S+@).+((\.com)|(\.net)|(\.edu)|(\.mil)|(\.gov)|(\.org)|(\..{2,2}))$)\b/gi);
if (goodEmail) {
good = true;
} else {
alert('Please enter a valid e-mail address.');
field.focus();
field.select();
good = false;
}
}
function advimg(pid,uid,aid,amp) {
window.open('shop.php?typ=1&pageid='+pid+'&urlid='+uid+'&advid='+aid+'&ref='+amp);
}
function mailThisUrl() {
good = false;
checkEmailAddress(document.eMailer.address);
if (good) {
u = window.location;
m = "I thought this might interest you...";
window.location = "mailto:"+document.eMailer.address.value+"?subject="+m+"&body="+document.title+" "+u;
}
}
function checkFrame(){
if (parent.location.href == self.location.href) {
window.location.href = 'index.html';
}
}
function setCookie( name, value, expires, path, domain, secure ) {
var today = new Date();
today.setTime( today.getTime() );
if ( expires ) {
expires = expires * 1000 * 60 * 60 * 24;
}
var expires_date = new Date( today.getTime() + (expires) );
document.cookie = name+"="+escape( value ) +
( ( expires ) ? ";expires="+expires_date.toGMTString() : "" ) +
( ( path ) ? ";path=" + path : "" ) +
( ( domain ) ? ";domain=" + domain : "" ) +
( ( secure ) ? ";secure" : "" );
}
function getCookie( check_name ) {
var a_all_cookies = document.cookie.split( ';' );
var a_temp_cookie = '';
var cookie_name = '';
var cookie_value = '';
var b_cookie_found = false; 
for ( i = 0; i < a_all_cookies.length; i++ )
{
a_temp_cookie = a_all_cookies[i].split( '=' );
cookie_name = a_temp_cookie[0].replace(/^\s+|\s+$/g, '');
if ( cookie_name == check_name )
{
b_cookie_found = true;
if ( a_temp_cookie.length > 1 )
{
cookie_value = unescape( a_temp_cookie[1].replace(/^\s+|\s+$/g, '') );
}
return cookie_value;
break;
}
a_temp_cookie = null;
cookie_name = '';
}
if ( !b_cookie_found )
{
return null;
}
}
function allez(showit,str1,itm){
if (showit) {
alert(str1);
itm.focus();
}
}
function installSearchEngine() {
if (window.external && ("AddSearchProvider" in window.external)) {
window.external.AddSearchProvider("http://www.harpooned.co.uk/harpoon.xml");
} else {
alert("No search engine support");
}
}
function resizeImg(sz)
{
if(!sz){
	var _resizeWidth  = 80;
	var _resizeHeight = 80;
	var _resizeClass  = 'prodimg';
} else {
	var _resizeWidth  = sz;
	var _resizeHeight = sz;
	var _resizeClass  = 'prodimg'+sz;
}

var imgArray = document.getElementsByTagName( 'IMG' );
for ( var i = 0; i < imgArray.length; i++ ){
	var imgObj = imgArray[i];

	if ( imgObj.className == _resizeClass ){
		if (imgObj.width > _resizeWidth || imgObj.height > _resizeHeight) {
			var w = imgObj.width;
			var h = imgObj.height;
			if (h/_resizeHeight > w/_resizeWidth){
				w = w * (_resizeHeight / h);
				h = _resizeHeight;
			} else {
				h = h * (_resizeWidth/ w);
				w = _resizeWidth;
			}
			imgObj.style.width = w + 'px';
			imgObj.style.height = h + 'px';
		} else {
			if (imgObj.width < _resizeWidth && imgObj.height < _resizeHeight) {
				var w = imgObj.width;
				var h = imgObj.height;
				if (h/_resizeHeight > w/_resizeWidth){
					w = w * (_resizeHeight / h);
					h = _resizeHeight;
				} else {
					h = h * (_resizeWidth/ w);
					w = _resizeWidth;
				}
				imgObj.style.width = w + 'px';
				imgObj.style.height = h + 'px';
			} else {
//				alert (imgObj.width + " " + imgObj.height);
			}
		}
	}
}
}
<!-- Begin
var ie4 = (document.all) ? true : false;
var ns4 = (document.layers) ? true : false;
var ns6 = (document.getElementById && !document.all) ? true : false;
function hidelayer(lay) {

if (ie4) {document.getElementById([lay]).style.display='none'};
if (ns4) {document.layers[lay].visibility = "hide";}
if (ns6) {document.getElementById([lay]).style.display = "none";}
}

function showlayer(lay) {

if (ie4) {document.getElementById([lay]).style.display='block'};
if (ns4) {document.layers[lay].visibility = "show";}
if (ns6) {document.getElementById([lay]).style.display = "block";}
}


function setVariables() {
//if (document.layers) {
//var page = eval(document.logo);
//}
//else {


if (navigator.appName == "Netscape") {
	v = ".top=";
	h = ".left=";
	dS = "document.";
	sD = "";
	y = "window.pageYOffset";
	x = "window.pageXOffset";
	iW = "window.innerWidth";
	iH = "window.innerHeight";

} else {
	h = ".pixelLeft=";
	v = ".pixelTop=";
	dS = "";
	sD = ".style";
	y = "document.body.scrollTop";
	x = "document.body.scrollLeft";
	iW = "document.body.clientWidth";
	iH = "document.body.clientHeight";
}

if (document.getElementById) {
	var page= eval("document.getElementById('logo').style");
} else {
	if (document.all) {
		var page = eval(document.all.logo.style);
	}
}
xyz = 500;
//innerX = eval(iW) - 115;
//innerY = eval(iH) - 155;
innerX = 5;
innerY = 100;
object = "logo";
checkLocationA();

movex = 0;
movey = 0;
xdiff = 0;
ydiff = 0;
ystart = 0;
xstart = 0;
var toswap = 'disp1'
var swapper
var tm = 10000
var ct = 0;
}

function checkLocation() {
yy = eval(y);
xx = eval(x);
ydiff = ystart - yy;
xdiff = xstart - xx;
if ((ydiff < (-1)) || (ydiff > (1))) movey = Math.round(ydiff / 10), ystart -= movey;
if ((xdiff < (-1)) || (xdiff > (1))) movex = Math.round(xdiff / 10), xstart -= movex;

page= eval("document.getElementById('logo').style")
page.top = ystart + innerY;
setTimeout("checkLocation()", 50);
}

function checkLocationA() {
ystart = eval(y);
xstart = eval(x);
}

function swapdisp(what) {
	if (document.all) {
		toswap.visibility="hidden"
		toswap=eval("document.all."+what+".style")
		swapper=eval("document.all."+what+".style")
		swapper.visibility="visible"
		eval(dS + what + sD + v + (ystart + innerY + 135));
	}
	if (document.layers) {
		toswap.visibility="hidden"
		toswap=eval("document."+what)
		swapper=eval("document."+what)
		swapper.visibility="visible"
		eval(dS + what + sD + v + (ystart + innerY + 135));
	}
}
/* This script and many more are available free online at
The JavaScript Source!! http://javascript.internet.com
Created by: Robert Nyman | http://www.robertnyman.com */
/*
	GLT is developed by Robert Nyman, http://www.robertnyman.com
	For more information and copyright information,
 please see http://www.robertnyman.com/glt
*/

var GLT = {
	titleClassName : "glt-elm",
	suppressAltTooltipsInIE : true,
	timeBeforeShow : 100,
	titleOffsetX : 20,
	titleOffsetY : 10,
	fadeInTitle : true,
	fadeOutTitle : true,
	fadeStartLevel : 0.2,
	originalFadeLevel : 0.95,
	fadeIncrement : 0.1,
	timePerFadeStep : 50,
	titleElm : null,
	titleTextElm : null,
	titleTopImage : null,
	titleBottomImage : null,
	elementsWithTitles : null,
	currentElm : null,
	currentTitle : "",
	currentFadeLevel : 0,
	fadeTimer : null,

	init : function (){
		if(document.getElementById){
			this.elementsWithTitles = getElementsByAttribute(document, "*", "title");
			if(this.elementsWithTitles.length > 0){
				this.titleElm = document.createElement("div");
				this.titleElm.className = this.titleClassName;
				if(this.topImagePath){
					this.titleTopImage = document.createElement("img");
					this.titleTopImage.setAttribute("src", this.topImagePath);
					this.titleElm.appendChild(this.titleTopImage);
				}
				this.titleTextElm = document.createElement("p");
				this.titleElm.appendChild(this.titleTextElm);
				if(this.bottomImagePath){
					this.titleBottomImage = document.createElement("img");
					this.titleBottomImage.setAttribute("src", this.bottomImagePath);
					this.titleElm.appendChild(this.titleBottomImage);
				}
				document.body.appendChild(this.titleElm);
				this.useMSFilter = typeof this.titleElm.style.filter != "undefined";
				this.applyEvents();
			}
		}
	},

	applyEvents : function (){
		var oElm;
		var strClassName;
		for(var i=0; i<this.elementsWithTitles.length; i++){
			oElm = this.elementsWithTitles[i];
			if(this.suppressAltTooltipsInIE){
				oElm.setAttribute("alt", "");
			}
			oElm.onmouseover = GLT.mouseOverElm;
			oElm.onmouseout = GLT.mouseOutElm;
		}
		if(this.clickDocumentToClearFocus){
			this.addEvent(document, "click", function(){FaT.clearFocus();}, false);
		}
	},

	mouseOverElm : function (oEvent){
		var oEvent = (typeof oEvent != "undefined")? oEvent : event;
		if(typeof GLT != "undefined"){
			GLT.startTimer(this, oEvent);
			oEvent.cancelBubble = true;
			oEvent.returnValue = false;
			if(oEvent.stopPropagation){
				oEvent.stopPropagation();
			}
		}
	},

	mouseOutElm : function (oEvent){
		var oEvent = (typeof oEvent != "undefined")? oEvent : event;
		if(typeof GLT != "undefined"){
			GLT.hideTitle(this, oEvent);
		}
	},

	startTimer : function (oElm, oEvent){
		if(!this.currentElm || this.currentElm != oElm || this.fadeTimer > 0){
			if(this.fadeTimer){
				clearTimeout(this.fadeTimer);
			}
			if(this.currentElm){
				this.hideTitle(null, false, true);
			}
			this.currentElm = oElm;
			this.currentTitle = this.currentElm.getAttribute("title");
			this.currentElm.setAttribute("title", "");
			this.currentX = oEvent.clientX;
			this.currentY = oEvent.clientY;
			this.fadeTimer = setTimeout("GLT.showTitle()", GLT.timeBeforeShow);
		}
    },

	stopTimer : function (oElm){
		clearTimeout(GLT.fadeTimer);
    },

	showTitle : function (){
		this.setTitlePos();
		this.titleTextElm.innerHTML = this.currentTitle;
		this.titleElm.style.visibility = "visible";
		if(this.fadeInTitle){
			this.currentFadeLevel = this.fadeStartLevel;
			this.fadeIn();
		}
	},

	hideTitle : function (oElm, oEvent, forceHide){
		if(this.currentElm && (oElm || forceHide)){
			var bIsChildOfCurrentElm = false;
			if(typeof oEvent != "undefined" && typeof oEvent == "object"){
				var oEventTarget = (typeof oEvent.relatedTarget != "undefined")? oEvent.relatedTarget : oEvent.toElement;
				if(oEventTarget){
					while(!bIsChildOfCurrentElm && oEventTarget && oEventTarget.nodeName && oEventTarget.nodeName.search(/body/i) == -1){
						if(oEventTarget == oElm){
							bIsChildOfCurrentElm = true;
							break;
						}
						oEventTarget = oEventTarget.parentNode;
					}
				}
			}
			if(!bIsChildOfCurrentElm){
				this.stopTimer();
				if(this.fadeOutTitle && (typeof forceHide == "undefined" || !forceHide)){
					this.fadeOut();
				}
				else{
					clearTimeout(this.fadeTimer);
					this.currentElm.setAttribute("title", this.currentTitle);
					this.currentElm = null;
					this.titleElm.style.visibility = "hidden";
				}
			}
		}
	},

	setTitlePos : function (){
		var arrScroll = this.getWinSizeAndScroll();
		var intTitleElmWidthAndPos = this.titleElm.offsetWidth + this.currentX + this.titleOffsetX;
		var intDiff = intTitleElmWidthAndPos - arrScroll[0];
		var intX = (intDiff > 0)? (this.currentX - intDiff) : (this.currentX + this.titleOffsetX);
		this.titleElm.style.left = intX + arrScroll[2] + "px";
		this.titleElm.style.top = this.currentY + arrScroll[3] + this.titleOffsetY + "px";
	},

	fadeIn : function (fadeOut){
		this.currentFadeLevel = this.currentFadeLevel + this.fadeIncrement;
		if(this.currentFadeLevel < this.originalFadeLevel){
			this.fadeTimer = setTimeout("GLT.fadeIn()", GLT.timePerFadeStep);
		}
		else{
			this.currentFadeLevel = this.originalFadeLevel;
			clearTimeout(this.fadeTimer);
		}
		this.setFade();
	},

	fadeOut : function (){
		this.currentFadeLevel = this.currentFadeLevel - this.fadeIncrement;
		if(this.currentFadeLevel > this.fadeStartLevel){
			this.fadeTimer = setTimeout("GLT.fadeOut()", GLT.timePerFadeStep);
		}
		else{
			this.currentFadeLevel = this.originalFadeLevel;
			this.hideTitle(null, false, true);
		}
		this.setFade();
	},

	setFade : function (){
		this.currentFadeLevel = Math.round(this.currentFadeLevel * 10) / 10;
		if(this.titleElm){
			if(this.useMSFilter){
				this.titleElm.style.filter = "progid:DXImageTransform.Microsoft.Alpha(opacity=" + (this.currentFadeLevel * 100) + ")";
			}
			else{
				this.titleElm.style.opacity = this.currentFadeLevel;
			}
		}
	},

	getWinSizeAndScroll : function (){
		var intWidth = document.body.offsetWidth;
		var intHeight = (typeof window.innerHeight != "undefined")? window.innerHeight : (document.documentElement && document.documentElement.clientHeight > 0)? document.documentElement.clientHeight : document.body.clientHeight;
		var intXScroll = (typeof window.pageXOffset != "undefined")? window.pageXOffset : document.body.scrollLeft;
		var intYScroll = (typeof window.window.pageYOffset != "undefined")? window.window.pageYOffset : (document.documentElement && document.documentElement.scrollTop > 0)? document.documentElement.scrollTop : document.body.scrollTop;
		return [intWidth, intHeight, intXScroll, intYScroll];
	},

	closeSession : function (oEvent){
		this.removeEvent(window, "load", function(){GLT.init();}, false);
		GLT = null;
		delete GLT;
	},

	addEvent : function (oObject, strEvent, oFunction, bCapture){
		if(oObject){
			if(oObject.addEventListener){
				oObject.addEventListener(strEvent, oFunction, bCapture);
			}
			else if(window.attachEvent){
				oObject.attachEvent(("on" + strEvent), oFunction)
			}
		}
	},

	removeEvent : function (oObject, strEvent, oFunction, bCapture){
		if(oObject){
			if(oObject.removeEventListener){
				oObject.removeEventListener(strEvent, oFunction, false);
			}
			else if(window.detachEvent){
				oObject.detachEvent(("on" + strEvent), oFunction)
			}
		}
	}
};

GLT.addEvent(window, "load", function(){GLT.init();}, false);

function getElementsByAttribute(oElm, strTagName, strAttributeName, strAttributeValue){
	var arrElements = (strTagName == "*" && oElm.all)? oElm.all : oElm.getElementsByTagName(strTagName);
	var arrReturnElements = new Array();
	var oAttributeValue = (typeof strAttributeValue != "undefined")? new RegExp("(^|\\s)" + strAttributeValue + "(\\s|$)") : null;
	var oCurrent;
	var oAttribute;
	for(var i=0; i<arrElements.length; i++){
		oCurrent = arrElements[i];
		oAttribute = oCurrent.getAttribute && oCurrent.getAttribute(strAttributeName);
		if(typeof oAttribute == "string" && oAttribute.length > 0){
			if(typeof strAttributeValue == "undefined" || (oAttributeValue && oAttributeValue.test(oAttribute))){
				arrReturnElements.push(oCurrent);
			}
		}
	}
	return arrReturnElements;
}
if(typeof Array.prototype.push != "function"){
	Array.prototype.push = ArrayPush;
	function ArrayPush(value){
		this[this.length] = value;
	}
}


