window.history.previous = window.location.href;

function Back(link) 
{
return true;
}

function openTarget (form, features, windowName) {
  if (!windowName)
    windowName = 'formTarget' + (new Date().getTime());
  form.target = windowName;
  open ('', windowName, features);
}

function OpenPinWnd(pins)
{
var action

action = "pins.asp?pins=" + pins
open (action, 'Pins', 'width=367,height=211,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbar=no,scrollbars=auto,resizable=no,copyhistory=no');
}

function LinkSelect(form,page,subpage)
{
form.action = page
form.subpage.value = subpage
form.target = "_top"
}

function GetSelection(control)
{
var i
for (i=0;i<control.length;i++) 
	{
	if (control.options[i].selected == true)
		{
		return control.options[i].value
		}
	}
return null
}

function SetActiveListbox(form,listbox)
{
var len,i

if (listbox == 1)
	{
	len = form.Inactive.length
	for (i=0;i<len;i++)
		{
		form.Inactive.options[i].selected=false
		}
	form.Inactive.selectedIndex = -1
	}
if (listbox == 0)
	{
	len = form.Active.length
	for (i=0;i<len;i++)
		{
		form.Active.options[i].selected=false
		}
	form.Active.selectedIndex = -1
	}
}

function SelectLanguage(form,language,action)
{
form.action = action;
form.language.value = language;
form.submit();
}

function SelectTournament(form,tournamenttype,action)
{
form.action = action;
form.tournamenttype.value = tournamenttype;
form.submit();
}

function CheckAlleySelection()
{
var index = document.pageform.alleys.selectedIndex

if (index == -1 )
	{
	return false
	}
else
	{
	return true
	}
}

function CheckTournamentSelection()
{
var index = document.pageform.results.selectedIndex

if (index == -1 )
	{
	return false
	}
else
	{
//	ShowTournament()
	return true
	}
}

function SetRefresh(page)
{
document.pageform.action = page
}

function ShowTournament()
{
document.pageform.action = "TournamentPage.asp"
openTarget(document.pageform, 'width=800,height=600,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbar=yes,scrollbars=yes,resizable=no,copyhistory=no')
}

function ShowProtocol(game,match)
{
document.pageform.action = "ProtocolsPage.asp"
openTarget(document.pageform, 'width=800,height=600,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbar=yes,scrollbars=yes,resizable=no,copyhistory=no')
}

