﻿function LoadLargeImage(ImageName)
{
    document.getElementById('ViewLargeImage').src = 'http://www.trevensonfc.co.uk//Content/SiteLogic/LoadImage.aspx?ImageType=Product&Image=' + ImageName + '.jpg&format=ScaleCrop&Width=412&Height=550'; 
    document.getElementById('FullScreenImage').style.display = 'block';
    document.getElementById('FullScreenBackground').style.display = 'block';
}

function CloseLargeImage()
{
    document.getElementById('FullScreenImage').style.display = 'none';
    document.getElementById('FullScreenBackground').style.display = 'none';
}

function SwapImage(ImageName)
{
    document.getElementById('LargeImage').src = 'http://www.trevensonfc.co.uk//Content/SiteLogic/LoadImage.aspx?ImageType=Product&Image=' + ImageName + '.jpg&format=scalecrop&Width=250&Height=333';
}

function DropDownSwapImage(strFormElement) {
	if(strFormElement == 'OptionId') {
        //alert(document.getElementById("OptionID").selectedIndex);    
		var intSelected = document.getElementById("OptionID").selectedIndex;
		var strImage = document.Product.OptionId[intSelected].attributes('Image').value;
		
		if (strImage != '') {
			document.getElementById("MainProductImage").src = 'http://www.trevensonfc.co.uk/Content/SiteLogic/LoadImage.aspx?ImageType=Product&Image=' + strImage + '&format=crop&Width=300&Height=400';
		}
	}
}

function ChangeTopStory(StoryID, Image) {
    document.getElementById("TopStoryMainImage").src  = 'http://www.trevensonfc.co.uk/Content/SiteLogic/LoadImage.aspx?ImageType=General&Image=' + Image + '&format=scalecrop&Width=310&Height=240';
    
    var currTabElem = document.getElementById("Story1"); 
    currTabElem.setAttribute("class", ""); 
    currTabElem.setAttribute("className", "");

    var currTabElem = document.getElementById("Story2"); 
    currTabElem.setAttribute("class", ""); 
    currTabElem.setAttribute("className", "");

    var currTabElem = document.getElementById("Story3"); 
    currTabElem.setAttribute("class", ""); 
    currTabElem.setAttribute("className", "");

    var currTabElem = document.getElementById("Story" + StoryID); 
    currTabElem.setAttribute("class", "selected"); 
    currTabElem.setAttribute("className", "selected");
}

function NextGameScroller() 
{
    objScroller = document.getElementById("NextGameScroller");
    intShowLen = 0;
    strNextGame = objScroller.innerText;
    startScroller(strNextGame);
}

function startScroller(strNextGame)
{
    if(intShowLen < strNextGame.length)
	{
	    objScroller.innerText = strNextGame.substring(0, intShowLen) + '_';
		intShowLen++;
		nextChar = 65;
	}
	else
	{
	    objScroller.innerText = strNextGame;
		intShowLen = 0;
		nextChar = 3000;
	}
    setTimeout('startScroller("' + strNextGame + '")', nextChar);
}

function ChangeMainText(strText, strImage, ImageType)
{
    document.getElementById('HighlightText').innerHTML = strText;
    if(ImageType == 'Coach'){
        document.getElementById('PlayerImage').src = 'http://www.trevensonfc.co.uk/Content/SiteLogic/LoadImage.aspx?ImageType=User&Image=' + strImage + '&format=scalecrop&Width=200&Height=200';
    }
    else
    {
        document.getElementById('PlayerImage').src = 'http://www.trevensonfc.co.uk/Content/SiteLogic/LoadImage.aspx?ImageType=Squad&Image=' + strImage + '&format=scalecrop&Width=200&Height=200';
    }
}
