function AddServiceFormSubmit() {
	var myForm = document.forms['AddServiceForm'];

	var myName = trim(myForm.newService.value);

	if (myName.length == 0) {
		alert("You must specify the service name.");
		myForm.newService.focus();
	} else {
		//alert("Submit");
		myForm.submit();
	}
}

function ModifyServiceFormSubmit() {
	var myForm = document.forms['ModifyServiceForm'];
	
	var myName = trim(myForm.modifyStatus.value);
	
	if (myName.length == 0) {
		alert("You must specify the status.");
		myForm.modifyStatus.focus();
	} else {
		//alert("Submit");
		myForm.submit();
	}
}

function AddListingFormSubmit() {
	var myForm = document.forms['AddListingForm'];

	var myName = trim(myForm.newName.value);

	if (myName.length == 0) {
		alert("You must specify the listing name.");
		myForm.newName.focus();
	} else if (myForm.country.value == "") {
		alert("You must specify the country.");
		myForm.country.focus();
	} else {
		//alert("Submit");
		ae_onSubmit();
		if(myForm.list2 == "[object]")
			selectAllOptions(myForm.list2);

		if(myForm.list2a == "[object]")
			selectAllOptions(myForm.list2a);

		selectAllOptions(myForm.list4);
		myForm.submit();
	}
}

function ModifyListingFormSubmit() {
	var myForm = document.forms['ModifyListingForm'];
	
	var myName = trim(myForm.modifyName.value);
	
	if (myName.length == 0) {
		alert("You must specify the listing name.");
		myForm.modifyName.focus();
	} else if (myForm.country.value == "") {
		alert("You must specify the country.");
		myForm.country.focus();
	} else {
		ae_onSubmit();

		if(myForm.list2 == "[object]")
			selectAllOptions(myForm.list2);
			
		if(myForm.list2a == "[object]")
			selectAllOptions(myForm.list2a);

		selectAllOptions(myForm.list4);
		myForm.submit();
	}
}

function AddEventFormSubmit() {
	var myForm = document.forms['AddEventForm'];

	var myName = trim(myForm.newName.value);

	if (myName.length == 0) {
		alert("You must specify the event name.");
		myForm.newName.focus();
	} else if (myForm.country.value == "") {
		alert("You must specify the country.");
		myForm.country.focus();
	} else {
		//alert("Submit");
		ae_onSubmit();
		selectAllOptions(myForm.list2);
		myForm.submit();
	}
}

function ModifyEventFormSubmit() {
	var myForm = document.forms['ModifyEventForm'];
	
	var myName = trim(myForm.modifyName.value);
	
	if (myName.length == 0) {
		alert("You must specify the event name.");
		myForm.modifyName.focus();
	} else {
		ae_onSubmit();
		selectAllOptions(myForm.list2);
		myForm.submit();
	}
}

function AddEventTypeFormSubmit() {
	var myForm = document.forms['AddEventTypeForm'];

	var myName = trim(myForm.newEventType.value);

	if (myName.length == 0) {
		alert("You must specify the event type name.");
		myForm.newEventType.focus();
	} else {
		//alert("Submit");
		myForm.submit();
	}
}

function ModifyEventTypeFormSubmit() {
	var myForm = document.forms['ModifyEventTypeForm'];

	var myName = trim(myForm.modifyStatus.value);

	if (myName.length == 0) {
		alert("You must specify the event type name.");
		myForm.modifyStatus.focus();
	} else {
		//alert("Submit");
		myForm.submit();
	}
}

function CloseAllWindows () {
	return;
}

function setAllInVisible()
{
	document.getElementById("listbox1").style.display = "none";
	document.getElementById("listbox2").style.display = "none";
	document.getElementById("listbox3").style.display = "none";
	document.getElementById("listbox4").style.display = "none";
	document.getElementById("listbox5").style.display = "none";
	document.getElementById("listbox6").style.display = "none";
	document.getElementById("non_selected").style.display = "none";
	document.getElementById("controls").style.display = "none";
	document.getElementById("controls_usa").style.display = "none";
	document.getElementById("controls_ireland").style.display = "none";
}

