
var whitespace = " \t\n\r";
    var defaultEmptyOK = false;
	
var ageidentifier =  new Array("51","02",		
		"52","03","53","04",
		"54","05","55","06","56",
		"07","57 ","08","58","09","59",
		"10","60","11","61","12",		
		"62","13","63","14","64",
		"15","65","16","66","17","67",
		"18","68","19","69","20",				
		"70","21","71","22","72",
		"23","73","24","74","25","75",
		"26","76","27","77","28","78","29","79",
		"30","80","31","81","32",		
		"82","33","83","34","84",
		"35","85","36","86","37","87",
		"38","88","39","89","40",				
		"90","41","91","42","92",
		"43","93","44","94","45","95",
		"46","96","47","97","48","98","49","99",
		"50","01"	
		);
var	ageidentifier1 = Array("A","B","C","D","E","F","G","H","J","K","L","M","N","P","R","S","T","V","W","X","Y");

var	ageid_currentvalue_old = Array("01-09-2001","01-03-2002",		
		"01-09-2002","01-03-2003","01-09-2003","01-03-2004",
		"01-09-2004","01-03-2005","01-09-2005","01-03-2006","01-09-2006",
		"01-03-2007","01-09-2007","01-03-2008","01-09-2008","01-03-2009","01-09-2009",
		"01-03-2010","01-09-2010","01-03-2011","01-09-2011","01-03-2012",		
		"01-09-2012","01-03-2013","01-09-2013","01-03-2014","01-09-2014",
		"01-03-2015","01-09-2015","01-03-2016","01-09-2016","01-03-2017","01-09-2017",
		"01-03-2018","01-09-2018","01-03-2019","01-09-2019","01-03-2020",				
		"01-09-2020","01-03-2021","01-09-2021","01-03-2022","01-09-2022",
		"01-03-2023","01-09-2023","01-03-2024","01-09-2024","01-03-2025","01-09-2025",
		"01-03-2026","01-09-2026","01-03-2027","01-09-2027","01-03-2028","01-09-2028",
		"01-03-2029","01-09-2029",
		"01-03-2030","01-09-2030","01-03-2031","01-09-2031","01-03-2032",		
		"01-09-2032","01-03-2033","01-09-2033","01-03-2034","01-09-2034",
		"01-03-2035","01-09-2035","01-03-2036","01-09-2036","01-03-2037","01-09-2037",
		"01-03-2038","01-09-2038","01-03-2039","01-09-2039","01-03-2040",				
		"01-09-2040","01-03-2041","01-09-2041","01-03-2042","01-09-2042",
		"01-03-2043","01-09-2043","01-03-2044","01-09-2044","01-03-2045","01-09-2045",
		"01-03-2046","01-09-2046","01-03-2047","01-09-2047","01-03-2048","01-09-2048",
		"01-03-2049","01-09-2049","Format is reversed","Reserved"	
		);

var	ageid_currentvalue = Array("Sep '01 to Feb '02","Mar '02 to Aug '02",		
		"Sep '02 to Feb '03","Mar '03 to Aug '03","Sep '03 to Feb '04","Mar '04 to Aug '04",
		"Sep '04 to Feb '05","Mar '05 to Aug '05","Sep '05 to Feb '06","Mar '06 to Aug '06","Sep '06 to Feb '07",
		"Mar '07 to Aug '07","Sep '07 to Feb '08","Mar '08 to Aug '08","Sep '08 to Feb '09","Mar '09 to Aug '09",
		"Sep '09 to Feb '10","Mar '10 to Aug '10","Sep '10 to Feb '11","Mar '11 to Aug '11","Sep '11 to Feb '12",
		"Mar '12 to Aug '12","Sep '12 to Feb '13","Mar '13 to Aug '13","Sep '13 to Feb '14","Mar '14 to Aug '14",
		"Sep '14 to Feb '15","Mar '15 to Aug '15","Sep '15 to Feb '16","Mar '16 to Aug '16","Sep '16 to Feb '17",
		"Mar '17 to Aug '17","Sep '17 to Feb '18","Mar '18 to Aug '18","Sep '18 to Feb '19","Mar '19 to Aug '19",
		"Sep '19 to Feb '20","Mar '20 to Aug '20","Sep '20 to Feb '21","Mar '21 to Aug '21","Sep '21 to Feb '22",
		"Mar '22 to Aug '22","Sep '22 to Feb '23","Mar '23 to Aug '23","Sep '23 to Feb '24","Mar '24 to Aug '24",
		"Sep '24 to Feb '25","Mar '25 to Aug '25","Sep '25 to Feb '26","Mar '26 to Aug '26","Sep '26 to Feb '27",
		"Mar '27 to Aug '27","Sep '27 to Feb '28","Mar '28 to Aug '28","Sep '28 to Feb '29","Mar '29 to Aug '29",
		"Sep '29 to Feb '30","Mar '30 to Aug '30","Sep '30 to Feb '31","Mar '31 to Aug '31","Sep '31 to Feb '32",
		"Mar '32 to Aug '32","Sep '32 to Feb '33","Mar '33 to Aug '33","Sep '33 to Feb '34","Mar '34 to Aug '34",
		"Sep '34 to Feb '35","Mar '35 to Aug '35","Sep '35 to Feb '36","Mar '36 to Aug '36","Sep '36 to Feb '37",
		"Mar '37 to Aug '37","Sep '37 to Feb '38","Mar '38 to Aug '38","Sep '38 to Feb '39","Mar '39 to Aug '39",
		"Sep '39 to Feb '40","Mar '40 to Aug '40","Sep '40 to Feb '41","Mar '41 to Aug '41","Sep '41 to Feb '42",
		"Mar '42 to Aug '42","Sep '42 to Feb '43","Mar '43 to Aug '43","Sep '43 to Feb '44","Mar '44 to Aug '44",
		"Sep '44 to Feb '45","Mar '45 to Aug '45","Sep '45 to Feb '46","Mar '46 to Aug '46","Sep '46 to Feb '47",
		"Mar '47 to Aug '47","Sep '47 to Feb '48","Mar '48 to Aug '48","Sep '48 to Feb '49","Mar '49 to Aug '49",
		"Sep '49 to Feb '50","Format is reversed","Reserved"	
		);

 var	ageid_prefixvalue = Array("Aug '83 to July '84","Aug '84 to July '85",		
		"Aug '85 to July '86","Aug '86 to July '87","Aug '87 to July '88","Aug '88 to July '89",
		"Aug '89 to July '90","Aug '90 to July '91","Aug '91 to July '92","Aug '92 to July '93","Aug '93 to July '94",
		"Aug '94 to July '95","Aug '95 to July '96","Aug '96 to July '97",		
		"Aug '97 to July '98","Aug '98 to Feb '99","March '99 to Aug '99","Sept '99 to Feb 2000",
		"March 2000 to Aug 2000","Sept 2000 to Feb 2001","March 2001 to Aug 2001"
		);
 var	ageid_suffixvalue = Array("Jan '63 to Dec '63","Jan '64 to Dec '64",		
		"Jan '65 to Dec '65","Jan '66 to Dec '66","Jan '67 to July '67","Aug '67 to July '68",
		"Aug '68 to July '69","Aug '69 to July '70","Aug '70 to July '71","Aug '71 to July '72","Aug '72 to July '73",
		"Aug '73 to July '74","Aug '74 to July '75","Aug '75 to July '76",		
		"Aug '76 to July '77","Aug '77 to July '78","Aug '78 to July '79","Aug '79 to July '80",
		"Aug '80 to July '81","Aug '81 to July '82","Aug '82 to July '83"
		);
 var	pricetype_for = Array("offers over");
 var	pricetype_want = Array("upto","circa");



function isEmpty(s){ 
	return ((s == null) || (s.length == 0))
	}

	function isWhitespace (s){
	var i;
	// Is s empty?
	if (isEmpty(s)) return true;
	
	// Search through string's characters one by one
	// until we find a non-whitespace character.
	// When we do, return false; if we don't, return true.
 	for (i = 0; i < s.length; i++){   
	// Check that current character isn't whitespace.
	var c = s.charAt(i);
	if (whitespace.indexOf(c) == -1) return false;
	}
	
	// All characters are whitespace.
	return true;
	}
	

function isCharsInBag (s, bag){  
var i;
// Search through string's characters one by one.
// If character is in bag, append to returnString.

for (i = 0; i < s.length; i++){ 
// Check that current character isn't whitespace.
var c = s.charAt(i);
if (bag.indexOf(c) == -1) return false;
}
return true;
}

