var popUp = null; 
var pDay;
var pMonth;
var pYear;
var dDay;
var dMonth;
var dYear;
var dCity;
var day;
var month;
var selectedCardIndex;
var frm;



function displayVerifDesc() 
{
	//Get the selected index -> AMEX = 2
	selectedCardIndex = document.MDCreditCardPayment.ddlCardType.selectedIndex;
	
	//if AMEX -> display 4 digit message
	if (selectedCardIndex == 2 ) 
	{
		document.MDCreditCardPayment.lblDesc.value = "The 4 digit number above your card number.";
	}
	else 
	{
	//else -> display 3 digit message
		document.MDCreditCardPayment.lblDesc.value = "The last 3 numbers on the signature panel.";
	}
}

function orig_OpenCalendar(idname, postBack)
{
	popUp = window.open('Calendar.aspx?formname=' + document.forms[0].name + 
		'&id=' + idname + '&selected=' + document.forms[0].elements[idname].value + '&postBack=' + postBack, 
		'popupcal', 
		'width=165,height=208,left=200,top=250');
}
function OpenPickupCalendar(id, postBack)
{	
	GetDates()
	popUp = window.open('Calendar.aspx?formname=CarRes1' + '&day=' + pDay + '&month=' + pMonth + '&year=' + pYear + '&id=' + id + '&postBack=' + postBack, 'popupcal','width=165,height=208,left=200,top=250')
}

function SetPickupDate(newDate, postBack)
{	
	//alert(newDate);
	//date = newDate;
if (!opener.closed)
{
	month = newDate.substring(2,8);
	day = newDate.substring(0,2);
	//alert(day)
	//alert(month)
	DoMonth(month);
	DoDay(day);
	
	//opener.document.CarRes1.CarDatesAndLocation1_ddlPickupMonth.selectedIndex = 0;
	
}
	
	self.close();
	PickupDaySelect_onchange();
	
	//theform.elements[id].value = newDate;
	//if (postBack)
		//__doPostBack(id,'');
}		

function QuoteWindow(QuotePage)
{
	popUp = window.open(QuotePage+'?' + document.forms[0].elements['ddlPickupCity'].value,'_blank','width=600,height=600,left=100,top=100,scrollbars=no,resizable=no, status=no, titlebar=no, toolbar=no'); 
}

function CloseWindow()
{
	self.close();
}


function carWindow(page) 
{ 
window.open(page,'_blank','width=480,height=500,left=100,top=100,scrollbars=yes,resizable=no, status=no, titlebar=no, toolbar=no'); 
} 

function helpWindow(helpDoc) 
{ 
window.open('./Help/' + helpDoc,'_blank','width=600,height=400,left=100,top=100,scrollbars=yes,resizable=yes'); 
} 



function GetDates()
{
	
	pDay = frm.CarDatesAndLocation1_ddlPickupDay.options[frm.CarDatesAndLocation1_ddlPickupDay.selectedIndex].value;
	dDay = frm.CarDatesAndLocation1_ddlDropoffDay.options[frm.CarDatesAndLocation1_ddlDropoffDay.selectedIndex].value;
	pMonth = frm.CarDatesAndLocation1_ddlPickupMonth.options[frm.CarDatesAndLocation1_ddlPickupMonth.selectedIndex].value.substring(0,2);
	pYear = frm.CarDatesAndLocation1_ddlPickupMonth.options[frm.CarDatesAndLocation1_ddlPickupMonth.selectedIndex].value.substring(2,8);
	dMonth = frm.CarDatesAndLocation1_ddlDropoffMonth.options[frm.CarDatesAndLocation1_ddlDropoffMonth.selectedIndex].value.substring(0,2);
	dYear = frm.CarDatesAndLocation1_ddlDropoffMonth.options[frm.CarDatesAndLocation1_ddlDropoffMonth.selectedIndex].value.substring(2,8);
}

function PickupDaySelect_onchange(ctl) {
	
	frm = ctl;
	GetDates()
	
	if(dDay != 0 )
	{
		if ( ( dMonth < pMonth ) && ( dYear == pYear ) || ( pYear > dYear ) )
		{
			frm.CarDatesAndLocation1_ddlDropoffDay.selectedIndex = frm.CarDatesAndLocation1_ddlPickupDay.selectedIndex;
			frm.CarDatesAndLocation1_ddlDropoffMonth.selectedIndex = frm.CarDatesAndLocation1_ddlPickupMonth.selectedIndex;
		}
		else if ( ( dDay < pDay ) && ( dMonth == pMonth ) )
		{
			frm.CarDatesAndLocation1_ddlDropoffDay.selectedIndex = frm.CarDatesAndLocation1_ddlPickupDay.selectedIndex;
		}
	}		
	
}

function PickupCity_onchange(ctl)
{
	frm = ctl
	
	//alert(frm);
	dCity = frm.CarDatesAndLocation1_ddlDropoffCity.options[frm.CarDatesAndLocation1_ddlDropoffCity.selectedIndex].value;
	if (dCity < 0)
	{
		frm.CarDatesAndLocation1_ddlDropoffCity.selectedIndex = frm.CarDatesAndLocation1_ddlPickupCity.selectedIndex;
	}
	
}
function DoDay(d)
{
	for (i=0; i<= opener.document.CarRes1.CarDatesAndLocation1_ddlPickupDay.length; i++)
		{
			if ( opener.document.CarRes1.CarDatesAndLocation1_ddlPickupDay[i].value == document.Calendar.dateChosen.value.substring(0,2))
			{
				opener.document.CarRes1.CarDatesAndLocation1_ddlPickupDay.selectedIndex = i;
				//opener.document.CarRes1.CarDatesAndLocation1_ddlPickupMonth.selectedIndex = eval(document.Calendar.dateChosen.value.substring(2,6))
				break
			}
		}
}

function DoMonth(m)
{
	//alert(document.Calendar.monthChosen.value);
	alert(m);
	for (j=0; j<= opener.document.CarRes1.CarDatesAndLocation1_ddlPickupMonth.length; j++)
				{
				//alert(document.Calendar.monthChosen.value);
				//alert(opener.document.CarRes1.CarDatesAndLocation1_ddlPickupMonth[j].value);
				//	if ( opener.document.CarRes1.CarDatesAndLocation1_ddlPickupMonth[j].value == eval(document.Calendar.monthChosen.value))
					if ( opener.document.CarRes1.CarDatesAndLocation1_ddlPickupMonth[j].value == m)
					{
						opener.document.CarRes1.CarDatesAndLocation1_ddlPickupMonth.selectedIndex = j;
						break
					}
				}
}


<!-- Overture Services, Inc
var pm_tagname = "universalTag.txt";
var pm_tagversion = "1.4";
var pm_accountid = "IKE41461M9VC8M2B78CVG78KJ4";
var pm_scripthost = "srv.perf.overture.com";
var pm_customargs = "";
var pm_querystr = "?" + "ver=" + pm_tagversion + "&aid=" + pm_accountid + pm_customargs;
var pm_tag = "<SCR" + "IPT LANGUAGE='JavaScript' " + "SRC=//" + pm_scripthost + "/collweb/ScriptServlet" + pm_querystr + "></SCR" + "IPT>";
document.write(pm_tag);
// -->



function pop2(page)

{
	window.open("https://secure.kuiconnect.com/kui20/sendform.epl?q=PREST6&info_referringpage="+page,"","toolbar=0,location=0,directories=0,menubar=0,copyhistory=0,status=1,scrollbars=0,width=484,height=360,resizable=no,scrollbars=no");
}
