﻿///////////////////////////////////////////////////////////////////////////////
//
//  pageGenerator.js
//
// 
// © 2007 Microsoft Corporation. All Rights Reserved.
//
// This file is licensed as part of the Silverlight 1.0 SDK, for details look here: http://go.microsoft.com/fwlink/?LinkID=89144&clcid=0x409
//
///////////////////////////////////////////////////////////////////////////////

// Controls the content for each page and the set of resources required by them
PageGenerator = function(numPages) {
    this.numPages = numPages;
    this.resourceArray = new Array();
    for (var i=5; i<=this.numPages; i++){
        this.resourceArray[this.resourceArray.length] = "assets/BCG08_Page_" + getTwoDigitInt(i) + ".jpg";
    }
}

PageGenerator.prototype.getPageString = function(pageNumber, isThumbnail)
{
  var retStr = "";
  if (pageNumber < 0)
  {
    return retStr;
  }
  retStr =  "<Canvas>";
  if (pageNumber == 0)
  {
    retStr += "  <Rectangle Height='570' Width='420' Stretch='Fill'>";
    retStr += "    <Rectangle.Fill>";
    retStr += "      <LinearGradientBrush StartPoint='0,1' EndPoint='1,0'>";
    retStr += "        <GradientStop Color='#FF888888' Offset='0'/>";
    retStr += "        <GradientStop Color='#FFFFFFFF' Offset='1'/>";
    retStr += "      </LinearGradientBrush>";
    retStr += "    </Rectangle.Fill>";
    retStr += "  </Rectangle>";
    retStr += "  <Image Height='570' Width='420' Source='assets/BCG08_Page_Cover.jpg' Stretch='Fill'/>";
	retStr += "</Canvas>";
    return retStr;
  }

  else if (pageNumber >0)
  { 
    retStr += "  <Image Height='570' Width='420' Source='assets/BCG08_Page_"+getTwoDigitInt(pageNumber)+".jpg'/>";
  }
  
  if ((pageNumber % 2) == 1) {
      retStr += "  <Path Data='M 420,570 h -420 v -570 h 420' Stroke='White' StrokeThickness='5'/>";
  } else {
      retStr += "  <Path Data='M 0,0 h 420 v 570 h -420' Stroke='White' StrokeThickness='5'/>";
  }

  retStr += "</Canvas>";
  return retStr;
}