// \u00bf = ¿
// \u00c0 = À
// \u00c1 = Á
// \u00c2 = Â
// \u00c3 = Ã
// \u00c4 = Ä
// \u00c5 = Å
// \u00c6 = Æ
// \u00c7 = Ç
// \u00c8 = È
// \u00c9 = É
// \u00ca = Ê
// \u00cb = Ë
// \u00cc = Ì
// \u00cd = Í
// \u00ce = Î
// \u00cf = Ï
// \u00d0 = Ð
// \u00d1 = Ñ
// \u00d2 = Ò
// \u00d3 = Ó
// \u00d4 = Ô
// \u00d5 = Õ
// \u00d6 = Ö
// \u00d7 = ×
// \u00d8 = Ø
// \u00d9 = Ù
// \u00da = Ú
// \u00db = Û
// \u00dc = Ü
// \u00dd = Ý
// \u00de = Þ
// \u00df = ß
// \u00e0 = à
// \u00e1 = á
// \u00e2 = â
// \u00e3 = ã
// \u00e4 = ä
// \u00e5 = å
// \u00e6 = æ
// \u00e7 = ç
// \u00e8 = è
// \u00e9 = é
// \u00ea = ê
// \u00eb = ë
// \u00ec = ì
// \u00ed = í
// \u00ee = î
// \u00ef = ï
// \u00f0 = ð
// \u00f1 = ñ
// \u00f2 = ò
// \u00f3 = ó
// \u00f4 = ô
// \u00f5 = õ
// \u00f6 = ö
// \u00f7 = ÷
// \u00f8 = ø
// \u00f9 = ù
// \u00fa = ú
// \u00fb = û
// \u00fc = ü
// \u00fd = ý
// \u00fe = þ
// \u00ff = ÿ

function changeLanguage(pLanguage)
{
	var lForm = document.general;
	var lOk = ValidateArtistEditForm(document.artistedit);

	if (lOk)
	{
		if (document.keywordsearch && document.keywordsearch.Search && document.keywordsearch.Search.value != 0)
		{
			lForm = document.keywordsearch;
		}
		else if (document.specialisedsearch)
		{
			lForm = document.specialisedsearch;
		}
		else if (document.artistedit)
		{
			lForm = document.artistedit;
		}
		else if (document.registerform)
		{
			lForm = document.registerform;
		}
		if (lForm.OriginPage && lForm.OriginPage.value != 0)
		{
			lForm.Page.value = lForm.OriginPage.value;
		}
		lForm.Language.value = pLanguage;
		lForm.submit();
	}
}

function changePage2(pPageStart, pPage, pAction)
{
	var lForm = document.general;
	var lOk = ValidateArtistEditForm(document.artistedit);

	if (lOk)
	{
		if (!document.artistedit && document.sortedlist)
		{
			lForm = document.sortedlist;
		}
		else if (document.artistedit && (document.artistedit.OriginPage.value == "artistaddartwork" || document.artistedit.OriginPage.value == "artistaddphoto" || document.artistedit.OriginPage.value == "artisteditartwork" || document.artistedit.OriginPage.value == "artistediteventwork" || document.artistedit.OriginPage.value == "artistediteventphoto" || document.artistedit.OriginPage.value == "artisteditnewsphoto" || document.artistedit.OriginPage.value == "artistediteventworks" || document.artistedit.OriginPage.value == "artistediteventphotos" || document.artistedit.OriginPage.value == "artisteditnewsphotos" || document.artistedit.OriginPage.value == "artisteditgallery" || document.artistedit.OriginPage.value == "artistviewgallery" || document.artistedit.OriginPage.value == "artistviewphotos" || document.artistedit.OriginPage.value == "artistviewartwork" || document.artistedit.OriginPage.value == "artistviewphoto") && document.sortedlist)
		{
			lForm = document.sortedlist;
		}
		else if (document.keywordsearch && document.keywordsearch.Search && document.keywordsearch.Search.value != 0)
		{
			lForm = document.keywordsearch;
		}
		else if (document.specialisedsearch)
		{
			lForm = document.specialisedsearch;
		}
		else if (document.artistedit)
		{
			lForm = document.artistedit;
			lForm.Artwork.value = "";
		}
		else
		{
			lForm.Artwork.value = "";
		}
		if (document.specialisedsearch && lForm)
			copySearchCriteria(document.specialisedsearch, lForm);
		lForm.Page.value = pPage;

		lForm.Start.value = pPageStart;
		lForm.Action.value = pAction;
		if (pAction == "delete")
		{
			if (confirm(_RST["DELETE_ITEM"]))
			{
				lForm.submit();
			}
		}
		else
		{
			lForm.submit();
		}
	}
}

function changePage(pPageStart)
{
	var lForm = document.general;
	var lOk = ValidateArtistEditForm(document.artistedit);

	if (lOk)
	{
		if (document.artistedit && (document.artistedit.OriginPage.value == "artisteditartwork" || document.artistedit.OriginPage.value == "artistediteventwork" || document.artistedit.OriginPage.value == "artistediteventphoto" || document.artistedit.OriginPage.value == "artisteditnewsphoto") && document.sortedlist)
		{
			lForm = document.sortedlist;
		}
		else if (document.keywordsearch && document.keywordsearch.Search && document.keywordsearch.Search.value != 0)
		{
			lForm = document.keywordsearch;
		}
		else if (document.specialisedsearch)
		{
			lForm = document.specialisedsearch;
		}
		else if (document.artistedit)
		{
			lForm = document.artistedit;
			lForm.Artwork.value = "";
		}
		else
		{
			lForm.Artwork.value = "";
		}
		if (document.specialisedsearch && lForm)
			copySearchCriteria(document.specialisedsearch, lForm);
		lForm.Start.value = pPageStart;
		lForm.submit();
	}
}

function deleteLogo(pImageId)
{
	var lForm = document.general;
	var lOk = ValidateArtistEditForm(document.artistedit);

	if (lOk)
	{
		if (document.artistedit)
		{
			lForm = document.artistedit;
		}
		lForm.Action.value = ("deletelogo"+pImageId);
		lForm.submit();
	}
}

function loadMembership(pUserType, pAction, pMembership, pRegStep, pPromotionCode)
{
	var lForm = document.general;
	var lOk = ValidateArtistEditForm(document.artistedit);

	if (lOk)
	{
		if (document.artistedit)
		{
			lForm = document.artistedit;
		}
		lForm.Page.value = "membership";
		lForm.UserType.value = pUserType;
		lForm.Membership.value = pMembership;
		lForm.Action.value = pAction;
		if (lForm.PromotionCode)
		{
			lForm.PromotionCode.value = pPromotionCode;
		}
		lForm.RegistrationStep.value = pRegStep;
		lForm.submit();
	}
}

function loadNews(pReleaseId)
{
	var lForm = document.general;
	var lOk = true;

	lForm.Page.value = "news";
	lForm.PressReleaseId.value = pReleaseId;
	lForm.submit();
}

function loadNewsletter(pReleaseId)
{
	var lForm = document.general;
	var lForm = document.general;
	var lOk = ValidateArtistEditForm(document.artistedit);

	if (lOk)
	{
		if (document.artistedit)
		{
			lForm = document.artistedit;
		}

		lForm.Page.value = "newsletter";
		lForm.ReleaseFrom.value = pReleaseId;
		lForm.submit();
	}
}

function loadPage(pPage)
{
	var lForm = document.general;
	var lOk = true;
	if (pPage != "login" && pPage != "memberlogin")
	{
		lOk = ValidateArtistEditForm(document.artistedit);
	}

	if (lOk)
	{
		if (document.keywordsearch && document.keywordsearch.Search && document.keywordsearch.Search.value != 0)
		{
			lForm = document.keywordsearch;
		}
		else if (document.specialisedsearch)
		{
			lForm = document.specialisedsearch;
		}
		else if (document.artistedit)
		{
			lForm = document.artistedit;
		}
		if (pPage == "myaccount")
		{
			lForm.Artist.value = ""
		}
		else if (pPage == "login" || pPage == "memberlogin")
		{
			// don't attempt save on current page for logout or new login
			if (lForm.OriginPage)
			{
				lForm.OriginPage.value = "";
			}
			if (lForm.UserName)
			{
				lForm.UserName.value = "";
			}
			if (lForm.SessionId)
			{
				lForm.SessionId.value = "";
			}
		}
		emptySearchCriteria(lForm);
		lForm.Page.value = pPage;
		lForm.Gallery.value = "";
		lForm.Artist.value = "";
		lForm.SortBy.value = "";
		lForm.Start.value = 0;
		lForm.submit();
	}
}

function loadPageNoSave(pPage)
{
	var lForm = document.general;

	if (document.keywordsearch && document.keywordsearch.Search && document.keywordsearch.Search.value != 0)
	{
		lForm = document.keywordsearch;
	}
	else if (document.specialisedsearch)
	{
		lForm = document.specialisedsearch;
	}
	else if (document.artistedit)
	{
		lForm = document.artistedit;
	}
	else if (document.orderedit)
	{
		lForm = document.orderedit;
	}
	emptySearchCriteria(lForm);
	if (document.specialisedsearch && lForm)
		copySearchCriteria(document.specialisedsearch, lForm);
	if (lForm.OriginPage)
	{
		lForm.OriginPage.value = "";
	}
	lForm.Page.value = pPage;
	lForm.submit();
}

