//  Original Calendar AppleScript by Jan Suhr and posted on http://homepage.mac.com/jannes/FileShring2.html
//  Modified by Robert Cornelius October 15, 2002 and posted on http://www.fsc-inc.net/downloads/indescalscrp
// Modified by Steve Nichols to include a user interface

//This JavaScript version of the Calendar Maker was written by Steve Nichols Sept_04

//create the dialog
var myDialog = app.dialogs.add({name:"Calendar Maker", canCancel:true});
	with (myDialog){
		with (dialogColumns.add()){
			with (borderPanels.add()){
				with (dialogColumns.add()){
				staticTexts.add({staticLabel:"Select the Year:"});
				}
				with (dialogColumns.add()){
				var Yearlist = dropdowns.add({stringList:["2004", "2005", "2006", "2007"], minWidth:195, selectedIndex:0});
				}
				}
				
			with (borderPanels.add()){
				with (dialogColumns.add()){
				staticTexts.add({staticLabel:"Select the Font:"});
				}
				with (dialogColumns.add()){
				var myFontlist = dropdowns.add({stringList:["Adobe Garamond Pro", "Myriad Pro", "Adobe Caslon Pro"], minWidth:195, selectedIndex:0});
				}
				}
				
				with (borderPanels.add()){
				with (dialogColumns.add()){
				staticTexts.add({staticLabel:"Select the Font Size:"});
				}
				with (dialogColumns.add()){
				var dayfontsizelist = dropdowns.add({stringList:["18", "24", "30", "36"], minWidth:166, selectedIndex:0});
				}
				}
				
				with (borderPanels.add()){
				with (dialogColumns.add()){
				staticTexts.add({staticLabel:"Select the Starting Month:"});
				}
				with (dialogColumns.add()){
				var monthList = dropdowns.add({stringList:["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"], minWidth:130, selectedIndex:0});
				}
				}
				
				with (borderPanels.add()){
				with (dialogColumns.add()){
				staticTexts.add({staticLabel:"Number of Months:"});
				}
				with (dialogColumns.add()){
				var numberofmonthslist = dropdowns.add({stringList:["1", "3", "6", "12"], minWidth:170, selectedIndex:0});
				}
				}
				
				
				with (borderPanels.add()){
				with (dialogColumns.add()){
				staticTexts.add({staticLabel:"Start Calendar from:"});
				}
				with (dialogColumns.add()){
				var myradiobuttongroup = radiobuttonGroups.add();
				with (myradiobuttongroup){
				var myMonday = radiobuttonControls.add({staticLabel:"Monday", checkedState:true, minWidth:165});
				var mySunday = radiobuttonControls.add({staticLabel:"Sunday"});
				}
				}	
			}
		}
	}
	//show the dialog