function CheckClassic(){

inputvalue = document.frmclassic.last.value;
//alert(inputvalue);

//alert(document.classic.char.value.length);

if ((document.frmclassic.last.value.length) <= 0 && (document.frmclassic.prefix.options[document.frmclassic.prefix.selectedIndex].value) == '-' && (document.frmclassic.number.options[document.frmclassic.number.selectedIndex].value) == '-'){
alert('Please enter at least one letter or number excluding I and Q');
document.frmclassic.last.focus(); 
return false;
}

if (!isCharsInBag( inputvalue, "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" )){
alert("Please check your entry. Enter at least one letter excluding I and Q" );
document.frmclassic.last.select(); 
return false;
}

if (!isCharsInBag( inputvalue, "ABCDEFGHJKLMNOPRSTUVWXYabcdefghjklmnoprstuvwxy" )){
alert("The input is  not valid, I, Q and Z are not valid." );
document.frmclassic.last.select(); 
return false;
}

var q;

if(document.frmclassic.last.value=="") {
	var last = "-";
}else {
	var last = document.frmclassic.last.value;
}

q = document.frmclassic.prefix.options[document.frmclassic.prefix.selectedIndex].value;;
q = q + document.frmclassic.number.options[document.frmclassic.number.selectedIndex].value;
q = q + last;

document.frmclassic.q.value = q;
//alert(q);

return true;

}//end function


function CheckNew(){

inputfirst = document.frmnew.first.value;
inputlast = document.frmnew.last.value;
//alert(inputvalue);

//alert(document.classic.char.value.length);

//alert(document.frmnew.year.options[document.frmnew.year.selectedIndex].value);

var inputyear = document.frmnew.year.options[document.frmnew.year.selectedIndex].value;

//alert(inputyear);

if ((document.frmnew.first.value.length) <= 0 && (document.frmnew.last.value.length) <= 0 && (inputyear) == "-"){
alert('Please enter at least one letter or number excluding I and Q');
document.frmnew.first.focus(); 
return false;
}


if (!isCharsInBag( inputfirst, "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghjklmnoprstuvwxyz" )){
alert("Please check your entry. Enter at least one letter excluding I and Q" );
document.frmnew.first.select(); 
return false;
}

/*
if ((document.frmnew.last.value.length) <= 0){
alert('Please type minimum one letter to search.');
document.frmnew.last.focus(); 
return false;
}

*/

if (!isCharsInBag( inputlast, "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghjklmnoprstuvwxyz")){
alert("Please check your entry. Enter at least one letter excluding I and Q" );
document.frmnew.last.select(); 
return false;
}

/*
if (!isCharsInBag( inputlast, "ABCDEFGHJKLMNOPQRSTUVWXYZabcdefghjklmnoprstuvwxyz" )){
alert("The input is  not valid, I is not valid." );
document.frmnew.last.select(); 
return false;
}

*/

var q;
q = document.frmnew.first.value;
q = q + document.frmnew.year.options[document.frmnew.year.selectedIndex].value;
q = q + document.frmnew.last.value;

document.frmnew.q.value = q;
//alert(q);

return true;

}//end function

//CheckSearch

function trim(str)
{
   return str.replace(/^\s+|\s+$/g,'');
}


function CheckSearch(){

inputvalue = trim(document.frmsearch.q.value);
//alert(inputvalue);

//alert(inputvalue.length);
//return false;

if ((inputvalue.length) <= 0){
alert('Please enter at least one letter or number to search.');
document.frmsearch.q.focus(); 
return false;
}

if (!isCharsInBag( inputvalue, "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789 " )){
alert("Please check your entry. Enter at least one letter or number." );
document.frmsearch.q.select(); 
return false;
}


return true;

}//end function

function indexsearchval(){

inputvalue = trim(document.indexsearch.q.value);
//alert(inputvalue);

//alert(document.classic.char.value.length);

if ((inputvalue.length) <= 0){
alert('Please enter at least one letter or number to search.');
document.indexsearch.q.focus(); 
return false;
}

if (!isCharsInBag( inputvalue, "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789 " )){
alert("Please check your entry. Enter at least one letter or number." );
document.indexsearch.q.select(); 
return false;
}


return true;

}//end function


/////////////////////////////////////////

function isAlphaNumeric(aChar)
{
	aChar = aChar.toUpperCase();
	var strValidChars = "0123456789ABCDEFGHIJKLMNOPRSTUVWXYZ";
	if (aChar.length == 0) return false;
	if (strValidChars.indexOf(aChar) == -1)
	{
		return false;
	}
	else
	{
		return true;
	}
}


function displayImageNS1(thisInput, Inputi){

//alert(thisInput.value);
alert(Inputi);
var number = thisInput.value;
var numlength = thisInput.value.length + Inputi;

alert(numlength);
//thisInput.focus();
//var image;

//image = 'img_ns1';
//imagesrc = eval("document."+image);
//alert(imagesrc);
//imagesrc.src = "images/number-plates/" + number +".gif";

i = Inputi;

	while(i < 7)
	{
		if (isAlphaNumeric(number.charAt(i)) == true)
		{
			newChar = number.charAt(i);
			alert(newChar);
		}
		else if(number.charAt(i) == ' ')
		{
			newChar = '_';
		}
		else
		{
			newChar = 'spacer';
		}
		if(newChar != 'spacer')
		{
			newChar = newChar.toUpperCase();
		}
		if(newChar == 'I' || newChar == '1' || newChar == '_')
		{
			newWidth = 11;
		}
		else if(newChar == '' || newChar == 'spacer')
		{
			newWidth = 1;
		}
		else
		{
			newWidth = 27;
		}
		
		switch (i)
		{
		case 0:
			//img-ns1.src = "images/number-plates/" + newChar + ".gif";
			document.getElementById("img_ns1").src = 'images/number-plates/' + newChar + '.gif';
			//document.getElementById("char_1").width = newWidth;
			break;
		case 1:
			
			//document.img-ns2.src = "images/number-plates/" + newChar + ".gif";
			document.getElementById("img_ns2").src = 'images/number-plates/' + newChar + '.gif';
			//document.getElementById("char_2").width = newWidth;
			break;
		
		case 2:
			
			//document.img-ns2.src = "images/number-plates/" + newChar + ".gif";
			document.getElementById("img_ns3").src = 'images/number-plates/' + newChar + '.gif';
			//document.getElementById("char_2").width = newWidth;
			break;
			
		case 3:
			
			//document.img-ns2.src = "images/number-plates/" + newChar + ".gif";
			document.getElementById("img_ns4").src = 'images/number-plates/' + newChar + '.gif';
			//document.getElementById("char_2").width = newWidth;
			break;		
		
		case 4:
			
			//document.img-ns2.src = "images/number-plates/" + newChar + ".gif";
			document.getElementById("img_ns5").src = 'images/number-plates/' + newChar + '.gif';
			//document.getElementById("char_2").width = newWidth;
			break;
			
		case 5:
			
			//document.img-ns2.src = "images/number-plates/" + newChar + ".gif";
			document.getElementById("img_ns6").src = 'images/number-plates/' + newChar + '.gif';
			//document.getElementById("char_2").width = newWidth;
			break;
			
		case 6:
			
			//document.img-ns2.src = "images/number-plates/" + newChar + ".gif";
			document.getElementById("img_ns7").src = 'images/number-plates/' + newChar + '.gif';
			//document.getElementById("char_2").width = newWidth;
			break;
			
		
						
		}//end case
		
		i++;
	}//while
	

}// function


function displayImageNS(thisInput, vposition){

var number;

//var number = thisInput.value;
//alert(thisInput.value);
//var number;
//number = document.frmnew.first.value;
//alert(vposition);
if(vposition == 'first'){
number = thisInput.value;
number = number + document.frmnew.year.options[document.frmnew.year.selectedIndex].value;
number = number + document.frmnew.last.value;
}

if(vposition == 'second'){
number = document.frmnew.first.value;	
number = number + thisInput.value;
//number = number + document.frmnew.year.options[document.frmnew.year.selectedIndex].value;
number = number + document.frmnew.last.value;
}

if(vposition == 'third'){
number = document.frmnew.first.value;	
number = number + document.frmnew.year.options[document.frmnew.year.selectedIndex].value;
number = number + thisInput.value;
}


//alert(number);

//var number = doucument.value;
var numlength = number.length;
//alert(number);
//alert(numlength);
//thisInput.focus();
//i = 0;

arrayimg = Array();

arrayimg[0] = 'space';
arrayimg[1] = 'space';
arrayimg[2] = 'space';
arrayimg[3] = 'space';
arrayimg[4] = 'space';
arrayimg[5] = 'space';
arrayimg[6] = 'space';

		var vstring = '';
				//for(j=0,i=istart;i<iend;i++,j++){
		//for(j=0;j<8;j++){	
		for(j=0;j<numlength;j++){
		
		//alert(j);
		if(isWhitespace(number.charAt(j)))
		{
			newChar = arrayimg[j];
			//imgsrc="img_reg"+(j+1);
			//document.getElementById(imgsrc).src = 'images/big-number-plates/' + newChar + '.jpg';
			newChar1 = newChar.toLowerCase();
			vstring += '<img src="images/small-number-plates/' + newChar1 + '.gif" />';
		}
		else if(number.charAt(j) == '-')
		{
			newChar = arrayimg[j];
			newChar1 = newChar.toLowerCase();
			vstring += '<img src="images/small-number-plates/' + newChar1 + '.gif" />';
		}
		else
		{
			
			newChar = number.charAt(j);
			//imgsrc="img_reg"+(j+1);
			newChar1 = newChar.toLowerCase();
			vstring += '<img src="images/small-number-plates/' + newChar1 + '.gif" />';
			//document.getElementById(imgsrc).src = 'images/big-number-plates/' + newChar + '.jpg';
		}
		
		
		
		//i++;
		}//for
		
		document.getElementById('divns').innerHTML = vstring;
		//alert(vstring);
		
			
}// function
//////////////////////////////////////////////

