
daysInMonth = new Array(12);
daysInMonth[0]=31;
daysInMonth[1]=28;
daysInMonth[2]=31;
daysInMonth[3]=30;
daysInMonth[4]=31;
daysInMonth[5]=30;
daysInMonth[6]=31;
daysInMonth[7]=31;
daysInMonth[8]=30;
daysInMonth[9]=31;
daysInMonth[10]=30;
daysInMonth[11]=31;

var monthnames = new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec");

function makeCal1(inputMonth,inputYear,win){

	gotoMonth = inputMonth;
	gotoYear = inputYear;

	year = this.startYear;

	// for netscape only
	if (year < 1900) year += 1900;

	if(inputYear > year)
		year = inputYear;

	previousYear = year;

	if (gotoMonth==-1){ 
		month = this.gNow.getMonth();
		this.nextMonth = month+1
		if (month == 0){
			this.previousMonth = 11; 
			previousYear = year -1;
		}
		else{
			this.previousMonth = month-1; 
		}
	} 
	else {
		month = gotoMonth;
		this.nextMonth = month+1;
		if (month == 12 || month == 0){
			this.previousMonth = 11; 
			previousYear = year -1;
		}
		else{
			this.previousMonth = month-1; 
		}
	}
	
	if (((year % 4 == 0) && !(year % 100 == 0)) || (year % 400 == 0)) daysInMonth[1]=29;
	else(daysInMonth[1] = 28);

	var firstOfMonth = new Date (year, month, 1);
	var startspaces  = firstOfMonth.getDay();

	//start building current month
	
	calHdrStr = "<table border=0 cellpadding=0 cellspacing=0 width=100%>";;
	calHdrStr = calHdrStr + "<tr height=20 class=calhdr valign=middle>"

	if (this.previousMonth >= this.startMonth || year > this.startYear){
		calHdrStr = calHdrStr + "<td ><a onmouseover=\"style.cursor='hand';\" onclick=\"javascript:wp.makeCal1("+this.previousMonth+"," + previousYear +",wf);\"><img src=\"../../../../web/images/internal/prev.gif\" border=\"0\" alt=\"\"></a></td>";
	}
	else {


		calHdrStr = calHdrStr+"<td>&nbsp;</td>";
	}
	calHdrStr = calHdrStr + "<td colspan=5 align='center' class='month' nowrap>" + monthnames[month] + " " + year + "</td>";	
	calHdrStr = calHdrStr + "</table>";


	// The Header Info for the Calender
	dayHdrStr = "<tr height=25 class=dayhdr align='center' valign='middle'> <td class='day' width='15'>S</td> <td class='day' width='15'>M</td> <td class='day' width='15'>T</td><td class='day' width='15'>W</td> <td class='day' width='15'>T</td> <td class='day' width='15'>F</td> <td class='day' width='15'>S</td> </tr>";
	
	dateStr = "<tr>";
	for (s=0;s<startspaces;s++) {
		dateStr = dateStr+"<td class='date'>&nbsp;</td>";
	}
	count=1;
	while (count <= daysInMonth[month]) {
		for (b = startspaces;b<7;b++) {
			linktrue=false;
			if (count <= daysInMonth[month]) {
				if((count == this.inputDay && month == this.inputMonth && year == this.inputYear))
					dateStr = dateStr + "<td align='center' valign='middle' class='seldt' >"+count+"</td>";
				else if  (  (year > this.stopYear)
						 || (month > this.stopMonth && year == this.stopYear)
						 || (count > this.stopDay && month == this.stopMonth && year == this.stopYear)
						 )
					dateStr = dateStr + "<td align='center' valign='middle' class='nodate'>"+count+"</td>";
				else if  (  (year < this.startYear)
						 || (month < this.startMonth && year == this.startYear)
						 || (count < this.startDay && month == this.startMonth && year == this.startYear)
						 )
					dateStr = dateStr + "<td align='center' valign='middle' class='nodate'>"+count+"</td>";
				else
				{
					//condition later than today and before year from now				
					if(count == this.currDay && month == this.currMonth && year == this.currYear)
						dateStr = dateStr + "<td align='center' valign='middle' class='today'>";
					else					
						dateStr = dateStr + "<td align='center' valign='middle' class='date'>";

					dateStr = dateStr + "<a class=\"date\" onmouseover=\"style.cursor='hand';\" onclick=\"javascript:wp.SetDate1(" + month + "," + count + "," + year + "," + b + ");\">";
					dateStr = dateStr + count;						
					dateStr = dateStr + "</a></td>";
				}
			}
			else
			 dateStr = dateStr + "<td align='center' valign='middle' class='nodate'></td>";
			count++;
		}
		dateStr = dateStr + "</tr>";
		if (count <= daysInMonth[month]) 
			dateStr = dateStr + "<tr>";
		startspaces=0;
	}

	calStr = "<table border=0 cellpadding=0 cellspacing=0><tr><td>"+calHdrStr+"</td></tr>";
	calStr = calStr+"<tr><td> <table border=0 cellpadding=1 cellspacing=0 width=100%>";
	calStr = calStr+dayHdrStr+dateStr+"</td></tr></table>";
	cmCalStr = calStr+"";
	//end building current month
		
	//start building next month
	
	calHdrStr = "<table border=0 cellpadding=0 cellspacing=0 width=100%>";;
	calHdrStr = calHdrStr + "<tr height=20 class=calhdr valign=middle>"

	if (month==11){ 
	    month2 = 0;
	    year2 = year+1; 
	}
	else { 
	    month2 = month+1;
	    year2 = year;
	}
	calHdrStr = calHdrStr + "<td colspan=5 align='center' class='month' nowrap>" + monthnames[month2] + " " + year2 + "</td>";		
	var firstOfMonth2 = new Date (year2, month2, 1);
	var startspaces2  = firstOfMonth2.getDay();
	
	if (this.stopYear == year2 && month2 == this.stopMonth + 1){
		calHdrStr = calHdrStr + "<td class='day'>&nbsp;</td></tr>";
	}
	else {
		calHdrStr = calHdrStr + "<td class='day'><a onmouseover=\"style.cursor='hand';\" onclick=\"javascript:wp.makeCal1("+month2+"," + year2 +",wf);\"><img src=\"../../../../web/images/internal/next.gif\" border=\"0\" alt=\"\"></a></td></tr>";
						
	}
	calHdrStr = calHdrStr + "</table>";
	dateStr = "<tr>";
	for (s=0;s<startspaces2;s++) {
		dateStr = dateStr+"<td class='date'>&nbsp;</td>";
	}

	count=1;
	while (count <= daysInMonth[month2]) {
		for (b = startspaces2;b<7;b++) {
			linktrue=false;
			if (count <= daysInMonth[month2]) {
				if((count == this.inputDay && month2 == this.inputMonth && year2 == this.inputYear))
					dateStr = dateStr + "<td align='center' valign='middle' class='seldt' >"+count+"</td>";
				else if  (  (year2 > this.stopYear)
						 || (month2 > this.stopMonth && year2 == this.stopYear)
						 || (count > this.stopDay && month2 == this.stopMonth && year2 == this.stopYear)
						 )
					dateStr = dateStr + "<td align='center' valign='middle' class='nodate'>"+count+"</td>";
				else if  (  (year2 < this.startYear)
						 || (month2 < this.startMonth && year2 == this.startYear)
						 || (count < this.startDay && month2 == this.startMonth && year2 == this.startYear)
						 )
					dateStr = dateStr + "<td align='center' valign='middle' class='nodate'>"+count+"</td>";
				else{
					if(count == this.currDay && month2 == this.currMonth && year2 == this.currYear)
						dateStr = dateStr + "<td align='center' valign='middle' class='today'>";
					else
						dateStr = dateStr + "<td align='center' valign='middle' class='date'>";
					dateStr = dateStr + "<a class=\"date\" onmouseover=\"style.cursor='hand';\" onclick=\"javascript:wp.SetDate1(" + month2 + "," + count + "," + year2 + "," + b + ");\">";
					dateStr = dateStr + count;						
					dateStr = dateStr + "</a></td>";
				}
			}
			else
			 dateStr = dateStr + "<td align='center' valign='middle' class='nodate'></td>";
			count++;
		}
		dateStr = dateStr + "</tr>";
		if (count <= daysInMonth[month2]) 
			dateStr = dateStr + "<tr>";
		startspaces2=0;
	}
	
	calStr = "<table border=0 cellpadding=0 cellspacing=0><tr><td>"+calHdrStr+"</td></tr>";
	calStr = calStr+"<tr><td> <table border=0 cellpadding=1 cellspacing=0 width=100%>";
	calStr = calStr+dayHdrStr+dateStr+"</td></tr></table>";
	nmCalStr = calStr + "";
	//end building next month
	
	closeLinkHTMLStr = "<a class=date onmouseover=\"style.cursor='hand';\" onclick=\"javascript:wp.hideCal();\"> close </a>";		
	if (ns){
		// For NS6
		this.IFrameCalDoc.getElementById('closeLink').innerHTML = closeLinkHTMLStr;
		this.IFrameCalDoc.getElementById('currMonthcal').innerHTML = cmCalStr;
		this.IFrameCalDoc.getElementById('nextMonthCal').innerHTML = nmCalStr;
	}
	else if (ie55dn){
		this.winCal.writeContent(closeLinkHTMLStr,  cmCalStr, nmCalStr);
	}
 	else{
		this.IFrameCalDoc.all.closeLink.innerHTML = closeLinkHTMLStr;
		this.IFrameCalDoc.all.currMonthcal.innerHTML = cmCalStr;
		this.IFrameCalDoc.all.nextMonthCal.innerHTML = nmCalStr;
	}	
}

