
	 /*#################################################################
	 #
	 #	JS MAIN
	 #
	 ##################################################################*/
	
		var js_mainFunctionsProt = js_mainFunctions.prototype;			
		
		function js_mainFunctions()
		{		
		}
		
	 /*#################################################################
	 #	TIMESTAMP
	 ##################################################################*/
		
		js_mainFunctionsProt.getTimeStamp = function()
		{		
			var timestamp = new Date();
			return timestamp.getYear().toString() + timestamp.getMonth().toString() + timestamp.getDate().toString() + timestamp.getTime();				
		}
		
		js_mainFunctionsProt.killTempPresenters = function()
		{		
		g_fac.killAllDomOfAType('js_tempPresenter', true);	
		}

	 /*#################################################################
	 #	DOM OBJECT PROPERTIES SIMPLE
	 # 	- sets simple styles to DOM object
	 ##################################################################*/
		
		js_mainFunctionsProt.domObjProps = function(obj,position,left,top,width,height)
		{	
	
			try
			{
			obj.style.position = position;
			obj.style.left = left + 'px';
			obj.style.top = top + 'px';
			obj.style.width = width + 'px';
			obj.style.height = height + 'px';												
			}
			catch(e)
			{
			}
		}

	 /*#################################################################
	 #	DOM OBJECT PROPERTIES SIMPLE
	 # 	- sets simple styles to DOM object
	 ##################################################################*/
		
		js_mainFunctionsProt.domExists = function(obj)
		{					
			if(typeof obj == 'object')
			{
			return obj;
			}
			else if(document.getElementById(obj))
			{	
			return document.getElementById(obj)
			}
			else
			{
			return false;
			}								
		}

	//////////////////////////////////////////////////////////////////////////
	// # isDefined
	// - returning TRUE for typeof != 'undefined'
	//////////////////////////////////////////////////////////////////////////
		
		js_mainFunctionsProt.isDefined = function(obj)
		{
			if(typeof obj != 'undefined')
			{
			return true;
			}
			else
			{
			return false;
			}
		}
		
	//////////////////////////////////////////////////////////////////////////
	// # isDefined
	// - returning TRUE for typeof != 'undefined'
	//////////////////////////////////////////////////////////////////////////
		
		js_mainFunctionsProt.isDefinedNOF = function(obj)
		{

			if(typeof obj == 'string')
			{
			return true;
			}
			else if(typeof obj != 'undefined')
			{

				if(eval(obj) == false || obj == null)
				{		
				return false;
				}
				else
				{
				return true;
				}
			}
			else
			{
			return false;
			}
		}
		
	//////////////////////////////////////////////////////////////////////////
	// # isDefinedNNOU
	// - returning TRUE for typeof != 'undefined'
	//////////////////////////////////////////////////////////////////////////
		
		js_mainFunctionsProt.isDefinedNNOU = function(obj)
		{

			if(typeof obj == 'string')
			{
			return true;
			}
			else if(typeof obj == 'undefined')
			{
			return false;			
			}
			else if(obj == null)
			{
			return false;
			}
			else
			{
			return true;
			}
		}			
		
	//////////////////////////////////////////////////////////////////////////
	// # isTrueOrFalse
	// - returning TRUE for boolean value
	//////////////////////////////////////////////////////////////////////////
		
		js_mainFunctionsProt.isTrueOrFalse = function(obj)
		{

			if(obj == true || obj == false)
			{
			return true;
			}
			else
			{
			return false;
			}
		}		
		

	//////////////////////////////////////////////////////////////////////////
	// # isObject (DOM)
	// - returning TRUE for typeof == 'object'
	//////////////////////////////////////////////////////////////////////////
		
		js_mainFunctionsProt.isObject = function(obj)
		{
			if(typeof obj == 'object')
			{
			return true;
			}
			else
			{
			return false;
			}
		}
		
	//////////////////////////////////////////////////////////////////////////
	// # isString
	// - returning TRUE for typeof == 'object'
	//////////////////////////////////////////////////////////////////////////
		
		js_mainFunctionsProt.isString = function(obj)
		{
			if(typeof obj == 'string')
			{
			return true;
			}
			else
			{
			return false;
			}
		}				

	 /*#################################################################
	 #	valueExists
	 #  - if object has value
	 ##################################################################*/
		
		js_mainFunctionsProt.valueExists = function(value)
		{		
			if((value == false || value == "" || value == null || value == "undefined") && value != 0)
			{
			return false;
			}		
			else
			{
			return true;
			}							
		}
		

	//////////////////////////////////////////////////////////////////////////
	// # isOdd
	// - returning TRUE for odd value
	//////////////////////////////////////////////////////////////////////////
		
		js_mainFunctionsProt.isOdd = function(value)
		{
			if(value % 2 == 0)
			{
			return false;
			}
			else
			{
			return true;
			}
		}

	//////////////////////////////////////////////////////////////////////////
	// # isEven
	// - returning TRUE for even value
	//////////////////////////////////////////////////////////////////////////
	
		js_mainFunctionsProt.isEven = function(value)
		{
			if(value % 2 == 0)
			{
			return true;
			}
			else
			{
			return false;
			}	
		}			
		
	 /*#################################################################
	 #	domScreenLeftTop
	 #  - gets coordinates for specified object
	 ##################################################################*/
		
		js_mainFunctionsProt.domScreenLeftTop = function(obj)
		{		
			var curleft = 0;
			var curtop = 0;
				
				var arr = this.findPositionWithScrolling(obj);
				curleft = arr[0];
				curtop = arr[1];

			return [curleft,curtop];							
		}	
		
	 js_mainFunctionsProt.findPositionWithScrolling = function( oElement ) {
	  function getNextAncestor( oElement ) {
	    var actualStyle;
	    if( window.getComputedStyle ) {
	      actualStyle = getComputedStyle(oElement,null).position;
	    } else if( oElement.currentStyle ) {
	      actualStyle = oElement.currentStyle.position;
	    } else {
	      //fallback for browsers with low support - only reliable for inline styles
	      actualStyle = oElement.style.position;
	    }
	    if( actualStyle == 'absolute' || actualStyle == 'fixed' ) {
	      //the offsetParent of a fixed position element is null so it will stop
	      return oElement.offsetParent;
	    }
	    return oElement.parentNode;
	  }
	  if( typeof( oElement.offsetParent ) != 'undefined' ) {
	    var originalElement = oElement;
	    for( var posX = 0, posY = 0; oElement; oElement = oElement.offsetParent ) {
	      posX += oElement.offsetLeft;
	      posY += oElement.offsetTop;
	    }
	    if( !originalElement.parentNode || !originalElement.style || typeof( originalElement.scrollTop ) == 'undefined' ) {
	      //older browsers cannot check element scrolling
	      return [ posX, posY ];
	    }
	    oElement = getNextAncestor(originalElement);
	    while( oElement && oElement != document.body && oElement != document.documentElement ) {
	      posX -= oElement.scrollLeft;
	      posY -= oElement.scrollTop;
	      oElement = getNextAncestor(oElement);
	    }
	    return [ posX, posY ];
	  } else {
	    return [ oElement.x, oElement.y ];
	  }
}

	 /*#################################################################
	 #	domDimensions
	 #  - gets coordinates for specified object and height + width
	 ##################################################################*/
		
		js_mainFunctionsProt.domDimensions = function(obj)
		{	
			if(typeof obj == 'string')
			{
			obj = g_main.domExists(obj);
			}
			
			var pos = this.domScreenLeftTop(obj);
			var left = pos[0];
			var top = pos[1];
			var height = obj.offsetHeight;
			var width = obj.offsetWidth;
			return [left, top, height, width];							
		}
		
	 /*#################################################################
	 #	domDimensionsWidthScroll
	 #  - gets coordinates for specified object and height + width
	 # also calcualte scrolling
	 ##################################################################*/
		
		js_mainFunctionsProt.domDimensionsWithScroll = function(obj)
		{		
			var pos = this.domScreenLeftTop(obj);
			var left = pos[0];
			var top = pos[1];
			var height = obj.scrollWidth;
			var width = obj.scrollWidth;
			return [left, top, height, width];							
		}		
		
	 /*#################################################################
	 #	domDimensions
	 #  - gets coordinates for specified object and height + width
	 ##################################################################*/
		
		js_mainFunctionsProt.strippedFromPaddingMarginBorder = function(obj)
		{		
			var pos = this.domScreenLeftTop(obj);
			var left = pos[0];
			var top = pos[1];
			var height = this.domDimensions_stripHeightFromPaddingMarginBorder(obj, obj.offsetHeight);
			var width = this.domDimensions_stripWidthFromPaddingMarginBorder(obj, obj.offsetWidth);
			return [left, top, height, width];							
		}		
		
	 /*#################################################################
	 #	domDimensions_stripWidthFromPaddingMarginBorder
	 #  - stripping from padding, border and margin values
	 ##################################################################*/
		
		js_mainFunctionsProt.domDimensions_stripWidthFromPaddingMarginBorder = function(obj, currentWidth)
		{	
			var width = currentWidth;
	
				try
				{			
				var paddingLeft = this.getStrippedDimension(obj,'style.paddingLeft');
				var paddingRight = this.getStrippedDimension(obj,'style.paddingRight');
				var borderLeft = this.getStrippedDimension(obj,'style.borderLeft');
				var borderRight = this.getStrippedDimension(obj,'style.borderRight');
				var marginLeft = this.getStrippedDimension(obj,'style.marginLeft');
				var marginRight = this.getStrippedDimension(obj,'style.marginRight');										
				
				width = width - paddingLeft - paddingRight - borderLeft - borderRight - marginLeft - marginRight;
				}
				catch(e)
				{
				}
				
			return width;
		}
		
	 /*#################################################################
	 #	domDimensions_stripHeightFromPaddingMarginBorder
	 #  - stripping from padding, border and margin values
	 ##################################################################*/
		
		js_mainFunctionsProt.domDimensions_stripHeightFromPaddingMarginBorder = function(obj, currentHeight)
		{	
			var height = currentHeight;

				try
				{			
				var paddingTop = this.getStrippedDimension(obj,'style.paddingTop');
				var paddingBottom = this.getStrippedDimension(obj,'style.paddingBottom');
				var borderTop = this.getStrippedDimension(obj,'style.borderTop');
				var borderBottom = this.getStrippedDimension(obj,'style.borderBottom');
				var marginTop = this.getStrippedDimension(obj,'style.marginTop');
				var marginBottom = this.getStrippedDimension(obj,'style.marginBottom');										
				
				height = height - paddingTop - paddingBottom - borderTop - borderBottom - marginTop - marginBottom;
				}
				catch(e)
				{
				}

			return height;
		}				
		
		
		
		
	 /*#################################################################
	 #	getMouseEventCoordinatesObjectExecFunc
	 #  - gets coordinates of mouse event and then executes function on object
	 ##################################################################*/
		
		js_mainFunctionsProt.getMouseEventCoordinatesObjectExecFunc = function(id,action,e)
		{	
				var scrollX = g_bsp.getClientDimension_scrollLeft();
				var scrollY = g_bsp.getClientDimension_scrollTop();
				
				if(navigator.appName == 'Netscape')
				{
				windowX = e.pageX;
				windowY = e.pageY;
				}
				else
				{
					if(g_bsp.userAgent == 'IE')
					{
					windowX = event.x;
					windowY = event.y;
					}
					else
					{
					windowX = event.x + scrollX;
					windowY = event.y + scrollY;									
					}
				}				

			g_fac.getObjectExecFunc(id,action,[windowX,windowY]);
		}
		
	 /*#################################################################
	 #	getMouseEventCoordinatesObjectExecFunc
	 #  - gets coordinates of mouse event and then executes function on object
	 ##################################################################*/
		
		js_mainFunctionsProt.getMouseEventCoordinates = function(e)
		{	
	
				if(navigator.appName == 'Netscape')
				{
				windowX = e.pageX;
				windowY = e.pageY;
				}
				else
				{
				windowX = event.x;
				windowY = event.y;
				}				
				
			return [windowX,windowY];
		}		
		
	 /*#################################################################
	 #	getMouseEventCoordinatesObjectExecFunc
	 #  - gets coordinates of mouse event and then executes function on object
	 ##################################################################*/
		
		js_mainFunctionsProt.getMouseEventCoordinatesObjectExecFuncDisplaced = function(id,action,e,args)
		{	
				var argList = args.toString().split(",");
				var displaceTop = argList[0];
				var displaceLeft = argList[1];
	
				if(navigator.appName == 'Netscape')
				{
				windowX = e.pageX;
				windowY = e.pageY;
				}
				else
				{
				windowX = event.x;
				windowY = event.y;
				}				
				
			g_fac.getObjectExecFunc(id,action,[windowX + eval(displaceTop),windowY + eval(displaceLeft)]);
		}		
		

	 /*#################################################################
	 #	getMouseEventCoordinatesObjectExecFunc
	 #  - gets coordinates of mouse event and then executes function on object
	 ##################################################################*/
		
		js_mainFunctionsProt.getMouseEventCoordinatesObjectExecFuncRelativeToObject = function(id,action,e,objectId)
		{	
				var object = g_main.domExists(objectId);
				var dim = g_main.domScreenLeftTop(object);
				var displaceTop = dim[1];
				var displaceLeft = dim[0];

				if(navigator.appName == 'Netscape')
				{
				windowX = e.pageX;
				windowY = e.pageY;
				}
				else
				{
				windowX = event.x;
				windowY = event.y;
				}				
				
				xRat = windowX - (windowX-(displaceLeft+1));
				yRat = windowY - (windowY-(displaceTop+1));
				g_main.domExists('brax').innerHTML = "LEFT: " + xRat;
//g_fac.getObjectExecFunc(id,action,[(windowX - (windowX-eval(displaceLeft))),(windowY - (windowY-eval(displaceTop)))]);
			g_fac.getObjectExecFunc(id,action,[yRat,xRat]);
		}		
				
		
	 /*#################################################################
	 #	getMouseEventCoordinatesRelativeObjectExecFunc
	 #  - gets coordinates of mouse event and then executes function on object
	 ##################################################################*/
		
		js_mainFunctionsProt.getMouseEventCoordinatesRelativeObjectExecFunc = function(relativeTo,id,action,e)
		{	
	
				if(navigator.appName == 'Netscape')
				{
				windowX = e.pageX;
				windowY = e.pageY;
				}
				else
				{
				windowX = event.x;
				windowY = event.y;
				}				
				
			g_fac.getObjectExecFunc(id,action,[windowX,windowY]);
		}		
		
	 /*#################################################################
	 #	killDom
	 ##################################################################*/
		
		js_mainFunctionsProt.killDom = function(toKill)
		{	
			var domObj = null;
			
			if(typeof toKill == "object")
			{
			domObj = toKill;
			}
			else
			{
			domObj = this.domExists(toKill);
			}

			if(domObj)
			{
				if(domObj.parentNode)
				{
				domObj.parentNode.removeChild(domObj);
				}
			}	
		}

	 /*#################################################################
	 #	printToInnerHTML
	 ##################################################################*/
	 		
		js_mainFunctionsProt.printToInnerHTML = function(dom,string)
		{
			if(this.isDefinedNOF(dom))
			{
				var domObj = this.domExists(dom);
				if(domObj)
				{
				domObj.innerHTML = string;
				}
			}
		}
		
	 /*#################################################################
	 #	printValue
	 ##################################################################*/
	 		
		js_mainFunctionsProt.printValue = function(dom,value)
		{
			var domObj = this.domExists(dom);
			if(domObj)
			{
			domObj.value = value;
			}
		}		
		
	 /*#################################################################
	 #	appendToDom
	 ##################################################################*/
	 		
		js_mainFunctionsProt.appendToDom = function(dom,string)
		{
			var domObj = this.domExists(dom);
			if(domObj)
			{
				var temp = document.createElement("DIV");
				this.printToInnerHTML(temp,string);
				
			domObj.appendChild(temp);
			}
		}		
		
	 /*#################################################################
	 #	printToInnerHTMLAfter
	 ##################################################################*/
	 		
		js_mainFunctionsProt.printToInnerHTMLAfter = function(dom,string)
		{
			var domObj = this.domExists(dom);
			if(domObj)
			{
			domObj.innerHTML = domObj.innerHTML + string;
			}
		}												
		
	 /*#################################################################
	 #	getStrippedDimension
	 ##################################################################*/
		
		js_mainFunctionsProt.getStrippedDimension = function(id,attr)
		{
			var obj = null;
	
			if(typeof id == 'string')
			{
			obj = document.getElementById(id);
			}
			else
			{
			obj = id;
			}
			
			if(obj)
			{
				if(typeof id == 'string')
				{
				obj = eval('document.getElementById(id).' + attr);
				}
				else
				{
				obj = eval('obj.' + attr);
				}
		
	
				if(obj.toString().indexOf('px') !== -1)
				{
				return eval(obj.substr(0,(obj.indexOf('px'))));
				}
				else
				{
				return obj;
				}
			}		
		}
		
		
		js_mainFunctionsProt.stripFromPx = function(obj)
		{
		
			if(obj.toString().indexOf('px') !== -1)
			{
			return eval(obj.substr(0,(obj.indexOf('px'))));
			}
			else
			{
			return obj;
			}			
		}
		
	//////////////////////////////////////////////////////////////////////////
	// # m_sortExtended on ObjId
	// - obj (object)
	// - param [sort parameter] (string)
	// - direction (0 = descending, 1 = ascending)
	//////////////////////////////////////////////////////////////////////////		
		
		js_mainFunctionsProt.sortExtendedOnObjId = function(obj, direction)
		{		
		
			m_sort_desc_int = function(a,b)
			{
			if(eval(a.id) == '' && eval(a.id) != 0){return 1}
			if(eval(b.id) == '' && eval(b.id) != 0) {return -1}
			if(eval(a.id) > eval(b.id)) return 1
			if(eval(a.id) < eval(b.id))  return -1
			return 0
			}
			
			m_sort_asc_int = function(a,b)
			{				
			if(eval(a.id) == '' && eval(a.id) != 0){return 1}
			if(eval(b.id) == '' && eval(b.id) != 0) {return -1}			
			if(eval(a.id) < eval(b.id)) return 1
			if(eval(a.id) > eval(b.id))  return -1
			return 0
			}								

			if(direction == 0)
			{
			return obj.sort(m_sort_desc_int);		
			}
			else
			{
			return obj.sort(m_sort_asc_int);
			}
		
		}		
		
	//////////////////////////////////////////////////////////////////////////
	// # m_sortExtended on ColIndex
	// - obj (object)
	// - param [sort parameter] (string)
	// - direction (0 = descending, 1 = ascending)
	//////////////////////////////////////////////////////////////////////////		

		js_mainFunctionsProt.sortExtendedOnColIndex = function(obj, param, direction, varType)
		{				

			m_sort_desc = function(a,b)
			{	
			if(a.getRowCells()[param].text == ''){return 1}			
			if(b.getRowCells()[param].text == ''){return -1}					
			if(a.getRowCells()[param].text > b.getRowCells()[param].text) return 1
			if(a.getRowCells()[param].text < b.getRowCells()[param].text)  return -1
			return 0
			}

			m_sort_asc = function(a,b)
			{		
			if(a.getRowCells()[param].text == ''){return 1}			
			if(b.getRowCells()[param].text == ''){return -1}			
			if(a.getRowCells()[param].text < b.getRowCells()[param].text) return 1
			if(a.getRowCells()[param].text > b.getRowCells()[param].text)  return -1								
			return 0
			}	
	
			m_sort_desc_int = function(a,b)
			{					
			if(eval(a.getRowCells()[param].text) == '' && eval(a.getRowCells()[param].text) != 0){return 1}
			if(eval(b.getRowCells()[param].text) == '' && eval(b.getRowCells()[param].text) != 0) {return -1}
			if(eval(a.getRowCells()[param].text) > eval(b.getRowCells()[param].text)) return 1
			if(eval(a.getRowCells()[param].text) < eval(b.getRowCells()[param].text))  return -1
			if(typeof a.getRowCells()[param].text == 'string')return 1
			if(typeof b.getRowCells()[param].text == 'string')return -1				
			return 0
			}

			m_sort_asc_int = function(a,b)
			{						
			if(eval(a.getRowCells()[param].text) == '' && eval(a.getRowCells()[param].text) != 0){return 1}
			if(eval(b.getRowCells()[param].text) == '' && eval(b.getRowCells()[param].text) != 0) {return -1}			
			if(eval(a.getRowCells()[param].text) < eval(b.getRowCells()[param].text)) return 1
			if(eval(a.getRowCells()[param].text) > eval(b.getRowCells()[param].text))  return -1
			if(typeof a.getRowCells()[param].text == 'string')return -1
			if(typeof b.getRowCells()[param].text == 'string')return 1				
			return 0
			}

			m_sort_desc_date = function(a,b)
			{
			var dateA = (a.getRowCells()[param].text).split(",");
			var dateB = (b.getRowCells()[param].text).split(",");
			var _dateA = new Date(dateA[0], dateA[1], dateA[2]);
			var _dateB = new Date(dateB[0], dateB[1], dateB[2]);
			
			if(_dateA > _dateB) return 1
			if(_dateA < _dateB) return -1
			return 0
			}
			

			m_sort_asc_date = function(a,b)
			{
			var dateA = (a.getRowCells()[param].text).split(",");
			var dateB = (b.getRowCells()[param].text).split(",");
			var _dateA = new Date(dateA[0], dateA[1], dateA[2]);
			var _dateB = new Date(dateB[0], dateB[1], dateB[2]);
			
			if(_dateA < _dateB) return 1
			if(_dateA > _dateB) return -1
			return 0
			}
					
	
			if(param == false && param != 0)
			{
			return obj;
			}
			else if(direction == 0)
			{

				if(varType == 'int')
				{
				return obj.sort(m_sort_desc_int);
				}
				else if(varType == 'date')
				{
				return obj.sort(m_sort_desc_date);
				}
				else
				{
				return obj.sort(m_sort_desc);
				}
			}
			else
			{

				if(varType == 'int')
				{
				return obj.sort(m_sort_asc_int);
				}
				else if(varType == 'date')
				{
				return obj.sort(m_sort_asc_date);
				}				
				else
				{
				return obj.sort(m_sort_asc);
				}			

			}
		
		}
		
	//////////////////////////////////////////////////////////////////////////
	// # sortArrayOnTextParam
	// - obj (object)
	// - param [sort parameter] (string)
	// - direction (0 = descending, 1 = ascending)
	//////////////////////////////////////////////////////////////////////////		

		js_mainFunctionsProt.sortArrayOnTextParam = function(obj, param, direction)
		{				

			m_sort_desc = function(a,b)
			{
			if(a[param] > b[param]) return 1
			if(a[param] < b[param])  return -1
			return 0
			}
			
			m_sort_asc = function(a,b)
			{
			if(a[param] < b[param]) return 1
			if(a[param] > b[param])  return -1
			return 0
			}	
			
			if(param == false)
			{
			return obj;
			}
			else if(direction == 0)
			{
			return obj.sort(m_sort_desc);
			}
			else
			{
			return obj.sort(m_sort_asc);
			}
		
		}					
				
	//////////////////////////////////////////////////////////////////////////
	// # setFocus
	// - obj (object) OR id
	//////////////////////////////////////////////////////////////////////////		

		js_mainFunctionsProt.setFocus = function(obj)
		{	
			if(typeof obj == 'object')
			{
			obj.focus();
			}
			else if(typeof obj == 'string')
			{
				obj = this.domExists(obj);
				if(obj)
				{
				obj.focus();
				}
			}
		}
		
		
		js_mainFunctionsProt.setFocusOnFirstAvailable = function(obj)
		{

			if(typeof obj == 'string')
			{
				obj = this.domExists(obj);
				if(obj)
				{
				obj.focus();
				}
			}
		
			for(var i in obj.childNodes)
			{				
				if(obj.childNodes[i].tagName == "A")
				{
				obj.childNodes[i].focus();
				return false;
				}
				else if(obj.childNodes[i].childNodes)
				{
					if(obj.childNodes[i].childNodes.length > 0)
					{
					return this.setFocusOnFirstAvailable(obj.childNodes[i]);
					}
				}			
			}
			
			return true;		
		}
		
		js_mainFunctionsProt.changeCssFeature = function(styleSheetHref, inRule, attribute, value)
		{
			var styleSheet = null;
			var cssRules = null; 
			var currentRule = null;
			
			for(var u in document.styleSheets)
			{
				if(document.styleSheets[u].href == styleSheetHref)
				{
				styleSheet = document.styleSheets[u];
				}				
			}
			
			if(g_main.valueExists(styleSheet))
			{
			cssRules = eval("document.styleSheets[0]." + g_bsp.browsersStyleSheetRule);
			
				for(var i in cssRules)
				{
		
					var rule = cssRules[i];
				
					/***************************************************
					*	.main_table 
					***************************************************/
						
						if(rule.selectorText == inRule)
						{
						currentRule = rule;
						break;
						}
										
				}
	
				eval('currentRule.style.' + attribute + '="' + value + '"');
			}
		
		}		
		
	//////////////////////////////////////////////////////////////////////////
	// # setStyleClass
	// - obj (object) OR id
	// - class (string)
	//////////////////////////////////////////////////////////////////////////		

		js_mainFunctionsProt.setStyleClass = function(obj,classN)
		{	

			var obj = this.domExists(obj);
			
			if(obj || this.isObject(obj))
			{
			obj.className = classN;
			}
		}
		

	//////////////////////////////////////////////////////////////////////////
	// # addZero
	// - obj (object) OR id
	// - class (string)
	//////////////////////////////////////////////////////////////////////////		

		js_mainFunctionsProt.addZero = function(value)
		{	
			var zeroed = value;
			
			if(zeroed <= 9)
			{
			return '0' + zeroed;
			}
	
			return zeroed;
			
		}		
		
	//////////////////////////////////////////////////////////////////////////
	// # flipBoolean 
	// - returning boolean opposite
	//////////////////////////////////////////////////////////////////////////
		
		js_mainFunctionsProt.flipBoolean = function(bool)
		{
			if(bool == false)
			{
			return true;
			}
			else
			{
			return false;
			}
		}		
		
	//////////////////////////////////////////////////////////////////////////
	// # generateClassOnTemplateStyle 
	// - templateStyle and classname in
	// * returning string with class="xx"	
	//////////////////////////////////////////////////////////////////////////
			
		js_mainFunctionsProt.generateClassOnTemplateStyle = function(templateStyle, cl)
		{		
			var sb = new js_stringBuffer();
				sb.append(' class="');
				sb.append(cl);
					
					if(templateStyle != null)
					{
					sb.append('_' + templateStyle);
					}
					
				sb.append('"');
				
			return sb.toString();
		
		}
			
	//////////////////////////////////////////////////////////////////////////
	// # generateClassGeneric 
	// -  classname
	// * returning string with class="xx"	
	//////////////////////////////////////////////////////////////////////////				

		js_mainFunctionsProt.generateClassGeneric = function(cl)
		{		
			var sb = new js_stringBuffer();
				sb.append(' class="');
				sb.append(cl);							
				sb.append('"');
				
			return sb.toString();
		
		}				
	
	//////////////////////////////////////////////////////////////////////////
	// # generateClassOnTemplateStyle_plain 
	// - templateStyle and classname in
	// * returning string with classname concated with templateStyle	
	//////////////////////////////////////////////////////////////////////////					
				
		js_mainFunctionsProt.generateClassOnTemplateStyle_plain = function(templateStyle, cl)
		{		
			var sb = new js_stringBuffer();

				sb.append(cl);
					
					if(templateStyle != null)
					{
					sb.append('_' + templateStyle);
					}
											
			return sb.toString();
		
		}		
		
	//////////////////////////////////////////////////////////////////////////
	// # swopImgUrl 
	// - via dom - changing img url	
	//////////////////////////////////////////////////////////////////////////					
				
		js_mainFunctionsProt.swopImgUrl = function(obj, url)
		{		
			
			var img = null;
			
			if(typeof obj == 'object')
			{
			img = obj;
			}
			else
			{
			img = this.domExists(obj);
			}
			
			if(img)
			{
			img.src = url;
			}
		
		}	
		
	//////////////////////////////////////////////////////////////////////////
	// # getValueOnRecursiveJsonString 
	// - json-object and dot-notated string
	// - returning value on parsed string
	//////////////////////////////////////////////////////////////////////////			
		
		js_mainFunctionsProt.getValueOnRecursiveJsonString = function(object, recursiveArray)
		{
			var nextItem = recursiveArray[0];
			
			recursiveArray.splice(0,1);
			
			object = object[nextItem]
			
			if(recursiveArray.length > 0)
			{
			return object = this.getValueOnRecursiveJsonString(object, recursiveArray);
			}
			else
			{
			return object;
			}
		
		}				
		
		js_mainFunctionsProt.tryFocusDomObj = function(id)
		{

			var obj = g_main.domExists(id);
			
			if(obj)
			{
				try
				{
				obj.focus();
				}
				catch(e)
				{
				}
			}	
		
		}
		
	//////////////////////////////////////////////////////////////////////////
	// # getShortenedString 
	// - string to be shortened
	// - number of characters in result
	// - boolean - add dots at end
	//////////////////////////////////////////////////////////////////////////			
		
		js_mainFunctionsProt.getShortenedString = function(string, noOfChars, addDots)
		{
			var res = string.substr(0,noOfChars);
			
			if(string.length <= noOfChars)
			{
			return res;
			}
			else if(addDots == true)
			{
			return res + " ...";
			}
			else
			{
			return res;
			}
		
		}	
		
		
		js_mainFunctionsProt.getLocationOnPage = function(id, adjustLeft, adjustTop, delay)
		{

			var arr = this.domDimensions(id);

			var func = 'window.scrollTo(' + (arr[0] + adjustLeft) + ',' + (arr[1] + adjustTop) + ')';
			if(typeof delay == 'number')
			{
			setTimeout('eval(' + func + ')',delay);
			}
			else
			{
			eval(func);
			}
		}
		
		js_mainFunctionsProt.getTopLocationOnPage = function(id, adjustLeft, adjustTop, delay)
		{

			var arr = this.domDimensions(id);

			var func = 'window.scrollTo(' + 0 + ',' + (arr[1] + adjustTop) + ')';
			if(typeof delay == 'number')
			{
			setTimeout('eval(' + func + ')',delay);
			}
			else
			{
			eval(func);
			}
		}
		
		js_mainFunctionsProt.getLocationOnPageViaTypeAndName = function(objType, name, domObjId, adjustLeft, adjustTop, delay, forceExpand)
		{
			var object = g_fac.getObjectOnTypeAndViewType(objType,name);

			if(object != null)
			{
				var id = object[domObjId].id;
				if(this.isDefinedNOF(id))				
				{
				this.getLocationOnPage(id, adjustLeft, adjustTop, delay);

					if(forceExpand == true)
					{
					object.forceDisplayOnTopMenuChoice();
					}				
				}
			}
		}
		
		js_mainFunctionsProt.getDragDropLinkCore = function()
		{
			var sb = new js_stringBuffer()			
			sb.append(' onmousedown="new js_dragDropLink(this);hideIsDragDrop(this);return false;" onclick="g_fac.getObjectOnNameExecFunc(\'js_dragDropLink\',this.id,\'deactivate\');" onmouseup="g_fac.getObjectOnNameExecFunc(\'js_dragDropLink\',this.id,\'deactivate\');"');
			sb.append(' onmouseover="displayIsDragDrop(this);" onmouseout="hideIsDragDrop(this);"' );
			return sb.toString();
		}
		
		js_mainFunctionsProt.removeHtmlBrsAndNbsps = function(text)
		{
			var pattern = new RegExp("<br\/>","g");
			text = text.replace(pattern," ");
			
			var pattern2 = new RegExp("&nbsp;","g");
			return text.replace(pattern2," ");
			
		}
		
		js_mainFunctionsProt.toggleAllClosableDivs = function(forcedDirection)
		{
			var arr = g_fac.getRegistredCollection('js_closableDiv');

			for(var i in arr)	
			{
				var curr = arr[i];
				curr.toggleExpansion(forcedDirection);
			}		
		}
		
		js_mainFunctionsProt.createAndPlaySound = function(id, url, appendToObjectId)
		{
			var appendToObject = g_main.domExists(appendToObjectId);
		
				var sound = document.createElement("embed");					
				sound.setAttribute("id","alert_sound_"+id);
				sound.setAttribute("hidden", true);
				sound.setAttribute("type","audio/x-wav");
				sound.setAttribute("src",url);					
				sound.setAttribute("volume","100");	
				sound.setAttribute("autostart",true);
			
			appendToObject.appendChild(sound);
		}

