#!/usr/bin/perl

use CGI::Carp qw(fatalsToBrowser);
require "./cookie.lib";
require "./tricklib.cgi";

&get_input;

print "Content-type: text/html\n\n";
$dirname = $in{'dir'};
@trash = split(/\//,$dirname);
$dirname1 = pop @trash;
$dirname1 =~ s/-/ /g;
$abspath = "../content/";
$fullpath = $abspath . $dirname;


#<HTML><HEAD><TITLE>$dirname1 Resume, Sample $dirname1 Resumes, Free $dirname1 Resume Examples</TITLE>
print qq~
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
   "http://www.w3.org/TR/html4/loose.dtd">
<HTML><HEAD><TITLE>$dirname1 Resume Samples and Writing Guide</TITLE>
<META http-equiv=Content-Type content="text/html;charset=UTF-8">
<META http-equiv=rating content=general>
<META content=all name=robots>
<META name=description content="$dirname1 resume samples provide tips on how to build your own resume for $dirname1 related job. Also, it will guide you in preparing your resume to get the desired job position.">
<META name=keywords content="$dirname1 resume examples, free sample $dirname1 resume">
<LINK href="/sample-resume.css" type="text/css" rel=stylesheet>
</HEAD>
<BODY>
~;

open(LATEST, "header.txt");
@bnr_all = <LATEST>;
close(LATEST);
print "@bnr_all\n";

#print qq~
#<table width=672 border=0 align=left cellpadding=0 cellspacing=0><tr><td height=25 class=blueheader><strong>$dirname1 Resume</strong></td></tr></table><br><br>
#~;

@heir = split('/',$dirname);
pop(@heir);
print "<a href=\"http://www.aroj.com\">Home</a>";
$i=0;
foreach $tag (@heir)
{
        push @inarray, $tag;
        print " &raquo; <a href=\"/_";
        foreach $intag (@inarray) {
                print "$intag/";
        }
        $tag = ucfirst($tag);
        $tag =~ s/-/ /g;
        print "\">$tag Resumes</a>\n";
        $i++;
}
print " &raquo; $dirname1 Resume<p>\n";

print qq~

<h1>$dirname1 Resume</h1>
<div style="width: 340px; float:right; padding: 0 0 10px 20px;">


<!-- /37742840/Aroj_336x280 -->
<div id='div-gpt-ad-1476432313355-0' style='height:280px; width:336px;'>
<script>
googletag.cmd.push(function() { googletag.display('div-gpt-ad-1476432313355-0'); });
</script>
</div>


</div>
~;

$infofile = "../info/$dirname" . ".txt";
open(LATEST, $infofile);
@bnr_all = <LATEST>;
close(LATEST);
print "@bnr_all\n";

print qq~
~;

$dircount=0;
$filecount=0;
opendir(DIR,$fullpath);
@listing = readdir(DIR);
closedir(DIR);
foreach $list (@listing) {
        $currentdir = $fullpath . "/". $list;
        if (-d $currentdir) {
                if ($list ne "." && $list ne "..") {
			$dircount++;
		}
	}
        unless (-d $currentdir) {
		$filecount++;
	}
}
if( $dircount ne "0" ) {
	$totdirs = get_dirs($dirname);
}

if( $filecount ne "0" ) {
	print "<h2>$dirname1 Resume Samples</h2>";
	$totfiles = &get_files($dirname);
}
if(($totdirs eq "") && ($totfiles eq "")) {
	print "<br><Br><b>There is no \"$dirname1\" sample resumes to show. We will soon update this category and add some $dirname1 resumes.</b><br>\n";
}

open(LATEST, "footer.txt");
@bnr_all = <LATEST>;
close(LATEST);
print "@bnr_all\n";

print qq~
</body></html>
~;


exit;