<!--
function blockError(){return true;}
window.onerror = blockError;

//verify for netscape/mozilla
var isNS4 = (navigator.appName=="Netscape")?1:0;

function MM_validateForm() { //validate form by id
  var i,p,q,nm,id,test,num,min,max,errors='',args=MM_validateForm.arguments;
  for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
    if (val) { nm=val.id; if ((val=val.value)!="") {
      if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
        if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
      } else if (test!='R') { num = parseFloat(val);
        if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
        if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
          min=test.substring(8,p); max=test.substring(p+1);
          if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
    } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is a required field.\n'; }
  } if (errors) alert('Please correct the following error(s):\n'+errors);
  document.MM_returnValue = (errors == '');
}

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 protectmail2() { //encrypt email address
  var name = "information";
  var address = "knm-websolutions.co.uk";
  var link = "";
  var subject = "General&nbsp;enquiry";
  document.write('<a class="email" href=mailto:' + name + '@' + address + '?subject=' + subject + '><img src="images/p2.gif" alt="Click here to email us" title="Click here to email us" border="0" /></a>');
}

function protectmail() { //encrypt email address
  var name = "links";
  var address = "knm-websolutions.co.uk";
  var link = "clicking here";
  var subject = "Reciprocal&nbsp;link&nbsp;enquiry&nbsp;for&nbsp;KNM-Websolutions";
  document.write('<a class="email" href=mailto:' + name + '@' + address + '?subject=' + subject + '>' + link + '</a>');
}

function protectmailknm() { //encrypt email address
  var name = "admin";
  var address = "knm-websolutions.co.uk";
  var link = "Email Webmaster";
  var subject = "Report&nbsp;a&nbsp;site&nbsp;issue&nbsp;--&nbsp;Selectsandwiches.co.uk";
  document.write('<a class="email" href=mailto:' + name + '@' + address + '?subject=' + subject + ' title="Email KNM-Websolutions Webmaster">' + link + '</a>');
}

function protectmail3() { //encrypt email address
  var name = "links";
  var address = "knm-websolutions.co.uk";
  var link = "Reciprocal Link Exchange";
  var subject = "Reciprocal&nbsp;link&nbsp;enquiry&nbsp;for&nbsp;Selectsandwiches.co.uk";
  document.write('<a href=mailto:' + name + '@' + address + '?subject=' + subject + ' title="Click here to email us"><u>' + link + '<u></a>');
}

function protectmail4() { //encrypt email address
  var name = "information";
  var address = "selectsandwiches.co.uk";
  var link = "";
  var subject = "General&nbsp;enquiry";
  document.write('<a class="email" href=mailto:' + name + '@' + address + '?subject=' + subject + '><img src="images/p2.gif" alt="Click here to email us" title="Click here to email us" border="0" /></a>');
}

function protectmail6() { //encrypt email address
  var name = "links";
  var address = "knm-websolutions.co.uk";
  var link = "";
  var subject = "Reciprocal&nbsp;link&nbsp;enquiry&nbsp;Selectsandwiches.co.uk";
  document.write('<a class="email" href=mailto:' + name + '@' + address + '?subject=' + subject + '><img src="images/yourlink.gif" align="left"  id="genlinkimg" alt="Click here to email us" title="Click here to email us" border="0" /></a>');
}

function addToFavorites() {
var urlAddress = "http://www.selectsandwiches.co.uk/"; 
var pageName = "Selectsandwiches";  
if (window.external) { window.external.AddFavorite(urlAddress,pageName) 
} else { alert("Sorry your browser doesn't support this function."); 
} }

function confirmSubmit()
{
var agree=confirm("Send Message?");
if (agree)
	return true ;
else
	return false ;
}

function replaceChars(entry) {
out = "'"; // replace this
add = " "; // with this
temp = "" + entry; // temporary holder

while (temp.indexOf(out)>-1) {
pos= temp.indexOf(out);
temp = "" + (temp.substring(0, pos) + add + 
temp.substring((pos + out.length), temp.length));
}
document.subform.Query.value = temp;
}

function replaceChars2(entry) {
out = "'"; // replace this
add = " "; // with this
temp = "" + entry; // temporary holder

while (temp.indexOf(out)>-1) {
pos= temp.indexOf(out);
temp = "" + (temp.substring(0, pos) + add + 
temp.substring((pos + out.length), temp.length));
}
document.subform.Email.value = temp;
}

function replaceChars3(entry) {
out = "'"; // replace this
add = " "; // with this
temp = "" + entry; // temporary holder

while (temp.indexOf(out)>-1) {
pos= temp.indexOf(out);
temp = "" + (temp.substring(0, pos) + add + 
temp.substring((pos + out.length), temp.length));
}
document.subform.Name.value = temp;
}

function replaceChars4(entry) {
out = "'"; // replace this
add = " "; // with this
temp = "" + entry; // temporary holder

while (temp.indexOf(out)>-1) {
pos= temp.indexOf(out);
temp = "" + (temp.substring(0, pos) + add + 
temp.substring((pos + out.length), temp.length));
}
document.subform1.message.value = temp;
}

function replaceChars5(entry) {
out = "'"; // replace this
add = " "; // with this
temp = "" + entry; // temporary holder

while (temp.indexOf(out)>-1) {
pos= temp.indexOf(out);
temp = "" + (temp.substring(0, pos) + add + 
temp.substring((pos + out.length), temp.length));
}
document.subform.Company.value = temp;
}

function reloadcaptcha() {
	document.getElementById('CAPTCHA').src='captcha_image.asp?'+Date();
}

function textCounter(field, countfield, maxlimit) {
if (field.value.length > maxlimit) // if too long...trim it!
field.value = field.value.substring(0, maxlimit);
// otherwise, update 'characters left' counter
else 
countfield.value = maxlimit - field.value.length;
}

function swapPhoto(photoSRC) {

if (document.getElementById("mainPhoto")) {

	var theImage = document.getElementById("mainPhoto");

	var imgFolder = "images/jukeboxes/";

	theImage.setAttribute("src", imgFolder+photoSRC);

    }
  }

var popUpWin=0;
function popUpWindow(URLStr, right, top, width , height)
{
  if(popUpWin)
  {
    if(!popUpWin.closed) popUpWin.close();
  }
  popUpWin = open(URLStr, 'popUpWin', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,copyhistory=no,width='+500+',height='+570+',right='+right+', top='+top+',screenX='+right+',screenY='+top+'');
}

function passwordfocus()
{
document.dateedit.Name.focus();
}
// -->