function loadArtistEditDetails(pArtist, pPage)
{
	var lForm = document.artistedit;

	if (document.artistedit && (document.artistedit.OriginPage.value == "artisteditartwork" || document.artistedit.OriginPage.value == "artistediteventwork" || document.artistedit.OriginPage.value == "artisteditgallery" || document.artistedit.OriginPage.value == "artistediteventphoto" || document.artistedit.OriginPage.value == "artisteditnewsphoto") && document.sortedlist)
	{
		lForm = document.sortedlist;
	}
	else if (document.keywordsearch && document.keywordsearch.Search && document.keywordsearch.Search.value != 0)
	{
		lForm = document.keywordsearch;
	}
	else if (document.specialisedsearch)
	{
		lForm = document.specialisedsearch;
	}

	if (ValidateArtistEditForm(document.artistedit))
	{
		lForm.Artist.value = pArtist;
		var lEventId;
		if (lForm.EventId)
		{
			lEventId = lForm.EventId.value;
		}
		// unset any desired fields, except eventid
		emptySearchCriteria(lForm);

		var lPage = lForm.Page;
		if (lForm.OriginPage)
		{
			lPage = lForm.OriginPage;
		}
		if (lPage.value == "artisteditevent" || lPage.value == "artistediteventworks" || lPage.value == "artistediteventwork" || lPage.value == "artistediteventphotos" || lPage.value == "artistediteventphoto" || lPage.value == "artistaddphoto" || pPage == "artisteditevent" || pPage == "artistediteventworks" || pPage == "artistediteventwork" || pPage == "artistediteventphotos" || pPage == "artistediteventphoto" || pPage == "artistaddphoto")
		{
			if (lForm.EventId)
			{
				lForm.EventId.value = lEventId;
			}
		}
		lForm.Page.value = pPage;
		lForm.Start.value = 0;
		lForm.submit();
	}
}

function actionArtistEditDetails(pArtist, pPage, pAction)
{
	var lForm = document.artistedit;

	if (document.keywordsearch && document.keywordsearch.Search && document.keywordsearch.Search.value != 0)
	{
		lForm = document.keywordsearch;
	}
	else if (document.specialisedsearch)
	{
		lForm = document.specialisedsearch;
	}

	if (document.artistedit.Action)
	{
		document.artistedit.Action.value = pAction;
	}
	if (ValidateArtistEditForm(document.artistedit))
	{
		lForm.Artist.value = pArtist;
		lForm.Page.value = pPage;
		lForm.Action.value = pAction;
		lForm.Start.value = 0;
		if (pAction == "delete")
		{
			if (confirm(_RST["DELETE_ITEM"]))
			{
				lForm.submit();
			}
		}
		else
		{
			lForm.submit();
		}
	}
}

function submitOrderDetails(pArtist, pPage)
{
	if (document.orderedit)
	{
		if (confirm(_RST["SEND_ORDER"]))
		{
			document.orderedit.Artist.value = pArtist;
			document.orderedit.Page.value = pPage;
			document.orderedit.Start.value = 0;
			document.orderedit.submit();
		}
	}
}

function loadGalleryArtistPage(pGallery, pArtist, pPage)
{
	var lForm = document.general;
	var lOk = ValidateArtistEditForm(document.artistedit);

	if (lOk)
	{
		if (document.artistedit)
		{
			lForm = document.artistedit;
		}
		lForm.Page.value = pPage;
		lForm.Gallery.value = pGallery;
		lForm.Artist.value = pArtist;
		lForm.Start.value = 0;
		lForm.submit();
	}
}

function loadArtistPage(pArtist, pPage)
{
	var lForm = document.general;
	var lOk = true;
	if (pPage != "login" && pPage != "memberlogin")
	{
		lOk = ValidateArtistEditForm(document.artistedit);
	}

	if (lOk)
	{
		if (document.artistedit)
		{
			lForm = document.artistedit;
		}
		if (pPage == "login" || pPage == "memberlogin")
		{
			// don't attempt save on current page for logout or new login
			if (lForm.OriginPage)
			{
				lForm.OriginPage.value = "";
			}
			if (lForm.UserName)
			{
				lForm.UserName.value = "";
			}
			if (lForm.SessionId)
			{
				lForm.SessionId.value = "";
			}
		}
		emptySearchCriteria(lForm);
		lForm.Page.value = pPage;
/*		lForm.Gallery.value = "";*/
		lForm.Artist.value = pArtist;
		lForm.Start.value = 0;
		lForm.Search.value = "";
		lForm.DoSearch.value = 0;
		lForm.submit();
	}
}

function loadArtists(pGallery, pArtist, pMedium, pTheme)
{
	var lForm = document.general;
	var lOk = ValidateArtistEditForm(document.artistedit);

	if (lOk)
	{
		if (document.artistedit)
		{
			lForm = document.artistedit;
		}
		emptySearchCriteria(lForm);
		lForm.Page.value = "artistlist";
		lForm.Gallery.value = pGallery;
		lForm.Artist.value = pArtist;
		lForm.Medium.value = pMedium;
		lForm.Theme.value = pTheme;
		lForm.SearchLetter.value = "";
		lForm.Search.value = "";
		lForm.SortBy.value = "";
		lForm.Start.value = 0;
		lForm.submit();
	}
}

function loadArtistsAtoZ(pGallery, pArtist, pMedium, pTheme, pSearchLetter)
{
	var lForm = document.general;
	var lOk = ValidateArtistEditForm(document.artistedit);

	if (lOk)
	{
		if (document.artistedit)
		{
			lForm = document.artistedit;
		}
/*		lForm.Page.value = "artistlist";*/
		emptySearchCriteria(lForm);
		lForm.Gallery.value = pGallery;
		lForm.Artist.value = pArtist;
		lForm.Medium.value = pMedium;
		lForm.Theme.value = pTheme;
		lForm.SearchLetter.value = pSearchLetter;
		lForm.Search.value = "";
		lForm.SortBy.value = "";
		lForm.Start.value = 0;
		lForm.submit();
	}
}

function loadArtworksEcards(pGallery, pArtist, pMedium, pTheme)
{
	var lForm = document.general;
	var lOk = ValidateArtistEditForm(document.artistedit);

	if (lOk)
	{
		if (document.artistedit)
		{
			lForm = document.artistedit;
		}
		emptySearchCriteria(lForm);
		lForm.Page.value = "artworks";
		lForm.Gallery.value = pGallery;
		lForm.Artist.value = pArtist;
		lForm.SearchMedium.value = pMedium;
		lForm.SearchTheme.value = pTheme;
		lForm.SearchEcard.value = 1;
		lForm.SortBy.value = "";
		lForm.Search.value = "";
		lForm.Start.value = 0;
		lForm.submit();
	}
}

function loadArtworks(pGallery, pArtist, pMedium, pTheme)
{
	var lForm = document.general;
	var lOk = ValidateArtistEditForm(document.artistedit);

	if (lOk)
	{
		if (document.artistedit)
		{
			lForm = document.artistedit;
		}
		if (pGallery == "ALL" || pArtist == "A" || pArtist == "R" || pArtist == "AR")
		{
			lForm.Page.value = "artworks";
		}
		else
		{
			lForm.Page.value = "artistviewgallery";
		}
		emptySearchCriteria(lForm);
		lForm.Gallery.value = pGallery;
		lForm.Artist.value = pArtist;
		lForm.SearchMedium.value = pMedium;
		lForm.SearchTheme.value = pTheme;
		lForm.Search.value = "";
		lForm.SortBy.value = "";
		lForm.Start.value = 0;
		lForm.DoSearch.value = 0;
		lForm.submit();
	}
}

function loadOrder(pArtist, pOrderId, pPage)
{
	var lForm = document.artistedit;

	if (document.general)
	{
		lForm = document.general;
	}
	else if (document.keywordsearch && document.keywordsearch.Search && document.keywordsearch.Search.value != 0)
	{
		lForm = document.keywordsearch;
	}
	else if (document.specialisedsearch)
	{
		lForm = document.specialisedsearch;
	}

	var lOk = ValidateArtistEditForm(document.artistedit);

	if (lOk)
	{
		if ((lForm.Page.value == "artisteditorders" || lForm.Page.value == "artisteditorder") && (pPage != "artisteditorders"))
		{
			// unset any desired fields
			if (lForm.SortBy) { lForm.SortBy.value = "" }
			if (lForm.SearchFromDate) { lForm.SearchFromDate.value = "" }
			if (lForm.SearchToDate) { lForm.SearchToDate.value = "" }
		}
		emptySearchCriteria(lForm);
		lForm.Artist.value = pArtist;
		if (pArtist == "0" && lForm.Gallery)
		{
			lForm.Gallery.value = 0;
		}
		lForm.Page.value = pPage;
		lForm.OrderId.value = pOrderId;
		if (lForm.PressReleaseId)
		{
			lForm.PressReleaseId.value = "";
		}
		lForm.Start.value = 0;
		lForm.submit();
	}
}

