#!/usr/bin/perl

## 2tone 24/01/2003 based on tuner 13/10/2001
   use DBI; 

$site_url = "https://2-tone.info";
$scriptname = "search.pl";
$fescriptname = "2tone.pl";
$passwd = "nova88fm";
$defusr = "twotone_2tone";
$pwlock = "";
#$line_read_step = 5;
$title = "2 Tone Discography";



sub setvalues {
@invalues = ("$d1" , "$d2" , "$d3" , "$d4" , "$d5" , "$d6" , "$d7" , "$d9" , "$d8" , "$d10" ,   
"$d11" , "$d12" , "$d13" , "$d14" , "$d15" , "$d16" , "$d17" , "$d18" , "$d19" ,
"$d20" , "$d21" , "$d22" , "$d23" , "$d24" , "$d25" , "$d26" , "$d27" , "$d28" ,
"$d29" , "$d30" , "$d31" , "$d32" , "$d33" , "$d34" , "$d35" , "$d36" , "$d37" ,
"$d38" , "$d39" , "$d40" , "$d41" , "$d42" , "$d43" , "$d44" , "$d45" , "$d46" ,
"$d47" , "$d48" , "$d49" ,
"$master" , "$d66" , "$imgtna" , "$imgtnb" , "$imgtnsa" , "$imgtnsb" , "$imglga" ,
"$imglgb" , "$imglgsa" , "$imglgsb" , "$servant" , "$bootleg" , "$promo" , "$related" , "$rank"
);


@xvalues = ('title' , 
'artist' ,
'format' ,
'country' ,
'label' ,
'catno' ,
'reldate' ,
'ukpos' ,
'ukentry' ,
'a1' , 'a2' , 'a3' , 'a4' , 'a5' , 'a6' , 'a7' , 'a8' , 'a9' , 'a10' , 'a11' , 'a12' , 'a13' , 'a14' , 'a15' , 'a16' , 'a17' ,
'a18' , 'a19' , 'a20' , 'a21' , 'a22' , 'a23' , 'a24' , 'a25' , 'a26' , 'a27' , 'a28' , 'a29' , 'a30' , 'b1' ,
'b2' , 'b3' , 'b4' ,'b5' , 'b6' , 'b7' , 'b8' , 'b9' , 'b10' ,
'master' ,
'notes' , 
'imgtna' ,
'imgtnb' , 'imgtnsa' ,'imgtnsb' , 'imglga' ,
'imglgb' , 'imglgsa' , 'imglgsb' , 'servant' , 'bootleg' , 'promo' , 'related' , 'rank'
);

}



$header .= "<html><HEAD><TITLE>2 Tone Database</TITLE>";
$header .= "<LINK REL=stylesheet HREF=\"2tone.css\" TYPE=\"text/css\"></head>";
$header .= "<BODY bgcolor=\"#ffffff\">";

print "Content-type: text/html\n\n ";

# make a database connection for general run
#print "connecting to server<br>";
          $dbh = DBI->connect("DBI:mysql:twotone_2tone",$defusr,$passwd) 
          or die "Unable to connect to 2 Tone Database: $dbh->errstr\n";  
          $dbh->{RaiseError} = 1;  

# make a disconnect reconnect for subs that write then read
sub reconnect {
#print "re connecting to server<br>";

          $dbh->disconnect;  
          $dbh = DBI->connect("DBI:mysql:twotone_2tone",$defusr,$passwd) 
          or die "Unable to connect to 2 Tone Database: $dbh->errstr\n";  
          $dbh->{RaiseError} = 1;  
}


&setvalues;


#########################################################################################
#                                                                                       #
#                                                               DEFAULT MENU            #
#                                                                                       #
#########################################################################################


sub default {
$ednom1 = $edno -1;
$ednop1 = $edno +1;
print "<table border=0 align=right><tr><td>";

print "<a href=\"$scriptname\"><img src=trade_mark.gif width=\"116\" height=\"167\" border=\"0\"></a><br>";
print "Record\# $edno<br>";
#print "<a href=\"$scriptname?show$edno&\">SHOW</a><br>";

print "<a href=\"$scriptname\">Home</a><br>";
print "<a href=\"$scriptname?add\">ADD a new record</a><br>";
#print "<a href=\"$scriptname?drop$edno\">DROP</a><br>";


&jumpbox;

print "</td></tr></table>";


}




#########################################################################################
#											#
#								QUERY STRING INPUT	#
#											#
#########################################################################################
# handle some query commands
if ($ENV{'QUERY_STRING'} =~ /^find$/i) {
$subpage = 1;
&prisearch;
&find  ;
}

