function Is() {
    agent  = navigator.userAgent.toLowerCase();  //alert(agent);
    plat = navigator.platform.toLowerCase();
    this.mac   = (plat.indexOf('mac')   !=   -1);
    this.win   = (plat.indexOf('win')   !=   -1);
    this.major = parseInt(navigator.appVersion);
    this.minor = parseFloat(navigator.appVersion);
    this.ns    = ((agent.indexOf('mozilla')   !=   -1) &&
                 ((agent.indexOf('spoofer')   ==   -1) &&
                 (agent.indexOf('compatible') ==   -1)));
    this.ns4   = (this.ns && (this.major      ==    4));
    this.ns6   = (this.ns && (this.major      >=    5));
    this.ie    = (agent.indexOf("msie")       !=   -1);
    this.ie3   = (this.ie && (this.major      < 4));
    this.ie4   = (this.ie && (this.major      ==    4) &&
                 (agent.indexOf("msie 5.0")   ==   -1));
    this.ie5   = (this.ie && (this.major      ==    4) &&
                 (agent.indexOf("msie 5.0")   !=   -1));
    this.ie55  = (this.ie && (this.major      ==    4) &&
                 (agent.indexOf("msie 5.5")   !=   -1));
    this.ie6   = (this.ie && (agent.indexOf("msie 6.0")!=-1) );
    this.opera = (this.ie && (agent.indexOf("opera")!=-1) );
       this.safari=(agent.indexOf("safari")!=-1);
   this.gecko=(agent.indexOf("gecko")!=-1);
}
/* ---------------------------------------------------------------------- */
// Global variables
var is = new Is();
var StoreWindow = null;
var proc= '<span style="font-family:sans-serif;font-size:16pt;color:#3638bd">Processing'
+ ' - please wait</span>';

window.onerror=myErrorHandler;
function myErrorHandler() {
return true;}

/* ---------------------------------------------------------------------- */
function ST_note(theURL,uWidth,uHeight,sbar,res,locH,locV,StoreWindow) {
var attr='scrollbars='+sbar+',resizable='+res+',width=' + uWidth + ',height=' +uHeight
if(!window.StoreWindow || window.StoreWindow.closed) {
if(is.mac && is.ie) {
StoreWindow = window.open(theURL,StoreWindow,attr);
StoreWindow.focus();
} else {
StoreWindow = window.open('',StoreWindow,attr);
StoreWindow.moveTo(locH,locV);
setClientSize(uWidth,uHeight,StoreWindow);
StoreWindow.document.close();
StoreWindow.document.write(proc);
StoreWindow.focus()
StoreWindow.location.href = (theURL)
} // end else
} else {
StoreWindow.location.href = (theURL)
//setClientSize(uWidth,uHeight,StoreWindow);
StoreWindow.focus()
}
return StoreWindow;
}
/* ---------------------------------------------------------------------- */
function doMidIm(x,n,h){ var t,l,a,b,c,d,y;   //alert ('yy '+is.gecko);
if(y=MM_findObj('thDIV'+n)){t=(y.offsetTop-1);l=(y.offsetLeft-1);
if(b=MM_findObj('boxDIV')){s=(b.style)?b.style:b; s.left=l; s.top=t;
if(is.ns || is.gecko || is.safari){ s.height=50;s.width=70;}
s.visibility=(h)?'hidden':'visible'; }
if(y=MM_findObj('pPicBaseDIV')){t=(y.offsetTop-0);l=(y.offsetLeft-0);
if(b=MM_findObj('midDIV'+n)){s=(b.style)?b.style:b; s.left=l; s.top=t;s.visibility=(h)?'hidden':'visible'; }
}}

}
/* ---------------------------------------------------------------------- */

