document.write('<script type="text/javascript" language="JavaScript" src="../js/scriptaculous/lib/prototype.js"></script>');
document.write('<script type="text/javascript" language="JavaScript" src="../js/scriptaculous/src/scriptaculous.js"></script>');

var updateRequest = createMultiRequest();

function createRequest()
{
	try
	{
		request = new XMLHttpRequest();
	}
	catch (trymicrosoft)
	{
		try
		{
			request = new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (othermicrosoft)
		{
			try
			{
				request = new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch (failed)
			{
				request = null;
			}
		}
	}

	if(request == null)
	{
		alert("Error creating request object");
	}

	return request;
}

function createMultiRequest()
{
	try
	{
		request = new XMLHttpRequest();
	}
	catch (trymicrosoft)
	{
		try
		{
			request = new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (othermicrosoft)
		{
			try
			{
				request = new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch (failed)
			{
				request = null;
			}
		}
	}
 
	if(request == null)
	{
		alert("Error creating request object");
	}
 
	return request;
}

var isNS4;
var isNS6;
var isIE4;
var isIE5;
var strPlatform;

isNS4 = (document.layers) ? true : false;
isIE4 = (document.all && !document.getElementById) ? true : false;
isIE5 = (document.all && document.getElementById) ? true : false;
isNS6 = (!document.all && document.getElementById) ? true : false;

Browser = navigator.appName
Net = Browser.indexOf("Netscape")
Micro = Browser.indexOf("Microsoft")
Netscape = false
IE = false

if(Net >= 0) {
	Netscape = true
	
	
}

if(Micro >= 0) {
	IE = true
}

var xPos;
var yPos;
document.onmousemove = XYpos;

function XYpos(e) {

	if (IE == true) {
		xPos = event.screenX
		yPos = event.screenY
	}
	else{
		xPos = e.clientX;
		yPos = e.clientY;
	}
}

function getMouseXY(e) {
  if (IE) { // grab the x-y pos.s if browser is IE
    xPos = event.clientX + document.body.scrollLeft
    yPos = event.clientY + document.body.scrollTop
  } else {  // grab the x-y pos.s if browser is NS
    xPos = e.pageX
    yPos = e.pageY
  }  
  // catch possible negative values in NS4
  if (xPos < 0){xPos = 0}
  if (yPos < 0){yPos = 0}  
  return true
}

function findPos(obj)
{
	var curleft = curtop = 0;
	if (obj.offsetParent) 
	{
		curleft = obj.offsetLeft
		curtop = obj.offsetTop
		while (obj = obj.offsetParent) 
		{
			curleft += obj.offsetLeft
			curtop += obj.offsetTop
		}
	}
	return [curleft,curtop];
}


function changeActionDiv(content, visibleStatus, leftPos, topPos)
{
	handle = document.getElementById("actionDiv");
	handle.innerHTML			= content;
	handle.style.visibility		= visibleStatus;
	handle.style.top			= topPos + 'px';
	handle.style.left			= leftPos + 'px';
}


function showActionLayer(iLeft, iTop, iWidth, iHeight)
{
	upload = document.getElementById("actionLayer");
	upload.style.background		= '#FFFFFF';
	upload.style.visibility		= 'visible';
	upload.style.left			= iLeft + 'px';
	upload.style.top			= iTop + 'px';
	upload.style.width			= iWidth + 'px';
	upload.style.height			= iHeight + 'px';
}


function hideActionLayer()
{
	upload = document.getElementById("actionLayer");
	upload.style.visibility		= 'hidden';
}


function hideActionDiv()
{
//	if(IE)
//	{
		upload					= document.getElementById("actionLayer");
		upload.style.visibility	= 'hidden';
//	}

	handle = document.getElementById("actionDiv");
	handle.style.visibility = "hidden";
}


function Confirmation_Popup(SuccessMessage, iWidth, xPos, yPos)
{
	SuccessMessage = '<table width="' + iWidth + '" cellpadding="3" cellspacing="0" class="blackBorder" bgcolor="white"><tr><td class="padded"><span class="fontnormgreen">' + SuccessMessage + '</span></td><td class="padded" width="20" valign="middle"><a href="javascript:void(0);" onClick="hideActionDiv()"><span class="fontnorm"><u>Close</u></span></a></td></tr></table>';

	changeActionDiv(SuccessMessage, 'visible', xPos, yPos);
}

function SettingsConfirmUpdate(SuccessMessage)
{

	SuccessMessage = '<table width="350" height="40" cellpadding="3" cellspacing="0" class="blackBorder" bgcolor="white"><tr><td class="padded"><span class="fontnormgreen">' + SuccessMessage + '</span></td><td class="padded" width="20" valign="middle"><a href="javascript:void(0);" onClick="hideActionDiv()"><span class="fontnorm"><u>Close</u></span></a></td></tr></table>';

	changeActionDiv(SuccessMessage, 'visible', 290, 171);
}


function TicketEdited(SuccessMessage, Content)
{

	SuccessMessage = '<table width="260" height="40" cellpadding="3" cellspacing="0" class="blackBorder" bgcolor="#FF9900"><tr><td class="padded"><span class="fontbigred">' + SuccessMessage + '</span></td><td class="padded" width="20" valign="middle"><a href="javascript:void(0);" onClick="hideActionDiv()"><span class="fontnorm"><u>Close</u></span></a></td></tr><tr><td colspan="2"><span class="fontnorm">' + Content + '</span><td></tr></table>';

	changeActionDiv(SuccessMessage, 'visible', 300, 310);
}


function TicketCancelled(SuccessMessage)
{

	SuccessMessage = '<table width="200" height="40" cellpadding="3" cellspacing="0" class="blackBorder" bgcolor="white"><tr><td class="padded"><span class="fontbigred">' + SuccessMessage + '</span></td><td class="padded" width="20" valign="middle"><a href="javascript:void(0);" onClick="hideActionDiv()"><span class="fontnorm"><u>Close</u></span></a></td></tr></table>';

	changeActionDiv(SuccessMessage, 'visible', 290, 171);
}


function SelectCriteria(SuccessMessage)
{

	SuccessMessage = '<table width="250" height="40" cellpadding="3" cellspacing="0" class="blackBorder" bgcolor="white"><tr><td class="padded"><span class="fontbigred">' + SuccessMessage + '</span></td><td class="padded" width="20" valign="middle"><a href="javascript:void(0);" onClick="hideActionDiv()"><span class="fontnorm"><u>Close</u></span></a></td></tr></table>';

	changeActionDiv(SuccessMessage, 'visible', 290, 171);
}


function ConsumerResend(SuccessMessage)
{

	SuccessMessage = '<table width="175" height="40" cellpadding="3" cellspacing="0" class="blackBorder" bgcolor="white"><tr><td class="padded"><span class="fontbiggreen">' + SuccessMessage + '</span></td><td class="padded" width="20" valign="middle"><a href="javascript:void(0);" onClick="hideActionDiv()"><span class="fontnorm"><u>Close</u></span></a></td></tr></table>';

	changeActionDiv(SuccessMessage, 'visible', 600, 145);
}


function ConsumerUpdate(SuccessMessage)
{

	SuccessMessage = '<table width="200" height="40" cellpadding="3" cellspacing="0" class="blackBorder" bgcolor="white"><tr><td class="padded"><span class="fontbiggreen">' + SuccessMessage + '</span></td><td class="padded" width="20" valign="middle"><a href="javascript:void(0);" onClick="hideActionDiv()"><span class="fontnorm"><u>Close</u></span></a></td></tr></table>';

	changeActionDiv(SuccessMessage, 'visible', 600, 145);
}

function NewEmailSent(SuccessMessage)
{

	SuccessMessage = '<table width="165" height="50" cellpadding="3" cellspacing="0" class="blackBorder" bgcolor="white"><tr><td class="padded" bgcolor="D7E1EA"><span class="fontbignormbold">Confirmation</span></td></tr><tr><td class="padded"><span class="fontbigred">' + SuccessMessage + '</span></td></tr><tr><td align="center"><input type="button" class="yellowstd" name="close" value="Close" onClick="hideActionDiv()"></td></tr></table>';

	changeActionDiv(SuccessMessage, 'visible', 560, 400);
}

function PasswordChanged(SuccessMessage)
{

	SuccessMessage = '<table width="355" height="50" cellpadding="3" cellspacing="0" class="blackBorder" bgcolor="white"><tr><td class="padded" bgcolor="D7E1EA"><span class="fontbignormbold">Confirmation</span></td></tr><tr><td class="padded"><span class="fontbigred">' + SuccessMessage + '</span></td></tr><tr><td align="center"><input type="button" class="yellowstd" name="close" value="OK" onClick="hideActionDiv()"></td></tr></table>';

	changeActionDiv(SuccessMessage, 'visible', 440, 400);
}

function PayByInvoiceWarningWhenZeroCostTicket(WarningMessage)
{

	WarningMessage = '<table width="410" height="50" cellpadding="3" cellspacing="0" class="blackBorder" bgcolor="white"><tr><td class="padded" bgcolor="D7E1EA"><span class="fontbignormbold">Warning</span></td></tr><tr><td class="padded"><span class="fontbigred">' + WarningMessage + '</span></td></tr><tr><td align="center"><input type="button" class="yellowstd" name="close" value="OK" onClick="hideActionDiv()"></td></tr></table>';

	changeActionDiv(WarningMessage, 'visible', 440, 350);
}

function DuplicateEvent(SuccessMessage)
{

	SuccessMessage = '<table width="270" height="50" cellpadding="3" cellspacing="0" class="blackBorder" bgcolor="white"><tr><td class="padded" bgcolor="D7E1EA"><span class="fontbignormbold">Confirmation</span></td></tr><tr><td class="padded"><span class="fontbigred">' + SuccessMessage + '</span></td></tr><tr><td align="center"><input type="button" class="yellowstd" name="close" value="OK" onClick="hideActionDiv()"></td></tr></table>';

	changeActionDiv(SuccessMessage, 'visible', 440, 400);
}

function RemovingGuestNamesWarning()
{
	var bGuestNameChecked = document.EditEvent.bGuestNames.checked;

	if(bGuestNameChecked == false)
	{
		document.EditEvent.bGuestNames.checked = true;

		WarningMessage = '<table width="410" height="50" cellpadding="3" cellspacing="0" class="blackBorder" bgcolor="white"><tr><td class="padded" bgcolor="D7E1EA"><span class="fontbignormbold">Warning</span></td></tr><tr><td class="padded"><span class="fontbigred">You have extra questions setup on a \'per ticket\' basis. Unticking this box will delete this data and all per ticket questions. The data you delete is NOT recoverable. Do you wish to continue and lose this data?</span></td></tr><tr><td align="center"><input type="button" class="yellowstd" name="Cancel" value=" Cancel " onClick="hideActionDiv()"> <input type="button" class="redstd" name="Delete" value=" Continue " onClick="document.EditEvent.bGuestNames.checked = false;hideActionDiv();"></td></tr></table>';

		changeActionDiv(WarningMessage, 'visible', 440, 350);
		showActionLayer(440, 350, 410, 174);
	}	
}

function ChangeSecurityCodes()
{
	var bChangeCodesChecked = document.editticket.ChangeCodes.checked;

	if(bChangeCodesChecked == true)
	{
		document.editticket.ChangeCodes.checked = false;

		WarningMessage = '<table width="410" height="50" cellpadding="3" cellspacing="0" class="blackBorder" bgcolor="white"><tr><td class="padded" bgcolor="D7E1EA"><span class="fontbignormbold">Warning</span></td></tr><tr><td class="padded"><span class="fontbigred">Changing security details will invalidate the previous security codes and send new codes to the purchaser. You will need to download you ticket lists again to get this new data. Do you wish to continue and change the codes?</span></td></tr><tr><td align="center"><input type="button" class="yellowmed" name="Cancel" value=" Keep Codes " onClick="hideActionDiv()"> <input type="button" class="redmed" name="Change" value=" Change Codes " onClick="document.editticket.ChangeCodes.checked = true; document.editticket.ReIssue.checked = true; document.editticket.ReIssue.disabled = true; hideActionDiv();"></td></tr></table>';

		changeActionDiv(WarningMessage, 'visible', 440, 350);
		showActionLayer(440, 350, 410, 174);
	}

	if(bChangeCodesChecked != true)
	{
		document.editticket.ReIssue.disabled = false;
	}
}

function QuestionHowAskedWarning()
{
	var bGuestNameChecked = document.extended_profile_data.per_ticket.value;

	if(bGuestNameChecked == false)
	{
		document.extended_profile_data.per_ticket.value = '1';

		WarningMessage = '<table width="410" height="50" cellpadding="3" cellspacing="0" class="blackBorder" bgcolor="white"><tr><td class="padded" bgcolor="D7E1EA"><span class="fontbignormbold">Warning</span></td></tr><tr><td class="padded"><span class="fontbigred">Unticking this box will delete the answers held for it. The data you delete is NOT recoverable. Do you wish to continue and lose this data?</span></td></tr><tr><td align="center"><input type="button" class="yellowstd" name="Cancel" value=" Cancel " onClick="hideActionDiv()"> <input type="button" class="redstd" name="Delete" value=" Continue " onClick=";document.extended_profile_data.per_ticket.value = 0; hideActionDiv();"></td></tr></table>';

		changeActionDiv(WarningMessage, 'visible', 440, 350);
		showActionLayer(440, 350, 410, 174);
	}
}

function HowContinuousDaysWork(iDays, iTicketNum)
{
	var strTicketName = eval("document.NewEvent2.strTicketName" + iTicketNum + '.value');

	var iTop = 370 + (500 * (iTicketNum - 1));

	WarningMessage = '<table width="630" height="300" cellpadding="3" cellspacing="0" class="blackBorder" bgcolor="white"><tr><td class="padded" bgcolor="D7E1EA"><span class="fontbignormbold">How multi day tickets work</span></td></tr><tr><td class="padded"><span class="fontbigred">Continuous</span><br><span class="fontnorm">The purchaser is asked to select the first day they would like the ticket to be valid for. When calculating how many tickets have been sold, <strong>' + strTicketName + '</strong> tickets will be counted on their start date and the next <strong>' + iDays + '</strong> days.<br><strong>EG</strong><br>An event runs every day in August and this ticket is valid for entry for 3 days. The purchaser selects a start date of the 10th. The amount of tickets sold for the 10th, 11th and 12th will be increased by 1 as this ticket is valid for those 3 days.</span><br><br><span class="fontbigred">Sporadic</span><br><span class="fontnorm">The purchaser is asked to select each day they would like entry. These dates can be together or spaced out over the entire duration of the event. When calculating how many tickets have been sold, <strong>' + strTicketName + '</strong> tickets will be counted on the <strong>' + iDays + '</strong> selected dates.<br><strong>EG</strong><br>An event runs every day in August and this ticket is valid for entry on 5 days. The purchaser selects the 1st, 5th, 6th, 18, and 23rd. The amount of tickets sold for each of these dates will be increased by 1.</span></td></tr><tr><td align="center"><input type="button" class="greenstd" name="Cancel" value=" Carry On " onClick="hideActionDiv()"></td></tr></table>';

	changeActionDiv(WarningMessage, 'visible', 295, iTop);
	showActionLayer(295, iTop, 630, 300);
}

function HowContinuousDaysWorkEdit(iDays, iTicketNum)
{
	var strTicketName = eval("document.EditEvent.strTicketName" + iTicketNum + '.value');

	var iTop = 370 + (500 * (iTicketNum - 1));

	WarningMessage = '<table width="630" height="300" cellpadding="3" cellspacing="0" class="blackBorder" bgcolor="white"><tr><td class="padded" bgcolor="D7E1EA"><span class="fontbignormbold">How multi day tickets work</span></td></tr><tr><td class="padded"><span class="fontbigred">Continuous</span><br><span class="fontnorm">The purchaser is asked to select the first day they would like the ticket to be valid for. When calculating how many tickets have been sold, <strong>' + strTicketName + '</strong> tickets will be counted on their start date and the next <strong>' + iDays + '</strong> days.<br><strong>EG</strong><br>An event runs every day in August and this ticket is valid for entry for 3 days. The purchaser selects a start date of the 10th. The amount of tickets sold for the 10th, 11th and 12th will be increased by 1 as this ticket is valid for those 3 days.</span><br><br><span class="fontbigred">Sporadic</span><br><span class="fontnorm">The purchaser is asked to select each day they would like entry. These dates can be together or spaced out over the entire duration of the event. When calculating how many tickets have been sold, <strong>' + strTicketName + '</strong> tickets will be counted on the <strong>' + iDays + '</strong> selected dates.<br><strong>EG</strong><br>An event runs every day in August and this ticket is valid for entry on 5 days. The purchaser selects the 1st, 5th, 6th, 18, and 23rd. The amount of tickets sold for each of these dates will be increased by 1.</span></td></tr><tr><td align="center"><input type="button" class="greenstd" name="Cancel" value=" Carry On " onClick="hideActionDiv()"></td></tr></table>';

	changeActionDiv(WarningMessage, 'visible', 295, iTop);
	showActionLayer(295, iTop, 630, 300);
}


function AdvancedCreditPurchase(strMessage, strStatus)
{
	if(strStatus == 'success')
	{
		strFont = 'fontbiggreen';
	}
	else
	{
		strFont = 'fontbigred';
	}

	strMessage = '<table width="430" height="40" cellpadding="3" cellspacing="0" class="blackBorder" bgcolor="#DADADA"><tr><td class="padded"><span class="' + strFont + '">' + strMessage + '</span></td><td class="padded" width="20" valign="middle"><a href="javascript:void(0);" onClick="hideActionDiv()"><span class="fontnorm"><u>Close</u></span></a></td></tr></table>';

	changeActionDiv(strMessage, 'visible', 310, 180);
}


function DateChange()
{
		// Gets the TO and FROM dates
	var sFromDay				= document.NewEvent1.iFromDay.value;
	var sFromMonth				= document.NewEvent1.iFromMonth.value;
	var sFromYear				= document.NewEvent1.iFromYear.value;
	var sToDay					= document.NewEvent1.iToDay.value;
	var sToMonth				= document.NewEvent1.iToMonth.value;
	var sToYear					= document.NewEvent1.iToYear.value;
	
	if(sToDay == "Day")
	{
		document.NewEvent1.iToDay.value = sFromDay;
	}

	if(sToMonth == "Month")
	{
		document.NewEvent1.iToMonth.value = sFromMonth;
	}

	if(sToYear == "Year")
	{
		document.NewEvent1.iToYear.value = sFromYear;
	}
}

function roundNumber(rnum, rlength) { // Arguments: number to round, number of decimal places
  return Math.round(rnum*Math.pow(10,rlength))/Math.pow(10,rlength);
}

function BuyTicketCost()
{
	// Reset Vars
	var	fTotalTicketsCost		= "0";
	var	fServiceCharge			= "0";
	var	fTotalCost				= "0";
	var fThisTicketCost			= "0";
	var fTotalTicketsCost		= "0";
	var fThisTicketTax			= "0";
	var fTotalTicketsTax		= "0";
	var fGrandTotal				= "0";

	// These tell us what we want to know- taken from the form
	var fPerTicket				= parseFloat(document.Landing.fPerTicket.value);
	var fPerTrans				= parseFloat(document.Landing.fPerTrans.value);
	var fPCTrans				= parseFloat(document.Landing.fPCTrans.value) / 100;
	var fSalesTax				= parseFloat(document.Landing.fSalesTax.value);

	// We want to return these
	var hTicketsCost			= document.getElementById("TicketsCost");
	var hServiceCharge			= document.getElementById("ServiceCharge");
	var hGrandTotal				= document.getElementById("GrandTotal");
	if(fSalesTax > 0)
	{		
		var hTicketTotal		= document.getElementById("TicketTotal");
		var hSalesTax			= document.getElementById("SalesTax");
	}

	// Round the decimal of the percentage to 3 decimal places due to the division above by 100
	fPCTrans					= Math.round(fPCTrans * 10000) / 10000;

	// Vars used in the looping process
	var iTotalNumTickets		= "0";
	var fThisTicketCost			= "";
	var fTotalTicketsCost		= "0";
		
	var sArrayLength			= parseFloat(document.getElementsByTagName("select").length);
		
	// Loops through the tickets counting
	var iCount					= 0;
	sDiscountApplied = '';
	for(iCount = 0; iCount < sArrayLength; iCount++)
	{
		var iTicketQuantity		= "0";
		var iTicketPrice		= "0";
		
		var sThisDropDown		= eval("document.getElementsByTagName(\"select\")[" + iCount + "].name");

		var iBreak				= eval("document.Landing." + sThisDropDown + "_break.value");
		var iAt					= parseFloat(eval("document.Landing." + sThisDropDown + "_at.value"));

		iTicketQuantity			= parseFloat(eval("document.Landing." + sThisDropDown + ".value"));
		iTicketPrice			= parseFloat(eval("document.Landing." + sThisDropDown + "_val.value"));

		if(iBreak > 0 && iAt > 0) {
			if(iTicketQuantity >= iBreak) {
				iTicketPrice = iAt;
				sDiscountApplied = '(discount applied)';
			}
		}
		
		bApplySalesTax			= parseFloat(eval("document.Landing." + sThisDropDown + "_salestax.value"));

		// Cost of this line of tickets
		fThisTicketCost			= parseFloat(iTicketQuantity)	* parseFloat(iTicketPrice);
		fTotalTicketsCost		= parseFloat(fTotalTicketsCost) + parseFloat(fThisTicketCost);

		// If this ticket has sales tax applied, add it to the rolling total
		if(bApplySalesTax == 1)
		{
			fThisTicketTax		= parseFloat(iTicketQuantity)	* parseFloat(iTicketPrice);
			fTotalTicketsTax	= parseFloat(fTotalTicketsTax)	+ parseFloat(fThisTicketTax);
		}
	
		iTotalNumTickets		= parseFloat(iTotalNumTickets)	+ parseFloat(iTicketQuantity);
		fThisTicketCost			= "0";
	}

	// General Booking fees
	fServiceCharge				= iTotalNumTickets	* fPerTicket;
	fServiceCharge				= roundNumber((fServiceCharge	+ fPerTrans), 2);
	fPCTransCharge				= fTotalTicketsCost * fPCTrans;
	fServiceCharge				= fServiceCharge + fPCTransCharge;
	fSalesTaxCharge				= fTotalTicketsTax	* (fSalesTax / 100);

	// Rounds the individual variables before we work out the total	
	fServiceCharge				= roundNumber(fServiceCharge, 2);
	fTotalTicketsCost			= roundNumber(fTotalTicketsCost, 2);
	fSalesTaxCharge				= roundNumber(fSalesTaxCharge, 2);
	fTotalCost					= roundNumber(fServiceCharge + fTotalTicketsCost, 2);

	// Checks they end £xxx.xx
	fTotalTicketsCost			= AddPence(fTotalTicketsCost);
	fServiceCharge				= AddPence(fServiceCharge);
	fTotalCost					= AddPence(fTotalCost);
	fSalesTaxCharge				= AddPence(fSalesTaxCharge);


	// Puts the variables into the Page
	if(fSalesTax > 0)
	{
		fGrandTotal						= AddPence(parseFloat(fTotalCost) + parseFloat(fSalesTaxCharge));
		replaceText(hTicketsCost,		fTotalTicketsCost + ' ' + sDiscountApplied);
		replaceText(hServiceCharge,		fServiceCharge);
		replaceText(hTicketTotal,		fTotalCost);
		replaceText(hSalesTax,			fSalesTaxCharge);
		replaceText(hGrandTotal,		fGrandTotal);
	}
	else
	{
		replaceText(hTicketsCost,		fTotalTicketsCost + ' ' + sDiscountApplied);
		replaceText(hServiceCharge,		fServiceCharge);
		replaceText(hGrandTotal,		fTotalCost);
	}
}


function HowHeldDropDown(strFormName)
{	
	var bGuestNames			= eval('document.' + strFormName + '.bGuestNames.checked');
	var bExtraQs			= eval('document.' + strFormName + '.bCollectExtendedProfileData.checked');

	if(bGuestNames == true && bExtraQs == true)
	{
		hHowHeld			= eval('document.' + strFormName + '.bHowHeld');
		hHowHeld.disabled	= false;
	}
	else
	{
		hHowHeld			= eval('document.' + strFormName + '.bHowHeld');
		hHowHeld.disabled	= true;
	}
}

function AddPence(number)
{
	var message="value" + number + ".nothing";
	var word=message.split(".")

	if (word[1] == "nothing")
	{
		number = number + ".00";
	}
	
	if (word[1] == '1' || word[1] == '2' || word[1] == '3' || word[1] == '4' || word[1] == '5' || word[1] == '6' || word[1] == '7' || word[1] == '8' || word[1] == '9')
	{
		number = number + "0";
	}

	return number;
}

function ValidObject(Object) 
{
	if(Object == null)
	{
		return false;
	}
	
	if(typeof(Object) == "undefined") 
	{
		return false;
	}
	
	return true;
}


function replaceText(el, text)
{
	if (el != null) 
	{
		clearText(el);
		var newNode = document.createTextNode(text);
		el.appendChild(newNode);
	}
}


function clearText(el) 
{
	if (el != null) 
	{
		if (el.childNodes) 
		{
			for (var i = 0; i < el.childNodes.length; i++) 
			{
				var childNode = el.childNodes[i];
				el.removeChild(childNode);
			}
		}
	}
}



function getText(el)
{
	var text = "";
	if(el != null)
	{
		if(el.childNodes) 
		{
			for(var i = 0; i < el.childNodes.length; i++)
			{
				var childNode = el.childNodes[i];
				if(childNode.nodeValue != null) 
				{
					text = text + childNode.nodeValue;
				}
			}
		}
      
	}
	return text;
}


function HelpPopupShowIframe()
{
	var agt=navigator.userAgent.toLowerCase();

	if (agt.indexOf("msie") != -1);
	{
		handle = document.getElementById("frame");
		handle.style.display = "inline";
		handle.style.top	 = 180;
		handle.style.left	 = 128;
		handle.style.width	 = 310;
		handle.style.height	 = 140;

	}

	HelpPopup();
}

function HelpPopup()
{

	HelpWindow = '<table width="550" height="300" cellpadding="5" cellspacing="5" class="blackBorder" bgcolor="white"><tr><td><h3><strong>Setting up multiple dates for an event</strong></h3><p><strong>To simplify the management of your ticket sales each event can only be on a single date. This allows you to easily track the sales for each date of your event. If you are running the same event on multiple dates then all you need to do is:</strong></p><p><strong>1</strong> - Create a new eTickets.to event for the first event date.</p><p><strong>2</strong> - After you have set up the event click the Duplicate Event button next to your event on the home page of your account.</p><p><strong>3</strong> - Edit the duplicated event to change the event date (you can also alter the other information if you wish).</p><p><strong>4</strong> - Repeat as many times are required.</p></td></tr><tr><td class="padded" width="20" align="center" valign="middle"><a href="javascript:void(0);" onClick="hideActionDivAndIframe()"><span class="fontnorm"><u>Close</u></span></a></td></tr></table>';

	changeActionDiv(HelpWindow, 'visible', 180, 380);

}


function NeedPaypal(fSalesTax)
{
	NeedPaymetDetails = '<form method="post" action="index.php?f=settings&stage=payment"><table width="520" height="200" cellpadding="5" cellspacing="5" class="blackBorder" bgcolor="white"><tr><td colspan="2"><h3><strong>Paymet Details Required</strong></h3>Before you can activate your account you must store either your Paypal or Google Checkout details. You can create a Paypal account <a href="https://www.paypal.com/cgi-bin/webscr?cmd=_registration-run" target="_blank">here</a> or a Google Checkout account <a href="https://www.google.com/accounts/NewAccount?service=sierra&signupAgent=sierraukAgent&gclid=homepage&hl=en-GB&continue=https%3A%2F%2Fcheckout.google.com%2Fbuyer%2Fwelcome.html%3Fhl%3Den-GB%26signupAgent%3DsierraukAgent%26gclid%3Dhomepage" target="_blank" target="_blank">here</a>.</td></tr><tr><td align="right"><strong>PayPal Email Address: </strong></td><td align="left"><input type="text" name="strPayPal" size="30" maxlength="120"></td></tr><tr><td align="right"><strong>Google Checkout Merchant ID: </strong></td><td align="left"><input type="text" name="strGoogle" size="30" maxlength="15"></td></tr><tr><td colspan="2" align="center"><input type="submit" name="submit" value=" Save " class="yellowstd"><input type="hidden" name="change" value="yes"><input type="hidden" name="bToActivate" value="1"><input type="hidden" name="strSalesTax" value="' + fSalesTax + '"> <input type="button" name="back" class="greystd" value="Cancel" onClick="hideActionDiv()"></td></tr></table></form>';

	changeActionDiv(NeedPaymetDetails, 'visible', 300, 150);
}


function duplicateClosedEvent(iEventID, iNumberofDates)
{
	if(iNumberofDates == 2)
	{
		strNewDates = '<form method="post" action="index.php?f=duplicateevent&amp;eventid=' + iEventID +'" name="duplicateclosedevent"><table width="320" height="100" cellpadding="5" cellspacing="5" class="blackBorder" bgcolor="white"><tr><td colspan="2"><h3><strong>New Dates Required</strong></h3>While you can alter all the details of this event in the usual way, please specify the start and end dates here.</td></tr><tr><td align="right"><strong>Start: </strong></td><td align="left"><input type="text" name="strEventDateFromD" value="dd-mm-yyyy" size="20"  onfocus="this.select();BuildCalendar(\'strEventDateFromD\', \'duplicateclosedevent\')" onClick="event.cancelBubble=true;this.select();BuildCalendar(\'strEventDateFromD\', \'duplicateclosedevent\');" onFocus="event.cancelBubble=true;this.select();BuildCalendar(\'strEventDateFromD\', \'duplicateclosedevent\');" id="strEventDateFromD" /></td></tr><tr><td align="right"><strong>End: </strong></td><td align="left"><input type="text" name="strEventDateToD" value="dd-mm-yyyy" size="20"  onfocus="this.select();BuildCalendar(\'strEventDateToD\', \'duplicateclosedevent\')" onClick="event.cancelBubble=true;this.select();BuildCalendar(\'strEventDateToD\', \'duplicateclosedevent\');" onFocus="event.cancelBubble=true;this.select();BuildCalendar(\'strEventDateToD\', \'duplicateclosedevent\');" id="strEventDateToD" /></td></tr><tr><td colspan="2" align="center"><input type="hidden" name="bClosedEvent" value="1"><input type="submit" name="submit" value=" Duplicate " class="yellowstd"> <input type="button" name="back" class="greystd" value="Cancel" onClick="hideActionDiv()"></td></tr></table></form>';
	}
	else
	{
		strNewDates = '<form method="post" action="index.php?f=duplicateevent&amp;eventid=' + iEventID +'" name="duplicateclosedevent"><table width="320" height="100" cellpadding="5" cellspacing="5" class="blackBorder" bgcolor="white"><tr><td colspan="2"><h3><strong>New Date Required</strong></h3>While you can alter all the details of this event in the usual way, please specify the date here.</td></tr><tr><td align="right"><strong>Date: </strong></td><td align="left"><input type="text" name="strEventDateFromD" value="dd-mm-yyyy" size="20"  onfocus="this.select();BuildCalendar(\'strEventDateFromD\', \'duplicateclosedevent\')" onClick="event.cancelBubble=true;this.select();BuildCalendar(\'strEventDateFromD\', \'duplicateclosedevent\');" onFocus="event.cancelBubble=true;this.select();BuildCalendar(\'strEventDateFromD\', \'duplicateclosedevent\');" id="strEventDateFromD" /></td></tr><tr><td colspan="2" align="center"><input type="hidden" name="bClosedEvent" value="1"><input type="submit" name="submit" value=" Duplicate " class="yellowstd"> <input type="button" name="back" class="greystd" value="Cancel" onClick="hideActionDiv()"></td></tr></table></form>';
	}

	iPosX	= 500;
	iPosY	= (yPos - 120) + document.body.scrollTop;

	changeActionDiv(strNewDates, 'visible', iPosX, iPosY);
}


function doDuplicateClosedEvent()
{
	hStart		= document.getElementById("strEventDateFrom");
	strStart	= hStart.value;
	hEnd		= document.getElementById("strEventDateTo");
	strEnd		= hEnd.value;
}

function hideActionDivAndIframe()
{
	document.getElementById("frame").style.display = "none";

	hideActionDiv();
}

function ticketAssignment(formname)
{

	handle = eval("document." + formname + ".iTotalTickets");
	handle.disabled = false;
	
	var AssignmentType = eval("document." + formname + ".bAssignmentType.value");

	if(AssignmentType == 'limit_individual')
	{
		handle.disabled = true;
		handle.style.backgroundColor = '#d4d0c8';
	}
	else
	{
		handle.disabled = false;
		handle.style.backgroundColor = '#ffffff';
	}

	return;

}



function Popup(url, width, height, options)
{	
	if(!options) options = 'scrollbars=yes,status=no';

	myFloater = window.open('', 'Information', options + ',width=' + width + ',height=' + height);
    myFloater.location.href = url;
}


function NavigateBack()
{
	document.back.submit();
}
function TypeResub(formname)
{	
	strHandle = eval("document." + formname);
	strHandle.bHasTypeBeenChanged.value=1;
	strHandle.submit();
}

function OptionsResub(formname)
{	
	strHandle = eval("document." + formname);
	strHandle.bHasNumberOfOptionsBeenChanged.value=1;
	strHandle.submit();
}

function TypeResubEdit(formname, thevalue)
{	
	strHandle = eval("document." + formname);
	strHandle.bHasTypeBeenChanged.value=1;
	strHandle.goingto.value=thevalue;
	strHandle.submit();
}

function OptionsResubEdit(formname, thevalue)
{	
	strHandle = eval("document." + formname);
	strHandle.bHasNumberOfOptionsBeenChanged.value=1;
	strHandle.goingto.value=thevalue;
	strHandle.submit();
}


function showRemoveExtendedProfileNewEvent(iExtendedProfileID)
{	
	strContent = '<form name="removeExtendedProfile" action="index.php?f=delete_extended_profile&amp;iExtendedProfileID=' + iExtendedProfileID + '" method="post"><table width="370" height="50" cellpadding="8" cellspacing="0" class="blackBorder" bgcolor="white"><tr><td class="padded" bgcolor="D7E1EA" align="center" colspan="2"><span class="fontbignormbold">Remove event question?</span></td></tr><tr><td class="padded" align="center" colspan="2"><span class="fontmedred">Are you sure you want to remove this extended profile?<br><br>This process is irreversible.</span></td></tr><tr><td align="right"><input type="button" class="yellowstd" name="cancel" value="Proceed" onClick="removeExtendedProfile.submit();"></td><td align="left"><input type="button" class="greystd" name="proceed" value="Cancel" onClick="hideActionDiv()"></td></tr></table></form>';


	yPos = 250;
	xPos = 315;

	return changeActionDiv(strContent, 'visible', xPos, yPos);
}

function showRemoveExtendedProfileEditedEvent(iExtendedProfileID, iEventID, strComingFrom)
{	
	strContent = '<form name="removeExtendedProfile" action="index.php?f=editevent&amp;iExtendedProfileID=' + iExtendedProfileID + '&amp;eventid=' + iEventID + '&amp;goingto=DeleteEventQuestion&amp;comingfrom=' + strComingFrom + '" method="post"><table width="370" height="50" cellpadding="8" cellspacing="0" class="blackBorder" bgcolor="white"><tr><td class="padded" bgcolor="D7E1EA" align="center" colspan="2"><span class="fontbignormbold">Remove event question?</span></td></tr><tr><td class="padded" align="center" colspan="2"><span class="fontmedred">This process is irreversible. Any information you may have already captured in answer to this question from ticket sales will be lost.</span></td></tr><br><tr><td align="right"><input type="button" class="yellowstd" name="cancel" value="Proceed" onClick="removeExtendedProfile.submit();"></td><td align="left"><input type="button" class="greystd" name="proceed" value="Cancel" onClick="hideActionDiv()"></td></tr></table></form>';


	yPos = 250;
	xPos = 315;
	
	if(IE)
	{
		upload					= document.getElementById("actionLayer");
		upload.style.visibility	= 'visible';
		upload.style.top		= yPos + 18;
		upload.style.left		= xPos;
		upload.style.width		= 370;
		upload.style.height		= 137;
	}

	return changeActionDiv(strContent, 'visible', xPos, yPos);
}

function confirmEventDelete(iEventID)
{	
	strContent = '<table width="370" height="50" cellpadding="8" cellspacing="0" class="blackBorder" bgcolor="white"><tr><td class="padded" bgcolor="D7E1EA" align="center" colspan="2"><span class="fontbignormbold">Confirm Event Deletion</span></td></tr><tr><td class="padded" align="center" colspan="2"><span class="fontmedred">This process is irreversible. All information about this event will be lost.</span></td></tr><tr><td align="right"><input type="button" class="redstd" name="delete" value="Delete" onClick="parent.location=\'index.php?f=deleteevent&amp;eventid=' + iEventID + '\'"></td><td align="left"><input type="button" class="greystd" name="cancel" value="Cancel" onClick="hideActionDiv();"></td></tr></table>';

	yPos = yPos - 50;
	xPos = xPos - 185;

	if(IE)
	{
		upload					= document.getElementById("actionLayer");
		upload.style.visibility	= 'visible';
		upload.style.top		= yPos;
		upload.style.left		= xPos;
		upload.style.width		= 370;
		upload.style.height		= 137;
	}

	return changeActionDiv(strContent, 'visible', xPos, yPos);
}


function HideTable(name, formname)
{
	if(document.getElementById(name).style.display != 'none') Effect.SlideUp(document.getElementById(name));

	field_handle = eval("document." + formname + ".bTableStatus");
	field_handle.value = '0';

	handle = document.getElementById('hide' + name);
	handle.innerHTML = '[<a href="#BuyCustomisationOptions" class="fontnorm" onClick="ShowTable(\'' + name + '\', \'' + formname + '\');">show</a>]';
}

function ShowTable(name, formname)
{
	if(document.getElementById(name).style.display == 'none') Effect.SlideDown(document.getElementById(name));

	field_handle = eval("document." + formname + ".bTableStatus");
	field_handle.value = '1';

	handle = document.getElementById('hide' + name);
	handle.innerHTML = '[<a href="#BuyCustomisationOptions" class="fontnorm" onClick="HideTable(\'' + name + '\', \'' + formname + '\');">hide</a>]';
}


function ResetPageDesignColour(form, element, val)
{
	// Resets a 
	field_handle = eval("document." + form + "." + element);
	field_handle.value = val;

	document.getElementById(element + '_colour').style.backgroundColor=val;
	return;
}

function RemovePageDesignImage(form, element, val)
{
	// Resets a 
	field_handle = eval("document." + form + "." + element);
	field_handle.value = val;

	hImageMessage = document.getElementById(element + '_Text');

	replaceText(hImageMessage, 'Image Removed');

	field_handle = eval("document." + form + ".NewBGImage");
	field_handle.value = 2;
	return;
}

function DropListSelection(form, element, val)
{
	// Resets a 
	field_handle = eval("document." + form + "." + element);
	field_handle.selectedIndex = val;

	return;
}



var APIrequest;
var NewDL;
var DropListName;
var strSignupHashX;
var iSignupCIDX;
var strFormNameX;
var iTTTX;
var iUpdateTest;
var DoCreateProc;
var DoSend;

function newlistform(strFormName, strDropName, strSignupHash, iSignupCID, iTTT)
{	
	var listid	= eval("document." + strFormName + "." + strDropName + ".value");

	if (listid == "New")
	{
		strContent = '<form name="newsuplist" action="index.php?f=delete_extended_profil" method="post"><table width="400" height="50" cellpadding="8" cellspacing="0" class="blackBorder" bgcolor="white"><tr><td class="padded" bgcolor="D7E1EA" align="center" colspan="2"><span class="fontbignormbold">Add New Sign-Up.to List</span></td></tr><tr><td class="padded" align="right" width="50%"><span class="fontnorm">Sign-Up.to List Name: </span></td><td class="padded" align="left" width="50%"><input type="text" name="strListName" value="" size="20"  maxlength="32"></td></tr><tr><td align="right" width="50%"><input type="button" class="greystd" name="cancel" value="Cancel" onClick="hideActionDiv()"></td><td align="left" width="50%"><input type="button" class="yellowstd" name="save" value="Save" onClick="savesuplist(\'' + strSignupHash + '\', \'' + iSignupCID + '\', \'' + strFormName + '\', \'' + iTTT + '\');"></td></tr></table></form>';
	}
	else
	{
		return;
	}

	aTopnLeft = findPos(eval(document.getElementById("Div" + strDropName))); 

	yPos = aTopnLeft[1] - 50;
	xPos = aTopnLeft[0] - 125;

	return changeActionDiv(strContent, 'visible', xPos, yPos);
}

function savesuplist(strSignupHash, iSignupCID, strFormName, iTTT)
{
	var strListName = document.newsuplist.strListName.value;

	strSignupHashX	= strSignupHash;
	iSignupCIDX		= iSignupCID;
	strFormNameX	= strFormName;
	iTTTX			= iTTT;

	if(strListName == '')
	{
		alert('Please enter the name of the list');

		return;
	}
	else
	{
		var URL = './addlist.php?hash=' + strSignupHash + '&cid=' + iSignupCID + '&name=' + strListName + '&dummy=' + new Date().getTime();
		iTicketLoop		= 1;

		APIrequest = createRequest();
		APIrequest.open("GET", URL, true);
		APIrequest.onreadystatechange = UpdateDropLists;
		APIrequest.send(null);
	}

	hideActionDiv();
}


function UpdateDropLists()
{
	if(APIrequest.readyState == 4)
	{
		RequestDropData();
	}
}

function RequestDropData()
{
	DropListName	= "iSUPListID" + iTicketLoop;

	var listid		= escape(eval("document." + strFormNameX + ".iSUPListID" + iTicketLoop + ".value"));

	var URL			= './remakedroplist.php?hash=' + strSignupHashX + '&cid=' + iSignupCIDX + '&formname=' + strFormNameX + '&iticketloop=' + iTicketLoop + '&ittt=' + iTTTX + '&iselectedlistid=' + listid + '&dummy=' + new Date().getTime();

	NewDL = createRequest();
	NewDL.open("GET", URL, true);


	NewDL.onreadystatechange = RecreateDropList;

	NewDL.send(null);
}


function RecreateDropList()
{
	if(NewDL.readyState == 4)
	{
		handle = eval(document.getElementById("Div" + DropListName));
		handle.innerHTML = NewDL.responseText;

		iTicketLoop++;
		if(iTicketLoop <= iTTTX)
		{
			RequestDropData();
		}
		DoCreateProc = 1;
		DoSend		 = 0;
	}
}


function TypeofEvent(strEventType, form, strToValue)
{
	strEventDateToInput = '<input type="text" name="strEventDateTo" value="' + strToValue + '" size="20" onfocus="this.select();BuildCalendar(\'strEventDateTo\', \'' + form + '\')" onclick="event.cancelBubble=true;this.select();BuildCalendar(\'strEventDateTo\', \'' + form + '\');" />';
	
	switch (strEventType)
	{
		case "single":
			hFromText			= document.getElementById("EventDateFromText");
			hFromText.innerHTML	= '';
			
			hFromText			= document.getElementById("EventDateToText");
			hFromText.innerHTML	= '';

			hFromText			= document.getElementById("EventDateToSpan");
			hFromText.innerHTML	= '&nbsp;';

			hFromText			= document.getElementById("DateExtraText");
			hFromText.innerHTML	= '';

			hFromText			= document.getElementById("bGuestNames");
			hFromText.disabled	= false;
			hFromText.checked	= false;
			break

		
		case "multi":
			hFromText			= document.getElementById("EventDateFromText");
			hFromText.innerHTML	= '<strong>From: </strong>';
			
			hFromText			= document.getElementById("EventDateToText");
			hFromText.innerHTML	= '&nbsp;&nbsp;&nbsp;<strong>To: </strong>';

			hFromText			= document.getElementById("EventDateToSpan");
			if(hFromText.innerHTML == '&nbsp;') hFromText.innerHTML = strEventDateToInput;

			hFromText			= document.getElementById("DateExtraText");
			hFromText.innerHTML	= '';

			hFromText			= document.getElementById("bGuestNames");
			hFromText.checked	= true;
			hFromText.disabled	= true;
			break

	
		case "recurring":
			hFromText			= document.getElementById("EventDateFromText");
			hFromText.innerHTML	= '<strong>From: </strong>';
			
			hFromText			= document.getElementById("EventDateToText");
			hFromText.innerHTML	= '&nbsp;&nbsp;&nbsp;<strong>To: </strong>';

			hFromText			= document.getElementById("EventDateToSpan");
			if(hFromText.innerHTML == '&nbsp;') hFromText.innerHTML = strEventDateToInput;

			hWeekend			= eval("document." + form + ".iWeekends");
			iWeekends			= hWeekend.value;

			hFromText			= document.getElementById("bGuestNames");
			hFromText.disabled	= false;
			hFromText.checked	= false;

			if(iWeekends == 1)
			{
				var strWeekendsI	= '<span class="fontnorm" id="WeekendISpan"><strong>Included</strong></span>';
				var strWeekendsX	= '<span class="fontnorm" id="WeekendXSpan"><a href="javascript:void(0);" onClick="ExcludeWeekends(\'' + form + '\')" class="fontunder"><span>Exclude</span></a></span>';
			}
			else
			{
				var strWeekendsI	= '<span class="fontnorm" id="WeekendISpan"><a href="javascript:void(0);" onClick="IncludeWeekends(\'' + form + '\')" class="fontunder"><span>Include</span></a></span>';
				var strWeekendsX	= '<span class="fontnorm" id="WeekendXSpan"><strong>Excluded</strong></span>';
			}

			hWeekDays			= eval("document." + form + ".iWeekDays");
			iWeekDays			= hWeekDays.value;

			if(iWeekDays == 1)
			{
				var strWeekDaysI	= '<span class="fontnorm" id="WeekDayISpan"><strong>Included</strong></span>';
				var strWeekDaysX	= '<span class="fontnorm" id="WeekDayXSpan"><a href="javascript:void(0);" onClick="ExcludeWeekDays(\'' + form + '\')" class="fontunder"><span>Exclude</span></a></span>';
			}
			else
			{
				var strWeekDaysI	= '<span class="fontnorm" id="WeekDayISpan"><a href="javascript:void(0);" onClick="IncludeWeekDays(\'' + form + '\')" class="fontunder"><span>Include</span></a></span>';
				var strWeekDaysX	= '<span class="fontnorm" id="WeekDayXSpan"><strong>Excluded</strong></span>';
			}

			hFromText			= document.getElementById("DateExtraText");
			hFromText.innerHTML	= '<table width="300" border="0" cellpadding="2" cellspacing="0"><tr><td><span class="fontnorm"><strong>Exclude Dates</strong></span></td></tr><tr><td><span class="fontnorm">Weekends: </span></td><td>' + strWeekendsI + '<span class="fontnorm"> / </span>' + strWeekendsX + '</td></tr><tr><td><span class="fontnorm">Week Days:</span></td><td>' + strWeekDaysI + '<span class="fontnorm"> / </span>' + strWeekDaysX + '</td></tr><tr><td colspan="2"><span class="fontnorm"><strong>Other Excluded Dates</strong>&nbsp;&nbsp;(<a href="javascript:void(0);" id="OtherDatesLink" onclick="event.cancelBubble=true;BuildCalendar(\'strExcludedDates\', \'' + form + '\');" class="fontunder">add</a>)</span></td></tr><tr><td><span class="fontnorm" id="OtherDatesSpan"></span></td><td><span class="fontnorm"></span></td></tr><tr><td colspan="2"><span class="fontnorm" id="OtherExDatesDropSpan"><select name="OtherExDatesDrop" size="1"><option value="">Currently Excluded</option></select></span>&nbsp;<span class="fontnorm">(<a href="javascript:void(0);" onclick="RemoveOtherExDate(\'' + form + '\', \'OtherExDatesDrop\', \'Currently Excluded\');" class="fontunder">remove</a>)&nbsp;&nbsp;<a href="javascript:void(0);" onclick="RemoveAllOtherExDates(\'' + form + '\', \'OtherExDatesDrop\', \'Currently Excluded\');" class="fontunder">clear</a></span></td></tr></table>';

			CreateOtherExDate(form);
			break
	}
}

function ExcludeWeekends(form, iTicketLoop)
{	
	var strWeekends		= (iTicketLoop > 0 ? 'iWeekends'	+ iTicketLoop : 'iWeekends');
	var strWeekDays		= (iTicketLoop > 0 ? 'iWeekDays'	+ iTicketLoop : 'iWeekDays');
	var strWeekendISpan	= (iTicketLoop > 0 ? 'WeekendISpan' + iTicketLoop : 'WeekendISpan');
	var strWeekendXSpan	= (iTicketLoop > 0 ? 'WeekendXSpan' + iTicketLoop : 'WeekendXSpan');
	var strWeekDayISpan	= (iTicketLoop > 0 ? 'WeekDayISpan' + iTicketLoop : 'WeekDayISpan');
	var strWeekDayXSpan	= (iTicketLoop > 0 ? 'WeekDayXSpan' + iTicketLoop : 'WeekDayXSpan');

	hWeekend			= eval("document." + form + "." + strWeekends);
	hWeekend.value		= '0';

	hWeekend			= eval("document." + form + "." + strWeekDays);
	hWeekend.value		= '1';

	hInclude			= document.getElementById(strWeekendISpan);
	hInclude.innerHTML	= '<a href="javascript:void(0);" onClick="IncludeWeekends(\'' + form + '\', \'' + iTicketLoop + '\')" class="fontunder"><span>Include</span></a>';

	hExclude			= document.getElementById(strWeekendXSpan);
	hExclude.innerHTML	= '<strong>Excluded</strong>';

	hInclude			= document.getElementById(strWeekDayISpan);
	hInclude.innerHTML	= '<strong>Included</strong>';

	hExclude			= document.getElementById(strWeekDayXSpan);
	hExclude.innerHTML	= '<a href="javascript:void(0);" onClick="ExcludeWeekDays(\'' + form + '\', \'' + iTicketLoop + '\')" class="fontunder"><span>Exclude</span></a>';
}

function ExcludeWeekDays(form, iTicketLoop)
{	
	var strWeekends		= (iTicketLoop > 0 ? 'iWeekends'	+ iTicketLoop : 'iWeekends');
	var strWeekDays		= (iTicketLoop > 0 ? 'iWeekDays'	+ iTicketLoop : 'iWeekDays');
	var strWeekendISpan	= (iTicketLoop > 0 ? 'WeekendISpan' + iTicketLoop : 'WeekendISpan');
	var strWeekendXSpan	= (iTicketLoop > 0 ? 'WeekendXSpan' + iTicketLoop : 'WeekendXSpan');
	var strWeekDayISpan	= (iTicketLoop > 0 ? 'WeekDayISpan' + iTicketLoop : 'WeekDayISpan');
	var strWeekDayXSpan	= (iTicketLoop > 0 ? 'WeekDayXSpan' + iTicketLoop : 'WeekDayXSpan');

	hWeekend			= eval("document." + form + "." + strWeekDays);
	hWeekend.value		= '0';

	hWeekend			= eval("document." + form + "." + strWeekends);
	hWeekend.value		= '1';

	hInclude			= document.getElementById(strWeekDayISpan);
	hInclude.innerHTML	= '<a href="javascript:void(0);" onClick="IncludeWeekDays(\'' + form + '\', \'' + iTicketLoop + '\')" class="fontunder"><span>Include</span></a>';

	hExclude			= document.getElementById(strWeekDayXSpan);
	hExclude.innerHTML	= '<strong>Excluded</strong>';

	hInclude			= document.getElementById(strWeekendISpan);
	hInclude.innerHTML	= '<strong>Included</strong>';

	hExclude			= document.getElementById(strWeekendXSpan);
	hExclude.innerHTML	= '<a href="javascript:void(0);" onClick="ExcludeWeekends(\'' + form + '\', \'' + iTicketLoop + '\')" class="fontunder"><span>Exclude</span></a>';
}

function IncludeWeekends(form, iTicketLoop)
{	
	var strWeekends		= (iTicketLoop > 0 ? 'iWeekends'	+ iTicketLoop : 'iWeekends');
	var strWeekendISpan	= (iTicketLoop > 0 ? 'WeekendISpan' + iTicketLoop : 'WeekendISpan');
	var strWeekendXSpan	= (iTicketLoop > 0 ? 'WeekendXSpan' + iTicketLoop : 'WeekendXSpan');

	hWeekend			= eval("document." + form + "." + strWeekends);
	hWeekend.value		= '1';

	hInclude			= document.getElementById(strWeekendISpan);
	hInclude.innerHTML	= '<strong>Included</strong>';

	hExclude			= document.getElementById(strWeekendXSpan);
	hExclude.innerHTML	= '<a href="javascript:void(0);" onClick="ExcludeWeekends(\'' + form + '\', \'' + iTicketLoop + '\')" class="fontunder"><span>Exclude</span></a>';
}

function IncludeWeekDays(form, iTicketLoop)
{	
	var strWeekDays		= (iTicketLoop > 0 ? 'iWeekDays'	+ iTicketLoop : 'iWeekDays');
	var strWeekDayISpan	= (iTicketLoop > 0 ? 'WeekDayISpan' + iTicketLoop : 'WeekDayISpan');
	var strWeekDayXSpan	= (iTicketLoop > 0 ? 'WeekDayXSpan' + iTicketLoop : 'WeekDayXSpan');

	hWeekend			= eval("document." + form + "." + strWeekDays);
	hWeekend.value		= '1';

	hInclude			= document.getElementById(strWeekDayISpan);
	hInclude.innerHTML	= '<strong>Included</strong>';

	hExclude			= document.getElementById(strWeekDayXSpan);
	hExclude.innerHTML	= '<a href="javascript:void(0);" onClick="ExcludeWeekDays(\'' + form + '\', \'' + iTicketLoop + '\')" class="fontunder"><span>Exclude</span></a>';
}

function AddOtherExDate(form, thedates, strDropToUse, strDefaultText)
{
	var aAllDates		= thedates.split(',');
	var iTotal			= aAllDates.length;
	var strNewDrop;
	var aSortedDates	= aAllDates;
	var aOutput			= aAllDates;

	for(var iCount = 0; iCount < iTotal; iCount++)
	{
		strNewDrop		= strNewDrop + '<option value="' + aAllDates[iCount] + '">' + aAllDates[iCount] + '</option>';
	}
	
	hDrop				= document.getElementById(strDropToUse + 'Span');

	hDrop.innerHTML		= '<select name="' + strDropToUse + '" size="1"><option value="">UPDATING...</option></select>';

	var strNewDropData	= '<select name="' + strDropToUse + '" size=\"1\" id="' + strDropToUse + '"><option value="">' + strDefaultText + '</option>' + strNewDrop + '</select>';

	strOutput			= "hDrop.innerHTML = '" + strNewDropData + "'";
	strOutput			= strOutput.replace('undefined', '');

	setTimeout(strOutput, 500);
}

function RemoveOtherExDate(form, strElementInUse, strDefaultText)
{
	hDrop				= document.getElementById(strElementInUse);
	strSelectedDate		= hDrop.value;

	if(strElementInUse.length == 17)
	{
		strHidden		= 'strExcludedDates' + strElementInUse.substr(16, 1);
	}
	else
	{
		strHidden		= 'strExcludedDates';
	}

	hExDates			= eval("document." + form + "." + strHidden);
	strExDates			= hExDates.value;

	strNewExDate		= strExDates.replace(strSelectedDate, '');
	strNewExDate		= strNewExDate.replace(',,', ',');
	strNewExDate		= (strNewExDate.substr(0, 1)  == ',' ? (strNewExDate.substr(1)) : (strNewExDate.substr(0)));
	strNewExDate		= (strNewExDate.substr(-1, 1) == ',' ? (strNewExDate.substr(0, strNewExDate.length - 1)) : (strNewExDate.substr(0)));

	var aAllDates		= strNewExDate.split(',');
	var iTotal			= aAllDates.length;
	var strNewDrop;

	for(var iCount = 0; iCount < iTotal; iCount++)
	{
		if(aAllDates[iCount] != '')
		{
			strNewDrop	= strNewDrop + '<option value="' + aAllDates[iCount] + '">' + aAllDates[iCount] + '</option>';
		}
	}

	hDropSpan			= document.getElementById(strElementInUse + 'Span');

	hDropSpan.innerHTML	= '<select name="' + strElementInUse + '" size="1"><option value="">UPDATING...</option></select>';

	strOutput			= "hDropSpan.innerHTML = '<select name=\"" + strElementInUse + "\" size=\"1\" id=\"" + strElementInUse + "\"><option value=\"\">" + strDefaultText + "</option>" + strNewDrop + "</select>'";
	strOutput			= strOutput.replace('undefined', '');

	setTimeout(strOutput, 500);

	hExDates.value		= strNewExDate;
}

function RemoveAllOtherExDates(form, strElementInUse, strDefaultText)
{
	hDrop				= document.getElementById('OtherExDatesDropSpan');
	hDrop.innerHTML		= '<select name="OtherExDatesDrop" size="1"><option value="">UPDATING...</option></select>';

	strOutput			= "hDrop.innerHTML = '<select name=\"OtherExDatesDrop\" size=\"1\"><option value=\"\">" + strDefaultText + "</option></select>'";

	setTimeout(strOutput, 500);
	
	strHidden			= (strElementInUse.length == 17 ? 'strExcludedDates' + strElementInUse.substr(-1, 1) : 'strExcludedDates');
	hExDates			= eval("document." + form + "." + strHidden);
	hExDates.value		= '';
}

function CreateOtherExDate(form)
{
	hExDates			= eval("document." + form + ".strExcludedDates");
	strExDates			= hExDates.value;

	var aAllDates		= strExDates.split(',');
	var iTotal			= aAllDates.length;
	var strNewDrop		= '<select name="OtherExDatesDrop" size="1"><option value="">Currently Excluded</option>';

	for(var iCount = 0; iCount < iTotal; iCount++)
	{
		if(aAllDates[iCount] != '')
		{
			strNewDrop	= strNewDrop + '<option value="' + aAllDates[iCount] + '">' + aAllDates[iCount] + '</option>';
		}
	}

	strNewDrop	= strNewDrop + '</select>';

	hDrop				= document.getElementById('OtherExDatesDropSpan');
	hDrop.innerHTML		= strNewDrop;
}

function CreateOtherTicketExDate(form, iTickets, strEventType)
{
	if(strEventType != 'recurring')
	{
		return;
	}
	else
	{
		for(var iMCount = 1; iMCount <= iTickets; iMCount++)
		{
			hExDates			= eval("document." + form + ".strExcludedDates" + iMCount);
			strExDates			= hExDates.value;

			var aAllDates		= strExDates.split(',');
			var iTotal			= aAllDates.length;
			var strNewDrop		= '';

			for(var iCount = 0; iCount < iTotal; iCount++)
			{
				if(aAllDates[iCount] != '')
				{
					strNewDrop	= strNewDrop + '<option value="' + aAllDates[iCount] + '">' + aAllDates[iCount] + '</option>';
				}
			}

			hDrop				= document.getElementById('OtherExDatesDrop' + iMCount + 'Span');
			hDrop.innerHTML		= '<select name="OtherExDatesDrop' + iMCount + '" size="1" id="OtherExDatesDrop' + iMCount + '"><option value=\"\">Excluded</option>' + strNewDrop + '</select>';
		}
	}
}

function ShowHideDaysTypeTable(strTicketDays, DaysTypeTable)
{
	var iNumDays	= strTicketDays.value;

	if(iNumDays == 1)
	{
		hTable			= document.getElementById(DaysTypeTable);
		hTable.style.display	= 'none'; 
	}
	else
	{
		hTable			= document.getElementById(DaysTypeTable);
		hTable.style.display	= ''; 
	}
}

function ManualShowDates(strHowDays, iTotalDays, iEventID, iTicketID, strStartDate, strErrorMessage, strEventType)
{
	hSpan	= document.getElementById("DatesSpan");

	if(strEventType == 'multi')
	{
		switch(strHowDays)
		{
			case 'cont':
				if(typeof(strErrorMessage) == "undefined")
				{
					strErrorMessage = ' ';
				}

				strTable	= '<table width="100%" border="0" cellspacing="0" cellpadding="5"><tr><td colspan="2" align="center"><span class="fontbuy"><strong>Any dates which have been excluded for this ticket or event will not be shown in the calendar views. If you wish to sell this ticket for an excluded date, you can manually enter the date in the format dd-mm-yyyy</strong></span></td></tr><tr><td width="50%" align="right" valign="top"><span class="fontbuy"><strong>Start Date</strong></span></td><td align="left"><input type="text" name="StartDate" value="' + strStartDate + '" size="20" onFocus="this.select();BuildCalendar(\'StartDate\', \'MTicket\', \'' + iEventID + '\', \'' + iTicketID + '\');" onClick="event.cancelBubble=true;this.select();BuildCalendar(\'StartDate\', \'MTicket\', \'' + iEventID + '\', \'' + iTicketID + '\');" /><br /><span class="fontbred" />' + strErrorMessage + '</span></td></tr></table>';

				hSpan.innerHTML	= strTable;
				break;
			
			case 'spor':
				var strTableRows = '';

				aDates	= strStartDate.split('/');
				aErrors	= strErrorMessage.split('/');

				for(iCount = 0; iCount < iTotalDays; iCount++)
				{
					strThisDate		= aDates[iCount];
					strThisError	= aErrors[iCount];
					iNCount			= iCount + 1;

					if(typeof(strThisError) == "undefined")
					{
						strThisError = ' ';
					}

					strTableRows = strTableRows + '<tr><td width="50%" align="right" valign="top"><span class="fontbuy"><strong>Date ' + iNCount + '</strong></span></td><td align="left"><input type="text" name="Date' + iCount + '" value="' + strThisDate + '" size="20" onFocus="this.select();BuildCalendar(\'Date' + iCount + '\', \'MTicket\', \'' + iEventID + '\', \'' + iTicketID + '\');" onClick="event.cancelBubble=true;this.select();BuildCalendar(\'Date' + iCount + '\', \'MTicket\', \'' + iEventID + '\', \'' + iTicketID + '\');" /><br /><span class="fontbred" />' + strThisError + '</span></td></tr>';
				}


				strTable	= '<table width="100%" border="0" cellspacing="0" cellpadding="5"><tr><td colspan="2" align="center"><span class="fontbuy"><strong>Any dates which have been excluded for this ticket or event will not be shown in the calendar views. If you wish to sell this ticket for an excluded date, you can manually enter the date in the format dd-mm-yyyy</strong></span></td></tr>' + strTableRows + '</table>';

				hSpan.innerHTML	= strTable;
				break;

			default:
				hSpan.innerHTML	= ' ';
				break;
		}
	}
	else if (strEventType == 'recurring')
	{
		if(typeof(strErrorMessage) == "undefined")
		{
			strErrorMessage = ' ';
		}

		strTable	= '<table width="100%" border="0" cellspacing="0" cellpadding="5"><tr><td colspan="2" align="center"><span class="fontbuy"><strong>Any dates which have been excluded for this ticket or event will not be shown in the calendar views. If you wish to sell this ticket for an excluded date, you can manually enter the date in the format dd-mm-yyyy</strong></span></td></tr><tr><td width="50%" align="right" valign="top"><span class="fontbuy"><strong>Start Date</strong></span></td><td align="left"><input type="text" name="StartDate" value="' + strStartDate + '" size="20" onFocus="this.select();BuildCalendar(\'StartDate\', \'MTicket\', \'' + iEventID + '\', \'' + iTicketID + '\');" onClick="event.cancelBubble=true;this.select();BuildCalendar(\'StartDate\', \'MTicket\', \'' + iEventID + '\', \'' + iTicketID + '\');" /><br /><span class="fontbred" />' + strErrorMessage + '</span></td></tr></table>';

		hSpan.innerHTML	= strTable;
	}
}


function whatDownload(iTicketID, iSelectedRow)
{
	hChecked		= eval("document.getElementById(\"ticket" + iTicketID + "\")");
	hTable			= document.getElementById("tickets");
	hTableBodies	= document.getElementById("tickets").tBodies[0];

	if(hChecked.checked == true)
	{
		if(hTable.style.width == '200px')
		{
			hTable.style.width	= '300';

			var newCell			= hTableBodies.rows[0].insertCell(-1);

			newCell.innerHTML	= '<span class="fontnorm"><strong>Dates</strong></span>';
			newCell.align		= 'center';
			newCell.valign		= 'top';
			newCell.width		= '100';

			for (iCount = 1; iCount < hTableBodies.rows.length; iCount++)
			{
				if(iCount == iSelectedRow)
				{
					strRow	= '<input type="radio" name="which' + iTicketID + '" value="all" checked  onClick="showHideDates(this.value, \'' + iTicketID + '\', \'' + iSelectedRow + '\');"><span class="fontbuy"><strong>All Dates</strong></span><br><input type="radio" name="which' + iTicketID + '" value="some" onClick="showHideDates(this.value, \'' + iTicketID + '\', \'' + iSelectedRow + '\');"><span class="fontbuy"><strong>Selected</strong></span>';
				}
				else
				{
					strRow	= '&nbsp;';
				}
				
				newCell				= hTableBodies.rows[iCount].insertCell(-1);
				newCell.innerHTML	= strRow;
			}
		}
		else
		{
			strRow ='<input type="radio" name="which' + iTicketID + '" value="all" checked  onClick="showHideDates(this.value, \'' + iTicketID + '\', \'' + iSelectedRow + '\');"><span class="fontbuy"><strong>All Dates</strong></span><br><input type="radio" name="which' + iTicketID + '" value="some" onClick="showHideDates(this.value, \'' + iTicketID + '\', \'' + iSelectedRow + '\');"><span class="fontbuy"><strong>Selected</strong></span>';		

			hTableBodies.rows[iSelectedRow].cells[2].innerHTML = strRow;
		}
	}
	else
	{
		hTableBodies.rows[iSelectedRow].cells[2].innerHTML = '&nbsp;';
		if(hTableBodies.rows[iSelectedRow].cells.length > 3)
		{
			hTableBodies.rows[iSelectedRow].cells[3].innerHTML = '&nbsp;';
		}

		if(hTableBodies.rows[iSelectedRow].cells.length > 3)
		{
			bDeleteCol2	= true;

			for(iCount = 1; iCount < hTableBodies.rows.length; iCount++)
			{
				if(hTableBodies.rows[iCount].cells[3].innerHTML != '&nbsp;')
				{
					bDeleteCol2	= false;
				}
			}
		}
		else
		{
			bDeleteCol2 = false;
		}

		if(bDeleteCol2 == true)
		{
			for (var iCount = 0; iCount < hTableBodies.rows.length; iCount++)
			{
				if (hTableBodies.rows[iCount].cells.length > 1)
				{
					hTableBodies.rows[iCount].deleteCell(-1);
				}
			}

			hTable.style.width	= '300';
		}

		bDeleteCol	= true;

		for(iCount = 1; iCount < hTableBodies.rows.length; iCount++)
		{
			if(hTableBodies.rows[iCount].cells[2].innerHTML != '&nbsp;')
			{
				bDeleteCol	= false;
			}
		
		}

		if(bDeleteCol == true)
		{
			for (var iCount = 0; iCount < hTableBodies.rows.length; iCount++)
			{
				if (hTableBodies.rows[iCount].cells.length > 1)
				{
					hTableBodies.rows[iCount].deleteCell(-1);
				}
			}
			
			hTable.style.width	= '200';
		}
	}	
}


function showHideDates(strWhich, iTicketID, iSelectedRow)
{
	hTable			= document.getElementById("tickets");
	hTableBodies	= document.getElementById("tickets").tBodies[0];

	if(strWhich == 'some')
	{
		if(hTable.style.width == '300px')
		{
			hTable.style.width	= '492';

			var newCell			= hTableBodies.rows[0].insertCell(-1);

			newCell.innerHTML	= '<span class="fontnorm"><strong>Selected Dates</strong></span>';
			newCell.align		= 'center';
			newCell.width		= '200';

			for (iCount = 1; iCount < hTableBodies.rows.length; iCount++)
			{
				if(iCount == iSelectedRow)
				{
					strRow	= '<a href="javascript:void(0);" onclick="event.cancelBubble=true;BuildCalendar(\'chosendates' + iTicketID + '\', \'download\');" class="fontunder">Select dates</a><br><span id="chosendates' + iTicketID + 'span"><select name="chosendates' + iTicketID + '" size="1" id="chosendates' + iTicketID + '"></select></span> <a href="javascript:void(0);" onclick="RemoveOtherIncDate(\'download\', \'chosendates' + iTicketID + '\', \'Chosen Dates\');" class="fontunder">Remove</a><input type="hidden" name="chosendates' + iTicketID + 'hidden" value=""  />';
				}
				else
				{
					strRow	= '&nbsp;';
				}

				newCell				= hTableBodies.rows[iCount].insertCell(-1);
				newCell.innerHTML	= strRow;
			}
		}
		else
		{
			strRow = '<a href="javascript:void(0);" onclick="event.cancelBubble=true;BuildCalendar(\'chosendates' + iTicketID + '\', \'download\');" class="fontunder">Select dates</a><br><span id="chosendates' + iTicketID + 'span"><select name="chosendates' + iTicketID + '" size="1" id="chosendates' + iTicketID + '"></select></span> <a href="javascript:void(0);" onclick="RemoveOtherIncDate(\'download\', \'chosendates' + iTicketID + '\', \'Chosen Dates\');" class="fontunder">Remove</a><input type="hidden" name="chosendates' + iTicketID + 'hidden" value=""  />';	

			hTableBodies.rows[iSelectedRow].cells[3].innerHTML = strRow;
		}
	}
	else
	{
		hTableBodies.rows[iSelectedRow].cells[3].innerHTML = '&nbsp;';

		bDeleteCol2	= true;

		for(iCount = 1; iCount < hTableBodies.rows.length; iCount++)
		{
			if(hTableBodies.rows[iCount].cells[3].innerHTML != '&nbsp;')
			{
				bDeleteCol2	= false;
			}			
		}

		if(bDeleteCol2 == true)
		{
			for (var iCount = 0; iCount < hTableBodies.rows.length; iCount++)
			{
				if (hTableBodies.rows[iCount].cells.length > 1)
				{
					hTableBodies.rows[iCount].deleteCell(-1);
				}
			}

			hTable.style.width	= '300';
		}
	}
}


function AddOtherIncDate(form, thedates, strDropToUse, strDefaultText)
{
	var aAllDates		= thedates.split(',');
	var iTotal			= aAllDates.length;
	var strNewDrop;
	var aSortedDates	= aAllDates;
	var aOutput			= aAllDates;

	for(var iCount = 0; iCount < iTotal; iCount++)
	{
		strNewDrop		= strNewDrop + '<option value="' + aAllDates[iCount] + '">' + aAllDates[iCount] + '</option>';
	}

	hDrop				= document.getElementById(strDropToUse + 'span');

	hDrop.innerHTML		= '<select name="' + strDropToUse + '" size="1"><option value="">UPDATING...</option></select>';

	var strNewDropData	= '<select name="' + strDropToUse + '" size=\"1\" id="' + strDropToUse + '"><option value="">' + strDefaultText + '</option>' + strNewDrop + '</select>';

	strOutput			= "hDrop.innerHTML = '" + strNewDropData + "'";
	strOutput			= strOutput.replace('undefined', '');

	setTimeout(strOutput, 500);
}

function RemoveOtherIncDate(form, strElementInUse, strDefaultText)
{
	hDrop				= document.getElementById(strElementInUse);
	strSelectedDate		= hDrop.value;


	hIncDates			= eval("document." + form + "." + strElementInUse + 'hidden');
	strIncDates			= hIncDates.value;

	strNewIncDate		= strIncDates.replace(strSelectedDate, '');
	strNewIncDate		= strNewIncDate.replace(',,', ',');
	strNewIncDate		= (strNewIncDate.substr(0, 1)  == ',' ? (strNewIncDate.substr(1)) : (strNewIncDate.substr(0)));
	strNewIncDate		= (strNewIncDate.substr(-1, 1) == ',' ? (strNewIncDate.substr(0, strNewIncDate.length - 1)) : (strNewIncDate.substr(0)));

	var aAllDates		= strNewIncDate.split(',');
	var iTotal			= aAllDates.length;
	var strNewDrop;

	for(var iCount = 0; iCount < iTotal; iCount++)
	{
		if(aAllDates[iCount] != '')
		{
			strNewDrop	= strNewDrop + '<option value="' + aAllDates[iCount] + '">' + aAllDates[iCount] + '</option>';
		}
	}

	hDropSpan			= document.getElementById(strElementInUse + 'span');

	hDropSpan.innerHTML	= '<select name="' + strElementInUse + '" size="1"><option value="">UPDATING...</option></select>';

	strOutput			= "hDropSpan.innerHTML = '<select name=\"" + strElementInUse + "\" size=\"1\" id=\"" + strElementInUse + "\"><option value=\"\">" + strDefaultText + "</option>" + strNewDrop + "</select>'";
	strOutput			= strOutput.replace('undefined', '');

	setTimeout(strOutput, 500);

	hIncDates.value		= strNewIncDate;
}

var bCheck = false;

function AC_HowMuch(strCurrency)
{
	iUnits = document.getElementById('iUnits').value;

	if(iUnits > 49 && bCheck == false)
	{
		bCheck = true;
		var URL = 'advanced_credits.php?u=' + iUnits + '&c=' + strCurrency + '&dummy=' + new Date().getTime();

		updateRequest.open("GET", URL, true);
		updateRequest.onreadystatechange = ViewTotalCost;
		updateRequest.send(null);

		return true;
	}

	hSpanTotal				= document.getElementById('SpanTotal');
	hSpanTotal.innerHTML	= '<span class="fontbred">The minimum Advance Credits purchase is 50</span>';
	return false;
}

function ViewTotalCost()
{
	if(updateRequest.readyState == 4)
	{
		fRate					= updateRequest.responseText;
		strCurSym				= document.getElementById('strCurSym').value;

		hSpanTotal				= document.getElementById('SpanTotal');
		hSpanTotal.innerHTML	= 'Total (ex-VAT): ' + strCurSym + fRate + ' &nbsp;&nbsp;&nbsp;&nbsp;<input type="submit" name="submit" value=" Purchase " class="yellowstd" />';
		bCheck = false;
	}
}
