if (document.getElementById("myFlashContent") != undefined) {
	swfobject.registerObject("myFlashContent", "9.0.0");
}
window.status="Regfinder : The Number Plate Search Engine";
function jClick(value) {
	var swf = swfobject.getObjectById("myFlashContent");
	swf.jClick(value);
}
function genemail(address) {
	//function to hide the email addresses from the site
	var mailto = 'mailto:'+address+'@regfinder.net?subject=Web Site Enquiry';
	win = window.open(mailto,'emailWindow');
	if (win && win.open &&!win.closed) win.close(); 
}
function gentraderemail(e1,e2,plate,price) {
	//function to hide the email addresses from the site
var mailto = 'mailto:'+e1+'@'+e2+'?subject='+plate+'%20%4Eumber%20%50late%20%45nquiry%20from%20%52egfinder.net&body=%50lease%20contact%20me%20about%20this%20registration%20number:%20'+plate+'.%0A%0A%49%20will%20make%20an%20offer%20of%20'+price+'%47%42%50%20(%45dit%20the%20price%20to%20whatever%20you%20are%20prepared%20to%20pay).%0A%0A%41dd%20%59our%20%4Eame%20%48ere';

//var mailto = 'mailto:'+e1+'@'+e2+'?subject='+plate+'%20%4Eumber%20%50late%20%45nquiry%20from%20%52egfinder.net&body=';

//var mailtotest = URLEncode('Please contact me about this registration number:'+plate+'.I will make an offer of £'+price+'GBP. (Edit the price to whatever you are prepared to pay). Add Your name here');
//var text2 = '';
//for (i=0;i<mailtotest.length;i++)
  //  text2 += '%'+mailtotest.charCodeAt(i).toString(16);
//alert(text2);
//mailto = mailto + text2;

	win = window.open(mailto,'_self');
	if (win && win.open &&!win.closed) win.close();
}

function URLEncode (clearString) {
  var output = '';
  var x = 0;
  clearString = clearString.toString();
  var regex = /(^[a-zA-Z0-9_.]*)/;
  while (x < clearString.length) {
    var match = regex.exec(clearString.substr(x));
    if (match != null && match.length > 1 && match[1] != '') {
    	output += match[1];
      x += match[1].length;
    } else {
      if (clearString[x] == ' ')
        output += ' ';
      else {
        var charCode = clearString.charCodeAt(x);
        var hexVal = charCode.toString(16);
        output += '%' + ( hexVal.length < 2 ? '0' : '' ) + hexVal.toUpperCase();
      }
      x++;
    }
  }
  return output;
}