function sizeMe(){
var H,W,s,r,m;

s=''+self.location; r=''+document.referrer; s=s.replace(/^[^\/]+\/\//,''); s=s.replace(/\/.*/,'');
m=new RegExp("/"+s+"/","i"); if(r && r.match(m)){return;}
H=(is.ns)?419:(is.opera)?440:405; W=(is.ns)?755:758;
H=(is.ns)?578:(is.opera)?578:578; W=(is.ns)?983:983;
if(screen.availWidth<810){maxWindow();}
else{setClientSize(W,H);}//if(is.ns){window.resizeBy(-14,0);}
//window.resizeTo(983, 578);
}

function maxWindow(){
window.moveTo(0,0);
if (document.all){top.window.resizeTo(screen.availWidth,screen.availHeight);}
else if (document.layers||document.getElementById)
{if (top.window.outerHeight<screen.availHeight||top.window.outerWidth<screen.availWidth)
{top.window.outerHeight = screen.availHeight;top.window.outerWidth = screen.availWidth;
 }}}

function setClientSize(W, H,win) {
 win.resizeTo(W, H); var cp = win.document.createElement("div");
    cp.style.position = "absolute"; cp.style.width = "0px";cp.style.height = "0px"; cp.style.right = "0px";
    cp.style.bottom = "0px";win.document.body.appendChild(cp);
    var current_width = cp.offsetLeft;    var current_height = cp.offsetTop;
    var dw = W - current_width;    var dh = H - current_height;
    win.resizeBy(dw, dh); win.document.body.removeChild(cp);}
var dayarray=new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday")
var montharray=new Array("January","February","March","April","May","June","July","August","September","October","November","December")
var holdFacts=new Array(); holdFacts['divDone']='';
/* ---------------------------------------------------------------------- */
function printMe() { if(window.print) { window.print();}
else {alert("Sorry, your browser does not support this function. \nPlease select Print from your file menu.") } return false;}
/*----------------------------------------------------------------------------------------------------*/
function getHeights(){  var a,b,c,d,x,i,s;
if(x=MM_findObj('leftPanelDIV')){ a=x.offsetTop;
if(x=MM_findObj('leftMarkerDIV')){ b=x.offsetTop;
h=(b-a-146);
if(x=MM_findObj('mainContentDIV')){s=(x.style)?x.style:x; s.height=h; }}}
if(x=MM_findObj('littleBIT')){a=x.offsetTop;b=x.offsetLeft; s=(x.style)?x.style:x; if(is.ie && is.mac){s.visibility='hidden';}
if(x=MM_findObj('littleBITh')){s=(x.style)?x.style:x;s.top=a; s.left=b; if(is.ie && is.mac){s.visibility='hidden';}}}

}
/*----------------------------------------------------------------------------------------------------*/
function doMyBG(x,bg,eB){var s,x;
s=(x.style)?x.style:x; s.background=bg;
if(x=MM_findObj('littleBITh')){s=(x.style)?x.style:x;if(eB){s.visibility='visible';}else{s.visibility='hidden';}
 if(is.ie && is.mac){s.visibility='hidden';}}}
/*----------------------------------------------------------------------------------------------------*/
function showdate(){
if(!holdFacts['divDone']){document.write('<div id="AStimeDiv" style="font-size:11px"></div>');holdFacts['divDone']=1;}
var x,d,y,m,n,s,t,h,i,g; d=new Date();
y=d.getYear();i=d.getDay();n=d.getMonth();t=d.getDate();h=d.getHours();m=d.getMinutes();s=d.getSeconds()
y=(y>99)?1900+y:y; y=(y>3000)?y-1900:y;
t=(t<10)?"0"+t:t; h=(h<10)?"0"+h:h; m=(m<10)?"0"+m:m; g=(60-s);s=(s<10)?"0"+s:s;
c=dayarray[i]+' '+t+' '+montharray[n]+' '+y+' : <b style="font-size:12px">'+h+'.'+m+'</b>';
if(x=MM_findObj('AStimeDiv')){x.innerHTML=c;setTimeout("showdate();",(g*1000));}else{document.write(c);}}
/*----------------------------------------------------------------------------------------------------*/
function doAreas(f,sep){  var a,b,c,d,i,r;  d=''; sep=(sep)?sep:' ';   r = new RegExp(sep+"$","i");
if(a=f.elements['Area']){ if(b=f.elements['areamulti']){
for (i=0;i<a.options.length;i++){ if(a.options[i].selected){
d+=a.options[i].value+sep;}}
d=d.replace(r,''); b.value=d;}}
 d='';
if(a=f.elements['Postcode']){ if(b=f.elements['postcodemulti']){
for (i=0;i<a.options.length;i++){ if(a.options[i].selected){
d+=a.options[i].value+sep;}}
d=d.replace(r,''); b.value=d;}}
 d='';
if(a=f.elements['xstype']){ if(b=f.elements['stype']){
for (i=0;i<a.length;i++){ if(a[i].checked){
d+=a[i].value+sep;}}
d=d.replace(r,''); b.value=d;}}

return false;}
/*----------------------------------------------------------------------------------------------------*/
function AScheckForm(f,checks){ var a,b,c,d,e,ee,i,l,o,x,t,z,mA,mB;
var ePat=/^([a-zA-Z0-9\.\-\_\&]+)\@([a-zA-Z0-9\.\-\_\&]+)\.([a-zA-Z]{2,4})$/;
  e=''; ee=''; z=0;
mA=checks.split('~');
for(i=0;i<mA.length;i++){mB=mA[i].split('|');
if(a=f.elements[mB[0]]){t='';
//if(l=a.length){for(x=0;x<l;x++){b=a.elements[x].type.toLowerCase(); alert(b); }   }
if(a.type){b=a.type.toLowerCase();
if(b=='checkbox'){if(!(a.checked)){ e+=mB[1]+' : ';z++;if(z>5){z=0;e+="\n";}}}
else if(b.match(/select/)) {t=''; o=a.options;l=o.length; 
for(x=0;x<l;x++){if(o[x].selected){if(o[x].value){t=1;}}}if(!t){e+=mB[1]+' : ';z++;if(z>5){z=0;e+="\n";}}}
else{if(!(a.value.match(/[^\r\n\s\t]/))){e+=mB[1]+' : ';z++;if(z>5){z=0;e+="\n";}}
else if(mB[2]&&!(a.value.match(ePat))){ee+="\n"+mB[1]+' seems incorrect';}}
} // end if(a.type){
else if(l=a.length){t=''; for(x=0;x<l;x++){b=a[x].type.toLowerCase();if(a[x].checked){t=1;}}
if(!t){e+=mB[1]+' : ';z++;if(z>5){z=0;e+="\n";}}}
}}
if(e || ee){alert(((e)?'Please complete these fields'+"\n"+e:'')+((ee)?ee:''));return false;}return true;}
/*----------------------------------------------------------------------------------------------------*/
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_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_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];}
}