function makeCal_shuttlePax(inputMonth,inputYear,win){

	gotoMonth = inputMonth;
	gotoYear = inputYear;

	year = this.startYear;

	// for netscape only
	if (year < 1900) year += 1900;

	if(inputYear > year)
		year = inputYear;

	previousYear = year;

	if (gotoMonth==-1){ 
		month = this.gNow.getMonth();
		this.nextMonth = month+1
		if (month == 0){
			this.previousMonth = 11; 
			previousYear = year -1;
		}
		else{
			this.previousMonth = month-1; 
		}
	} 
	else {
		month = gotoMonth;
		this.nextMonth = month+1;
		if (month == 12 || month == 0){
			this.previousMonth = 11; 
			previousYear = year -1;
		}
		else{
			this.previousMonth = month-1; 
		}
	}
	
	if (((year % 4 == 0) && !(year % 100 == 0)) || (year % 400 == 0)) daysInMonth[1]=29;
	else(daysInMonth[1] = 28);

	var firstOfMonth = new Date (year, month, 1);
	var startspaces  = firstOfMonth.getDay();

	//start building current month
	
	calHdrStr = "<table border=0 cellpadding=0 cellspacing=0 width=100%>";;
	calHdrStr = calHdrStr + "<tr height=20 class=calhdr valign=middle>"

	if (this.previousMonth >= this.startMonth || year > this.startYear){
		calHdrStr = calHdrStr + "<td ><a onmouseover=\"style.cursor='hand';\" onclick=\"javascript:wp.makeCal_shuttlePax("+this.previousMonth+"," + previousYear +",wf);\"><img src=\"../../../../web/images/internal/prev.gif\" border=\"0\" alt=\"\"></a></td>";
	}
	else {


		calHdrStr = calHdrStr+"<td>&nbsp;</td>";
	}
	calHdrStr = calHdrStr + "<td colspan=5 align='center' class='month' nowrap>" + monthnames[month] + " " + year + "</td>";	
	calHdrStr = calHdrStr + "</table>";


	// The Header Info for the Calender
	dayHdrStr = "<tr height=25 class=dayhdr align='center' valign='middle'> <td class='day' width='15'>S</td> <td class='day' width='15'>M</td> <td class='day' width='15'>T</td><td class='day' width='15'>W</td> <td class='day' width='15'>T</td> <td class='day' width='15'>F</td> <td class='day' width='15'>S</td> </tr>";
	
	dateStr = "<tr>";
	for (s=0;s<startspaces;s++) {
		dateStr = dateStr+"<td class='date'>&nbsp;</td>";
	}
	count=1;
	while (count <= daysInMonth[month]) {
		for (b = startspaces;b<7;b++) {
			linktrue=false;
			if (count <= daysInMonth[month]) {
				if((count == this.inputDay && month == this.inputMonth && year == this.inputYear))
					dateStr = dateStr + "<td align='center' valign='middle' class='seldt' >"+count+"</td>";
				else if  (  (year > this.stopYear)
						 || (month > this.stopMonth && year == this.stopYear)
						 || (count > this.stopDay && month == this.stopMonth && year == this.stopYear)
						 )
					dateStr = dateStr + "<td align='center' valign='middle' class='nodate'>"+count+"</td>";
				else if  (  (year < this.startYear)
						 || (month < this.startMonth && year == this.startYear)
						 || (count < this.startDay && month == this.startMonth && year == this.startYear)
						 )
					dateStr = dateStr + "<td align='center' valign='middle' class='nodate'>"+count+"</td>";
				else
				{
					//condition later than today and before year from now				
					if(count == this.currDay && month == this.currMonth && year == this.currYear)
						dateStr = dateStr + "<td align='center' valign='middle' class='today'>";
					else					
						dateStr = dateStr + "<td align='center' valign='middle' class='date'>";

					dateStr = dateStr + "<a class=\"date\" onmouseover=\"style.cursor='hand';\" onclick=\"javascript:wp.SetDate_shuttlePax(" + month + "," + count + "," + year + "," + b + ");\">";
					dateStr = dateStr + count;						
					dateStr = dateStr + "</a></td>";
				}
			}
			else
			 dateStr = dateStr + "<td align='center' valign='middle' class='nodate'></td>";
			count++;
		}
		dateStr = dateStr + "</tr>";
		if (count <= daysInMonth[month]) 
			dateStr = dateStr + "<tr>";
		startspaces=0;
	}

	calStr = "<table border=0 cellpadding=0 cellspacing=0><tr><td>"+calHdrStr+"</td></tr>";
	calStr = calStr+"<tr><td> <table border=0 cellpadding=1 cellspacing=0 width=100%>";
	calStr = calStr+dayHdrStr+dateStr+"</td></tr></table>";
	cmCalStr = calStr+"";
	//end building current month
		
	//start building next month
	
	calHdrStr = "<table border=0 cellpadding=0 cellspacing=0 width=100%>";;
	calHdrStr = calHdrStr + "<tr height=20 class=calhdr valign=middle>"

	if (month==11){ 
	    month2 = 0;
	    year2 = year+1; 
	}
	else { 
	    month2 = month+1;
	    year2 = year;
	}
	calHdrStr = calHdrStr + "<td colspan=5 align='center' class='month' nowrap>" + monthnames[month2] + " " + year2 + "</td>";		
	var firstOfMonth2 = new Date (year2, month2, 1);
	var startspaces2  = firstOfMonth2.getDay();
	
	if (this.stopYear == year2 && month2 == this.stopMonth + 1){
		calHdrStr = calHdrStr + "<td class='day'>&nbsp;</td></tr>";
	}
	else {
		calHdrStr = calHdrStr + "<td class='day'><a onmouseover=\"style.cursor='hand';\" onclick=\"javascript:wp.makeCal_shuttlePax("+month2+"," + year2 +",wf);\"><img src=\"../../../../web/images/internal/next.gif\" border=\"0\" alt=\"\"></a></td></tr>";
						
	}
	calHdrStr = calHdrStr + "</table>";
	dateStr = "<tr>";
	for (s=0;s<startspaces2;s++) {
		dateStr = dateStr+"<td class='date'>&nbsp;</td>";
	}

	count=1;
	while (count <= daysInMonth[month2]) {
		for (b = startspaces2;b<7;b++) {
			linktrue=false;
			if (count <= daysInMonth[month2]) {
				if((count == this.inputDay && month2 == this.inputMonth && year2 == this.inputYear))
					dateStr = dateStr + "<td align='center' valign='middle' class='seldt' >"+count+"</td>";
				else if  (  (year2 > this.stopYear)
						 || (month2 > this.stopMonth && year2 == this.stopYear)
						 || (count > this.stopDay && month2 == this.stopMonth && year2 == this.stopYear)
						 )
					dateStr = dateStr + "<td align='center' valign='middle' class='nodate'>"+count+"</td>";
				else if  (  (year2 < this.startYear)
						 || (month2 < this.startMonth && year2 == this.startYear)
						 || (count < this.startDay && month2 == this.startMonth && year2 == this.startYear)
						 )
					dateStr = dateStr + "<td align='center' valign='middle' class='nodate'>"+count+"</td>";
				else{
					if(count == this.currDay && month2 == this.currMonth && year2 == this.currYear)
						dateStr = dateStr + "<td align='center' valign='middle' class='today'>";
					else
						dateStr = dateStr + "<td align='center' valign='middle' class='date'>";
					dateStr = dateStr + "<a class=\"date\" onmouseover=\"style.cursor='hand';\" onclick=\"javascript:wp.SetDate_shuttlePax(" + month2 + "," + count + "," + year2 + "," + b + ");\">";
					dateStr = dateStr + count;						
					dateStr = dateStr + "</a></td>";
				}
			}
			else
			 dateStr = dateStr + "<td align='center' valign='middle' class='nodate'></td>";
			count++;
		}
		dateStr = dateStr + "</tr>";
		if (count <= daysInMonth[month2]) 
			dateStr = dateStr + "<tr>";
		startspaces2=0;
	}
	
	calStr = "<table border=0 cellpadding=0 cellspacing=0><tr><td>"+calHdrStr+"</td></tr>";
	calStr = calStr+"<tr><td> <table border=0 cellpadding=1 cellspacing=0 width=100%>";
	calStr = calStr+dayHdrStr+dateStr+"</td></tr></table>";
	nmCalStr = calStr + "";
	//end building next month
	
	closeLinkHTMLStr = "<a class=date onmouseover=\"style.cursor='hand';\" onclick=\"javascript:wp.hideCal();\"> close </a>";		
	if (ns){
		// For NS6
		this.IFrameCalDoc.getElementById('closeLink').innerHTML = closeLinkHTMLStr;
		this.IFrameCalDoc.getElementById('currMonthcal').innerHTML = cmCalStr;
		this.IFrameCalDoc.getElementById('nextMonthCal').innerHTML = nmCalStr;
	}
	else if (ie55dn){
		this.winCal.writeContent(closeLinkHTMLStr,  cmCalStr, nmCalStr);
	}
 	else{
		this.IFrameCalDoc.all.closeLink.innerHTML = closeLinkHTMLStr;
		this.IFrameCalDoc.all.currMonthcal.innerHTML = cmCalStr;
		this.IFrameCalDoc.all.nextMonthCal.innerHTML = nmCalStr;
	}	
}

