////Copyright Scott L. Thomas All Rights Reserved 2000, 2001, 2002, 2003

function PSReport(){

var entDate = " ";
var txtEvent = " ";
var callDate = " ";
var pheNbr = " ";
var dtlLine = " ";
var clcDays = 0;
var newMth = 0;
var newDay = 0;


// Load All PS Events & Days
var aryEvents = new Array;
aryEvents[0] = "Mickey's Backyard BBQ DS";
aryEvents[1] = "Hoop-Dee-Doo Musical Revue DS";
aryEvents[2] = "Spirit of Aloha Polynesian Luau DS";
aryEvents[3] = "Cirque de Soleil";
aryEvents[4] = "House of Blues";
aryEvents[5] = "Fulton's Crab House";
aryEvents[6] = "Portobello Yacht Club";
aryEvents[7] = "Wolfgang Puck Cafe D Only";
aryEvents[8] = "Breakfastosaurus CB";
aryEvents[9] = "Chef Mickey's CB & CM";
aryEvents[10] = "Cinderella's Gala Feast CD";
aryEvents[11] = "Cinderella's Royal Table CB";
aryEvents[12] = "Crystal Palace CB";
aryEvents[13] = "Garden Grill Character Meal";
aryEvents[14] = "Goofy's Beach Club CB";
aryEvents[15] = "Grand Adventures in Cooking";
aryEvents[16] = "";
aryEvents[17] = "Ice Cream Social @ Garden Grill";
aryEvents[18] = "Liberty Tree Tavern CM";
aryEvents[19] = "O'Hana's CB";
aryEvents[20] = "Pirate Treasure Hunt Cruise";
aryEvents[21] = "Princess Storybook CB - Norway";
aryEvents[22] = "Wonderland Tea Party";
aryEvents[23] = "1900 Park Fare CM";
aryEvents[24] = "EPCOT Speciality Cruise";
aryEvents[25] = "Fishing Excursion";
aryEvents[26] = "Golf Cart Rental/365";
aryEvents[27] = "Golf Tee Times - WDW Guests Only/60";
aryEvents[28] = "Golf Tee Times - Off-Site Guests/60";
aryEvents[29] = "Horse-drawn Carriage Ride";
aryEvents[30] = "Horse Trail Ride";
aryEvents[31] = "Parasailing";
aryEvents[32] = "Water Skiing";
aryEvents[33] = "Cinderella's Royal Table L,D";
aryEvents[34] = "Liberty Tree Tavern L Only";
aryEvents[35] = "Plaza Restaurant";
aryEvents[36] = "Tony's Town Square";
aryEvents[37] = "Coral Reef - The Living Seas";
aryEvents[38] = "Biergarten - Germany";
aryEvents[39] = "Bistro de Paris - France";
aryEvents[40] = "Chef's de France - France";
aryEvents[41] = "L'Originale Alfredo di Roma - Italy";
aryEvents[42] = "Le Cellier Steakhouse";
aryEvents[43] = "Nine Dragons - China";
aryEvents[44] = "Restaurant Akershus - Norway";
aryEvents[45] = "Restaurant Marrakesh - Morocco";
aryEvents[46] = "Rose & Crown - United Kingdom";
aryEvents[47] = "San Angel Inn - Mexico";
aryEvents[48] = "Teppan Edo / Tokyo Dining - Japan0";
aryEvents[49] = "50's Prime Time Cafe";
aryEvents[50] = "Fantasmic! DP @ Hollywood & Vine";
aryEvents[51] = "Fantasmic! DP @ Mama Melrose's";
aryEvents[52] = "Fantasmic! DP @ The Brown Derby";
aryEvents[53] = "Hollywood & Vine";
aryEvents[54] = "Mama Melrose's Ristorante Italiano";
aryEvents[55] = "Sci-Fi Dine-In Theater";
aryEvents[56] = "The Brown Derby";
aryEvents[57] = "Rainforest Cafe @ AK";
aryEvents[58] = "Artist Point - Wilderness Lodge L,D";
aryEvents[59] = "Boatwright's - French Quarter - Riverside";
aryEvents[60] = "Boma - Animal Kingdom Lodge";
aryEvents[61] = "California Grill - Contemporary";
aryEvents[62] = "Cape May Cafe - Beach Club L,D";
aryEvents[63] = "Citrico's - Grand Floridian";
aryEvents[64] = "Citrico's Chef's Domain - GF";
aryEvents[65] = "";
aryEvents[66] = "Kona Cafe - Polynesian Resort";
aryEvents[67] = "Flying Fish - Boardwalk Resort";
aryEvents[68] = "Garden View Lounge Afternoon Tea";
aryEvents[69] = "Grand Floridian Cafe";
aryEvents[70] = "";
aryEvents[71] = "Jiko - Animal Kingdom Lodge";
aryEvents[72] = "Kona Cafe - Polynesian Resort";
aryEvents[73] = "Maya Grill - Coronado Springs";
aryEvents[74] = "Narcoossee's - Grand Floridian";
aryEvents[75] = "'Ohana - Polynesian Resort";
aryEvents[76] = "Olivia's - Old Key West";
aryEvents[77] = "";
aryEvents[78] = "";
aryEvents[79] = "Spoodles - Boardwalk Resort";
aryEvents[80] = "Shutters - Caribbean Beach Resort";
aryEvents[81] = "Victoria & Albert's Chef's Table";
aryEvents[82] = "Victoria & Albert's - Grand Floridian";
aryEvents[83] = "The Wave - Contemporary Resort";
aryEvents[84] = "Whispering Canyon Cafe - WL";
aryEvents[85] = "Yacht Club Galley (B,L) - Yacht Club";
aryEvents[86] = "Yachtsman Steakhouse - Yacht Club";

// Open Window and Display Report
PopOne=open('','newWin','toolbar=yes,location=no,status=no,resizable=yes,scrollbars=yes');
PopOne.document.writeln("<html><head><title>PS Calculator Custom Report</title>");
PopOne.document.writeln("<script>");
PopOne.document.writeln("self.moveTo(0,0)");
PopOne.document.writeln("self.resizeTo(700,500)");
PopOne.document.writeln("</script>");
PopOne.document.writeln("</head>");
PopOne.document.writeln("<body bgcolor='#FFFFFF' text='#000080' onblur='self.close()'>");
PopOne.document.writeln("<br><center><FONT size='5' COLOR='#FF0000'>Priority Seating Planning Report</FONT></center><br>")
PopOne.document.writeln("<pre>")
PopOne.document.writeln("     Selected Event/Restaurant       PS Date    Time   Call Date  Confirmation Nbr")
PopOne.document.writeln("----------------------------------- ---------- ------ ----------- ----------------");


for(i=0;i<document.forms[0].event.length;i++){

   if(document.forms[0].event[i].checked==true){

      var event_split = aryEvents[i].split("/");

      clcDays = event_split[1];


////This section fixes up the date
        var t = new Date();
        var year = parseInt(document.forms[0].aYear[i].value);
        if (isNaN(year)) {
                year = t.getFullYear();
        }
        var month = parseInt(document.forms[0].aMth[i].value);
        if (isNaN(month)) {
                month = t.getMonth();
        } else {
                month--;
        }
        var day = parseInt(document.forms[0].aDay[i].value);
        if (isNaN(day)) {
                day = t.getDate();
        }

      var clcDate = new Date(year, month, day);
      var msTime = clcDate.getTime();
      var msecs = 24 * 60 * 60 * 1000;

// WDW counts day of event as 1
//    clcDate.setTime(msTime - ((clcDays - 1) * msecs));
      clcDate.setTime(msTime - (clcDays * msecs));

      newMth = clcDate.getUTCMonth() + 1;
      newDay = clcDate.getUTCDate();

                if (newMth < 10) {
                   newMth = "0" + newMth;
                }

                if (newDay < 10) {
                   newDay = "0" + newDay;
                }

      txtEvent = FmtEvent(event_split[0]);

      month = month + 1  
                if (month < 10) {
                   month = "0" + month;
                }

                if (day < 10) {
                   day = "0" + day;
                }

      entDate = month + "/" + day + "/" + year;
      callDate = newMth + "/" + newDay + "/" + clcDate.getUTCFullYear();

      dtlLine = txtEvent + " " + entDate + " ______  "+  callDate + " " + "________________ <br>";
      PopOne.document.writeln(dtlLine);
   }
}

PopOne.document.writeln(" ");
PopOne.document.writeln("------------------------------------------------------------------------------------");
PopOne.document.writeln("LEGEND: B-Breakfast, L-Lunch, D-Dinner, CB-Character Breakfast,"); 
PopOne.document.writeln("        CM-Character Meal, DS-Dinner Show");
PopOne.document.writeln(" ");
PopOne.document.writeln("Important Telephone Numbers");
PopOne.document.writeln("------------------------------------------------------------------------------------");
PopOne.document.writeln("Central Reservations Office (CRO): 1-407-934-7639");
PopOne.document.writeln("Walt Disney World Dining         : 1-407-WDW-DINE (1-407-939-3463)");
PopOne.document.writeln("Walt Disney Sports & FW Cruises  : 1-407-WDW-PLAY (1-407-939-7529)");
PopOne.document.writeln("Ft. Wilderness Special Events    : 1-407-824-2832"); 
PopOne.document.writeln("</pre>");
PopOne.document.writeln("<br><center><FONT size='3' COLOR='#FF0000'>Compliments of the PS Planning Guide!</font>");
PopOne.document.writeln("</center>");
PopOne.document.close();
}


function FmtEvent(txtSent){

// Pad Event with blanks
     var txtTitle = txtSent;
     var txtLen = txtTitle.length;
     var addSpace = 35 - txtLen;
    
        for (xl=0;xl<addSpace;xl++){
           txtTitle = txtTitle + " ";
        }

     return(txtTitle);
}