// XXCOM_FORMS v2.3.1   September 15, 2008
// Added New dumpProps function Code

// XXCOM_FORMS v2.3.0   July 22, 2008
// Added Try Block Code to disable custom form tag button before returning True

// XXCOM_FORMS v2.2.9   July 16, 2008
// Added Code to properly Add Event Listeners to Radio Buttons

// XXCOM_FORMS v2.2.8   July 1, 2008
// Updated Code to properly handle File Type Validation

// XXCOM_FORMS v2.2.7   June 27, 2008
// Added: Updated File Upload Code to add newly selected file to the TOP of the display stack

// XXCOM_FORMS v2.2.6   June 26, 2008
// Added: Code change to allow for dynamic assignment of validation object name
// Modified ability to add/subtract from validation object

// XXCOM_FORMS v2.2.5   June 25, 2008
// Added: New function to allow image preview

// XXCOM_FORMS v2.2    June 22, 2008
// Added: New auto-creation of Form.Element.EventObservers
// No Need to use inline events anymore

// XXCOM_FORMS v2.1.5   June 7, 2008
// Added: New form validation Type: URL :: Checks for proper http & https absolute adresses

// XXCOM_FORMS v2.1.4   June 3, 2008
// Added: Inline Error Message

// XXCOM_FORMS v2.1.3   May 6, 2008
// Added: AJAX Tool-Tip

// XXCOM_FORMS v2.1.2   May 3, 2008
// Added: New File Upload Functions: addUploadFileToList, removeUploadFileFromList

// XXCOM_FORMS v2.1.1   May 1, 2008

/*==============================================================*/
/*===================  XXCOM :: 2/15/2008  =====================*/
/*==============================================================*/