function makeCal(inputMonth,inputYear,win){

	gotoMonth = inputMonth;
	gotoYear = inputYear;

	year = this.startYear;

	// for netscape only
	if (year < 1900) year += 1900;

	if(inputYear > year)
		year = inputYear;

	previousYear = year;

	if (gotoMonth==-1){ 
		month = this.gNow.getMonth();
		this.nextMonth = month+1
		if (month == 0){
			this.previousMonth = 11; 
			previousYear = year -1;
		}
		else{
			this.previousMonth = month-1; 
		}
	} 
	else {
		month = gotoMonth;
		this.nextMonth = month+1;
		if (month == 12 || month == 0){
			this.previousMonth = 11; 
			previousYear = year -1;
		}
		else{
			this.previousMonth = month-1; 
		}
	}
	
	if (((year % 4 == 0) && !(year % 100 == 0)) || (year % 400 == 0)) daysInMonth[1]=29;
	else(daysInMonth[1] = 28);

	var firstOfMonth = new Date (year, month, 1);
	var startspaces  = firstOfMonth.getDay();

	//start building current month
	
	calHdrStr = "<table border=0 cellpadding=0 cellspacing=0 width=100%>";;
	calHdrStr = calHdrStr + "<tr height=20 class=calhdr valign=middle>"

	if (this.previousMonth >= this.startMonth || year > this.startYear){
		calHdrStr = calHdrStr + "<td ><a onmouseover=\"style.cursor='hand';\" onclick=\"javascript:wp.makeCal("+this.previousMonth+"," + previousYear +",wf);\"><img src=\"../../../../web/images/internal/prev.gif\" border=\"0\" alt=\"\"></a></td>";
	}
	else {
		calHdrStr = calHdrStr+"<td>&nbsp;</td>";
	}
	calHdrStr = calHdrStr + "<td colspan=5 align='center' class='month' nowrap>" + monthnames[month] + " " + year + "</td>";	
	calHdrStr = calHdrStr + "</table>";


	// The Header Info for the Calender
	dayHdrStr = "<tr height=25 class=dayhdr align='center' valign='middle'> <td class='day' width='15'>S</td> <td class='day' width='15'>M</td> <td class='day' width='15'>T</td><td class='day' width='15'>W</td> <td class='day' width='15'>T</td> <td class='day' width='15'>F</td> <td class='day' width='15'>S</td> </tr>";
	
	dateStr = "<tr>";
	for (s=0;s<startspaces;s++) {
		dateStr = dateStr+"<td class='date'>&nbsp;</td>";
	}
	count=1;
	while (count <= daysInMonth[month]) {
		for (b = startspaces;b<7;b++) {
			linktrue=false;
			if (count <= daysInMonth[month]) {
				if((count == this.inputDay && month == this.inputMonth && year == this.inputYear))
					dateStr = dateStr + "<td align='center' valign='middle' class='seldt' >"+count+"</td>";
				else if  (  (year > this.stopYear)
						 || (month > this.stopMonth && year == this.stopYear)
						 || (count > this.stopDay && month == this.stopMonth && year == this.stopYear)
						 )
					dateStr = dateStr + "<td align='center' valign='middle' class='nodate'>"+count+"</td>";
				else if  (  (year < this.startYear)
						 || (month < this.startMonth && year == this.startYear)
						 || (count < this.startDay && month == this.startMonth && year == this.startYear)
						 )
					dateStr = dateStr + "<td align='center' valign='middle' class='nodate'>"+count+"</td>";
				else
				{
					//condition later than today and before year from now				
					if(count == this.currDay && month == this.currMonth && year == this.currYear)
						dateStr = dateStr + "<td align='center' valign='middle' class='today'>";
					else					
						dateStr = dateStr + "<td align='center' valign='middle' class='date'>";
					dateStr = dateStr + "<a class=\"date\" onmouseover=\"style.cursor='hand';\" onclick=\"javascript:wp.SetDate(" + month + "," + count + "," + year + ");\">";
					dateStr = dateStr + count;						
					dateStr = dateStr + "</a></td>";
				}
			}
			else
			 dateStr = dateStr + "<td align='center' valign='middle' class='nodate'></td>";
			count++;
		}
		dateStr = dateStr + "</tr>";
		if (count <= daysInMonth[month]) 
			dateStr = dateStr + "<tr>";
		startspaces=0;
	}

	calStr = "<table border=0 cellpadding=0 cellspacing=0><tr><td>"+calHdrStr+"</td></tr>";
	calStr = calStr+"<tr><td> <table border=0 cellpadding=1 cellspacing=0 width=100%>";
	calStr = calStr+dayHdrStr+dateStr+"</td></tr></table>";
	cmCalStr = calStr+"";
	//end building current month
		
	//start building next month
	
	calHdrStr = "<table border=0 cellpadding=0 cellspacing=0 width=100%>";;
	calHdrStr = calHdrStr + "<tr height=20 class=calhdr valign=middle>"

	if (month==11){ 
	    month2 = 0;
	    year2 = year+1; 
	}
	else { 
	    month2 = month+1;
	    year2 = year;
	}
	calHdrStr = calHdrStr + "<td colspan=5 align='center' class='month' nowrap>" + monthnames[month2] + " " + year2 + "</td>";		
	var firstOfMonth2 = new Date (year2, month2, 1);
	var startspaces2  = firstOfMonth2.getDay();
	
	if (this.stopYear == year2 && month2 == this.stopMonth + 1){
		calHdrStr = calHdrStr + "<td class='day'>&nbsp;</td></tr>";
	}
	else {
		calHdrStr = calHdrStr + "<td class='day'><a onmouseover=\"style.cursor='hand';\" onclick=\"javascript:wp.makeCal("+month2+"," + year2 +",wf);\"><img src=\"../../../../web/images/internal/next.gif\" border=\"0\" alt=\"\"></a></td></tr>";
						
	}
	calHdrStr = calHdrStr + "</table>";
	dateStr = "<tr>";
	for (s=0;s<startspaces2;s++) {
		dateStr = dateStr+"<td class='date'>&nbsp;</td>";
	}

	count=1;
	while (count <= daysInMonth[month2]) {
		for (b = startspaces2;b<7;b++) {
			linktrue=false;
			if (count <= daysInMonth[month2]) {
				if((count == this.inputDay && month2 == this.inputMonth && year2 == this.inputYear))
					dateStr = dateStr + "<td align='center' valign='middle' class='seldt' >"+count+"</td>";
				else if  (  (year2 > this.stopYear)
						 || (month2 > this.stopMonth && year2 == this.stopYear)
						 || (count > this.stopDay && month2 == this.stopMonth && year2 == this.stopYear)
						 )
					dateStr = dateStr + "<td align='center' valign='middle' class='nodate'>"+count+"</td>";
				else if  (  (year2 < this.startYear)
						 || (month2 < this.startMonth && year2 == this.startYear)
						 || (count < this.startDay && month2 == this.startMonth && year2 == this.startYear)
						 )
					dateStr = dateStr + "<td align='center' valign='middle' class='nodate'>"+count+"</td>";
				else{
					if(count == this.currDay && month2 == this.currMonth && year2 == this.currYear)
						dateStr = dateStr + "<td align='center' valign='middle' class='today'>";
					else
						dateStr = dateStr + "<td align='center' valign='middle' class='date'>";
					dateStr = dateStr + "<a class=\"date\" onmouseover=\"style.cursor='hand';\" onclick=\"javascript:wp.SetDate(" + month2 + "," + count + "," + year2 + ");\">";
					dateStr = dateStr + count;						
					dateStr = dateStr + "</a></td>";
				}
			}
			else
			 dateStr = dateStr + "<td align='center' valign='middle' class='nodate'></td>";
			count++;
		}
		dateStr = dateStr + "</tr>";
		if (count <= daysInMonth[month2]) 
			dateStr = dateStr + "<tr>";
		startspaces2=0;
	}
	
	calStr = "<table border=0 cellpadding=0 cellspacing=0><tr><td>"+calHdrStr+"</td></tr>";
	calStr = calStr+"<tr><td> <table border=0 cellpadding=1 cellspacing=0 width=100%>";
	calStr = calStr+dayHdrStr+dateStr+"</td></tr></table>";
	nmCalStr = calStr + "";
	//end building next month
	
	closeLinkHTMLStr = "<a class=date onmouseover=\"style.cursor='hand';\" onclick=\"javascript:wp.hideCal();\"> close </a>";		
	if (ns){
		// For NS6
		this.IFrameCalDoc.getElementById('closeLink').innerHTML = closeLinkHTMLStr;
		this.IFrameCalDoc.getElementById('currMonthcal').innerHTML = cmCalStr;
		this.IFrameCalDoc.getElementById('nextMonthCal').innerHTML = nmCalStr;
	}
	else if (ie55dn){
		this.winCal.writeContent(closeLinkHTMLStr,  cmCalStr, nmCalStr);
	}
 	else{
		this.IFrameCalDoc.all.closeLink.innerHTML = closeLinkHTMLStr;
		this.IFrameCalDoc.all.currMonthcal.innerHTML = cmCalStr;
		this.IFrameCalDoc.all.nextMonthCal.innerHTML = nmCalStr;
	}	
}




