		// ---------------------------------------------
		function PostActionRequest(action, target)
		{
			//postback event handling
			var objectTargetContainer = document.all[objectTargetContainerName];
			objectTargetContainer.value = target;
			var postBackEventCall = postBackEventReferenceTemplate.replace(/javascript\:/i,"").replace(/\[action\]/gi,action);
			eval(postBackEventCall);
		}
		
		//---------------------------------------------------------------------------------------------------------
        function button_msover(anImage)
        {
	        with(anImage) src = src.replace(".gif","_ms.gif");
        } 

        //---------------------------------------------------------------------------------------------------------
        function button_msout(anImage)
        {
	        with(anImage) src = src.replace("_ms.gif",".gif");
        }
					
		//------------------------------------------------------------------
        function SelectResourceTypeEditor()
        {
            with(document.forms[0])
            {
                var urlvisible = !isfile;
                var uploadvisible = isfile;
                var selectedOption = ResourceType.options[ResourceType.selectedIndex];
                if (selectedOption.isfile!=undefined)
                {
                    var isfile = (selectedOption.isfile.toLowerCase()=="true");
                    urlvisible = !isfile;
                    uploadvisible = isfile;
                } else
                {
                    urlvisible = false;
                    uploadvisible = false;
                }

                with(document.all.ResourceURLContainer)
                    style.display = urlvisible ? "block" : "none";

                if (document.all.ResourceUploadContainer)
                    with(document.all.ResourceUploadContainer)
                        style.display = uploadvisible ? "block" : "none";

                if (document.all.ResourceUploadContainer1)
                    with(document.all.ResourceUploadContainer1)
                        style.display = uploadvisible ? "block" : "none";
            }
        }
        
		//------------------------------------------------------------------
		function Replace( astring, findstr, replacestr)
		{
			return astring.split(findstr).join(replacestr);
		}		
		
		//------------------------------------------------------------------
		function ExecuteSearch()
		{
		    with(document.forms[0])
		    {
		        var classificationChecked = false;
		        for(var i=0; i<ClassificationID.length; i++)
		            if (classificationChecked = ClassificationID[i].checked)
		                break;
		                
		        if (!(Keywords.value || classificationChecked ))
		        {
		            alert("You have no search terms entered.\n\nPlease select at least one classification or enter a keyword to search for.");
		            return;
		        }
		        PostActionRequest("execute-search");
		    }
		}
		
		//------------------------------------------------------------------
		function GetSearchTerms()
		{
		    PostActionRequest("get-search-terms");
		}
			
	    
	    //------------------------------------------------------------------
		function GetSubClassifications()
		{
		    PostActionRequest("get-subclassifications", document.forms[0].Classification1.value );
		}
			
		//------------------------------------------------------------------
		function CancelEdit()
		{
		    PostActionRequest("cancel");
		}
			
	    //------------------------------------------------------------------
		function PostItem()
		{
		    SelectAll( document.forms[0].ClassificationIDs );
		    PostActionRequest("post");
		}
				
		//------------------------------------------------------------------
		function AddNewItem()
		{
		    PostActionRequest("add");
		}
				
		//------------------------------------------------------------------
		function EditItem()
		{
			var aselect = document.forms[0].ItemSelector;
			var anarray=ReadSelection( aselect );
			
			if (anarray.length==1)
			{
    		    PostActionRequest("edit",aselect.options[anarray[0]].value);
			}
		}

		//------------------------------------------------------------------
		function DeleteItem()
		{
			var aselect = document.forms[0].ItemSelector;
			var anarray=ReadSelection( aselect );
			var astring = "";
			var ItemIDs = "";
			
			for(var i=0; i<anarray.length; i++)
				{
				 astring += "\n\t"+aselect.options[anarray[i]].text;
				 ItemIDs += "," + aselect.options[anarray[i]].value;
				}


			if ((anarray.length)&&confirm("You are about to delete these Item(s).\n"+ astring))
				{
				    if ((anarray.length==1)||confirm("Are you sure?!"))
				    {
        		        PostActionRequest("delete",ItemIDs);
				    }
				}
		}
		
		//------------------------------------------------------------------
		function ReadSelection( aselect )
		{
			var anarray = [];
			with (aselect) 
				for(var i=0;i<options.length;i++) 
					if((options[i].selected)&&(options[i].value)) 
						anarray[anarray.length]=i;
			return anarray;
		}
