IMGPREFIX=>{S}/img
STATPREFIX=>{S}/stc
SITENAME=>{S}Foo.com
SITEROOT=>{S}http://www.lj.com/

SECURITYPRIVATE=>{Ss}<img src="<?imgprefix?>/icon_private.gif" width=16 height=16 align=absmiddle>
SECURITYPROTECTED=>{Ss}<img src="<?imgprefix?>/icon_protected.gif" width=14 height=15 align=absmiddle>
LJUSER=>{DRs}<span class='ljuser' style='white-space:nowrap;'><a href='/userinfo.bml?user=%%data%%'><img src='<?imgprefix?>/userinfo.gif' alt='userinfo' width='17' height='17' style='vertical-align:bottom;border:0;' /></a><a href='/users/%%data%%/'><b>%%data%%</b></a></span>
LJCOMM=>{DRs}<span class='ljuser' style='white-space:nowrap;'><a href='/userinfo.bml?user=%%data%%'><img src='<?imgprefix?>/community.gif' alt='userinfo' width='16' height='16' style='vertical-align:bottom;border:0;' /></a><a href='/community/%%data%%/'><b>%%data%%</b></a></span>
LJUSERF=>{DRs}<span class='ljuser' style='white-space:nowrap;'><a href='/userinfo.bml?user=%%data%%&amp;mode=full'><img src='<?imgprefix?>/userinfo.gif' alt='userinfo' width='17' height='17' style='vertical-align:bottom;border:0;' /></a><a href='/users/%%data%%/'><b>%%data%%</b></a></span>
HELP=>{DR}(<a href="%%data%%"><i>help</i></a>)
INERR=>{DR}<font color="#ff0000"><b>%%data%%</b></font>
SOERROR=>{DR}<div><b>%%data%%</b></div>

NEEDLOGIN<=
<?h1 Login Required h1?>
<?p
To view this page you must first <a href="/login.bml?ret=1">go login</a>.
p?>
<=NEEDLOGIN

BADINPUT<=
<?h1 Bad Unicode input h1?>
<?p
Your browser sent some text which is not recognised as valid text in the
UTF-8 encoding, as it should be. This might happen if you forced your browser 
to view the previous page in some other encoding rather than UTF-8. It may
also indicate a bug in the browser. If you cannot get around this error,
contact us. 
p?>
<=BADINPUT

REQUIREPOST<=
{S}As a security precaution, the page you're viewing requires a POST request, 
not a GET.  If you're trying to submit this form legitimately, please 
contact us.
<=REQUIREPOST

LOAD_PAGE_INFO<=
<?_code
#line 3
 @sidebar = ({ 'name' => 'Home',
	       'uri' => '/',
	       'match' => "^/(index\\.bml)?(\\?.*)?\$",
	       'children' => [
			      { 'name' => 'Create Journal',
				'uri' => '/create.bml', },
			      { 'name' => 'Update',
				'uri' => '/update.bml', 
				'extra' => '/update.bml?mode=full',
#				'children' => [
#					       { 'name' => 'Full Update',
#						 'uri' => '/update.bml?mode=full', }
#					       ],
			    },
			      { 'name' => 'Download',
				'uri' => '/download/', },
			      ],
	       },
	     { 'name' => 'LiveJournal',
	       'children' => [
			      { 'name' => 'News',
				'match' => '^/news\\.bml\$',
				'uri' => '/news.bml', },
			      { 'name' => 'Paid Accounts',
				'uri' => '/paidaccounts/', 
                                'recursematch' => '^/paidaccounts/',
				'children' => [ 
						{ 'name' => 'Is this safe?',
						  'uri' => '/paidaccounts/whysafe.bml', },
						{ 'name' => 'Progress',
						  'uri' => '/paidaccounts/progress.bml', },
						],
				},
#			      { 'name' => 'To-Do list',
#				'uri' => '/todo.bml', },
			      { 'name' => 'Contributors',
				'uri' => '/contributors.bml', },
			      ],
	       },
	     { 'name' => 'Customize',
	       'children' => [
			      { 'name' => 'Modify Journal',
				'uri' => '/modify.bml', },
			      { 'name' => 'Create Style',
				'uri' => '/createstyle.bml', },
			      { 'name' => 'Edit Style',
				'uri' => '/editstyle.bml', },
			      ],
	   },
	     { 'name' => 'Find Users',
	       'children' => [
       			      { 'name' => 'Random!',
				'uri' => '/random.bml', },
       			      { 'name' => 'By Region',
				'uri' => '/directory.bml', },
       			      { 'name' => 'By Interest',
				'uri' => '/interests.bml', },
                              { 'name' => 'Search',	
				'uri' => '/directorysearch.bml', }  
	              ], },
	     { 'name' => 'Edit ...',
	       'children' => [
			      { 'name' => 'Personal Info &',
				'uri' => '/editinfo.bml', },
			      { 'name' => 'Settings', cont => 1,
				'uri' => '/editinfo.bml', },
			      { 'name' => 'Your Friends',
				'uri' => '/editfriends.bml', },
			      { 'name' => 'Old Entries',
				'uri' => '/editjournal.bml', },
			      { 'name' => 'Your Pictures',
				'uri' => '/editpics.bml', },
			      { 'name' => 'Your Password',
				'uri' => '/changepassword.bml', },
			      ],
	   },
	     { 'name' => 'Developer Area',
	       'uri' => '/developer/',
	       'match' => "^/developer/\$",
	       'recursematch' => "^/developer/",
	       'children' => [
			      { 'name' => 'Style System',
				'uri' => '/developer/styles.bml', 
				'children' => [
					       { 'name' => 'View Types',
						 'uri' => '/developer/views.bml', },
					       { 'name' => 'Variable List',
						 'uri' => '/developer/varlist.bml', },
					       ],
				},
			      { 'name' => 'Embedding',
				'uri' => '/developer/embedding.bml', },
			      { 'name' => 'Protocol',
				'uri' => '/developer/protocol.bml', 
				'children' => [
					       { 'name' => 'Mode List',
						 'uri' => '/developer/modelist.bml', }
					       ],
			    },
			      ],
	   },
	     { 'name' => 'Need Help?',
	       'children' => [
			      { 'name' => 'Lost Password?',
				'uri' => '/lostinfo.bml', },
			      { 'name' => 'Freq. Asked',
				'uri' => '/support/faq.bml', },
			      { 'name' => 'Questions',
				'uri' => '/support/faq.bml', cont => 1, },
			      { 'name' => 'Support Area',
				'uri' => '/support/', },
			      ],
	   },
	     );
 
 my $remote = LJ::get_remote();
 my $remuser = $remote ? $remote->{'user'} : "";
 my $uri = BML::get_uri();        
 if ($remuser ne "" && $uri ne "/logout.bml") 
 {
     my $subdomain = $remuser;
     $subdomain =~ s/_/-/g;
     unshift @sidebar, { 'name' => "Hello, $remuser!",
			 'children' => [
					{ 'name' => 'Your Journal', 
					  'children' => [
							 { 'name' => 'Recent',
							   'uri' => "/users/$remuser/", },
							 { 'name' => 'Calendar',
							   'uri' => "/users/$remuser/calendar", },
							 { 'name' => 'Friends',
							   'uri' => "/users/$remuser/friends",
							   'extra' => "/friendsfilter.bml",
						       },
							 ],
					  },
					{ 'name' => 'User Info',
					  'uri' => "/userinfo.bml?user=$remuser", },
					{ 'name' => 'Memories',
					  'uri' => "/memories.bml?user=$remuser", },
					{ 'name' => 'Logout',
					  'uri' => '/logout.bml', },
					]
					};
 } elsif ($uri ne "/login.bml") {
     unshift @sidebar, { 'name' => "Log In",
			 'uri' => '/login.bml', }
 }