function makePublicCal(inputMonth,inputYear,win){

	gotoMonth = inputMonth;
	gotoYear = inputYear;

	year = this.startYear;

	// for netscape only
	if (year < 1900) year += 1900;

	if(inputYear > year)
		year = inputYear;

	previousYear = year;

	if (gotoMonth==-1){ 
		month = this.gNow.getMonth();
		this.nextMonth = month+1
		if (month == 0){
			this.previousMonth = 11; 
			previousYear = year -1;
		}
		else{
			this.previousMonth = month-1; 
		}
	} 
	else {
		month = gotoMonth;
		this.nextMonth = month+1;
		if (month == 12 || month == 0){
			this.previousMonth = 11; 
			previousYear = year -1;
		}
		else{
			this.previousMonth = month-1; 
		}
	}
	
	if (((year % 4 == 0) && !(year % 100 == 0)) || (year % 400 == 0)) daysInMonth[1]=29;
	else(daysInMonth[1] = 28);

	var firstOfMonth = new Date (year, month, 1);
	var startspaces  = firstOfMonth.getDay();

	//start building current month
	
	calHdrStr = "<table border=0 cellpadding=0 cellspacing=0 width=100%>";;
	calHdrStr = calHdrStr + "<tr height=20 class=calpublichdr valign=middle>"

	if (this.previousMonth >= this.startMonth || year > this.startYear){
		calHdrStr = calHdrStr + "<td ><a onmouseover=\"style.cursor='hand';\" onclick=\"javascript:wp.makePublicCal("+this.previousMonth+"," + previousYear +",wf);\"><img src=\"../../../../web/images/internal/prev.gif\" border=\"0\" alt=\"\"></a></td>";
	}
	else {
		calHdrStr = calHdrStr+"<td>&nbsp;</td>";
	}
	calHdrStr = calHdrStr + "<td colspan=5 align='center' class='publicmonth' nowrap>" + monthnames[month] + " " + year + "</td>";	
	calHdrStr = calHdrStr + "</table>";


	// The Header Info for the Calender
	dayHdrStr = "<tr height=25 class=publicdayhdr align='center' valign='middle'> <td class='day' width='15'>S</td> <td class='day' width='15'>M</td> <td class='day' width='15'>T</td><td class='day' width='15'>W</td> <td class='day' width='15'>T</td> <td class='day' width='15'>F</td> <td class='day' width='15'>S</td> </tr>";
	
	dateStr = "<tr>";
	for (s=0;s<startspaces;s++) {
		dateStr = dateStr+"<td class='publicdate'>&nbsp;</td>";
	}
	count=1;
	while (count <= daysInMonth[month]) {
		for (b = startspaces;b<7;b++) {
			linktrue=false;
			if (count <= daysInMonth[month]) {
				if((count == this.inputDay && month == this.inputMonth && year == this.inputYear))
					dateStr = dateStr + "<td align='center' valign='middle' class='selpublicdt' >"+count+"</td>";
				else if  (  (year > this.stopYear)
						 || (month > this.stopMonth && year == this.stopYear)
						 || (count > this.stopDay && month == this.stopMonth && year == this.stopYear)
						 )
					dateStr = dateStr + "<td align='center' valign='middle' class='nodate'>"+count+"</td>";
				else if  (  (year < this.startYear)
						 || (month < this.startMonth && year == this.startYear)
						 || (count < this.startDay && month == this.startMonth && year == this.startYear)
						 )
					dateStr = dateStr + "<td align='center' valign='middle' class='nodate'>"+count+"</td>";
				else
				{
					//condition later than today and before year from now				
					if(count == this.currDay && month == this.currMonth && year == this.currYear)
						dateStr = dateStr + "<td align='center' valign='middle' class='publictoday'>";
					else					
						dateStr = dateStr + "<td align='center' valign='middle' class='publicdate'>";
					dateStr = dateStr + "<a class=\"publicdate\" onmouseover=\"style.cursor='hand';\" onclick=\"javascript:wp.SetDate(" + month + "," + count + "," + year + ");\">";
					dateStr = dateStr + count;						
					dateStr = dateStr + "</a></td>";
				}
			}
			else
			 dateStr = dateStr + "<td align='center' valign='middle' class='nodate'></td>";
			count++;
		}
		dateStr = dateStr + "</tr>";
		if (count <= daysInMonth[month]) 
			dateStr = dateStr + "<tr>";
		startspaces=0;
	}

	calStr = "<table border=0 cellpadding=0 cellspacing=0><tr><td>"+calHdrStr+"</td></tr>";
	calStr = calStr+"<tr><td> <table border=0 cellpadding=1 cellspacing=0 width=100%>";
	calStr = calStr+dayHdrStr+dateStr+"</td></tr></table>";
	cmCalStr = calStr+"";
	//end building current month
		
	//start building next month
	
	calHdrStr = "<table border=0 cellpadding=0 cellspacing=0 width=100%>";;
	calHdrStr = calHdrStr + "<tr height=20 class=calpublichdr valign=middle>"

	if (month==11){ 
	    month2 = 0;
	    year2 = year+1; 
	}
	else { 
	    month2 = month+1;
	    year2 = year;
	}
	calHdrStr = calHdrStr + "<td colspan=5 align='center' class='publicmonth' nowrap>" + monthnames[month2] + " " + year2 + "</td>";		
	var firstOfMonth2 = new Date (year2, month2, 1);
	var startspaces2  = firstOfMonth2.getDay();
	
	if (this.stopYear == year2 && month2 == this.stopMonth + 1){
		calHdrStr = calHdrStr + "<td class='day'>&nbsp;</td></tr>";
	}
	else {
		calHdrStr = calHdrStr + "<td class='day'><a onmouseover=\"style.cursor='hand';\" onclick=\"javascript:wp.makePublicCal("+month2+"," + year2 +",wf);\"><img src=\"../../../../web/images/internal/next.gif\" border=\"0\" alt=\"\"></a></td></tr>";
						
	}
	calHdrStr = calHdrStr + "</table>";
	dateStr = "<tr>";
	for (s=0;s<startspaces2;s++) {
		dateStr = dateStr+"<td class='publicdate'>&nbsp;</td>";
	}

	count=1;
	while (count <= daysInMonth[month2]) {
		for (b = startspaces2;b<7;b++) {
			linktrue=false;
			if (count <= daysInMonth[month2]) {
				if((count == this.inputDay && month2 == this.inputMonth && year2 == this.inputYear))
					dateStr = dateStr + "<td align='center' valign='middle' class='selpublicdt' >"+count+"</td>";
				else if  (  (year2 > this.stopYear)
						 || (month2 > this.stopMonth && year2 == this.stopYear)
						 || (count > this.stopDay && month2 == this.stopMonth && year2 == this.stopYear)
						 )
					dateStr = dateStr + "<td align='center' valign='middle' class='nodate'>"+count+"</td>";
				else if  (  (year2 < this.startYear)
						 || (month2 < this.startMonth && year2 == this.startYear)
						 || (count < this.startDay && month2 == this.startMonth && year2 == this.startYear)
						 )
					dateStr = dateStr + "<td align='center' valign='middle' class='nodate'>"+count+"</td>";
				else{
					if(count == this.currDay && month2 == this.currMonth && year2 == this.currYear)
						dateStr = dateStr + "<td align='center' valign='middle' class='publictoday'>";
					else
						dateStr = dateStr + "<td align='center' valign='middle' class='publicdate'>";
					dateStr = dateStr + "<a class=\"publicdate\" onmouseover=\"style.cursor='hand';\" onclick=\"javascript:wp.SetDate(" + month2 + "," + count + "," + year2 + ");\">";
					dateStr = dateStr + count;						
					dateStr = dateStr + "</a></td>";
				}
			}
			else
			 dateStr = dateStr + "<td align='center' valign='middle' class='nodate'></td>";
			count++;
		}
		dateStr = dateStr + "</tr>";
		if (count <= daysInMonth[month2]) 
			dateStr = dateStr + "<tr>";
		startspaces2=0;
	}
	
	calStr = "<table border=0 cellpadding=0 cellspacing=0><tr><td>"+calHdrStr+"</td></tr>";
	calStr = calStr+"<tr><td> <table border=0 cellpadding=1 cellspacing=0 width=100%>";
	calStr = calStr+dayHdrStr+dateStr+"</td></tr></table>";
	nmCalStr = calStr + "";
	//end building next month
	
	closeLinkHTMLStr = "<a class=publicdate onmouseover=\"style.cursor='hand';\" onclick=\"javascript:wp.hideCal();\"> close </a>";		
	if (ns){
		// For NS6
		this.IFrameCalDoc.getElementById('closeLink').innerHTML = closeLinkHTMLStr;
		this.IFrameCalDoc.getElementById('currMonthcal').innerHTML = cmCalStr;
		this.IFrameCalDoc.getElementById('nextMonthCal').innerHTML = nmCalStr;
	}
	else if (ie55dn){
		this.winCal.writeContent(closeLinkHTMLStr,  cmCalStr, nmCalStr);
	}
 	else{
		this.IFrameCalDoc.all.closeLink.innerHTML = closeLinkHTMLStr;
		this.IFrameCalDoc.all.currMonthcal.innerHTML = cmCalStr;
		this.IFrameCalDoc.all.nextMonthCal.innerHTML = nmCalStr;
	}	
}