function loadEvent(pArtist, pEventId, pPage)
{
	var lForm = document.artistedit;

	if (document.artistedit && (document.artistedit.OriginPage.value == "artisteditartwork" || document.artistedit.OriginPage.value == "artistediteventwork" || document.artistedit.OriginPage.value == "artistediteventphoto") && document.sortedlist)
	{
		lForm = document.sortedlist;
	}
	else if (document.general)
	{
		lForm = document.general;
	}
	else if (document.keywordsearch && document.keywordsearch.Search && document.keywordsearch.Search.value != 0)
	{
		lForm = document.keywordsearch;
	}
	else if (document.specialisedsearch)
	{
		lForm = document.specialisedsearch;
	}

	var lOk = ValidateArtistEditForm(document.artistedit);

	if (lOk)
	{
		if ((lForm.Page.value == "artisteditevents" || lForm.Page.value == "artisteditevent" || lForm.Page.value == "artistediteventworks" || lForm.Page.value == "artistediteventphotos" || lForm.Page.value == "artistaddevent") && (pPage != "artisteditevents"))
		{
			// unset any desired fields
			if (lForm.SortBy) { lForm.SortBy.value = "" }
			if (lForm.SearchFromDate) { lForm.SearchFromDate.value = "" }
			if (lForm.SearchToDate) { lForm.SearchToDate.value = "" }
			if (lForm.SearchVenueId) { lForm.SearchVenueId.value = "-1" }
		}
		emptySearchCriteria(lForm);
		lForm.Artist.value = pArtist;
		if (pArtist == "0" && lForm.Gallery)
		{
			lForm.Gallery.value = 0;
		}
		lForm.Page.value = pPage;
		lForm.EventId.value = pEventId;
		if (lForm.PressReleaseId)
		{
			lForm.PressReleaseId.value = "";
		}
		lForm.Start.value = 0;
		lForm.submit();
	}
}

function loadPressRelease(pArtist, pPressReleaseId, pPage)
{
	var lForm = document.artistedit;

	if (document.artistedit && document.sortedlist)
	{
		lForm = document.sortedlist;
	}
	else if (document.general)
	{
		lForm = document.general;
	}
	else if (document.keywordsearch && document.keywordsearch.Search && document.keywordsearch.Search.value != 0)
	{
		lForm = document.keywordsearch;
	}
	else if (document.specialisedsearch)
	{
		lForm = document.specialisedsearch;
	}

	var lOk = ValidateArtistEditForm(document.artistedit);

	if (lOk)
	{
		if ((lForm.Page.value == "artisteditpressreleaselist" || lForm.Page.value == "artisteditpressrelease" || lForm.Page.value == "artisteditnewsphotos") && (pPage != "artisteditpressreleaselist"))
		{
			// unset any desired fields
			if (lForm.SortBy) { lForm.SortBy.value = "" }
			if (lForm.SearchFromDate) { lForm.SearchFromDate.value = "" }
			if (lForm.SearchToDate) { lForm.SearchToDate.value = "" }
		}
		emptySearchCriteria(lForm);
		lForm.Artist.value = pArtist;
		if (pArtist == "0" && lForm.Gallery)
		{
			lForm.Gallery.value = 0;
		}
		lForm.Page.value = pPage;
		if (lForm.PressReleaseId)
		{
			lForm.PressReleaseId.value = pPressReleaseId;
		}
		lForm.Start.value = 0;
		lForm.submit();
	}
}

function loadVenueEvents(pArtist, pVenueId, pPage)
{
	var lForm = document.general;
	var lOk = ValidateArtistEditForm(document.artistedit);

	if (lOk)
	{
		if (document.artistedit)
		{
			lForm = document.artistedit;
		}
		emptySearchCriteria(lForm);
		lForm.Page.value = pPage;
		lForm.Artist.value = pArtist;
		lForm.SearchVenueId.value = pVenueId;
		lForm.submit();
	}
}

function copySearchCriteria(fromForm, toForm)
{
	if (fromForm.Artist && toForm.SearchArtist && fromForm.Artist.value != "0" && fromForm.Artist.value != fromForm.Gallery.value) { toForm.SearchArtist.value = "__"+fromForm.Artist.value }
	else if (fromForm.SearchArtist && toForm.SearchArtist) { toForm.SearchArtist.value = fromForm.SearchArtist.value }
	if (fromForm.SearchMedium && toForm.SearchMedium) { toForm.SearchMedium.value = fromForm.SearchMedium.value }
	if (fromForm.SearchTitle && toForm.SearchTitle) { toForm.SearchTitle.value = fromForm.SearchTitle.value }
	if (fromForm.SearchTheme && toForm.SearchTheme) { toForm.SearchTheme.value = fromForm.SearchTheme.value }
	if (fromForm.SearchFromDate && toForm.SearchFromDate) { toForm.SearchFromDate.value = fromForm.SearchFromDate.value }
	if (fromForm.SearchToDate && toForm.SearchToDate) { toForm.SearchToDate.value = fromForm.SearchToDate.value }
	if (fromForm.SearchArtworkStatus && toForm.SearchArtworkStatus) { toForm.SearchArtworkStatus.value = fromForm.SearchArtworkStatus.value }
	if (fromForm.SearchEcard && toForm.SearchEcard) { toForm.SearchEcard.value = fromForm.SearchEcard.value }
	if (fromForm.SearchCommission && toForm.SearchCommission) { toForm.SearchCommission.value = fromForm.SearchCommission.value }
	if (fromForm.SearchCountry && toForm.SearchCountry) { toForm.SearchCountry.value = fromForm.SearchCountry.value }
	if (fromForm.SearchFromPrice && toForm.SearchFromPrice) { toForm.SearchFromPrice.value = fromForm.SearchFromPrice.value }
	if (fromForm.SearchToPrice && toForm.SearchToPrice) { toForm.SearchToPrice.value = fromForm.SearchToPrice.value }
	if (fromForm.SearchNegotiable && toForm.SearchNegotiable) { toForm.SearchNegotiable.value = fromForm.SearchNegotiable.value }
	if (fromForm.SearchFromWidth && toForm.SearchFromWidth) { toForm.SearchFromWidth.value = fromForm.SearchFromWidth.value }
	if (fromForm.SearchFromHeight && toForm.SearchFromHeight) { toForm.SearchFromHeight.value = fromForm.SearchFromHeight.value }
}

function emptySearchCriteria(fromForm)
{
	if (fromForm.EventId) { fromForm.EventId.value = "" }
	if (fromForm.SearchArtist) { fromForm.SearchArtist.value = "" }
	if (fromForm.SearchMedium) { fromForm.SearchMedium.value = "" }
	if (fromForm.SearchTitle) { fromForm.SearchTitle.value = "" }
	if (fromForm.SearchTheme) { fromForm.SearchTheme.value = "" }
	if (fromForm.SearchFromDate) { fromForm.SearchFromDate.value = "" }
	if (fromForm.SearchToDate) { fromForm.SearchToDate.value = "" }
	if (fromForm.SearchArtworkStatus) { fromForm.SearchArtworkStatus.value = "" }
	if (fromForm.SearchEcard) { fromForm.SearchEcard.value = "" }
	if (fromForm.SearchCommission) { fromForm.SearchCommission.value = "" }
	if (fromForm.SearchCountry) { fromForm.SearchCountry.value = "" }
	if (fromForm.SearchFromPrice) { fromForm.SearchFromPrice.value = "" }
	if (fromForm.SearchToPrice) { fromForm.SearchToPrice.value = "" }
	if (fromForm.SearchNegotiable) { fromForm.SearchNegotiable.value = "" }
	if (fromForm.SearchFromWidth) { fromForm.SearchFromWidth.value = "" }
	if (fromForm.SearchFromHeight) { fromForm.SearchFromHeight.value = "" }
}

function actionEvent(pArtist, pEventId, pPage, pAction)
{
	var lForm = document.general;
	var lOk = ValidateArtistEditForm(document.artistedit);

	if (lOk)
	{
		if (document.artistedit)
		{
			lForm = document.artistedit;
		}
		if (document.specialisedsearch && lForm)
			copySearchCriteria(document.specialisedsearch, lForm);
		lForm.Page.value = pPage;
		lForm.Artist.value = pArtist;
		lForm.EventId.value = pEventId;
		lForm.Action.value = pAction;
		if (pAction == "delete")
		{
			if (confirm(_RST["DELETE_ITEM"]))
			{
				lForm.submit();
			}
		}
		else
		{
			lForm.submit();
		}
	}
}

function loadArtwork(pArtist, pMedium, pTheme, pArtwork, pPage)
{
	var lForm = document.general;
	var lOk = ValidateArtistEditForm(document.artistedit);

	if (lOk)
	{
		if (document.artistedit)
		{
			lForm = document.artistedit;
		}
		if (document.specialisedsearch && lForm)
			copySearchCriteria(document.specialisedsearch, lForm);
		lForm.Page.value = pPage;
		lForm.Artist.value = pArtist;
		lForm.SearchMedium.value = pMedium;
		lForm.SearchTheme.value = pTheme;
		lForm.Artwork.value = pArtwork;
		lForm.submit();
	}
}

function actionArtist(pArtist, pPage, pAction)
{
	var lForm = document.general;
	var lOk = ValidateArtistEditForm(document.artistedit);

	if (lOk)
	{
		if (document.artistedit)
		{
			lForm = document.artistedit;
		}
		lForm.Page.value = pPage;
		lForm.Artist.value = pArtist;
		lForm.Action.value = pAction;
		if (pAction == "delete")
		{
			if (confirm(_RST["DELETE_ITEM"]))
			{
				lForm.submit();
			}
		}
		else
		{
			lForm.submit();
		}
	}
}

