

function SwitchCheckbox(pid)
{
	if (document.getElementById(pid).checked == true)
		document.getElementById(pid).checked = false;
	else
		document.getElementById(pid).checked = true;
}

function SwitchDiv(pid,pset)
{
	if (document.getElementById(pid).style.display == "block")
		document.getElementById(pid).style.display = "none";
	else
		document.getElementById(pid).style.display = "block";
		
	document.getElementById(pset).value = document.getElementById(pid).style.display;
}

function SwitchDivSimple(pid)
{
	if (document.getElementById(pid).style.display == "block" || 
			document.getElementById(pid).style.visibility == "visible")
	{		 
		document.getElementById(pid).style.visibility = "collapse";
		document.getElementById(pid).style.display = "none";
	}
	else
	{
		document.getElementById(pid).style.visibility = "visible";
		document.getElementById(pid).style.display = "block";
	}
}


function ConfirmLink(pmessage,purl)
{
	if (window.confirm(pmessage) == true)
	{
		window.location.href = purl;
	}
}

function ParentConfirmLink(pmessage,purl)
{
	if (window.confirm(pmessage) == true)
	{
		parent.location.href = purl;
	}
}

function Redirect(purl)
{
	if (purl == "")
	{
		purl = window.location.href;	
	}
	
	window.location.href = purl;
}

function OpenDialog(purl,pname,pwidth,pheight)
{
	psize = "";
	if (pwidth > 0 && pheight > 0)
		psize = "height="+ pheight +",width="+ pwidth +",";
	dialog = window.open(purl,pname,psize + "resizable=yes,scrollbars=yes,status=no,location=no,toolbar=no,menubar=no",true);
	
	wScreenX = ((screen.width-(pwidth*1))/2);
	wScreenY = ((screen.height-(pheight*1))/2);
	
	if (navigator.appName != "Microsoft Internet Explorer")
		dialog.moveTo(wScreenX,wScreenY);
	dialog.focus();
}


function FormSetField(pid,pvalue)
{
	document.getElementById(pid).value = pvalue;
 	FormSubmit();
}

function FormSubmit()
{
	FormSubmitByIndex(0);
}

function FormSubmitByIndex(pIndex)
{
	document.forms[pIndex].submit();
}

function ReloadFrame(pid)
{
	document.getElementById(pid).location.reload(true);
}

function SetField(pid,pvalue)
{
	document.getElementById(pid).value = pvalue;
}

function SwitchUri(pValue,pPrimaryUri,pSecondaryUri)
{
	if (pValue != "")
		return pPrimaryUri
	else
		return pSecondaryUri
}