function SetDate(m,d,y){
	this.selMonth = m+1;
	this.selDay = d;
	this.selYear = y;
  	this.gReturnItemMonth.value = this.selMonth;
  	this.gReturnItemDay.value = this.selDay;
  	this.gReturnItemYear.value = this.selYear;
	this.hideCal();
	return true;
}


function SetDate1(m,d,y,b){
	this.selMonth = m+1;
	this.selDay = d;
	this.selYear = y;
	this.b = b;
  	this.gReturnItemMonth.value = this.selMonth;
  	this.gReturnItemDay.value = this.selDay;
  	this.gReturnItemYear.value = this.selYear;
	var month = null;
	switch (this.selMonth)
	{
        case 1:  month = "January"; break;
        case 2:  month = "February"; break;
        case 3:  month = "March"; break;
        case 4:  month = "April"; break;
        case 5:  month = "May"; break;
        case 6:  month = "June"; break;
        case 7:  month = "July"; break;
        case 8:  month = "August"; break;
        case 9:  month = "September"; break;
        case 10: month = "October"; break;
        case 11: month = "November"; break;
        case 12: month = "December"; break;
    }
    var day = null;
    switch (this.b)
    {
        case 0:  day = "Sunday"; break;
        case 1:  day = "Monday"; break;
        case 2:  day = "Tuesday"; break;
        case 3:  day = "Wednesday"; break;
        case 4:  day = "Thursday"; break;
        case 5:  day = "Friday"; break;
        case 6:  day = "Saturday"; break;
    }

	this.gReturnItemDate.value = day+", "+month+" "+this.selDay+", "+this.selYear;
	this.gReturnPoint.focus();
	this.hideCal();
	return true;
}

function SetDate_shuttlePax(m,d,y,b){
	this.selMonth = m+1;
	this.selDay = d;
	this.selYear = y;
	this.b = b;
  	this.gReturnItemMonth.value = this.selMonth;
  	this.gReturnItemDay.value = this.selDay;
  	this.gReturnItemYear.value = this.selYear;

	this.gReturnItemDate.value = this.selMonth+"/"+this.selDay+"/"+this.selYear;
	this.gReturnPoint.focus();
	this.hideCal();
	return true;
}

function hideCal(){	
	if(ie){
		this.IFrameCal.style.display='none';
	}
	else{
		this.IFrameCal.style.width='0px';
		this.IFrameCal.style.height='0px';
	}
}

function showCal(width,height){
	if(ie){ this.IFrameCal.style.display='block';}
	this.IFrameCal.style.width= width;
	this.IFrameCal.style.height=height;
}

