/* Create a new XMLHttpRequest object to talk to the Web server */
var xmlHttp = false;
/*@cc_on @*/
/*@if (@_jscript_version >= 5)
try {
	xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
	try {
		xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
  	} catch (e2) {
		xmlHttp = false;
	}
}
@end @*/

if (!xmlHttp && typeof XMLHttpRequest != 'undefined') {
  xmlHttp = new XMLHttpRequest();
}
 function callServer() {
	var memState = document.getElementById("memState").value;
	var url = "education_get_city.php?state=" + escape(memState);
	xmlHttp.open("GET", url, true);
	xmlHttp.onreadystatechange = updatePage;
	xmlHttp.send(null);
}
function updatePage() {
  if (xmlHttp.readyState == 4) {
    var response = xmlHttp.responseText;
    document.getElementById("memSearchCity").options.length = 0;
	var responseLines = response.split("\n");
	var i=0;
	var numLines = responseLines.length - 1;
	while (i < numLines) {
		document.getElementById("memSearchCity").options[i] = new Option(responseLines[i], responseLines[i]);
		i++;
	}
  }
}
function changeState(search) {
	var state = document.search.state.options[document.search.state.selectedIndex].value;
	location.href = "search.php?command=search_state&state=" + state + "&search=" + search;
}
function changeStateCity() {
	var state = document.search.state.options[document.search.state.selectedIndex].value;
	location.href = "search.php?command=search_state&search=course&state=" + state;
}
function addSuburb() {
	var suburb = document.search.suburb.options[document.search.suburb.selectedIndex].value;
	var suburbs = document.search.selected_suburbs.value;
	document.search.selected_suburbs.value = suburbs + suburb + ', ';
}
function addCity() {
	var city = document.search.city.options[document.search.city.selectedIndex].value;
	var cities = document.search.selected_cities.value;
	document.search.selected_cities.value = cities + city + ', ';
}
function submitform() {
	document.LoginFormBox.submit();
}
function createContent() {
	var newValue;
	newValue = document.getElementById("memDiscounts").value;
	document.getElementById("discountBox").innerHTML = newValue;
}
function addLogo(page) {
	page = escape(page);
	window.open("profile_add_logo.php?page=" + page, "Add_Logo", "menubar=no,width=430,height=330,toolbar=no,scrollbars=yes");
}
function modifyLogo(page) {
	page = escape(page);
	window.open("profile_modify_logo.php?page=" + page, "Modify_Logo", "menubar=no,width=430,height=480,toolbar=no,scrollbars=yes");
}
function addPhoto(page) {
	page = escape(page);
	window.open("profile_add_photo.php?page=" + page, "Add_Photo", "menubar=no,width=430,height=330,toolbar=no,scrollbars=yes");
}
function addPtPhoto(page) {
	page = escape(page);
	window.open("profile_add_pt_photo.php?page=" + page, "Add_Photo", "menubar=no,width=430,height=330,toolbar=no,scrollbars=yes");
}
function modifyPhoto(photo,page) {
	page = escape(page);
	window.open("profile_modify_photo.php?photo=" + photo + "&page=" + page, "Modify_Photo", "menubar=no,width=430,height=480,toolbar=no,scrollbars=yes");
}
function modifyPtPhoto(page) {
	page = escape(page);
	window.open("profile_modify_pt_photo.php?page=" + page, "Modify_Photo", "menubar=no,width=430,height=480,toolbar=no,scrollbars=yes");
}
function clearSuburbs() {
	document.search.selected_suburbs.value = "";
}
function clearCities() {
	document.search.selected_cities.value = "";
}

function selectRecipient() {
	window.open("profile_select_recipient.php", "Select_Recipient", "menubar=no,width=750,height=620,toolbar=no,scrollbars=yes");
}
function calendarPopup(prefix,thedate) {
	window.open("calendar_popup.php?prefix=" + prefix + "&thedate=" + thedate, "Select_a_Date", "menubar=no,width=189,height=155,toolbar=no,scrollbars=no");
}
function viewPhoto(photo) {
	window.open("profile_view_photo.php?photo=" + photo, "View_Photo", "menubar=no,width=450,height=525,toolbar=no,scrollbars=yes");
}
function viewInvoice(id) {
	window.open("profile_invoice_view.php?id=" + id, "View_Invoice", "menubar=no,width=650,height=500,toolbar=no,scrollbars=yes");
}
function viewInvoiceChq(id) {
	window.open("profile_invoice_view.php?id=" + id + "&cheque=yes", "View_Invoice", "menubar=no,width=650,height=500,toolbar=no,scrollbars=yes");
}
function viewInvoiceEFT(id) {
	window.open("profile_invoice_view.php?id=" + id + "&eft=yes", "View_Invoice", "menubar=no,width=650,height=500,toolbar=no,scrollbars=yes");
}
function payInvoice(id) {
	window.open("profile_invoice_pay.php?id=" + id, "View_Pay", "menubar=no,width=830,height=670,toolbar=no,scrollbars=yes");
}