function displayImageCS(thisInput, vposition){

var number;

//var number = thisInput.value;
//alert(thisInput.value);
//var number;
//number = document.frmnew.first.value;
//alert(vposition);
if(vposition == 'first'){
number = thisInput.value;
number = number + document.frmclassic.number.options[document.frmclassic.number.selectedIndex].value;
number = number + document.frmclassic.last.value;
}

if(vposition == 'second'){
number = document.frmclassic.prefix.value;	
number = number + thisInput.value;
//number = number + document.frmnew.year.options[document.frmnew.year.selectedIndex].value;
number = number + document.frmclassic.last.value;
}

if(vposition == 'third'){
number = document.frmclassic.prefix.value;	
number = number + document.frmclassic.number.options[document.frmclassic.number.selectedIndex].value;
number = number + thisInput.value;
}


//alert(number);

//var number = doucument.value;
var numlength = number.length;
//alert(number);
//alert(numlength);
//thisInput.focus();
//i = 0;

arrayimg = Array();

arrayimg[0] = 'space';
arrayimg[1] = 'space';
arrayimg[2] = 'space';
arrayimg[3] = 'space';
arrayimg[4] = 'space';
arrayimg[5] = 'space';
arrayimg[6] = 'space';

		var vstring = '';
				//for(j=0,i=istart;i<iend;i++,j++){
		//for(j=0;j<8;j++){	
		for(j=0;j<numlength;j++){
		
		//alert(j);
		if(isWhitespace(number.charAt(j)))
		{
			newChar = arrayimg[j];
			//imgsrc="img_reg"+(j+1);
			//document.getElementById(imgsrc).src = 'images/big-number-plates/' + newChar + '.jpg';
			newChar1 = newChar.toLowerCase();
			vstring += '<img src="images/small-number-plates/' + newChar1 + '.gif" />';
		}
		else if(number.charAt(j) == '_')
		{
			newChar = arrayimg[j];
			newChar1 = newChar.toLowerCase();
			vstring += '<img src="images/small-number-plates/' + newChar1 + '.gif" />';
		}
		else if(number.charAt(j) == '*')
		{
			newChar = arrayimg[j];
			newChar1 = newChar.toLowerCase();
			vstring += '<img src="images/small-number-plates/' + newChar1 + '.gif" />';
		}
		else
		{
			
			newChar = number.charAt(j);
			//imgsrc="img_reg"+(j+1);
			newChar1 = newChar.toLowerCase();
			vstring += '<img src="images/small-number-plates/' + newChar1 + '.gif" />';
			//document.getElementById(imgsrc).src = 'images/big-number-plates/' + newChar + '.jpg';
		}
		
		
		
		//i++;
		}//for
		
		document.getElementById('divcs').innerHTML = vstring;
		//alert(vstring);
		
			
}// function
//////////////////////////////////////////////

function displayImageCS1(thisInput, istart, iend){

var number = thisInput.value;
var numlength = thisInput.value.length;
//alert(number+"-"+thisInput.id);
//alert(numlength);
//thisInput.focus();
//i = 0;

arrayimg = Array();

arrayimg[0] = 'space';
arrayimg[1] = 'space';
arrayimg[2] = 'space';
arrayimg[3] = 'space';
arrayimg[4] = 'space';
arrayimg[5] = 'space';
arrayimg[6] = 'space';

		for(j=0,i=istart;i<iend;i++,j++){
		
		if(number.charAt(j) == '')
		{
			newChar = arrayimg[i];
			
		}
		 
		else if(number.charAt(j) == '_')
		{
			newChar = arrayimg[i];
			
		}
		else if(number.charAt(j) == '*')
		{
			newChar = arrayimg[i];
			
		}
		else
		{
			
			newChar = number.charAt(j);
			
		}
		
		imgsrc="img_cs"+(i+1);
		document.getElementById(imgsrc).src = 'images/number-plates/' + newChar + '.gif';
		
		//i++;
		}//whiel
		
		//alert(newChar);
	
			
}// function

function removeImage(thisInput){

alert(thisInput.value);

}


/////////////////////////////////////////////////////
/////////////////////////////////////////////////////

function displaySearch(thisInput, istart, iend){

var number = thisInput.value;
var numlength = thisInput.value.length;
//alert(number);
//alert(numlength);
//thisInput.focus();
//i = 0;

arrayimg = Array();

arrayimg[0] = 'space';
arrayimg[1] = 'space';
arrayimg[2] = 'space';
arrayimg[3] = 'space';
arrayimg[4] = 'space';
arrayimg[5] = 'space';
arrayimg[6] = 'space';
arrayimg[7] = 'space';

		//for(j=0,i=istart;i<iend;i++,j++){
		for(j=0;j<8;j++){	
		
		//alert(j);
		if(isWhitespace(number.charAt(j)))
		{
			newChar = arrayimg[j];
			imgsrc="img_reg"+(j+1);
			if(newChar!="space") {
				newChar1 = newChar.toUpperCase();
			}else {
				newChar1 = newChar
			}
			document.getElementById(imgsrc).src = 'images/big-number-plates/' + newChar1 + '.jpg';
		}
		else
		{
			
			newChar = number.charAt(j);
			imgsrc="img_reg"+(j+1);
			if(newChar!="space") {
				newChar1 = newChar.toUpperCase();
			}else {
				newChar1 = newChar
			}
			document.getElementById(imgsrc).src = 'images/big-number-plates/' + newChar1 + '.jpg';
		}
		
		
		
		//i++;
		}//for
		
		//alert(newChar);
	
			
}// function


function displayImageREG(thisInput, istart, iend){
var number = thisInput.value;
var numlength = thisInput.value.length;

arrayimg = Array();

arrayimg[0] = 'space';
arrayimg[1] = 'space';
arrayimg[2] = 'space';
arrayimg[3] = 'space';
arrayimg[4] = 'space';
arrayimg[5] = 'space';
arrayimg[6] = 'space';
arrayimg[7] = 'space';

		var vstring = '';
				//for(j=0,i=istart;i<iend;i++,j++){
		//for(j=0;j<8;j++){	
		for(j=0;j<numlength;j++){
		
		//alert(j);
		if(isWhitespace(number.charAt(j)))
		{
			newChar = arrayimg[j];
			//imgsrc="img_reg"+(j+1);
			//document.getElementById(imgsrc).src = 'images/big-number-plates/' + newChar + '.jpg';
			if(newChar!="space") {
				newChar1 = newChar.toUpperCase();
			}else {
				newChar1 = newChar
			}
			vstring += '<img src="images/big-number-plates/' + newChar1 + '.jpg" />';
		}
		else
		{
			
			newChar = number.charAt(j);
			//imgsrc="img_reg"+(j+1);
			if(newChar!="space") {
				newChar1 = newChar.toUpperCase();
			}else {
				newChar1 = newChar
			}
			vstring += '<img src="images/big-number-plates/' + newChar1 + '.jpg" />';
			//document.getElementById(imgsrc).src = 'images/big-number-plates/' + newChar + '.jpg';
		}
		
		
		
		//i++;
		}//for
		
		document.getElementById('reg').innerHTML = vstring;
		//alert(vstring);
	
			
}// function


function displayImageREG_sms(thisInput, istart, iend,from){
var number = thisInput.value;
var numlength = thisInput.value.length;

arrayimg = Array();

arrayimg[0] = 'space';
arrayimg[1] = 'space';
arrayimg[2] = 'space';
arrayimg[3] = 'space';
arrayimg[4] = 'space';
arrayimg[5] = 'space';
arrayimg[6] = 'space';
arrayimg[7] = 'space';

		var vstring = '';
				//for(j=0,i=istart;i<iend;i++,j++){
		//for(j=0;j<8;j++){	
		for(j=0;j<numlength;j++){
		
		//alert(j);
		if(isWhitespace(number.charAt(j)))
		{
			newChar = arrayimg[j];
			//imgsrc="img_reg"+(j+1);
			//document.getElementById(imgsrc).src = 'images/big-number-plates/' + newChar + '.jpg';
			if(newChar!="space") {
				newChar1 = newChar.toUpperCase();
			}else {
				newChar1 = newChar
			}
			vstring += '<img src="images/big-number-plates/' + newChar1 + '.jpg" />';
		}
		else
		{
			
			newChar = number.charAt(j);
			//imgsrc="img_reg"+(j+1);
			if(newChar!="space") {
				newChar1 = newChar.toUpperCase();
			}else {
				newChar1 = newChar
			}
			vstring += '<img src="images/big-number-plates/' + newChar1 + '.jpg" />';
			//document.getElementById(imgsrc).src = 'images/big-number-plates/' + newChar + '.jpg';
		}
		
		
		
		//i++;
		}//for
		if(from==2) {
			document.getElementById('reg1').innerHTML = vstring;
		}else {
			document.getElementById('reg').innerHTML = vstring;
		}
		
		//alert(vstring);
	
			
}// function


