<!-- 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 ConfirmSwitchProfileVisibility(userid, onoroff, urlExtend)
{
    var message = "You are about to switch " + onoroff + " the profile visibility.  Type the word SWITCH to confirm.";
    var def = "";
    var rv = prompt(message,def);

    if ( rv.toLowerCase() == 'switch' )
    {
       window.location = '/findplayer/playerprofile.php?switchvis=1&uid=' + userid + urlExtend;
    }
}

function ConfirmDeleteClub(clubid, name, urlExtend)
{
    var message = "You are about to delete " + name + ".  Type the word DELETE to confirm.";
    var def = "";
    var rv = prompt(message,def);

    if ( rv.toLowerCase() == 'delete' )
    {
       window.location = '/findcourt/deleteclub.php?clubid=' + clubid + urlExtend;
       //window.location = '/sup/admin/courts/courtstobeupdated.php?type=2';
    }
}

function ConfirmDeleteResult(resultid)
{
    var message = "Please confirm that you wish to remove this result by typing the word DELETE in the box below.";
    var def = "";
    var rv = prompt(message,def);

    if ( rv.toLowerCase() == 'delete' )
    {
       window.location = '/results/results.php?deleteresultid=' + resultid;
    }    
}

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 ConfirmRemoveFromCompetition(userid, competitionid, areaid, sex, seasonid)
{
    var message = "Please confirm that you wish to remove this player from this competition.";

    if (confirm(message) == true)
    {
       window.location = '/sup/admin/adminleagues.php?removefromcompetitionid=' + competitionid + '&removeuserid=' + userid + '&seasonid=' + seasonid + '&areaid=' + areaid + '&sex=' + sex;
    }
}

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;
}


