// JavaScript Document
var thisWeek = new Date();
var day = thisWeek.getDate();
var year = thisWeek.getFullYear();
var themonth = thisWeek.getMonth()+ 1;


var thismonth;

function setmonth(){
	if (themonth<10){
	thismonth = ("0" + themonth);
	}else{
	if (themonth == 13){
		thismonth = "01";
		}else{
			thismonth = themonth;
			}
	
	}
}

setmonth();

var dayNum = thisWeek.getDay();
var nextMonth = false;
var date1;
var date2;
var date3;
var date4;
var value1;
var value2;
var value3;
var value4;

var thismonthMax;

if (thismonth==2 && year % 4  == 0 && year % 100 !=0){
thismonthMax = 29;
}else if(thismonth==2){
thismonthMax = 28;
}else if(thismonth % 2 == 0){
thismonthMax = 30;
}else{
thismonthMax = 31;
}
var daysLeft = 14 - (dayNum+1); 

//Set First Saturday date and value
var Saturday1 = day + daysLeft;

if (Saturday1 > thismonthMax){
	Saturday1 = Saturday1 - thismonthMax;
	nextMonth = true;
	if(thismonth==12){
	year++;
	thismonth = 0;
	}
	themonth++;
	setmonth();
	if(Saturday1<10){
	date1 = (year + "/" + (thismonth) + "/0" + Saturday1);
	value1 = (year + (thismonth) +  "0"+Saturday1);
	}else{
	date1 = (year + "/" + (thismonth) + "/" + Saturday1);
	value1 = (year + (thismonth) + Saturday1+"");
	}
}else{
	if(Saturday1<10){
	date1 = (year + "/" + (thismonth) + "/0" + Saturday1);
	value1 = (year + (thismonth) +  "0"+Saturday1);
	}else{
	date1 = (year + "/" + thismonth + "/" + Saturday1);
	value1 = (year + thismonth + Saturday1+"");
	}
}


//Set Second Saturday date and value
var Saturday2 = Saturday1 + 7;
if(!nextMonth){
if (Saturday2>thismonthMax){
	Saturday2 = Saturday2 - thismonthMax;
	nextMonth = true;
	if(thismonth==12){
	thismonth = 0;
	year++;
	}
	themonth++;
	setmonth();
	if(Saturday2<10){
	date2 = (year + "/" + (thismonth) + "/0" + Saturday2);
	value2 = (year + (thismonth) +  "0"+Saturday2);
	}else{
	date2 = (year + "/" + (thismonth) + "/" + Saturday2);
	value2 = (year + (thismonth) +  Saturday2+"");
	}
}else{
	if(Saturday2<10){
	date2 = (year + "/" + (thismonth) + "/0" + Saturday2);
	value2 = (year + (thismonth) +  "0"+Saturday2);
	}else{
	date2 = (year + "/" + thismonth + "/" + Saturday2);
	value2 = (year + thismonth + Saturday2 +"");
	}
}
}else{
	if(Saturday2<10){
	date2 = (year + "/" + (thismonth) + "/0" + Saturday2);
	value2 = (year + (thismonth) +  "0"+Saturday2);
	}else{
	date2 = (year + "/" + (thismonth) + "/" + Saturday2);
	value2 = (year + (thismonth) + Saturday2 +"");
	}
}


//Set Third Saturday date and value
var Saturday3 = Saturday2 + 7;
if(!nextMonth){
if (Saturday3>thismonthMax){
	Saturday3 = Saturday3 - thismonthMax;
	nextMonth = true;
	if(thismonth==12){
	thismonth = 0;
	year++;
	}
	themonth++;
	setmonth();
	if(Saturday3<10){
	date3 = (year + "/" + (thismonth) + "/0" + Saturday3);
	value3 = (year + (thismonth) +  "0"+Saturday3);
	}else{
	date3 = (year + "/" + (thismonth) + "/" + Saturday3);
	value3 = (year + (thismonth) + Saturday3+"");
	}
}else{
	if(Saturday3<10){
	date3 = (year + "/" + (thismonth) + "/0" + Saturday3);
	value3 = (year + (thismonth) +  "0"+Saturday3);
	}else{
	date3 = (year + "/" + thismonth + "/" + Saturday3);
	value3 = (year + thismonth + Saturday3 +"");
	}

}
}else{
	if(Saturday3<10){
	date3 = (year + "/" + (thismonth) + "/0" + Saturday3);
	value3 = (year + (thismonth) +  "0"+Saturday3);
	}else{
	date3 = (year + "/" + (thismonth) + "/" + Saturday3);
	value3 = (year + (thismonth) +  Saturday3+"");
	}
}


//Set Fourth Saturday date and value
var Saturday4 = Saturday3 + 7;
if(!nextMonth){
if (Saturday4>thismonthMax){
	Saturday4 = Saturday4 - thismonthMax;
	nextMonth = true;
	if(thismonth==12){
	thismonth =0;
	themonth = 0;
	year++;
	}
	themonth++;
	setmonth();
	if(Saturday4<10){
	date4 = (year + "/" + (thismonth) + "/0" + Saturday4);
	value4 = (year + (thismonth) +  "0"+Saturday4);
	}else{
	date4 = (year + "/" + (thismonth) + "/0" + Saturday4);
	value4 = (year + (thismonth) +  "0"+Saturday4);
	}
}else{
	if(Saturday4<10){
	date4 = (year + "/" + (thismonth) + "/0" + Saturday4);
	value4 = (year + (thismonth) +  "0"+Saturday4);
	}else{
	date4 = (year + "/" + thismonth + "/" + Saturday4);
	value4 = (year + thismonth + Saturday4 +"");
	}
}
}else{
	if(Saturday4 <10){
	date4 = (year + "/" + (thismonth) + "/0" + Saturday4);
	value4 = (year + (thismonth) +  "0"+Saturday4);
	}else{
	date4 = (year + "/" + (thismonth) + "/" + Saturday4);
	value4 = (year + (thismonth) +  Saturday4+"");
	}
}