function show_calendar(search, point, itemDay, itemMonth, itemYear){

	// Create todays date
	this.gNow = new Date();

	// get the current day details	
	this.currDay = this.gNow.getDate();
	this.currMonth = this.gNow.getMonth();
	this.currYear = this.gNow.getYear();

	// for netscape only
	if (this.currYear < 1900) this.currYear += 1900;

	// calculate the stop date
	calLength();
	

	// calculate the start day  
	// search cal has 2 year window and non search cal has 1 year window
	if(search == 'false'){	
		this.startDay = this.currDay;
		this.startMonth = this.currMonth;
		this.startYear = this.currYear;
	}
	else{
		this.startDay = this.currDay;
		this.startMonth = this.currMonth;
		this.startYear = this.currYear - 1;
	}

	if (ns || ie4up)
		this.IFrameCal=document.getElementById('CalFrame'); 
	else
		this.IFrameCal=document.frames['CalFrame'];
		
	if (this.IFrameCal.contentDocument) {
    		// For NS6
	    	this.IFrameCalDoc = this.IFrameCal.contentDocument; 
	} else if (this.IFrameCal.contentWindow) {
    		// For IE5.5 and IE6
    		this.IFrameCalDoc = this.IFrameCal.contentWindow.document;
  	} else if (this.IFrameCal.document) {
    		// For IE5
    		this.IFrameCalDoc = this.IFrameCal.document;
	}
	
	this.winCal=window.frames.CalFrame;

	this.gReturnItemDay = itemDay;
	this.gReturnItemMonth = itemMonth;
	this.gReturnItemYear = itemYear;
	
	tmpDay  = itemDay.value;
	tmpMonth  = itemMonth.value;
	tmpYear  = itemYear.value;

	if (tmpMonth == null || tmpDay == null){
		tmpMonth = this.currMonth + 1;
		tmpDay = this.currDay;
		tmpYear  = this.currYear;
	}

	if(tmpMonth <= '9') tmpMonth = '0' + tmpMonth;
	if(tmpDay <= '9') tmpDay = '0' + tmpDay;

	var inputDate = tmpMonth + "/" + tmpDay + "/" + tmpYear;
	
	this.inputMonth = null;
	this.inputDay = null;
	this.inputYear = null;

	// parse and get the input Date
	GetInputDate(inputDate);

	// set the input date to correct date with having some checks
	if (this.inputYear <= this.startYear) {
	
		if((this.inputDay >= this.startDay) && this.inputMonth >= (this.startMonth+1) && (this.inputYear == this.startYear)
			|| (this.inputMonth > (this.startMonth+1) && (this.inputYear == this.startYear))) {
			//do nothing
		}
		else {
//			if(search = 'false')
//				this.inputYear = this.startYear;
//			else	
			this.inputYear = this.startYear + 1;
			this.gReturnItemYear.value = this.inputYear;
		}
	}
	
	if (this.inputYear >= this.stopYear) { 
	
		if((this.inputDay <= this.stopDay) && this.inputMonth <= this.stopMonth+1 && (this.inputYear == this.stopYear)
			|| (this.inputMonth < this.stopMonth+1 && (this.inputYear == this.stopYear))) {
			//do nothing
		}
		else {
			
		  	this.inputYear = this.stopYear - 1;
			this.gReturnItemYear.value = this.inputYear;
		}
	}
	
	this.inputMonth = this.inputMonth - 1;

	// make the calender with current selected month and next month of selected month
	makeCal(this.inputMonth,this.inputYear,this.winCal);

	// display the calender taking browser details into account
	if(browser=="Netscape") 
	{ 
		this.showCal('246px','205px');
	}
	else 
	{
		this.showCal('246px','159px');
	}
	
	var  doc_width = 800, doc_height = 600;
	var eL=0, eT=0,eH=0, eH=0, eW=0, dH=0, dW=0, sT=0, sL=0;
	
	eH=point.offsetHeight;
	eW=point.offsetWidth;
	
	if (ns) {
		doc_width = self.innerWidth;
		doc_height = self.innerHeight;
		sT = self.pageYOffset;
		sL = self.pageXOffset;
		var str = new String(this.IFrameCal.style.height);
		dH=str.substr(0,str.length-2);
		str=new String(this.IFrameCal.style.width)
		dW=str.substr(0,str.length-2);
	}
	else{
		doc_width = document.body.clientWidth;
		doc_height = document.body.clientHeight;
		sT = document.body.scrollTop;
		sL = document.body.scrollLeft;
		dH=this.IFrameCal.style.pixelHeight;
		dW=this.IFrameCal.style.pixelWidth;
	}

	for(var p=point; p&&p.tagName!='BODY'; p=p.offsetParent){
  		eL+=p.offsetLeft;
   		eT+=p.offsetTop;
   	}
	
	var hOffset = parseInt(eT)-parseInt(dH);	
	var wOffset = parseInt(eL)-parseInt(dW);
	
	var sum  = parseInt(eT)+parseInt(eH)+parseInt(dH);
	var sum1 = parseInt(doc_height)+parseInt(sT);

	var wSum=parseInt(eL)+parseInt(dW);
	
	if(hOffset >= sT && sum > sum1)
     	this.IFrameCal.style.top=eT-dH;
   	else
     	this.IFrameCal.style.top=eT+eH;
	
	if( wSum >=	doc_width)
		if(wOffset < 0) this.IFrameCal.style.left = sL;
		else this.IFrameCal.style.left =eL-dW+eW;
	else 
		this.IFrameCal.style.left=eL;
}




function show_public_calendar(search, point, itemDay, itemMonth, itemYear){

	// Create todays date
	this.gNow = new Date();

	// get the current day details	
	this.currDay = this.gNow.getDate();
	this.currMonth = this.gNow.getMonth();
	this.currYear = this.gNow.getYear();

	// for netscape only
	if (this.currYear < 1900) this.currYear += 1900;

	// calculate the stop date
	calLength();
	

	// calculate the start day  
	// search cal has 2 year window and non search cal has 1 year window
	if(search == 'false'){	
		this.startDay = this.currDay;
		this.startMonth = this.currMonth;
		this.startYear = this.currYear;
	}
	else{
		this.startDay = this.currDay;
		this.startMonth = this.currMonth;
		this.startYear = this.currYear - 1;
	}

	if (ns || ie4up)
		this.IFrameCal=document.getElementById('CalFrame'); 
	else
		this.IFrameCal=document.frames['CalFrame'];
		
	if (this.IFrameCal.contentDocument) {
    		// For NS6
	    	this.IFrameCalDoc = this.IFrameCal.contentDocument; 
	} else if (this.IFrameCal.contentWindow) {
    		// For IE5.5 and IE6
    		this.IFrameCalDoc = this.IFrameCal.contentWindow.document;
  	} else if (this.IFrameCal.document) {
    		// For IE5
    		this.IFrameCalDoc = this.IFrameCal.document;
	}
	
	this.winCal=window.frames.CalFrame;

	this.gReturnItemDay = itemDay;
	this.gReturnItemMonth = itemMonth;
	this.gReturnItemYear = itemYear;
	
	tmpDay  = itemDay.value;
	tmpMonth  = itemMonth.value;
	tmpYear  = itemYear.value;

	if (tmpMonth == null || tmpDay == null){
		tmpMonth = this.currMonth + 1;
		tmpDay = this.currDay;
		tmpYear  = this.currYear;
	}

	if(tmpMonth <= '9') tmpMonth = '0' + tmpMonth;
	if(tmpDay <= '9') tmpDay = '0' + tmpDay;

	var inputDate = tmpMonth + "/" + tmpDay + "/" + tmpYear;
	
	this.inputMonth = null;
	this.inputDay = null;
	this.inputYear = null;

	// parse and get the input Date
	GetInputDate(inputDate);

	// set the input date to correct date with having some checks
	if (this.inputYear <= this.startYear) {
	
		if((this.inputDay >= this.startDay) && this.inputMonth >= (this.startMonth+1) && (this.inputYear == this.startYear)
			|| (this.inputMonth > (this.startMonth+1) && (this.inputYear == this.startYear))) {
			//do nothing
		}
		else {
//			if(search = 'false')
//				this.inputYear = this.startYear;
//			else	
			this.inputYear = this.startYear + 1;
			this.gReturnItemYear.value = this.inputYear;
		}
	}
	
	if (this.inputYear >= this.stopYear) { 
	
		if((this.inputDay <= this.stopDay) && this.inputMonth <= this.stopMonth+1 && (this.inputYear == this.stopYear)
			|| (this.inputMonth < this.stopMonth+1 && (this.inputYear == this.stopYear))) {
			//do nothing
		}
		else {
			
		  	this.inputYear = this.stopYear - 1;
			this.gReturnItemYear.value = this.inputYear;
		}
	}
	
	this.inputMonth = this.inputMonth - 1;

	// make the calender with current selected month and next month of selected month
	makePublicCal(this.inputMonth,this.inputYear,this.winCal);

	// display the calender taking browser details into account
	if(browser=="Netscape") 
	{ 
		this.showCal('246px','205px');
	}
	else 
	{
		this.showCal('246px','159px');
	}
	
	var  doc_width = 800, doc_height = 600;
	var eL=0, eT=0,eH=0, eH=0, eW=0, dH=0, dW=0, sT=0, sL=0;
	
	eH=point.offsetHeight;
	eW=point.offsetWidth;
	
	if (ns) {
		doc_width = self.innerWidth;
		doc_height = self.innerHeight;
		sT = self.pageYOffset;
		sL = self.pageXOffset;
		var str = new String(this.IFrameCal.style.height);
		dH=str.substr(0,str.length-2);
		str=new String(this.IFrameCal.style.width)
		dW=str.substr(0,str.length-2);
	}
	else{
		doc_width = document.body.clientWidth;
		doc_height = document.body.clientHeight;
		sT = document.body.scrollTop;
		sL = document.body.scrollLeft;
		dH=this.IFrameCal.style.pixelHeight;
		dW=this.IFrameCal.style.pixelWidth;
	}

	for(var p=point; p&&p.tagName!='BODY'; p=p.offsetParent){
  		eL+=p.offsetLeft;
   		eT+=p.offsetTop;
   	}
	
	var hOffset = parseInt(eT)-parseInt(dH);	
	var wOffset = parseInt(eL)-parseInt(dW);
	
	var sum  = parseInt(eT)+parseInt(eH)+parseInt(dH);
	var sum1 = parseInt(doc_height)+parseInt(sT);

	var wSum=parseInt(eL)+parseInt(dW);
	
	if(hOffset >= sT && sum > sum1)
     	this.IFrameCal.style.top=eT-dH;
   	else
     	this.IFrameCal.style.top=eT+eH;
	
	if( wSum >=	doc_width)
		if(wOffset < 0) this.IFrameCal.style.left = sL;
		else this.IFrameCal.style.left =eL-dW+eW;
	else 
		this.IFrameCal.style.left=eL;
}








