#!/usr/bin/perl

print "Content-type: text/html\n\n";
use CGI qw(param);
$name = param('list');

open(DATA,"palmdevice.txt");
#flock(DATA,2);
@database=<DATA>;
#flock(DATA,8);
close(DATA);
chomp(@database);

print qq(

<HTML>
<HEAD>
<TITLE>Palm OS Device ::</TITLE>
<META NAME="Author" CONTENT="10pakorn">
<META NAME="Keywords" CONTENT="Palm Powered device, palm os, Palm OS device, PalmOS device, palm device list, palm os list, palm handheld,palm handheld list,">
<META NAME="Description" CONTENT="including all model specification of palm powered device">
</HEAD>
<style>
.std {font-family:ms sans serif,tahoma,sans-serif;font-size:7px;}

.tablebarfont { 
	font-family: tahoma, ms sans serif,verdana, arial, sans-serif;
	font-weight:bold;
	text-transform:none; 
	font-size:11px;
	color: #000;
}

.tablecontentfont { 
	font-family: tahoma, ms sans serif,verdana, arial, sans-serif;
	font-weight:normal;
	text-transform:none; 
	font-size:11px;
	color: #000;
}
</style>
<body style="margin-top:0px;font-family:ms sans serif,tahoma;font-size: 13px;">
Capsules! http://capsules.no-ip.com
<br>กำลังรวบรวมให้มากที่สุด ฮ่าๆ ใครอยากช่วยก็ช่วยได้ค้าบบ แต่คงไม่มี ฮ่าๆ เพราะ spec บางอย่างมันหาไม่ได้ ถ้าไม่มีเครื่องจริงๆ ครั้นจะให้ซื้อทุกเครื่องก็ป่วยละ -_- ให้ครบก่อนค่อยทำให้มัน compare ได้ เหอ-เหอ ...
<br>10-pa-koRn - ic74175 at yahoo.co.uk - 16062005 - 0805pm

<hr color="#C0C0C0" size="1" width="100%">
 <table width="100%" cellpadding="1" cellspacing="1" border="0">
	 <tr valign="top">
		 <td valign="top">
			<img src="lowres.gif"> = Low-Resolution 160px*160px
			<br><img src="hires.gif"> = High-Resolution 320px*320px
			<br><img src="hires_p1.gif"> = High-Resolution plus 320px*480px (Portrait)
			<br><img src="hires_p2.gif"> = High-Resolution plus 480px*320px (Landscape)
		</td>
		<td valign="top">
			<img src="irda.gif"> = IrDa - Infrared
			<br><img src="bt1.1.gif"> = Bluetooth 1.1
			<br><img src="wifi.gif"> = Wireless LAN IEEE802.11b
			<br><img src="mp3.gif"> = MP3 capability
			<br><img src="record.gif"> = Recording capability
		</td>
	</tr>
</table>
);

####################

	&list_all();


####################
print qq(
</body>
</html>
);

#####จบบบบบ#########

