// Javascript functions for VMS signs

function GetCharName(CharX)
{
	switch(CharX)
		{
		case 'A':
		case 'B':
		case 'C':
		case 'D':
		case 'E':
		case 'F':
		case 'G':
		case 'H':
		case 'I':
		case 'J':
		case 'K':
		case 'L':
		case 'M':
		case 'N':
		case 'O':
		case 'P':
		case 'Q':
		case 'R':
		case 'S':
		case 'T':
		case 'U':
		case 'V':
		case 'W':
		case 'X':
		case 'Y':
		case 'Z':
		case '0':
		case '1':
		case '2':
		case '3':
		case '4':
		case '5':
		case '6':
		case '7':
		case '8':
		case '9':
			CharName=CharX;
			break;
		case ' ':
			CharName='space';
			break;
		case '?': CharName='question';break;
		case '.': CharName='fullstop';break;
		case ',': CharName='comma';break;
		case '/': CharName='stroke';break;
		case '#': CharName='hash';break;
		case '£': CharName='pound';break;
		case ':': CharName='colon';break;
		case '!': CharName='exclamation';break;
		case '"': CharName='doublequote';break;
		case '\'': CharName='singlequote';break;
		case '%': CharName='percent';break;
		case '(': CharName='leftbracket';break;
		case ')': CharName='rightbracket';break;
		case '_': CharName='underscore';break;
		case '=': CharName='equals';break;
		case '+': CharName='plus';break;
		case '-': CharName='minus';break;
		case '—': CharName='dash';break;
		case '<': CharName='leftanglebracket';break;
		case '>': CharName='rightanglebracket';break;
		default: CharName='check';break;
		}
return CharName
}



function WriteVMS(VMSmessage1,VMSmessage2,VMSmessage3)
{
VMSmessage1=VMSmessage1.toUpperCase()
VMSmessage2=VMSmessage2.toUpperCase()
VMSmessage3=VMSmessage3.toUpperCase()

if(document.location.pathname.indexOf('local/')==-1 && document.location.pathname.indexOf('local\\')==-1 && document.location.pathname.indexOf('shop/')==-1 && document.location.pathname.indexOf('shop\\')==-1 && document.location.pathname.indexOf('pr/')==-1 && document.location.pathname.indexOf('pr\\')==-1)
	{depth=''}
else
	{depth='../'}

if(VMSmessage1.length>18)
	{
	alert('VMS line cannot be longer than 18 characters!');
	return false;
	}
else
	{
	Counter=0
	while(VMSmessage1.length<18)
		{
		if(Counter%2==0)
			{VMSmessage1 = VMSmessage1 + ' '}
		else
			{VMSmessage1 = ' ' + VMSmessage1}
		Counter++
		}
	}

if(VMSmessage2.length>18)
	{
	alert('VMS line cannot be longer than 18 characters!');
	return false;
	}
else
	{
	Counter=0
	while(VMSmessage2.length<18)
		{
		if(Counter%2==0)
			{VMSmessage2 = VMSmessage2 + ' '}
		else
			{VMSmessage2 = ' ' + VMSmessage2}
		Counter++
		}
	}

if(VMSmessage3.length>18)
	{
	alert('VMS line cannot be longer than 18 characters!');
	return false;
	}
else
	{
	Counter=0
	while(VMSmessage3.length<18)
		{
		if(Counter%2==0)
			{VMSmessage3 = VMSmessage3 + ' '}
		else
			{VMSmessage3 = ' ' + VMSmessage3}
		Counter++
		}
	}

document.writeln('<TABLE CLASS=VMSOUTER BORDER=0 CELLPADDING=0>');
document.writeln('<TBODY>');

document.writeln('<TR>');
document.writeln('<TD CLASS=Corner ID=TopLeft></TD>');

document.writeln('<TD ID=Centre ROWSPAN=3>');

document.writeln('<TABLE CLASS=VMSINNER BORDER=0 CELLPADDING=0>');
document.writeln('<TBODY>');

Row=0
document.writeln('<TR>');
for(Column=0; Column<18 ;Column++)
	{
	document.writeln('<TD CLASS=DIGIT>');
	CharName=GetCharName(VMSmessage1.charAt(Column))
	if(CharName!='space')
		{document.writeln('<IMG SRC="' + depth + 'images/vms/VMS2_' + CharName + '.gif">');}
	document.writeln('</TD>');
	}
document.writeln('</TR>');

Row=1
document.writeln('<TR>');
for(Column=0; Column<18 ;Column++)
	{
	document.writeln('<TD CLASS=DIGIT>');
	CharName=GetCharName(VMSmessage2.charAt(Column))
	if(CharName!='space')
		{document.writeln('<IMG SRC="' + depth + 'images/vms/VMS2_' + CharName + '.gif">');}
	document.writeln('</TD>');
	}
document.writeln('</TR>');

Row=2
document.writeln('<TR>');
for(Column=0; Column<18 ;Column++)
	{
	document.writeln('<TD CLASS=DIGIT>');
	CharName=GetCharName(VMSmessage3.charAt(Column))
	if(CharName!='space')
		{document.writeln('<IMG SRC="' + depth + 'images/vms/VMS2_' + CharName + '.gif">');}
	document.writeln('</TD>');
	}
document.writeln('</TR>');

document.writeln('</TD>');
document.writeln('</TR>');
document.writeln('</TBODY>');
document.writeln('</TABLE>');

document.writeln('</TD>');

document.writeln('<TD CLASS=Corner ID=TopRight></TD>');
document.writeln('</TR>');

document.writeln('<TR>');
document.writeln('<TD CLASS=Side></TD>');
document.writeln('<TD CLASS=Side></TD>');
document.writeln('</TR>');

document.writeln('<TR>');
document.writeln('<TD CLASS=CORNER ID=BottomLeft></TD>');
document.writeln('<TD CLASS=CORNER ID=BottomRight></TD>');
document.writeln('</TR>');

document.writeln('</TBODY>');
document.writeln('</TABLE>');
}
