function MM_preloadImages()
{
 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 makeDate()
{
 DateText = "";
 Now = new Date();
 NowDay = Now.getDay();
 NowDate = Now.getDate();
 NowHours = Now.getHours();
 NowMins = Now.getMinutes();

 if (NowMins<10)
  DateText = NowHours +":0" + NowMins;
 else
  DateText = NowHours +":" + NowMins;

 NowMonth = Now.getMonth();
 if (NowMonth == 0) { DateText = DateText + " - January "; }
 if (NowMonth == 1) { DateText = DateText + " - February "; }
 if (NowMonth == 2) { DateText = DateText + " - March "; }
 if (NowMonth == 3) { DateText = DateText + " - April "; }
 if (NowMonth == 4) { DateText = DateText + " - May "; }
 if (NowMonth == 5) { DateText = DateText + " - June "; }
 if (NowMonth == 6) { DateText = DateText + " - July "; }
 if (NowMonth == 7) { DateText = DateText + " - August "; }
 if (NowMonth == 8) { DateText = DateText + " - September "; }
 if (NowMonth == 9) { DateText = DateText + " - October "; }
 if (NowMonth == 10) { DateText = DateText + " - November "; }
 if (NowMonth == 11) { DateText = DateText + " - December "; }

 if (NowDate==1)
  DateText = DateText + NowDate + "<SUP>st</SUP>";
 else if ((NowDate==2)||(NowDate==22))
  DateText = DateText + NowDate + "<SUP>nd</SUP>";
 else if ((NowDate==3)||(NowDate==23))
  DateText = DateText + NowDate + "<SUP>rd</SUP>"
 else
  DateText = DateText + NowDate + "<SUP>th</SUP>";

 document.write(DateText);
}

function gogetit(url)
{
 if (url != '')
  self.location = url;
}

function showBrochure(url)
{
  var params="menubar=yes,toolbar=yes,location=yes,directories=yes,status=yes,scrollbars=yes,resizable=yes,dependent,top=0,left=0,width=640,height=480";
  popupWin = window.open(url, 'popup',params);
  popupWin.focus();
}

function openWindow(url,width,height,scroll)
{
  var params="menubar=no,toolbar=no,location=no,directories=no,status=no,scrollbars="+scroll+",resizable=no,dependent,top=0,left=0,width="+width+",height="+height;
  popupWin = window.open(url, 'popup',params);
  popupWin.focus();
}

function blank(form,field,text)
{
 if (document[form][field].value==text)
 {
  document[form][field].value='';
 }
}

function unblank(form,field,text)
{
 if (document[form][field].value=='')
 {
  document[form][field].value=text;
 }
}

function searchSite()
{
 if ((document.search.keyword.value=='')||(document.search.keyword.value=='search...'))
 {
  alert('Please enter a search term');
  return(false);
 }
}

function emailLink(url)
{
 var link='mailto:?subject=Active-Breaks.com Gift Voucher&body=I thought you might be interested in this:%0D%0D';
 urllength = url.length;
 var pos1 = url.indexOf('&');
 if (pos1==-1)
 {
  link = link + url;
  self.location(url);
 }
 else
 {
  templink1 = url.substring(0,pos1);
  link = link + templink1;
  var templink2 = url.substring(pos1+1,urllength);
  link = link + '%26' + templink2;
  self.location = link;
 }
}

function MM_findObj(n, d) { 
  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 && document.getElementById) x=document.getElementById(n); return x;
}

function P7_Snap() { 
  var x,y,ox,bx,oy,p,tx,a,b,k,d,da,e,el,args=P7_Snap.arguments;a=parseInt(a);
  for (k=0; k<(args.length-3); k+=4)
   if ((g=MM_findObj(args[k]))!=null) {
    el=eval(MM_findObj(args[k+1]));
    a=parseInt(args[k+2]);b=parseInt(args[k+3]);
    x=0;y=0;ox=0;oy=0;p="";tx=1;da="document.all['"+args[k]+"']";
    if(document.getElementById) {
     d="document.getElementsByName('"+args[k]+"')[0]";
     if(!eval(d)) {d="document.getElementById('"+args[k]+"')";if(!eval(d)) {d=da;}}
    }else if(document.all) {d=da;} 
    if (document.all || document.getElementById) {
     while (tx==1) {p+=".offsetParent";
      if(eval(d+p)) {x+=parseInt(eval(d+p+".offsetLeft"));y+=parseInt(eval(d+p+".offsetTop"));
      }else{tx=0;}}
     ox=parseInt(g.offsetLeft);oy=parseInt(g.offsetTop);var tw=x+ox+y+oy;
     if(tw==0 || (navigator.appVersion.indexOf("MSIE 4")>-1 && navigator.appVersion.indexOf("Mac")>-1)) {
      ox=0;oy=0;if(g.style.left){x=parseInt(g.style.left);y=parseInt(g.style.top);
      }else{var w1=parseInt(el.style.width);bx=(a<0)?-5-w1:-10;
      a=(Math.abs(a)<1000)?0:a;b=(Math.abs(b)<1000)?0:b;
      x=document.body.scrollLeft + event.clientX + bx;
      y=document.body.scrollTop + event.clientY;}}
   }else if (document.layers) {x=g.x;y=g.y;var q0=document.layers,dd="";
    for(var s=0;s<q0.length;s++) {dd='document.'+q0[s].name;
     if(eval(dd+'.document.'+args[k])) {x+=eval(dd+'.left');y+=eval(dd+'.top');break;}}}
   if(el) {e=(document.layers)?el:el.style;
   var xx=parseInt(x+ox+a),yy=parseInt(y+oy+b);
   if(navigator.appName=="Netscape" && parseInt(navigator.appVersion)>4){xx+="px";yy+="px";}
   if(navigator.appVersion.indexOf("MSIE 5")>-1 && navigator.appVersion.indexOf("Mac")>-1){
    xx+=parseInt(document.body.leftMargin);yy+=parseInt(document.body.topMargin);
    xx+="px";yy+="px";}e.left=xx;e.top=yy;}}
}