function actionArtwork(pArtist, pArtwork, pPage, pAction)
{
	var lForm = document.general;
	var lOk = ValidateArtistEditForm(document.artistedit);

	if (lOk)
	{
		if (document.artistedit && (document.artistedit.OriginPage.value == "artisteditartwork" || document.artistedit.OriginPage.value == "artistediteventwork")&& document.sortedlist)
		{
			lForm = document.sortedlist;
		}
		else if (document.artistedit)
		{
			lForm = document.artistedit;
		}
		if (document.specialisedsearch && lForm)
			copySearchCriteria(document.specialisedsearch, lForm);
		lForm.Page.value = pPage;
		lForm.Artist.value = pArtist;
		lForm.Artwork.value = pArtwork;
		lForm.Action.value = pAction;
		if (pAction == "delete")
		{
			if (confirm(_RST["DELETE_ITEM"]))
			{
				lForm.submit();
			}
		}
		else
		{
			lForm.submit();
		}
	}
}

function loadPrevNextArtwork(pArtist, pMedium, pTheme, pArtwork, pPage, pAction)
{
	var lForm = document.general;
	var lOk = ValidateArtistEditForm(document.artistedit);

	if (lOk)
	{
		if (document.artistedit)
		{
			lForm = document.artistedit;
		}
		if (document.specialisedsearch && lForm)
			copySearchCriteria(document.specialisedsearch, lForm);
		lForm.Page.value = pPage;
		lForm.Action.value = pAction;
		lForm.Artist.value = pArtist;
		lForm.Medium.value = pMedium;
		lForm.Theme.value = pTheme;
		lForm.Artwork.value = pArtwork;
		lForm.Search.value = "";
		lForm.SortBy.value = "";
		lForm.Start.value = 0;
		lForm.submit();
	}
}

function negotiatePrice(pArtist, pArtwork)
{
	var lForm = document.general;
	var lOk = ValidateArtistEditForm(document.artistedit);

	if (lOk)
	{
		if (document.artistedit)
		{
			lForm = document.artistedit;
		}
		lForm.Page.value = "artworknegotiateprice";
		lForm.Artist.value = pArtist;
		lForm.Artwork.value = pArtwork;
		lForm.Action.value = "load";
		lForm.Start.value = 0;
		lForm.submit();
	}
}

function sendEcard(pArtist, pArtwork)
{
	var lForm = document.general;
	var lOk = ValidateArtistEditForm(document.artistedit);

	if (lOk)
	{
		if (document.artistedit)
		{
			lForm = document.artistedit;
		}
		lForm.Page.value = "artworksendecard";
		lForm.Artist.value = pArtist;
		lForm.Artwork.value = pArtwork;
		lForm.Action.value = "load";
		lForm.Start.value = 0;
		lForm.submit();
	}
}

function commissionAPiece(pArtist, pArtwork)
{
	var lForm = document.general;
	var lOk = ValidateArtistEditForm(document.artistedit);

	if (lOk)
	{
		if (document.artistedit)
		{
			lForm = document.artistedit;
		}
		lForm.Page.value = "artworkcommission";
		lForm.Artist.value = pArtist;
		lForm.Artwork.value = pArtwork;
		lForm.Action.value = "load";
		lForm.Start.value = 0;
		lForm.submit();
	}
}

function artworkEnquiry(pArtist, pArtwork)
{
	var lForm = document.general;
	var lOk = ValidateArtistEditForm(document.artistedit);

	if (lOk)
	{
		if (document.artistedit)
		{
			lForm = document.artistedit;
		}
		lForm.Page.value = "artworkenquiry";
		lForm.Artist.value = pArtist;
		lForm.Artwork.value = pArtwork;
		lForm.Action.value = "load";
		lForm.Start.value = 0;
		lForm.submit();
	}
}

function actionPressRelease(pArtist, pReleaseId, pPage, pAction)
{
	var lForm = document.general;
	var lOk = ValidateArtistEditForm(document.artistedit);

	if (lOk)
	{
		if (document.artistedit && (document.artistedit.OriginPage.value == "artisteditnewsphoto") && document.sortedlist)
		{
			lForm = document.sortedlist;
		}
		else if (document.artistedit)
		{
			lForm = document.artistedit;
		}
		else if (document.keywordsearch && document.keywordsearch.Search && document.keywordsearch.Search.value != 0)
		{
			lForm = document.keywordsearch;
		}
		else if (document.specialisedsearch)
		{
			lForm = document.specialisedsearch;
		}
		lForm.Page.value = pPage;
		lForm.Artist.value = pArtist;
		lForm.PressReleaseId.value = pReleaseId;
		if (lForm.EventId)
		{
			lForm.EventId.value = "";
		}
		lForm.Action.value = pAction;
		if (pAction == "delete")
		{
			if (confirm(_RST["DELETE_ITEM"]))
			{
				lForm.submit();
			}
		}
		else
		{
			lForm.submit();
		}
	}
}

function payOffline(pCartIndex)
{
	var lCart = "document.offlinecart"+pCartIndex
	var lTheCart = eval(lCart);
	var lOk = ValidateOrderForm(document.orderdetails);

	if (lTheCart && lOk)
	{
		lTheCart.BuyerId.value = document.orderdetails.BuyerId.value;
		lTheCart.Comments.value = document.orderdetails.Comments.value;
		lTheCart.FromEmail.value = document.orderdetails.FromEmail.value;
		lTheCart.FirstName.value = document.orderdetails.FirstName.value;
		lTheCart.Surname.value = document.orderdetails.Surname.value;
		lTheCart.Phone.value = document.orderdetails.Phone.value;
		lTheCart.Mobile.value = document.orderdetails.Mobile.value;
		lTheCart.Address1.value = document.orderdetails.Address1.value;
		lTheCart.Address2.value = document.orderdetails.Address2.value;
		lTheCart.Town.value = document.orderdetails.Town.value;
		lTheCart.PostalArea.value = document.orderdetails.PostalArea.value;
		lTheCart.PostCode.value = document.orderdetails.PostCode.value;
		lTheCart.Country.value = document.orderdetails.Country.value;
		lTheCart.submit();
	}
}

function payCart(pCartIndex)
{
	var lCart = "document.localcart"+pCartIndex
	var lTheCart = eval(lCart);

	var lOk = 1;
	if (document.orderdetails)
	{
		lOk = ValidateOrderForm(document.orderdetails);
	}

	if (lTheCart && lOk)
	{
//alert("all ok, setting custom details");
		if (document.orderdetails)
		{
//alert("FromEmail="+document.orderdetails.FromEmail.value);
//alert("BuyerId="+document.orderdetails.BuyerId.value);
//alert("Comments="+document.orderdetails.Comments.value);
//alert("FirstName="+document.orderdetails.FirstName.value);
//alert("Surname="+document.orderdetails.Surname.value);
//alert("Phone="+document.orderdetails.Phone.value);
//alert("Mobile="+document.orderdetails.Mobile.value);
//alert("Address1="+document.orderdetails.Address1.value);
//alert("Address2="+document.orderdetails.Address2.value);
//alert("Town="+document.orderdetails.Town.value);
//alert("PostalArea="+document.orderdetails.PostalArea.value);
//alert("PostCode="+document.orderdetails.PostCode.value);
//alert("Country="+document.orderdetails.Country.value);
//alert("Language="+document.general.Language.value);
			lTheCart.custom.value = document.orderdetails.FromEmail.value+"|"+document.orderdetails.BuyerId.value+"|"+document.orderdetails.Comments.value+"|"+document.orderdetails.FirstName.value+"|"+document.orderdetails.Surname.value+"|"+document.orderdetails.Phone.value+"|"+document.orderdetails.Mobile.value+"|"+document.orderdetails.Address1.value+"|"+document.orderdetails.Address2.value+"|"+document.orderdetails.Town.value+"|"+document.orderdetails.PostalArea.value+"|"+document.orderdetails.PostCode.value+"|"+document.orderdetails.Country.value+"|"+document.general.Language.value;
		}
//alert("custom details="+lTheCart.custom.value);
		lTheCart.submit();
	}
}

function searchFor(thisForm)
{
	var lForm = thisForm;
	var lOk = ValidateArtistEditForm(document.artistedit);

	if (lOk)
	{
		if (document.artistedit)
		{
			lForm = document.artistedit;
		}
		lForm.Medium.value = "";
		lForm.Theme.value = "";
		lForm.Artwork.value = "";
		lForm.Page.value = "artworks";
		lForm.SortBy.value = "";
		if (thisForm.Search && thisForm.Search.value != 0)
		{
			lForm.Search.value = thisForm.Search.value;
			alert("search for "+lForm.Search.value);
		}
		else
		{
			lForm.Search.value = "";
		}
		lForm.submit();
	}
	return false;
}