function show_calendar1(search, point, itemDay, itemMonth, itemYear, itemDate){
	// Create todays date
	this.gNow = new Date();

	// get the current day details	
	this.currDay = this.gNow.getDate();
	this.currMonth = this.gNow.getMonth();
	this.currYear = this.gNow.getYear();
	this.currDate = this.gNow.getDay()+", " +this.gNow.getMonth()+" "+this.gNow.getDate()+","+this.gNow.getYear();

	// for netscape only
	if (this.currYear < 1900) this.currYear += 1900;

	// calculate the stop date
	calLength();
	

	// calculate the start day  
	// search cal has 2 year window and non search cal has 1 year window
	if(search == 'false'){	
		this.startDay = this.currDay;
		this.startMonth = this.currMonth - 1;
		this.startYear = this.currYear;
	}
	else{
		this.startDay = this.currDay;
		this.startMonth = this.currMonth;
		this.startYear = this.currYear - 1;
	}

	if (ns || ie4up)
		this.IFrameCal=document.getElementById('CalFrame'); 
	else
		this.IFrameCal=document.frames['CalFrame'];
		
	if (this.IFrameCal.contentDocument) {
    		// For NS6
	    	this.IFrameCalDoc = this.IFrameCal.contentDocument; 
	} else if (this.IFrameCal.contentWindow) {
    		// For IE5.5 and IE6
    		this.IFrameCalDoc = this.IFrameCal.contentWindow.document;
  	} else if (this.IFrameCal.document) {
    		// For IE5
    		this.IFrameCalDoc = this.IFrameCal.document;
	}
	
	this.winCal=window.frames.CalFrame;

	this.gReturnItemDay = itemDay;
	this.gReturnItemMonth = itemMonth;
	this.gReturnItemYear = itemYear;
	this.gReturnItemDate = itemDate;
	this.gReturnPoint = point;
	
	tmpDay  = itemDay.value;
	tmpMonth  = itemMonth.value;
	tmpYear  = itemYear.value;
	tmpDate  = itemDate.value;

	if (tmpMonth == null || tmpDay == null){
		tmpMonth = this.currMonth + 1;
		tmpDay = this.currDay;
		tmpYear  = this.currYear;
	}

	if(tmpMonth <= '9') tmpMonth = '0' + tmpMonth;
	if(tmpDay <= '9') tmpDay = '0' + tmpDay;

	var inputDate = tmpMonth + "/" + tmpDay + "/" + tmpYear;
	
	this.inputMonth = null;
	this.inputDay = null;
	this.inputYear = null;

	// parse and get the input Date
	GetInputDate(inputDate);

	// set the input date to correct date with having some checks
	if (this.inputYear <= this.startYear) {
	
		if((this.inputDay >= this.startDay) && this.inputMonth >= (this.startMonth+1) && (this.inputYear == this.startYear)
			|| (this.inputMonth > (this.startMonth+1) && (this.inputYear == this.startYear))) {
			//do nothing
		}
		else {
			
//		  	this.inputYear = this.startYear + 1;
//			this.gReturnItemYear.value = this.inputYear;
			if(search = 'false')
				this.inputYear = this.startYear;
			else	
			  	this.inputYear = this.startYear + 1;
			this.gReturnItemYear.value = this.inputYear;
		}
	}
	
	if (this.inputYear >= this.stopYear) { 
	
		if((this.inputDay <= this.stopDay) && this.inputMonth <= this.stopMonth+1 && (this.inputYear == this.stopYear)
			|| (this.inputMonth < this.stopMonth+1 && (this.inputYear == this.stopYear))) {
			//do nothing
		}
		else {
			
		  	this.inputYear = this.stopYear - 1;
			this.gReturnItemYear.value = this.inputYear;
		}
	}
	
	this.inputMonth = this.inputMonth - 1;

	// make the calender with current selected month and next month of selected month
	makeCal1(this.inputMonth,this.inputYear,this.winCal);

	// display the calender taking browser details into account
	if(browser=="Netscape") 
	{ 
		this.showCal('246px','205px');
	}
	else 
	{
		this.showCal('246px','159px');
	}
	
	var  doc_width = 800, doc_height = 600;
	var eL=0, eT=0,eH=0, eH=0, eW=0, dH=0, dW=0, sT=0, sL=0;
	
	eH=point.offsetHeight;
	eW=point.offsetWidth;
	
	if (ns) {
		doc_width = self.innerWidth;
		doc_height = self.innerHeight;
		sT = self.pageYOffset;
		sL = self.pageXOffset;
		var str = new String(this.IFrameCal.style.height);
		dH=str.substr(0,str.length-2);
		str=new String(this.IFrameCal.style.width)
		dW=str.substr(0,str.length-2);
	}
	else{
		doc_width = document.body.clientWidth;
		doc_height = document.body.clientHeight;
		sT = document.body.scrollTop;
		sL = document.body.scrollLeft;
		dH=this.IFrameCal.style.pixelHeight;
		dW=this.IFrameCal.style.pixelWidth;
	}

	for(var p=point; p&&p.tagName!='BODY'; p=p.offsetParent){
  		eL+=p.offsetLeft;
   		eT+=p.offsetTop;
   	}
	
	var hOffset = parseInt(eT)-parseInt(dH);	
	var wOffset = parseInt(eL)-parseInt(dW);
	
	var sum  = parseInt(eT)+parseInt(eH)+parseInt(dH);
	var sum1 = parseInt(doc_height)+parseInt(sT);

	var wSum=parseInt(eL)+parseInt(dW);
	
	if(hOffset >= sT && sum > sum1)
     	this.IFrameCal.style.top=eT-dH;
   	else
     	this.IFrameCal.style.top=eT+eH;
	
	if( wSum >=	doc_width)
		if(wOffset < 0) this.IFrameCal.style.left = sL;
		else this.IFrameCal.style.left =eL-dW+eW;
	else 
		this.IFrameCal.style.left=eL;
}

