var num = 0;
function ImageSwap(me,img)
{
	me.src = img;
}
function PrintImageSwap(mePrint,meLabel,imgPrint,imgLabel)
{
	ImageSwap(mePrint,imgPrint);
	ImageSwap(meLabel,imgLabel);
}
function SubmitForm(button)
{
	document.forms['matchMainForm'].target = "_self";
	switch (button)
	{
	case "button1":
		document.forms['matchMainForm'].action = b1;
		document.forms['matchMainForm'].submit();
		break;
	case "button2":
		document.forms['matchMainForm'].action = b2;
		document.forms['matchMainForm'].submit();
		break;
	case "button3":
		document.forms['matchMainForm'].action = b3;
		document.forms['matchMainForm'].submit();
		break;
	case "button4":
		document.forms['matchMainForm'].action = b4;
		document.forms['matchMainForm'].submit();
		break;
	case "button5":
		document.forms['matchMainForm'].action = b5;
		document.forms['matchMainForm'].submit();
		break;
	case "button6":
		document.forms['matchMainForm'].action = b6;
		document.forms['matchMainForm'].submit();
		break;
	case "button7":
		document.forms['matchMainForm'].action = b7;
		document.forms['matchMainForm'].submit();
		break;
	case "button8":
		submitPhotoForm(1)
		break;
	case "button9":
		document.forms['matchMainForm'].action = b9;
		document.forms['matchMainForm'].submit();
		break;
	case "button10":
		document.forms['matchMainForm'].action = b10;
		document.forms['matchMainForm'].submit();
		break;
	case "button11":
		document.forms['matchMainForm'].action = b11;
		document.forms['matchMainForm'].submit();
		break;
	case "button12":
		document.forms['matchMainForm'].action = b12;
		document.forms['matchMainForm'].submit();
		break;
	case "buttonA":
		document.forms['matchMainForm'].action = bA;
		document.forms['matchMainForm'].submit();
		break;
	case "buttonM1":
		document.forms['matchMainForm'].action = bM1;
		document.forms['matchMainForm'].submit();
		break;
	case "buttonM2":
		document.forms['matchMainForm'].action = bM2;
		document.forms['matchMainForm'].submit();
		break;
	case "buttonM3":
		document.forms['matchMainForm'].action = bM3;
		document.forms['matchMainForm'].submit();
		break;

	}
}
function submitPhotoForm(loadPhoto)
{
	document.forms['matchMainForm'].action = b8 + "&lp=" + loadPhoto;
	document.forms['matchMainForm'].submit();
}
function openCompatWin(sec)
{ 
	myWin = window.open("../html/custom/template.blank.html", "compatWin", "width=715,height=550,status=0,titlebar=0,toolbar=0,scrollbars=1,resizable=1");
	myWin.name = "compatWin";
	document.forms['matchMainForm'].target = "compatWin"; 
	document.forms['matchMainForm'].action = bC + '&sec=' + sec;
	document.forms['matchMainForm'].submit();
}
function LoadPhoto(cur)
{
	if (cur == -1)
	{
		num = num - 1;
		document.images['imgPhoto'].src = aryImages[num];
	}
	else if (cur == 0)
	{
		num = num + 1;
		document.images['imgPhoto'].src = aryImages[num];
	}
	else
	{
		num = cur-1;
		document.images['imgPhoto'].src = aryImages[num];
	}
	for (j=1; j<=aryImages.length; j++)
	{
		if (j == (num+1))
		{
			document.getElementById("aPhoto" + j).className = "cssPhotoLinkOn";
		}
		else
		{
			document.getElementById("aPhoto" + j).className = "cssGlobalLinks_PageNav";
		}
	}
	var numGroups = 1;
	if (((aryImages.length)%5) ==0)
	{
		numGroups = (aryImages.length)/5;
	}
	else
	{
		numGroups = parseInt((aryImages.length)/5) + 1;
	}
	var groupNum = 1;
	for(i=1; i<=numGroups; i++)
	{
		document.getElementById("pro_PhotoPagination" + (groupNum)).style.display = "none";
		groupNum = groupNum+5;
	}
	if ((num+1)%5 == 0)
	{
		document.getElementById("pro_PhotoPagination" + (num-3)).style.display = "";
	}
	if ((num+1)%5 == 1)
	{
		document.getElementById("pro_PhotoPagination" + (num+1)).style.display = "";
	}
	if ((num+1)%5 == 2)
	{
		document.getElementById("pro_PhotoPagination" + (num)).style.display = "";
	}
	if ((num+1)%5 == 3)
	{
		document.getElementById("pro_PhotoPagination" + (num-1)).style.display = "";
	}
	if ((num+1)%5 == 4)
	{
		document.getElementById("pro_PhotoPagination" + (num-2)).style.display = "";
	}
	if (aryImages.length > 1)
	{
		if (num == aryImages.length-1)
		{
			document.getElementById("proPhoPaginationNext").style.display = "none";
		}
		else
		{
			document.getElementById("proPhoPaginationNext").style.display = "";
		}
		if ((num > 0) && (num < aryImages.length-1))
		{
			document.getElementById("proPhoPaginationPipe").style.display = "";		
		}
		else
		{
			document.getElementById("proPhoPaginationPipe").style.display = "none";		
		}
		if (num == 0)
		{
			document.getElementById("pro_PhoPaginationPrevious").style.display = "none";
		}
		else
		{
			document.getElementById("pro_PhoPaginationPrevious").style.display = "";
		}
	}
}