function ValidateArtistEditForm(thisForm)
{
	var AlertString=(_RST["OOPS"] + "\n\n" + _RST["PLEASE_ENTER_YOUR_INFORMATION_BELOW"]);
	var ErrorsFound = false;
	var lHavePhone = true;

	if (thisForm)
	{
		if (thisForm.OriginPage.value == "usereditcontact")
		{
			if ((!thisForm.FirstName || thisForm.FirstName.value == 0) && thisForm.Surname.value == 0)
			{
				AlertString += ("\n " + _RST["FIRSTNAME"] + " " + _RST["OR"] + " " + _RST["LASTNAME"]);
				ErrorsFound = true;
			}
			if (thisForm.Email.value == 0){AlertString += ("\n " + _RST["EMAIL"]);ErrorsFound = true;}
			else if (!testEmail(thisForm.Email.value)){AlertString += ("\n " + _RST["EMAIL_NOT_VALID"]);ErrorsFound = true;}
			if (thisForm.Gallery.value == 0 || thisForm.Gallery.value == thisForm.Artist.value)
			{
				if (thisForm.Phone.value == 0 && thisForm.Mobile.value == 0)
				{
					AlertString += ("\n " + _RST["CONTACTPHONE"] + " " + _RST["OR"] + " " + _RST["CONTACTMOBILE"]);
					ErrorsFound = true;
				}
				if (thisForm.Address1.value == 0){AlertString += ("\n " + _RST["ADDRESS1"]);ErrorsFound = true;}
				if (thisForm.Address2.value == 0){AlertString += ("\n " + _RST["ADDRESS2"]);ErrorsFound = true;}
				if (thisForm.Country.value == 0){AlertString += ("\n " + _RST["COUNTRY"]);ErrorsFound = true;}
			}
		}
		else if (thisForm.OriginPage.value == "artistediturl")
		{
//			if (thisForm.Gallery.value == thisForm.Artist.value)
			if (1)
			{
				if (thisForm.HomePageFirstName.value == 0 && thisForm.HomePageSurname.value == 0)
				{
					AlertString += ("\n " + _RST["FIRSTNAME"] + " " + _RST["OR"] + " " + _RST["LASTNAME"]);
					ErrorsFound = true;
				}
			}
			else
			{
				if (thisForm.HomePageFirstName.value == 0){AlertString += ("\n " + _RST["FIRSTNAME"]);ErrorsFound = true;}
				if (thisForm.HomePageSurname.value == 0){AlertString += ("\n " + _RST["LASTNAME"]);ErrorsFound = true;}
			}
		}
		else if ((thisForm.OriginPage.value == "artisteditpressrelease" || thisForm.OriginPage.value == "artisteditpressreleaselist") && thisForm.Action.value == "add")
		{
			if (thisForm.ReleaseFrom.value == 0){AlertString += ("\n " + _RST["DATE"]);ErrorsFound = true;}
		}
		else if (thisForm.OriginPage.value == "artistaddevent")
		{
			if (thisForm.Action.value == "" || thisForm.Action.value == "add")
			{
				if (thisForm.FromDate.value > thisForm.ToDate.value){AlertString += ("\n " + _RST["TODATEMUSTBEGTFROMDATE"]);ErrorsFound = true;}
				if (thisForm.Title.value == 0)
				{
					AlertString += ("\n " + _RST["TITLE"]);
					ErrorsFound = true;
				}
				if (thisForm.Surname.value == 0)
				{
					AlertString += ("\n " + _RST["VENUENAME"]);
					ErrorsFound = true;
				}
				if (thisForm.ToEmail.value != 0 && !testEmail(thisForm.ToEmail.value)){AlertString += ("\n " + _RST["EMAIL_NOT_VALID"]);ErrorsFound = true;}
				if (thisForm.Address1.value == 0){AlertString += ("\n " + _RST["ADDRESS1"]);ErrorsFound = true;}
				if (thisForm.Country.value == 0){AlertString += ("\n " + _RST["COUNTRY"]);ErrorsFound = true;}
			}
		}
		else if (thisForm.OriginPage.value == "artisteditartwork" || thisForm.OriginPage.value == "artistediteventwork")
		{
			var pickList = document.sortedlist.ArtworkThemes;
			var pickOptions = pickList.options;
			var pickOLength = pickOptions.length;
			for (var i = 0; i < pickOLength; i++) {
				pickOptions[i].selected = true;
			}
		}
		else if (thisForm.OriginPage.value == "artisteditpassword")
		{
			if (thisForm.Currency.value == 0){AlertString += ("\n " + _RST["CURRENCY"]);ErrorsFound = true;}
			if (thisForm.PayPalEmail && thisForm.PayPalEmail.value != 0 && !testEmail(thisForm.PayPalEmail.value)){AlertString += ("\n " + _RST["EMAIL_NOT_VALID"]);ErrorsFound = true;}
			if (thisForm.OldPassword.value == 0 &&
				thisForm.NewPassword.value == 0 &&
				thisForm.NewPasswordAgain.value == 0)
			{
				/* nothing to check on password */
			}
			else
			{
				if (thisForm.NewPassword.value == 0){AlertString += ("\n " + _RST["PASSWORD"]);ErrorsFound = true;}
				else if (thisForm.NewPassword.value != thisForm.NewPasswordAgain.value){AlertString += ("\n " + _RST["PASSWORDS_NOT_SAME"]);ErrorsFound = true;}
				if (ErrorsFound)
				{
					thisForm.NewPassword.select();
					thisForm.NewPassword.focus();
				}
			}
		}
		else if (thisForm.OriginPage.value == "artistenquiry" || thisForm.OriginPage.value == "artworkenquiry" || thisForm.OriginPage.value == "artworksendecard" || thisForm.OriginPage.value == "contactus" || thisForm.OriginPage.value == "updatemyartists")
		{
			if (thisForm.FirstName.value == 0 && thisForm.Surname.value == 0)
			{
				AlertString += ("\n " + _RST["FIRSTNAME"] + " " + _RST["OR"] + " " + _RST["LASTNAME"]);
				ErrorsFound = true;
			}
			if (thisForm.FromEmail.value == 0){AlertString += ("\n " + _RST["EMAIL"]);ErrorsFound = true;}
			else if (!testEmail(thisForm.FromEmail.value)){AlertString += ("\n " + _RST["EMAIL_NOT_VALID"]);ErrorsFound = true;}
			if (thisForm.OriginPage.value == "artworksendecard")
			{
				if (thisForm.ToEmail.value == 0){AlertString += ("\n " + _RST["EMAIL"]);ErrorsFound = true;}
				else if (!testEmail(thisForm.ToEmail.value)){AlertString += ("\n " + _RST["EMAIL_NOT_VALID"]);ErrorsFound = true;}
			}
			if (thisForm.OriginPage.value != "updatemyartists")
			{
				if (thisForm.Message.value == 0){AlertString += ("\n " + _RST["MESSAGE"]);ErrorsFound = true;}
			}
		}
		else if (thisForm.OriginPage.value == "artworknegotiateprice" || thisForm.OriginPage.value == "artworkcommission")
		{
			if (thisForm.FirstName.value == 0 && thisForm.Surname.value == 0)
			{
				AlertString += ("\n " + _RST["FIRSTNAME"] + " " + _RST["OR"] + " " + _RST["LASTNAME"]);
				ErrorsFound = true;
			}
			if (thisForm.FromEmail.value == 0)
			{
				AlertString += ("\n " + _RST["EMAIL"]);ErrorsFound = true;
				thisForm.FromEmail.select();
				thisForm.FromEmail.focus();
			}
			else if (!testEmail(thisForm.FromEmail.value))
			{
				AlertString += ("\n " + _RST["EMAIL_NOT_VALID"]);ErrorsFound = true;
				thisForm.FromEmail.select();
				thisForm.FromEmail.focus();
			}
			if (thisForm.OriginPage.value == "artworknegotiateprice")
			{
				if (thisForm.Price.value == 0)
				{
					if (!ErrorsFound)
					{
						thisForm.Price.select();
						thisForm.Price.focus();
					}
					AlertString += ("\n " + _RST["OFFERED"]);ErrorsFound = true;
				}
			}
			if (thisForm.Description.value == 0)
			{
				if (!ErrorsFound)
				{
					thisForm.Description.select();
					thisForm.Description.focus();
				}
				AlertString += ("\n " + _RST["MESSAGE"]);ErrorsFound = true;
			}
		}
	}
	if (ErrorsFound == true){alert (AlertString);return false;}else{return true;}
}

function uploadWork(pPage)
{
	var AlertString=(_RST["OOPS"] + "\n\n" + _RST["PLEASE_ENTER_YOUR_INFORMATION_BELOW"]);
	var ErrorsFound = false;
	var thisForm = document.uploadform;

	var pickList = thisForm.ArtworkThemes;
	var pickOptions = pickList.options;
	var pickOLength = pickOptions.length;
	var i = 0;
	for (i = 0; i < pickOLength; i++) {
		pickOptions[i].selected = true;
	}

	if (thisForm.FILE1.value == 0)
	{
		AlertString += ("\n " + _RST["FILENAME"]);
		ErrorsFound = true;
	}
	if (thisForm.ArtworkMedium.value == 0)
	{
		AlertString += ("\n " + _RST["MEDIUM"]);
		ErrorsFound = true;
	}
	if (thisForm.Width.value == 0)
	{
		AlertString += ("\n " + _RST["WIDTH"]);
		ErrorsFound = true;
	}
	if (thisForm.Height.value == 0)
	{
		AlertString += ("\n " + _RST["HEIGHT"]);
		ErrorsFound = true;
	}
	if (thisForm.DimensionId.value == 0)
	{
		AlertString += ("\n " + _RST["SCALE"]);
		ErrorsFound = true;
	}
	if ((thisForm.Price.value == 0 || thisForm.Price.value == "0" || thisForm.Price.value == "0.00") && thisForm.ArtworkStatus.value == "FSL")
	{
		AlertString += ("\n " + _RST["PRICE"]);
		ErrorsFound = true;
	}
	if (thisForm.ArtworkStatus.value == 0)
	{
		AlertString += ("\n " + _RST["STATUS"]);
		ErrorsFound = true;
	}
	if (i == 0)
	{
		AlertString += ("\n " + _RST["THEME"]);
		ErrorsFound = true;
	}

	if (ErrorsFound == true)
	{
		alert (AlertString);
		return false;
	}
	else
	{
		document.uploadform.Page.value = pPage;
		document.uploadform.Start.value = 0;
		return true;
	}
}

