function localInit() {
try { pageInit() } catch (e) {;}
}

function woosh() {
woosh = document.getElementById("whoops");
woosh.title = woosh.innerHTML;
setInterval("wavey(woosh)",100);
}

origin = 0;
startchange = 1;
flagw = true;
localflag = false;
if (document.location.href.substr(0,7) == "file://") localflag=true;

function wavey(obj) {

wavelength = 4;

txt = obj.title;
len = txt.length;
if (origin > wavelength) startchange = 1;
if (origin < 1) startchange = -1;
origin -= startchange;
replac = "";
posn = origin;
change = startchange;

for (var x=0;x<len;x++) {
	m = txt.substr(x,1) + "";
	if (m == " ") m = "&nbsp;";
	if (m == "_") m = "&nbsp;";
	wav = obj.className;
//	sea ripple (default)
	if (wav == "0") replac += "<span style=position:relative;top:" + ((posn)-wavelength) + "px>" + m + "</span>";
//	sound compression
	if (wav == "1") replac += "<span style=position:relative;left:" + posn + "px>" + m + "</span>";
//	twinkle
	n = Math.floor(100*Math.random());
	if (wav == "2") replac += "<span style=width:1en;height:1em;color:rgb(" + n + "%," + n + "%,100%);font-weight:bold;>" + m + "</span>";

	posn += change;
	if (posn>wavelength) change = -1;
	if (posn<1) change = 1;
	}
obj.innerHTML = replac;
}

function refresher(n) {
if (tday.getTime() > modified.getTime() + ((n-1) * day)) document.getElementById("panicButton").style.display = "block";
if (tday.getTime() > modified.getTime() + (n * day)) document.location.reload(1);
}

var xlp = ["Andy","Rob","Alan","Dick","Phil","Dave","Colin","Ron","Roger","Steve","Ken","Pete","Paul","Les","Geoff","Eric","Nigel","Terry","Keith","Nick","Chris","Mick","Tony","Martin","Mike","Kevin","Trevor","Brian","Derek","John","Ian"];
var xlplen = xlp.length;
var xlpno=Math.floor(Math.random()*(xlplen));

function expho(num) {
if (xlpno + num + 1 >xlplen) num = num - xlplen;
document.writeln(xlp[xlpno + num]);
}

var mcp = ["AJS","Ariel","BSA","Norton","Matchless","Royal Enfield","Triumph","Panther","Velocette","Vincent","Scott"];
var mcplen = mcp.length;
var mcpno=Math.floor(Math.random()*(mcplen));

function rider(num) {
if (mcpno + num + 1 >mcplen) num = num - mcplen;
document.writeln(mcp[mcpno + num]);
}

function startShuffle() {
obj = document.getElementById('phrase');
obj.title = obj.innerHTML;
shufint = setInterval("shuffleWords()",5000);
shuffleWords(nam);
}

function shuffleWords() {
obj = document.getElementById('phrase');
temp = obj.title.toLowerCase();
word_array = temp.split(" ");
rand_array = word_array.slice();
rand_array.shuffle();
rand_array[0] = rand_array[0].charAt(0).toUpperCase() + rand_array[0].substring(1,rand_array[0].length);
new_phrase = rand_array.join(" ");
obj.innerHTML = new_phrase;
}

function subscription(inout) {
obj = document.getElementById("response");
if (obj.innerHTML.length == 0) {
	if (document.newsform.EMAIL.value == "") {
		alert("Please put in your email address");
		document.newsform.EMAIL.focus();
		return false;
		}
	if (document.newsform.REALNAME.value == "") {
		alert("Please put in your name");
		document.newsform.REALNAME.focus();
		return false;
		}

	obj.innerHTML = "Thank you for joining the free News Update service. You can leave any time by using this form or send me an email or just say so when you see me.";

	if (inout == 1) {
		document.newsform.action = 'http://portal.plus.net/office/mycircular/remote_scripts/script_remove_contact.php3?sYTC5gRj0VNO4pYECa2Rh5Bg3dUquyoz';
		obj.innerHTML = "You have now been removed from the circulation list.\nSorry to see you go.\nYou can rejoin any time.";
		}

	document.newsform.submit();

	} else {
	alert("Please refresh the page (f5) if you wish to send another Subscribe/Un-subscribe");
	}
}
//========================================
// added 6 Apr 2010

function offending() {
var grp = ["Everyone","women","men","foreigners","Irish","Christians","Jews","Moslems","swearing","disabled","gay","Americans","old","police","with explicit content","French","blondes","Scotsmen","with toilet humour","BSA riders (fair game)","Kiwis"];
var fozanchors = document.getElementById("IDcontent").getElementsByTagName("A");
for (var x=0;x<fozanchors.length;x++) {
	var offend = fozanchors[x].getAttribute("offends");
	if (offend) {
		var insults = offend.split(",");
		for (var y = 0;y<insults.length;y++) {
			var omg = document.createElement("IMG");
			omg.src="../home/gifs/foz" + insults[y] + ".gif";
			omg.className = "fozx";
			omg.alt = "May offend " + grp[parseInt(insults[y],10)];
			omg.onmouseover = redden;
			omg.onmouseout = whiten;
			fozanchors[x].appendChild(omg);
			}
		fozanchors[x].className="fozx";
		}
	}
}
//---------------------------------------
function redden() {this.style.backgroundColor = "#191c91";}
function whiten() {this.style.backgroundColor = "#818cd1";}
