					   function changeSeason(id,url,id1){

						   if(id1 > 0){
						   window.open(url+'?ID2='+id+'&ID1='+id1+'&ID='+id1, "_self");
					   } else {
					    window.open(url+'?ID2='+id, "_self");
					   }
					   }
					   
function setLeague2(id,url){
if (id==0){
	document.form1.comp_name.value = "";
	document.form1.county.value = "";
	document.form1.postcode.value = "";
	}
else {
	window.open(url+'?ID='+id, '_self');
						    //alert('set league');
	}
}
					   
function setLeague3(id,url){
if (id>0){
	window.open(url+'?submitted=1&ID='+id, '_self');
	}
}
				

function toggleLeague(id,name){
if (id==1){
	document.form1.comp_name.value = name;
	document.form1.comp_name.readOnly = true;
	} 
else {
	document.form1.comp_name.value = "";
	document.form1.comp_name.readOnly = false;
	document.form1.comp_name.focus();
	}
}
	

function DelConfirm(id, typeid){
	if (id==0) return;
	url = 'confirm-delete.php?ID='+id+'&T='+typeid;
	document.form1.action=url;
	document.form1.submit();
}

	
function SetArrTick(id, arrlen) {
// IMPORTANT - If there is only one tick-box, we are not really dealing with an array
// Strangely, this doesn't seem to matter with the other elements, only the tick-box
if (arrlen == 1) {
        if (document.form1.xpicked.checked) { 
                document.form1.picked.value = 1; 
                }
        else {
                document.form1.picked.value = 0;
        }
        }
else {
        if (document.form1.xpicked[id].checked) { 
                document.form1.picked[id].value = 1; 
                }
        else {
                document.form1.picked[id].value = 0;
                }
        }
}

function lgprofilecountry(id) {
	url = 'league-profile.php?country='+id;
	document.team.action=url;
	document.team.submit();
}

function tmprofilecountry(id) {
	url = 'team-profile.php?country='+id;
	document.team.action=url;
	document.team.submit();
}



function populate(inForm,smonth,syear,monthfld, yearfld, startyr,endyr){
var temp=0;

if (smonth == 0){
var today= new Date();
var smonth= today.getMonth()+1;
var syear= today.getFullYear();
}

var startyear= startyr;
var endyear = endyr;
t2= 3;


for (var i=0, j=endyear; j>=startyear; i++, j--) {
var y= String(j);
document[inForm][yearfld].options[i] = new Option(y,y);
}
for (var i=0, j=endyear; j>=startyear; i++, j--) {
if (j==syear){
document[inForm][yearfld].options[i].selected=true;
break;
}
}
		
for(var i=0;i<=12;i++){
if(i=smonth){
document[inForm][monthfld].options[i-1].selected=true;
break;
}
}
}


function populate3(inForm,sday,smonth,syear,dayfld, monthfld, yearfld, startyr,endyr){
var temp=0;

if (sday == 0){
var today= new Date();
var sday= today.getDate();
var smonth= today.getMonth()+1;
var syear= today.getFullYear();
}

var startyear= startyr;
var endyear = endyr;
t2= 3;
for (var i=0; i <31 ; i++){
var x= String(i+1);
document[inForm][dayfld].options[i] = new Option(x,x);
}

for (var i=-1; i <31 ; i++){
if(i=sday){
document[inForm][dayfld].options[i-1].selected=true;
break;
}
}

for (var i=0, j=endyear; j>=startyear; i++, j--) {
var y= String(j);
document[inForm][yearfld].options[i] = new Option(y,y);
}
for (var i=0, j=endyear; j>=startyear; i++, j--) {
if (j==syear){
document[inForm][yearfld].options[i].selected=true;
break;
}
}

		
for(var i=0;i<=12;i++){
if(i=smonth){
document[inForm][monthfld].options[i-1].selected=true;
break;
}
}
}


function smartdirect(id,url,param){

var newurl = url+'?'+param+'='+id;
window.open(newurl,"_self");
//window.open("index.php", "WindowName", "_self","menubar=yes,location=yes,resizable=yes,scrollbars=yes,status=yes");
		}

function redirect(id,url){

var newurl = url+'?ID='+id;
window.open(newurl,"_self");
//window.open("index.php", "WindowName", "_self","menubar=yes,location=yes,resizable=yes,scrollbars=yes,status=yes");
}


function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return unescape(c.substring(nameEQ.length,c.length));
	}
	return null;
}

function createCookie(name,value,days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+escape(value)+expires+"; path=/";
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function PopupResults(url, id) {
	if (id > 0) {
		window.open(url+'?ID='+id,'','scrollbars=yes,width=600,height=500');
		}
}