// artist.js -- by Keith Onken -- (C) REM Gallery, 2009;

var play_speed;    // Slide show seconds between slides (0 = off);
var scale=1;
var tip_settings="FONTFACE, 'Arial, Helvetica, sans-serif', FONTSIZE, '10pt', OFFSETY, 30, FADEIN, 200, FADEOUT, 200, DURATION, 5000, DELAY, 1000, CENTERMOUSE, true, BORDERCOLOR, '#bbb #555 #555 #bbb', BGCOLOR, '#000000', FONTCOLOR, '#FFFFFF'";

function get_scale ()
{
   max_w=1232;
   max_h=872;
   sw=screen.availWidth;
   sh=screen.availHeight;
   adj_w=(sw/max_w)*.9;
   adj_h=(sh/max_h)*.9;
   scale=(adj_h > adj_w)?adj_w:adj_h;
   return scale;
}

function read_cookie (name)
{
   var nameEQ=name+"=";
   var ca=document.cookie.split (';');

   for (var i=0; i < ca.length; i++)
   {
      var c=ca[i];
      while (c.charAt(0) == ' ')
      {
         c=c.substring (1,c.length);
      }
      if (c.indexOf(nameEQ) == 0)
      {
         return c.substring (nameEQ.length, c.length);
      }
   }
   return null;
}

function set_cookie (name, value, expires, path, domain, secure)
{
   document.cookie=name+"="+escape(value)+
                   ((expires) ? "; expires="+expires.toGMTString() : "") +
                   ((path) ? "; path="+path : "") +
                   ((domain) ? "; domain="+domain : "") +
                   ((secure) ? "; secure" : "");
}

function save_slide_speed (new_speed, root, num)
{
   document.cookie="rem_slides=; expires=Thu, 01-Jan-70 00:00:01 GMT";
   set_cookie ("rem_slides", new_speed);

   var buttons_str="";

   if (total_pics > 1)
   {
      if (new_speed == 0)
      {
         buttons_str+="<table cellspacing=\"10\" cellpadding=\"3\"><tr>";
         buttons_str+="<td width=\"20%\" align=\"right\" class=\"normal\">Slideshow:</td>";
         buttons_str+="<td width=\"40%\" align=\"center\" class=\"bg_on\"  onclick=\"save_slide_speed (0, artist_root_name, current_pic_num);\" onmouseover=\"this.style.cursor='pointer'; Tip('&nbsp;turn off slideshow&nbsp;', "+tip_settings+"); \" onmouseout=\"this.style.cursor='auto'; UnTip(); \">&nbsp;Off&nbsp;</td> ";                                   // ! Slide speed button
         buttons_str+="<td width=\"40%\" align=\"center\" class=\"bg_off\" onclick=\"save_slide_speed (5, artist_root_name, current_pic_num);\" onmouseover=\"this.style.cursor='pointer'; Tip('&nbsp;turn on slideshow&nbsp;', "+tip_settings+"); \"  onmouseout=\"this.style.cursor='auto'; UnTip(); \">&nbsp;On&nbsp;</td> ";                                    // ! Slide speed button
         buttons_str+="</tr></table>";
      }
      if (new_speed >= 1)
      {
         buttons_str+="<table cellspacing=\"10\" cellpadding=\"3\"><tr>";
         buttons_str+="<td width=\"20%\" align=\"right\" class=\"normal\">Slideshow:</td>";
         buttons_str+="<td width=\"40%\" align=\"center\" class=\"bg_off\" onclick=\"save_slide_speed (0, artist_root_name, current_pic_num);\" onmouseover=\"this.style.cursor='pointer'; Tip('&nbsp;turn off slideshow&nbsp;', "+tip_settings+"); \" onmouseout=\"this.style.cursor='auto'; UnTip(); \">&nbsp;Off&nbsp;</td> ";                                   // ! Slide speed button
         buttons_str+="<td width=\"40%\" align=\"center\" class=\"bg_on\"  onclick=\"save_slide_speed (5, artist_root_name, current_pic_num);\" onmouseover=\"this.style.cursor='pointer'; Tip('&nbsp;turn on slideshow&nbsp;', "+tip_settings+"); \"  onmouseout=\"this.style.cursor='auto'; UnTip(); \">&nbsp;On&nbsp;</td> ";                                    // ! Slide speed button
         buttons_str+="</tr></table>";
      }
   }

   document.getElementById('b_slides').innerHTML=buttons_str;

   play_speed=new_speed;

   // Refresh the page with the new speed;
   window.location=root+num+".html";
}

function load_slide_speed ()
{
   // Load the current value;
   database=unescape(read_cookie ("rem_slides"));
   len=database.length;
   return parseInt(database.substring (0, len));
}

function open_close (type, destination, mod, description)
{
   // Displays the open or close buttons;
   //
   //    type        = "open" or "close";
   //    destination = href destination or none (if mod="back");
   //    mod         = "back" (for history.back) or none;
   //    description = text for tooltip which describes what is being opened or closed;

   if (type == "close")
   {
      if (mod == "back")
      {
         var button_str="<table><tr><td align=\"center\" valign=\"top\"><a class=\"Nav_Link2\" href=\""+destination+"\" onmouseover=\"Tip('&nbsp;&nbsp;close"+description+"&nbsp;&nbsp;', "+tip_settings+");\" onmouseout=\"UnTip();\">&nbsp;X&nbsp;</a></td></tr></table>";
      }
      else
      {
         var button_str="<table><tr><td align=\"center\" valign=\"top\"><a class=\"Nav_Link2\" href=\""+destination+"\" onmouseover=\"Tip('&nbsp;&nbsp;close"+description+"&nbsp;&nbsp;', "+tip_settings+");\" onmouseout=\"UnTip();\">&nbsp;X&nbsp;</a></td></tr></table>";
      }
   }
   else
   {
      var button_str="<table><tr><td align=\"center\" valign=\"top\"><a class=\"Nav_Link3\" href=\""+destination+"\" onmouseover=\"Tip('&nbsp;&nbsp;open"+description+"&nbsp;&nbsp;', "+tip_settings+");\" onmouseout=\"UnTip();\">&nbsp;O&nbsp;</a></td></tr></table>";
   }

   document.write(button_str);
}