function setAllInVisibleUser()
{
	document.getElementById("listbox1").style.display = "none";
	document.getElementById("listbox2").style.display = "none";
	document.getElementById("service").style.display = "none";
	document.getElementById("service_title").style.display = "none";
}

function loadIt(option)
{
	if(option == "United States")
	{
		document.getElementById("listbox1").style.display = "block";
		document.getElementById("listbox2").style.display = "none";
		document.getElementById("listbox3").style.display = "none";
		document.getElementById("listbox4").style.display = "block";

		if(AddListingForm.list2a != "[object]")
		{
			// Delete them from original
			for (var i=(AddListingForm.list2.options.length-1); i>=0; i--)
			{
				//var o = AddListingForm.list2.options[i];
				//AddListingForm.list2.options[i] = null;
				moveAllOptions(document.AddListingForm.list2, document.AddListingForm.list1a, true, document.AddListingForm.movepattern1.value);
			}
		}
		else
		{
			// Delete them from original
			for (var i=(AddListingForm.list2a.options.length-1); i>=0; i--)
			{
				//var o = AddListingForm.list2a.options[i];
				//AddListingForm.list2a.options[i] = null;
				moveAllOptions(document.AddListingForm.list2a, document.AddListingForm.list1a, true, document.AddListingForm.movepattern1.value);
			}
		}

		document.getElementById("listbox5").style.display = "none";
		document.getElementById("listbox6").style.display = "none";
		document.getElementById("controls").style.display = "block";
		document.getElementById("controls_usa").style.display = "block";
		document.getElementById("controls_ireland").style.display = "none";
		document.getElementById("non_selected").style.display = "block";
		document.all["state_region"].innerText = "State";
	}
	else if(option == "Ireland")
	{
		document.getElementById("listbox1").style.display = "none";
		document.getElementById("listbox2").style.display = "block";
		document.getElementById("listbox3").style.display = "none";
		document.getElementById("listbox4").style.display = "block";

		if(AddListingForm.list2a != "[object]")
		{
			// Delete them from original
			for (var i=(AddListingForm.list2.options.length-1); i>=0; i--)
			{
				//var o = AddListingForm.list2.options[i];
				//AddListingForm.list2.options[i] = null;
				moveAllOptions(document.AddListingForm.list2, document.AddListingForm.list1, true, document.AddListingForm.movepattern1.value);
			}
		}
		else
		{
			// Delete them from original
			for (var i=(AddListingForm.list2a.options.length-1); i>=0; i--)
			{
				//var o = AddListingForm.list2a.options[i];
				//AddListingForm.list2a.options[i] = null;
				moveAllOptions(document.AddListingForm.list2a, document.AddListingForm.list1, true, document.AddListingForm.movepattern1.value);
			}
		}

		document.getElementById("listbox5").style.display = "block";
		document.getElementById("listbox6").style.display = "none";
		document.getElementById("controls").style.display = "block";
		document.getElementById("controls_usa").style.display = "none";
		document.getElementById("controls_ireland").style.display = "block";
		document.getElementById("non_selected").style.display = "block";
		document.all["state_region"].innerText = "County";
	}
	else
	{
		document.getElementById("listbox1").style.display = "none";
		document.getElementById("listbox2").style.display = "none";
		document.getElementById("listbox3").style.display = "none";
		document.getElementById("listbox4").style.display = "none";
		document.getElementById("listbox5").style.display = "none";
		document.getElementById("listbox6").style.display = "none";
		document.getElementById("controls").style.display = "none";
		document.getElementById("controls_usa").style.display = "none";
		document.getElementById("controls_ireland").style.display = "none";
		document.getElementById("non_selected").style.display = "none";
		document.all["state_region"].innerText = "";								
	}
}

