function toggleclassNameDisplay2(a_objElement, a_strclassName){
	//this function swaps the visability of all the elements in the 'all' collection of the supplied element
	//whose className property matches the supplied a_strclassName value
	
	//initilise and loop through the 'all' collection for the provided element
	//for(var i=0; i<a_objElement.all.length; i++) {
	for(var i=0; i<a_objElement.childNodes.length; i++) {
		if(!confirm('a_objElement.childNodes(i).className ' + a_objElement.all(i).className)){return}//alert(a_objElement.all(i).tagName);
		if (typeof(a_objElement.childNodes(i).childNodes)=='object'){toggleclassNameDisplay(a_objElement.childNodes(i), a_strclassName)}
		//test if the className property matches the supplied argument
		if(a_objElement.childNodes(i).className == a_strclassName){
			//alert(a_objElement.all(i).className);
			
			
			//the className matches toggle the elelments visability
			if (a_objElement.childNodes(i).style.display == 'block'){
				a_objElement.childNodes(i).style.display = 'none';
			}
			else{
				a_objElement.childNodes(i).style.display = 'block';
			}
		}
	}//close the loop

	
}



function setElementDisplay(a_strID, a_bolDisplay){
	//this function sets the visability of the element with the supplied id
	
	var l_objElement = document.getElementById(a_strID)
	
	
	if (l_objElement){
		if (l_objElement.nodeType==1){
			switch(a_bolDisplay){
			case null:
				//alert('Toggle the display of the element with a ' + a_strProperty + ' value of ' + l_strPropValue)
				//toggle the elelments visability
				//alert('l_objElement.childNodes[i].style.display' + l_objElement.childNodes[i].style.display)
				if (l_objElement.style.display == 'block'){
					l_objElement.style.display = 'none';
				}
				else{
					l_objElement.style.display = 'block';
				}
				break
			case true:
				//alert('Show the element with a ' + a_strProperty + ' value of ' + l_strPropValue)
				l_objElement.style.display = 'block';
				break
			case false:
				//alert('Hide the element with a ' + a_strProperty + ' value of ' + l_strPropValue)
				l_objElement.style.display = 'none';
				break
			}
		}
		else{
			//not an element
		}
	
	}
	else{
		//alert("does not exist")
	}
}



function setDisplayByFilter(a_strID, a_strProperty, a_strDelimiter, a_intIndex,a_strValue, a_bolDisplay){
	//this function swaps the visability of all the elements in the 'all' collection of the supplied element
	//the supplied property(a_strProperty) is 'split' using the supplied a_strDelimiter
	//the n'th index (a_intIndex), of the 'split' property, is then tested against the a_strValue.
	//If it matches, then its 'style.display' value is set
	//a_bolDisplay==null, then the displaye is toggeld on/off
	//a_bolDisplay==true, then the display is set on
	//a_bolDisplay==false, then the display is set off

	//initilise and loop through the 'all' collection for the provided element
	
	//27-09-2009//
	var l_objElement = document.getElementById(a_strID)
	//var l_objElement = $id(a_strID)
	//alert(l_objElement.childNodes[1].id)
	//alert(l_objElement)
	//alert('ba_strID ;' + a_strID)
	
	if (l_objElement!=null){
		setNodeDisplayByFilter(l_objElement, a_strProperty, a_strDelimiter, a_intIndex,a_strValue, a_bolDisplay)
	}
	
}

