function getPageTracker(){
return _gat._getTracker("UA-2506285-1");
}
//global page tracker that onclick pdf handlers can access
var pageTracker;
//global object to store arbitrary things in
var pouch = new Object();
pouch.transSourcecode = 'none'; //set a default for the sourcecode
pouch.transSKU = 'DO1'; //set a default for the SKU
pouch.url = ''; //a useful url
/*you tube flash display parameters*/
var ytparams = {
allowScriptAccess: 'always',
wmode:'transparent'
};
var ytatts = { id: 'ytplayer' };
function jump_menu(targ,selObj,restore){ //v3.0
eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
if (restore) { selObj.selectedIndex=0; }
}
//edited by chris
function MM_jumpMenu(targ,selObj,restore){ //v3.0 to maintain compatiblity - will be deprecated after June 01
eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
if (restore) { selObj.selectedIndex=0; }
}
function openBrWindow(theURL,winName,features) { //v2.0
window.open(theURL,winName,features);
//if (newWind.opener == null) { // for Nav 2.0x
//newWind.opener = self // this creates and sets a new property
//}
}
//line break to
conversion utils for textarea elements Chrisg 19.02.04
//Now generic to any field regards of name where output should be XHTML
function addBRtags(selObj){
for (i=0; i < selObj.elements.length; i++){
if (selObj.elements[i].type=="textarea"){
if(selObj.elements[i].value.indexOf("
")==-1){
selObj.elements[i].value = selObj.elements[i].value.replace(new RegExp("[\n\r]","g"),"
");
}
}
}
}
function removeBRtags(selObj){
if(selObj){
selObj.value = selObj.value.replace(new RegExp("
","g"),"\r");
selObj.value = selObj.value.replace(new RegExp("
","g"),"\r");
}
}
function composeToFOE (cand,subj) {
var doc;
var body = "Message sent from this page:\r\n"+window.location.href+"\r\n";
if(cand!='' && cand.indexOf('@')==-1) {
cand = cand+'@foe.co.uk';
}
if(subj==undefined) {
subj = '';
doc = "mailto:" + cand;
} else {
doc = "mailto:" + cand+ "?subject="+escape(subj)+"&body="+escape(body);
}
// POP UP EMAIL MESSAGE WINDOW
window.location = doc;
}
//check that a letters servlet form has a valid recipient
function has_valid_recipient (theForm) {
var hasRecip = false, i = 0, el;
var emptyPat = /^\s*$/;
for (i=0; i < theForm.elements.length; i++) {
if (theForm.elements[i].name=="email_and_name_of_recipient") {
if(!theForm.elements[i].value.match(emptyPat) && theForm.elements[i].value.indexOf(" 0) {
if((el = document.getElementById('donation-amt1')) != null && el.value == lterm) {
el.checked = true;
if((el = document.getElementById('Total_Money_Required')) != null) {
el.value = lterm;
}
} else
if((el = document.getElementById('donation-amt2')) != null && el.value == lterm) {
el.checked = true;
if((el = document.getElementById('Total_Money_Required')) != null) {
el.value = lterm;
}
} else
if((el = document.getElementById('donation-amt3')) != null && el.value == lterm) {
el.checked = true;
if((el = document.getElementById('Total_Money_Required')) != null) {
el.value = lterm;
}
} else
if((el = document.getElementById('donation-amt4')) != null) {
el.checked = true;
if((el = document.getElementById('donation-amt-other')) != null) {
el.value = lterm;
}
if((el = document.getElementById('Total_Money_Required')) != null) {
el.value = lterm;
}
}
} //end lterm
} //end start
} //end window location
}
//set a form field from the currently selected menu option
//used for feedback comment form
function setCommentRecip (menu,field) {
if(menu != undefined && field != undefined) {
if(menu.selectedIndex>0) {
if(menu[menu.selectedIndex].value.indexOf('ink')!=-1) {
field.value = "info@foe.co.uk";
return;
}
}
field.value = "info@foe.co.uk";
}
}
/* validate firstname, surname, 1st address line, postcode and display warning if none entered */
function validatePostcode (f,postcodeEl) {
if(postcodeEl!=undefined && postcodeEl.value=='') {
var el;
if((el = document.getElementById('postcodewarning'))!=null) {
el.style.display = 'inline';
}
postcodeEl.focus();
return false;
}
return true;
}
/* validate a text field and display warning if none entered
Missing form element highlighting added by chrisg 10/09/08
*/
function has_valid_text_fields(theForm) {
//clear border colors in case of multiple tests
if (document.getElementById('rq_address1') !==null){
document.getElementById('rq_address1').style.borderColor = "";
}
if (document.getElementById('rq_postcode') !==null){
document.getElementById('rq_postcode').style.borderColor = "";
}
if (document.getElementById('rq_fname') !==null){
document.getElementById('rq_fname').style.borderColor = "";
}
if (document.getElementById('rq_sname') !==null){
document.getElementById('rq_sname').style.borderColor = "";
}
var invalid_counter = 0;
if(theForm.rq_address1!==undefined && theForm.rq_address1.value==='') {
if (document.getElementById('rq_address1') !==null){
document.getElementById('rq_address1').style.borderColor = "red";
}else{
//alert kept for older browsers
alert('You need to fill in the first address field');
}
invalid_counter++;
}
if(theForm.rq_postcode!==undefined && theForm.rq_postcode.value==='') {
if (document.getElementById('rq_postcode') !==null){
document.getElementById('rq_postcode').style.borderColor = "red";
}else{
alert('You need to fill in the postcode');
}
invalid_counter++;
}
if(theForm.rq_fname!==undefined && theForm.rq_fname.value==='') {
if (document.getElementById('rq_fname') !==null){
document.getElementById('rq_fname').style.borderColor = "red";
}else{
alert('You need to fill in your firstname');
}
invalid_counter++;
}
if(theForm.rq_sname!==undefined && theForm.rq_sname.value==='') {
if (document.getElementById('rq_sname') !==null){
document.getElementById('rq_sname').style.borderColor = "red";
}else{
alert('You need to fill in your surname');
}
invalid_counter++;
}
//invalid_counter > 0 if any missing fields
if (invalid_counter !==0){
if (document.getElementById('valid') !==null){
document.getElementById('valid').style.display = "block";
}
return false;
}else{
return true;
}
}
/*
similar to the above but generic
see if any data has been passed in on the url querystring with 'qs_param_name' parameter
use it to set the value of form element form_el
*/
function setFormValueFromQuerystring (form, qs_param_name, form_el) {
var el = '', loc = '', term = '', origterm = '';
var start = 0, end = 0, paramlen = 0;
if(window.location.href.indexOf(qs_param_name)!=-1) {
paramlen = qs_param_name.length;
loc = window.location.href;
start = loc.indexOf(qs_param_name+'=');
if(start != -1) {
start += paramlen+1; end = loc.indexOf('&',start);
if(end==-1) { end = loc.length; }
origterm = loc.substring(start,end);
origterm = unescape(origterm);
term = origterm.toLowerCase();
term = unescape(term);
//if(term.indexOf(' ') == -1) {
if(form_el!=undefined) {
if(form_el.type.indexOf('select')!=-1) {
//match the term to an option value
var ife = 0;
for(ife=0;ife Old code - flag for removal:
if((message = document.getElementById('sender_postcode'))!=null) {
message = document.getElementById('sender_postcode');
message.className = 'hidden';
}
*/
var url = '/app/AddressServlet?template_park='+tpark+'&';
if(prem != null && prem != '') {
url = url + 'premises=' + prem.value + '&';
}
if(pc != null && pc.value != '') {
url = url + 'postcode=' + pc.value + '&';
}
if(form != null && form != '') {
url = url + 'formname=' + form+ '&';
}
if(add1 != null && add1 != '') {
url = url + 'add1=' + add1 + '&';
}
if(add2 != null && add2 != '') {
url = url + 'add2=' + add2 + '&';
}
if(add3 != null && add3 != '') {
url = url + 'add3=' + add3 + '&';
}
if(add4 != null && add4 != '') {
url = url + 'add4=' + add4 + '&';
}
if(add5 != null && add5 != '') {
url = url + 'add5=' + add5 + '&';
}
if(wbpc != null && wbpc != '') {
url = url + 'wbpostcode=' + wbpc + '&';
}
if(funcname != null && funcname != '') {
url = url + 'scriptname=' + funcname + '&';
}
if(wbfuncname != null && wbfuncname != '') {
url = url + 'wbscriptname=' + wbfuncname + '&';
}
if(thost != undefined && thost != null) {
url = url + 'template_host=' + thost;
}
if(url.charAt(url.length) == '&') {
url = url.substring(0, url.length-2);
}
var winhdle = window.open(url, 'blob', 'scrollbars,resizable,width=600,height=600');
return true;
}
function validEmail ( cand ) {
if(cand.indexOf('@')==-1) {
alert('The email address should have a @');
return false;
}
if(cand.indexOf(' ')!=-1) {
alert('The email address should not have any spaces in it');
return false;
}
return true;
}
/* limit the number of checkboxes that can be checked in a particular group
JN 21/08/09
*/
function limitcheckboxes(boxgroup,boxlimit)
{
var group=boxgroup;
var limit=boxlimit;
var count=0;
for (var i=0; ilimit){
alert("Sorry, you can only select a maximum of "+limit+""); group[i].checked=false; return false;}
}
}
//plug in detection routines
// Copyright © 2000 by Apple Computer, Inc., All Rights Reserved.
//
// You may incorporate this Apple sample code into your own code
// without restriction. This Apple sample code has been provided "AS IS"
// and the responsibility for its operation is yours. You may redistribute
// this code, but you are not permitted to redistribute it as
// "Apple sample code" after having made changes.
var javascriptVersion1_1 = false;
javascriptVersion1_1 = true;
// initialize global variables
var detectableWithVB = false;
var pluginFound = false;
function goURL(daURL) {
// if the browser can do it, use replace to preserve back button
if(javascriptVersion1_1) {
window.location.replace(daURL);
} else {
window.location = daURL;
}
return;
}
function redirectCheck(pluginFound, redirectURL, redirectIfFound) {
// check for redirection
if( redirectURL && ((pluginFound && redirectIfFound) ||
(!pluginFound && !redirectIfFound)) ) {
// go away
goURL(redirectURL);
return pluginFound;
} else {
// stay here and return result of plugin detection
return pluginFound;
}
}
function canDetectPlugins() {
if( detectableWithVB || (navigator.plugins && navigator.plugins.length > 0) ) {
return true;
} else {
return false;
}
}
function detectFlash(redirectURL, redirectIfFound) {
pluginFound = detectPlugin('Shockwave','Flash');
// if not found, try to detect with VisualBasic
if(!pluginFound && detectableWithVB) {
pluginFound = detectActiveXControl('ShockwaveFlash.ShockwaveFlash.1');
}
// check for redirection
return redirectCheck(pluginFound, redirectURL, redirectIfFound);
}
function detectDirector(redirectURL, redirectIfFound) {
pluginFound = detectPlugin('Shockwave','Director');
// if not found, try to detect with VisualBasic
if(!pluginFound && detectableWithVB) {
pluginFound = detectActiveXControl('SWCtl.SWCtl.1');
}
// check for redirection
return redirectCheck(pluginFound, redirectURL, redirectIfFound);
}
function detectQuickTime(redirectURL, redirectIfFound) {
pluginFound = detectPlugin('QuickTime');
// if not found, try to detect with VisualBasic
if(!pluginFound && detectableWithVB) {
pluginFound = detectQuickTimeActiveXControl();
}
return redirectCheck(pluginFound, redirectURL, redirectIfFound);
}
function detectReal(redirectURL, redirectIfFound) {
pluginFound = detectPlugin('RealPlayer');
// if not found, try to detect with VisualBasic
if(!pluginFound && detectableWithVB) {
pluginFound = (detectActiveXControl('rmocx.RealPlayer G2 Control') ||
detectActiveXControl('RealPlayer.RealPlayer(tm) ActiveX Control (32-bit)') ||
detectActiveXControl('RealVideo.RealVideo(tm) ActiveX Control (32-bit)'));
}
return redirectCheck(pluginFound, redirectURL, redirectIfFound);
}
function detectWindowsMedia(redirectURL, redirectIfFound) {
pluginFound = detectPlugin('Windows Media Player');
// if not found, try to detect with VisualBasic
if(!pluginFound && detectableWithVB) {
pluginFound = detectActiveXControl('MediaPlayer.MediaPlayer.1');
}
return redirectCheck(pluginFound, redirectURL, redirectIfFound);
}
function detectPlugin() {
// allow for multiple checks in a single pass
var daPlugins = detectPlugin.arguments;
// consider pluginFound to be false until proven true
var pluginFound = false;
// if plugins array is there and not fake
if (navigator.plugins && navigator.plugins.length > 0) {
var pluginsArrayLength = navigator.plugins.length;
// for each plugin...
for (pluginsArrayCounter=0; pluginsArrayCounter < pluginsArrayLength; pluginsArrayCounter++ ) {
// loop through all desired names and check each against the current plugin name
var numFound = 0;
for(namesCounter=0; namesCounter < daPlugins.length; namesCounter++) {
// if desired plugin name is found in either plugin name or description
if( (navigator.plugins[pluginsArrayCounter].name.indexOf(daPlugins[namesCounter]) >= 0) ||
(navigator.plugins[pluginsArrayCounter].description.indexOf(daPlugins[namesCounter]) >= 0) ) {
// this name was found
numFound++;
}
}
// now that we have checked all the required names against this one plugin,
// if the number we found matches the total number provided then we were successful
if(numFound == daPlugins.length) {
pluginFound = true;
// if we've found the plugin, we can stop looking through at the rest of the plugins
break;
}
}
}
return pluginFound;
} // detectPlugin
// Here we write out the VBScript block for MSIE Windows
if ((navigator.userAgent.indexOf('MSIE') != -1) && (navigator.userAgent.indexOf('Win') != -1)) {
document.writeln('