function displayImageREG_bike(from,thisInput, istart, iend){

var number = document.getElementById("registration_no1").value;
var numlength = number.length;

arrayimg = Array();

arrayimg[0] = 'space';
arrayimg[1] = 'space';
arrayimg[2] = 'space';
arrayimg[3] = 'space';
arrayimg[4] = 'space';
arrayimg[5] = 'space';
arrayimg[6] = 'space';

		var vstring = '<div class="row1-container-big"><div class="numberplate-row1-big">';
				//for(j=0,i=istart;i<iend;i++,j++){
		//for(j=0;j<8;j++){	
		for(j=0;j<numlength;j++){
		
		//alert(j);
		if(isWhitespace(number.charAt(j)))
		{
			newChar = arrayimg[j];
			//imgsrc="img_reg"+(j+1);
			//document.getElementById(imgsrc).src = 'images/big-number-plates/' + newChar + '.jpg';
			if(newChar!="space") {
				//newChar1 = newChar.toUpperCase();
				newChar1 = newChar.toUpperCase();
			}else {
				newChar1 = newChar
			}
			vstring += '<img src="images/big-number-plates/' + newChar1 + '.jpg" />';
		}
		else
		{
			
			newChar = number.charAt(j);
			//imgsrc="img_reg"+(j+1);
			if(newChar!="space") {
				newChar1 = newChar.toUpperCase();
			}else {
				newChar1 = newChar
			}
			vstring += '<img src="images/big-number-plates/' + newChar1 + '.jpg" />';
			//document.getElementById(imgsrc).src = 'images/big-number-plates/' + newChar + '.jpg';
		}
		//i++;
		}//for
		vstring += '</div></div>';
var number = document.getElementById("registration_no2").value;
var numlength = number.length;

arrayimg = Array();

arrayimg[0] = 'space';
arrayimg[1] = 'space';
arrayimg[2] = 'space';
arrayimg[3] = 'space';
arrayimg[4] = 'space';
arrayimg[5] = 'space';
arrayimg[6] = 'space';

		vstring += '<div class="row2-container-big"><div class="numberplate-row2-big">';
				//for(j=0,i=istart;i<iend;i++,j++){
		//for(j=0;j<8;j++){	
		for(j=0;j<numlength;j++){
		
		//alert(j);
		if(isWhitespace(number.charAt(j)))
		{
			newChar = arrayimg[j];
			//imgsrc="img_reg"+(j+1);
			//document.getElementById(imgsrc).src = 'images/big-number-plates/' + newChar + '.jpg';
			if(newChar!="space") {
				//newChar1 = newChar.toUpperCase();
				newChar1 = newChar.toUpperCase();
			}else {
				newChar1 = newChar
			}
			vstring += '<img src="images/big-number-plates/' + newChar1 + '.jpg" />';
		}
		else
		{
			
			newChar = number.charAt(j);
			//imgsrc="img_reg"+(j+1);
			if(newChar!="space") {
				newChar1 = newChar.toUpperCase();
			}else {
				newChar1 = newChar
			}
			vstring += '<img src="images/big-number-plates/' + newChar1 + '.jpg" />';
			//document.getElementById(imgsrc).src = 'images/big-number-plates/' + newChar + '.jpg';
		}
		//i++;
		}//for
		vstring += '</div></div>';		
		document.getElementById('reg1').innerHTML = vstring;
		//alert(vstring);
}// function
function displayImageREG_keyring(from,thisInput, istart, iend){

var number = document.getElementById("keyring_no1").value;
var numlength = number.length;

arrayimg = Array();

arrayimg[0] = 'space';
arrayimg[1] = 'space';
arrayimg[2] = 'space';
arrayimg[3] = 'space';
arrayimg[4] = 'space';
arrayimg[5] = 'space';
arrayimg[6] = 'space';

		var vstring = '<div class="row1-container-big"><div class="numberplate-row1-big">';
				//for(j=0,i=istart;i<iend;i++,j++){
		//for(j=0;j<8;j++){	
		for(j=0;j<numlength;j++){
		
		//alert(j);
		if(isWhitespace(number.charAt(j)))
		{
			newChar = arrayimg[j];
			//imgsrc="img_reg"+(j+1);
			//document.getElementById(imgsrc).src = 'images/big-number-plates/' + newChar + '.jpg';
			if(newChar!="space") {
				//newChar1 = newChar.toUpperCase();
				newChar1 = newChar.toUpperCase();
			}else {
				newChar1 = newChar
			}
			vstring += '<img src="images/big-number-plates/' + newChar1 + '.jpg" />';
		}
		else
		{
			
			newChar = number.charAt(j);
			//imgsrc="img_reg"+(j+1);
			if(newChar!="space") {
				newChar1 = newChar.toUpperCase();
			}else {
				newChar1 = newChar
			}
			vstring += '<img src="images/big-number-plates/' + newChar1 + '.jpg" />';
			//document.getElementById(imgsrc).src = 'images/big-number-plates/' + newChar + '.jpg';
		}
		//i++;
		}//for
		vstring += '</div></div>';
var number = document.getElementById("keyring_no2").value;
var numlength = number.length;

arrayimg = Array();

arrayimg[0] = 'space';
arrayimg[1] = 'space';
arrayimg[2] = 'space';
arrayimg[3] = 'space';
arrayimg[4] = 'space';
arrayimg[5] = 'space';
arrayimg[6] = 'space';

		vstring += '<div class="row2-container-big"><div class="numberplate-row2-big">';
				//for(j=0,i=istart;i<iend;i++,j++){
		//for(j=0;j<8;j++){	
		for(j=0;j<numlength;j++){
		
		//alert(j);
		if(isWhitespace(number.charAt(j)))
		{
			newChar = arrayimg[j];
			//imgsrc="img_reg"+(j+1);
			//document.getElementById(imgsrc).src = 'images/big-number-plates/' + newChar + '.jpg';
			if(newChar!="space") {
				//newChar1 = newChar.toUpperCase();
				newChar1 = newChar.toUpperCase();
			}else {
				newChar1 = newChar
			}
			vstring += '<img src="images/big-number-plates/' + newChar1 + '.jpg" />';
		}
		else
		{
			
			newChar = number.charAt(j);
			//imgsrc="img_reg"+(j+1);
			if(newChar!="space") {
				newChar1 = newChar.toUpperCase();
			}else {
				newChar1 = newChar
			}
			vstring += '<img src="images/big-number-plates/' + newChar1 + '.jpg" />';
			//document.getElementById(imgsrc).src = 'images/big-number-plates/' + newChar + '.jpg';
		}
		//i++;
		}//for
		vstring += '</div></div>';		
		document.getElementById('reg1').innerHTML = vstring;
		//alert(vstring);
}// function

function displayImageREG_bike1(from,thisInput, istart, iend){

var number = document.getElementById("registration_no3").value;
var numlength = number.length;

arrayimg = Array();

arrayimg[0] = 'space';
arrayimg[1] = 'space';
arrayimg[2] = 'space';
arrayimg[3] = 'space';
arrayimg[4] = 'space';
arrayimg[5] = 'space';
arrayimg[6] = 'space';

		var vstring = '<div class="row1-container"><div class="numberplate-row1">';
				//for(j=0,i=istart;i<iend;i++,j++){
		//for(j=0;j<8;j++){	
		for(j=0;j<numlength;j++){
		
		//alert(j);
		if(isWhitespace(number.charAt(j)))
		{
			newChar = arrayimg[j];
			//imgsrc="img_reg"+(j+1);
			//document.getElementById(imgsrc).src = 'images/big-number-plates/' + newChar + '.jpg';
			if(newChar!="space") {
				//newChar1 = newChar.toUpperCase();
				newChar1 = newChar.toLowerCase();
			}else {
				newChar1 = newChar
			}
			vstring += '<img src="images/small-number-plates/' + newChar1 + '.gif" />';
		}
		else
		{
			
			newChar = number.charAt(j);
			//imgsrc="img_reg"+(j+1);
			if(newChar!="space") {
				newChar1 = newChar.toLowerCase();
			}else {
				newChar1 = newChar
			}
			vstring += '<img src="images/small-number-plates/' + newChar1 + '.gif" />';
			//document.getElementById(imgsrc).src = 'images/big-number-plates/' + newChar + '.jpg';
		}
		//i++;
		}//for
		vstring += '</div></div>';
var number = document.getElementById("registration_no4").value;
var numlength = number.length;

arrayimg = Array();

arrayimg[0] = 'space';
arrayimg[1] = 'space';
arrayimg[2] = 'space';
arrayimg[3] = 'space';
arrayimg[4] = 'space';
arrayimg[5] = 'space';
arrayimg[6] = 'space';

		vstring += '<div class="row2-container"><div class="numberplate-row2">';
				//for(j=0,i=istart;i<iend;i++,j++){
		//for(j=0;j<8;j++){	
		for(j=0;j<numlength;j++){
		
		//alert(j);
		if(isWhitespace(number.charAt(j)))
		{
			newChar = arrayimg[j];
			//imgsrc="img_reg"+(j+1);
			//document.getElementById(imgsrc).src = 'images/big-number-plates/' + newChar + '.jpg';
			if(newChar!="space") {
				//newChar1 = newChar.toUpperCase();
				newChar1 = newChar.toLowerCase();
			}else {
				newChar1 = newChar
			}
			vstring += '<img src="images/small-number-plates/' + newChar1 + '.gif" />';
		}
		else
		{
			
			newChar = number.charAt(j);
			//imgsrc="img_reg"+(j+1);
			if(newChar!="space") {
				newChar1 = newChar.toLowerCase();
			}else {
				newChar1 = newChar
			}
			vstring += '<img src="images/small-number-plates/' + newChar1 + '.gif" />';
			//document.getElementById(imgsrc).src = 'images/big-number-plates/' + newChar + '.jpg';
		}
		//i++;
		}//for
		vstring += '</div></div>';		
		document.getElementById('reg1').innerHTML = vstring;
		//alert(vstring);
	
			
}// function



