// =======================================================
// ===  General helper methods                         ===
// =======================================================
function SetElementValue(theElement, theValue) 
{
	document.getElementById(theElement).value = theValue;
}

function GetElementValue(theElement)
{
	return document.getElementById(theElement).value;
}

function SubmitForm(formName)
{
	document.forms[formName].submit();
}

function GoTo(page)
{
	document.location.href = page;
}

function ConfirmGoTo(page, $msg)
{
	if (confirm($msg)) 
		document.location.href = page;
}

function OpenGoTo(page)
{
	window.open(page);
}


function toggle(id)
{
	var obj = document.getElementById(id);
	if (obj)
	{
		obj.style.visibility = (obj.style.visibility == 'hidden') ? 'visible' : 'hidden';
		obj.style.display = (obj.style.display == 'none') ? 'block' : 'none';
	}	
}

function hide(id)
{
	var obj = document.getElementById(id);
	if (obj)
	{
		obj.style.visibility = 'hidden';
		obj.style.display = 'none';
	}	
}

// =======================================================
// ===  Action specific methods                        ===
// =======================================================

function MarkTicketAsPaid(transactionid) 
{
	if (confirm("Really mark this ticket as paid?"))
	{
		SetElementValue('transactionid', transactionid);
		SubmitForm('confirmpaidticket');
	}
}

function LoadConfirmationMsg()
{
	document.location.href="#confirmation";
}

function CustomerLookup()
{
	SetElementValue('cl-email', GetElementValue('email'));
	SubmitForm('customerlookup');
}

function HideNotificationMessage()
{
	setTimeout("hide('cl-notification')", 3000);
}

function ConfirmOrderIsPaid()
{
	if (confirm("Confirm this order has been paid already?"))
	{
		SubmitForm('markpaid');
	}
}

function PayPrintOrderOnline()
{
	SubmitForm('payprint');
}

