<?php

  // load viewer library
  $libraryPath = 'cmsAdmin/lib/viewer_functions.php';
  $dirsToCheck = array('','../','../../','../../../','../../../../');
  foreach ($dirsToCheck as $dir) { if (@include_once("$dir$libraryPath")) { break; }}
  if (!function_exists('getRecords')) { die("Couldn't load viewer library, check filepath in sourcecode."); }

  // error checking
  
  if (!@$GLOBALS['WEBSITE_MEMBERSHIP_PLUGIN']) { die("You must activate the Website Membership plugin before you can access this page."); }

  // error checking
  $errorsAndAlerts = alert();
  if (@$CURRENT_USER) {
    $errorsAndAlerts = "You are already logged in! <a href='{$GLOBALS['WEBSITE_LOGIN_POST_LOGIN_URL']}'>Click here to continue</a> or <a href='?action=logoff'>Logoff</a>.";
  }
 // load records
  list($booksRecords, $booksMetaData) = getRecords(array(
    'tableName'   => 'books',
  ));
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><!-- InstanceBegin template="/Templates/Clownin Round.dwt.php" codeOutsideHTMLIsLocked="false" -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<!-- InstanceBeginEditable name="doctitle" -->
<title>Clownin Round Readers Members Page</title>
<!-- InstanceEndEditable -->
<!-- InstanceBeginEditable name="head" -->
<style type="text/css">
<!--
body {
	background-image: url(../../images/Clowninlayoutbg.jpg);
}
-->
</style><!-- InstanceEndEditable -->
<style type="text/css">
<!--
body {
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
	background-image: url(file:///Macintosh HD/Users/jrenner/Desktop/ClowninRound/images/Clowninlayoutbg.jpg);
	background-repeat: repeat-x;
}
-->
</style>
<script type="text/javascript">
<!--
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_nbGroup(event, grpName) { //v6.0
  var i,img,nbArr,args=MM_nbGroup.arguments;
  if (event == "init" && args.length > 2) {
    if ((img = MM_findObj(args[2])) != null && !img.MM_init) {
      img.MM_init = true; img.MM_up = args[3]; img.MM_dn = img.src;
      if ((nbArr = document[grpName]) == null) nbArr = document[grpName] = new Array();
      nbArr[nbArr.length] = img;
      for (i=4; i < args.length-1; i+=2) if ((img = MM_findObj(args[i])) != null) {
        if (!img.MM_up) img.MM_up = img.src;
        img.src = img.MM_dn = args[i+1];
        nbArr[nbArr.length] = img;
    } }
  } else if (event == "over") {
    document.MM_nbOver = nbArr = new Array();
    for (i=1; i < args.length-1; i+=3) if ((img = MM_findObj(args[i])) != null) {
      if (!img.MM_up) img.MM_up = img.src;
      img.src = (img.MM_dn && args[i+2]) ? args[i+2] : ((args[i+1])? args[i+1] : img.MM_up);
      nbArr[nbArr.length] = img;
    }
  } else if (event == "out" ) {
    for (i=0; i < document.MM_nbOver.length; i++) {
      img = document.MM_nbOver[i]; img.src = (img.MM_dn) ? img.MM_dn : img.MM_up; }
  } else if (event == "down") {
    nbArr = document[grpName];
    if (nbArr)
      for (i=0; i < nbArr.length; i++) { img=nbArr[i]; img.src = img.MM_up; img.MM_dn = 0; }
    document[grpName] = nbArr = new Array();
    for (i=2; i < args.length-1; i+=2) if ((img = MM_findObj(args[i])) != null) {
      if (!img.MM_up) img.MM_up = img.src;
      img.src = img.MM_dn = (args[i+1])? args[i+1] : img.MM_up;
      nbArr[nbArr.length] = img;
  } }
}
//-->
</script>
<link href="../../CSS/Level2_Times_Text.css" rel="stylesheet" type="text/css" />
<style type="text/css">
<!--
a:visited {
	color: #1E1D74;
}
a:hover {
	color: #1E1D74;
}
a:active {
	color: #1E1D74;
}
a:link {
	color: #600;
}
-->
</style></head>

<body vlink="#1E1D74" onload="MM_preloadImages('../../nav/navdown_03.gif','../../nav/navdown_04.gif','../../nav/navdown_05.gif','../../nav/navdown_06.gif','../../nav/navdown_07.gif','../../nav/navdown_08.gif','../../nav/navdown_09.gif')">
<table width="1024" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td colspan="2"><img src="../../images/Clowninroundbanner_01.jpg" alt="Clownin Round Readers" width="1024" height="104" border="0" /></td>
  </tr>
  <tr>
    <td colspan="2"><table border="0" cellpadding="0" cellspacing="0">
      <tr>
        <td><a href="javascript:;" target="_top" onclick="MM_nbGroup('down','group1','spacer','',1)" onmouseover="MM_nbGroup('over','spacer','','',1)" onmouseout="MM_nbGroup('out')"><img src="../../images/Clowns_02.jpg" alt="" name="spacer" width="142" height="27" border="0" id="spacer" onload="" /></a></td>
        <td><a href="../../index.php" target="_top" onclick="MM_nbGroup('down','group1','Home','../../nav/navdown_03.gif',1)" onmouseover="MM_nbGroup('over','Home','../../nav/navdown_03.gif','',1)" onmouseout="MM_nbGroup('out')"><img src="../../nav/nav_03.gif" alt="Home" name="Home" width="87" height="27" border="0" id="Home" onload="" /></a></td>
        <td><a href="../WhyClowns.php" target="_top" onclick="MM_nbGroup('down','group1','WhyClowns','../../nav/navdown_04.gif',1)" onmouseover="MM_nbGroup('over','WhyClowns','../../nav/navdown_04.gif','',1)" onmouseout="MM_nbGroup('out')"><img src="../../nav/nav_04.gif" alt="Why Clowns" name="WhyClowns" width="113" height="27" border="0" id="WhyClowns" onload="" /></a></td>
        <td><a href="../Browse.php" target="_top" onClick="MM_nbGroup('down','group1','Browse','../../nav/navdown_05.gif',1)" onMouseOver="MM_nbGroup('over','Browse','../../nav/navdown_05.gif','',1)" onMouseOut="MM_nbGroup('out')"><img src="../../nav/nav_05.gif" alt="Browse Books" name="Browse" width="128" height="27" border="0" onLoad="" /></a></td>
        <td><a href="../WhatsNew.php" target="_top" onClick="MM_nbGroup('down','group1','WhatsNew','../../nav/navdown_06.gif',1)" onMouseOver="MM_nbGroup('over','WhatsNew','../../nav/navdown_06.gif','',1)" onMouseOut="MM_nbGroup('out')"><img src="../../nav/nav_06.gif" alt="What's New" name="WhatsNew" width="117" height="27" border="0" onLoad="" /></a></td>
        <td><a href="../Reviews.php" target="_top" onClick="MM_nbGroup('down','group1','Reviews','../../nav/navdown_07.gif',1)" onMouseOver="MM_nbGroup('over','Reviews','../../nav/navdown_07.gif','',1)" onMouseOut="MM_nbGroup('out')"><img src="../../nav/nav_07.gif" alt="Reviews and Research" name="Reviews" width="175" height="27" border="0" onLoad="" /></a></td>
        <td><a href="../Blog.php" target="_top" onClick="MM_nbGroup('down','group1','Blog','../../nav/navdown_08.gif',1)" onMouseOver="MM_nbGroup('over','Blog','../../nav/navdown_08.gif','',1)" onMouseOut="MM_nbGroup('out')"><img src="../../nav/nav_08.gif" alt="Sara's Profile and Blog" name="Blog" width="174" height="27" border="0" onLoad="" /></a></td>
        <td><a href="../SignUp.php" target="_top" onClick="MM_nbGroup('down','group1','SignUp','../../nav/navdown_09.gif',1)" onMouseOver="MM_nbGroup('over','SignUp','../../nav/navdown_09.gif','',1)" onMouseOut="MM_nbGroup('out')"><img src="../../nav/nav_09.gif" alt="Sign-up" name="SignUp" width="88" height="27" border="0" onLoad="" /></a></td>
      </tr>
    </table></td>
  </tr>
  <tr>
    <td width="142" align="left" valign="top"><img src="../../images/Clowns_10.jpg" alt="Clowns" width="142" height="53" border="0" /></td>
    <td width="882" align="left" valign="top"><!-- InstanceBeginEditable name="EditRegion1" -->
      <table width="766" border="0" cellpadding="4" cellspacing="4">
        <tr>
          <td width="34" align="left" valign="middle" class="justified">&nbsp;</td>
          <td width="151" align="left" valign="middle" class="justified"><strong>Browse by:</strong></td>
          <td width="118" align="left" valign="middle"><label> <a href="http://clowninroundbooks.com/pages/membership/Members.php?orderBy=title" class="justified">Title</a></label></td>
          <td width="105" align="left" valign="middle"><label><a href="http://clowninroundbooks.com/pages/membership/Members.php?orderBy=level" class="justified">Level</a></label></td>
          <td width="294" align="left" valign="middle" class="justified"><a href="http://clowninroundbooks.com/pages/membership/Members.php?orderBy=lookandsay">&quot;Look and Say&quot; Level</a></td>
        </tr>
      </table>
    <!-- InstanceEndEditable --></td>
  </tr>
  <tr>
    <td height="223" colspan="2" align="left" valign="top"><!-- InstanceBeginEditable name="EditRegion2" -->
      <table width="1023" border="0" cellspacing="8" cellpadding="8">
        <tr>
          <td width="991" align="center" valign="top"><table width="990" border="0" cellspacing="2" cellpadding="2">
            <tr>
              <td width="756" align="left" valign="top"><?php if ($CURRENT_USER): ?>
 Welcome to the Clownin' 'Round Readers Members Page <?php echo $CURRENT_USER['username'] ?>! 
Choose a new password by clicking the link to the right or download your books below!</td>
              <td width="220" align="right" valign="top"><a href="<?php echo $GLOBALS['WEBSITE_LOGIN_PROFILE_URL'] ?>">Edit Profile and Password</a> | <a href="?action=logoff">Logoff</a></td>
              </tr>
</table></td>
        </tr>
        <tr>
          <td height="74"><!-- STEP 2a: Display Uploads for field 'books' (Paste this anywhere inside STEP2 to display uploads) -->
        <!-- Upload Fields: num, createdTime, tableName, fieldName, recordNum, preSaveTempId, filePath, filename, extension, thumbFilePath, isImage, hasThumbnail, urlPath, width, height, thumbUrlPath, thumbWidth, thumbHeight, info1, info2, info3, info4, info5 -->
         <table width = "100%" cellpadding="6" cellspacing="6">
           <?php
		    $columnMax   = 2;
		    $columnCount = 0;
		  ?>
           <tr>
             <?php foreach ($booksRecords as $title): ?>
             <td width="20%"><?php if ($upload = @$title['picture'][0]):?>
               <a href = "<?php echo $title['_link'];?>"><img src = "<?php echo $upload['thumbUrlPath'];?>" width = "<?php echo $upload['thumbWidth'];?>" height = "<?php echo $upload['thumbHeight'];?>" alt = "" style="color:#600;" border="1" /></a>
               <?php else: ?>
               <b>
                 <table cellspacing="0" cellpadding="0" width="50" class="noPhoto" style="height: 50px">
                   <tr>
                     <td align="center" bgcolor="#EEEEEE" class="footer"><b>Photo<br/>
                       Not<br/>
                       Available</b></td>
                   </tr>
                 </table>
                 </b>
               <?php endif ?></td>
             <td width="80%"><table width="314">
               <tr>
                 <td width="306" class="justified"><a href = "<?php echo $title['_link'];?>"><strong><?php echo $title['title'];?></strong></a></td>
               </tr>
               <tr>
                 <td class="bodystyle"><strong>Level: <?php echo $title['level'];?>
                 
                 </strong>
                   <?php foreach ($booksRecords as $record): ?>
                   <?php foreach ($record['books'] as $upload): ?>
                   <?php if ($upload['hasThumbnail']): ?>
                 
                   <?php else: ?>
                   <a href="<?php echo $upload['urlPath'] ?>">Download <?php echo $upload['filename'] ?></a><br/>
                   <?php endif ?>
                   <?php endforeach ?>
                   
                   <?php endforeach ?>
                   </td>
               </tr>
               <tr>
                 <td class="bodystyle"><strong>Look and Say Level: <?php echo $title['lookandsay'] ?></strong></td>
               </tr>
               <tr>
                 <td><strong><?php echo $title['shortdescription'] ?></strong></td>
               </tr>
             </table></td>
             <?php if ((++$columnCount % $columnMax) == 0): ?>
           </tr>
           <tr>
             <?php endif ?>
             <?php endforeach ?>
           </tr>
         </table><br /></td>
        </tr>
        <tr>
          <td align="center" valign="middle"><table width="980" border="0" cellspacing="2" cellpadding="2">
            <tr>
    <td align="center" valign="middle">
      <?php else: ?>If you don't see any content on this page and are a current member you can
      <a href="<?php echo $GLOBALS['WEBSITE_LOGIN_LOGIN_FORM_URL'] ?>">Login</a> here.
      <?php endif ?>
         <?php if (!$CURRENT_USER): ?>
      If you need to renew your membership or want to become a new member <a href="../SignUp.php">Sign up</a> now!
  <?php endif ?></td>
    </tr>
</table></td>
        </tr>
      </table>
      <!-- InstanceEndEditable --></td>
  </tr>
</table>
</body>
<!-- InstanceEnd --></html>
