		function closeMe(){
			window.close();
		}
	
    function submitOnEnter(event, formname) {
		
		if (!event) event = window.event;
		if (event && event.keyCode == 13) {
			submitForm(formname);
		}else{
			return true;
		}
    }

    function gotoTab(formname,tabname){
      setComponentValue(formname,"selectedTab",tabname);
      submitForm(formname);
    }
	
		function isAppletForm(formname){
			return (document.applets[formname]!=null);
		}
		
		function isDropDown(comp){
			if(comp.options!=null){
				return true;
			}else{
        return false;
			}
		}

		
		
		function getForm(formname){
			
			theform=document.forms['PageWithTabsForm'];
     
			if(theform==null){
        
				theform=document.forms[formname];
        
      
			}
			return theform;
		}


		function setAddListValues(formname,compname,values,hiddenname,skipapplet)
		{
			if (isAppletForm(formname))
			{
				return;
			}
			theform=getForm(formname);
			thecomponent=theform[compname];
			thehidden=theform[hiddenname];
			if (thehidden==null||thehidden.value=="off")
			{
				return;
			}
			
			if (thecomponent==null)
			{
				
				return;
			}
			var selarr=thecomponent.options;
			for (x=selarr.length-1;x>=0;x--)
			{
				selarr[x]=null;
			}
			if (values=="null" || values=="")
			{
				return;
			}
			valstr=new String(values);
			valarr=valstr.split(",");
			for(x=valarr.length-1;x>=0;x--){
					newOp=new Option();
					newOp.text=valarr[x];
					selarr[x]=newOp;
			}
		}
		
		
		
		
    
    
    function setComponentValue(formname,compname,value,skipapplet){
        if(value==null || value=="null" || value=="undefined") value="";
        if(compname=="newcolumn") return;
        valstr=new String(value);
        valarr=valstr.split("+");
        value="";
        for(x=0;x<valarr.length;x++){
            if(x!=0) value+=" ";
            value+=valarr[x];
        }
        value=unescape(value);
        theform=getForm(formname);
        thecomponent=theform[compname];
        if(thecomponent==null){
            
            return;
        }
        if(isDropDown(thecomponent) ){
            
            foundone=false;
            for(x=thecomponent.options.length-1;x>=0;x--){
					if(!foundone && thecomponent.options[x].value==value){
                    thecomponent.options[x].selected=true;
                    foundone=true;
                }
                else{
                    thecomponent.options[x].selected=false;
                }
            }
            if(!foundone && thecomponent.options.length>0){
                thecomponent.options[0].selected=true;
            }
            thecomponent=null;
            return foundone;
        }	
        if(thecomponent.length==null)
        {
            thecomponent.value=value;
				
            if(!skipapplet && isAppletForm(formname)){
                setAppletComponentValue(formname,compname,value);
            }
			
            if(value=="on"){
                    thecomponent.checked=true;
                    
            }
            if(value=="off"){
                    thecomponent.checked=false;
                    
                    
                    
            }
        }
        else{
            
            for(x=0;x<thecomponent.length;x++){
                if(thecomponent[x].value==value){
                    thecomponent[x].checked=true;
                }
                else{
                    thecomponent[x].checked=false;
                }
            }
        }
        return true;
    }
    
    
    
    
    function setComponentValues(formname,compname,values,skipapplet){
        
        if(compname=="newcolumn") return;
        theform=getForm(formname);
        thecomponent=theform[compname];
        if(thecomponent==null){
            
            return;
        }
                
        if(values==null) values = new Array("");

        
        for(x=thecomponent.options.length-1 ;x>=0; x--){
            thecomponent.options[x].selected=false;
        }
        
        
        for(i=0; i < values.length; i++){
            if(values[i]==null || values[i]=="null" || values[i]=="undefined") values[i]="";
        
            valstr=new String(values[i]);
            valarr=valstr.split("+");
            values[i]="";
            for(x=0;x<valarr.length;x++){
                if(x!=0) values[i] += " ";
                values[i] += valarr[x];
            }
        
            values[i] = unescape(values[i]);
            
            if(isDropDown(thecomponent) ){
                
                foundone=false;
                for(x=thecomponent.options.length-1 ;x>=0; x--){

                    if(!foundone && thecomponent.options[x].value==values[i]){              
                        thecomponent.options[x].selected=true;
                        foundone=true;
                    }
                }
                if(!foundone && thecomponent.options.length>0){
                    thecomponent.options[0].selected=true;
                }
                
                
            }
            
            else if(thecomponent.length==null){
                thecomponent.value=values[i];                    
                if(!skipapplet && isAppletForm(formname)){
                    setAppletComponentValue(formname,compname,values[i]);
                }
                            
                if(values[i]=="on"){
                        thecomponent.checked=true;
                }
                if(values[i]=="off"){
                        thecomponent.checked=false;
                        
                        
                }
            }
            
            else{
                for(x=0;x<thecomponent.length;x++){
                    if(thecomponent[x].value==values[i]){
                        thecomponent[x].checked=true;
                    }
                    else{
                        thecomponent[x].checked=false;
                    }
                }
            }
        }
        return true;
    }
		
    
    function getComponentValue(formname,compname){
        theform=getForm(formname);
        var thecomponent=theform[compname];        

        if(thecomponent==null){
            
            return "";
        }
        if(isDropDown(thecomponent)){
            index=thecomponent.selectedIndex;
            if (index==-1) {
                    return "";
            }
            thevalue=thecomponent.options[thecomponent.selectedIndex].value;
            thecomponent=null;
            return thevalue;
        }
	if(thecomponent.length==null)
	{
            thevalue=thecomponent.value;
        }
        else{
            
            for(x=0;x<thecomponent.length;x++){
                if(thecomponent[x].checked) {
                    thevalue = thecomponent[x].value;
                    break;
                }
            }
        }
        thecomponent=null;        
        return thevalue;
    }

    function getCheckBoxValue(formname,compname){	
	theform=getForm(formname);
        var thecomponent=theform[compname];
        if(thecomponent==null)
            return "";
        else return thecomponent.checked;
    }

    
    function getDropDownValues(formname,compname){	
	theform=getForm(formname);
        var thecomponent=theform[compname];
        
        selected = new Array();
        		
        if(thecomponent==null){
            
            return selected;
        }
        if(isDropDown(thecomponent)){
            for (var i = 0; i < thecomponent.options.length; i++){ 
                if (thecomponent.options[i].selected) selected.push(thecomponent.options[i].value);
            }
        }
        thecomponent=null;
        return selected;
    }
    
    
		
		function setAppletComponentValidValues(formname,compname,values){
			theapplet=document.applets[formname];
			theapplet.clearComponentValidValues(compname);
			for(x=0;x<values.length;x++){
				theapplet.addComponentValidValue(compname,values[x]);
			}
			
		}
		
		function setAppletComponentValue(formname,compname,value){
			theapplet=document.applets[formname];
			if(!theapplet || !compname ){
				return;
			}
			theapplet.setComponentValue(compname,value);
		}

		
		
		function setComponentValidValues(formname,compname,values){
			if(isAppletForm(formname)){
				setAppletComponentValidValues(formname,compname,values);
				return true;
			}
			theform=getForm(formname);
			thecomponent=theform[compname];
      if(thecomponent==null){
        
        return false;
      }
      if(!isDropDown(thecomponent)){
				
				return false;
			}	
			for(x=0;x<values.length;x++){
				thecomponent.options[x]=new Option();
				thecomponent.options[x].value=values[x];
				thecomponent.options[x].text=values[x];
			}
			if(thecomponent.options.length>values.length){
				for(x=values.length;x<thecomponent.options.length;x++){
					thecomponent.options[x]=null;
				}
			}
			
			thecomponent.options[0].selected=true;
			return true;
		}
		
		function submitForm(formname){
    
			theform=getForm(formname);
      if(theform==null) {
				
				return;
			}
			doSubmitChecks(formname);	

      theform.submit();

		}
    
    function setAndSubmit(formname, componentname, componentvalue) 
    {
      setComponentValue(formname, componentname, componentvalue);
			submitForm(formname);
		}
    
		function doSubmitChecks(formname){
      funcname="doSubmitChecks_"+formname+"()";
			eval(funcname);
		}

		function doCheckboxes(formname)
		{
			theform=getForm(formname);
			
			for(x=0;x<theform.elements.length;x++){
				
				
				if(theform.elements[x].checked && theform.elements[x].value=="off"){
					theform.elements[x].value="on";
				}  
			}
		}
		function addToList(formName,listName)
		{
			theform=document.forms[formName];
			if (theform==null)
			{
				return;
			}
			thefromlist=theform[listName];
			if (thefromlist==null)
			{
				return;
			}
			theselectlist=theform[listName+"selected"];
			if (theselectlist==null)
			{
				return;
			}
			selarr = theselectlist.options;
			fromarr = thefromlist.options;
			outer : for (j=0; j<fromarr.length; j++) {
				fromOp = fromarr[j];
				if (fromOp.selected==true && fromOp.value!="No items available") {
					newop = new Option();
					newop.text=fromOp.text;
					for (i=0; i<selarr.length; i++) {
						if (selarr[i].text==newop.text) {
							continue outer;
						}
					}
					if (selarr.length==1) {
						if (selarr[0].text=="Select your items") {
							selarr[0]=newop;
						}
						else selarr[selarr.length]=newop;
					}
					else {
						selarr[selarr.length]=newop;
					}
				}
			}
		}
		
		function addToListImproved(formName,listName)
		{
			theform=document.forms[formName];
			if (theform==null)
			{
				return;
			}
			thefromlist=theform[listName];
			if (thefromlist==null)
			{
				return;
			}
			theselectlist=theform[listName+"selected"];
			if (theselectlist==null)
			{
				return;
			}
			selarr = theselectlist.options;
			fromarr = thefromlist.options;
			for (k=fromarr.length-1; k>=0; k--) {
				fromOp = fromarr[k];
				if (fromOp.selected==true) {
					newop = new Option();
					newop.text=fromOp.text;
					selarr[selarr.length]=newop;
					fromarr[k]=null;
				}
			}
		}
		
		function addAllToListImproved(formName,listName){
			theform=document.forms[formName];
			if (theform==null)
			{
				return;
			}
			thefromlist=theform[listName];
			if (thefromlist==null)
			{
				return;
			}
			theselectlist=theform[listName+"selected"];
			if (theselectlist==null)
			{
				return;
			}
			selarr = theselectlist.options;
			fromarr = thefromlist.options;
			for (k=fromarr.length-1; k>=0; k--) {
				fromOp = fromarr[k];				
				newop = new Option();
				newop.text=fromOp.text;
				selarr[selarr.length]=newop;
				fromarr[k]=null;
			}
		}
		
		function removeFromList(formName,listName)
		{
			theform=document.forms[formName];
			if (theform==null)
			{
				return;
			}
			thefromlist=theform[listName];
			if (thefromlist==null)
			{
				return;
			}
			theselectlist=theform[listName+"selected"];
			if (theselectlist==null)
			{
				return;
			}
			selarr = theselectlist.options;
			for (i=selarr.length-1;i>=0;i--)
			{
				if (selarr[i].selected) {
					selarr[i]=null;
				}
			}
		}
		
		function removeFromListImproved(formName,listName)
		{
			theform=document.forms[formName];
			if (theform==null)
			{
				return;
			}
			thefromlist=theform[listName];
			if (thefromlist==null)
			{
				return;
			}
			theselectlist=theform[listName+"selected"];
			if (theselectlist==null)
			{
				return;
			}
			selarr = theselectlist.options;
			fromarr = thefromlist.options;
			for (k=selarr.length-1; k>=0; k--) {
				selOp = selarr[k];
				if (selOp.selected==true) {
					newop = new Option();
					newop.text=selOp.text;
					fromarr[fromarr.length]=newop;
					selarr[k]=null;
				}
		   }
			
		}
		
		function removeAllFromListImproved(formName,listName)
		{
			theform=document.forms[formName];
			if (theform==null)
			{
				return;
			}
			thefromlist=theform[listName];
			if (thefromlist==null)
			{
				return;
			}
			theselectlist=theform[listName+"selected"];
			if (theselectlist==null)
			{
				return;
			}
			selarr = theselectlist.options;
			fromarr = thefromlist.options;
			for (k=selarr.length-1; k>=0; k--) {
				selOp = selarr[k];
				newop = new Option();
				newop.text=selOp.text;
				fromarr[fromarr.length]=newop;
				selarr[k]=null;
			}
		}
		
        function setListValues(formname,listname,value,hiddename)
		{
			var theForm=document.forms[formname];
			var theList="";
			if (theForm==null)
			{
				return;
			}
			var theList=theForm.elements[listname];
			if (theList==null)
			{
				return;
			}
			var thehidden=theForm.elements[hiddename];
			if (thehidden==null)
			{
				return;
			}
			thehidden.value="";
			selarr=theList.options;
			for (i=selarr.length-1;i>=0;i--)
			{
				if(thehidden.value!="")
				{
					thehidden.value=","+thehidden.value;
				}
				thehidden.value=selarr[i].text+thehidden.value
				selarr[i].selected=value;
			}
		}
    
    function showTipFor(object) {
      if (document.layers && document.layers[object] != null) {
        document.layers[object].left = window.event.x + 5 + document.body.scrollLeft;
        document.layers[object].top = window.event.y + 5 + document.body.scrollTop;
        document.layers[object].visibility = 'visible';
      }
      else if (document.all) {
        document.all[object].style.left = window.event.x + 5 + document.body.scrollLeft;
        document.all[object].style.top = window.event.y + 5 + document.body.scrollTop;
        document.all[object].style.visibility = 'visible';
      }
    }

    function hideTipFor(object) {
      if (document.layers && document.layers[object] != null) {
        document.layers[object].visibility = 'hidden';
      }
      else if (document.all) {
        document.all[object].style.visibility = 'hidden';
      }
    }
    
    function setComponentFocus(name){
        var c=document.getElementsByName(name);
        if(c!=null){
            try{
                c[0].focus();
            }
            catch(e){}
        }

    }