if ($ENV{'QUERY_STRING'} =~ /^get=(.*)/i) {
$subpage = 1;
&prisearch;
$vterm = $1;
&output  ;
}


if ($ENV{'QUERY_STRING'} =~ /^$/) {
&prisearch;
#&output;
}

unless ($pwlock){

if ($ENV{'QUERY_STRING'} =~ /^show(.*)&(.*)$/) {$edno = $1; $opw = $2; &showrec;}
}

if ($ENV{'QUERY_STRING'} =~ /^search/i) {
$ENV{'QUERY_STRING'} =~ (/^......(.*)\+(.*$)/);
$next = $2;
$line_read_no = $2;
$termhold = $1;
$term = $1;
&prisearch;
&output ;
}


#########################################################################################
#											#
#								OUTPUT			#
#											#
#########################################################################################
#main results ouput
sub output {


print "<table cellpadding=3 cellspacing=3 border=0>";




$sqlquery = "SELECT * FROM music WHERE";

if ($zartist =~ /Allstars$/){$zartist = "Allstars";}

# do not show everything,,, turned off 2/6/2005
#if ($zartist =~ /%/  && $zformat =~ /%/ && $zcountry =~ /%/ ){
#$zartist =  "none";
#$zformat =  "none";
#$zcountry = "none";
#$special_msg = "Please refine your search";
#}



if ($term ne "") {$sqlquery .=      " title  LIKE '%$term%' or b1 LIKE  '%$term%' or a1 LIKE  '%$term%'" ;}
else {$sqlquery .=      " title   LIKE '%' ";}

if ($vterm){ $sqlquery .=      "  AND  LCASE(notes) LIKE LCASE('%$vterm%') ";}

if ($zartist) {$sqlquery .= " and artist  LIKE '%$zartist%'"; } 

if ($zformat =~ /promo|bootleg/){
if ($zformat eq "promo"){$sqlquery .= " and promo  = 1 ";}
if ($zformat eq "cassette"){$sqlquery .= " and format  LIKE '%casette%'";}

if ($zformat eq "bootleg"){$sqlquery .= " and bootleg  = 1 ";}
} else { if ($zformat) {$sqlquery .= " and format  LIKE '%$zformat%'"; } }


if ($zcountry){$sqlquery .= " and country LIKE '%$zcountry%'"; }
if ($zcatno)  {$sqlquery .= " and catno   LIKE '%$zcatno%'"; }

$sqlquery .= " ORDER BY rank ASC";

#print $sqlquery;

my $sth = $dbh->prepare("$sqlquery");



##bhgk
#          $sth->execute() or die "Unable to execute query: $dbh->errstr\n"; 
$sth->execute() or die "Unable to execute query: $dbh->errstr\n";
          my $row; 
          while($row = $sth->fetchrow_arrayref) { 

$q0 = $row->[0]; $q1 = $row->[1]; $q2 = $row->[2]; $q3 = $row->[3]; $q4 = $row->[4];
$q5 = $row->[5]; $q6 = $row->[6]; $q7 = $row->[7]; $q8 = $row->[8]; $q9 = $row->[9]; 
$q10 = $row->[10]; $q11 = $row->[11]; $q12 = $row->[12]; $q13 = $row->[13]; 
$q14 = $row->[14]; $q15 = $row->[15]; $q16 = $row->[16]; $q17 = $row->[17]; 
$q18 = $row->[18]; $q19 = $row->[19]; $q27 = $row->[27];
$q65 = $row->[65];
$bootleg = $row->[68];
$promo = $row->[69];
$rank = $row->[71];


#if ($q65 eq 1){$dearg = "class=master ";} else {$dearg = "class=servant ";}

# print the successful row results in a while loop started above
$el = "<a  href=$scriptname?show$q0&>\[$q0\]</a>";
$em = "<a $dearg href=$fescriptname?display$q0>$q5</a>";
#bhgdisplay

$ton   = "<tr><td>";
$tn  = "</td><td $dearg>";
$toff  = "</td></tr>";

&country_swap($q6);
&format_swap($q3);

print "$ton $tn $em $tn  $nc $tn $nf $tn $q4 $tn $q1 $tn $q7 $toff ";
}


print "</table>";



# print something if the resulting row count is zero
if ($sth->rows == 0) {
 print "<br>No records found.\n\n"; }

if ($special_msg){print $special_msg ;}


          $sth->finish; 
          $dbh->disconnect; 


if ($subpage){&footer;}


}








