


				function clickHandler(targetElementId) {
				  var targetElement;
				  
						targetElement = document.getElementById(targetElementId);
					
				   		if (targetElement.style.visibility=="visible") {
				  			targetElement.style.visibility="collapse";
						} else {
				  			targetElement.style.visibility="visible";
						}
				
				}

				function switchDiv(div_id)
				{
				
				  var style_sheet = getStyleObject(div_id);
				  if (style_sheet)
				  {
				    hideAll();
				    changeObjectVisibility(div_id, "visible");
				  }
				  else 
				  {
				    //alert("For this Purchase Type there is no ");
				  }
				}
				
 
 				function getStyleObject(objectId) 
				{
				  // checkW3C DOM, then MSIE 4, then NN 4.
				  //
				  if(document.getElementById && document.getElementById(objectId)) {
					return document.getElementById(objectId).style;
				   } else if (document.all && document.all(objectId)) {  
						return document.all(objectId).style;
				   }  else if (document.layers && document.layers[objectId]) { 
						return document.layers[objectId];
				   } else {
						return false;
				   }
				   
				}
			
				function changeObjectVisibility(objectId, newVisibility) {
				    // first get the object's stylesheet
				    var styleObject = getStyleObject(objectId);
				
				    // then if we find a stylesheet, set its visibility
				    // as requested
				    //
				    if (styleObject) {
						styleObject.visibility = newVisibility;
						return true;
				    } else {
						return false;
				    }
				}			
					
				

				function ShowElement(popupitem)
				{
					popupitem.style.visibility = "Visible";
				}

				function HideElement(popupitem)
				{
					popupitem.style.visibility = "Hidden";	
				}

				function toggleDisplay(elementID)
				{
				
					// the following value should be the same as a class defined in the CSS
					var displayNoneClass = 'hideit';
					
					if (document.getElementById(elementID))
					{
						// if element is not shown, we display it
						if (document.getElementById(elementID).className.indexOf(displayNoneClass) != -1 || document.getElementById(elementID).style.display == 'none')
						{
							document.getElementById(elementID).className = document.getElementById(elementID).className.replace(displayNoneClass, '');
							// handle inline style display:none, otherwise the element will not show
							if (document.getElementById(elementID).style.display == 'none')
							{
								document.getElementById(elementID).style.display = '';
							}
						}
						// else element is shown and we hide it
						else
						{
							document.getElementById(elementID).className += ' '+displayNoneClass;
						}
					}
				}
				
				
				function msgBox (result) {
					alert (result) 
				}
				
				function formCollect(oForm)
				{
				  var sRetval='', sTemp='', sCTName='', sCName='', sCType='', arrElts=[],
				    oCurrent=null;
				  for (var i=oForm.elements.length-1; i >= 0; i--)
				  {
				    oCurrent = oForm.elements[i];
				    /* successful elements must have a name and must not be disabled */
				    if (oCurrent.name && !oCurrent.disabled) arrElts.push(oCurrent);
				  }
				
				  /* sort elements so same names will be adjacent to each other */
				  arrElts.sort(function(a,b){return ((a.name<b.name)?1:(a.name==b.name)?0:-1);});
				
				  while (oCurrent = arrElts.pop())
				  {
				    sCTName = oCurrent.tagName.toLowerCase();
				    sCName = oCurrent.name.toLowerCase();
				    sCType = ((oCurrent.type)?oCurrent.type:'').toLowerCase();
				
				    /* handle input[type="radio|checkbox"] */
				    if (sCTName == "input" && /^(?:radio|checkbox)$/.test(sCType))
				    {
				      do {
				        if (oCurrent.checked || oCurrent.selected)
				          sRetval = sRetval.append(encodeURIComponent(oCurrent.name) + '=' +
				                         encodeURIComponent(oCurrent.value), '&');
				      } while (arrElts[arrElts.length-1].name == oCurrent.name &&
				               (oCurrent = arrElts.pop()));
				    }
				
				    /* handle select[multiple] */
				    if (sCTName == "select" && oCurrent.multiple && oCurrent.options)
				    {
				      for (i=0,len=oCurrent.options.length,sTemp=''; i < len; i++)
				        if (oCurrent.options[i].selected)
				          sTemp = sTemp.append(encodeURIComponent(oCurrent.options[i].value),
				                               ',');
				      sRetval = sRetval.append(encodeURIComponent(oCurrent.name) + '=' +
				                               sTemp, '&');
				    }
				    /* any other element */
				    else if ((sCTName == "input" &&
				             /^(?:text|password|hidden)$/.test(sCType)) ||
				            /^(?:select|textarea)$/.test(sCTName))
				    {
				      sRetval = sRetval.append(encodeURIComponent(oCurrent.name) + '=' +
				                     encodeURIComponent(oCurrent.value), '&');
				    }
				  }
				  return sRetval;
				}
				String.prototype.append = function(sAdd, sSep)
				{
				  return this + ((this.length)?sSep:'') + sAdd;
				}
				
				