function loadItNeutral(option)
{
	if(option == "United States")
	{
		document.getElementById("listbox1").style.display = "block";
		document.getElementById("listbox2").style.display = "none";
		document.getElementById("listbox3").style.display = "none";
		document.getElementById("listbox4").style.display = "block";
		document.getElementById("listbox5").style.display = "none";
		document.getElementById("listbox6").style.display = "none";
		document.getElementById("controls").style.display = "block";
		document.getElementById("controls_usa").style.display = "block";
		document.getElementById("controls_ireland").style.display = "none";
		document.getElementById("non_selected").style.display = "block";
		document.all["state_region"].innerText = "State";
	}
	else if(option == "Ireland")
	{
		document.getElementById("listbox1").style.display = "none";
		document.getElementById("listbox2").style.display = "block";
		document.getElementById("listbox3").style.display = "none";
		document.getElementById("listbox4").style.display = "block";
		document.getElementById("listbox5").style.display = "block";
		document.getElementById("listbox6").style.display = "none";
		document.getElementById("controls").style.display = "block";
		document.getElementById("controls_usa").style.display = "none";
		document.getElementById("controls_ireland").style.display = "block";
		document.getElementById("non_selected").style.display = "block";
		document.all["state_region"].innerText = "County";
	}
	else
	{
		document.getElementById("listbox1").style.display = "none";
		document.getElementById("listbox2").style.display = "none";
		document.getElementById("listbox3").style.display = "none";
		document.getElementById("listbox4").style.display = "none";
		document.getElementById("listbox5").style.display = "none";
		document.getElementById("listbox6").style.display = "none";
		document.getElementById("controls").style.display = "none";
		document.getElementById("controls_usa").style.display = "none";
		document.getElementById("controls_ireland").style.display = "none";
		document.getElementById("non_selected").style.display = "none";
		document.all["state_region"].innerText = "";								
	}
}

function loadItUser(option)
{
	if(option == "United States")
	{
		document.getElementById("listbox1").style.display = "block";
		document.getElementById("listbox2").style.display = "none";
		document.all["state_region"].innerText = "State";
	}
	else if(option == "Ireland")
	{
		document.getElementById("listbox1").style.display = "none";
		document.getElementById("listbox2").style.display = "block";
		document.all["state_region"].innerText = "County";
	}
	else
	{
		document.getElementById("listbox1").style.display = "none";
		document.getElementById("listbox2").style.display = "none";
		document.all["state_region"].innerText = "";								
	}
}