#########################################################################################
#											#
#								FIND			#
#											#
#########################################################################################
# catch the terms posted from the search then do output
sub find {
read(STDIN, $data, $ENV{'CONTENT_LENGTH'});
@pairs = split(/&/, $data);
foreach $pair (@pairs) 
{
	($name, $value) = split(/=/, $pair);
	$value =~ tr/+/ /;
	$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
	$value =~ s/<!--(.|\n)*-->//g;
	$value =~ s/\n//g;
	$value =~ s/\r//g;
	$value =~ s/          //g;
##	$value =~ s/<([^>]|\n)*>//g;
	$FORM{$name} = $value;
}

$zartist = $FORM{'artist'};   
$term = $FORM{'title'};
$zformat = $FORM{'format'};
$zcountry = $FORM{'country'};
$zcatno = $FORM{'zcatno'};
$vterm = $FORM{'vterm'};

&clean($zcatno);
&clean($term);
&clean($zartist);  
&clean($vterm);

#if ($sfield eq "all"){$term = $sfield = "%";}
#if ($term eq "") {$term = $FORM{'term'}; };
#if ($term eq "all") {$term = "%"; };


&output;
}





sub formatpri {

@formats = (
'7',  
'12', 
'picdisc',
'cdsin',   
'album',
'cassette', 
'cda',
'10',
'special',
'vhs',
'book'
);

@formatsname = (
'7 inch vinyl',
'12 inch vinyl',
'picture disc',
'cd single',
'vinyl album',
'cassette album',
'cd album',
'10 inch vinyl',
'special',
'vhs',
'book'
);


#zzz  
for ($if=0; $if <= $#formats; $if++ ) {
$FORCHK = ""; if ($q3 eq $formats[$if]){$FORCHK = "SELECTED";}
print "<OPTION value=\"$formats[$if]\" $FORCHK>$formatsname[$if]</OPTION>";
}

}




# print the header search box and some logic to nulls or first time run of script
#########################################################################################
#											#
#								PRINT SEARCH INPUT	#
#											#
#########################################################################################

sub clean {

$_[0] =~ s/^\s+//;               # Strip leading
$_[0] =~ s/\s+$//;               # and trailing spaces   
$_[0] =~ s/\.//; 
}

