//--------------------------------------------------------------------------------------------------------------
//NOTES: This file includes functions that control:
//Multi Select list JScript
//Delete and Re-Instate Confirmation
// Update Confirmation
//Colour switching selected form elements
//Managing Parent Dropdown values
//--------------------------------------------------------------------------------------------------------------



function DeleteConfirm(strURL, strMessage)
	{
		var doit
		if (!strMessage)
			{
				doit = window.confirm('Are you sure you want to delete this item?');
			}			
		else
			{
				doit = window.confirm(strMessage);
			}		
		if (doit)
			{
				window.location.href = strURL;
			}
		else
			{
				document.focus();
			}
	}	
	
function UpdateConfirm(strURL, strMessage)
	{
		var doit
		doit = window.confirm('Are you sure you want to ' + strMessage + ' this item');
		if (doit)
			{
				window.location.href = strURL;
			}
		else
			{
				document.focus();
			}
	}		
	
function ReInstateConfirm(strURL)
	{			
		var doit = window.confirm('Are you sure you want to re-instate this item?');
				
		if (doit)
			{
				window.location.href = strURL;
			}
		else
			{
				document.focus();
			}
				

	}
	

function chgColour(currObj,strHex)
{
	currObj.style.backgroundColor = strHex;
}

function AddToOptionList(objVal,objText,objSet) {
	var ddObj = eval('document.ADMINFORM.'+objSet);
	ddObj[ddObj.length] = new Option(objText,objVal);
	ddObj.selectedIndex = (ddObj.length - 1);
	ddObj.focus();
}

function mngParent(objVal,objText,objSet) {
	window.opener.AddToOptionList(objVal,objText,objSet);
	window.close();
}

function toggleML(arrElmnt, iLangID, arrLangID, strForm) {
	for (var i = 0; i < arrLangID.length; i++) {
		if (arrLangID[i] == iLangID){					
			for (var x = 0; x < arrElmnt.length; x++){
				var checkfield = (strForm + '.' + arrElmnt[x] + '_' + arrLangID[i]);
				eval(checkfield).style.display = 'block';
				document.images['FLAG_' + arrLangID[i]].style.borderBottom = '3px solid #333333';
			}						
		}
		else
		{
			for (var z = 0; z < arrElmnt.length; z ++){
				var checkfield = (strForm + '.' + arrElmnt[z] + '_' + arrLangID[i]);
				eval(checkfield).style.display = 'none';
				document.images['FLAG_' + arrLangID[i]].style.borderBottomWidth = '0px';			
			}
		}
		
	}
}