	var IE = (navigator.appName == "Microsoft Internet Explorer");
	function getElement(sName)
	{
		if (IE)
		{
			return eval('document.all.'+sName);
		}
		else
		{
			return document.getElementById(sName);
		}
		
	}
	
	function getXYParent(Obj) 
	{
		for (var sumTop=0,sumLeft=0;Obj!=document.body;sumTop+=Obj.offsetTop,sumLeft+=Obj.offsetLeft, Obj=Obj.offsetParent);
		return {left:sumLeft,top:sumTop}
	}
	
	function getXYParent(Obj,oParent) 
	{
		for (var sumTop=0,sumLeft=0;Obj!=document.oParent;sumTop+=Obj.offsetTop,sumLeft+=Obj.offsetLeft, Obj=Obj.offsetParent);
		return {left:sumLeft,top:sumTop}
	}

	oFlashTimeOut = '';
	function doClassFlash(sObject,iStep,iTimeout,iTimeout2,sClassA,sClassB)
	{
		clearTimeout(oFlashTimeOut);
		oFlashTimeOut = setTimeout("classFlash('"+sObject+"','"+iStep+"',"+iTimeout2+",'"+sClassA+"','"+sClassB+"')",iTimeout);
	}
	
	function classFlash(sObject,iStep,iTimeout,sClassA,sClassB)
	{
		el = getElement(sObject);
		if (!bLoading)
		{
			if (el.className == sClassA)
			{
				el.className = sClassB;
			}
			else
			{
				el.className = sClassA;
				iStep--;
			}
			if (iStep != 0)
			{
				setTimeout("classFlash('"+sObject+"','"+iStep+"',"+iTimeout+",'"+sClassA+"','"+sClassB+"')",iTimeout);
			}
		}
	}
	
	function openWindow(sURL,sName,iWidth,iHeight,sHAlign,sVAlign,iXPadding,iYPadding,sAreaType)
	{
		if (sHAlign == undefined) sHAlign = 'left';
		if (sVAlign == undefined) sVAlign = 'top';
		if (iXPadding == undefined) iXPadding = 0;
		if (iYPadding == undefined) iYPadding = 0;
		if (sAreaType == undefined) sAreaType = 'window';
		
		
		
		switch(sAreaType)
		{
			case('window'):
				if (IE)
				{
					iAreaLeft = window.screenLeft;
					iAreaTop = window.screenTop;
				}
				else
				{
					iAreaLeft = window.left;
					iAreaTop = window.top;
				}
				iAreaWidth = document.body.clientWidth;
				iAreaHeight = document.body.clientHeight;
			break;
			case('screen'):
				iAreaLeft = 0;
				iAreaTop = 0;
				iAreaWidth = document.body.clientWidth;
				iAreaHeight = document.body.clientHeight;
			break;
		}
		
		switch(sHAlign)
		{
			case('center'):
				iLeft = iAreaLeft+((iAreaWidth-iWidth)/2)+iXPadding;
			break;
			default:
				iLeft = iAreaLeft+iXPadding;
			break;
		}
		
		switch(sVAlign)
		{
			case('middle'):
				iTop = iAreaTop+((iAreaHeight-iHeight)/2)+iYPadding;
			break;
			default:
				iTop = iAreaTop+iYPadding;
			break;
		}
		
		
		oWindow = window.open(sURL,sName,'width='+iWidth+',height='+iHeight+',left='+iLeft+',top='+iTop+',scrollbars=yes');
		if (sURL.substr(0,4) != 'http')
		{
			oWindow.focus();
			oWindow.moveTo(iLeft,iTop);
		}
	}
	
	 function getXY(Obj) 

            {

                        var sumTop=0,sumLeft=0;

                        for (var sumTop=0,sumLeft=0;Obj!=document.body && Obj != null;sumTop+=Obj.offsetTop,sumLeft+=Obj.offsetLeft, Obj=Obj.offsetParent);

                        return {left:sumLeft,top:sumTop}

            }



	function getSize(Obj) 
	{
		iWidth = Obj.offsetWidth;
		iHeight = Obj.offsetHeight;
		return {width:iWidth,height:iHeight};
	}	

	function jsDebug(sText)
	{
		oDebug = getElement('jsDebug');
		oDebug.style.display = '';
		oDate = new Date();
		sText = oDate.toUTCString()+' - '+sText
		oDebug.innerHTML = sText+'<br/>'+oDebug.innerHTML;
	}
	
	aDropDowns = new Array();
	aDropDownNames = new Array();
	
	function dropDown(sGroupName,sTargetDiv,sDivName,sHAlign,sVAlign,bForce,iPaddingLeft,iPaddingTop,sParentName)
	{
		if (aDropDowns[sGroupName] === undefined) aDropDowns[sGroupName] = new Array();
		if (aDropDownNames[sGroupName] === undefined) aDropDownNames[sGroupName] = new Array();
		
		if ((aDropDownNames[sGroupName][sDivName] === undefined))
		{
			if (sParentName == undefined)
				sParentName = '';
			oDropDown = getElement(sDivName);
			oTargetDiv  = getElement(sTargetDiv);

			aDropDown = new Array();
			aDropDown['name'] = sDivName;
			aDropDown['status'] = false;
			aDropDown['statusNext'] = false;
			aDropDown['oDrop'] = oDropDown;
			aDropDown['oTarget'] = oTargetDiv;
			aDropDown['sParentName'] = sParentName;
			aDropDown['top'] = oTargetDiv;
			aDropDown['left'] = oTargetDiv;
			aDropDown['halign'] = sHAlign;
			aDropDown['valign'] = sVAlign;
			aDropDown['paddingLeft'] = iPaddingLeft;
			aDropDown['paddingTop'] = iPaddingTop;
			
			aDropDownNames[sGroupName][sDivName] = aDropDowns[sGroupName].length;
			iCurDropDown = aDropDownNames[sGroupName][sDivName];
			aDropDowns[sGroupName].push(aDropDown);
		}
		else
			iCurDropDown = aDropDownNames[sGroupName][sDivName];
		
			
		for(var i=0 ; i<aDropDowns[sGroupName].length ; i++)
		{
			if ((!bForce) || i != iCurDropDown)
				aDropDowns[sGroupName][i]['status'] = false;
		}
		
		aDropDowns[sGroupName][iCurDropDown]['status'] = bForce;
		
		if ((bForce))
			hideSelects('hidden')
		else
			hideSelects('visible');
		
		
		if ((aDropDowns[sGroupName]['timer'] === undefined) || (aDropDowns[sGroupName]['timer'] == false))
		{
			aDropDowns[sGroupName]['timer'] = setTimeout("setDropDowns('"+sGroupName+"');",10)
		}
	}
	
	function setDropDowns(sGroupName)
	{
		clearTimeout(aDropDowns[sGroupName]['timer']);
		aDropDowns[sGroupName]['timer'] = false;
		sDivDrops = '';
		for(var i=0 ; i<aDropDowns[sGroupName].length ; i++)
		{
			aDropDown = aDropDowns[sGroupName][i];
			oDropDown = aDropDown['oDrop'];

			sDivDrops = sDivDrops+' | '+aDropDown['name']+' : '+aDropDown['status'];
			
			if ((aDropDown['status']) && (oDropDown.style.display != ''))
			{ 
				bOpened = true;
				
				oDropDown.style.display = '';
				
				sVAlign = aDropDown['valign'];
				sHAlign = aDropDown['halign'];
				
				oDropDown = aDropDown['oDrop'];
				oTargetDiv = aDropDown['oTarget'];
				sParentName = aDropDown['sParentName'];

				if (sParentName == '')
					aTargetPos = getXY(oTargetDiv);
				else
				{
					oParent = getElement(sParentName);
					aTargetPos = getXY(oTargetDiv,true);
					aParentTargetPos = getXY(oParent,true);
					aParentTargetSize = getSize(oParent,true);
					
					aTargetPos['left'] = aTargetPos['left']-aParentTargetPos['left'];
					//if (IE)
					//	aTargetPos['top'] = aTargetPos['top']-aParentTargetPos['top'];
				}
				aTargetSize = getSize(oTargetDiv);
				
				
				aDropDownPos = getXY(oDropDown);
				aDropDownSize = getSize(oDropDown);
				
				if (sHAlign == 'middleLeft')   
					iLeft = aTargetPos['left'];
				else if (sHAlign == 'middleRight')
					iLeft = aTargetPos['left']+(aTargetSize['width']-aDropDownSize['width']);
				else if (sHAlign == 'right')
					iLeft = aTargetPos['left']+aTargetSize['width'];
				else // or == 'left'
					iLeft = aTargetPos['left']-aDropDownSize['width'];
				
					
				if (sVAlign == 'bottomTop')
					iTop = aTargetPos['top'];
				else if (sVAlign == 'bottom')
					iTop = aTargetPos['top']+aTargetSize['height'];
				else if (sVAlign == 'top')
					iTop = aTargetPos['top']-aTargetSize['height'];
				else if (sVAlign == 'topBottom')
					iTop = aTargetPos['top']-aTargetSize['height']+aTargetSize['height'];
	
				if (aDropDown['paddingTop'] != undefined)
					iTop += aDropDown['paddingTop'];
				if (aDropDown['paddingLeft'] != undefined)
					iLeft += aDropDown['paddingLeft'];
					
				aDropDown['top'] = iTop+'px';
				aDropDown['left'] = iLeft+'px';
				
				oDropDown.style.top = aDropDown['top'];
				oDropDown.style.left = aDropDown['left'];				
			}
			else if ((!aDropDown['status']) && (oDropDown.style.display != 'none'))
				aDropDown['oDrop'].style.display = 'none'
		}
	}
	
	
	function hideSelects(action) 
	{
		/*
		if (navigator.appName.indexOf("MSIE")) 
		{
			oDiv = getElement('externalIFrame');
			if (action!='visible'){action='hidden';}
			if (oDiv != undefined) oDiv.style.visibility = action;
		}
		*/
		
		//documentation for this script at http://www.shawnolson.net/a/1198/
		//possible values for action are 'hidden' and 'visible'
		for (var S = 0; S < document.forms.length; S++)
		{
			for (var R = 0; R < document.forms[S].length; R++) 
			{
				if (document.forms[S].elements[R].options) 
				{
					document.forms[S].elements[R].style.visibility = action;
				}
			}
		} 
		
	}
	
	//end code