sub prisearch {

read(STDIN, $data, $ENV{'CONTENT_LENGTH'});
@pairs = split(/&/, $data);
foreach $pair (@pairs) 
{
	($name, $value) = split(/=/, $pair);
	$value =~ tr/+/ /;
	$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
	$value =~ s/<!--(.|\n)*-->//g;
	$value =~ s/\n//g;
	$value =~ s/\r//g;
	$value =~ s/          //g;
	$FORM{$name} = $value;
}
$term = $FORM{'title'};
$zformat =  $FORM{'format'};
$zartist  = $FORM{'artist'};
$zcountry = $FORM{'country'};
$zcatno = $FORM{'zcatno'};
$vterm = $FORM{'vterm'};


## parse

        


if ($term eq ""){$term = "";}# cara
if ($zcatno eq ""){$zcatno = "%";}

print "<html><HEAD><TITLE>$title Search</TITLE>";
print "<LINK REL=stylesheet HREF=\"2tone.css\" TYPE=\"text/css\"></head>";
print "<BODY bgcolor=\"#ffffff\">";


if ($subpage){&header;}

print "<FORM METHOD=POST ACTION=$scriptname?find >";
#print "<input type=hidden NAME=term value=\"$term\">";
#print "<input type=hidden NAME=sfield value=\"$sfield\">";

#bhgrte

@formatsname = (
'All Formats',
'7 inch vinyl',
'12 inch vinyl',
'picture disc',
'cd single',
'vinyl album',
'cassette album',
'cd album',
'10 inch vinyl',
'special',
'vhs',
'book',
'promo',
'bootleg'
);




@formats = (
'%',
'7',  
'12', 
'picdisc',
'cdsin',
'album',
'cassette',
'cda',
'10',
'special',
'vhs',
'book',
'promo',
'bootleg'
);


@artists = ('All Artists',
'The Apollinaires',
'Bad Manners',
'The Beat',
'The Bodysnatchers',
'Elvis Costello',
'The Friday Club',
'The Higsons',
'JB\'s Allstars',
'Madness',
'Rhoda',
'Rico',
'The Selecter',
'The Special AKA',
'The Specials',
'The Swinging Cats',
'Various'
);


@artists2 = ('%',
'The Apollinaires',
'Bad Manners',
'The Beat',
'The Bodysnatchers',
'Elvis Costello',
'The Friday Club',
'The Higsons',
'JB\'s Allstars',
'Madness',
'Rhoda',
'Rico',
'The Selecter',
'The Special AKA',
'The Specials',
'The Swinging Cats',
'various');


@countrydb = ("%",
"UK",
"JP",
"IE",
"FR",
"NL",
"DE",
"IT",
"CA",
"US",
"ES",
"GR",
"AU",
"PT",
"NZ",
"YU",
"SE",
"PH",
"ZA",
"NO"
);


@country = ("All Countries",
"UK",
"Japan",
"Ireland",
"France",
"Netherlands",
"Germany",
"Italy",
"Canada",
"US",
"Spain",
"Greece",
"Australia",
"Portugal",
"New Zealand",
"Yugoslavia",
"Sweden",
"Phillipines",
"South Africa",
"Norway"
);




print "<b>Artist</b><br><select name=artist>";
for ($if=0; $if <= $#artists; $if++ ) {
$FORCHK = ""; if ($zartist eq $artists[$if]){$FORCHK = "SELECTED";}
print "<OPTION value=\"$artists2[$if]\" $FORCHK>$artists[$if]</OPTION>";
}
print "</select>";


if ($term eq "%"){$term = "";}

print "<br><br><b>Title</b><br>
<INPUT TYPE=text NAME=title size=22 value=\"$term\">

<br><br><b>Optional Search Term</b><br>
<INPUT TYPE=text NAME=vterm size=22 value=\"$vterm\">";


print "<br><br><b>Format</b><br><select name=format>";
for ($if=0; $if <= $#formats; $if++ ) {
$FORCHK = ""; if ($zformat eq $formats[$if]){$FORCHK = "SELECTED";}
print "<OPTION value=\"$formats[$if]\" $FORCHK>$formatsname[$if]</OPTION>";
}
print "</select>"; 

print "<br><br><b>Country</b><br><select name=country>";
for ($if=0; $if <= $#country; $if++ ) {
$FORCHK = ""; if ($zcountry eq $countrydb[$if]){$FORCHK = "SELECTED";}
print "<OPTION value=\"$countrydb[$if]\" $FORCHK>$country[$if]</OPTION>";
}
print "</select>";



if ($zcatno eq "%"){$zcatno = "";}

print "<br><br><b>Catalogue Number</b><br>
<INPUT TYPE=text NAME=zcatno size=22 value=\"$zcatno\">";


print "<br><br><INPUT TYPE=submit VALUE=go size=12><br></form>";

if ($subpage){&mid1;}
if ($subpage){&boxes;}

}


