var browserType;

if (document.layers) {browserType = "nn4"}
if (document.all) {browserType = "ie"}
if (window.navigator.userAgent.toLowerCase().match("gecko")) {browserType= "gecko"}

if (document.implementation && document.implementation.createDocument) {
	xmlDoc = document.implementation.createDocument("", "", null);
	var B="MOZ";
}
	
if (window.ActiveXObject) {
	xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
	var B="IE";
}

xmlDoc.async=false;

function getTimes(thisDate, thisTimeZone, thisOption) {
	xmlDoc.load("js/timeLookup.asp?tz=-"+thisTimeZone +"&dt="+thisDate);
	var theTimes=xmlDoc.getElementsByTagName("time");
	thisOption.options.length=0;
	thisOption.options[0] = new Option('[Select a Time]', "");
	for(var i=0; i < theTimes.length; i++) { 
		thisOption.options[i+1]= new Option(theTimes[i].getElementsByTagName("text")[0].childNodes[0].nodeValue,theTimes[i].getElementsByTagName("value")[0].childNodes[0].nodeValue);
	}

}

function doTimes(){
	if (document.forms.theForm.contactDate.selectedIndex > 0 && document.forms.theForm.contactTimeZone.selectedIndex > 0) { 
		getTimes(document.forms.theForm.contactDate.options[document.forms.theForm.contactDate.selectedIndex].value, document.forms.theForm.contactTimeZone.options[document.forms.theForm.contactTimeZone.selectedIndex].value, document.forms.theForm.contactTime);
		document.forms.theForm.contactTime.disabled=false; 
	}
}

function checkContactTimeZone() {
	if (document.forms.theForm.contactTimeZone.selectedIndex == 0) {
		document.forms.theForm.contactTime.selectedIndex=0;
		document.forms.theForm.contactTime.disabled=true;
	}
	doTimes();
}

function checkContactDate() {
	if (document.forms.theForm.contactDate.selectedIndex > 0) {
		document.forms.theForm.contactTimeZone.disabled=false; 
		//document.forms.theForm.contactTimeZone.selectedIndex=document.forms.theForm.timeZone.value;
	} else {
		document.forms.theForm.contactTimeZone.selectedIndex=0;
		document.forms.theForm.contactTimeZone.disabled=true;
		document.forms.theForm.contactTime.selectedIndex=0;
		document.forms.theForm.contactTime.disabled=true;
	}
	doTimes();
}

