function mdl_newwindow(p_win, p_name, p_w, p_h)
{
	window.open(p_win, p_name,'width='+p_w+',height='+p_h+',resizable=no, titlebar=no');
}


function mdl_resultyear_onchange()
{
	document.forms['resultform'].resultcat.options.length = 0;
 
	switch (document.forms['resultform'].resultyear.options[document.forms['resultform'].resultyear.selectedIndex].value)
	{
		case 'results0809':
		{
                	document.forms['resultform'].resultcat.options[0] = new Option('Match Results', 'results');
			document.forms['resultform'].resultcat.options[1] = new Option('Match Reports', 'reports');
			document.forms['resultform'].resultcat.options[2] = new Option('Club Scorers', 'scorers');
			document.forms['resultform'].resultcat.options[3] = new Option('Surrey League Three', 'l3');
			document.forms['resultform'].resultcat.options[4] = new Option('Surrey Conference 2', 'sc2');
			document.forms['resultform'].resultcat.options[5] = new Option('Surrey Combination 4', 'sc4');
			window["resultyear"]="results0809"			
		}
		break;


		case 'results0708':
		{
                	document.forms['resultform'].resultcat.options[0] = new Option('Match Results', 'results');
			document.forms['resultform'].resultcat.options[1] = new Option('Match Reports', 'reports');
			document.forms['resultform'].resultcat.options[2] = new Option('Club Scorers', 'scorers');
			window["resultyear"]="results0708"			
		}
		break;

		case 'results0607':
		{
                	document.forms['resultform'].resultcat.options[0] = new Option('Match Results', 'results');
			document.forms['resultform'].resultcat.options[1] = new Option('Match Reports', 'reports');
			document.forms['resultform'].resultcat.options[2] = new Option('Club Scorers', 'scorers');
			document.forms['resultform'].resultcat.options[3] = new Option('Surrey Bowl Winners', 'sbowl');
			window["resultyear"]="results0607"			
		}
		break;

		case 'results0506':
		{
                	document.forms['resultform'].resultcat.options[0] = new Option('Match Results', 'results');
			document.forms['resultform'].resultcat.options[1] = new Option('Match Reports', 'reports');
			document.forms['resultform'].resultcat.options[2] = new Option('Club Scorers', 'scorers');
			document.forms['resultform'].resultcat.options[3] = new Option('Press Cuttings', 'press');
			document.forms['resultform'].resultcat.options[4] = new Option('Surrey Bowl Winners', 'sbowl');
			window["resultyear"]="results0506"
		}
		break;

		case 'results0405':
		{
                	document.forms['resultform'].resultcat.options[0] = new Option('Match Results', 'results');
			document.forms['resultform'].resultcat.options[1] = new Option('Match Reports', 'reports');
			document.forms['resultform'].resultcat.options[2] = new Option('Club Scorers', 'scorers');
			window["resultyear"]="results0405"
		}
		break;

		case 'results0304':
		{
                	document.forms['resultform'].resultcat.options[0] = new Option('Match Results', 'results');
			document.forms['resultform'].resultcat.options[1] = new Option('Match Reports', 'reports');
			document.forms['resultform'].resultcat.options[2] = new Option('Club Scorers', 'scorers');
			window["resultyear"]="results0304"
		}
		break;

		case 'results0203':
		{
                	document.forms['resultform'].resultcat.options[0] = new Option('Match Results', 'results');
			document.forms['resultform'].resultcat.options[1] = new Option('Match Reports', 'reports');
			document.forms['resultform'].resultcat.options[2] = new Option('Club Scorers', 'scorers');
			document.forms['resultform'].resultcat.options[3] = new Option('Press Cuttings', 'press');
			window["resultyear"]="results0203"
		}
		break;

		case 'results0102':
		{
                	document.forms['resultform'].resultcat.options[0] = new Option('Match Results', 'results');
			document.forms['resultform'].resultcat.options[1] = new Option('Match Reports', 'reports');
			document.forms['resultform'].resultcat.options[2] = new Option('Club Scorers', 'scorers');
			window["resultyear"]="results0102"
		}
		break;

		default:
			document.forms['resultform'].resultcat.options[0] = new Option('','x');
			window["resultyear"]="None"
		break;
	}

        /*alert(window["resultyear"]);*/
        mdl_resultcat_onchange();
}


