

function SwitchCheckbox(pid)
{
	if (document.getElementById(pid).checked == true)
		document.getElementById(pid).checked = false;
	else
		document.getElementById(pid).checked = true;
}

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 OpenDialog(purl,pname,pwidth,pheight)
{
	
// 	alert(navigator.appName);
	
	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);
	dialog.moveTo(((screen.width-pwidth)/2),((screen.height-pheight)/2));
	dialog.focus();
	
	
}

function OpenMediaDialog(pid,pname,pwidth,pheight)
{
//  	alert(navigator.appName);
	purl = "media.php?id=" + pid;
	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);
	dialog.moveTo(((screen.width-pwidth)/2),((screen.height-pheight)/2));
	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;
}
