function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
 var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
   var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
   if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
 var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
   var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
   if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_preloadImages() { //v3.0
 var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
   var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
   if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function mmLoadMenus() {
  if (window.mm_menu_0921152512_0) return;
  window.mm_menu_0921152512_0 = new Menu("root",138,15,"Verdana, Arial, Helvetica, sans-serif",11,"#14140e","#fee9a7","#aaa36f","#696937","left","middle",2,0,1000,-5,7,true,true,true,0,true,true);
  mm_menu_0921152512_0.addMenuItem("Sign-up&nbsp;for&nbsp;PAD&nbsp;action","location=relpath+'signup.htm'");
  mm_menu_0921152512_0.addMenuItem("News&nbsp;archive","location=relpath+'archive.htm'");
   mm_menu_0921152512_0.hideOnMouseOut=true;
   mm_menu_0921152512_0.menuBorder=1;
   mm_menu_0921152512_0.menuLiteBgColor='#aaa36f';
   mm_menu_0921152512_0.menuBorderBgColor='#14140e';
   mm_menu_0921152512_0.bgColor='#958d57';
  window.mm_menu_0215200640_0 = new Menu("root",101,15,"Verdana, Arial, Helvetica, sans-serif",11,"#14140e","#fee9a7","#aaa36f","#696937","left","middle",2,0,1000,-5,7,true,true,true,0,true,true);
  mm_menu_0215200640_0.addMenuItem("Vision&nbsp;&amp;&nbsp;mission","location=relpath+'vision.htm'");
  mm_menu_0215200640_0.addMenuItem("2005&nbsp;election","location=relpath+'election2005.htm'");
  mm_menu_0215200640_0.addMenuItem("Donations","location=relpath+'donations.htm'");
  mm_menu_0215200640_0.addMenuItem("Home","location=relpath+'index.htm'");
   mm_menu_0215200640_0.hideOnMouseOut=true;
   mm_menu_0215200640_0.menuBorder=1;
   mm_menu_0215200640_0.menuLiteBgColor='#aaa36f';
   mm_menu_0215200640_0.menuBorderBgColor='#14140e';
   mm_menu_0215200640_0.bgColor='#958d57';
  window.mm_menu_0215210219_1 = new Menu("root",112,15,"Verdana, Arial, Helvetica, sans-serif",11,"#14140e","#fee9a7","#aaa36f","#696937","left","middle",2,0,1000,-5,10,false,true,true,0,true,true);
  mm_menu_0215210219_1.addMenuItem("Conservative","location=relpath+'tory.htm'");
  mm_menu_0215210219_1.addMenuItem("Green","location=relpath+'green.htm'");
  mm_menu_0215210219_1.addMenuItem("Labour","location=relpath+'labour.htm'");
  mm_menu_0215210219_1.addMenuItem("Liberal&nbsp;Democrats","location=relpath+'libdem.htm'");
  mm_menu_0215210219_1.addMenuItem("Other&nbsp;parties","location=relpath+'other.htm'");
   mm_menu_0215210219_1.hideOnMouseOut=true;
   mm_menu_0215210219_1.menuBorder=1;
   mm_menu_0215210219_1.menuLiteBgColor='#aaa36f';
   mm_menu_0215210219_1.menuBorderBgColor='#14140e';
   mm_menu_0215210219_1.bgColor='#958d57';
  window.mm_menu_0216172743_3 = new Menu("root",190,15,"Verdana, Arial, Helvetica, sans-serif",11,"#14140e","#fee9a7","#aaa36f","#696937","left","middle",2,0,1000,-5,10,false,true,true,0,true,true);
//  mm_menu_0216172743_3.addMenuItem("EDM&nbsp;4&nbsp;Animal&nbsp;Testing&nbsp;of&nbsp;Food&nbsp;Additives","location=relpath+'edm4.htm'");
//    mm_menu_0216172743_3.addMenuItem("EDM&nbsp;127&nbsp;Ombudsman's&nbsp;Report&nbsp;PA-2823","location=relpath+'edm127.htm'");
  mm_menu_0216172743_3.addMenuItem("EDM&nbsp;97&nbsp;Animal&nbsp;Protection&nbsp;Policy","location=relpath+'edm97.htm'");
//  mm_menu_0216172743_3.addMenuItem("EDM&nbsp;1215&nbsp;Household&nbsp;Products","location=relpath+'edm1215.htm'");
//    mm_menu_0216172743_3.addMenuItem("EDM&nbsp;137&nbsp;Animal&nbsp;Testing&nbsp;of&nbsp;Cosmetics","location=relpath+'edm137.htm'");
   mm_menu_0216172743_3.hideOnMouseOut=true;
   mm_menu_0216172743_3.menuBorder=1;
   mm_menu_0216172743_3.menuLiteBgColor='#aaa36f'; //Set to table color 2006/07
//   mm_menu_0216172743_3.menuLiteBgColor='#F4E7BB';
   mm_menu_0216172743_3.menuBorderBgColor='#14140e'; //Set to table color 2006/07
//   mm_menu_0216172743_3.menuBorderBgColor='#F4E7BB';
   mm_menu_0216172743_3.bgColor='#958d57';
  window.mm_menu_0216172943_4 = new Menu("root",107,15,"Verdana, Arial, Helvetica, sans-serif",11,"#14140e","#fee9a7","#aaa36f","#696937","left","middle",2,0,1000,-5,10,false,true,true,0,true,true);
  mm_menu_0216172943_4.addMenuItem("MP&nbsp;search","location=relpath+'search.htm'");
  mm_menu_0216172943_4.addMenuItem("Constituency&nbsp;A-Z","location=relpath+'constituency.htm'");
  mm_menu_0216172943_4.addMenuItem("Sample&nbsp;letters","location=relpath+'letter.htm'");
  mm_menu_0216172943_4.addMenuItem("Downloads","location=relpath+'downloads.htm'");
   mm_menu_0216172943_4.hideOnMouseOut=true;
   mm_menu_0216172943_4.menuBorder=1;
   mm_menu_0216172943_4.menuLiteBgColor='#aaa36f';
   mm_menu_0216172943_4.menuBorderBgColor='#14140e';
   mm_menu_0216172943_4.bgColor='#958d57';

  mm_menu_0216172943_4.writeMenus();
} // mmLoadMenus()

var agt=navigator.userAgent.toLowerCase();
var is_major  = parseInt(navigator.appVersion);
var is_ie     = ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1));
var is_ie3    = (is_ie && (is_major < 4));
var is_ie4    = (is_ie && (is_major == 4) && (agt.indexOf("msie 5")==-1) );
var is_ie5up  = (is_ie && !is_ie3 && !is_ie4);
var is_mac    = (agt.indexOf("mac")!=-1);
var is_mac_ie5up = false; //needs to be false unless testing
if (is_mac && is_ie5up) is_mac_ie5up = true;