function displaySearchImg(thisInput, istart, iend){

var number = thisInput.value;
var numlength = thisInput.value.length;
//alert(number);
//alert(numlength);
//thisInput.focus();
//i = 0;

arrayimg = Array();

arrayimg[0] = 'space';
arrayimg[1] = 'space';
arrayimg[2] = 'space';
arrayimg[3] = 'space';
arrayimg[4] = 'space';
arrayimg[5] = 'space';
arrayimg[6] = 'space';
arrayimg[7] = 'space';

		var vstring = '';	
		//for(j=0,i=istart;i<iend;i++,j++){
		//for(j=0;j<8;j++){	
		for(j=0;j<numlength;j++){
		
		//alert(j);
		if(isWhitespace(number.charAt(j)))
		{
			newChar = arrayimg[j];
			//imgsrc="img_reg"+(j+1);
			//document.getElementById(imgsrc).src = 'images/big-number-plates/' + newChar + '.jpg';
			vstring += '<img src="images/bigger/' + newChar + '.gif" />';
		}
		else
		{
			
			newChar = number.charAt(j);
			//imgsrc="img_reg"+(j+1);
			vstring += '<img src="images/bigger/' + newChar + '.gif" />';
			//document.getElementById(imgsrc).src = 'images/big-number-plates/' + newChar + '.jpg';
		}
		
		
		
		//i++;
		}//for
		
		document.getElementById('searchimg').innerHTML = vstring;
}

function check_sub(val) {
  document.step2.target = val == 'preview' ? '_blank' : '';
  document.step2.submit22.value = val;
  return true;
}

function check_checkout(val) {
  document.step2.submit22.value = val;
  if(document.step2.is_agree.checked == false) {
	  alert("Do you agree with the terms & conditions. If yes, then Please check the CheckBox");
	  return false;
  }
  return true;
}

function show_on() {
  window.open("show_retention.php", "", "margintop=0, marginleft=0, marginright=0, toolbar=no, status=no, menubar=no, location=no, width=450, height=220, top=25, left=10");	
}

function show_on_redirect() {
  window.open("http://www.smashing-plates.com/show_retention.php", "", "margintop=0, marginleft=0, marginright=0, toolbar=no, status=no, menubar=no, location=no, width=450, height=220, top=25, left=10");	
}

function typechange(type) 
{
 if(type==2) {
 	document.getElementById("headlinediv").style.display = "inline";
 	document.getElementById("wordtagdiv").style.display = "inline";
 	document.getElementById("categorydiv").style.display = "inline";
 }else {
 	document.getElementById("headlinediv").style.display = "none";
 	document.getElementById("wordtagdiv").style.display = "none";
 	document.getElementById("categorydiv").style.display = "none";
 }
}

function typechange2_step21(type) 
{	
	if(document.getElementById("from").value=="wanted") {
		 if(type==2) {
			document.getElementById("headlinediv").style.display = "inline";
			document.getElementById("wordtagdiv").style.display = "inline";
			document.getElementById("categorydiv").style.display = "inline";
			document.getElementById("premcost").style.display = "none";
			document.getElementById("stancost").style.display = "none";
			document.getElementById("premcost1").style.display = "inline";
			document.getElementById("stancost1").style.display = "none";
			document.getElementById('prem_upsell_link').style.display = 'none';
		 }else {
			document.getElementById("headlinediv").style.display = "none";
			document.getElementById("wordtagdiv").style.display = "none";
			document.getElementById("categorydiv").style.display = "none";
			document.getElementById("premcost").style.display = "none";
			document.getElementById("stancost").style.display = "none";
			document.getElementById("premcost1").style.display = "none";
			document.getElementById("stancost1").style.display = "inline";
			document.getElementById('prem_upsell_link').style.display = 'inline';
		 }
		
	}else {
		 if(type==2) {
			document.getElementById("headlinediv").style.display = "inline";
			document.getElementById("wordtagdiv").style.display = "inline";
			document.getElementById("categorydiv").style.display = "inline";
			document.getElementById("premcost").style.display = "inline";
			document.getElementById("stancost").style.display = "none";
			document.getElementById("premcost1").style.display = "none";
			document.getElementById("stancost1").style.display = "none";
			document.getElementById('prem_upsell_link').style.display = 'none';
		 }else {
			document.getElementById("headlinediv").style.display = "none";
			document.getElementById("wordtagdiv").style.display = "none";
			document.getElementById("categorydiv").style.display = "none";
			document.getElementById("premcost").style.display = "none";
			document.getElementById("stancost").style.display = "inline";
			document.getElementById("premcost1").style.display = "none";
			document.getElementById("stancost1").style.display = "none";
			document.getElementById('prem_upsell_link').style.display = 'inline';
		 }	
	}
	
	if (typeof(containerHeight) != "undefined" && containerHeight != null) {
		var dur = containerHeight.options.duration;
		containerHeight.options.duration = 0;
		containerHeight.toggle();
		setTimeout("switchContainerBack("+dur+")", 50);
	}
}
function switchContainerBack(dur) {
	containerHeight.options.duration = dur;
	containerHeight.toggle();
}
function typechange2(type) 
{
 if(type==2) {
 	document.getElementById("headlinediv").style.display = "inline";
 	document.getElementById("wordtagdiv").style.display = "inline";
 	document.getElementById("categorydiv").style.display = "inline";
 	document.getElementById("premcost").style.display = "inline";
 	document.getElementById("stancost").style.display = "none";
 }else {
 	document.getElementById("headlinediv").style.display = "none";
 	document.getElementById("wordtagdiv").style.display = "none";
 	document.getElementById("categorydiv").style.display = "none";
 	document.getElementById("premcost").style.display = "none";
 	document.getElementById("stancost").style.display = "inline";
 }
}


function changeloc(value) {
	if(value=="Other Location") {
		document.getElementById("locother").style.display = "inline";
	}else {
		document.getElementById("locother").style.display = "none";
	}

}
function changeloc1(value) {
	if(value=="Other Location") {
		document.getElementById("locationdiv").style.display = "inline";
		document.getElementById("locationdiv1").style.display = "inline";
	}else {
		document.getElementById("locationdiv").style.display = "none";
		document.getElementById("locationdiv1").style.display = "none";
	}

}

function typechange1(type) 
{
 if(type==2) {
 	document.getElementById("headlinediv").style.display = "inline";
 	document.getElementById("wordtagdiv").style.display = "inline";
 	document.getElementById("categorydiv").style.display = "inline";
 	document.getElementById("headlinediv1").style.display = "inline";
 	document.getElementById("wordtagdiv1").style.display = "inline";
 	document.getElementById("categorydiv1").style.display = "inline";
 }else {
 	document.getElementById("headlinediv").style.display = "none";
 	document.getElementById("wordtagdiv").style.display = "none";
 	document.getElementById("categorydiv").style.display = "none";
 	document.getElementById("headlinediv1").style.display = "none";
 	document.getElementById("wordtagdiv1").style.display = "none";
 	document.getElementById("categorydiv1").style.display = "none";
 }
}
function typechange1_edit(type) 
{
 if(type==2) {
 	document.getElementById("wordtagdiv").style.display = "inline";
 	document.getElementById("categorydiv").style.display = "inline";
 	document.getElementById("wordtagdiv1").style.display = "inline";
 	document.getElementById("categorydiv1").style.display = "inline";
 }else {
 	document.getElementById("wordtagdiv").style.display = "none";
 	document.getElementById("categorydiv").style.display = "none";
 	document.getElementById("wordtagdiv1").style.display = "none";
 	document.getElementById("categorydiv1").style.display = "none";
 }
}

