/* FORMAT FUNCTIONS
NOTE: These are the routines the support the file NewDateValidity.js
 This file must be included before the file NewDateValidity.js

there are 2 drop downs one of day and one for month.
The month drop down must have a year formated into the string

if the dep month is changed then dep day is set to 1 and then the ret_mm/ret_dd is set to the date + ReturnDiff
if the dep_day is changed then the return mm/ret_dd is set to the date + ReturnDiff

 if you want to start on the current date then Start Date = 0;
 if you want to start on the current date + 7 days then Start Date = 7;
 if you want the return date to be the same day ReturnDiff = 0
 if you want the return date to be the next day ReturnDiff = 1


*/
var StartDate=0;  // number of days from current date to start calendar
var ReturnDiff = 1; // number of days from the depart date to start return

// set up how many days to display in the drop downs

var NumberofDisplayMonths = 13;
// arrays one less than number of Display Months
var NumberofDaysArrays = new Array(12);	    
var DatesArrays = new Array(12);

// FORMAT FUNCTIONS

function changeMonthNumbertoString(monthval){
if(monthval=="0"){
monthval="Jan";
}
else if (monthval=="1") {
monthval="Feb";
}
else if (monthval=="2") {
monthval="Mar";
}
else if (monthval=="3") {
monthval="Apr";
}
else if (monthval=="4") {
monthval="May"; 
}
else if (monthval=="5") {
monthval="Jun"; 
}
else if (monthval=="6") {
monthval="Jul"; 
}
else if (monthval=="7") {
monthval="Aug";  
}
else if (monthval=="8") {
monthval="Sep";  
}
else if (monthval=="9") {
monthval="Oct"; 
}
else if (monthval=="10") {
monthval="Nov"; 
}
else if (monthval=="11") {
monthval="Dec"; 
}
return(monthval);
}


function changeMonthNametoString(monthName){
	
		
		
if(monthName=="Jan"){
monthName="0";
}
else if (monthName=="Feb") {
monthName="1";
}
else if (monthName=="Mar") {
monthName="2";
}
else if (monthName=="Apr") {
monthName="3";
}
else if (monthName=="May") {
monthName="4"; 
}
else if (monthName=="Jun") {
monthName="5"; 
}
else if (monthName=="Jul") {
monthName="6"; 
}
else if (monthName=="Aug") {
monthName="7";  
}
else if (monthName=="Sep") {
monthName="8";  
}
else if (monthName=="Oct") {
monthName="9"; 
}
else if (monthName=="Nov") {
monthName="10"; 
}
else if (monthName=="Dec") {
monthName="11"; 
}
return(monthName);
}

function changeWeekNumberToString(dayval)
{
    if(dayval=="0"){
    dayval="Sun";
    }
    else if (dayval=="1") {
    dayval="Mon";
    }
    else if (dayval=="2") {
    dayval="Tue";
    }
    else if (dayval=="3") {
    dayval="Wed";
    }
    else if (dayval=="4") {
    dayval="Thu"; 
    }
    else if (dayval=="5") {
    dayval="Fri"; 
    }
    else if (dayval=="6") {
    dayval="Sat"; 
    }

    return(dayval);
}


function ReturnMonth(monthstr)
{
	var month = monthstr.substr(0,3);
	return month;
	}
function ReturnYear(monthstr)
{
	var selDepYear= "20" + (monthstr.substr(5,5));
	return(selDepYear);
}
function FormatMonth(month,year)
{
	var mm;
	
  mm=changeMonthNumbertoString(month) + " '"  +  year.substr(2,3);   
	return mm;
	}
	
function FormatDay(dd,numDay)
{
	var day;
	
	day = changeWeekNumberToString(dd) + " " + numDay;
	
	return day;
	}
	
	