function postit(postCode){ //check postcode format is valid
 test = postCode; size = test.length;
 test = test.toUpperCase(); //Change to uppercase
 while (test.slice(0,1) == " ") //Strip leading spaces
  {test = test.substr(1,size-1);size = test.length
  }
 while(test.slice(size-1,size)== " ") //Strip trailing spaces
  {test = test.substr(0,size-1);size = test.length
  }
 if (size < 6 || size > 8){ //Code length rule
  alert(test + " is not a valid postcode - wrong length");
  return false;
  }
 if (!(isNaN(test.charAt(0)))){ //leftmost character must be alpha character rule
   alert(test + " is not a valid postcode - cannot start with a number");
   return false;
  }
 if (isNaN(test.charAt(size-3))){ //first character of inward code must be numeric rule
   alert(test + " is not a valid postcode - alpha character in wrong position");
   return false;
  }
 if (!(isNaN(test.charAt(size-2)))){ //second character of inward code must be alpha rule
   alert(test + " is not a valid postcode - number in wrong position");
   return false;
  }
 if (!(isNaN(test.charAt(size-1)))){ //third character of inward code must be alpha rule
   alert(test + " is not a valid postcode - number in wrong position");
   return false;
  }
 if (!(test.charAt(size-4) == " ")){//space in position length-3 rule
   alert(test + " is not a valid postcode - no space or space in wrong position");
   return false;
   }
 count1 = test.indexOf(" ");count2 = test.lastIndexOf(" ");
 if (count1 != count2){//only one space rule
   alert(test + " is not a valid postcode - only one space allowed");
   return false;
  }
return true;
}