sub header {
print <<eoi;


<table width="600" border="0" cellspacing="0" cellpadding="0" align="center">
<tr><td valign="top">
<!-- header table -->
	<table width="600" border="0" cellspacing="0" cellpadding="0">
<tr>
	<td width="526" colspan="17" align="left" valign="top"><img src="header/1_17.gif" width="526" height="90" hspace="0" vspace="0" border="0" alt=""></td>
	<td><a href="index.html"><img src="header/2tone_logo.gif" width="69" height="90" hspace="0" vspace="0" border="0" alt=""></a></td>
	<td><img src="header/1_19.gif" width="5" height="90" hspace="0" vspace="0" border="0" alt=""></td>
</tr>
<tr>
	<td><img src="header/2_1.gif" width="4" height="15" hspace="0" vspace="0" border="0" alt=""></td>
	<td><A HREF="index.html" onMouseOver="document.home.src='header/home_over.gif';" onMouseOut="document.home.src='header/home.gif';"><img name="home" src="header/home.gif" width="25" height="15" hspace="0" vspace="0" border="0" alt="HOME"></a></td>
	<td><img src="header/hyphen.gif" width="8" height="15" hspace="0" vspace="0" border="0" alt=""></td>
	<td><A HREF="uk_disco.html" onMouseOver="document.uk_disco.src='header/uk_disco_over.gif';" onMouseOut="document.uk_disco.src='header/uk_disco.gif';"><img name="uk_disco" src="header/uk_disco.gif" width="76" height="15" hspace="0" vspace="0" border="0" alt="UK DISCOGRAPHY"></a></td>
	<td><img src="header/hyphen.gif" width="8" height="15" hspace="0" vspace="0" border="0" alt=""></td>
	<td><A HREF="artists/index.html" onMouseOver="document.artists.src='header/artists_over.gif';" onMouseOut="document.artists.src='header/artists.gif';"><img name="artists" src="header/artists.gif" width="36" height="15" hspace="0" vspace="0" border="0" alt="ARTISTS"></a></td>
	<td><img src="header/hyphen.gif" width="8" height="15" hspace="0" vspace="0" border="0" alt=""></td>
	<td><A HREF="articles/index.html" onMouseOver="document.articles.src='header/articles_over.gif';" onMouseOut="document.articles.src='header/articles.gif';"><img name="articles" src="header/articles.gif" width="40" height="15" hspace="0" vspace="0" border="0" alt="ARTICLES"></a></td>
	<td><img src="header/hyphen.gif" width="8" height="15" hspace="0" vspace="0" border="0" alt=""></td>
	<td><A HREF="search.html"><img name="search" src="header/search_over.gif" width="35" height="15" hspace="0" vspace="0" border="0" alt="SEARCH"></a></td>
	<td><img src="header/hyphen.gif" width="8" height="15" hspace="0" vspace="0" border="0" alt=""></td>
	<td><A HREF="links.html" onMouseOver="document.links.src='header/links_over.gif';" onMouseOut="document.links.src='header/links.gif';"><img name="links" src="header/links.gif" width="26" height="15" hspace="0" vspace="0" border="0" alt="LINKS"></a></td>
	<td><img src="header/hyphen.gif" width="8" height="15" hspace="0" vspace="0" border="0" alt=""></td>
	<td><A HREF="contact.html" onMouseOver="document.contact.src='header/contact_over.gif';" onMouseOut="document.contact.src='header/contact.gif';"><img name="contact" src="header/contact.gif" width="39" height="15" hspace="0" vspace="0" border="0" alt="CONTACT"></a></td>
	<td><img src="header/hyphen.gif" width="8" height="15" hspace="0" vspace="0" border="0" alt=""></td>
	<td><A HREF="subscribe.html" onMouseOver="document.subscribe.src='header/subscribe_over.gif';" onMouseOut="document.subscribe.src='header/subscribe.gif';"><img name="subscribe" src="header/subscribe.gif" width="48" height="15" hspace="0" vspace="0" border="0" alt="SUBSCRIBE"></a></td>
	<td><img src="header/2_17.gif" width="143" height="15" hspace="0" vspace="0" border="0" alt=""></td>
	<td><img src="header/2_trade.gif" width="69" height="15" hspace="0" vspace="0" border="0" alt=""></td>
	<td><img src="header/2_19.gif" width="5" height="15" hspace="0" vspace="0" border="0" alt=""></td>
</tr>
<tr>
	<td width="600" colspan="19" align="left" valign="top"><img src="header/3_all.gif" width="600" height="4" hspace="0" vspace="0" border="0" align="top" alt=""></td>
</tr>
<tr>
	<td width="600" colspan="19" align="left" valign="top" bgcolor="#333333"><img src="header/spacer.gif" width="600" height="1" hspace="0" vspace="0" border="0" align="top" alt=""></td>
</tr>
<tr>
	<td width="600" colspan="19" align="left" valign="top"><img src="header/5_all.gif" width="600" height="8" hspace="0" vspace="0" border="0" align="top" alt=""></td>
</tr>
</table>
<!-- end of header table -->

<!-- dynamic content table -->
<table width="600" border="0" cellspacing="0" cellpadding="0" align="center">

<tr>
	<td valign="top"><br><img src="images/search.gif" width="287" height="21" border="0" alt=""><br><br>
<P>Use the option boxes below to source the item you're looking for...\n
eoi
}




sub mid1 {

print <<eoi;
</td>
	<td valign="top"><img src="images/spacer.gif" width="20" height="10" border="0" alt=""></td>
	<td valign="top"><br><br><br>
eoi
}



sub footer {

print <<eoi;
</td>
</tr>
<tr>
	<td valign="top">&nbsp;</td>
	<td valign="top">&nbsp;</td>
	<td width="287" valign="top"></td>
</tr>
</table>
<!-- end of dynamic content table -->
	
	<!-- footer table -->
	<table width="600" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
	<td valign="top"><img src="images/spacer.gif" width="600" height="30" border="0" alt=""></td>
</tr>
</table>
	
	
	
	
	</td></tr>
</table>




</body>
</html>

eoi
}