function loadIt_view3(option)
{
	if(option == "United States")
	{
		document.getElementById("listbox1").style.display = "block";
		document.getElementById("listbox2").style.display = "none";
		document.getElementById("listbox3").style.display = "none";
		document.getElementById("listbox4").style.display = "block";

		if(ModifyListingForm.list2a != "[object]")
		{
			// Delete them from original
			for (var i=(ModifyListingForm.list2.options.length-1); i>=0; i--)
			{
				//var o = ModifyListingForm.list2.options[i];
				//ModifyListingForm.list2.options[i] = null;
				moveAllOptions(document.ModifyListingForm.list2, document.ModifyListingForm.list1a, true, document.ModifyListingForm.movepattern1.value);
			}
		}
		else
		{
			// Delete them from original
			for (var i=(ModifyListingForm.list2a.options.length-1); i>=0; i--)
			{
				//var o = ModifyListingForm.list2a.options[i];
				//ModifyListingForm.list2a.options[i] = null;
				moveAllOptions(document.ModifyListingForm.list2a, document.ModifyListingForm.list1a, true, document.ModifyListingForm.movepattern1.value);
			}
		}

		document.getElementById("listbox5").style.display = "none";
		document.getElementById("listbox6").style.display = "none";
		document.getElementById("controls").style.display = "block";
		document.getElementById("controls_usa").style.display = "block";
		document.getElementById("controls_ireland").style.display = "none";
		document.getElementById("non_selected").style.display = "block";
		document.all["state_region"].innerText = "State";
	}
	else if(option == "Ireland")
	{
		document.getElementById("listbox1").style.display = "none";
		document.getElementById("listbox2").style.display = "block";
		document.getElementById("listbox3").style.display = "none";
		document.getElementById("listbox4").style.display = "block";

		if(ModifyListingForm.list2a != "[object]")
		{
			// Delete them from original
			for (var i=(ModifyListingForm.list2.options.length-1); i>=0; i--)
			{
				//var o = ModifyListingForm.list2.options[i];
				//ModifyListingForm.list2.options[i] = null;
				moveAllOptions(document.ModifyListingForm.list2, document.ModifyListingForm.list1, true, document.ModifyListingForm.movepattern1.value);
			}
		}
		else
		{
			// Delete them from original
			for (var i=(ModifyListingForm.list2a.options.length-1); i>=0; i--)
			{
				//var o = ModifyListingForm.list2a.options[i];
				//ModifyListingForm.list2a.options[i] = null;
				moveAllOptions(document.ModifyListingForm.list2a, document.ModifyListingForm.list1, true, document.ModifyListingForm.movepattern1.value);
			}
		}

		document.getElementById("listbox5").style.display = "none";
		document.getElementById("listbox6").style.display = "none";
		document.getElementById("controls").style.display = "block";
		document.getElementById("controls_usa").style.display = "none";
		document.getElementById("controls_ireland").style.display = "block";
		document.getElementById("non_selected").style.display = "block";
		document.all["state_region"].innerText = "County";
	}
	else
	{
		document.getElementById("listbox1").style.display = "none";
		document.getElementById("listbox2").style.display = "none";
		document.getElementById("listbox3").style.display = "block";
		document.getElementById("listbox4").style.display = "none";
		document.getElementById("listbox5").style.display = "none";
		document.getElementById("listbox6").style.display = "block";
		document.getElementById("controls").style.display = "block";
		document.getElementById("controls_usa").style.display = "none";
		document.getElementById("controls_ireland").style.display = "none";
		document.getElementById("non_selected").style.display = "block";
		document.all["state_region"].innerText = "";								
	}
}

function SortAllHeaders(mySort) {
	var formFlag = 0;
	
	if (document.all) {
		myForm = document.forms['SortForm'];
		formFlag = 1;
	} else if (document.getElementById) {
		myForm = document.forms['SortForm'];
		formFlag = 1;
	}
	
	if (formFlag == 1) {
		myForm.sort.value = mySort;
		myForm.submit();	
	}
}

function SearchFormSubmit() {
	var myForm;
	var formFlag = 0;
	
	// Set form variable
	if (document.all) {
		myForm = document.forms['SearchForm'];
		formFlag = 1;
	}
	else if (document.getElementById) {
		myForm = document.forms['SearchForm'];
		formFlag = 1;
	}

	// Submit form
	if (formFlag == 1) {
		myForm.submit();
	}
}

function pass_right()
{
	if (document.getElementById("listbox1").style.display == "none")
	{
		moveSelectedOptions(document.AddListingForm.list1a, document.AddListingForm.list2, true, document.AddListingForm.movepattern1.value);
	}
	else if(document.getElementById("listbox2").style.display == "none")
	{
		moveSelectedOptions(document.AddListingForm.list1, document.AddListingForm.list2, true, document.AddListingForm.movepattern1.value);
	}
}

function pass_all_right()
{
	if (document.getElementById("listbox1").style.display == "none")
	{
		moveAllOptions(document.AddListingForm.list1a, document.AddListingForm.list2, true, document.AddListingForm.movepattern1.value);
	}
	else if(document.getElementById("listbox2").style.display == "none")
	{
		moveAllOptions(document.AddListingForm.list1, document.AddListingForm.list2, true, document.AddListingForm.movepattern1.value);
	}
}

function pass_left()
{
	if (document.getElementById("listbox1").style.display == "none")
	{
		moveSelectedOptions(document.AddListingForm.list2, document.AddListingForm.list1a, true, document.AddListingForm.movepattern1.value);
	}
	else if(document.getElementById("listbox2").style.display == "none")
	{
		moveSelectedOptions(document.AddListingForm.list2, document.AddListingForm.list1, true, document.AddListingForm.movepattern1.value);
	}
}

