
function setDefault() {
	var d = new Date();
	y1 = d.getYear();
	if (y1 < 1000) {
		y1 += 1900;
	}
	
	if (document.f1.date_input != null) {
		document.f1.date_input.value = y1 + "-" + (d.getMonth() + 1) + "-" + d.getDate();
	}
	var dpFields = new Array("NUM_PEOPLE", "NUM_EMPLOYEE");
	var sourceV = new Array("1", "2", "3", "4", "5", "6", "7", "8", "9");
	var sourceT = new Array("1", "2", "3", "4", "5", "6", "7", "8", "9");
	getValueSet(dpFields, sourceV, sourceT);
	var dpFields = new Array("NUM_ADULTS");
	var sourceV = new Array("1", "2", "3", "4", "5", "6", "7", "8", "9");
	var sourceT = new Array("1", "2", "3", "4", "5", "6", "7", "8", "9");
	getValueSet(dpFields, sourceV, sourceT);
	var dpFields = new Array("NUM_CHILDREN");
	var sourceV = new Array("0", "1", "2", "3", "4", "5", "6", "7", "8", "9");
	var sourceT = new Array("0", "1", "2", "3", "4", "5", "6", "7", "8", "9");
	getValueSet(dpFields, sourceV, sourceT);
	var dpFields = new Array("NUM_INFANTS");
	var sourceV = new Array("0", "1", "2", "3", "4", "5", "6");
	var sourceT = new Array("0", "1", "2", "3", "4", "5", "6");
	getValueSet(dpFields, sourceV, sourceT);
	var dpFields = new Array("AIRCLASS");
	var sourceV = new Array("E", "C", "F");
	var sourceT = new Array("Economy / Coach", "Business / PremEconomy", "First Class");
	getValueSet(dpFields, sourceV, sourceT);
	var dpFields = new Array("HOTEL");
	var sourceV = new Array("N", "5", "4", "3");
	var sourceT = new Array("No", "Yes 5 Star", "Yes 4 Star", "Yes 3 Star");
	getValueSet(dpFields, sourceV, sourceT);
	var dpFields = new Array("AIRLINE");
	var sourceV = new Array("", "AC", "CA", "MU", "JL", "CX", "BR", "CI", "KE", "UA", "NW");
	var sourceT = new Array("Search All Airlines", "Air Canada", "Air China", "China Eastern Airline", "Japan Airline", "Cathay Pacific Airline", "Eva Airline", "China Airline", "Korea Airline", "United Airline", "Northwest");
	getValueSet(dpFields, sourceV, sourceT);
	var dpFields = new Array("INSURANCE");
	var sourceV = new Array("Yes", "No", "Need more Info");
	var sourceT = new Array("Yes", "No", "Need more Info");
	getValueSet(dpFields, sourceV, sourceT);
	var dpFields = new Array("TITLE");
	var sourceV = new Array("Mr.", "Mrs.", "Miss.");
	var sourceT = new Array("Mr.", "Mrs.", "Miss.");
	getValueSet(dpFields, sourceV, sourceT);
}
function getValueSet(dpFields, sourceV, sourceT) {
	var tmp = "";
	for (var i = 0; i < dpFields.length; i++) {
		var tt = eval("document.f1." + dpFields[i]);
		if (tt != null && tt != "undefined" && tt.type != "hidden") {
			if (tt.length > 0) {
				tmp = tt.options[0].value;
			}
			for (var j = 0; j < sourceV.length; j++) {
				tt.options[j] = new Option(sourceT[j], sourceV[j]);
				if (tmp != "" && tmp == sourceV[j]) {
					tt.selectedIndex = j;
				}
			}
			tt.length = sourceV.length;
		}
	}
}
function checkOneWay(itemID) {
	for (i = 0; i < document.f1.TRIPWAY.length; i++) {
		if (document.f1.TRIPWAY[i].checked) {
			if (document.f1.TRIPWAY[i].value == "One") {
				test.style.visibility = "hidden";
			} else {
				test.style.visibility = "visible";
			}
			if (document.f1.TRIPWAY[i].value == "Mul") {
				document.getElementById(itemID).style.display = "inline";
			} else {
				document.getElementById(itemID).style.display = "none";
			}
		}
	}
}
function codeLookUp(fieldName) {
	var page = "code.html?fieldName=" + fieldName;
	msg = window.open(page, "", "width=600,height=600,toolbar=no,titlebar=no,status=no,menubar=no,top=60,left=360,scrollbars=yes"); 
//msg = window.open(page);
	if (msg.opener == null) {
		msg.opener = self;
	}
}
function getCode(code) {
	var fieldName = getValue(location.search, "fieldName=");
	var result = document.getElementById(code).innerHTML;
	window.parent.opener.document.getElementById(fieldName).value = result;
	self.close();
}
function getValue(str, match) {
	var idx1 = str.indexOf(match, 0);
	if (idx1 < 0) {
		return "";
	}
	var idx2 = str.indexOf("&", idx1 + 1);
	if (idx2 < 0) {
		idx2 = str.length;
	}
	var value = str.substring(idx1 + match.length, idx2);
	return value;
}
function getFileNm(str, match) {
	var idx1 = str.lastIndexOf(match);
	if (idx1 < 0) {
		return "";
	}
	var idx2 = str.indexOf("?", idx1 + 1);
	if (idx2 < 0) {
		idx2 = str.length;
	}
	var value = str.substring(idx1 + match.length, idx2);
	return value;
}
function checkEmail() {
	if (document.f1.EMAIL.value != document.f1.CONEMAIL.value) {
		alert("The email you confirm is not matching with your original typed email");
		return;
	} else {
		document.f1.submit();
	}
}

function mOver(el) {
//if (el.className != "pageclick")
		el.className = "pageon";
}
function mOut(el,pg) {
	if (pg != getValue(location.search, "Id=") && el.className != "pageclick") {
	//if (pg != getValue(location.search, "Id=")) {
		el.className = "page";
	}
	else {
		el.className = "pageclick";
	}

}



function toggleCells(el) {
	rCells = document.getElementsByTagName("td");
	for (var i = 0; i < rCells.length; i++) {
		if (rCells[i].name == "hd" && rCells[i].className != "page") {
			rCells[i].className = "page";
			break;
		}
	}
	el.className = "pageclick";
}