function setNodeDisplayByFilter(l_objElement, a_strProperty, a_strDelimiter, a_intIndex,a_strValue, a_bolDisplay){
	//this function swaps the visability of all the elements in the 'all' collection of the supplied element
	//the supplied property(a_strProperty) is 'split' using the supplied a_strDelimiter
	//the n'th index (a_intIndex), of the 'split' property, is then tested against the a_strValue.
	//If it matches, then its 'style.display' value is set
	//a_bolDisplay==null, then the displaye is toggeld on/off
	//a_bolDisplay==true, then the display is set on
	//a_bolDisplay==false, then the display is set off

	//initilise and loop through the 'all' collection for the provided element
	
	//var l_objElement = document.getElementById(a_strID)
	//alert(l_objElement.childNodes[1].id)
	//alert(l_objElement)
	//alert('ba_strID ;' + a_strID)
	
		for(var i=0; i<l_objElement.childNodes.length; i++) {
			//nodeType not working
			//if(!(window.confirm(l_objElement.childNodes[i].nodeName))){return};
			//alert(l_objElement.childNodes[i].nodeType)
			if (l_objElement.childNodes[i].nodeType==1){
				//
				setNodeDisplayByFilter(l_objElement.childNodes[i], a_strProperty, a_strDelimiter, a_intIndex,a_strValue, a_bolDisplay)
				var l_strPropValue= eval('l_objElement.childNodes[i].'+ a_strProperty)
				//if(!(window.confirm('l_strPropValue: ' + l_strPropValue))){return}
			
				//alert(l_strPropValue != undefined)
				 
				//test the property value
				if(l_strPropValue!='' && l_strPropValue!=undefined){
					var l_strFilter
					//if a_strDelimiter is null or an empty string
					if(a_strDelimiter==null ||a_strDelimiter=='' ){
						l_strFilter	= l_strPropValue
					}
					else{
						//try to split the property value using the supplied delimiter
						var l_strTemp = l_strPropValue.split(a_strDelimiter)
						l_strFilter = l_strTemp[a_intIndex]
						//if(!(window.confirm('l_strFilter (postSplit): ' + l_strFilter))){return}
					}
					
					
					if(typeof(l_strFilter)=='undefined'){
						//if(!(confirm('The ' + a_strProperty + '(==' + l_strPropValue + ') for the curent element[' + i + '] will not split'))){return}
					}
					else{
						//if(!(confirm('The ' + a_strProperty + ' with a value of ' + l_strPropValue + ' will be tested against:' +  a_strValue))){return}
					}
					
					//test if the property (part of property) matches the supplied a_strValue argument
					if(l_strFilter == a_strValue){
						//they match
						//test to see if the display is to be toggled
						switch(a_bolDisplay){
						case null:
							//alert('Toggle the display of the element with a ' + a_strProperty + ' value of ' + l_strPropValue)
							//toggle the elelments visability
							//alert('l_objElement.childNodes[i].style.display' + l_objElement.childNodes[i].style.display)
							if (l_objElement.childNodes[i].style.display == 'block'){
								l_objElement.childNodes[i].style.display = 'none';
							}
							else{
								l_objElement.childNodes[i].style.display = 'block';
							}
							break
						case true:
							//alert('Show the element with a ' + a_strProperty + ' value of ' + l_strPropValue)
							l_objElement.childNodes[i].style.display = 'block';
							break
						case false:
							//alert('Hide the element with a ' + a_strProperty + ' value of ' + l_strPropValue)
							l_objElement.childNodes[i].style.display = 'none';
							break
						}

					}
					
				}	//close test the property value
			}	//close test for type
			else{
				//alert('not a HTML Element')
			}
		}	//close the loop

	
}




function toggleElementDisplay(a_objElement){
	//this function swaps the visability of the supplied element
	//alert(a_objElement.id)
	if (a_objElement){
		if (a_objElement.style.display == 'block'){
			a_objElement.style.display = 'none';
		}
		else{
			a_objElement.style.display = 'block';
		}
	}
	else{
		//alert("does not exist")
	}
}


function getDOMObj(a_strID){
    if (document.getElementById) {return document.getElementById(a_strID);}
    else if (document.all) {return document.all[a_strID];}
    else if (document.layers) {return document.layers[a_strID];}
}

function isChildOf(a_objElement,a_objIsParent) {
	
	while(a_objElement) {
		if (a_objElement==a_objIsParent){ 
			//the current object is the 'a_objIsParent' object
			//exit out of the function, returning a true value
			return true;
		}
		a_objElement=a_objElement.parentNode;
	}
	//the tree 'above' a_objElement, has been fully searched
	//and the 'a_objIsParent' hasn't been found
	//exit out of the function, returning a true value
	return false;
}