function pass_all_left()
{
	if (document.getElementById("listbox1").style.display == "none")
	{
		moveAllOptions(document.AddListingForm.list2, document.AddListingForm.list1a, true, document.AddListingForm.movepattern1.value);
	}
	else if(document.getElementById("listbox2").style.display == "none")
	{
		moveAllOptions(document.AddListingForm.list2, document.AddListingForm.list1, true, document.AddListingForm.movepattern1.value);
	}
}

function pass_right_usa(option, country)
{
	if(country == "United States")
	{
		if(option == "United States")
		{
			moveSelectedOptions(document.ModifyListingForm.list1, document.ModifyListingForm.list2, true, document.ModifyListingForm.movepattern1.value);
		}
		else
		{
			moveSelectedOptions(document.ModifyListingForm.list1, document.ModifyListingForm.list2, true, document.ModifyListingForm.movepattern1.value);
		}
	}
	else
	{
		if(option == "United States")
		{
			moveSelectedOptions(document.ModifyListingForm.list1, document.ModifyListingForm.list2a, true, document.ModifyListingForm.movepattern1.value);
		}
		else
		{
			moveSelectedOptions(document.ModifyListingForm.list1, document.ModifyListingForm.list2, true, document.ModifyListingForm.movepattern1.value);
		}
	}
}

function pass_all_right_usa(option, country)
{
	if(country == "United States")
	{
		if(option == "United States")
		{
			moveAllOptions(document.ModifyListingForm.list1, document.ModifyListingForm.list2, true, document.ModifyListingForm.movepattern1.value);
		}
		else
		{
			moveAllOptions(document.ModifyListingForm.list1, document.ModifyListingForm.list2, true, document.ModifyListingForm.movepattern1.value);	
		}
	}
	else
	{
		if(option == "United States")
		{
			moveAllOptions(document.ModifyListingForm.list1, document.ModifyListingForm.list2a, true, document.ModifyListingForm.movepattern1.value);
		}
		else
		{
			moveAllOptions(document.ModifyListingForm.list1, document.ModifyListingForm.list2a, true, document.ModifyListingForm.movepattern1.value);	
		}
	}
}

function pass_left_usa(option, country)
{
	if(country == "United States")
	{
		if(option == "United States")
		{
			moveSelectedOptions(document.ModifyListingForm.list2, document.ModifyListingForm.list1, true, document.ModifyListingForm.movepattern1.value);
		}
		else
		{
			moveSelectedOptions(document.ModifyListingForm.list2, document.ModifyListingForm.list1a, true, document.ModifyListingForm.movepattern1.value);
		}
	}
	else
	{
		if(option == "United States")
		{
			moveSelectedOptions(document.ModifyListingForm.list2a, document.ModifyListingForm.list1, true, document.ModifyListingForm.movepattern1.value);
		}
		else
		{
			moveSelectedOptions(document.ModifyListingForm.list2, document.ModifyListingForm.list1, true, document.ModifyListingForm.movepattern1.value);
		}
	}
}

function pass_all_left_usa(option, country)
{
	if(country == "United States")
	{
		if(option == "United States")
		{
			moveAllOptions(document.ModifyListingForm.list2, document.ModifyListingForm.list1, true, document.ModifyListingForm.movepattern1.value);
		}
		else
		{
			moveAllOptions(document.ModifyListingForm.list2, document.ModifyListingForm.list1, true, document.ModifyListingForm.movepattern1.value);
		}
	}
	else
	{
		if(option == "United States")
		{
			moveAllOptions(document.ModifyListingForm.list2a, document.ModifyListingForm.list1, true, document.ModifyListingForm.movepattern1.value);
		}
		else
		{
			moveAllOptions(document.ModifyListingForm.list2, document.ModifyListingForm.list1, true, document.ModifyListingForm.movepattern1.value);
		}
	}
}