function MM_reloadPage(init) {
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

function P7_autoLayers() {
 var g,b,k,f,args=P7_autoLayers.arguments;
 var a = parseInt(args[0]);if(isNaN(a))a=0;
 if(!document.p7setc) {p7c=new Array();document.p7setc=true;
  for (var u=0;u<100;u++) {p7c[u] = new Array();}}
 for(k=0; k<p7c[a].length; k++) {
  if((g=MM_findObj(p7c[a][k]))!=null) {
   b=(document.layers)?g:g.style;b.visibility="hidden";}}
 for(k=1; k<args.length; k++) {
  if((g=MM_findObj(args[k])) != null) {
   b=(document.layers)?g:g.style;b.visibility="visible";f=false;
   for(j=0;j<p7c[a].length;j++) {
    if(args[k]==p7c[a][j]) {f=true;}}
  if(!f) {p7c[a][p7c[a].length++]=args[k];}}}
}

function submitSearch()
{
 check=0;
 f=document.search;
 if (f.typeid.selectedIndex==0)
 {
  alert("Please select an activity");
  check=1;
 }
 if (check==0)
 {
  document.search.target='_top';
  document.search.submit();
 }
}

function checkForm()
{
 f=document.form;
 if (f.name.value==='')
 {
  alert("Please enter your name");
  return(false);
 }
 if (f.telephone.value==='')
 {
  alert("Please enter a contact number");
  return(false);
 }
 if (f.email.value=='')
 {
  alert("Please enter your email address");
  return(false);
 }
 else
 {
  var str = f.email.value;
  var supported = 0;
  if (window.RegExp)
  {
   var tempStr = "a";
   var tempReg = new RegExp(tempStr);
   if (tempReg.test(tempStr)) supported = 1;
  }
  if (!supported) 
   return (str.indexOf(".") > 2) && (str.indexOf("@") > 0);
  var r1 = new RegExp("(@.*@)|(\\.\\.)|(@\\.)|(^\\.)");
  var r2 = new RegExp("^.+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,3}|[0-9]{1,3})(\\]?)$");
  if ((!r1.test(str)==true)&&(r2.test(str)==false))
  {
   alert('Sorry, you must provide a real email address');
   return(false);
  }
 }
 if (f.comments.value=='')
 {
  alert("Please enter your enquiry in the comments box");
  return(false);
 }
}

function checkSupplier()
{
 f=document.form;
 if (f.company.value=='')
 {
  alert("Please enter your company name");
  return(false);
 }
 if (f.contact.value=='')
 {
  alert("Please enter your contact name");
  return(false);
 }
 if (f.address1.value=='')
 {
  alert("Please enter your address");
  return(false);
 }
 if (f.town.value=='')
 {
  alert("Please enter your town");
  return(false);
 }
 if (f.county.value=='')
 {
  alert("Please enter your county");
  return(false);
 }
 if (f.postcode.value=='')
 {
  alert("Please enter your postcode");
  return(false);
 }
 if (f.telephone.value=='')
 {
  alert("Please enter your telephone");
  return(false);
 }
 if (f.telephone2.value=='')
 {
  alert("Please enter your mobile");
  return(false);
 }
 if (f.email.value=='')
 {
  alert("Please enter your email");
  return(false);
 }
 if (f.website.value.length<5)
 {
  alert("Please enter your website");
  return(false);
 }
 if (f.password.value=='')
 {
  alert("Please enter your password");
  return(false);
 }
 if (f.region1.selectedIndex==0)
 {
  alert("Please enter your password");
  return(false);
 }
}