function OpenMVF(URL)
{			
	window.open(URL,'mvf','toolbar=no,location=no,menubar=no,scrollbars=yes,resizable=yes,width=300,height=500');
	//window.open(URL,'mvf','toolbar=yes,location=yes,menubar=yes,scrollbars=yes,status=yes,resizable=yes,width=700,height=500');
}
function OpenSecurity(URL)
{			
	window.open(URL,'security','toolbar=no,location=no,menubar=no,scrollbars=yes,resizable=yes,width=500,height=500');
	//window.open(URL,'security','toolbar=yes,location=yes,menubar=yes,scrollbars=yes,status=yes,resizable=yes,width=700,height=500');
}
function OpenReportSecurity(URL)
{			
	window.open(URL,'reportpermissions','toolbar=no,location=no,menubar=no,scrollbars=yes,resizable=yes,width=400,height=600');
	//window.open(URL,'security','toolbar=yes,location=yes,menubar=yes,scrollbars=yes,status=yes,resizable=yes,width=700,height=500');
}
function OpenProperties(URL)
{			
	window.open(URL,'properties','toolbar=no,location=no,menubar=no,scrollbars=yes,resizable=yes,width=400,height=400');
}
function NewWindow(target)
{
	newwin=open(target,'newwindow','toolbar=yes,location=no,menubar=no,scrollbars=yes,resizable=yes,width=700,height=500');
}
function OpenLegend(URL)
{			
	window.open(URL,'legend','toolbar=no,location=no,menubar=no,scrollbars=yes,resizable=yes,width=400,height=300');
}


// FOR LOOKUP WINDOW
var TargetControl;
function SetValue(NewValue)
{
	try
	{
		TargetControl.value = NewValue;
	} catch (e) { alert(e.message); }
}
function OpenLookup(URL)
{			
	window.open(URL,'lookup','toolbar=no,location=no,menubar=no,scrollbars=yes,resizable=yes,width=700,height=500');
	//window.open(URL,'security','toolbar=yes,location=yes,menubar=yes,scrollbars=yes,status=yes,resizable=yes,width=700,height=500');
}
// FOR LOOKUP WINDOW

// FOR LISTBOX 
function AddValueToList(SourceTextBox, TargetList) 
{
	try
	{
		if (SourceTextBox.value.replace(/^\s*|\s*$/g,"") != "")
		{
			var optionObject = new
			Option(SourceTextBox.value,SourceTextBox.value)
			var found = false;
			for (i=0; i<TargetList.options.length; i++)
			{
				if (optionObject.text ==
					TargetList.options[i].text ||  optionObject.value == TargetList.options[i].value ){
					found = true;
					break
				}
			} 
			if (found==false)
			{
	
				TargetList.options[TargetList.options.length] = optionObject;
				SourceTextBox.value = "";
			}
		}
		SourceTextBox.focus();
	} catch (e) { alert(e.message) }
}


function RemoveValueFromList(SourceList)
{
	
	if (SourceList.selectedIndex > -1) SourceList.options[SourceList.selectedIndex] = null;     
}

function SaveListValues(SourceList, TargetField, Delimiter)
{
	try
	{
		var Value = '';
		if (SourceList.options.length > 0)
		{
			for (i=0; i<SourceList.options.length; i++)
			{
				Value = Value + SourceList.options[i].value	+ Delimiter;		
			}			
		}
		TargetField.value = Value;
	} catch (e) { alert(e.message) }
}

function DisableForm()
{
	// DISABLE ALL THE DROP DOWN LISTS
	for(var i=0; i<document.forms(0).getElementsByTagName("select").length; i++)
	{
		document.forms(0).getElementsByTagName("select")(i).style.color = '#DDDDDD';
		document.forms(0).getElementsByTagName("select")(i).style.backgroundColor = '#FFFFFF';
		//document.forms(0).getElementsByTagName("select")(i).disabled = true;
	}
	// DISABLE ALL THE TEXT BOXES / BUTTONS
	for(var i=0; i<document.forms(0).getElementsByTagName("input").length; i++)
	{
		if (document.forms(0).getElementsByTagName("input")(i).type == "submit") { // SUBMIT BUTTONS
			document.forms(0).getElementsByTagName("input")(i).style.color = '#DDDDDD';
			document.forms(0).getElementsByTagName("input")(i).style.backgroundColor = '#FFFFFF';
			document.forms(0).getElementsByTagName("input")(i).disabled = true;
		}else{ // TEXT BOXES OR HIDDEN FIELDS
			document.forms(0).getElementsByTagName("input")(i).style.color = '#DDDDDD';
			document.forms(0).getElementsByTagName("input")(i).style.backgroundColor = '#FFFFFF';
			//document.forms(0).getElementsByTagName("input")(i).disabled = true;
		}
	}
	return true;
}
