function sb(b,t) {
	document.getElementById('tf').style.zIndex='1';document.getElementById('tf1').className='SubMenu';
	document.getElementById('norm').style.zIndex='1';document.getElementById('norm1').className='SubMenu';
	;document.getElementById(t).className='SubMenuClick';
	document.getElementById(b).style.zIndex='999';
	document.getElementById(b).style.display='block';
}
function createCookie(name,value,days) {
	if (days)	{
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}

function postit(){ //check postcode format is valid
 test = document.getElementById('txtPostcode').value; size = test.length
 test = test.toUpperCase();
 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
  }
 document.getElementById('txtPostcode').value = test; //write back to form field
 if (size < 5 || size > 8){ //Code length rule
  alert(test + " is not a valid postcode - wrong length");
  document.getElementById('txtPostcode').focus();
  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");
   document.getElementById('txtPostcode').focus();
   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");
   document.getElementById('txtPostcode').focus();
   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");
   document.getElementById('txtPostcode').focus();
   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");
   document.getElementById('txtPostcode').focus();
   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");
  // document.details.pcode.focus();
   //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");
   document.getElementById('txtPostcode').focus();
   return false;
  }
  //document.write(str.replace(/Microsoft/g, "W3Schools"));
  strPostCode = escape(test);
  strPostCode = strPostCode.replace(/%20/g, "+");
location.href='/contact/directions/'+strPostCode
return true;
}