function checkwanted() {
	
 	if(document.getElementById("chkwanted").checked==true) {
		document.getElementById("chkwanted").value = 't';
		document.getElementById("is_dvlafees").value = 't';
		
	}else {
		document.getElementById("chkwanted").value = 'f';	
		document.getElementById("is_dvlafees").value = 'f';	
	}
}
function checksetofplates() {	
 	if(document.getElementById("chksetofplates").checked==true) {		
		document.getElementById("is_setofplates").value = 't';		
	}else {		
		document.getElementById("is_setofplates").value = 'f';	
	}
}
function checkactive(value) {
	if(value==1) {
		if(document.getElementById("chk_phonepublish").checked==true) {
			document.getElementById("chk_phonepublish").value = 't';
			document.getElementById("is_phonepublish").value = 't';
			
		}else {
			document.getElementById("chk_phonepublish").value = 'f';	
			document.getElementById("is_phonepublish").value = 'f';	
		}
	}else if(value==2) {
		if(document.getElementById("chk_phone2publish").checked==true) {
			document.getElementById("chk_phone2publish").value = 't';
			document.getElementById("is_phone2publish").value = 't';
			
		}else {
			document.getElementById("chk_phone2publish").value = 'f';	
			document.getElementById("is_phone2publish").value = 'f';	
		}
	}else if(value==3) {
		if(document.getElementById("chk_emailpublish").checked==true) {
			document.getElementById("chk_emailpublish").value = 't';
			document.getElementById("is_emailpublish").value = 't';
			
		}else {
			document.getElementById("chk_emailpublish").value = 'f';	
			document.getElementById("is_emailpublish").value = 'f';	
		}
	}else if(value==4) {
		if(document.getElementById("chksendemail").checked==true) {
			document.getElementById("is_sendemail").value = 't';
			
		}else {
			document.getElementById("is_sendemail").value = 'f';	
		}
	}
}

function changecategory(index,value,subvalue) 
  {
  var xmlHttp;
if(index==0) {
	index="";
}
var k = 0;
var subcategory = "subcategory"+index;
var x=document.getElementById(subcategory);
var len = x.options.length;
for (j = len - 1; j>=0; j--) {
x.remove(j);
}
if(value!=0) {
 try
    {
    // Firefox, Opera 8.0+, Safari
    xmlHttp=new XMLHttpRequest();
    }
  catch (e)
    {
    // Internet Explorer
    try
      {
      xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
      }
    catch (e)
      {
      try
        {
        xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
        }
      catch (e)
        {
        alert("Your browser does not support AJAX!");
        return false;
        }
      }
    }
    xmlHttp.onreadystatechange=function()
      {
      if(xmlHttp.readyState==4)
        {
        var fulltext = xmlHttp.responseText;		
		var text = fulltext.split("!");
		var reccount = text[1];
		var record = text[0].split("|");
		//alert(record);
			for(i=0;i<reccount;i++) {
				var subcat = record[i].split(":");				
						document.getElementById(subcategory).options[i] =  new Option(subcat[1],subcat[1]);
			} 
				var optionlength = document.getElementById(subcategory).options.length;   // booking type
				document.getElementById(subcategory).options[0].selected =true;						
				for(var lm=0;lm<optionlength;lm++){								
					//alert(document.getElementById("bookingtype").options[lm].value+"="+bookingarrayvalue);
					if(document.getElementById(subcategory).options[lm].value == subvalue){
						document.getElementById(subcategory).options[lm].selected = true;					
					}
				}														
						
        }
      }
 	var url = "getsubcategorytext.php?catid="+value;
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null);
}

 }
function show_popup(value) {
  if(value=="1") {
 	 window.open("plate_type.php", "", "margintop=0, marginleft=0, marginright=0, toolbar=no, status=no, menubar=no, location=no, width=550, height=380, top=25, left=10");	
  }else if(value=="2") {
 	 window.open("plate_status.php", "", "margintop=0, marginleft=0, marginright=0, toolbar=no, status=no, menubar=no, location=no, width=400, height=150, top=25, left=10");	
  }else if(value=="3") {
 	 window.open("plate_style.php", "", "margintop=0, marginleft=0, marginright=0, toolbar=no, status=no, menubar=no, location=no, width=430, height=200, top=25, left=10");	
  }else if(value=="4") {
 	 window.open("age_identifier.php", "", "margintop=0, marginleft=0, marginright=0, toolbar=no, status=no, menubar=no, location=no, width=450, height=150, top=25, left=10");	
  }else if(value=="5") {
 	 window.open("plate_disclaimer.php", "", "margintop=0, marginleft=0, marginright=0, toolbar=no, status=no, menubar=no, location=no, width=450, height=230, top=25, left=10");	
  }else if(value=="6") {
 	 window.open("plate_keyword.php", "", "margintop=0, marginleft=0, marginright=0, toolbar=no, status=no, menubar=no, location=no, width=450, height=175, top=25, left=10");	
  }else if(value=="7") {
 	 window.open("plate_DVLAfees.php", "", "margintop=0, marginleft=0, marginright=0, toolbar=no, status=no, menubar=no, location=no, width=400, height=150, top=25, left=10");	
  }else if(value=="8") {
 	 window.open("plate_setofplates.php", "", "margintop=0, marginleft=0, marginright=0, toolbar=no, status=no, menubar=no, location=no, width=350, height=125, top=25, left=10");	
  }else if(value=="9") {
 	 window.open("plate_type_wanted.php", "", "margintop=0, marginleft=0, marginright=0, toolbar=no, status=no, menubar=no, location=no, width=550, height=380, top=25, left=10");	
  }else if(value=="10") {
	 window.open("valuation.php","Plateimage","height=775,width=800,toolbar=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no");
  }else if(value=="11") {
 	 window.open("plate_format.php", "", "margintop=0, marginleft=0, marginright=0, toolbar=no, status=no, menubar=no, location=no, width=325, height=125, top=25, left=10");	
  }else if(value=="12") {
 	 window.open("userdetails_publish.php", "", "margintop=0, marginleft=0, marginright=0, toolbar=no, status=no, menubar=no, location=no, width=400, height=125, top=25, left=10");	
  }else if(value=="13") {
 	//window.open("suggest_category.php","Suggest Category","height=340,width=575,toolbar=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no");	
	 //window.open("suggest_category.php","Suggest-Category","height=340,width=575,toolbar=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no");
	 window.open("suggest_category.php","Category","height=275,width=575,toolbar=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no");
  }
}
function show_previewpopup(value){ 
	if(document.getElementById("is_tradeaccount").value=="t") {	
		var type = 2;	
	} else {
		var type = document.getElementById("type_of_plate").value;
	}
	var price = document.getElementById("asking_price").value;
	var pricetype = document.getElementById("pricetype").value;
	var from = document.getElementById("from").value;
	var is_wantedadvert = document.getElementById("is_wantedadvert").value;
	var format_of_plate = document.getElementById("format_of_plate").value;
	var add_date = document.getElementById("add_date").value;
	var is_upgrade_status = document.getElementById("is_upgrade_status").value;
	var headline = "";
	if(from=="wanted") {
		var status_of_plate = "Wanted";
		var is_dvlafees = "";
		var is_setofplates = "";
		var age_identifier = "";
		var style_of_plate = "";
	}else {
		var status_of_plate = document.getElementById("status_of_plate").value;
		var is_dvlafees = document.getElementById("is_dvlafees").value;
		var is_setofplates = document.getElementById("is_setofplates").value;
		var age_identifier = document.getElementById("age_identifier").value;
		var style_of_plate  = document.getElementById("style_of_plate").value;
	}
	var details = document.getElementById("further_information").value;
	var wordtag = document.getElementById("wordtag").value;
	if(from=="wanted") {
		var hid_plateimage = "";
	}else {
		var hid_plateimage = document.getElementById("hid_plateimage").value;
	}
	if(type==2) {
		headline = document.getElementById("headline").value;
		if(document.getElementById("wordtag1").value) {
			if(wordtag) {
				wordtag = wordtag + ","+document.getElementById("wordtag1").value;
			}else {
				wordtag = document.getElementById("wordtag1").value;
			}			
		}
		if(document.getElementById("wordtag2").value) {
			if(wordtag) {
				wordtag = wordtag + ","+document.getElementById("wordtag2").value;
			}else {
				wordtag = document.getElementById("wordtag2").value;
			}			
		}
		if(document.getElementById("wordtag3").value) {
			if(wordtag) {
				wordtag = wordtag + ","+document.getElementById("wordtag3").value;
			}else {
				wordtag = document.getElementById("wordtag3").value;
			}			
		}
		if(document.getElementById("wordtag4").value) {
			if(wordtag) {
				wordtag = wordtag + ","+document.getElementById("wordtag4").value;
			}else {
				wordtag = document.getElementById("wordtag4").value;
			}			
		}		
	}
	var category = document.getElementById("category").value;
		
	if(document.getElementById("subcategory").value) {
		if(category) {
			category = category + ","+document.getElementById("subcategory").value;
		}else {
			category = document.getElementById("subcategory").value;
		}			
	}

	if(type==2) {
		if(document.getElementById("category1").value) {
			if(category) {
				category = category + ","+document.getElementById("category1").value;
			}else {
				category = document.getElementById("category1").value;
			}			
		}
		if(document.getElementById("subcategory1").value) {
			if(category) {
				category = category + ","+document.getElementById("subcategory1").value;
			}else {
				category = document.getElementById("subcategory1").value;
			}			
		}
		if(document.getElementById("category2").value) {
			if(category) {
				category = category + ","+document.getElementById("category2").value;
			}else {
				category = document.getElementById("category2").value;
			}			
		}
		if(document.getElementById("subcategory2").value) {
			if(category) {
				category = category + ","+document.getElementById("subcategory2").value;
			}else {
				category = document.getElementById("subcategory2").value;
			}			
		}
		if(document.getElementById("category3").value) {
			if(category) {
				category = category + ","+document.getElementById("category3").value;
			}else {
				category = document.getElementById("category3").value;
			}			
		}
		if(document.getElementById("subcategory3").value) {
			if(category) {
				category = category + ","+document.getElementById("subcategory3").value;
			}else {
				category = document.getElementById("subcategory3").value;
			}			
		}
		if(document.getElementById("category4").value) {
			if(category) {
				category = category + ","+document.getElementById("category4").value;
			}else {
				category = document.getElementById("category4").value;
			}			
		}
		if(document.getElementById("subcategory4").value) {
			if(category) {
				category = category + ","+document.getElementById("subcategory4").value;
			}else {
				category = document.getElementById("subcategory4").value;
			}			
		}
	}
 	 window.open("/preview.php?no="+value+"&is_upgrade_status="+is_upgrade_status+"&headline="+headline+"&format_of_plate="+format_of_plate+"&add_date="+add_date+"&style_of_plate="+style_of_plate+"&is_setofplates="+is_setofplates+"&age_identifier="+age_identifier+"&is_dvlafees="+is_dvlafees+"&price="+price+"&category="+category+"&pricetype="+pricetype+"&status_of_plate="+status_of_plate+"&details="+details+"&wordtag="+wordtag+"&hid_plateimage="+hid_plateimage+"&from="+from+"&is_wantedadvert="+is_wantedadvert, "", "margintop=0, marginleft=0, marginright=0, toolbar=no, status=no, menubar=no,,scrollbars=yes, location=no, width=900, height=900, top=25, left=10");	
}

