#!/usr/bin/perl
use CGI qw(:standard);
basicheader() unless $ARGV[1] eq "bh";

$cookieid = "atid";
$cookie = $ENV{"HTTP_COOKIE"};

$cookie =~ m/$cookieid\=([^;]+)/;
$id = $1;

$time = time;

$subfolder = substr($id,0,3);

$dirlocation = "/home12c/sub007/sc13648-GPVH";
chdir($dirlocation) || print "Couldn't change directory $!<BR>\n";


exit unless $id eq "1272988346758";

($event = $ARGV[0]) || ($event = param("event"));


opendir(DATA,"/home12c/sub007/sc13648-GPVH/jacksharem.com/images/images/e/cloth");
@filenms = readdir(DATA);
closedir(DATA);
@filenms = grep m/\w\./, @filenms;
$r = int(rand(@filenms));
push @togo, qq~<img src=http://jacksharem.com/images/images/e/cloth/$filenms[$r] align=right class=picture title="Welcome">~;

push @togo, qq~<p>The "start Trance" imageries put you into your state. Then you can experience the other imageries. Then the "Leave Trance" imageries get out of this state.~;
push @togo, qq~<br><a href=/t/hyp7/c1.htm>Leave trance</a>~;
push @togo, qq~<p><a href=/t/chr/hypintro1.htm><p>Introduction </a>~;
push @togo, qq~<p><a href=/t/hyp99/a1.htm>Basic </a>~;
push @togo, qq~<p><a href=/t/hyp99/b1.htm>Memories </a><BR>~;
push @togo, qq~<p><a href=/t/hyp99/c1.htm>Personality </a><BR>~;

push @togo, qq~<br><a href=/cgi-bin/creatorh.pl?fl=hyp1.txt;start=a1>Entry</a> A hypnoimagery to do first on entering the harem.~;
push @togo, qq~<br><a href=/t/hyp8/g1.htm>Intro</a> Gives a meaning to counting from 10 to 1.~;
push @togo, qq~<br><a href=/t/hyp7/g1.htm>General Relaxation</a>~;
push @togo, qq~<br><a href=/t/hyp6/a1.htm>Intro, starter</a> Encourages more hypnosis.~;
push @togo, qq~<br><a href=/t/hyp7/a1.htm>Improving Induction.</a> This is good for starting.~;
push @togo, qq~<br><a href=/t/hyp7/b1.htm>Be the person you want to be</a> Another starter.~;
push @togo, qq~<br><a href=/t/hyp7/d1.htm>Enjoy training</a> Another good starter.~;
push @togo, qq~<br><a href=/t/hyp9/c1.htm>Your happiness</a> Assumes you are already happy.~;

if ($girlinfo{"baby"} eq "yes") {
	push @togo, qq~<br><a href=/t/hypbab/a1.htm>Lose your ability to use long words.</a>~;
	push @togo, qq~<br><a href=/t/hypbab/b1.htm>Losing years and experience.</a>~;
}

push @togo, qq~<br><a href=/t/hyp6/d1.htm>Write</a> Write a hypnosis.~;
push @togo, qq~<br><a href=/cgi-bin/creatorh.pl?fl=hyp5.txt;start=a1>Entry</a> Simple Body Image~;
push @togo, qq~<br><a href=/cgi-bin/creatorh.pl?fl=hyp1.txt;start=g1>Body Image I</a>~;
push @togo, qq~<br><a href=/cgi-bin/creatorh.pl?fl=hyp1.txt;start=j1>Body Image III</a>~;
push @togo, qq~<br><a href=/cgi-bin/creatorh.pl?fl=hyp1.txt;start=jj1>Body Image IV</a>~;
push @togo, qq~<br><a href=/t/hyp8/i1.htm>Showing Emotions</a>Tolerance and understand of men who are not allowed to freely show their emotions.~;
push @togo, qq~<br><a href=/t/hyppun/b1.htm>Birthday.</a>This is a story for you to experience; there are no explicit suggestions. This one is somewhat sad.~;
push @togo, qq~<br><a href=/t/hyppun/g1.htm>Memories I</a>. A collage of different stories for you to experience; there are no explicit suggestions.~;
push @togo, qq~<br><a href=/t/hyppun/g11.htm>Memories II</a>. More short stories for you to experience; there are no explicit suggestions.~;
push @togo, qq~<br><a href=/t/hyppun/w1.htm>Memory of Piercing your Nipple</a>. Story to experience; there are no explicit suggestions.~;
push @togo, qq~<br><a href=/t/hyppun/w1.htm>Memory of Piercing your Nipple with Rasha</a>. You promised me, Jill. So be brave.~ if $girlinfo{"name"} eq "Jill";
push @togo, qq~<br><a href=/t/hyp8/j1.htm>Making things right</a> Finding happiness. Includes following rules and accepting punishments.~;
push @togo, qq~<br><a href=/t/hyp7/f1.htm>Tolerating Pain and Suffering</a>~;
push @togo, qq~<br><a href=/cgi-bin/creatorh.pl?fl=hyp5.txt;start=e1>breastfeeding</a>~;


push @togo, qq~<br><a href=/t/hyp8/h1.htm>Night Visit</a> Suggests I might give you a hypnoimagery while you are about to sleep or sleeping. Probably you should be experienced with my hypnoimageries before doing this one.~;