return "";
_code?>
<=LOAD_PAGE_INFO

AL=>{P}<i><a href="%%data1%%">%%data2%%</a></i> <img src="/img/external_link.gif" width='16' height='11' align='absmiddle' />
AWAYLINK=>{P}<i><a href="%%data1%%">%%data2%%</a></i> <img src="/img/external_link.gif" width='16' height='11' align='absmiddle' />

H1=>{D}<h1>%%data%%</h1>
H2=>{D}<h2>%%data%%</h2>

# Banner Header: search results banner, content desriptor, etc...
BH=>{D}<p align='center'><font face="Arial,Helvetica" color="#CC0000" size='-1'><b>%%data%%</b></font>

GRIN=>{S}&lt;grin&gt;
HR=>{S}<hr />

NEWLINE=>{S}<BR>&nbsp;&nbsp;&nbsp;&nbsp;
P=>{D}<P>%%data%%</P>

STANDOUT<=
{D}<blockquote>
<hr />
%%data%%
<hr />
</blockquote>
<=STANDOUT

BADCONTENT<=
<?h1 Error h1?>
<?p
One or more errors occured processing your request.  Please go back, correct the 
necessary information, and submit your data again.
p?>
<=BADCONTENT

DE<=
%%data%%
<=DE

EMCOLOR=>{S}#c0c0c0
HOTCOLOR=>{S}#ff0000
EMCOLORLITE=>{S}#e2e2e2
screenedbarcolor=>{S}#d0d0d0

CHOICE=>{P}<dt><a href="%%data2%%"><font size="+1"><tt><b>%%data1%%</b></tt></font></a><dd><font size="2">%%data3%%</font>

CHOICES<=
{F}<table width="100%" cellpadding="2" cellspacing="5">
<tr>
<td valign='top' width="50%">
<dl>
%%items%%
</dl>
</td>
<td valign='top' width="50%">
<dl>
%%itemsb%%
</dl>
</td>
</tr>
</table>
<=CHOICES

PAGE<=
{Fp}<html>
<head><title>%%title%%</title>%%head%%</head>
<body %%bodyopts%%>
%%body%%
</body>
</html>
<=PAGE

CHALRESPJS<=
<script type="text/javascript" src="/js/md5.js"></script>
<script language="JavaScript">
    <!--
function sendForm ()
{
    if (! document.getElementById) return true;
    var loginform = document.getElementById('login');
    if (! loginform) return true;
    var pass_ele = document.getElementById('xc_password');
    var chal_ele = document.getElementById('login_chal');
    var resp_ele = document.getElementById('login_response');
    if (! pass_ele || ! chal_ele || ! resp_ele) return true;
    var pass = pass_ele.value;
    var chal = chal_ele.value;
    var res = MD5(chal + MD5(pass));
    resp_ele.value = res;
    pass_ele.value = "";  // dont send clear-text password!
    loginform.submit();
    return false; // cancel browser submit
}
// -->
</script>
<=CHALRESPJS
