<!-- Common Site JS -->

var g_form_modified = false;

function ShowPopup(hoveritem, popupname)
{
hp = document.getElementById(popupname);

// Set position of hover-over popup
hp.style.top = hoveritem.offsetTop + 18;
//hp.style.left = hoveritem.offsetLeft + 20;

// Set popup to visible
hp.style.visibility = "Visible";
}

function HidePopup(popupname)
{
hp = document.getElementById(popupname);
hp.style.visibility = "Hidden";
}

function PopupWindow( url )
{
    winParams='toolbar=no,status=no,resizable=yes,scrollbars=yes';    
    window.open( url, 2, winParams );
}

function DropDownChange(url)
{
	if (url != '')
	{
		window.location = url;
	}
}

function PredictorWeekChange(weeknum)
{
    window.location = '/predictor/index.php?week=' + weeknum;
}

function ConfirmDeleteResult(resultid)
{
    var message = "Please confirm that you wish to remove this result.";

    if (confirm(message) == true)
    {
       window.location = '/results/results.php?deleteresultid=' + resultid;
    }
}

function ConfirmDeleteFixture(fixtureid)
{
    var message = "Please confirm that you wish to remove this fixture.";

    if (confirm(message) == true)
    {
       window.location = '/sup/admin/predictor/predictorfixtures.php?deletefixtureid=' + fixtureid;
    }
}

function ConfirmLeaveCompetition(competitionid)
{
    var message = "Please confirm that you wish to leave this competition.";

    if (confirm(message) == true)
    {
       window.location = '/leagues/leagues.php?action=remove&competitionid=' + competitionid;
    }
}

function ToggleBlock(elementId)
{
	var element = document.getElementById( elementId )
	if( element.style.display == "block" )
	{
		element.style.display = "none";
		element.style.position = "relative";
	}
	else
	{
		element.style.display = "block";
		element.style.position = "relative";
	}
}

function EnableBlock(elementId)
{
	var element = document.getElementById( elementId )
	element.style.display = "block";
	element.style.position = "relative";
}

function DisableBlock(elementId)
{
	var element = document.getElementById( elementId )
	element.style.display = "none";
	element.style.position = "relative";
}

function HideBlock(elementId)
{
	var element = document.getElementById( elementId )
	element.style.visibility = "hidden";
	element.style.position = "relative";
}

function ShowBlock(elementId)
{
	var element = document.getElementById( elementId )
	element.style.visibility = "visible";
	element.style.position = "relative";
}

function FormModified()
{
	g_form_modified = true;
}

function IsFormModified(form, processorUrl, destinationUrl)
{
	if (g_form_modified)
	{
	    var message = "Would you like to save your changes to this tabpage?";

    	if (confirm(message))
    	{
			var element = document.getElementById(form);
    		element.submit();
	    }
	    else
	    {
	    	g_form_modified = false;
	    }
	}
	else
	{
		window.location = destinationUrl;
	}
}

function RedirectToUKFFForums()
{
    var message = "General football chat is now taking place in the fantastic new UKFF forums site.\r\n\r\nPlease note that you will need to create a new account for the forums site!\r\n\r\nClick OK to be redirected.";

    alert(message);
/*    {
        window.location = 'http://forums.ukfootballfinder.co.uk/';
    }
    else
    { */
      //  window.location = 'http://www.ukfootballfinder.co.uk/core/forums/forums.php';
    //}
}