push @togo, qq~<br><a href=/t/hyp2/a1.htm>Harmony</a>~;
push @togo, qq~<br><a href=/t/hyp2/b1.htm>Harmony & improving induction</a>~;
push @togo, qq~<br><a href=/t/hyp2/c1.htm>Memory and body image</a> (requires b1)~;
push @togo, qq~<br><a href=/t/hyp2/d1.htm>An example of effects without hypnosis</a> (but vicious)~;



push @togo, qq~<br><a href=/t/hyp2/e1.htm>Memories of outside the Harem</a> If memories outside the harem are causing you pain, this helps you not have those memories only when you are in the harem.~;
push @togo, qq~<br><a href=/t/hyp2/f1.htm>Sleep</a> Pleasant sleep if you have been obedient. But only if you have been obedient. So this is a "vicious" hypnosis, trapping you into obedience.~;
push @togo, qq~<br><a href=/t/hyp2/g1.htm>Concentration</a> Same as above -- good concentration if you have been obedient.~;
push @togo, qq~<br><a href=/t/hyp2/h1.htm>Happiness</a> Same as the two above.~;


push @togo, qq~<br><a href=/t/hyp2/j1.htm>Sleep</a> Practice your body awareness as you fall asleep in bed.~;

push @togo, qq~<br><a href=/t/hyp8/k1.htm>Training</a> Suggests that your unconscious will help you with training (outside of training) for the next few days.~;


push @togo, qq~<br><a href=/t/hyp6/n1.htm>Identity</a> Pretty heavy suggestion about losing your old identity.~;
push @togo, qq~<br><a href=/t/hyp6/p1.htm>Identity</a> Even heavier. Allows some "negotiation".~;
push @togo, qq~<br><a href=/t/hyp7/e1.htm>Body Image</a> Discusses the male disguise you might have to wear sometimes.~;
push @togo, qq~<br><a href=/cgi-bin/creatorh.pl?fl=hyp4.txt;start=a1> Trigger</a> See <a href=/t/chr/trigger.htm>trigger</a>~;


push @togo, qq~<br><a href=/t/hyp8/c1.htm>Babies are cute</a>~;
push @togo, qq~<br><a href=/t/hyp8/e1.htm>Babies II</a> Training to be caring.~;
push @togo, qq~<br><a href=/t/hyp8/f1.htm>Babies III</a> Training to be caring, without the explanation of Babies II.~;
push @togo, qq~<br><a href=/t/hyp9/b1.htm>emails</a> Imagining emailing~;

push @togo, qq~<br><a href=/t/hyp8/d1.htm>Suggests writing a fantasy</a>~;
push @togo, qq~<br><a href=/t/hyp10/b1.htm>Fantasy I</a> Experience a story~;
push @togo, qq~<br><a href=/t/hyp10/c1.htm>Systematic Desensitization I</a> to Jacks touch~ if $id eq "1171642486374";
push @togo, qq~<br><a href=/t/hyp10/d1.htm>Systematic Desensitization II</a> to Jacks touch~ if $id eq "1171642486374";
push @togo, qq~<br><a href=/t/hyp10/e1.htm>Systematic Desensitization III</a> going slower than II~ if $id eq "1171642486374";
push @togo, qq~<br><a href=/t/hyp10/e1.htm>Systematic Desensitization IV</a> continuing to go slow~ if $id eq "1171642486374";

	push @togo, qq~<br><a href=/cgi-bin/creatorh.pl?fl=hyp20.txt;start=b1>Avatar</a> About controlling your Real World avatar.~;


printonblankerpage(@togo);
exit;

################
sub basicheader {
	print <<eND;
Content-type: text/html

eND
	return;
}

sub printonblankerpage {
	@toprint = @_;
	chdir("/home12c/sub007/sc13648-GPVH/jacksharem.com");
	open(DATA,"cgi-bin/chrshell.htm") || open(DATA,"cgi-bin/startshell.htm")  || gracefulend("There was a problem reading body: $!");
	@lines = <DATA>;
	close(DATA);
	$contentmarker = "<!--content-->";

	foreach (@lines) {
		if (m/$contentmarker/o) {
			print @toprint;
		}
		#elsif (s/^ROOMCOLOR//) {
			#($roomcolor = $info{"roomcolor"}) || ($roomcolor = "#ffffe0");
			#print "background-color:$roomcolor;";
		#}
		else {
			print;
		}
	}
	exit;
}

sub printpage {
	my ($fl, $in) = @_;
	chdir("/home12c/sub007/sc13648-GPVH/jacksharem.com");
	exec "cgi-bin/main.pl" if $fl eq "page" || $fl eq "ownpage";
	open(DATA,"$fl") || open(DATA,"$fl") || gracefulend("There was a problem reading $fl");
	@lines = <DATA>;
	close(DATA);
	foreach (@lines) {
		s/INSERT/$in/go;
		print;
	}
	exit;
}

sub savechangestochr {
	open(DATA,">girls/$subfolder/$id/chr.txt") || open(DATA,">girls/$subfolder/$id/chr.txt")  || print "Problem writing to chr for some reason: $!";
	@keys = keys(%info);
	foreach (@keys) {
		$i = $info{$_};
		print DATA "$_=$i\n";
	}
	close(DATA);
	return;
}