function uploadPhoto(pPage)
{
	var AlertString=(_RST["OOPS"] + "\n\n" + _RST["PLEASE_ENTER_YOUR_INFORMATION_BELOW"]);
	var ErrorsFound = false;
	var thisForm = document.uploadform;

	if (thisForm.FILE1.value == 0)
	{
		AlertString += ("\n " + _RST["FILENAME"]);
		ErrorsFound = true;
	}

	if (ErrorsFound == true)
	{
		alert (AlertString);
		return false;
	}
	else
	{
		document.uploadform.Page.value = pPage;
		document.uploadform.Start.value = 0;
		return true;
	}
}

function addPressRelease()
{
	var lOk = ValidateArtistEditForm(document.addpressreleaseform);

	if (lOk)
	{
		document.addpressreleaseform.Page.value = "artisteditpressreleaselist";
		document.addpressreleaseform.Start.value = 0;
		document.addpressreleaseform.submit();
	}
}

function testEmail(src){var regex = /^[a-zA-Z0-9._-]+@([a-zA-Z0-9.-]+\.)+[a-zA-Z0-9.-]{2,4}$/;return regex.test(src);}

function setOptionValue(thisItem, thisValue)
{
	thisItem.value = thisValue;
}

function checkSearchFor(event, thisForm) {
	if (event)
	{
		if (event.keyCode == 13)
		{
			searchFor(thisForm)
			return true;
		}
	}
}

function checkLogin(event, currentname) {
	if (event)
	{
		if (event.keyCode == 13)
		{
			/* if on username, go to password */
			if (currentname == "username")
			{
				document.loginform.Password.focus();
			}
			else if (currentname == "password")
			{
				/* if on password login.. */
				signinArtist(document.loginform.Page.value);
			}
			
			return true;
		}
	}
}

function checkRegister(event, currentname) {
//	var thename = "";
	if (event)
	{
		if (event.keyCode == 13)
		{
			/* if on username, go to password */
			if (currentname == "username")
			{
				if (document.registerform.FirstName)
				{
					document.registerform.FirstName.focus();
				}
				else
				{
					document.registerform.Surname.focus();
				}
			}
			else if (currentname == "firstname")
			{
				document.registerform.Surname.focus();
			}
			else if (currentname == "surname")
			{
				document.registerform.OwnDomain.focus();
			}
			else if (currentname == "websitename")
			{
				document.registerform.PromotionCode.focus();
			}
			else if (currentname == "promotioncode")
			{
				document.registerform.OverTheAge.focus();
			}
			else if (currentname == "overtheage")
			{
				document.registerform.AcceptTerms.focus();
			}
			else if (currentname == "acceptterms")
			{
				signinArtist("regstep2");
			}
			
			return true;
		}
	}
}

function checkRegisterLeftField(field) {
	var thename = "";
	if (field)
	{
		if (field == document.registerform.Surname)
		{
			if (document.registerform.FirstName && document.registerform.FirstName.value != 0)
			{
				thename = document.registerform.FirstName.value;
			}
			thename += document.registerform.Surname.value;
			thename = thename.replace(/[^a-zA-Z0-9-]/g, '');
			document.registerform.OwnDomain.value = thename.toLowerCase();
		}
			
		return true;
	}
}

function addArtist()
{
	document.addartist.submit();
}

function signinArtist(pAction)
{
	var AlertString=(_RST["OOPS"] + "\n\n" + _RST["PLEASE_ENTER_YOUR_INFORMATION_BELOW"]);
	ErrorFound = false;
	WarningFound = false;
	var theForm;

	if (pAction == "introduction" || pAction == "packages" || pAction == "regstep1" || pAction == "regstep2" ||  pAction == "regstep3")
	{
		theForm = document.registerform;
	}
	else
	{
		theForm = document.loginform;
	}
	if ((!theForm.RegistrationStep || pAction == "regstep2" || theForm.RegistrationStep.value == "2") && theForm.UserName.value != 0 && !testEmail(theForm.UserName.value))
	{
		AlertString += ("\n " + _RST["EMAIL_NOT_VALID"]);
		theForm.UserName.focus();
		theForm.UserName.select();
		ErrorFound = true;
	}

	if (pAction == "forgotpassword")
	{
		if (theForm.UserName.value == 0 || !testEmail(theForm.UserName.value))
		{
			AlertString += ("\n " + _RST["EMAIL_NOT_VALID"]);
			theForm.UserName.focus();
			theForm.UserName.select();
			ErrorFound = true;
		}
		else
		{
			theForm.Page.value = pAction;
		}
	}
	else if (pAction == "introduction" || pAction == "packages")
	{
		theForm.Action.value = pAction;
	}
	else if (pAction == "regstep2")
	{
//		if (theForm.FirstName && theForm.FirstName.value == 0){AlertString += ("\n " + _RST["FIRSTNAME"]);ErrorFound = true;}
//		alert("firstname="+theForm.FirstName.value);
//		alert("surname="+theForm.Surname.value);
//		alert("phone="+theForm.Phone.value);
//		alert("mobile="+theForm.Mobile.value);
//		alert("address1="+theForm.Address1.value);
		if ((!theForm.FirstName || theForm.FirstName.value == 0) && theForm.Surname.value == 0 && theForm.Phone.value == 0 && theForm.Mobile.value == 0 && theForm.Address1.value == 0){AlertString += ("\n " + _RST["NAME"] + " " + _RST["OR"] + " " + _RST["CONTACTPHONE"] + " " + _RST["OR"] + " " + _RST["CONTACTMOBILE"] + " " + _RST["OR"] + " " + _RST["ADDRESS1"]);ErrorFound = true;}

		if (theForm.OwnDomain && theForm.OwnDomain.value == 0){AlertString += ("\n " + _RST["WEBSITENAME"]);ErrorFound = true;}
		if (theForm.NewPassword && theForm.NewPasswordAgain && theForm.NewPassword.value != theForm.NewPasswordAgain.value){AlertString += ("\n " + _RST["PASSWORDSMISMATCH"]);ErrorFound = true;}
		if (theForm.OverTheAge.checked == 0){AlertString += ("\n " + _RST["OVERTHEAGE"]);ErrorFound = true;}
		if (theForm.AcceptTerms.checked == 0){AlertString += ("\n " + _RST["ACCEPTTERMS"]);ErrorFound = true;}

		if (!ErrorFound)
		{
			if (theForm.OwnDomain) {
				theForm.OwnDomain.value = theForm.OwnDomain.value.replace(/[^a-zA-Z0-9-]/g, ''); 
			}
			theForm.RegistrationStep.value = "2";
		}
	}
	else if (pAction == "regstep1")
	{
		theForm.RegistrationStep.value = "1";
	}
	else if (pAction == "regstep3")
	{
		theForm.RegistrationStep.value = "3";
	}
	else
	{
		if (theForm.Password.value == 0)
		{
			AlertString += ("\n "+ _RST["PASSWORD"]);
			if (!ErrorFound)
			{
				theForm.Password.focus();
				theForm.Password.select();
			}
			ErrorFound = true;
		}
		theForm.Page.value = pAction;
	}

	if (ErrorFound || WarningFound)
	{
		alert(AlertString);
	}
	theForm.Language.value = document.general.Language.value;
	if (!ErrorFound)
	{
		theForm.submit();
	}
}

function initVisibleArea(areaOne)
{
	var theId = "SHOWMORE"+areaOne
	var altId = "ALT"+areaOne
	var isNormal = document.getElementById(areaOne)
	var isAlt = document.getElementById(altId)
	var showMain = false;
	if (document.getElementById) {
		if (isNormal)
			thisMenu = document.getElementById(areaOne).style
		if (isAlt)
			thisAltMenu = document.getElementById(altId).style
//		alert("isNormal="+isNormal+", isAlt="+isAlt)
//		if (isNormal)
//			alert("normal was \("+thisMenu.display+"\)")
//		if (isAlt)
//			alert("alt was \("+thisAltMenu.display+"\)")
		if (isAlt && showMain == false)
			if (thisAltMenu.display == "inline")
				showMain = true
		if (isNormal && showMain == false)
			if (thisMenu.display == "none")
				showMain = true
		if (showMain) {
			/* show the submenu */
			if (isNormal)
				thisMenu.display = "inline"
			thisMenu = document.getElementById(theId)
			thisMenu.style.display = "inline"
			theId = "SHOWLESS"+areaOne;
			thisMenu = document.getElementById(theId)
			thisMenu.style.display = "none"
			if (isAlt)
				thisAltMenu.display = "none"
		}
		else {
			/* hide the submenu */
			if (isNormal)
				thisMenu.display = "none"
			thisMenu = document.getElementById(theId)
			thisMenu.style.display = "none"
			theId = "SHOWLESS"+areaOne;
			thisMenu = document.getElementById(theId)
			thisMenu.style.display = "inline"
			if (isAlt)
				thisAltMenu.display = "inline"
		}
	}
	document.specialisedsearch.CurrentSearch.value = areaOne;
//	alert("set to "+document.specialisedsearch.CurrentSearch.value);
}

