///////////////////////////////////////////////////////////////////////////////
//
//  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();
    //this.resourceArray[this.resourceArray.length]= folder + "/logo_name.png";
    //this.resourceArray[this.resourceArray.length]= folder + "/SilverlightBackgroundLight.jpg";

    for (var i=0; i<this.numPages; i++){
        this.resourceArray[this.resourceArray.length] = _imagefolder + "/page" + getTwoDigitInt(i) + ".jpg";
    }
    //this.resourceArray[this.resourceArray.length]= folder + "/logo.png";
}

PageGenerator.prototype.getPageString = function(pageNumber, isThumbnail)
{
  var retStr = "";
  if (pageNumber < 0 || pageNumber >= _pagenum)
  {
    return retStr;
  }
  retStr =  "<Canvas>";
  if (pageNumber == 0)
  { 

    retStr += "  <Image Height='" + _height + "' Width='" + _width + "' Source='"+_imagefolder+"/page"+getTwoDigitInt(pageNumber)+".jpg'/>";
    retStr += "  <Ellipse Height='120' Width='120' Canvas.Top='" + (_height - 130) + "' Canvas.Left='" + (_width - 137) + "' Stretch='Fill'>";
    retStr += "    <Ellipse.Fill>";
    retStr += "      <RadialGradientBrush >";
    retStr += "        <GradientStop Color='#FFFFFFFF' Offset='0'/>";
    retStr += "        <GradientStop Color='#FFFFFFFF' Offset='0.4'/>";
    retStr += "        <GradientStop Color='#00FFFFFF' Offset='1'/>";
    retStr += "      </RadialGradientBrush>";
    retStr += "    </Ellipse.Fill>";
    retStr += "  </Ellipse>";
 
  //  retStr += "  <Image Height='80' Canvas.Top='" + (_height - 110) + "' Canvas.Left='" + (_width - 110) + "' Source='assets/logo.png' Stretch='Fill'/>";
  }
  else
  { 
    retStr += "  <Image Height='" + _height + "' Width='" + _width + "' Source='"+_imagefolder+"/page"+getTwoDigitInt(pageNumber)+".jpg'/>";
  }
  
  if ((pageNumber % 2) == 1) {
      retStr += "  <Path Data='M " + _width + "," + _height + " h -" + _width + " v -" + _height + " h " + _width + "' Stroke='White' StrokeThickness='15'/>";
  } else {
      retStr += "  <Path Data='M 0,0 h " + _width + " v " + _height + " h -" + _width + "' Stroke='White' StrokeThickness='15'/>";
  }

  retStr += "</Canvas>";
  return retStr;
}