sub list_all {

	$loop=0; $company="";
#	while (($database[$loop] ne "") && ($loop<=30)) {
	while ($database[$loop] ne "") {
		@file=split(/\;/,$database[$loop]);
	
		if ($company ne $file[0]) {
			$company=$file[0];
			print qq( 
					</table>
					<hr color="#C0C0C0" size="1" width="100%"><b>$company</b><br>
					<table width="100%" cellpadding="1" cellspacing="1" border="0">
					<tr bgcolor="#54BA2F" class="tablebarfont">
						<td>Model</td>
						<td>CPU</td>
						<td>OS</td>
						<td>Memory</td>
						<td>Screen</td>
						<td>Extra key.</td>
						<td>Expansion</td>
						<td>Connectivity</td>
	<!--				<td>IrDA</td>
						<td>BT</td>
						<td>WLAN</td> -->
						<td>Wireless</td> 
						<td>Multi-media</td>
			<!--		<td>MP3</td>
						<td>Record</td> -->
						<td>Other</td>
					</tr>
			);

	#		$file[10] = ~s{160\*160\,}{<img src="lowres.gif">&nbsp;}gi;
	#		$file[10] = ~s{320\*320\,}{<img src="hires.gif">&nbsp;}gi;
	#		$file[10] = ~s{320\*480\,}{<img src="hires_p1.gif">&nbsp;}gi;
	#		$file[10] = ~s{480\*320\,}{<img src="hires_p2.gif">&nbsp;}gi;

			print qq( 
				<tr bgcolor="#CCEDCE" class="tablecontentfont">
					<td><a href="$file[25]">$file[1]</a></td>
					<td><!--$file[2]&nbsp;-->$file[3]</td>
					<td>$file[4]</td>		
					<td>$file[5]/$file[6]/$file[7]</td>
			);

			if ($file[10]=~/160\*160\,/) {
				$file[10]=~s/160\*160\,//g;
				print qq( <td><img src="lowres.gif">$file[10]</td> );
			} elsif ($file[10]=~/320\*320\,/) {
				$file[10]=~s/320\*320\,//g;
				print qq( <td><img src="hires.gif">$file[10]</td> );
			} elsif ($file[10]=~/320\*480\,/) {
				$file[10]=~s/320\*480\,//g;
				print qq( <td><img src="hires_p1.gif">$file[10]</td> );
			} elsif ($file[10]=~/480\*320\,/) {
				$file[10]=~s/480\*320\,//g;
				print qq( <td><img src="hires_p2.gif">$file[10]</td> );
			} else { print qq( <td>$file[10]</td> ); }

					#<td>$file[10]</td>
		print qq(
					<td>$file[12]</td> 
					<td>$file[13]</td>  
					);

			#		<td>$file[14]</td> อันนี้เป็น connectivity ทั้งหมด
			print "<td>$file[14]";
			if ($file[15] == 1) { print qq(&nbsp;<img src="irda.gif">);	}
			if ($file[16] eq "1.1") { print qq(&nbsp;<img src="bt1.1.gif">);	}
			if ($file[17] eq "IEEE802.11b") { print qq(&nbsp;<img src="wifi.gif">);	}
			print "</td>";

			print qq(
	<!--				<td>$file[15]</td>
					<td>$file[16]</td> 
					<td>$file[17]</td>   -->
					<td>$file[18]</td> 
				);

			print "<td>";
			if ($file[20] == 1) {  print qq(<img src="mp3.gif">&nbsp;);	}
			if ($file[21] == 1) {  print qq(<img src="record.gif">&nbsp;);	}
			print "</td>";

			print qq(
	<!--				<td>$file[20]</td>
					<td>$file[21]</td> -->
					<td>$file[24]</td>
				</tr>
			);

			} else {
			
		#	$file[10] = ~s{160*160\,}{<img src='lowres.gif'>&nbsp;}gi;
		#	$file[10] = ~s{320\*320,}{<img src='hires.gif'>&nbsp;}gi;
		#	$file[10] = ~s{320\*480\,}{<img src='hires_p1.gif'>&nbsp;}gi;
		#	$file[10] = ~s{480\*320\,}{<img src='hires_p2.gif'>&nbsp;}gi;
				
				print qq( 
				<tr bgcolor="#CDEDCE" class="tablecontentfont">
					<td><a href="$file[25]">$file[1]</a></td>
					<td><!--$file[2]&nbsp;-->$file[3]</td>
					<td>$file[4]</td>		
					<td>$file[5]/$file[6]/$file[7]</td>
				);

			if ($file[10]=~/160\*160\,/) {
				$file[10]=~s/160\*160\,//g;
				print qq( <td><img src="lowres.gif">$file[10]</td> );
			} elsif ($file[10]=~/320\*320\,/) {
				$file[10]=~s/320\*320\,//g;
				print qq( <td><img src="hires.gif">$file[10]</td> );
			} elsif ($file[10]=~/320\*480\,/) {
				$file[10]=~s/320\*480\,//g;
				print qq( <td><img src="hires_p1.gif">$file[10]</td> );
			} elsif ($file[10]=~/480\*320\,/) {
				$file[10]=~s/480\*320\,//g;
				print qq( <td><img src="hires_p2.gif">$file[10]</td> );
			} else { print qq( <td>$file[10]</td> ); }


					#<td>$file[10]</td>
		print qq(
					<td>$file[12]</td>
					<td>$file[13]</td>
					);

			#		<td>$file[14]</td> อันนี้เป็น connectivity ทั้งหมด
			print "<td>$file[14]";
			if ($file[15] == 1) { print qq(&nbsp;<img src="irda.gif">);	}
			if ($file[16] eq "1.1") { print qq(&nbsp;<img src="bt1.1.gif">);	}
			if ($file[17] eq "IEEE802.11b") { print qq(&nbsp;<img src="wifi.gif">);	}
			print "</td>";

			print qq(
		<!--		<td>$file[15]</td>
					<td>$file[16]</td> 
					<td>$file[17]</td>  -->
					<td>$file[18]</td> 
				);

			print "<td>";
			if ($file[20] == 1) {  print qq(<img src="mp3.gif">&nbsp;);	}
			if ($file[21] == 1) {  print qq(<img src="record.gif">&nbsp;);	}
			print "</td>";

			print qq(
		<!--			<td>$file[20]</td>
					<td>$file[21]</td> -->
					<td>$file[24]</td>
				</tr>
			);
		}

		$loop++;
	} #while




}