function mdl_resultcat_onchange()
{
	document.forms['resultform'].resultteam.options.length = 0;

        window["resultcat"]=document.forms['resultform'].resultcat.options[document.forms['resultform'].resultcat.selectedIndex].value;
        /*alert(window["resultcat"]);*/
 
	switch (document.forms['resultform'].resultcat.options[document.forms['resultform'].resultcat.selectedIndex].value)
	{
		case 'results':
		case 'reports':
		{
			document.forms['resultform'].resultteam.options[0] = new Option('1st XV','1XV');
			document.forms['resultform'].resultteam.options[1] = new Option('A XV','AXV');
			document.forms['resultform'].resultteam.options[2] = new Option('ExA XV','EAXV');
			document.forms['resultform'].resultteam.selectedIndex = 0;
			mdl_resultteam_onchange();
		}
		break;

		case 'scorers':
		{
			parent.links.location=window["resultyear"]+"/"+window["resultcat"]+"/scorers.htm";
		}
		break;

		case 'press':
		{
			parent.links.location=window["resultyear"]+"/"+window["resultcat"]+"/press.htm";
		}
		break;

		case 'sbowl':
		{
			parent.links.location=window["resultyear"]+"/"+window["resultcat"]+"/sbowl.htm";
		}
		break;

		case 'l3':
		{
			document.forms['resultform'].resultteam.options[0] = new Option('Fixtures','Fix');
			document.forms['resultform'].resultteam.options[1] = new Option('Results','Res');
			document.forms['resultform'].resultteam.options[2] = new Option('Tables','Tbl');
			document.forms['resultform'].resultteam.options[3] = new Option('Official RFU','Rfu');
			document.forms['resultform'].resultteam.selectedIndex = 0;
			mdl_resultteam_onchange();
		}
		break;

		case 'c3':
		{

		   parent.links.location = 'blank.htm';
		   window.open('http://www.iflweb.co.uk/surreydemo/rugbys.asp?g=3', 'extern1', 'menubar=0, toolbar=0, scrollbars=1 width=770');
		}
		break;

		case 'sc2':
		{

		   parent.links.location = 'blank.htm';
		   window.open('http://www.surreyrugby.com/rugbys.asp?g=3', 'extern1', 'menubar=0, toolbar=0, scrollbars=1 width=770');
		}
		break;

		case 'sc4':
		{

		   parent.links.location = 'blank.htm';
		   window.open('http://www.surreyrugby.com/rugbys.asp?g=4', 'extern1', 'menubar=0, toolbar=0, scrollbars=1 width=770');
		}
		break;
	}

}


function mdl_resultteam_onchange()
{
        /*alert(window["resultyear"]+"/"+window["resultcat"]);*/

        var resultteam=document.forms['resultform'].resultteam.options[document.forms['resultform'].resultteam.selectedIndex].value

	switch (document.forms['resultform'].resultcat.options[document.forms['resultform'].resultcat.selectedIndex].value)
	{
		case 'results':
		{
			/*alert(window["resultyear"]+"/"+window["resultcat"]+"/results"+resultteam+".htm");*/
			parent.links.location=window['resultyear']+"/"+window['resultcat']+"/results"+resultteam+".htm";
		}
                break
		case 'reports':
		{
			/*alert(window["resultyear"]+"/"+window["resultcat"]+"/reports"+resultteam+".htm");*/
			parent.links.location=window["resultyear"]+"/"+window["resultcat"]+"/reports"+resultteam+".htm";
		}
		break;

		case 'l3':
		{
			/*alert(resultteam);*/
		   	switch (resultteam)
		   	{
				case 'Fix':
				{
			   		parent.links.location = 'blank.htm';
			   		window.open('http://www.rfulondon.com/Data-Fix-Sy3.htm', 'extern1', 'menubar=0, toolbar=0, scrollbars=1 width=720');
				}
				break;

				case 'Res':
				{
			   		parent.links.location = 'blank.htm';
			   		window.open('http://www.rfulondon.com/Data-Res-Sy3.htm', 'extern1', 'menubar=0, toolbar=0, scrollbars=1 width=720');
				}
				break;

				case 'Tbl':
				{
			   		parent.links.location = 'blank.htm';
			   		window.open('http://www.rfulondon.com/Data-Tab-Sy3.htm', 'extern1', 'menubar=0, toolbar=0, scrollbars=1 width=720');
				}
				break;

				case 'Rfu':
				{
			   	  	parent.links.location = 'blank.htm';
                                        window.open('http://www.rfu.com/fixtures/ViewClubDetail.aspx?TeamID=5747620&CompetitionID=5730099&LeagueID=11145617&sType=League', 'extern2', 'menubar=0, toolbar=0, scrollbars=1');
			        }
			        break;
			
			        default:
			        break;
			}
		}

		break;
	}
}


function mdl_results_onchange()
{

	document.forms['clubresults'].resultsuboption.options.length = 0;
	

	switch (document.forms['clubresults'].resultoption.options[document.forms['clubresults'].resultoption.selectedIndex].value)
	{
		case 'Results':
		case 'Reports':
		{
			document.forms['clubresults'].resultsuboption.options[0] = new Option('1st XV','1XV');
			document.forms['clubresults'].resultsuboption.options[1] = new Option('A XV','AXV');
			document.forms['clubresults'].resultsuboption.options[2] = new Option('ExA XV','EAXV');
		}
		break;

		case 'l3':
		{
			document.forms['clubresults'].resultsuboption.options[0] = new Option('Fixtures','Fix');
			document.forms['clubresults'].resultsuboption.options[1] = new Option('Results','Res');
			document.forms['clubresults'].resultsuboption.options[2] = new Option('Tables','Tbl');
			document.forms['clubresults'].resultsuboption.options[3] = new Option('Official RFU','Rfu');

			document.forms['clubresults'].resultsuboption.selectedIndex = 0;
		}
		break;

		default:
			document.forms['clubresults'].resultsuboption.options[0] = new Option('','x');
		break;
	}
}


function mdl_reportnames_onchange()
{
	parent.links.location=document.forms['reportform'].reportname.options[document.forms['reportform'].reportname.selectedIndex].value;
}



function mdl_fixtures_onchange()
{
	TeamIdx = document.forms['fixtureform'].fixturelinks.options[document.forms['fixtureform'].fixturelinks.selectedIndex].value;

	parent.links.location = TeamIdx;
}


function mdl_gallery_onchange()
{
	GalleryIdx = document.forms['galleryform'].gallerylinks.options[document.forms['galleryform'].gallerylinks.selectedIndex].value;

	parent.links.location = GalleryIdx;
}


function mdl_clubsaz_onchange()
{
	ClubsIdx = document.forms['clubsform'].clubslinks.options[document.forms['clubsform'].clubslinks.selectedIndex].value;

	parent.links.location = ClubsIdx;
}


