function _switch(img) { img.src = img.src.indexOf("-on") > 0 ? img.src.replace("-on", "-off") : img.src.replace("-off", "-on"); return; } function s(input) { input.select(); } function f(obj, id) { var k = document.all ? window.event.keyCode : window.event.which; if(k != 9 && k != 16 && k != 17 && k != 18 && k != 20) { change = true; if(obj != null) { if(obj.id == "pn" || obj.id == "cn") { t = obj.id.substr(0, 1); if(obj.value == '?' || obj.value == '??') { for(i = 1; i <= (t == 'c' ? 2 : 3); i++) { img = document.getElementById("p_" + t + "n" + i); img.src = "http://www.britishcarregistrations.co.uk/img/layout/search-" + (t == 'c' ? i == 2 ? 3 : i : i) + ".png"; img.width = 25; } } else { for(i = 1; i <= (t == 'c' ? 2 : 3); i++) { img = document.getElementById("p_" + t + "n" + i); img.width = 25; if(obj.value.substr(i-1, 1) != "") { img.src = 'http://www.britishcarregistrations.co.uk/img/char/' + obj.value.substr(i-1, 1) + '.png'; } else { img.src = 'http://www.britishcarregistrations.co.uk/img/char/_.png'; } } } } else if(obj.value.toUpperCase() < 'A' || obj.value.toUpperCase() > 'Z' || obj.value == '') { img = document.getElementById("p_" + obj.id); num = obj.id.substr(obj.id.length-1, 1); src = num >= '1' && num <= '3' && obj.id.substr(1, 1) == 's' ? "http://www.britishcarregistrations.co.uk/img/layout/search-abc" + num + ".png" : "http://www.britishcarregistrations.co.uk/img/layout/search-abc.png"; obj.value = ''; change = false; img.width = 25; img.src = src; } else { img = document.getElementById("p_" + obj.id); if(obj.value != "") { img.src = 'http://www.britishcarregistrations.co.uk/img/char/' + obj.value + '.png'; img.width = 25; } else { img.src = 'http://www.britishcarregistrations.co.uk/img/char/_.png'; img.width = 0; } } } if(change) { document.getElementById(id).focus(); } } } function chk(num) { document.forms[1].type[num].checked = true; } function toggle_dimensions() { var txt = document.getElementById("sizeh"); txt = txt.disabled = !txt.disabled; var txt = document.getElementById("sizew"); txt = txt.disabled = !txt.disabled; } function okeydokey() { var xmlhttp = window.XMLHttpRequest ? new XMLHttpRequest() : new ActiveXObject("Microsoft.XMLHTTP"); xmlhttp.onreadystatechange = function() { if(xmlhttp.readyState == 4) { fade("out", 100, "protip"); } } xmlhttp.open("POST","http://www.britishcarregistrations.co.uk/php/fav/showtip.php?set",true); xmlhttp.send(null); return false; } function firsttime() { var xmlhttp = window.XMLHttpRequest ? new XMLHttpRequest() : new ActiveXObject("Microsoft.XMLHTTP"); xmlhttp.onreadystatechange = function() { if(xmlhttp.readyState == 4) { if(xmlhttp.responseText != "1") { document.getElementById("protip").style.visibility = "visible"; document.getElementById("protiptitle").innerHTML = "First Time Searching?"; document.getElementById("protipmsg").innerHTML = "If you see a plate you like, simply drag it here to add it to your favourites!" + " This will allow you to \"shortlist\" your favourites, and get back to them easily."; fade("in", 0, "protip"); setTimeout("fade('out', 100, 'protip')", 20000); } } } xmlhttp.open("POST","http://www.britishcarregistrations.co.uk/php/fav/showtip.php?get2&set2",true); xmlhttp.send(null); } function lowestprices(dir) { document.getElementById("protip").style.visibility = "visible"; document.getElementById("protiptitle").innerHTML = "Guaranteed Lowest Prices!"; document.getElementById("protipmsg").innerHTML = "Our prices are as low as they can possibly be that we GUARANTEE to at least match the price of an identical mark being advertised by another company!"; fade(dir, dir == "in" ? 0 : 100, "protip"); } function slide(dir, i) { var img = document.getElementById("top10"); if(i == undefined) { i = dir == "in" ? -150 : 0; } if((i == 0 && dir == "in") || (i == -150 && dir == "out")) { return; } else { i = dir == "in" ? i + 1 : i - 1; img.style.marginTop = i + "px"; setTimeout("slide('" + dir + "', " + i + ")", 1); } } function searchkey(event, txt) { kc=event.keyCode;sk=event.shiftKey;if((((kc >= 65 && kc <= 90) && !sk)||((kc >= 97 && kc <= 122) && sk)) && !event.ctrlKey){txt.value+=String.fromCharCode(kc);return false;} }