function changeDateSearchType(areaOne)
{
	var areaTwo = areaOne;

	if (document.specialisedsearch && document.specialisedsearch.CurrentSearch)
	{
		areaTwo = document.specialisedsearch.CurrentSearch.value;
	}

	if (areaOne == areaTwo)
	{
		return;
	}

	document.specialisedsearch.CurrentSearch.value = areaOne;
	if (areaOne == "DAYSEARCH")
	{
		searchFromTo(document.specialisedsearch.SearchFromDate.value,"")
	}
	else if (areaOne == "WEEKSEARCH")
	{
		searchFromTo(document.specialisedsearch.SearchFromDate.value,"")
	}
	else if (areaOne == "MONTHSEARCH")
	{
		// get month
		var theMonth = "";
		if  (document.specialisedsearch.SearchFromDate.value != "")
		{
			theMonth = document.specialisedsearch.SearchFromDate.value.substring(7,5);
		}
		searchMonth(theMonth)
	}
	else if (areaOne == "DATESSEARCH")
	{
		searchFromTo(document.specialisedsearch.SearchFromDate.value, document.specialisedsearch.SearchToDate.value)
	}
}

function swapVisibleAreas(areaOne)
{
	var areaTwo = areaOne;

	if (document.specialisedsearch && document.specialisedsearch.CurrentSearch)
	{
		areaTwo = document.specialisedsearch.CurrentSearch.value;
	}

	if (areaOne == areaTwo)
	{
		return;
	}

	var theId = "SHOWMORE"+areaOne
	var altId = "ALT"+areaOne
	var isNormal = document.getElementById(areaOne)
	var isAlt = document.getElementById(altId)
	var showMain = false;
	if (document.getElementById) {
		if (isNormal)
			thisMenu = document.getElementById(areaOne).style
		if (isAlt)
			thisAltMenu = document.getElementById(altId).style
//		alert("isNormal="+isNormal+", isAlt="+isAlt)
//		if (isNormal)
//			alert("normal was \("+thisMenu.display+"\)")
//		if (isAlt)
//			alert("alt was \("+thisAltMenu.display+"\)")
		if (isAlt && showMain == false)
			if (thisAltMenu.display == "inline")
				showMain = true
		if (isNormal && showMain == false)
			if (thisMenu.display == "none")
				showMain = true
		if (showMain) {
			/* show the submenu */
			if (isNormal)
				thisMenu.display = "inline"
			thisMenu = document.getElementById(theId)
			thisMenu.style.display = "inline"
			theId = "SHOWLESS"+areaOne;
			thisMenu = document.getElementById(theId)
			thisMenu.style.display = "none"
			if (isAlt)
				thisAltMenu.display = "none"
		}
		else {
			/* hide the submenu */
			if (isNormal)
				thisMenu.display = "none"
			thisMenu = document.getElementById(theId)
			thisMenu.style.display = "none"
			theId = "SHOWLESS"+areaOne;
			thisMenu = document.getElementById(theId)
			thisMenu.style.display = "inline"
			if (isAlt)
				thisAltMenu.display = "inline"
		}
	}

	if (areaTwo != "")
	{
		theId = "SHOWMORE"+areaTwo
		altId = "ALT"+areaTwo
		isNormal = document.getElementById(areaTwo)
		isAlt = document.getElementById(altId)
		showMain = false;
		if (document.getElementById) {
			if (isNormal)
				thisMenu = document.getElementById(areaTwo).style
			if (isAlt)
				thisAltMenu = document.getElementById(altId).style
//			alert("isNormal="+isNormal+", isAlt="+isAlt)
//			if (isNormal)
//				alert("normal was \("+thisMenu.display+"\)")
//			if (isAlt)
//				alert("alt was \("+thisAltMenu.display+"\)")
			if (isAlt && showMain == false)
				if (thisAltMenu.display == "inline")
					showMain = true
			if (isNormal && showMain == false)
				if (thisMenu.display == "none")
					showMain = true
			if (showMain) {
				/* show the submenu */
				if (isNormal)
					thisMenu.display = "inline"
				thisMenu = document.getElementById(theId)
				thisMenu.style.display = "inline"
				theId = "SHOWLESS"+areaTwo;
				thisMenu = document.getElementById(theId)
				thisMenu.style.display = "none"
				if (isAlt)
					thisAltMenu.display = "none"
			}
			else {
				/* hide the submenu */
				if (isNormal)
					thisMenu.display = "none"
				thisMenu = document.getElementById(theId)
				thisMenu.style.display = "none"
				theId = "SHOWLESS"+areaTwo;
				thisMenu = document.getElementById(theId)
				thisMenu.style.display = "inline"
				if (isAlt)
					thisAltMenu.display = "inline"
			}
		}
	}
	document.specialisedsearch.CurrentSearch.value = areaOne;
	if (areaOne == "DAYSEARCH")
	{
		searchFromTo(document.specialisedsearch.SearchFromDate.value,"")
	}
	else if (areaOne == "WEEKSEARCH")
	{
	}
	else if (areaOne == "MONTHSEARCH")
	{
		// get month
		var theMonth = document.specialisedsearch.SearchFromDate.value.substring(7,5)
		searchMonth(theMonth)
	}
	else if (areaOne == "DATESSEARCH")
	{
		searchFromTo(document.specialisedsearch.SearchFromDate.value, document.specialisedsearch.SearchToDate.value)
	}
}

function toggleExtraDetails(currMenu) {
	var theId = "SHOWMORE"+currMenu
	var altId = "ALT"+currMenu
	var isNormal = document.getElementById(currMenu)
	var isAlt = document.getElementById(altId)
	var showMain = false;
	if (document.getElementById) {
		if (isNormal)
			thisMenu = document.getElementById(currMenu).style
		if (isAlt)
			thisAltMenu = document.getElementById(altId).style
//		alert("isNormal="+isNormal+", isAlt="+isAlt)
//		if (isNormal)
//			alert("normal was \("+thisMenu.display+"\)")
//		if (isAlt)
//			alert("alt was \("+thisAltMenu.display+"\)")
		if (isAlt && showMain == false)
			if (thisAltMenu.display == "inline")
				showMain = true
		if (isNormal && showMain == false)
			if (thisMenu.display == "none")
				showMain = true
		if (showMain) {
			/* show the submenu */
			if (isNormal)
				thisMenu.display = "inline"
			thisMenu = document.getElementById(theId)
			thisMenu.style.display = "inline"
			theId = "SHOWLESS"+currMenu;
			thisMenu = document.getElementById(theId)
			thisMenu.style.display = "none"
			if (isAlt)
				thisAltMenu.display = "none"
		}
		else {
			/* hide the submenu */
			if (isNormal)
				thisMenu.display = "none"
			thisMenu = document.getElementById(theId)
			thisMenu.style.display = "none"
			theId = "SHOWLESS"+currMenu;
			thisMenu = document.getElementById(theId)
			thisMenu.style.display = "inline"
			if (isAlt)
				thisAltMenu.display = "inline"
		}
		return false
	}
	else {
		return true
	}
}

// Control flags for list selection and sort sequence
// Sequence is on option value (first 2 chars - can be stripped off in form processing)
// It is assumed that the select list is in sort sequence initially
var singleSelect = true;  // Allows an item to be selected once only
var sortSelect = true;  // Only effective if above flag set to true
var sortPick = true;  // Will order the picklist in sort sequence

// Adds a selected item into the picklist
function addIt(SelectList, PickList) {
	var selectable = ""+SelectList;
	var theSelectList = eval(selectable);
	var chosen = ""+PickList;
	var theChosenList = eval(chosen);

	var selectList = theSelectList;
	var selectIndex = selectList.selectedIndex;
	var selectOptions = selectList.options;
	var pickList = theChosenList;
	var pickOptions = pickList.options;
	var pickOLength = pickOptions.length;
	// An item must be selected
	while (selectIndex > -1) {
		pickOptions[pickOLength] = new Option(selectList[selectIndex].text);
		pickOptions[pickOLength].value = selectList[selectIndex].value;
		// If single selection, remove the item from the select list
		if (singleSelect) {
			selectOptions[selectIndex] = null;
		}
		if (sortPick) {
			var tempText;
			var tempValue;
			// Sort the pick list
			while (pickOLength > 0 && pickOptions[pickOLength].value < pickOptions[pickOLength-1].value) {
				tempText = pickOptions[pickOLength-1].text;
				tempValue = pickOptions[pickOLength-1].value;
				pickOptions[pickOLength-1].text = pickOptions[pickOLength].text;
				pickOptions[pickOLength-1].value = pickOptions[pickOLength].value;
				pickOptions[pickOLength].text = tempText;
				pickOptions[pickOLength].value = tempValue;
				pickOLength = pickOLength - 1;
			}
		}
		selectIndex = selectList.selectedIndex;
		pickOLength = pickOptions.length;
	}
	selectOptions[0].selected = true;
}