var xxcom_form_validation_switch = false;
var xxcom_form_validation_file = false;
var xxcom_forms_validate_items = [];
var XXCOM_FORMS = (function() {		
	// PRIVATE ATTRIBUTES
	validIcon = new Image();		
	invalidIcon = new Image();	
	validIcon.src = "/images/icons/tick.png";		// Preload Images - Update Image Paths Before Using !!!
	invalidIcon.src = "/images/icons/cross.png";	// Preload Images - Update Image Paths Before Using !!!
	editorNumber = 0;
	errorMsg = '';
	// Main Functions :: Privileged 
	return {		
		setFormEvents : function(el_list) {			
			for(i=0; i<el_list.length; i++) {				
				var myID = el_list[i].id;				
				if(el_list[i].type != 'phone' && el_list[i].type != 'file' && el_list[i].type != 'radio') {
					new Form.Element.EventObserver(myID, XXCOM_FORMS.activateFormEvent);
				} else {
					if(el_list[i].type != 'file') { 
						$(myID).setAttribute('onBlur','XXCOM_FORMS.validateElement( this, \'' + el_list[i].type + '\', \'' + el_list[i].msg + '\' ) '); 
					}
					if(el_list[i].type == 'radio') {
						var len = el_list[i].id.length; 
						var idY = el_list[i].id.substr(0,len-2) + 'Y';
						var idN = el_list[i].id.substr(0,len-2) + 'N';
						new Form.Element.EventObserver(idY, XXCOM_FORMS.activateFormEvent);
						new Form.Element.EventObserver(idN, XXCOM_FORMS.activateFormEvent);
					}
				}
					
			}
		},
		activateFormEvent : function(e,val) {			
			for(i=0; i<xxcom_forms_validate_items.length; i++) {	
				if(xxcom_forms_validate_items[i].id == e.id) {
					XXCOM_FORMS.validateElement( $(e.id), xxcom_forms_validate_items[i].type, xxcom_forms_validate_items[i].msg );
					break;
				}
			}				
		},		
		validateFormIDs : function(list,flag) {
			xxcom_form_validation_switch = true;
			xxcom_forms_validate_items=list; 
			this.setFormEvents(list);			
			this.iconRemoveAll('div.errorIcon');
			var count = 0;
			for(var i=0; i<list.length; i++) {
				if(list[i].type != 'file') {
					if(list[i].type == 'radio') { var len = list[i].id.length; list[i].id = list[i].id.substr(0,len-2); }
					if(list[i].type == 'editor') { editorNumber = list[i].number; }
					var valid = this.validateErrorTypes(list[i].id, list[i].type);
					if(valid) { count++; }
					valid ? this.iconValid(list[i].id, list[i].type) : this.iconInvalid(list[i].id, list[i].type, list[i].msg);
				} else {
					if(xxcom_form_validation_file == true) {
						try {
							$(list[i].id).setValid();
							valid = true;
							if(valid) { count++; }
						} catch(err) {}
					} else {
						try {
							$(list[i].id).setInvalid();	
						} catch(err) {}	
					}
				}
			}
			if(flag != 1) {
				if(count == list.length) { 
					xxcom_form_validation_switch = false; 
					// Try block code to disable custom form tag button before returning True
					try{ 
						$('btnDIV').update('');						
						$('btnDIV').style.cursor='default';
						$('btnDIV').style.backgroundPosition='-246px 0'; 
						$('btnDIV').setAttribute('onclick','');
						$('btnDIV').setAttribute('onMouseOver','');
						$('btnDIV').setAttribute('onMouseOut',''); 
						$('btnDIV').setAttribute('onMouseDown','');
						$('btnDIV').setAttribute('onMouseUp','');						
					} catch(err){}; 
					return true; 
				} else { 
					return false; 
				}
			} else {
				return false;	
			}
		},		
		iconValid: function(id,type) {
			var spacer = 5;
			var element = $(id);
			if(type == 'radio') { element = $(id+'YN'); }
			if(type == 'editor') { element = $(id).next(); }
			if(type == 'date') { element = $(id).next(); spacer = 23; }
			element.insert({after:'<div style="display:inline; vertical-align:top" class="errorIcon"><img src="' + validIcon.src + '" height="16" width="16" border="0" align="absmiddle" style="margin-left:' + spacer + 'px" /><div>'});
		},		
		iconInvalid : function(id,type,msg) {
			if(msg != undefined && msg != '') { errorMsg = msg; }
			var spacer = 5;
			var element = $(id);
			if(type == 'radio') { element = $(id+'YN'); }
			if(type == 'editor') { element = $(id).next(); }
			if(type == 'date') { element = $(id).next(); spacer = 23; }			
			element.insert({after:'<div style="display:inline; color:#ff0000; font-size:11px; vertical-align:top" class="errorIcon"><img src="' + invalidIcon.src + '" height="16" width="16" border="0" align="absmiddle" style="margin-left:' + spacer + 'px" />&nbsp;&nbsp;' + errorMsg + '</div>'});
			errorMsg = '';
		},		
		iconRemove : function(id,type) {
			try { 
				if(type == 'date' || type == 'editor') { $(id).next(1).remove(); } else { $(id).next().remove(); } 
				if(type == 'file') { $(id).clearIcon(); }
			} catch(e) { return; }
		},		
		iconRemoveAll : function(id) {
			try { el = $$(id); for(var i=0; i<el.length; i++) { el[i].remove(); } } catch(err) { return }	
		},		
		validateElement : function(id,type,msg) {
			if(msg != undefined) { errorMsg = msg; }
			this.iconRemove(id,type);
			if(type == 'radio') { var len = id.length; id = id.substr(0,len-2);}					
			var valid = this.validateErrorTypes(id,type);
			if(xxcom_form_validation_switch == true) { valid ? this.iconValid(id,type,errorMsg) : this.iconInvalid(id,type,errorMsg); }			
						
			// BEGIN :: SEAGRAVE PORTAL SLP FORM UPDATE FORM CODE //  REMOVE FOR NON_SEAGRAVE SITES
			// Special Update DB 
			try {
				if(__currentForm == 'activate') { if(typeof(id) == "object") { var field = id.id; } else { var field = id; }
					if(type == 'radio') { id = id + 'Y'; }
					var fVal=$F(id);
					if(fVal == null) { fVal=0 }
					if(type == 'currency' && (fVal == null || fVal == '')) { fVal=0 }
					new Ajax.Request('/CFCs/cfc_slp.cfc', { method:'get', parameters: {method:'updateActivationData', id:__currentActivationID, field:field, value:fVal} });
				}
			} catch(err) { return; }
			// END :: SEAGRAVE PORTAL SLP FORM UPDATE FORM CODE
						
			return valid;
		},		
		validateErrorTypes : function(id,type) {
			try { $('_errorMsg_').hide(); } catch(err) {}			
			var valid = false;	
			switch(type) {		
				case 'blank':
					if($F(id) != '') { valid = true; }
					break;
				case 'editor':					
					var myEditor = window.frames[editorNumber].document.body;
					if(myEditor.innerHTML != '' && myEditor.innerHTML != '&nbsp;') { valid = true; }
					break;
				case 'currency':
					if($F(id) != '' && Number($F(id)) > 0 && $F(id).length > 5) { valid = true; }
					break;	
				case 'date':			
					if($F(id).strip() != '') { valid = true; };
					break;
				case 'email':
					var filter = /^[\w-]+(\.[\w-]+)*@([\w-]+\.)+[a-zA-Z]{2,7}$/;
					if (filter.test($F(id))) { valid = true; }
					break;
				case 'url':
					var filter = /^(ht|f)tps?:\/\/[a-z0-9-\.]+\.[a-z]{2,4}\/?([^\s<>\#%"\,\{\}\\|\\\^\[\]`]+)?$/;
					if (filter.test($F(id))) { valid = true; }
					break;	
				case 'phone':			
					if($F(id).length == 12) { valid = true; };
					break;		
				case 'radio':			
					var radioY = $F(id+'Y');
					var radioN = $F(id+'N');
					if( radioY != null || radioN != null) { valid = true; } 
					break;
				case 'file':
					//if(xxcom_form_validation_file == true) { valid = true };
					if($(id).style.display != 'none') { valid = true; }					
					break;				
			}			
			return valid;
		}		
	};
})();	



/*==============================================================*/
/*==================== UPLOAD FILE FUNCTIONS ===================*/
/*==============================================================*/
var xxcom_preview_image = '';

// FUNCTION :: Default Upload Error Method
function uploadError(error) { alert("File Upload Error: " + error); }

// FUNCTION :: Add Files to Upload List
function addUploadFileToList(uploadID, fileName, size, required, fileDesc, newFileBelow) {
	if(required == undefined) { required = false; }
	if(fileDesc == undefined) { fileDesc = false; }
	if(newFileBelow == undefined) { newFileBelow = false; }
	xxcom_form_validation_file = true;	
	window[uploadID+'__fileListCount']++;  //eval(uploadID+'__fileListCount ++');
	var previewIcon = '';	
	var preview = window[uploadID+'__previewImage'];
	if(preview) { previewIcon = '&nbsp;|&nbsp;<img id="imgIcon_' + uploadID + '" src="/images/icons/image.png" onClick="xxcom_preview_image=\'' + uploadID + '\'; $(\'' + uploadID + '_swf\').previewImage(\'' + fileName + '\', \'' + eval(uploadID + '__previewImageURL') + '\')" style="cursor:pointer" align="absmiddle" border="0" width="16" height="16" title="Preview Image" alt="Preview Image" />'; }
	if(required) { if(xxcom_form_validation_switch) {$(uploadID+'_swf').setValid();} }	
	var fileInput = '<span style="float:right"><img src="/images/icons/comment.png" align="absmiddle" alt="Image Caption" title="Image Caption" /><input type="text" name="fileCaption" class="copy caption" maxlength="250" style="width:220px; border:none; background-color:#fafafa; padding-bottom:2px; margin-top:1px" value="<empty>" onFocus="if(this.value==\'<empty>\'){this.value=\'\'}" onBlur="if(this.value==\'\'){this.value=\'<empty>\'};this.setAttribute(\'value\',this.value)" />&nbsp;<img src="/images/icons/bullet_arrow_sort.png" align="absmiddle" alt="Image Display Sort Order" title="Image Display Sort Order" /><input type="text" name="fileOrder" class="copy" maxlength="2" style="width:14px; text-align:center; border:none; background-color:#fafafa; padding-bottom:2px; margin-top:1px; margin-right:1px" value="1" onKeyPress="return numeralsOnly(event)" onBlur="this.setAttribute(\'value\',this.value)" /></span>';
	if(!fileDesc) {fileInput='';}	
	var fileList = $(uploadID+'_files').innerHTML;	
	var newFile = '<div class="fileUploadListItem">' + fileInput + '<img src="/images/icons/delete.png" onClick="removeUploadFileFromList(\'' + uploadID + '\',\'' + fileName + '\',' + required + '); try{this.up().remove()} catch(e){}" style="cursor:pointer" align="absmiddle" border="0" width="16" height="16" title="Remove File From Upload List" alt="Remove File From Upload List" />' + previewIcon + '&nbsp;&nbsp;' + fileName + '&nbsp;&nbsp;<small>(' + (Math.ceil(size/1000)) + 'KB)</small>';
	newFile +=  '<input name="' + uploadID + '_file" id="' + uploadID + '_file" type="hidden" value="' + fileName + '" /></div>';
	if(newFileBelow) { $(uploadID+'_files').update(fileList+newFile); } else {$(uploadID+'_files').update(newFile+fileList); }
}

//  FUNCTION :: Remove Files from Upload Lists
function removeUploadFileFromList(uploadID, fileName, required) {	
	if(required == undefined) { required = false; }
	$(uploadID+'_swf').removeFile(fileName);
	eval(uploadID+'__fileListCount--');
	if(eval(uploadID+'__fileListCount') == 0) {
		$(uploadID+'_files').update();
		if(required) {
			xxcom_form_validation_file = false;
			if(xxcom_form_validation_switch) { $(uploadID+'_swf').setInvalid(); }
		}
	}
}

//  FUNCTION :: Use LightWindow.js to preview image
function imagePreview_Complete(file) {
	try { myLightWindow.activateWindow({ resizeSpeed:10, href: eval(xxcom_preview_image + '__previewImagePath') + file, title: file }); } catch(err) {};
}

//  FUNCTION :: Use LightWindow.js to preview image previously uploaded
function imagePreview_Uploaded(path,file) {
	try { myLightWindow.activateWindow({ resizeSpeed:10, href:path, title:file }); } catch(err) {};
}


/*==============================================================*/
/*===================  XXCOM :: 4/7/2008  ======================*/
/*==============================================================*/

function parseExtraVars(val) {
	var data = {};
	var step1 = val.split(",");
	for(var i=0; i<step1.length; i++) {
		var step2 = step1[i].split(":");
		data[step2[0]] = step2[1];
	}
	return data;
}



/*==============================================================*/
/*===================  XXCOM :: 2/15/2008  =====================*/
/*==============================================================*/

if (typeof(XXCOM_MASKS) === 'undefined') { XXCOM_MASKS = new Object(); }
XXCOM_MASKS.InputMask = {
	masks: {
		date_us: {		name: 'date_us', 		format: '  /  /    ', 	regex:  /\d/ },
		time: { 		name: 'time', 			format: '  :  :  ', 	regex:  /\d/ },
		phone: { 		name: 'phone', 			format: '   -   -    ', regex:  /\d/ },
		stateAbbrev: { 	name: 'stateAbbrev', 	format: '  ', 			regex:  /[a-zA-Z]/ }
	},

   // Finds every element with class input_mask and applies masks to them.
   setupElementMasks: function() {
      if ( document.getElementsByClassName ) { // Requires the Prototype library
         document.getElementsByClassName('input_mask').each(function(item) {
            Event.observe(item, 'keypress',
               XXCOM_MASKS.InputMask.applyMask.bindAsEventListener(item), true);
         });
      }
   },

   // This is triggered when the key is pressed in the form input.  It is
   // bound to the element, so 'this' is the input element.
   applyMask: function(event) {
      var match = /mask_(\w+)/.exec(this.className);
      if ( match.length == 2 && XXCOM_MASKS.InputMask.masks[match[1]] ) {
         var mask = XXCOM_MASKS.InputMask.masks[match[1]];
         var key  = XXCOM_MASKS.InputMask.getKey(event);

         if ( XXCOM_MASKS.InputMask.isPrintable(key) ) {
            var ch      = String.fromCharCode(key);
            var str     = this.value + ch;
            var pos     = str.length;
            if ( mask.regex.test(ch) && pos <= mask.format.length ) {
               if ( mask.format.charAt(pos - 1) != ' ' ) {
                  str = this.value + mask.format.charAt(pos - 1) + ch;
               }
               if( mask.name == 'stateAbbrev' ) { str = str.toUpperCase() }  // XXCOM ::  Added 3/21/2008
					this.value = str;
            }
            Event.stop(event);
         }
      }
   },
   // Returns true if the key is a printable character.
   isPrintable: function(key) { return ( key >= 32 && key < 127 ); },
   // Returns the key code associated with the event.
   getKey: function(e) { return window.event ? window.event.keyCode : e ? e.which : 0; }
};
Event.observe(window, 'load', function() { XXCOM_MASKS.InputMask.setupElementMasks(); } );



/*==============================================================*/
/*==============================================================*/
function numeralsOnly(evt) {
	evt = (evt) ? evt : event;
	var charCode = (evt.charCode) ? evt.charCode : ((evt.keyCode) ? evt.keyCode : ((evt.which) ? evt.which : 0));
	if (charCode > 31 && (charCode < 48 || charCode > 57)) { return false; }
	return true;
};

function currencyOnly(evt) {
	evt = (evt) ? evt : event;
	var charCode = (evt.charCode) ? evt.charCode : ((evt.keyCode) ? evt.keyCode : ((evt.which) ? evt.which : 0));
	if (charCode > 31 && (charCode < 48 || charCode > 57)) {
		if(charCode != 44)
			return false;
	}
	return true;
};

function lettersOnly(evt) {
    evt = (evt) ? evt : event;
    var charCode = (evt.charCode) ? evt.charCode : ((evt.keyCode) ? evt.keyCode : ((evt.which) ? evt.which : 0));
    if (charCode > 31 && (charCode < 65 || charCode > 90) && 
        (charCode < 97 || charCode > 122)) {
        return false;
    }
    return true;
};

function daysBetween(date1, date2) {
    var DSTAdjust = 0;
    // constants used for our calculations below
    oneMinute = 1000 * 60;
    var oneDay = oneMinute * 60 * 24;
    // equalize times in case date objects have them
    date1.setHours(0);
    date1.setMinutes(0);
    date1.setSeconds(0);
    date2.setHours(0);
    date2.setMinutes(0);
    date2.setSeconds(0);
    // take care of spans across Daylight Saving Time changes
    if (date2 > date1) {
        DSTAdjust = (date2.getTimezoneOffset() - date1.getTimezoneOffset()) * oneMinute;
    } else {
        DSTAdjust =  (date1.getTimezoneOffset() - date2.getTimezoneOffset()) * oneMinute;    
    }
    var diff = Math.abs(date2.getTime() - date1.getTime()) - DSTAdjust;
    return Math.ceil(diff/oneDay);
};

function dumpProps(obj, parent) {
   // Go through all the properties of the passed-in object
   for (var i in obj) {
      // if a parent (2nd parameter) was passed in, then use that to
      // build the message. Message includes i (the object's property name)
      // then the object's property value on a new line
      if (parent) { var msg = parent + "." + i + "\n" + obj[i]; } else { var msg = i + "\n" + obj[i]; }
      // Display the message. If the user clicks "OK", then continue. If they
      // click "CANCEL" then quit this level of recursion
      if (!confirm(msg)) { return; }
      // If this property (i) is an object, then recursively process the object
      if (typeof obj[i] == "object") {
         if (parent) { dumpProps(obj[i], parent + "." + i); } else { dumpProps(obj[i], i); }
      }
   }
}


/*==============================================================*/
/*==============================================================*/

/*
We can easily select different formatting by changing the values 
in the second through eighth parameters. The second parameter is 
the number of decimal places that the number should have. If the 
number contains more decimal places than required it will be rounded 
to the nearest number with that number of decimal places. If it has 
fewer decimal places than specified zeroes will be added to the end.

The third parameter is the thousands separator. In our example we 
used a space but a comma or period may be what is required for your location.

The fourth parameter is the decimal point. Either a period or comma is normal here.

The fifth and sixth parameters are used for monetary values and one
or other of them will contain the currency symbol when required. 
If your location uses a currency symbol hard against the left of numbers
then place that symbol by itself in the fifth parameter eg. '$'. 
If you normally have a space after the currency symbol then add it after the 
symbol in this '$ '. If your currency symbol comes after the amount instead 
of before then place it in the sixth parameter instead of the fifth parameter.

The seventh and eighth parameters define the symbols to place around the 
number when the value is negative. The usual values for these parameters 
would be '-','' but you may have a situation where you want to 
use '(',')' or even '',' CR'. 
*/
function formatNumber(num,dec,thou,pnt,curr1,curr2,n1,n2) {
	var x = Math.round(num * Math.pow(10,dec));
	if (x >= 0) n1=n2='';
	var y = (''+Math.abs(x)).split('');
	var z = y.length - dec; 
	if (z<0) z--; 
	for(var i = z; i < 0; i++) y.unshift('0');
	y.splice(z, 0, pnt); 
	if(y[0] == pnt) y.unshift('0'); 
	while (z > 3) {z-=3; y.splice(z,0,thou);}
	var r = curr1+n1+y.join('')+n2+curr2;
	return r;
}



/*==============================================================*/
/*======================= AJAX TOOL-TIP ========================*/
/*==============================================================*/

/* Custom variables */

/* Offset position of tooltip */
var x_offset_tooltip = -3;
var y_offset_tooltip = 5;

/* Don't change anything below here */
var ml_tooltip_width = 300;
var flickerflag = true;
var ajax_tooltipObj = false;
var ajax_tooltipObj_iframe = false;
var _SelectElements = [];

var ajax_tooltip_MSIE = false;
if(navigator.userAgent.indexOf('MSIE')>=0) ajax_tooltip_MSIE=true;

function ajax_showTooltip(externalFile,inputObj)
{
	// XXCOM :: xx :: Added June 7, 2007
	// Hides <select> boxes in IE6.
	if(isIE6) {
		if($('filterDiv')) {
			var selectEl = $$("#filterDiv select");
			for(i=0; i<selectEl.length; i++) {
				var e = selectEl[i];
				e.insert({after:"<div id='_select_" + i + "' style='height:13px'>&nbsp;</div>"});
				e.hide();
			}
		}
	}

	if(!ajax_tooltipObj) {	/* Tooltip div not created yet ? */	
		ajax_tooltipObj = document.createElement('DIV');
		ajax_tooltipObj.style.position = 'absolute';
		ajax_tooltipObj.id = 'ajax_tooltipObj';		
		document.body.appendChild(ajax_tooltipObj);
		
		var leftDiv = document.createElement('DIV');	/* Create arrow div */
		leftDiv.className='ajax_tooltip_arrow';
		leftDiv.id = 'ajax_tooltip_arrow';
		ajax_tooltipObj.appendChild(leftDiv);
		
		var contentDiv = document.createElement('DIV'); /* Create tooltip content div */
		contentDiv.className = 'ajax_tooltip_content';
		ajax_tooltipObj.appendChild(contentDiv);
		contentDiv.id = 'ajax_tooltip_content';
		
		if(ajax_tooltip_MSIE){	/* Create iframe object for MSIE in order to make the tooltip cover select boxes */
			ajax_tooltipObj_iframe = document.createElement('<IFRAME frameborder="0">');
			ajax_tooltipObj_iframe.style.position = 'absolute';
			ajax_tooltipObj_iframe.border='0';
			ajax_tooltipObj_iframe.frameborder=0;
			ajax_tooltipObj_iframe.style.backgroundColor='#FFF';
			ajax_tooltipObj_iframe.src = 'about:blank';
			contentDiv.appendChild(ajax_tooltipObj_iframe);
			ajax_tooltipObj_iframe.style.left = '-3px';
			ajax_tooltipObj_iframe.style.top = '3px';
		}			
	}
	// Find position of tooltip
	ajax_tooltipObj.style.display='block';
	ajax_loadContent('ajax_tooltip_content',externalFile);
	if(ajax_tooltip_MSIE){
		ajax_tooltipObj_iframe.style.width = ajax_tooltipObj.clientWidth + 'px';
		ajax_tooltipObj_iframe.style.height = ajax_tooltipObj.clientHeight + 'px';
	}
	ajax_positionTooltip(inputObj);
}

function ajax_positionTooltip(inputObj)
{
	var leftPos = (ajaxTooltip_getLeftPos(inputObj) + inputObj.offsetWidth);
	var topPos = ajaxTooltip_getTopPos(inputObj);	
	var rightedge=ajax_tooltip_MSIE? document.body.clientWidth-leftPos : window.innerWidth-leftPos   //
	var bottomedge=ajax_tooltip_MSIE? document.body.clientHeight-topPos : window.innerHeight-topPos  //	
	var tooltipWidth = document.getElementById('ajax_tooltip_content').offsetWidth; 
	var offset =  ml_tooltip_width - rightedge;  // tooltipWidth	
	if(offset>0)leftPos = Math.max(0,leftPos - ml_tooltip_width -25);  //  -offset -5	
	ajax_tooltipObj.style.left = (leftPos -3) + 'px';
	ajax_tooltipObj.style.top = (topPos + 13)  + 'px';
}


function ajax_hideTooltip(off) {
	// XXCOM :: Added June 7, 2007
	// Hides <select> boxes in IE6.
	if(isIE6) {
		if($('filterDiv')) {
			var selectEl = $$("#filterDiv select");
			for(i=0; i<selectEl.length; i++) {			
				selectEl[i].show();
				$('_select_'+i).remove();
			}
		}
	}	
	// XXCOM :: Added May 10, 2007
	// Removes Flicker bug when Tool-Tip is viewed in Firefox
	if(off) {flickerflag=false;}
	if(!flickerflag) {
		ajax_tooltipObj.style.display='none';
		flickerflag = true;
	}
}

function ajaxTooltip_getTopPos(inputObj) {		
  var returnValue = inputObj.offsetTop;
  while((inputObj = inputObj.offsetParent) != null) {
  	if(inputObj.tagName!='HTML')returnValue += inputObj.offsetTop;
  }
  return returnValue;
}

function ajaxTooltip_getLeftPos(inputObj) {
  var returnValue = inputObj.offsetLeft;
  while((inputObj = inputObj.offsetParent) != null) {
  	if(inputObj.tagName!='HTML')returnValue += inputObj.offsetLeft;
  }
  return returnValue;
}