function show_previewpopup2(){ 
	if($("is_tradeaccount").value=="t") {	
		var type = 2;	
	} else {
		var type = $("type_of_plate").value;
	}
	var price = $("asking_price").value;
	var pricetype = $("pricetype").value;
	var from = $("from").value;
	var is_wantedadvert = from == 'wanted' ? 't' : 'f';
	var format_of_plate = $("format_of_plate").value;
	var value = '';
	if (format_of_plate.toUpperCase() == 'CAR') {
		value = $('registration_no').value;
		if (value == '') {
			alert("Please supply a registration number");
			return false;
		}
	} else {
		if ($('registration_no1').value == '' || $('registration_no2').value == '') {
			alert("Please supply a registration number");
			return false;
		}
		value = $('registration_no1').value + '-' + $('registration_no2').value;
	}
	var add_date = new Date().format('Y-m-d');
	var is_upgrade_status = $("type_of_plate").value.toUpperCase() == 'STANDARD' ? 't' : 'f';
	var headline = "";
	if(from=="wanted") {
		var status_of_plate = "Wanted";
		var is_dvlafees = "";
		var is_setofplates = "";
	}else {
		var status_of_plate = $("status_of_plate").value;
		var is_dvlafees = $("is_dvlafees").value;
		var is_setofplates = $("is_setofplates").value;
	}
	var details = $("further_information").value;
	var wordtag = $("wordtag").value;
	if(type==2) {
		headline = $("headline").value;
		if($("wordtag1").value) {
			if(wordtag) {
				wordtag = wordtag + ","+$("wordtag1").value;
			}else {
				wordtag = $("wordtag1").value;
			}			
		}
		if($("wordtag2").value) {
			if(wordtag) {
				wordtag = wordtag + ","+$("wordtag2").value;
			}else {
				wordtag = $("wordtag2").value;
			}
		}
		if($("wordtag3").value) {
			if(wordtag) {
				wordtag = wordtag + ","+$("wordtag3").value;
			}else {
				wordtag = $("wordtag3").value;
			}
		}
		if($("wordtag4").value) {
			if(wordtag) {
				wordtag = wordtag + ","+$("wordtag4").value;
			}else {
				wordtag = $("wordtag4").value;
			}
		}
	}
	var category = $("category").value;
		
	if($("subcategory").value) {
		if(category) {
			category = category + ","+$("subcategory").value;
		}else {
			category = $("subcategory").value;
		}			
	}

	if(type==2) {
		if($("category1").value) {
			if(category) {
				category = category + ","+$("category1").value;
			}else {
				category = $("category1").value;
			}			
		}
		if($("subcategory1").value) {
			if(category) {
				category = category + ","+$("subcategory1").value;
			}else {
				category = $("subcategory1").value;
			}			
		}
		if($("category2").value) {
			if(category) {
				category = category + ","+$("category2").value;
			}else {
				category = $("category2").value;
			}			
		}
		if($("subcategory2").value) {
			if(category) {
				category = category + ","+$("subcategory2").value;
			}else {
				category = $("subcategory2").value;
			}			
		}
		if($("category3").value) {
			if(category) {
				category = category + ","+$("category3").value;
			}else {
				category = $("category3").value;
			}			
		}
		if($("subcategory3").value) {
			if(category) {
				category = category + ","+$("subcategory3").value;
			}else {
				category = $("subcategory3").value;
			}			
		}
		if($("category4").value) {
			if(category) {
				category = category + ","+$("category4").value;
			}else {
				category = $("category4").value;
			}			
		}
		if($("subcategory4").value) {
			if(category) {
				category = category + ","+$("subcategory4").value;
			}else {
				category = $("subcategory4").value;
			}			
		}
	}
 	 window.open("/preview.php?no="+value+"&is_upgrade_status="+is_upgrade_status+"&headline="+headline+"&format_of_plate="+format_of_plate+"&add_date="+add_date+"&is_setofplates="+is_setofplates+"&is_dvlafees="+is_dvlafees+"&price="+price+"&category="+category+"&pricetype="+pricetype+"&status_of_plate="+status_of_plate+"&details="+details+"&wordtag="+wordtag+"&from="+from+"&is_wantedadvert="+is_wantedadvert, "", "margintop=0, marginleft=0, marginright=0, toolbar=no, status=no, menubar=no,,scrollbars=yes, location=no, width=900, height=900, top=25, left=10");	
}

function changeformat(format) {
 if(format=="bike") {
 	document.getElementById("numberdiv1").style.display = "none";
 	document.getElementById("numberdiv2").style.display = "inline";
 	document.getElementById("platediv1").style.display = "none";
 	document.getElementById("platediv2").style.display = "inline";
 }else {
 	document.getElementById("numberdiv1").style.display = "inline";
 	document.getElementById("numberdiv2").style.display = "none";
 	document.getElementById("platediv1").style.display = "inline";
 	document.getElementById("platediv2").style.display = "none";
}
}

function changeformat_valuation(format) 
{
 if(format=="bike") {
 	document.getElementById("numberdiv1").style.display = "none";
 	document.getElementById("numberdiv2").style.display = "inline";
 	document.getElementById("platediv1").style.display = "none";
 	document.getElementById("platediv2").style.display = "inline";
	
	document.getElementById("registration_no").value = "";
	displayImageREG(document.getElementById("registration_no"), 0, 7);
 }else {
 	document.getElementById("numberdiv1").style.display = "inline";
 	document.getElementById("numberdiv2").style.display = "none";
 	document.getElementById("platediv1").style.display = "inline";
 	document.getElementById("platediv2").style.display = "none";
	
	document.getElementById("registration_no1").value = "";
	document.getElementById("registration_no2").value = "";
	displayImageREG_bike(document.getElementById("registration_no1"), 0, 3);
	displayImageREG_bike(document.getElementById("registration_no2"), 4, 7);
}
document.getElementById("status_of_plate").options[0].selected = true;
document.getElementById("retention_expiry_date").value="dd/mm/yyyy";
document.getElementById("chkvehicle").checked=false;
document.getElementById("chkvehicle").value = 'f';
document.getElementById("is_vehicletax").value = 'f';
document.getElementById("statusnewdiv1").style.display = "none";
document.getElementById("statusnewdiv2").style.display = "inline";
document.getElementById("chkunderstand").checked=false;
document.getElementById("chkowner").checked=false;
document.getElementById("is_owner").value = 'f';	
document.getElementById("chkmark").checked=false;
document.getElementById("is_nontrans_regmark").value = 'f';
document.getElementById("details").value = "";
}