function show_calendar_shuttlePax(search, point, itemDay, itemMonth, itemYear, itemDate){
	// Create todays date
	this.gNow = new Date();

	// get the current day details	
	this.currDay = this.gNow.getDate();
	this.currMonth = this.gNow.getMonth();
	this.currYear = this.gNow.getYear();
	this.currDate = this.gNow.getDay()+", " +this.gNow.getMonth()+" "+this.gNow.getDate()+","+this.gNow.getYear();

	// for netscape only
	if (this.currYear < 1900) this.currYear += 1900;

	// calculate the stop date
	calLength();
	

	// calculate the start day  
	// search cal has 2 year window and non search cal has 1 year window
	if(search == 'false'){	
		this.startDay = this.currDay;
		this.startMonth = this.currMonth - 1;
		this.startYear = this.currYear;
	}
	else{
		this.startDay = this.currDay;
		this.startMonth = this.currMonth;
		this.startYear = this.currYear - 1;
	}

	if (ns || ie4up)
		this.IFrameCal=document.getElementById('CalFrame'); 
	else
		this.IFrameCal=document.frames['CalFrame'];
		
	if (this.IFrameCal.contentDocument) {
    		// For NS6
	    	this.IFrameCalDoc = this.IFrameCal.contentDocument; 
	} else if (this.IFrameCal.contentWindow) {
    		// For IE5.5 and IE6
    		this.IFrameCalDoc = this.IFrameCal.contentWindow.document;
  	} else if (this.IFrameCal.document) {
    		// For IE5
    		this.IFrameCalDoc = this.IFrameCal.document;
	}
	
	this.winCal=window.frames.CalFrame;

	this.gReturnItemDay = itemDay;
	this.gReturnItemMonth = itemMonth;
	this.gReturnItemYear = itemYear;
	this.gReturnItemDate = itemDate;
	this.gReturnPoint = point;
	
	tmpDay  = itemDay.value;
	tmpMonth  = itemMonth.value;
	tmpYear  = itemYear.value;
	tmpDate  = itemDate.value;

	if (tmpMonth == null || tmpDay == null){
		tmpMonth = this.currMonth + 1;
		tmpDay = this.currDay;
		tmpYear  = this.currYear;
	}

	if(tmpMonth <= '9') tmpMonth = '0' + tmpMonth;
	if(tmpDay <= '9') tmpDay = '0' + tmpDay;

	var inputDate = tmpMonth + "/" + tmpDay + "/" + tmpYear;
	
	this.inputMonth = null;
	this.inputDay = null;
	this.inputYear = null;

	// parse and get the input Date
	GetInputDate(inputDate);

	// set the input date to correct date with having some checks
	if (this.inputYear <= this.startYear) {
	
		if((this.inputDay >= this.startDay) && this.inputMonth >= (this.startMonth+1) && (this.inputYear == this.startYear)
			|| (this.inputMonth > (this.startMonth+1) && (this.inputYear == this.startYear))) {
			//do nothing
		}
		else {
			
//		  	this.inputYear = this.startYear + 1;
//			this.gReturnItemYear.value = this.inputYear;
			if(search = 'false')
				this.inputYear = this.startYear;
			else	
			  	this.inputYear = this.startYear + 1;
			this.gReturnItemYear.value = this.inputYear;
		}
	}
	
	if (this.inputYear >= this.stopYear) { 
	
		if((this.inputDay <= this.stopDay) && this.inputMonth <= this.stopMonth+1 && (this.inputYear == this.stopYear)
			|| (this.inputMonth < this.stopMonth+1 && (this.inputYear == this.stopYear))) {
			//do nothing
		}
		else {
			
		  	this.inputYear = this.stopYear - 1;
			this.gReturnItemYear.value = this.inputYear;
		}
	}
	
	this.inputMonth = this.inputMonth - 1;

	// make the calender with current selected month and next month of selected month
	makeCal_shuttlePax(this.inputMonth,this.inputYear,this.winCal);

	// display the calender taking browser details into account
	if(browser=="Netscape") 
	{ 
		this.showCal('246px','205px');
	}
	else 
	{
		this.showCal('246px','159px');
	}
	
	var  doc_width = 800, doc_height = 600;
	var eL=0, eT=0,eH=0, eH=0, eW=0, dH=0, dW=0, sT=0, sL=0;
	
	eH=point.offsetHeight;
	eW=point.offsetWidth;
	
	if (ns) {
		doc_width = self.innerWidth;
		doc_height = self.innerHeight;
		sT = self.pageYOffset;
		sL = self.pageXOffset;
		var str = new String(this.IFrameCal.style.height);
		dH=str.substr(0,str.length-2);
		str=new String(this.IFrameCal.style.width)
		dW=str.substr(0,str.length-2);
	}
	else{
		doc_width = document.body.clientWidth;
		doc_height = document.body.clientHeight;
		sT = document.body.scrollTop;
		sL = document.body.scrollLeft;
		dH=this.IFrameCal.style.pixelHeight;
		dW=this.IFrameCal.style.pixelWidth;
	}

	for(var p=point; p&&p.tagName!='BODY'; p=p.offsetParent){
  		eL+=p.offsetLeft;
   		eT+=p.offsetTop;
   	}
	
	var hOffset = parseInt(eT)-parseInt(dH);	
	var wOffset = parseInt(eL)-parseInt(dW);
	
	var sum  = parseInt(eT)+parseInt(eH)+parseInt(dH);
	var sum1 = parseInt(doc_height)+parseInt(sT);

	var wSum=parseInt(eL)+parseInt(dW);
	
	if(hOffset >= sT && sum > sum1)
     	this.IFrameCal.style.top=eT-dH;
   	else
     	this.IFrameCal.style.top=eT+eH;
	
	if( wSum >=	doc_width)
		if(wOffset < 0) this.IFrameCal.style.left = sL;
		else this.IFrameCal.style.left =eL-dW+eW;
	else 
		this.IFrameCal.style.left=eL;
}

function calLength(){ 
	year = this.gNow.getYear();
	day = this.gNow.getDate();
	
	// for netscape only
	if (year < 1900) year += 1900;

	this.stopMonth = this.gNow.getMonth();    
	this.stopYear = year + 1;
	this.stopDay = (day -1);
}	 

function GetInputDate(inputDate){
  	var l = inputDate.length;

  	if(0 == l) return false;
  	var cSp = '\0';
  	var sSp1 = "";
  	var sSp2 = "";
  	for(var i = 0; i < inputDate.length; i++){
	    	var c = inputDate.charAt(i);
    		if(c == ' ' || isdigit(c)) {
			continue;
		}
	    	else if(cSp == '\0' && (c == '/' || c == '-' || c == '.')){
      			cSp = c;
      			sSp1 = inputDate.substring(i+1,l);
	    	}
    		else if(c == cSp) {
			sSp2 = inputDate.substring(i+1,l);
		}
	    	else if(c != cSp) {
			return false;
		}
  	}
	
  	if(0 == sSp1.length) 
		return false;
  	

	var m;
  	var d;
  	var y; 
  	
    m = atoi(inputDate);
	d = atoi(sSp1);
    if(0 != sSp2.length) 
		y = atoi(sSp2);
  	
  	this.inputMonth = m;
  	this.inputDay = d;
  	this.inputYear = y;

  	return true;
}

function atoi(s){
  	var t = 0;
  	for(var i = 0; i < s.length; i++){
    	var c = s.charAt(i);
    	if(!isdigit(c)) 
			return t;
    	else 
			t = t*10 + (c-'0');
  	}
  	return t;
}

function isdigit(c) {
	return(c >= '0' && c <= '9');
}