if (myDialog.show() == true){

//time to get the info from the dialog
var yearlistselect = Yearlist.selectedIndex
if (yearlistselect == 0)
var thisyear = "2004"
else if (yearlistselect == 1)
var thisyear = "2005"
else if (yearlistselect == 2)
var thisyear = "2006"
else if (yearlistselect == 3)
var thisyear = "2007"

var fontselect = myFontlist.selectedIndex
if (fontselect == 0)
var chosenfont = "Adobe Garamond Pro"
else if (fontselect == 1)
var chosenfont = "Myriad Pro"
else if (fontselect == 2)
var chosenfont = "Adobe Caslon Pro"

var dayfont = dayfontsizelist.selectedIndex
if (dayfont == 0)
var dayfontsize = 18
else if (dayfont == 1)
var dayfontsize = 24
else if (dayfont == 2)
var dayfontsize = 30
else if (dayfont == 3)
var dayfontsize = 36

var mymonth = monthList.selectedIndex
if (mymonth == 0)
var ThisMonth = "January"
else if (mymonth == 1)
var ThisMonth = "February"
else if (mymonth == 2)
var ThisMonth = "March"
else if (mymonth == 3)
var ThisMonth = "April"
else if (mymonth == 4)
var ThisMonth = "May"
else if (mymonth == 5)
var ThisMonth = "June"
else if (mymonth == 6)
var ThisMonth = "July"
else if (mymonth == 7)
var ThisMonth = "August"
else if (mymonth == 8)
var ThisMonth = "September"
else if (mymonth == 9)
var ThisMonth = "October"
else if (mymonth == 10)
var ThisMonth = "November"
else if (mymonth == 11)
var ThisMonth = "December"


//this is a hangover from some error checking - should really use the variable mymonth!
if (ThisMonth == "January"){
		var currentmonth = 0
		}
	else if (ThisMonth == "February"){
		var currentmonth = 1
		}
	else if (ThisMonth == "March"){
		var currentmonth = 2
		}
	else if (ThisMonth == "April"){
		var currentmonth = 3
		}
	else if (ThisMonth == "May"){
		var currentmonth = 4
		}
	else if (ThisMonth == "June"){
		var currentmonth = 5
		}
	else if (ThisMonth == "July"){
		var currentmonth = 6
		}
	else if (ThisMonth == "August"){
		var currentmonth = 7
		}
	else if (ThisMonth == "September"){
		var currentmonth = 8
		}
	else if (ThisMonth == "October"){
		var currentmonth = 9
		}
	else if (ThisMonth == "November"){
		var currentmonth = 10
		}
	else if (ThisMonth == "December"){
		var currentmonth = 11
		}

var nomonths = numberofmonthslist.selectedIndex
if (nomonths == 0)
var numberofmonths = 1
else if (nomonths == 1)
var numberofmonths = 3
else if (nomonths == 2)
var numberofmonths = 6
else if (nomonths == 3)
var numberofmonths = 12

var monsun = myradiobuttongroup.selectedButton
if (monsun == 0)
var mystart = "Monday"
else 
var mystart = "Sunday"


//this function checks the starting weekday for each month
function mydatestring(ThisMonth, thisyear){
	if (ThisMonth == "January"){
		var mythisMonth = "00"
		}
	else if (ThisMonth == "February"){
		var mythisMonth = "01"
		}
	else if (ThisMonth == "March"){
		var mythisMonth = "02"
		}
	else if (ThisMonth == "April"){
		var mythisMonth = "03"
		}
	else if (ThisMonth == "May"){
		var mythisMonth = "04"
		}
	else if (ThisMonth == "June"){
		var mythisMonth = "05"
		}
	else if (ThisMonth == "July"){
		var mythisMonth = "06"
		}
	else if (ThisMonth == "August"){
		var mythisMonth = "07"
		}
	else if (ThisMonth == "September"){
		var mythisMonth = "08"
		}
	else if (ThisMonth == "October"){
		var mythisMonth = "09"
		}
	else if (ThisMonth == "November"){
		var mythisMonth = "10"
		}
	else if (ThisMonth == "December"){
		var mythisMonth = "11"
		}
	
	if (thisyear == "2004")
	var mythisyear = 2004	
	else if (thisyear == "2005")
	var mythisyear = 2005	
	else if (thisyear == "2006")
	var mythisyear = 2006	
	else if (thisyear == "2007")
	var mythisyear = 2007	
	
	var mycaldate = new Date(mythisyear, mythisMonth).getDay()
	var myWeekday = mycaldate + 1	
	return (myWeekday)
}

//now we have all the variables recorded we need to create the calendar
var myDocument = app.documents.add();
with (myDocument){
with (myDocument.documentPreferences){
pageHeight = "297mm";
pageWidth = "210mm";
facingPages = false;
pageOrientation = PageOrientation.landscape
pagesPerDocument = numberofmonths;
}
with (myDocument.viewPreferences){
horizontalMeasurementUnits = MeasurementUnits.millimeters;
verticalMeasurementUnits = MeasurementUnits.millimeters;
}
var mymaster1 = masterSpreads.item(0).pages.item(0);
with (mymaster1){
marginPreferences.bottom = 10
marginPreferences.columnCount = 1
marginPreferences.left = 10
marginPreferences.right = 10
marginPreferences.top = 10
}

//add some document colors and make some variables
var mySundayColor = colors.add({name:"Red", colorValue:[0, 100, 100, 0], model:ColorModel.process, space:ColorSpace.cmyk});
var myGrayColor = colors.add({name:"gray 40", colorValue:[0, 0, 0, 40], model:ColorModel.process, space:ColorSpace.cmyk});
var myBlack = colors.item("Black")
var myPaper = colors.item("Paper")

//add the necessary para styles
var MonthStyle = paragraphStyles.add();
	MonthStyle.name = "Month";
	MonthStyle.appliedFont = chosenfont;
	MonthStyle.justification = Justification.fullyJustified;
	MonthStyle.pointSize = "60pt";
	
var WeekdayStyle = paragraphStyles.add();
	WeekdayStyle.name = "Weekday";
	WeekdayStyle.appliedFont = chosenfont;
	WeekdayStyle.justification = Justification.centerAlign;
	WeekdayStyle.pointSize = "14pt";
	WeekdayStyle.fillColor = myPaper;
	
var WeekDayNumberStyle = paragraphStyles.add();
	WeekDayNumberStyle.name = "WeekdayNumber";
	WeekDayNumberStyle.appliedFont = chosenfont;
	WeekDayNumberStyle.justification = Justification.rightJustified;
	WeekDayNumberStyle.pointSize = dayfontsize;
	
var OddWeekDayNumberStyle = paragraphStyles.add();
	OddWeekDayNumberStyle.name = "OddWeekdayNumber";
	OddWeekDayNumberStyle.appliedFont = chosenfont;
	OddWeekDayNumberStyle.justification = Justification.leftJustified;
	OddWeekDayNumberStyle.pointSize = dayfontsize;
	
var SundayNumberStyle = paragraphStyles.add();
	SundayNumberStyle.name = "Sundaynumber";
	SundayNumberStyle.appliedFont = chosenfont;
	SundayNumberStyle.justification = Justification.rightJustified;
	SundayNumberStyle.pointSize = dayfontsize;
	SundayNumberStyle.fillColor = mySundayColor;
	
var OddSundayNumberStyle = paragraphStyles.add();
	OddSundayNumberStyle.name = "OddSundaynumber";
	OddSundayNumberStyle.appliedFont = chosenfont;
	OddSundayNumberStyle.justification = Justification.leftJustified;
	OddSundayNumberStyle.pointSize = dayfontsize;
	OddSundayNumberStyle.fillColor = mySundayColor;
	
var GrayNumberStyle = paragraphStyles.add();
	GrayNumberStyle.name = "Graynumber";
	GrayNumberStyle.appliedFont = chosenfont;
	GrayNumberStyle.justification = Justification.rightJustified;
	GrayNumberStyle.pointSize = dayfontsize;
	GrayNumberStyle.fillColor = myGrayColor;
	
var OddGrayNumberStyle = paragraphStyles.add();
	OddGrayNumberStyle.name = "OddGraynumber";
	OddGrayNumberStyle.appliedFont = chosenfont;
	OddGrayNumberStyle.justification = Justification.leftJustified;
	OddGrayNumberStyle.pointSize = dayfontsize;
	OddGrayNumberStyle.fillColor = myGrayColor;
	
var WeekNumberStyle = paragraphStyles.add();
	WeekNumberStyle.name = "WeekNumber";
	WeekNumberStyle.appliedFont = chosenfont;
	WeekNumberStyle.justification = Justification.rightJustified;
	WeekNumberStyle.pointSize = dayfontsize;
	
var YearNumberStyle = characterStyles.add();
	YearNumberStyle.name = "YearNumber";
	YearNumberStyle.appliedFont = chosenfont;
	YearNumberStyle.pointSize = 40;
}
with (myDocument){
for (i = 0; i<numberofmonths; i++){	
if (ThisMonth == "February"){
	if (thisyear % 4 == 0){
		var DayNumber = 29;
		}
		else {
		var DayNumber = 28;
		}
		}
		else {
		if ((ThisMonth == "April") || (ThisMonth == "June") || (ThisMonth == "September") || (ThisMonth == "November")){
			var DayNumber = 30
			}
		else {
		var DayNumber = 31
		}
	}

	
//create a text frame and create the necessary table
var myTextFr1 = pages.item(i).textFrames.add(undefined, undefined, undefined, {geometricBounds:["10mm","10mm","200mm","287mm"]});
var myTable1 = myTextFr1.tables.add();
myTable1.bodyRowCount = 7;
myTable1.columnCount = 7;
myTable1.cells.item(0).width = "39.56mm"
myTable1.cells.item(1).width = "39.56mm"
myTable1.cells.item(2).width = "39.56mm"
myTable1.cells.item(3).width = "39.56mm"
myTable1.cells.item(4).width = "39.56mm"
myTable1.cells.item(5).width = "39.56mm"
myTable1.cells.item(6).width = "39.56mm"

myTable1.cells.item(1).height = "27.138mm"
myTable1.cells.item(8).height = "7.5mm"
myTable1.cells.item(16).height = "30.905mm"
myTable1.cells.item(24).height = "30.905mm"
myTable1.cells.item(32).height = "30.905mm"
myTable1.cells.item(40).height = "30.905mm"
myTable1.cells.item(48).height = "30.905mm"

var tableWidth = myTable1.width
myTable1.columns.item(0).rightEdgeStrokeWeight = "0.5pt"
myTable1.columns.item(1).rightEdgeStrokeWeight = "0.5pt"
myTable1.columns.item(2).rightEdgeStrokeWeight = "0.5pt"
myTable1.columns.item(3).rightEdgeStrokeWeight = "0.5pt"
myTable1.columns.item(4).rightEdgeStrokeWeight = "0.5pt"
myTable1.columns.item(5).rightEdgeStrokeWeight = "0.5pt"

myTable1.rows.item(0).bottomEdgeStrokeWeight = "0.5pt"
myTable1.rows.item(1).bottomEdgeStrokeWeight = "0.5pt"
myTable1.rows.item(2).bottomEdgeStrokeWeight = "0.5pt"
myTable1.rows.item(3).bottomEdgeStrokeWeight = "0.5pt"
myTable1.rows.item(4).bottomEdgeStrokeWeight = "0.5pt"
myTable1.rows.item(5).bottomEdgeStrokeWeight = "0.5pt"

myTable1.cells.item(0).merge(myTable1.cells.item(6))
myTable1.rightBorderStrokeWeight = 0
myTable1.leftBorderStrokeWeight = 0
myTable1.bottomBorderStrokeWeight = 0
myTable1.cells.item(0).rightEdgeStrokeWeight = 0
myTable1.cells.item(0).leftEdgeStrokeWeight = 0
myTable1.cells.item(0).topEdgeStrokeWeight = 0

myTable1.cells.item(7).rightEdgeStrokeWeight = "0.5pt"
myTable1.cells.item(14).rightEdgeStrokeWeight = "0.5pt"
myTable1.cells.item(21).rightEdgeStrokeWeight = "0.5pt"
myTable1.cells.item(28).rightEdgeStrokeWeight = "0.5pt"
myTable1.cells.item(35).rightEdgeStrokeWeight = "0.5pt"
myTable1.cells.item(42).rightEdgeStrokeWeight = "0.5pt"

myTable1.cells.item(1).leftEdgeStrokeWeight = "0.5pt"
myTable1.cells.item(8).leftEdgeStrokeWeight = "0.5pt"
myTable1.cells.item(15).leftEdgeStrokeWeight = "0.5pt"
myTable1.cells.item(22).leftEdgeStrokeWeight = "0.5pt"
myTable1.cells.item(29).leftEdgeStrokeWeight = "0.5pt"
myTable1.cells.item(36).leftEdgeStrokeWeight = "0.5pt"

myTable1.cells.item(36).bottomEdgeStrokeWeight = "0.5pt"
myTable1.cells.item(37).bottomEdgeStrokeWeight = "0.5pt"
myTable1.cells.item(38).bottomEdgeStrokeWeight = "0.5pt"
myTable1.cells.item(39).bottomEdgeStrokeWeight = "0.5pt"
myTable1.cells.item(40).bottomEdgeStrokeWeight = "0.5pt"
myTable1.cells.item(41).bottomEdgeStrokeWeight = "0.5pt"
myTable1.cells.item(42).bottomEdgeStrokeWeight = "0.5pt"

myTable1.cells.item(1).fillColor = myBlack
myTable1.cells.item(2).fillColor = myBlack
myTable1.cells.item(3).fillColor = myBlack
myTable1.cells.item(4).fillColor = myBlack
myTable1.cells.item(5).fillColor = myBlack
myTable1.cells.item(6).fillColor = myBlack
myTable1.cells.item(7).fillColor = myBlack


//now to fill up the table cells
myTable1.cells.item(0).contents = (thisyear + " " + ThisMonth + " " + thisyear)
myTable1.cells.item(0).words.item(0).appliedCharacterStyle = YearNumberStyle
myTable1.cells.item(0).words.item(2).appliedCharacterStyle = YearNumberStyle

if (mystart == "Monday"){
	myTable1.cells.item(1).contents = "Monday"
	myTable1.cells.item(2).contents = "Tuesday"
	myTable1.cells.item(3).contents = "Wednesday"
	myTable1.cells.item(4).contents = "Thursday"
	myTable1.cells.item(5).contents = "Friday"
	myTable1.cells.item(6).contents = "Saturday"
	myTable1.cells.item(7).contents = "Sunday"

	var myWeekday = mydatestring(ThisMonth, thisyear)
	if (myWeekday == 1)
	var startcell = 8
	else if (myWeekday == 2)
	var startcell = 9
	else if (myWeekday == 3)
	var startcell = 10
	else if (myWeekday == 4)
	var startcell = 11
	else if (myWeekday == 5)
	var startcell = 12
	else if (myWeekday == 6)
	var startcell = 13
	else if (myWeekday == 0)
	var startcell = 14
	else if (myWeekday == 7)
	var startcell = 14
	else
	var startcell = 8
	}
else{
	myTable1.cells.item(1).contents = "Sunday"
	myTable1.cells.item(2).contents = "Monday"
	myTable1.cells.item(3).contents = "Tuesday"
	myTable1.cells.item(4).contents = "Wednesday"
	myTable1.cells.item(5).contents = "Thursday"
	myTable1.cells.item(6).contents = "Friday"
	myTable1.cells.item(7).contents = "Saturday"

	var myWeekday = mydatestring(ThisMonth, thisyear)
	if (myWeekday == 0)
	var startcell = 8
	else if (myWeekday == 1)
	var startcell = 9
	else if (myWeekday == 2)
	var startcell = 10
	else if (myWeekday == 3)
	var startcell = 11
	else if (myWeekday == 4)
	var startcell = 12
	else if (myWeekday == 5)
	var startcell = 13
	else if (myWeekday == 6)
	var startcell = 14
	else if (myWeekday == 7)
	var startcell = 8
	else
	var startcell = 8
}
var n = 1
for (d = startcell; d<(DayNumber + startcell); d++){
	if (n == 30){
		if (startcell == 14){
			if (DayNumber == 30){
				myTable1.cells.item(36).contents = "" + ((n - 7) + "\r" + n)
				myTable1.cells.item(36).paragraphs.item(0).appliedParagraphStyle = WeekDayNumberStyle
				myTable1.cells.item(36).paragraphs.item(1).appliedParagraphStyle = OddWeekDayNumberStyle
				myTable1.cells.item(36).topLeftDiagonalLine = true
				myTable1.cells.item(36).diagonalLineStrokeWeight = "0.5pt"
				}
			else {
			if (DayNumber == 31){
				myTable1.cells.item(36).contents = "" + ((n - 7) + "\r" + n)
				myTable1.cells.item(36).paragraphs.item(0).appliedParagraphStyle = WeekDayNumberStyle
				myTable1.cells.item(36).paragraphs.item(1).appliedParagraphStyle = OddWeekDayNumberStyle
				myTable1.cells.item(36).topLeftDiagonalLine = true
				myTable1.cells.item(36).diagonalLineStrokeWeight = "0.5pt"
				}
			}
		}
		
		else{
		myTable1.cells.item(d).contents = "" + n
		myTable1.cells.item(d).texts.item(0).appliedParagraphStyle = WeekDayNumberStyle
		}
		
	}
	else {
	if (n == 31){
		if (startcell == 13){
			if (DayNumber == 31){
				myTable1.cells.item(36).contents = "" + ((n - 7) + "\r" + n)
				myTable1.cells.item(36).paragraphs.item(0).appliedParagraphStyle = WeekDayNumberStyle
				myTable1.cells.item(36).paragraphs.item(1).appliedParagraphStyle = OddWeekDayNumberStyle
				myTable1.cells.item(36).topLeftDiagonalLine = true
				myTable1.cells.item(36).diagonalLineStrokeWeight = "0.5pt"
				}
			}
			else {
			if (startcell == 14){
				if (DayNumber == 31){
					myTable1.cells.item(37).contents = "" + ((n - 7) + "\r" + n)
					myTable1.cells.item(37).paragraphs.item(0).appliedParagraphStyle = WeekDayNumberStyle
					myTable1.cells.item(37).paragraphs.item(1).appliedParagraphStyle = OddWeekDayNumberStyle
					myTable1.cells.item(37).topLeftDiagonalLine = true
					myTable1.cells.item(37).diagonalLineStrokeWeight = "0.5pt"
					}
				}
				else{
				myTable1.cells.item(d).contents = "" + n
				myTable1.cells.item(d).texts.item(0).appliedParagraphStyle = WeekDayNumberStyle
				}		
			}
		}
	else{
		myTable1.cells.item(d).contents = "" + n
		myTable1.cells.item(d).texts.item(0).appliedParagraphStyle = WeekDayNumberStyle
	
	
	}
	
}

var n = (n + 1)
}

//do some styling on the text

if (mystart == "Monday"){
myTable1.cells.item(0).paragraphs.item(0).appliedParagraphStyle = MonthStyle
myTable1.cells.item(1).paragraphs.item(0).appliedParagraphStyle = WeekdayStyle
myTable1.cells.item(2).paragraphs.item(0).appliedParagraphStyle = WeekdayStyle
myTable1.cells.item(3).paragraphs.item(0).appliedParagraphStyle = WeekdayStyle
myTable1.cells.item(4).paragraphs.item(0).appliedParagraphStyle = WeekdayStyle
myTable1.cells.item(5).paragraphs.item(0).appliedParagraphStyle = WeekdayStyle
myTable1.cells.item(6).paragraphs.item(0).appliedParagraphStyle = WeekdayStyle
myTable1.cells.item(7).paragraphs.item(0).appliedParagraphStyle = WeekdayStyle
myTable1.cells.item(14).texts.item(0).appliedParagraphStyle = SundayNumberStyle
myTable1.cells.item(21).texts.item(0).appliedParagraphStyle = SundayNumberStyle
myTable1.cells.item(28).texts.item(0).appliedParagraphStyle = SundayNumberStyle
myTable1.cells.item(35).texts.item(0).appliedParagraphStyle = SundayNumberStyle
myTable1.cells.item(42).texts.item(0).appliedParagraphStyle = SundayNumberStyle
}
else{
myTable1.cells.item(0).paragraphs.item(0).appliedParagraphStyle = MonthStyle
myTable1.cells.item(1).paragraphs.item(0).appliedParagraphStyle = WeekdayStyle
myTable1.cells.item(2).paragraphs.item(0).appliedParagraphStyle = WeekdayStyle
myTable1.cells.item(3).paragraphs.item(0).appliedParagraphStyle = WeekdayStyle
myTable1.cells.item(4).paragraphs.item(0).appliedParagraphStyle = WeekdayStyle
myTable1.cells.item(5).paragraphs.item(0).appliedParagraphStyle = WeekdayStyle
myTable1.cells.item(6).paragraphs.item(0).appliedParagraphStyle = WeekdayStyle
myTable1.cells.item(7).paragraphs.item(0).appliedParagraphStyle = WeekdayStyle
myTable1.cells.item(8).texts.item(0).appliedParagraphStyle = SundayNumberStyle
myTable1.cells.item(15).texts.item(0).appliedParagraphStyle = SundayNumberStyle
myTable1.cells.item(22).texts.item(0).appliedParagraphStyle = SundayNumberStyle
myTable1.cells.item(29).texts.item(0).appliedParagraphStyle = SundayNumberStyle
myTable1.cells.item(36).paragraphs.item(0).appliedParagraphStyle = SundayNumberStyle	
if (myTable1.cells.item(36).paragraphs.length == 2)
myTable1.cells.item(36).paragraphs.item(1).appliedParagraphStyle = OddSundayNumberStyle	
}

var currentmonth = (currentmonth + 1)
if (currentmonth == 12){
var ThisMonth = "January"
if (thisyear == "2004")
	var thisyear = "2005"	
	else if (thisyear == "2005")
	var thisyear = "2006"	
	else if (thisyear == "2006")
	var mythisyear = "2007"	
	else if (thisyear == "2007")
	var mythisyear = "2008"	
}

//now to add a month in the loop and make sure we wrap back around to January if we reach December.

if (currentmonth == 13)
var currentmonth = 1
if (currentmonth == 0){
var ThisMonth = "January"
}
else
if (currentmonth == 1)
var ThisMonth = "February"
else
if (currentmonth == 2)
var ThisMonth = "March"
else
if (currentmonth == 3)
var ThisMonth = "April"
else
if (currentmonth == 4)
var ThisMonth = "May"
else
if (currentmonth == 5)
var ThisMonth = "June"
else
if (currentmonth == 6)
var ThisMonth = "July"
else
if (currentmonth == 7)
var ThisMonth = "August"
else
if (currentmonth == 8)
var ThisMonth = "September"
else
if (currentmonth == 9)
var ThisMonth = "October"
else
if (currentmonth == 10)
var ThisMonth = "November"
else
if (currentmonth == 11)
var ThisMonth = "December"
}
}
}
else{
myDialog.destroy();
}