function changeformat_step2(format) 
{
 if(format=="bike") {
 	document.getElementById("numberdiv1").style.display = "none";
 	document.getElementById("numberdiv2").style.display = "inline";
 	document.getElementById("platediv1").style.display = "none";
 	document.getElementById("platediv2").style.display = "inline";
	
	document.getElementById("registration_no").value = "";
	displayImageREG(document.getElementById("registration_no"), 0, 7);

}else {
 	document.getElementById("numberdiv1").style.display = "inline";
 	document.getElementById("numberdiv2").style.display = "none";
 	document.getElementById("platediv1").style.display = "inline";
 	document.getElementById("platediv2").style.display = "none";
	
	document.getElementById("registration_no1").value = "";
	document.getElementById("registration_no2").value = "";
	displayImageREG_bike(document.getElementById("registration_no1"), 0, 3);
	displayImageREG_bike(document.getElementById("registration_no2"), 4, 7);
}


document.getElementById("type_of_plate").options[0].selected = true;
document.getElementById("status_of_plate").options[0].selected = true;
document.getElementById("chkwanted").checked=false;
document.getElementById("chkwanted").value = 'f';	
document.getElementById("is_dvlafees").value = 'f';	

document.getElementById("chksetofplates").checked=false;
document.getElementById("chksetofplates").value = 'f';	
document.getElementById("is_setofplates").value = 'f';	

document.getElementById("chktc").checked=false;
document.getElementById("chktc").value = 'f';	
document.getElementById("is_tc").value = 'f';	
 

document.getElementById("asking_price").value = "";
var x = document.getElementById("pricetype");
if (x.options) x.options[0].selected = true;
document.getElementById("plateimage").value = "";
document.getElementById("wordtag").value = "";
document.getElementById("further_information").value = "";


document.getElementById("category").options[0].selected = true;
var x=document.getElementById("subcategory");
var len = x.options.length;
for (j = len - 1; j>=0; j--) {
x.remove(j);
}


document.getElementById("headline").value = "";

document.getElementById("category1").options[0].selected = true;
var x=document.getElementById("subcategory1");
var len = x.options.length;
for (j = len - 1; j>=0; j--) {
x.remove(j);
}

document.getElementById("category2").options[0].selected = true;
var x=document.getElementById("subcategory2");
var len = x.options.length;
for (j = len - 1; j>=0; j--) {
x.remove(j);
}

document.getElementById("category3").options[0].selected = true;
var x=document.getElementById("subcategory3");
var len = x.options.length;
for (j = len - 1; j>=0; j--) {
x.remove(j);
}

document.getElementById("category4").options[0].selected = true;
var x=document.getElementById("subcategory4");
var len = x.options.length;
for (j = len - 1; j>=0; j--) {
x.remove(j);
}
if(document.getElementById("is_tradeaccount").value=="t") {
document.getElementById("hyperlink").value = ""; }
if(document.getElementById("from").value=="wanted") {
	 if(document.getElementById("type_of_plate").value=="2") {
			document.getElementById("premcost").style.display = "none";
			document.getElementById("stancost").style.display = "none";
			document.getElementById("premcost1").style.display = "inline";
			document.getElementById("stancost1").style.display = "none";
	 }else {
			document.getElementById("premcost").style.display = "none";
			document.getElementById("stancost").style.display = "none";
			document.getElementById("premcost1").style.display = "none";
			document.getElementById("stancost1").style.display = "inline";
	 }
}else {
	 if(document.getElementById("type_of_plate").value=="2") {
			document.getElementById("premcost").style.display = "inline";
			document.getElementById("stancost").style.display = "none";
			document.getElementById("premcost1").style.display = "none";
			document.getElementById("stancost1").style.display = "none";
	 }else {
			document.getElementById("premcost").style.display = "none";
			document.getElementById("stancost").style.display = "inline";
			document.getElementById("premcost1").style.display = "none";
			document.getElementById("stancost1").style.display = "none";
	 }
}
	//premier advert details
 	document.getElementById("headlinediv").style.display = "none";
 	document.getElementById("wordtagdiv").style.display = "none";
 	document.getElementById("categorydiv").style.display = "none";

}

function checkowner() {
	
 	if(document.getElementById("chkowner").checked==true) {
		document.getElementById("is_owner").value = 't';
		
	}else {
		document.getElementById("is_owner").value = 'f';	
	}
}


function checkmark() {
	
 	if(document.getElementById("chkmark").checked==true) {
		document.getElementById("is_nontrans_regmark").value = 't';
		
	}else {
		document.getElementById("is_nontrans_regmark").value = 'f';	
	}
}
function checkunderstand() {
	
 	if(document.getElementById("chkunderstand").checked==true) {
		document.getElementById("is_disclaimer").value = 't';
		
	}else {
		document.getElementById("is_disclaimer").value = 'f';	
	}
}

function checkvehicle() {
	
 	if(document.getElementById("chkvehicle").checked==true) {
		document.getElementById("chkvehicle").value = 't';
		document.getElementById("is_vehicletax").value = 't';
		
	}else {
		document.getElementById("chkvehicle").value = 'f';	
		document.getElementById("is_vehicletax").value = 'f';	
	}
}

function checktrans() {
	
 	if(document.getElementById("chktrans").checked==true) {
		document.getElementById("chktrans").value = 't';
		document.getElementById("is_transferable").value = 't';
		
	}else {
		document.getElementById("chktrans").value = 'f';	
		document.getElementById("is_transferable").value = 'f';	
	}
}
function onchangeaccount(value) {
	
 	if(value=="t") {
		document.getElementById("tradepaymentdiv").style.display = "inline";
		document.getElementById("tradepaymentdiv1").style.display = "inline";
	}else {
		document.getElementById("tradepaymentdiv").style.display = "none";
		document.getElementById("tradepaymentdiv1").style.display = "none";
	}
}
function checktc() {
	
 	if(document.getElementById("chktc").checked==true) {
		document.getElementById("is_tc").value = 't';
		
	}else {
		document.getElementById("is_tc").value = 'f';	
	}
}
function OnchangeStatusSMS(status) {
	if(status=="On Retention") {
		document.getElementById("smsreminderdiv").style.display = "inline";
	}else {
		document.getElementById("smsreminderdiv").style.display = "none";
	}
}

// Simulates PHP's date function
Date.prototype.format=function(format){var returnStr='';var replace=Date.replaceChars;for(var i=0;i<format.length;i++){var curChar=format.charAt(i);if(replace[curChar]){returnStr+=replace[curChar].call(this);}else{returnStr+=curChar;}}return returnStr;};Date.replaceChars={shortMonths:['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'],longMonths:['January','February','March','April','May','June','July','August','September','October','November','December'],shortDays:['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],longDays:['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],d:function(){return(this.getDate()<10?'0':'')+this.getDate();},D:function(){return Date.replaceChars.shortDays[this.getDay()];},j:function(){return this.getDate();},l:function(){return Date.replaceChars.longDays[this.getDay()];},N:function(){return this.getDay()+1;},S:function(){return(this.getDate()%10==1&&this.getDate()!=11?'st':(this.getDate()%10==2&&this.getDate()!=12?'nd':(this.getDate()%10==3&&this.getDate()!=13?'rd':'th')));},w:function(){return this.getDay();},z:function(){return"Not Yet Supported";},W:function(){return"Not Yet Supported";},F:function(){return Date.replaceChars.longMonths[this.getMonth()];},m:function(){return(this.getMonth()<11?'0':'')+(this.getMonth()+1);},M:function(){return Date.replaceChars.shortMonths[this.getMonth()];},n:function(){return this.getMonth()+1;},t:function(){return"Not Yet Supported";},L:function(){return"Not Yet Supported";},o:function(){return"Not Supported";},Y:function(){return this.getFullYear();},y:function(){return(''+this.getFullYear()).substr(2);},a:function(){return this.getHours()<12?'am':'pm';},A:function(){return this.getHours()<12?'AM':'PM';},B:function(){return"Not Yet Supported";},g:function(){return this.getHours()%12||12;},G:function(){return this.getHours();},h:function(){return((this.getHours()%12||12)<10?'0':'')+(this.getHours()%12||12);},H:function(){return(this.getHours()<10?'0':'')+this.getHours();},i:function(){return(this.getMinutes()<10?'0':'')+this.getMinutes();},s:function(){return(this.getSeconds()<10?'0':'')+this.getSeconds();},e:function(){return"Not Yet Supported";},I:function(){return"Not Supported";},O:function(){return(this.getTimezoneOffset()<0?'-':'+')+(this.getTimezoneOffset()/60<10?'0':'')+(this.getTimezoneOffset()/60)+'00';},T:function(){return"Not Yet Supported";},Z:function(){return this.getTimezoneOffset()*60;},c:function(){return"Not Yet Supported";},r:function(){return this.toString();},U:function(){return this.getTime()/1000;}};