sub boxes {



$site_name = "https://2-tone.info";


&imgfilelist;

$setbox = $runa = $runb = $runc = $rund = 0;

&a; 
&b; 
&c;
&d;




$setbox = "a";
&reclink($ifiles[$a]);

$setbox = "b";
&reclink($ifiles[$b]);

$setbox = "c";
&reclink($ifiles[$c]);

$setbox = "d";
&reclink($ifiles[$d]);

###print "<br>a $runa <br>b $runb <br>c $runc <br>d $rund <br>";


print "\n\n
<table cellpadding=0 cellspacing=1><tr><td>
<a href=$site_name/2tone.pl?display$runa>     
<img src=$site_name/rands/$ifiles[$a] width=\"143\" height=\"143\" border=\"0\" alt=\"\"></a></td><td>
<a href=$site_name/2tone.pl?display$runb>
<img src=$site_name/rands/$ifiles[$b] width=\"143\" height=\"143\" border=\"0\" alt=\"\" ></a></td></tr>
\n\n
<tr><td>
<a href=$site_name/2tone.pl?display$runc>
<img src=$site_name/rands/$ifiles[$c] width=\"143\" height=\"143\" border=\"0\" alt=\"\"></a></td><td>
<a href=$site_name/2tone.pl?display$rund>
<img src=$site_name/rands/$ifiles[$d] width=\"143\" height=\"143\" border=\"0\" alt=\"\"></a>
</td></tr></table>
</td></tr>
\n";


sub a {$a = int(rand $#ifiles) + 1;}
sub b {$b = int(rand $#ifiles) + 1; &checkb;}
sub c {$c = int(rand $#ifiles) + 1; &checkc;}
sub d {$d = int(rand $#ifiles) + 1; &checkd;}

sub checkb {if ($b == $a){&b;}}
sub checkc {if ($c == $a || $c == $b){&c;}}
sub checkd {if ($d == $a || $d == $b || $d == $c){&d;}}

sub imgfilelist {
opendir (ETC,"/home/twotone/domains/2-tone.info/public_html/rands");
while ($_ = readdir(ETC)) {
if (/jpg$/i) {$ifiles[++$#ifiles] = "$_"  ;} 
#if (/gif$/i) {$ifiles[++$#ifiles] = "$_"  ;}
} 
closedir(ETC);
} 


sub reclink {
$picinuse = "$_[0]" ;
#print "$picinuse <br>";

use picref;
&get_ref;

if ($setbox eq "a"){$runa = $picref;}
if ($setbox eq "b"){$runb = $picref;}
if ($setbox eq "c"){$runc = $picref;}
if ($setbox eq "d"){$rund = $picref;}
}




}

sub country_swap {
$nc = $_[0];
if ($_[0] eq "UK"){$nc = "UK";}
if ($_[0] eq "JP"){$nc = "Japan";}
if ($_[0] eq "IE"){$nc = "Ireland";}
if ($_[0] eq "FR"){$nc = "France";}
if ($_[0] eq "NL"){$nc = "Netherlands";}
if ($_[0] eq "DE"){$nc = "Germany";}
if ($_[0] eq "IT"){$nc = "Italy";}
if ($_[0] eq "CA"){$nc = "Canada";}
if ($_[0] eq "US"){$nc = "US";}
if ($_[0] eq "ES"){$nc = "Spain";}
if ($_[0] eq "GR"){$nc = "Greece";}
if ($_[0] eq "AU"){$nc = "Australia";}
if ($_[0] eq "PT"){$nc = "Portugal";}
if ($_[0] eq "SP"){$nc = "Spain";}
if ($_[0] eq "NZ"){$nc = "New Zealand";}
if ($_[0] eq "YU"){$nc = "Yugoslavia";}
if ($_[0] eq "NO"){$nc = "Norway";}
}


sub format_swap {
$nf = $_[0];
if ($_[0] eq "7"){$nf = "7&quot;";}
if ($_[0] eq "12"){$nf = "12&quot;";}
if ($_[0] eq "10"){$nf = "10&quot;";}
if ($_[0] eq "album"){$nf = "LP";}
if ($_[0] eq "picdisc"){$nf = "Picture Disc";}
if ($_[0] eq "cdsin"){$nf = "CD Single";}
if ($_[0] eq "cassettea"){$nf = "Cassette";}
if ($_[0] eq "cassette"){$nf = "Cassette";}
if ($_[0] eq "cda"){$nf = "CD";}
if ($_[0] eq "special"){$nf = "Special Format";}
if ($_[0] eq "vhs"){$nf = "VHS";}
}


exit;
