var login = 0;
var passd = 0;

function clearUser(obj)
{
	if (login == 1) return;
	obj.value = '';	
	login = 1;
}

function clearPass(obj)
{
	if (passd == 1) return;
	obj.value = '';
	passd = 1;
}	


function copy()
{
var doc = document.getElementById('copytext').innerHTML;
cp = doc.createTextRange();
cp.execCommand("Copy");
}

function lottaliga(getID) {
	if (confirm("Previously generated data will be lost. Continue?",8)) {
		document.location = 'leaguernd.asp?lid='+ getID;
	} else {
		return false;
	}
}

function lottagroup(getID) {
	if (confirm("Are you sure you want to generate the group play?",8)) {
		document.location = '/grouprnd.asp?cupid='+ getID;
	} else {
		return false;
	}
}

function lotta(getOmg, getID, getPage) {
	if (confirm("All previous randomization will be lost. Continue?",8)) {
		document.location = '/'+getPage +'.asp?omg='+ getOmg + '&cupid=' + getID +'';
	} else {
		return false;
	}
}

function popupCode()
{
	window.open('/code.asp','Forum Code','width=250,height=250,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,copyhistory=no,resizable=no')
}

function switchimg() {
	if (document.getElementById('login').hdn.value == '0'){
		document.images['cbox'].src = '/img/w_v.gif'
		document.getElementById('login').hdn.value = '1'
	} else {
		document.images['cbox'].src = '/img/wo_v.gif'
		document.getElementById('login').hdn.value = '0'
	}
}

function remcup(getID) {
	if (confirm("Are you sure you want to delete your cup?",8)) {
		document.location = '/remcup.asp?' + getID;
	} else {
		return false;
	}
}

function emailvalidation(entered, alertbox)
{
	with (entered)	{
		apos=value.indexOf("@"); 
		dotpos=value.lastIndexOf(".");
		lastpos=value.length-1;
		if (apos<1 || dotpos-apos<2 || lastpos-dotpos>3 || lastpos-dotpos<2) {
			if (alertbox) {document.getElementById('reg1').inpt_error.value = alertbox;} return false;
		} else {
			return true;
		}
	}
}