// Deletes an item from the picklist
function delIt(SelectList, PickList) {
	var selectable = ""+SelectList;
	var theSelectList = eval(selectable);
	var chosen = ""+PickList;
	var theChosenList = eval(chosen);

	var selectList = theSelectList;
	var selectOptions = selectList.options;
	var selectOLength = selectOptions.length;
	var pickList = theChosenList;
	var pickIndex = pickList.selectedIndex;
	var pickOptions = pickList.options;
	while (pickIndex > -1) {
		// If single selection, replace the item in the select list
		if (singleSelect) {
			selectOptions[selectOLength] = new Option(pickList[pickIndex].text);
			selectOptions[selectOLength].value = pickList[pickIndex].value;
		}
		pickOptions[pickIndex] = null;
		if (singleSelect && sortSelect) {
			var tempText;
			var tempValue;
			// Re-sort the select list
			while (selectOLength > 0 && selectOptions[selectOLength].value < selectOptions[selectOLength-1].value) {
				tempText = selectOptions[selectOLength-1].text;
				tempValue = selectOptions[selectOLength-1].value;
				selectOptions[selectOLength-1].text = selectOptions[selectOLength].text;
				selectOptions[selectOLength-1].value = selectOptions[selectOLength].value;
				selectOptions[selectOLength].text = tempText;
				selectOptions[selectOLength].value = tempValue;
				selectOLength = selectOLength - 1;
			}
		}
		pickIndex = pickList.selectedIndex;
		selectOLength = selectOptions.length;
	}
}

function rotateRandom()
{
	if (document.images)
	{
		randomNum = Math.floor ((Math.random() * 10))
		document.navrightpicture.src="/icons/"+randomNum+"_1_A.JPG"

		setTimeout("rotate()", 5*1000)
	}
}

function sort(pColumn)
{
	var theForm = document.general;

	if (document.keywordsearch && document.keywordsearch.Search && document.keywordsearch.Search.value != 0)
	{
		theForm = document.keywordsearch;
	}
	else if (document.specialisedsearch)
	{
		theForm = document.specialisedsearch;
	}

	theForm.SortBy.value = pColumn
	theForm.submit()
}

function preloadImages() {
	for (var y = 0; y < 2; y++) {
		for (var x = 0; x < tabs.length; x++) {
			image = new Image();
			image.src = tabs[x][y];
		}
	}
}

function ValidateOrderForm(thisForm)
{
	var AlertString=(_RST["OOPS"] + "\n\n" + _RST["PLEASE_ENTER_YOUR_INFORMATION_BELOW"]);
	var ErrorsFound = false;
	if (thisForm.FromEmail.value == 0 && thisForm.Phone.value == 0 && thisForm.Mobile.value == 0 && thisForm.Address1.value == 0)
	{
		AlertString += ("\n " + _RST["EMAIL"] + " " + _RST["OR"] + " " + _RST["CONTACTPHONE"] + " " + _RST["OR"] + " " + _RST["CONTACTMOBILE"] + " " + _RST["OR"] + " " + _RST["ADDRESS1"] );ErrorsFound = true;
//		thisForm.FromEmail.select();
//		thisForm.FromEmail.focus();
	}
	else if (thisForm.FromEmail.value != 0 && !testEmail(thisForm.FromEmail.value))
	{
		AlertString += ("\n " + _RST["EMAIL_NOT_VALID"]);ErrorsFound = true;
		thisForm.FromEmail.select();
		thisForm.FromEmail.focus();
	}
	if (ErrorsFound == true){alert (AlertString);return false;}else{return true;}
}

function searchVenue()
{
	if (document.specialisedsearch)
	{
		if (document.specialisedsearch.SearchFromDate)
		{
			document.specialisedsearch.SearchFromDate.value = "";
		}
		if (document.specialisedsearch.SearchToDate)
		{
			document.specialisedsearch.SearchToDate.value = "";
		}
		document.specialisedsearch.submit();
	}
}

function searchFromTo(fromdate, todate)
{
	var AlertString=_RST["OOPS"] + "\n\n";
	var ErrorsFound = false;

	if (todate == "")
		todate = fromdate

	if (document.specialisedsearch)
	{
		var gotOne = 0;
		if (document.specialisedsearch.SearchFromDate)
		{
			document.specialisedsearch.SearchFromDate.value = fromdate;
			gotOne = 1;
		}
		if (document.specialisedsearch.SearchToDate)
		{
			document.specialisedsearch.SearchToDate.value = todate;
			gotOne = 1;
		}
//		alert("gotOne="+gotOne+", from="+document.specialisedsearch.SearchFromDate.value+", to="+document.specialisedsearch.SearchToDate.value);
		if (fromdate > todate){AlertString += ("\n " + _RST["TODATEMUSTBEGTFROMDATE"]);ErrorsFound = true;}

		if (gotOne)
		{
			if (ErrorsFound == true)
			{
				alert (AlertString);
			}
			else
			{
				document.specialisedsearch.submit();
			}
		}
	}
}

function searchMonth(month)
{
	var today = new Date()
	var gotOne = 0;
	var fromdate = "";
	var todate = "";
	var year = today.getYear();
	var thisMonth = today.getMonth();

	if (month == "")
	{
		month = thisMonth;
	}

	if (document.specialisedsearch && document.specialisedsearch.SearchYear)
	{
		year = document.specialisedsearch.SearchYear.value;
	}
	if (month == "JAN" || month == "01" || month == "1")
	{
		fromdate = year + "-01-01";
		todate = year + "-01-31";
		gotOne = 1;
	}
	else if (month == "FEB" || month == "02" || month == "2")
	{
		fromdate = year + "-02-01";
		todate = year + "-02-29";
		gotOne = 1;
	}
	else if (month == "MAR" || month == "03" || month == "3")
	{
		fromdate = year + "-03-01";
		todate = year + "-03-31";
		gotOne = 1;
	}
	else if (month == "APR" || month == "04" || month == "4")
	{
		fromdate = year + "-04-01";
		todate = year + "-04-30";
		gotOne = 1;
	}
	else if (month == "MAY" || month == "05" || month == "5")
	{
		fromdate = year + "-05-01";
		todate = year + "-05-31";
		gotOne = 1;
	}
	else if (month == "JUN" || month == "06" || month == "6")
	{
		fromdate = year + "-06-01";
		todate = year + "-06-30";
		gotOne = 1;
	}
	else if (month == "JUL" || month == "07" || month == "7")
	{
		fromdate = year + "-07-01";
		todate = year + "-07-31";
		gotOne = 1;
	}
	else if (month == "AUG" || month == "08" || month == "8")
	{
		fromdate = year + "-08-01";
		todate = year + "-08-31";
		gotOne = 1;
	}
	else if (month == "SEP" || month == "09" || month == "9")
	{
		fromdate = year + "-09-01";
		todate = year + "-09-30";
		gotOne = 1;
	}
	else if (month == "OCT" || month == "10")
	{
		fromdate = year + "-10-01";
		todate = year + "-10-31";
		gotOne = 1;
	}
	else if (month == "NOV" || month == "11")
	{
		fromdate = year + "-11-01";
		todate = year + "-11-30";
		gotOne = 1;
	}
	else if (month == "DEC" || month == "12")
	{
		fromdate = year + "-12-01";
		todate = year + "-12-31";
		gotOne = 1;
	}

	if (gotOne)
		searchFromTo(fromdate, todate)
}

function searchYear(year)
{
	var fromdate = year+"-01-01";
	var todate = year+"-12-31";

	if (document.specialisedsearch)
	{
		var theString = document.specialisedsearch.SearchFromDate.value;
		if (document.specialisedsearch.SearchFromDate && document.specialisedsearch.SearchFromDate.value != "")
		{
			fromdate = year+theString.substring(10,4);
		}
		if (document.specialisedsearch.SearchToDate && document.specialisedsearch.SearchToDate.value != "")
		{
			theString = document.specialisedsearch.SearchToDate.value;
			todate = year+theString.substring(10,4);
		}
	}	

	if (document.specialisedsearch && document.specialisedsearch.SearchYear)
		document.specialisedsearch.SearchYear.value = year;

//	alert("searchyear from="+fromdate+", to="+todate)
	searchFromTo(fromdate, todate);
}

function getBackgroundColor(el)
{
	if(el.currentStyle)
		return el.currentStyle.backgroundColor;
	if(document.defaultView)
		return document.defaultView.getComputedStyle(el, '').getPropertyValue("background-color");
	return "";
}

function getCheckedValue(radioObj) {
	if(!radioObj)
		return "";
	var radioLength = radioObj.length;
	if(radioLength == undefined)
		if(radioObj.checked)
			return radioObj.value;
		else
			return "";
	for(var i = 0; i < radioLength; i++) {
		if(radioObj[i].checked) {
			return radioObj[i].value;
		}
	}
	return "";
}

function clearOptions(OptionList) {

   // Always clear an option list from the last entry to the first
   for (x = OptionList.length; x >= 0; x--) {
      OptionList[x] = null;
   }
}


function addToOptionList(OptionList, OptionValue, OptionText) {
   // Add option to the bottom of the list
   OptionList[OptionList.length] = new Option(OptionText, OptionValue);
}