function pass_right_ireland(option, country)
{
	if(country == "United States")
	{
		if(option == "United States")
		{
			moveSelectedOptions(document.ModifyListingForm.list1a, document.ModifyListingForm.list2a, true, document.ModifyListingForm.movepattern1.value);
		}
		else
		{
			moveSelectedOptions(document.ModifyListingForm.list1a, document.ModifyListingForm.list2, true, document.ModifyListingForm.movepattern1.value);
		}
	}
	else
	{
		if(option == "United States")
		{
			moveSelectedOptions(document.ModifyListingForm.list1a, document.ModifyListingForm.list2a, true, document.ModifyListingForm.movepattern1.value);
		}
		else
		{
			moveSelectedOptions(document.ModifyListingForm.list1a, document.ModifyListingForm.list2a, true, document.ModifyListingForm.movepattern1.value);
		}
	}
}

function pass_all_right_ireland(option, country)
{
	if(country == "United States")
	{
		if(option == "United States")
		{
			moveAllOptions(document.ModifyListingForm.list1a, document.ModifyListingForm.list2a, true, document.ModifyListingForm.movepattern1.value);
		}
		else
		{
			moveAllOptions(document.ModifyListingForm.list1a, document.ModifyListingForm.list2, true, document.ModifyListingForm.movepattern1.value);	
		}
	}
	else
	{
		if(option == "United States")
		{
			moveAllOptions(document.ModifyListingForm.list1a, document.ModifyListingForm.list2a, true, document.ModifyListingForm.movepattern1.value);
		}
		else
		{
			moveAllOptions(document.ModifyListingForm.list1a, document.ModifyListingForm.list2a, true, document.ModifyListingForm.movepattern1.value);	
		}
	}
}

function pass_left_ireland(option, country)
{
	if(country == "United States")
	{
		if(option == "United States")
		{
			moveSelectedOptions(document.ModifyListingForm.list2a, document.ModifyListingForm.list1a, true, document.ModifyListingForm.movepattern1.value);
		}
		else
		{
			moveSelectedOptions(document.ModifyListingForm.list2, document.ModifyListingForm.list1a, true, document.ModifyListingForm.movepattern1.value);
		}
	}
	else
	{
		if(option == "United States")
		{
			moveSelectedOptions(document.ModifyListingForm.list2a, document.ModifyListingForm.list1, true, document.ModifyListingForm.movepattern1.value);
		}
		else
		{
			moveSelectedOptions(document.ModifyListingForm.list2a, document.ModifyListingForm.list1a, true, document.ModifyListingForm.movepattern1.value);
		}
	}
}

function pass_all_left_ireland(option, country)
{
	if(country == "United States")
	{
		if(option == "United States")
		{
			moveAllOptions(document.ModifyListingForm.list2a, document.ModifyListingForm.list1a, true, document.ModifyListingForm.movepattern1.value);
		}
		else
		{
			moveAllOptions(document.ModifyListingForm.list2, document.ModifyListingForm.list1a, true, document.ModifyListingForm.movepattern1.value);
		}
	}
	else
	{
		if(option == "United States")
		{
			moveAllOptions(document.ModifyListingForm.list2a, document.ModifyListingForm.list1a, true, document.ModifyListingForm.movepattern1.value);
		}
		else
		{
			moveAllOptions(document.ModifyListingForm.list2a, document.ModifyListingForm.list1a, true, document.ModifyListingForm.movepattern1.value);
		}
	}
}


function IrishCommunitySearchFormSubmit()
{
	//document.IrishCommunitySearchForm.state_region1.value = document.getElementById("state_region").innerText;
	//alert(document.IrishCommunitySearchForm.state_region1.value);
	document.forms['IrishCommunitySearchForm'].submit();
}

function NextClick(myForm, myDir)
{
	if (document.layers) {
		document.layers["MainDiv"].document.forms[myForm].Next.value = myDir;
		document.layers["MainDiv"].document.forms[myForm].submit();
	}
	else {
		document.forms[myForm].Next.value = myDir;
		document.forms[myForm].submit();
	}
}