function art_page
   (
      artist_full_name,
      artist_root_name,
      display_type,
      total_pics,
      current_pic_num,
      f_statement,
      f_statement_mug,
      f_cv,
      art_title,
      art_size_width,
      art_size_height,
      art_size_depth,
      art_media,
      art_year,
      art_other,
      art_price,
      shop,
      art_status,
      art_location,
      artist_statement_title,
      artist_statement_quote,
      artist_statement_part1,
      artist_statement_part2,
      artist_statement_part3,
      artist_statement_part4
   )
{

   var anim_flag=0;
   if (artist_root_name == "yanas_anim")
   {
      anim_flag=1;
      artist_root_name="yanas"
   }

   play_speed=parseInt(load_slide_speed ());
   if (isNaN(play_speed)) { play_speed=0; }

   scale=get_scale();

// Art_Page Parameters:
//
//    artist_full_name. . . . . [string] Full artist name
//    artist_root_name. . . . . [string] Root name (used by filenames)
//    display_type. . . . . . . [string] Type ["art", "statement", or "cv"]
//    total_pics. . . . . . . . [number] Total number of pictures (max = 20)
//    current_pic_num . . . . . [number] Current picture (each "art" .html has a unique pic number)
//    f_statement . . . . . . . [boolan] Has an artist statement
//    f_statement_mug . . . . . [boolan] Has a mugshot (named {root}+"_mug.jpg")
//    f_cv. . . . . . . . . . . [boolan] Has a cv
//    art_title . . . . . . . . [string] Title of the piece
//    art_size_width. . . . . . [number] Width of the piece (inches)
//    art_size_height . . . . . [number] Height of the piece (inches)
//    art_size_depth. . . . . . [number] Depth of the piece (inches) - for sculpture
//    art_media . . . . . . . . [string] Media for the piece
//    art_year. . . . . . . . . [number] Year of the piece
//    art_other . . . . . . . . [string] Other information for the piece
//    art_price . . . . . . . . [number] Price of the piece
//    art_status. . . . . . . . [number] The piece's status [1=Not For Sale, 2=Available, 3=Sold, 4=Sale Pending, 9=Other]
//    art_location. . . . . . . [number] The piece's location [1=Not Available, 2=REM Gallery Exhibit, 3=REM Gallery Exhibit (Loft), 4=REM Gallery Art Storage, 5=Artist's Studio, 6=On Loan, 9=Other]
//    artist_statement_title. . [string] Statement/Exhibit Title (bolded)
//    artist_statement_quote. . [string] Statement Quote (italics and blue)
//    artist_statement_part1. . [string] Statement Paragraph 1
//    artist_statement_part2. . [string] Statement Paragraph 2
//    artist_statement_part3. . [string] Statement Paragraph 3
//    artist_statement_part4. . [string] Statement Paragraph 4
//
// Statement fields only need to be defined when display_type equals "statement".
// Art fields only need to be defined when display_type equals "art".

   artist_root_name=artist_root_name.toLowerCase();
   display_type=display_type.toLowerCase();

   cv_tot=cv_all_titles.length;
   for (i=0; i <= 99; i++)
   {
      if (cv_all_titles[i] == cv_title) {cv_num=i+1}
   }
   if (total_pics > 99) {total_pics=99}
   if (current_pic_num > total_pics) {current_pic_num=total_pics}
   if ((current_pic_num < 0) || (current_pic_num > 99)) {current_pic_num=0}

   // Slide Show stuff;
   if (((display_type == "art") || (display_type == "gallery")) && (play_speed > 0))
   {
      if (current_pic_num > 0)
      {
         if ((current_pic_num+1) <= total_pics)
         {
            document.writeln("<META HTTP-EQUIV=REFRESH CONTENT=\""+play_speed+";URL="+artist_root_name+(current_pic_num+1)+".html\">");
            preload_image=new Image (800, 600);
            if ((display_type == "art") || (display_type == "statement"))
            {
               preload_image.src="images/artists/"+artist_root_name+(current_pic_num+1)+".jpg";
            }
            else
            {
               if (artist_root_name == "anim")
               {
                  preload_image.src="images/gallery/oldloc"+artist_root_name+(current_pic_num+1)+".gif";
               }
               else
               {
                  preload_image.src="images/gallery/oldloc"+artist_root_name+(current_pic_num+1)+".jpg";
               }
            }
         }
         else
         {
            document.writeln("<META HTTP-EQUIV=REFRESH CONTENT=\""+play_speed+";URL="+artist_root_name+"1.html\">");
            if (total_pics > 1)
            {
               preload_image=new Image (800, 600);
               if ((display_type == "art") || (display_type == "statement"))
               {
                  preload_image.src="images/artists/"+artist_root_name+"2.jpg";
               }
               else
               {
                  if (artist_root_name == "anim")
                  {
                     preload_image.src="images/gallery/artists/"+artist_root_name+"2.gif";
                  }
                  else
                  {
                     preload_image.src="images/gallery/artists/"+artist_root_name+"2.jpg";
                  }
               }
            }
         }
      }
   }

   // ===================================================================================================================

   // MAIN CONTAINER TABLE
   document.writeln("<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"3\" >");
      // Row 1;
      document.writeln("<tr>");
         // Column 1;
         document.writeln("<td width=\"1%\"></td>");

         // Column 2;
         document.writeln("<td align=\"center\" valign=\"top\" >");

            // CONTENT TABLE
            document.writeln("<table width=\"400px\" border=\"0\" cellspacing=\"0\" cellpadding=\"3\" align=\"left\">");
               document.writeln("<tr>");
                  // Content Table Row 1, Column 1;
                  document.writeln("<td width=\"40\" align=\"center\" valign=\"top\" rowspan=\"2\">");
                     if (display_type == "gallery")
                     {
                        open_close ("close", depth_str+"gallery.html", "", " this folder");
                     }
                     else
                     {
                        open_close ("close", "../artists.html", "", " this artist");
                     }
                  document.writeln("</td>");

                  // Content Table Row 1, Column 2;
                  document.writeln("<td width=\"*\" valign=\"top\" colspan=\"2\">");
                     document.writeln("<p class=\"Normal_18pt\">"+artist_full_name+"</p>");
                  document.writeln("</td>");
               document.writeln("</tr>");

               document.writeln("<tr>");
                  // Content Table Row 2, Column 1;
                 document.writeln ("<td valign=\"top\" colspan=\"2\" >")

                  // CONTENTS TABLE
                  document.writeln ("<table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\">");

                     // Row 2 (has neither a statement nor a cv);
                     if ((f_statement == 0) && (f_cv == 0))
                     {
                        document.writeln("<tr colspan=\"4\">");
                           // Columns 2 to 4;
                           document.writeln("<td align=\"center\" valign=\"top\" height=\""+(Math.round(80*scale))+"\" rowspan=\"3\"></td>");
                        document.writeln("</tr>");
                     }

                     // Row 2 (has either only a statement or a cv);
                     if (((f_statement == 1) && (f_cv == 0)) || ((f_statement == 0) && (f_cv == 1)))
                     {
                        document.writeln("<tr>");
                           // Column 2;
                           document.writeln("<td align=\"center\" valign=\"top\" rowspan=\"3\" height=\""+(Math.round(40*scale))+"\" >");
                           document.writeln("</td>");

                           // Column 3;
                           if (f_statement == 1)
                           {
                              if ((display_type == "art") || (display_type == "cv"))
                              {
                                 document.writeln("<td valign=\"top\" align=\"right\" height=\""+(Math.round(40*scale))+"\" >");
                                    open_close ("open", artist_root_name+"s.html", "", " statement");
                                 document.writeln("</td>");
                              }
                              if (display_type == "statement")
                              {
                                 document.writeln("<td valign=\"top\" align=\"right\" height=\""+(Math.round(40*scale))+"\">");
                                    open_close ("close", artist_root_name+current_pic_num+".html", "", " statement");
                                 document.writeln("</td>");
                              }
                           }
                           if (f_cv == 1)
                           {
                              if (display_type == "cv")
                              {
                                 document.writeln("<td valign=\"top\" align=\"right\" height=\""+(Math.round(40*scale))+"\">");
                                    open_close ("close", artist_root_name+current_pic_num+".html", "", " cv");
                                 document.writeln("</td>");
                              }
                              else
                              {
                                 document.writeln("<td valign=\"top\" align=\"right\" height=\""+(Math.round(40*scale))+"\">");
                                    open_close ("open", artist_root_name+"cv1.html", "", " cv");
                                 document.writeln("</td>");
                              }
                           }

                           // Column 4;
                           if (f_statement == 1)
                           {
                              document.writeln("<td valign=\"top\" height=\""+(Math.round(40*scale))+"\">");
                                 document.writeln("<p class=\"Artist_Link\">Artist's Statement</p>");
                              document.writeln("</td>");
                           }
                           if (f_cv == 1)
                           {
                              document.writeln("<td valign=\"top\" height=\""+(Math.round(40*scale))+"\">");
                                 document.writeln("<p class=\"Artist_Link\">Curriculum Vit\&aelig;</p>");
                              document.writeln("</td>");
                           }
                        document.writeln("</tr>");
                     }

                     // Rows 2 and 3 (has both a statement and a cv);
                     if ((f_statement == 1) && (f_cv == 1))
                     {
                        document.writeln("<tr>");
                           // Column 2;
                           document.writeln("<td align=\"center\" valign=\"top\" height=\""+(Math.round(40*scale))+"\"></td>");

                           // Column 3;
                           if ((display_type == "art") || (display_type == "cv"))
                           {
                              document.writeln("<td valign=\"top\" align=\"center\" height=\""+(Math.round(40*scale))+"\">");
                                 open_close ("open", artist_root_name+"s.html", "", " statement");
                              document.writeln("</td>");
                           }
                           if (display_type == "statement")
                           {
                              document.writeln("<td valign=\"top\" align=\"center\" height=\""+(Math.round(40*scale))+"\">");
                                 open_close ("close", artist_root_name+current_pic_num+".html", "", " statement");
                              document.writeln("</td>");
                           }

                           // Column 4;
                           document.writeln("<td valign=\"top\" height=\""+(Math.round(40*scale))+"\">");
                              document.writeln("<p class=\"Artist_Link\">&nbsp;Artist's Statement</p>");
                           document.writeln("</td>");
                        document.writeln("</tr>");

                        // Row 3: CV;
                        document.writeln("<tr>");
                           // Column 2;
                           document.writeln("<td align=\"center\" valign=\"top\" rowspan=\"2\" height=\""+(Math.round(20*scale))+"\"></td>");

                           // Column 3;
                           if (display_type == "cv")
                           {
                              document.writeln("<td valign=\"top\" align=\"center\" height=\""+(Math.round(40*scale))+"\" >");
                                 open_close ("close", artist_root_name+current_pic_num+".html", "", " cv");
                              document.writeln("</td>");
                           }
                           else
                           {
                              document.writeln("<td valign=\"top\" align=\"center\" height=\""+(Math.round(40*scale))+"\" >");
                                 open_close ("open", artist_root_name+"cv1.html", "", " cv");
                              document.writeln("</td>");
                           }

                           // Column 4;
                           document.writeln("<td valign=\"top\" height=\""+(Math.round(40*scale))+"\" >");
                              document.writeln("<p class=\"Artist_Link\">&nbsp;Curriculum Vit\&aelig;</p>");
                           document.writeln("</td>");
                        document.writeln("</tr>");
                     }

                     // Row 4;
                     if (display_type == "cv")
                     {
                        document.writeln("<tr>");
                           document.writeln("<td rowspan=\""+cv_all_titles.length+"\"></td><td valign=\"top\">");
                              // START OF CV LINKS TABLE;
                              document.writeln("<table width=\""+(Math.round(290*scale))+"\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">");
                                 document.writeln("<tr><td width=\"2%\"></td><td width=\"98%\"></td></tr>");
                                 for (i=0; i < cv_tot; i++)
                                 {
                                    j=i+1;

                                    if (cv_all_titles[i] == cv_title)
                                    {
                                       document.writeln("<tr><td></td><td><p class=\"Artist_Link2\">"+cv_title+"</p></td></tr><tr><td colspan=\"2\">&nbsp;</td></tr>");
                                    }
                                    else
                                    {
                                       document.writeln("<tr><td></td><td><a class=\"Artist_Link\" href=\""+artist_root_name+"cv"+j+".html\">"+cv_all_titles[i]+"</a></td></tr><tr><td colspan=\"2\">&nbsp;</td></tr>");
                                    }
                                 }
                              document.writeln("</table>");
                              // END OF CV LINKS TABLE;
                           document.writeln("</td>");
                        document.writeln("</tr>");
                     }

                     // Index is Open;
                     if (((display_type == "art") || (display_type == "gallery")) && (current_pic_num == 0))
                     {
                        // Close Index Link;
                        document.writeln("<tr>");
                           if (display_type == "art")
                           {
                              document.writeln("<td colspan=\"2\" valign=\"top\" align=\"center\" height=\""+(Math.round(40*scale))+"\" >");
                              document.writeln("<br /><a class=\"Artist_Link\" href=\""+artist_root_name+"1.html\" alt=\"\" title=\"\">Close Index</a>");
                           }
                           else
                           {
                              document.writeln("<td valign=\"top\" align=\"center\" height=\""+(Math.round(40*scale))+"\" >");
                              document.writeln("<br /><a class=\"Artist_Link\" href=\""+artist_root_name+"1.html\" alt=\"\" title=\"\">Close Index</a>");
                           }
                           document.writeln("</td>");
                        document.writeln("</tr>");
                     }

                     // Index is Not Open;
                     if (((display_type == "art") || (display_type == "gallery")) && (current_pic_num > 0))
                     {
                        document.writeln("<tr>");

                           // Column 3;
                           document.writeln("<td colspan=\"2\" valign=\"top\" height=\""+(Math.round(40*scale))+"\" >");

                              // Display Slide Show Controls;
                              if (current_pic_num > 0)
                              {
                                 document.writeln("<table width=\""+(Math.round(290*scale))+"\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">");
                                    document.writeln("<tr><td colspan=\"11\">&nbsp;</td></tr>");
                                    document.writeln("<tr><td id=\"b_slides\" colspan=\"11\" valign=\"top\" align=\"center\">");
                                       document.writeln("<table cellspacing=\"10\" cellpadding=\"3\"><tr>");
                                          if (total_pics > 1)
                                             {
                                             document.writeln("<td width=\"20%\" align=\"right\" class=\"normal\">Slideshow:</td>");
                                             if (play_speed == 0)
                                             {
                                                document.writeln("<td width=\"40%\" align=\"center\" class=\"bg_on\"                                                                       onmouseover=\"this.style.cursor='default'; Tip('&nbsp;slideshow is currently off&nbsp;', "+tip_settings+"); \" onmouseout=\"this.style.cursor='auto'; UnTip(); \">&nbsp;Off&nbsp;</td>" );
                                                document.writeln("<td width=\"40%\" align=\"center\" class=\"bg_off\" onclick=\"save_slide_speed (5, artist_root_name, current_pic_num);\" onmouseover=\"this.style.cursor='pointer'; Tip('&nbsp;turn on slideshow&nbsp;', "+tip_settings+"); \"  onmouseout=\"this.style.cursor='auto'; UnTip(); \">&nbsp;On&nbsp;</td>" );
                                             }
                                             if (play_speed >= 1)
                                             {
                                                document.writeln("<td width=\"40%\" align=\"center\" class=\"bg_off\" onclick=\"save_slide_speed (0, artist_root_name, current_pic_num);\" onmouseover=\"this.style.cursor='pointer'; Tip('&nbsp;turn off slideshow&nbsp;', "+tip_settings+"); \" onmouseout=\"this.style.cursor='auto'; UnTip(); \">&nbsp;Off&nbsp; </td>");
                                                document.writeln("<td width=\"40%\" align=\"center\" class=\"bg_on\"                                                                       onmouseover=\"this.style.cursor='default'; Tip('&nbsp;slideshow is currently on&nbsp;', "+tip_settings+"); \"  onmouseout=\"this.style.cursor='auto'; UnTip(); \">&nbsp;On&nbsp;</td>" );
                                             }
                                          }
                                       document.writeln("</tr></table>");
                                    document.writeln("</td></tr>");
                                 document.writeln("</table>");
                              }

                              // Start of Display Image Navigation Buttons;
                              document.writeln("<img src=\"../images/dot.gif\" width=\"1\" height=\""+(Math.round(40*scale))+"\" alt=\"\">");
                              document.writeln("<table width=\""+(Math.round(290*scale))+"\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">");
                                 document.writeln("<tr>");
                                    prev_num=current_pic_num-1;
                                    if (prev_num < 1) { prev_num=0; }

                                    next_num=current_pic_num+1;
                                    if (next_num > total_pics) { next_num=total_pics+1; }

                                    var cp=0;   // This is the currently viewed picture in the set;
                                    for (i=1; i <= total_pics; i+=4) { if (current_pic_num == i) cp=1; }
                                    for (i=2; i <= total_pics; i+=4) { if (current_pic_num == i) cp=2; }
                                    for (i=3; i <= total_pics; i+=4) { if (current_pic_num == i) cp=3; }
                                    for (i=4; i <= total_pics; i+=4) { if (current_pic_num == i) cp=4; }

                                    // These are the picture numbers (1 to total_pics) for each cp column;
                                    if (cp == 1)
                                    {
                                       cp1=current_pic_num;
                                       cp2=current_pic_num+1;
                                       cp3=current_pic_num+2;
                                       cp4=current_pic_num+3;
                                    }
                                    if (cp == 2)
                                    {
                                       cp1=current_pic_num-1;
                                       cp2=current_pic_num;
                                       cp3=current_pic_num+1;
                                       cp4=current_pic_num+2;
                                    }
                                    if (cp == 3)
                                    {
                                       cp1=current_pic_num-2;
                                       cp2=current_pic_num-1;
                                       cp3=current_pic_num;
                                       cp4=current_pic_num+1;
                                    }
                                    if (cp == 4)
                                    {
                                       cp1=current_pic_num-3;
                                       cp2=current_pic_num-2;
                                       cp3=current_pic_num-1;
                                       cp4=current_pic_num;
                                    }
                                    if (cp2 > total_pics) cp2=0;
                                    if (cp3 > total_pics) cp3=0;
                                    if (cp4 > total_pics) cp4=0;

                                    // Previous button;
                                    if (prev_num == 0)
                                    {
                                       document.writeln("<td width=\"10%\" align=\"left\" valign=\"top\"><span class=\"Nav_Link1\" onmouseover=\"this.style.cursor='default';\">&nbsp;&nbsp;&nbsp;&nbsp;</a></td>");
                                    }
                                    else
                                    {
                                       document.writeln("<td width=\"10%\" align=\"left\" valign=\"top\"><a class=\"Nav_Link1\" href=\""+artist_root_name+prev_num+".html\" onclick=\"save_slide_speed (0, artist_root_name, current_pic_num);\" onmouseover=\"this.style.cursor='pointer'; Tip('&nbsp;previous image&nbsp;', "+tip_settings+"); \" onmouseout=\"this.style.cursor='auto'; UnTip(); \">&nbsp;<&nbsp;</a></td>")
                                    }

                                    // Start of the navigation buttons for pictures;
                                    // Note that cp is the current picture in the set of 4 (not the current picture number);
                                    // The cp column is highlighted (using "bg_on") and has no link;
                                    if (cp == 1)
                                    {
                                       document.writeln("<td width=\"20%\" align=\"center\"><span class=\"bg_on\" onmouseover=\"this.style.cursor='default';\">&nbsp;"+cp1+"&nbsp;</span></td>");
                                    }
                                    else
                                    {
                                       document.writeln("<td width=\"20%\" align=\"center\"><a class=\"bg_off\" href=\""+artist_root_name+cp1+".html\" onclick=\"save_slide_speed (0, artist_root_name, current_pic_num);\" onmouseover=\"Tip('&nbsp;image "+cp1+" of "+total_pics+"&nbsp;', "+tip_settings+");\" onmouseout=\"UnTip();\">&nbsp;"+cp1+"&nbsp;</a></td>");
                                    }

                                    if (cp == 2)
                                    {
                                       document.writeln("<td width=\"20%\" align=\"center\"><span class=\"bg_on\" onmouseover=\"this.style.cursor='default';\">&nbsp;"+cp2+"&nbsp;</span></td>");
                                    }
                                    else
                                    {
                                       if (cp2 == 0)
                                       {
                                          document.writeln("<td width=\"20%\" align=\"center\"><span class=\"bg_off\">&nbsp;</span></td>");
                                       }
                                       else
                                       {
                                          document.writeln("<td width=\"20%\" align=\"center\"><a class=\"bg_off\" href=\""+artist_root_name+cp2+".html\" onclick=\"save_slide_speed (0, artist_root_name, current_pic_num);\" onmouseover=\"Tip('&nbsp;image "+cp2+" of "+total_pics+"&nbsp;', "+tip_settings+");\" onmouseout=\"UnTip();\">&nbsp;"+cp2+"&nbsp;</a></td>");
                                       }
                                    }

                                    if (cp == 3)
                                    {
                                       document.writeln("<td width=\"20%\" align=\"center\"><span class=\"bg_on\" onmouseover=\"this.style.cursor='default';\">&nbsp;"+cp3+"&nbsp;</span></td>");
                                    }
                                    else
                                    {
                                       if (cp3 == 0)
                                       {
                                          document.writeln("<td width=\"20%\" align=\"center\"><span class=\"bg_off\">&nbsp;</span></td>");
                                       }
                                       else
                                       {
                                          document.writeln("<td width=\"20%\" align=\"center\"><a class=\"bg_off\" href=\""+artist_root_name+cp3+".html\" onclick=\"save_slide_speed (0, artist_root_name, current_pic_num);\" onmouseover=\"Tip('&nbsp;image "+cp3+" of "+total_pics+"&nbsp;', "+tip_settings+");\" onmouseout=\"UnTip();\">&nbsp;"+cp3+"&nbsp;</a></td>");
                                       }
                                    }

                                    if (cp == 4)
                                    {
                                       document.writeln("<td width=\"20%\" align=\"center\"><span class=\"bg_on\" onmouseover=\"this.style.cursor='default';\">&nbsp;"+cp4+"&nbsp;</span></td>");
                                    }
                                    else
                                    {
                                       if (cp4 == 0)
                                       {
                                          document.writeln("<td width=\"20%\" align=\"center\"><span class=\"bg_off\">&nbsp;</span></td>");
                                       }
                                       else
                                       {
                                          document.writeln("<td width=\"20%\" align=\"center\"><a class=\"bg_off\" href=\""+artist_root_name+cp4+".html\" onclick=\"save_slide_speed (0, artist_root_name, current_pic_num);\" onmouseover=\"Tip('&nbsp;image "+cp4+" of "+total_pics+"&nbsp;', "+tip_settings+");\" onmouseout=\"UnTip();\">&nbsp;"+cp4+"&nbsp;</a></td>");
                                       }
                                    }
                                    // End of the navigation buttons for pictures;

                                    // Next buttons;
                                    if (next_num == total_pics+1)
                                    {
                                       document.writeln("<td width=\"10%\" align=\"left\" valign=\"top\"><span class=\"Nav_Link1\" onmouseover=\"this.style.cursor='default';\">&nbsp;&nbsp;&nbsp;&nbsp;</a></td>");
                                    }
                                    else
                                    {
                                       document.writeln("<td width=\"10%\" align=\"right\"><a class=\"Nav_Link1\" href=\""+artist_root_name+next_num+".html\" onclick=\"save_slide_speed (0, artist_root_name, current_pic_num);\" onmouseover=\"this.style.cursor='pointer'; Tip('&nbsp;next image&nbsp;', "+tip_settings+"); \" onmouseout=\"this.style.cursor='auto'; UnTip(); \">&nbsp;>&nbsp;</a></td>")
                                    }
                                 document.writeln("</tr>");
                                 // End of Display Image Navigation Buttons;

                                 // Display Index Link;
                                 if ((current_pic_num > 0) && (total_pics > 1))
                                 {
                                    document.writeln("<tr><td colspan=\"11\" valign=\"top\" align=\"center\" onclick=\"set_cookie ('rem_slides', 0);\"><br/><a class=\"Artist_Link\" href=\""+artist_root_name+"0.html\" height=\""+(Math.round(40*scale))+"\" onclick=\"save_slide_speed (0, artist_root_name, current_pic_num);\">Open Index</a></td></tr>");
                                 }

                                 if (art_title != "")
                                 {
                                    document.writeln("<tr>");
                                       document.writeln("<td colspan=\"11\" align=\"center\" valign=\"top\">");
                                          document.writeln("<br><p class=\"Normal_12pt_b\">"+art_title+"</p>");
                                       document.writeln("</td>");
                                    document.writeln("</tr>");
                                    document.writeln("<tr><td colspan=\"11\">&nbsp;</td></tr>");
                                 }
                                 else
                                 {
                                    document.writeln("<tr>");
                                       document.writeln("<td colspan=\"11\" align=\"center\" valign=\"top\">");
                                          document.writeln("<br><p class=\"Normal_12pt\">exhibition image #"+current_pic_num+"</p>");
                                       document.writeln("</td>");
                                    document.writeln("</tr>");
                                    document.writeln("<tr><td colspan=\"11\">&nbsp;</td></tr>");
                                 }

                                 if ((art_size_width != 0) && (art_size_height != 0))
                                 {
                                    document.writeln("<tr>");
                                       document.writeln("<td colspan=\"11\" align=\"center\" valign=\"top\">");
                                          var h_frac="";
                                          var w_frac="";
                                          var d_frac="";

                                          var h_root=Math.round(art_size_height-.5);
                                          var w_root=Math.round(art_size_width-.5);
                                          var d_root=Math.round(art_size_depth-.5);

                                          if ((art_size_height-(Math.round(art_size_height))-.5) == -.375) {h_frac="&#8539;";}   // 1/8;
                                          if ((art_size_height-(Math.round(art_size_height))-.5) == -.25)  {h_frac="&frac14;";}  // 1/4;
                                          if ((art_size_height-(Math.round(art_size_height))-.5) == -.125) {h_frac="&#8540;";}   // 3/8;
                                          if ((art_size_height-(Math.round(art_size_height))-.5) == -1)    {h_frac="&frac12;";}  // 1/2;
                                          if ((art_size_height-(Math.round(art_size_height))-.5) == -.875) {h_frac="&#8541;";}   // 5/8;
                                          if ((art_size_height-(Math.round(art_size_height))-.5) == -.75)  {h_frac="&frac34;";}  // 3/4;
                                          if ((art_size_height-(Math.round(art_size_height))-.5) == -.625) {h_frac="&#8542;";}   // 7/8;

                                          if ((art_size_width-(Math.round(art_size_width))-.5) == -.375) {w_frac="&#8539;";}   // 1/8;
                                          if ((art_size_width-(Math.round(art_size_width))-.5) == -.25)  {w_frac="&frac14;";}  // 1/4;
                                          if ((art_size_width-(Math.round(art_size_width))-.5) == -.125) {w_frac="&#8540;";}   // 3/8;
                                          if ((art_size_width-(Math.round(art_size_width))-.5) == -1)    {w_frac="&frac12;";}  // 1/2;
                                          if ((art_size_width-(Math.round(art_size_width))-.5) == -.875) {w_frac="&#8541;";}   // 5/8;
                                          if ((art_size_width-(Math.round(art_size_width))-.5) == -.75)  {w_frac="&frac34;";}  // 3/4;
                                          if ((art_size_width-(Math.round(art_size_width))-.5) == -.625) {w_frac="&#8542;";}   // 7/8;

                                          if ((art_size_depth-(Math.round(art_size_depth))-.5) == -.375) {d_frac="&#8539;";}   // 1/8;
                                          if ((art_size_depth-(Math.round(art_size_depth))-.5) == -.25)  {d_frac="&frac14;";}  // 1/4;
                                          if ((art_size_depth-(Math.round(art_size_depth))-.5) == -.125) {d_frac="&#8540;";}   // 3/8;
                                          if ((art_size_depth-(Math.round(art_size_depth))-.5) == -1)    {d_frac="&frac12;";}  // 1/2;
                                          if ((art_size_depth-(Math.round(art_size_depth))-.5) == -.875) {d_frac="&#8541;";}   // 5/8;
                                          if ((art_size_depth-(Math.round(art_size_depth))-.5) == -.75)  {d_frac="&frac34;";}  // 3/4;
                                          if ((art_size_depth-(Math.round(art_size_depth))-.5) == -.625) {d_frac="&#8542;";}   // 7/8;

                                          if (art_size_depth > 1)
                                          {
                                             document.writeln("<p class=\"Normal_12pt\">"+h_root+h_frac+"\" x "+w_root+w_frac+"\" x "+d_root+d_frac+"\" [h w d]</p>");
                                          }
                                          else
                                          {
                                             document.writeln("<p class=\"Normal_12pt\">"+h_root+h_frac+"\" x "+w_root+w_frac+"\" [h w]</p>");
                                          }
                                       document.writeln("</td>");
                                    document.writeln("</tr>");
                                    document.writeln("<tr><td colspan=\"11\">&nbsp;</td></tr>");
                                 }

                                 if (art_media != "")
                                 {
                                    document.writeln("<tr>");
                                       document.writeln("<td colspan=\"11\" align=\"center\" valign=\"top\">");
                                          document.writeln("<p class=\"Normal_12pt\">"+art_media+"</p>");
                                       document.writeln("</td>");
                                    document.writeln("</tr>");
                                    document.writeln("<tr><td colspan=\"11\">&nbsp;</td></tr>");
                                 }

                                 if (art_year != 0)
                                 {
                                    document.writeln("<tr>");
                                       document.writeln("<td colspan=\"11\" align=\"center\" valign=\"top\">");
                                          document.writeln("<p class=\"Normal_12pt\">"+art_year+"</p>");
                                       document.writeln("</td>");
                                    document.writeln("</tr>");
                                    document.writeln("<tr><td colspan=\"11\">&nbsp;</td></tr>");
                                 }

                                 if (art_other != "")
                                 {
                                    document.writeln("<tr>");
                                       if (display_type == "gallery")
                                       {
                                          document.writeln("<td colspan=\"11\" align=\"left\" valign=\"top\">");
                                             document.writeln("<p class=\"Normal_10pt\">"+art_other+"</p>");
                                          document.writeln("</td>");
                                       }
                                       else
                                       {
                                          document.writeln("<td colspan=\"11\" align=\"center\" valign=\"top\">");
                                             document.writeln("<p class=\"Normal_12pt\">"+art_other+"</p>");
                                          document.writeln("</td>");
                                       }
                                    document.writeln("</tr>");
                                    document.writeln("<tr><td colspan=\"11\">&nbsp;</td></tr>");
                                 }

//                               if (art_price != 0)
//                               {
//                                  document.writeln("<tr>");
//                                     document.writeln("<td colspan=\"11\" align=\"center\" valign=\"top\">");
//                                        document.writeln("<p class=\"Normal_12pt\"><b>$"+art_price+"</b></p>");
//                                     document.writeln("</td>");
//                                  document.writeln("</tr>");
//                                  document.writeln("<tr><td colspan=\"11\">&nbsp;</td></tr>");
//                               }

                                 if (art_status != 0)
                                 {
                                    document.writeln("<tr>");
                                       document.writeln("<td colspan=\"11\" align=\"center\" valign=\"top\">");
                                          if (art_status == 1) {document.writeln("<p class=\"Normal_12pt\">Status: Not For Sale</p>");}
                                          if (art_status == 2) {document.writeln("<p class=\"Normal_12pt\">Status: Available</p>");}
                                          if (art_status == 3) {document.writeln("<p class=\"Normal_12pt\">Status: Sold</p>");}
                                          if (art_status == 4) {document.writeln("<p class=\"Normal_12pt\">Status: Sale Pending</p>");}
                                          if (art_status == 9) {document.writeln("<p class=\"Normal_12pt\">Status: Other</p>");}
                                       document.writeln("</td>");
                                    document.writeln("</tr>");
                                    document.writeln("<tr><td colspan=\"11\">&nbsp;</td></tr>");
                                 }

                                 if (art_location != 0)
                                 {
                                    document.writeln("<tr>");
                                       document.writeln("<td colspan=\"11\" align=\"center\" valign=\"top\">");
                                          if (art_location == 1) {document.writeln("<p class=\"Normal_12pt\">Location: Not Available</p>");}
                                          if (art_location == 2) {document.writeln("<p class=\"Normal_12pt\">Location: REM Gallery Exhibit</p>");}
                                          if (art_location == 3) {document.writeln("<p class=\"Normal_12pt\">Location: REM Gallery Exhibit (Loft)</p>");}
                                          if (art_location == 4) {document.writeln("<p class=\"Normal_12pt\">Location: REM Gallery Art Storage</p>");}
                                          if (art_location == 5) {document.writeln("<p class=\"Normal_12pt\">Location: Artist's Studio</p>");}
                                          if (art_location == 6) {document.writeln("<p class=\"Normal_12pt\">Location: On Loan</p>");}
                                          if (art_location == 9) {document.writeln("<p class=\"Normal_12pt\">Location: Other</p>");}
                                       document.writeln("</td>");
                                    document.writeln("</tr>");
                                    document.writeln("<tr><td colspan=\"11\">&nbsp;</td></tr>");
                                 }
                              document.writeln("</table>");
                           document.writeln("</td>");
                        document.writeln("</tr>");

                        document.writeln("<tr>");
                           document.writeln("<td align=\"center\">");
                              if (shop != 0)
                              {
                                 document.writeln("<tr>");
                                    document.writeln("<td colspan=\"11\" align=\"center\" valign=\"top\">");
                                       if (shop == 1)
                                       {
                                          document.writeln("<p class=\"Normal_12pt\">This piece is available for purchase in REM's on-line <a class=\"Artist_Link\" href=\"../shop/"+artist_root_name+current_pic_num+".html\" alt=\"\" title=\"\">shop</a>.</p>");
                                       }
                                       if (shop == 2)
                                       {
                                          document.writeln("<p class=\"Normal_12pt\">"+artist_full_name+" has pieces available for purchase in REM's on-line <a class=\"Artist_Link\" href=\"../shop/"+artist_root_name+"0.html\" alt=\"\" title=\"\">shop</a>.</p>");
                                       }
                                    document.writeln("</td>");
                                 document.writeln("</tr>");
                                 document.writeln("<tr><td colspan=\"11\">&nbsp;</td></tr>");
                              }
                           document.writeln("</td>");
                        document.writeln("</tr>");
                     }

                     // Row 4;
                     if (display_type == "statement")
                     {
                        document.writeln("<tr>");
                           document.writeln("<td colspan=\"2\">");
                           document.writeln("</td>");
                        document.writeln("</tr>");
                     }
                           document.writeln("</td>");
                        document.writeln("</tr>");
                     document.writeln("</table>");
                  document.writeln("</td>");
               document.writeln("</tr>");
            document.writeln("</table>");
            // END OF CONTENTS TABLE
         document.writeln("</td>");

         document.writeln("<td valign=\"top\">");
            document.writeln("<table border=\"0\" cellspacing=\"0\" cellpadding=\"3\" align=\"center\">");
               document.writeln("<tr>");

               // Column 1;
               if ((display_type == "art") || (display_type == "gallery"))
               {
                  // Start of Index;
                  if (current_pic_num == 0)
                  {
                     document.writeln("<td width=\""+(Math.round(800*scale))+"\" align=\"center\" valign=\"top\">");

                        // INDEX TABLE
                        document.writeln("<table width=\"100%\" border=\"1\" cellspacing=\"5\" cellpadding=\"5\">");
                           document.writeln("<tr>");
                              var index_column=1;

                              for (i=1; i <= total_pics; i++)
                              {
                                 document.writeln("<td align=\"center\">");
                                    document.writeln("<a href=\""+artist_root_name+i+".html\">");
                                       if (display_type == "art")
                                       {
                                          document.writeln("<img src=\"../mobi/images/artists/"+artist_root_name+i+".jpg\" alt=\""+all_titles[i-1]+"\" onmouseover=\"Tip('&nbsp;"+all_titles[i-1]+"&nbsp;', "+tip_settings+");\" onmouseout=\"UnTip();\" >");
                                       }
                                       else
                                       {
                                          document.writeln("<img src=\""+depth_str+"mobi/images/gallery/"+artist_root_name+i+".jpg\" alt=\""+all_titles[i-1]+"\" onmouseover=\"Tip('&nbsp;"+all_titles[i-1]+"&nbsp;', "+tip_settings+");\" onmouseout=\"UnTip();\" >");
                                       }
                                    document.writeln("</a>");
                                    document.writeln("<p class=\"Bottom_Link\">"+i+"</p>");
                                 document.writeln("</td>");

                                 index_column+=1;

                                 if ((index_column > 4) & (i < total_pics))
                                 {
                                    index_column=1;
                                    document.writeln("</tr><tr>");
                                 }
                              }
                           document.writeln("</tr>");
                        document.writeln("</table>");
                        // END OF INDEX TABLE

                     document.writeln("</td>");
                  }
                  // End of Index;

                  // Start of Display Current Image;
                  if (current_pic_num > 0)
                  {
                     document.writeln("<td width=\""+(Math.round(800*scale))+"\"  height=\""+(Math.round(600*scale))+"\" align=\"center\" valign=\"top\">");
                        if (display_type == "art")
                        {
                           if (anim_flag == 1)
                           {
                              document.writeln("<img src=\"../images/artists/yanas_anim.gif\" width=\""+(Math.round(800*scale))+"\" height=\""+(Math.round(600*scale))+"\" alt=\"\">");
                           }
                           else
                           {
                              document.writeln("<img src=\"../images/artists/"+artist_root_name+current_pic_num+".jpg\" alt=\"\">");
                           }
                        }
                        else
                        {
                           if (artist_root_name == "anim")
                           {
                              document.writeln("<img src=\"../images/gallery/artists/"+artist_root_name+current_pic_num+".gif\" width=\"800\" height=\"600\" alt=\"\">");
                           }
                           else
                           {
                              document.writeln("<img src=\""+depth_str+"images/gallery/"+artist_root_name+current_pic_num+".jpg\" alt=\"\">");
                           }
                        }
                     document.writeln("</td>");
                  }
                  // End of Display Current Image;
               }

               if (display_type == "statement")
               {
                  document.writeln("<td width=\""+(Math.round(800*scale))+"\" valign=\"top\">");
                     if (artist_statement_title != "")
                     {
                        document.writeln("<p class=\"Normal_14pt_b\">"+artist_statement_title+"</p>");
                     }
                     if (artist_statement_quote != "")
                     {
                        document.writeln("<p class=\"Normal_14pt_quote\">\""+artist_statement_quote+"\"</p><br>");
                     }
                     if (artist_statement_part1 != "")
                     {
                        document.writeln("<p class=\"Normal_14pt\">"+artist_statement_part1+"</p>");
                     }
                     if (artist_statement_part2 != "")
                     {
                        document.writeln("<p class=\"Normal_14pt\">"+artist_statement_part2+"</p>");
                     }
                     if (artist_statement_part3 != "")
                     {
                        document.writeln("<p class=\"Normal_14pt\">"+artist_statement_part3+"</p>");
                     }
                     if (artist_statement_part4 != "")
                     {
                        document.writeln("<p class=\"Normal_14pt\">"+artist_statement_part4+"</p>");
                     }
                  document.writeln("</td>");
               }

               if (display_type == "cv")
               {
                  document.writeln("<td width=\""+(Math.round(800*scale))+"\" valign=\"top\">");
                     // START OF CV CONTENT TABLE;
                     document.writeln("<table width=\"100%\" border=\"0\" cellspacing=\"1\" cellpadding=\"1\">");
                        document.writeln("<tr><td width=\"15%\" valign=\"top\"></td><td width=\"85%\" valign=\"top\"></td></tr>");

                        // CV Titles;
                        document.writeln("<tr><td colspan=\"2\" class=\"Normal_16pt\" valign=\"top\">"+cv_title+"</td></tr>");

                        document.writeln("<tr><td colspan=\"2\" valign=\"top\">&nbsp;</td></tr>");

                        // CV Content;
                        for (i=1; i <= cv_items; i++)
                        {
                           j=(i/2)-(Math.round(i/2));    // j equals 0 for even rows and .5 for odd rows (for alternating colors);

                           if (j == 0)
                           {
                              document.writeln("<tr><td class=\"Normal_12pt_even\" valign=\"top\">"+cv[i][0]+"</td>");
                              document.writeln("    <td class=\"Normal_12pt_even\" valign=\"top\">"+cv[i][1]+"</td></tr>");
                           }
                           else
                           {
                              document.writeln("<tr><td class=\"Normal_12pt_odd\" valign=\"top\">"+cv[i][0]+"</td>");
                              document.writeln("    <td class=\"Normal_12pt_odd\" valign=\"top\">"+cv[i][1]+"</td></tr>");
                           }
                        }
                     document.writeln("</td></tr></table>");
                  document.writeln("</td>");
               }
            document.writeln("</tr>");
         document.writeln("</table>");
      document.writeln("</td>");
      document.writeln("</tr>");
   document.writeln("</table>");

   document.writeln("<br>");
}