sub search {
	$loop=0; $check=0;
	while ($database[$loop] ne "") {

		@file=split(/\;/,$database[$loop]);

		if (($y_intania ne "") && ($name eq "")) {
			if ($file[0]==$y_intania) {&printt(); $check++;}
		} elsif (($y_intania eq "") && ($name ne "")) {
			if (($file[3] =~/$name/)) {&printt(); $check++;}
			}else {
					if (($file[3] =~/$name/) && ($file[0]==$y_intania)) {	
						&printt();
						$check++;
					}
				}
		$loop++;
	} #while

	if ($check==0) { 
		print "</table><br><br><b><font class='std'>ไม่พบรายชื่อหรือรุ่นที่ท่านหา~~!!";
	} else { 
		print "</table>";
		}
} #sub search()



#####################################
sub head{
	print qq(
	<table border=0 cellpadding=0 cellspacing=1 leftmargin=0 topmargin=0 bgcolor="#cccccc" class="std">
		<tr>
			<td bgcolor="#CCCCFF" align="center"><font color="#000000">Company ID</td>
			<td bgcolor="#CCCCFF" align="center"><font color="#000000">Model</td>
			<td bgcolor="#CCCCFF" align="center"><font color="#000000">CPU</td>
			<td bgcolor="#CCCCFF" align="center"><font color="#000000">Speed</td>
			<td bgcolor="#CCCCFF" align="center"><font color="#000000">OS</td>
			<td bgcolor="#CCCCFF" align="center"><font color="#000000">Memory (MB)</td>
			<td bgcolor="#CCCCFF" align="center"><font color="#000000">ROM (MB)</td>
			<td bgcolor="#CCCCFF" align="center"><font color="#000000">ext Memory (MB)</td>
			<td bgcolor="#CCCCFF" align="center"><font color="#000000">Storage heap (kB)</td>
			<td bgcolor="#CCCCFF" align="center"><font color="#000000">Dynamic heap (kB)</td>
			<td bgcolor="#CCCCFF" align="center"><font color="#000000">Screen</td>
			<td bgcolor="#CCCCFF" align="center"><font color="#000000">Screen Size</td>
			<td bgcolor="#CCCCFF" align="center"><font color="#000000">Extra keys</td>
			<td bgcolor="#CCCCFF" align="center"><font color="#000000">Expansion</td>
			<td bgcolor="#CCCCFF" align="center"><font color="#000000">Connectivity</td>
			<td bgcolor="#CCCCFF" align="center"><font color="#000000">IrDA</td>
			<td bgcolor="#CCCCFF" align="center"><font color="#000000">Bluetooth</td>
			<td bgcolor="#CCCCFF" align="center"><font color="#000000">WLAN</td>
			<td bgcolor="#CCCCFF" align="center"><font color="#000000">Wireless++</td>
			<td bgcolor="#CCCCFF" align="center"><font color="#000000">Speaker</td>
			<td bgcolor="#CCCCFF" align="center"><font color="#000000">MP3</td>
			<td bgcolor="#CCCCFF" align="center"><font color="#000000">Voice Recorder</td>
			<td bgcolor="#CCCCFF" align="center"><font color="#000000">Size</td>
			<td bgcolor="#CCCCFF" align="center"><font color="#000000">Weight</td>
			<td bgcolor="#CCCCFF" align="center"><font color="#000000">Others</td>
			<td bgcolor="#CCCCFF" align="center"><font color="#000000">Web</td>
	</tr>
	);
}

###############################
