%%document-stage1-member-scene%%
$Date $

%%preprocess%%
$characterId= $sitemember->p_characterId;
if (is_numeric($characterId) && $characterId>0) {
	$this->characterTag= bparsebml("[document:$characterId]");
	$this->message= "Ready to create a new Scene starring your character $this->characterTag.<br/><br/>
		<a href='$this->baseUrl?method=stage2'>Click to Continue</a>...";
	}
else {
	// sitemember needs to create a character, eh?
	$castfolder= new Folder;
	$query= "SELECT obj.* FROM folder AS obj WHERE obj.siteid='$site->id' AND obj.flavor='castfolder' $session->wherestatus $session->wherepublic ORDER BY rank DESC, created DESC";
	$castfolder->selectObject($query);
	if ($castfolder->id=="") {
		berror("You must define at least one folder as being of flavor 'castfolder' in order to add characters.",0);
		exit;
		}
	else {
		$castfolder->getBaseUrl();
		$this->redirect= "$castfolder->baseUrl/document-.scene?method=stage1create&return=".$folder->baseUrl."document-.scene?method=stage1";
		}

	$this->message= "Before we can create a new Scene, you will need to choose<br/> or create a character for yourself.<br/><br/>
			<a href='$this->redirect'>Click here</a> to do that.";
	}

// always show null on this
$this->showNull= 1;

// ROOM SETTINGS
berror("Getting imagesize on $folder->p_background now...",1);
if ($background= getimagesize($folder->p_background)) {
	berror("Got it.",1);
	$width= $background[0];
	$height= $background[1];

	$targetwidth= 630;
	$targetheight= 430;

	if ($width>$targetwidth) {
		//$height= $height * ($targetwidth/$width);
		$width= $targetwidth;
		}
	if ($height>$targetheight) {
		//$width= $width * ($targetheight/$height);
		$height= $targetheight;
		}

	$this->backgroundwidth= $width."px";
	$this->bgnumericwidth= $width;
	$this->backgroundheight= $height."px";
	$this->bgnumericheight= $height;
	}

// SCENEINFO COLOR
if ($folder->p_infoColor!="") $this->infoColor= $folder->p_infoColor;
else $this->infoColor= "white";

// INFO POSITION
$bgcenter= $this->bgnumericwidth / 2;
$this->infoLeft= ($bgcenter - 230)."px";
$bgmiddle= $this->bgnumericheight / 2;
$this->infoTop= ($bgmiddle - 75)."px";

%%header%%

%%css%%
.boothtable	{ background-color: #f9f9fb;
			border: 3px; border-color: #0e47b2; border-style: solid;
			color: #223344;
			font-family: Tahoma, Geneva, sans-serif; font-size: 12px; line-height: 18px;
			width: $this->backgroundwidth;
			}
.boothtable A { color: #135b9f; }
.frameInfo { font-family: Arial, Helvetica, sans-serif; font-size: 10px; line-height: 14px; color: $this->infoColor; text-align: center; }
.frameInfo A { color: $this->infoColor; font-weight: bold; }

%%template%%

%%listrow%%

%%nullobject%%
<a name="top"> </a>
<img src="/bicons/spacer.gif" width="$this->bgnumericwidth" height="$this->bgnumericheight" border=0>
<div id='background' style='position: absolute; left: 0px; top: 0px; width: $this->backgroundwidth; height: $this->backgroundheight; z-index:1; background-color: #333333; background-image: url($folder->p_background); background-position: center center;'>
</div>
<div id='frameInfo' class='boothTable' style='position: absolute; width: 460px; height: 150px; z-index: 1; left: $this->infoLeft; top: $this->infoTop;' >
		<table class='editTable'>
			<tr>
				<td colspan=2 class='objTitle'>New Scene in $folder->title: Step 1</td>
			</tr>
			<tr>
				<td colspan=2 align='center'><p>&nbsp;</p>
				<p>$this->message</p></td>
			</tr>
		</table>
</div>

%%footer%%

%%postprocess%%

%%end of context%%