function formToQString(a_objForm){
	//convert a form into a querystring
	//name=value&name2=value2
	var l_strReturn = ""
	var l_strValue = ""
	
		for (i = 0; i <= (a_objForm.length - 1); i++) {
			
			var a_objElement = a_objForm.elements[i]
			//need a switch statment on the tagname, shoe that the orrect property is recovered
			
			l_strValue = ""

			switch (a_objElement.tagName){
				case 'INPUT':
					//alert(a_objElement.type)
					switch (a_objElement.type){
					case 'text':
						l_strValue =  a_objForm.elements[i].name + "=" + escape(a_objElement.value)
					break
					case 'password':
						l_strValue = a_objForm.elements[i].name + "=" +  escape(a_objElement.value)
					break
					case 'file':
						l_strValue =  a_objForm.elements[i].name + "=" + escape(a_objElement.value)
						break
					case 'radio':
						if(a_objElement.checked){
							l_strValue =  a_objForm.elements[i].name + "=" + escape(a_objElement.value)
						}
						break
					case 'checkbox':
						if(a_objElement.checked){
							l_strValue =  a_objForm.elements[i].name + "=" + escape(a_objElement.value)
						}
						break
						
					//case 'button':
						//buttons are used to perform non submit or reset actions
						//hence these should be enabled/disabled explicitly as required
					//break
					case 'reset':
						//a reset button, when disabled does not reset the form
						//the 'onclick' event is handled before the reset is sent
						//hence when it is sent, and the control has been disabled the form is NOT reset
						//
						//no action is taken
					break
					default:
						l_strValue =  a_objForm.elements[i].name + "=" + escape(a_objElement.value)
					break
					}
				break
				case 'TEXTAREA':
					l_strValue =  a_objForm.elements[i].name + "=" + escape(a_objElement.value) + ""
				break
				case 'SELECT':
					l_strValue = a_objForm.elements[i].name + "=" + escape(a_objElement.options[a_objElement.selectedIndex].value)
				break
				default:
				break
			}
			
			if(l_strValue!=""){
				if(l_strReturn!=""){

					l_strReturn += "&"
					l_strReturn += l_strValue
				}
				else{
					l_strReturn += l_strValue
				}
			}
			//l_strReturn += a_objForm.elements[i].name + "=" + a_objForm.elements[i].name
	
		}                       
	return l_strReturn

	
}


function formToQString2(a_objElement){
	//initilise and loop through the 'all' collection for the provided element
	
	//var l_objElement = document.getElementById(a_strID)
	//alert(l_objElement.childNodes[1].id)
	alert(a_objElement.tagName + ", id:" + a_objElement.id )
	//alert('ba_strID ;' + a_strID)
	var l_strValue = ""
	
		for(var i=0; i<a_objElement.childNodes.length; i++) {
			//nodeType not working
			if (a_objElement.childNodes[i].nodeType==1){
				//
				var l_objHTMLElement = a_objElement.childNodes[i]
				l_strValue = formToQString(a_objElement.childNodes[i])
				alert(l_objHTMLElement.tagName);
				switch (l_objHTMLElement.tagName){
					case 'INPUT':
						//alert(l_objHTMLElement.type)
						switch (l_objHTMLElement.type){
						case 'text':
							l_strValue =  l_objHTMLElement.name + "=" + escape(l_objHTMLElement.value)
						break
						case 'password':
							l_strValue = l_objHTMLElement.name + "=" +  escape(l_objHTMLElement.value)
						break
						case 'file':
							l_strValue =  l_objHTMLElement + "=" + escape(l_objHTMLElement.value)
							break
						case 'radio':
							if(a_objElement.checked){
								l_strValue =  l_objHTMLElement + "=" + escape(l_objHTMLElement.value)
							}
							break
						case 'checkbox':
							if(a_objElement.checked){
								l_strValue =  l_objHTMLElement + "=" + escape(l_objHTMLElement.value)
							}
							break
							
						//case 'button':
							//buttons are used to perform non submit or reset actions
							//hence these should be enabled/disabled explicitly as required
						//break
						case 'reset':
							//a reset button, when disabled does not reset the form
							//the 'onclick' event is handled before the reset is sent
							//hence when it is sent, and the control has been disabled the form is NOT reset
							//
							//no action is taken
						break
						default:
							l_strValue =  l_objHTMLElement.name + "=" + escape(l_objHTMLElement.value)
						break
						}
					break
					case 'TEXTAREA':
						l_strValue =  l_objHTMLElement.name + "=" + escape(l_objHTMLElement.value) + ""
					break
					case 'SELECT':
						l_strValue = l_objHTMLElement.name + "=" + escape(l_objHTMLElement.options[l_objHTMLElement.selectedIndex].value)
					break
					default:
					break
				}
			}	//close test for type
			else{
				//alert('not a HTML Element')
			}
		}	//close the loop

	return l_strValue
}

