<!--

//declarations
var strInvalidTextChars = '';
var urlShare = '';

//**********************************************
//Following functions used for table row highlighting

// alternate each row color
function alternate(id){ 
	if (document.getElementsByTagName) {  
   		var table = document.getElementById(id);   
   		var rows = table.getElementsByTagName("tr");   
   		for (i = 0; i < rows.length; i++) {
   			//manipulate rows 
    		if (rows[i].className.substring(0,16) == "tablelistheading") {
			} else if (rows[i].className != "blank") {
				if (i % 2 == 0) { 
		   			rows[i].className = "even"; 
	     		} else { 
	       			rows[i].className = "odd"; 
	     		}       
			}
		}
   	} 

	//manipulate cells 
	var cells = table.getElementsByTagName("td");   
	for (i = 0; i < cells.length; i++) {
		//manipulate cells
		if (cells[i].className.substring(0,16) == "tablelistheading") { 
   			cells[i].className = cells[i].className + " head"; 
		} else if (cells[i].className == "blank") {
			cells[i].id = "blank";
		} else {
	   		if (cells[i].innerHTML == "") cells[i].innerHTML = "&nbsp;";
			cells[i].id = "cell";
		} 
	} 

   	//set the rollover setting
   	rollover(id,'over');
}

// highlight row on over
var arrayOfRolloverClasses = new Array();
var activeRow = false;
var activeCell = false;

function highlightTableRow()
{
	var tableObj = this.parentNode;
	if(tableObj.tagName!='TABLE')tableObj = tableObj.parentNode;

	if(this!=activeRow){
		this.setAttribute('origCl',this.className);
		this.origCl = this.className;
	}
	this.className = arrayOfRolloverClasses[tableObj.id];
	
	activeRow = this;
}

function resetRowStyle()
{
	var origCl = this.getAttribute('origCl');
	if(!origCl)origCl = this.origCl;
	this.className=origCl;
}
	
function rollover(tableId,whichClass)
{
	arrayOfRolloverClasses[tableId] = whichClass;
	
	var tableObj = document.getElementById(tableId);
	var tBody = tableObj.getElementsByTagName('TBODY');
	if(tBody){
		var rows = tBody[0].getElementsByTagName('TR');
	}else{
		var rows = tableObj.getElementsByTagName('TR');
	}
	for(var no=0;no<rows.length;no++){
		if (rows[no].className == "blank" || rows[no].className == "tablelistheading") {
		} else {
			rows[no].onmouseover = highlightTableRow;
			rows[no].onmouseout = resetRowStyle;
		}
	}
}

//**********************************************
//Following functions used for window manipulation

function resizeOuterTo(w,h) {
 if (parseInt(navigator.appVersion)>3) {
   if (navigator.appName=="Netscape") {
    top.outerWidth=w;
    top.outerHeight=h;
   }
   else top.resizeTo(w,h);
 }
}

//**********************************************
//Following functions used for dynamic help
 
var topOffsetAmount = 0;  // These are where the help items will appear relative to the field.
var leftOffsetAmount = 0;
var defaultMessage = "Move your mouse over a field to view a help tip...";

function SetDefault(thisObjectName,defaultText,thisClass) {
 	DisplayContents(thisObjectName,defaultText,thisClass);
}
 
function SetVisibility(thisObjectName, showIt) {  
    var thisObject = document.getElementById(thisObjectName);
    
    if (thisObject) {
		if (showIt)
	    	thisObject.style.visibility = "visible";
	    else
	    	thisObject.style.visibility = "hidden";
	}
}
 
function DisplayContents(thisObjectName,thisText,thisClass) {
    var thisObject = document.getElementById(thisObjectName);
    WriteContents(thisObjectName,thisText,thisClass);
    SetVisibility(thisObjectName, true);
}
 
function WriteContents(thisObjectName,thisText,thisClass) {
    var contents = "<TABLE align='top' border='0' cellpadding='0' cellspacing='0'><tr><td width='4'></td><td class='"+thisClass+"'> "+thisText+" </td><td width='4'></td></tr></TABLE>";
	var thisObject = document.getElementById(thisObjectName)    
 	if (thisObject) thisObject.innerHTML=contents;
}

function pSetDefault(thisObjectName,defaultText,thisClass) {
 	pDisplayContents(thisObjectName,defaultText,thisClass);
}
 
function pSetVisibility(thisObjectName, showIt) {  
    var thisObject = parent.document.getElementById(thisObjectName);
    if (thisObject) {
	    if (showIt)
	    	thisObject.style.visibility = "visible";
	    else
	    	thisObject.style.visibility = "hidden";
	}
}
 
function pDisplayContents(thisObjectName,thisText,thisClass) {
    var thisObject = parent.document.getElementById(thisObjectName);
    pWriteContents(thisObjectName,thisText,thisClass);
    pSetVisibility(thisObjectName, true);
}
 
function pWriteContents(thisObjectName,thisText,thisClass) {
	var contents = "<TABLE align='top' border='0' cellpadding='0' cellspacing='0'><tr><td width='4'></td><td class='"+thisClass+"'>"+thisText+"</td><td width='4'></td></tr></TABLE>";
    var thisObject = parent.document.getElementById(thisObjectName)    
 	if (thisObject) thisObject.innerHTML=contents;
}

//******************************************* 
//Other General Functions

//check for invalid characters in a string
function isNotValidChar(string,notallowed) {
  	for (var i=0; i< string.length; i++) {
    	if (notallowed.indexOf(string.charAt(i)) != -1)
        	return true;
    }
	return false;
}
function printWindow(url) {
	var mywindow = window.open(url, "print", 'width=800,height=700,left=50,top=50,status=1,scrollbars=1,toolbar=1,menubar=1,location=1,resizable')		
  	fn_WindowFocus(mywindow);
}
//get absolute x,y positions of object on the screen 
function getObjectX(obj){
	return obj.offsetLeft + (obj.offsetParent ? getObjectX(obj.offsetParent) : obj.x ? obj.x : 0);
}
function getObjectY(obj){
	return (obj.offsetParent ? obj.offsetTop + getObjectY(obj.offsetParent) : obj.y ? obj.y : 0);
}
function getWindowX(){
	if (navigator.appName.indexOf("Netscape")!=-1 && parseInt(navigator.appVersion)>=5) {
	     return window.screenX;
	} else if (navigator.appName.indexOf("Microsoft")!= -1 && parseInt(navigator.appVersion)>=4) {
	     return window.screenLeft;
	} else {
		return 0;
	}
}
function getWindowY(){
	if (navigator.appName.indexOf("Netscape")!=-1 && parseInt(navigator.appVersion)>=5) {
	     return window.screenY;
	} else if (navigator.appName.indexOf("Microsoft")!= -1 && parseInt(navigator.appVersion)>=4) {
	     return window.screenTop;
	} else {
		return 0;
	}
}
// Browser Window Size and Position, copyright Stephen Chapman, 3rd Jan 2005, 8th Dec 2005
function getWindowWidth(){
	return window.innerWidth != null? window.innerWidth : document.documentElement && document.documentElement.clientWidth ? document.documentElement.clientWidth : document.body != null ? document.body.clientWidth : null;
}
function getWindowHeight(){
	return  window.innerHeight != null? window.innerHeight : document.documentElement && document.documentElement.clientHeight ?  document.documentElement.clientHeight : document.body != null? document.body.clientHeight : null;
}

//******************************************* 
//loop through all check boxes - if name matches the one selected then set the checked value to that chosen
function fn_selectboxes(thisBox) {
	for (var i = 0; i < document.form.elements.length; i++) {
	    var e = document.form.elements[i];
		if ((e.name != thisBox.name) && (e.name.indexOf(thisBox.name) == 0) && (e.type == 'checkbox')) {
			e.checked = thisBox.checked;
	    }
	}
}

//loop through all check boxes - if name matches the one selected then set the checked value to that chosen
function fn_checkselection(boxPrefix,showAlert) {
	for (var i = 0; i < document.form.elements.length; i++) {
	    var e = document.form.elements[i];
		if ((e.name != boxPrefix) && (e.name.indexOf(boxPrefix) == 0) && (e.type == 'checkbox')) {
			if (e.checked == true) {
				return true;
			}
	    }
	}
	if (showAlert) {
		alert ('You need to make your selections that this action applies to BEFORE taking this action.');
	}
	return false;
}

//open the time picker
function fn_TimePicker(strForm, eControl, bAllowIfReadOnly) {
	var bOpenWindow = true;

	if (!bAllowIfReadOnly) {
		if (eControl.readOnly == "Yes" || eControl.disabled) {
			bOpenWindow = false;
			alert ('Time selection not currently allowed.\n\nIf this event is flagged as an All Day Event, uncheck that option first.');
		}
	}
	//open the time picker window
	if (bOpenWindow) {
		var mywindow = window.open('timepicker.cfm?eForm='+strForm+'&eControl='+eControl.name+'&defaulttime='+eControl.value+'&popiFrame=', "timepicker", 'width=225,height=100,left=200,top=200,status=no,scrollbars=no,resizable')
	  	fn_WindowFocus(mywindow);
	}
}

//hide/display a section on a web page
function WebPageDisplaySection(section) {

	//use the parent prefix as safari executes as though in an iframe; ff and ie okay with or without parent prefix.
	var eWebPage = parent.document.getElementById("webPage");
	var heightAdjust = 0;

	if (eWebPage.contentWindow.document.getElementById(section)) {
		var objSection = eWebPage.contentWindow.document.getElementById(section);
		
		//toggle display of the section
		if (objSection.className == "hiddenSection") {
			objSection.className = "";
			heightAdjust = (objSection.offsetHeight + 20);
		} else { 
			heightAdjust = (objSection.offsetHeight + 20) * -1;
			objSection.className = "hiddenSection";
		}
		
		//resize the webpage iframe so page still fits snugly
		if (heightAdjust != 0) {
			eWebPage.height = eWebPage.offsetHeight + heightAdjust;
		}
	}
}

//hiding/displaying sections on a page
function fn_ShowSection(section,show) {
	if (document.getElementById(section)) {
		var objSection = document.getElementById(section);
		if (show) {
			objSection.className = "";
		} else {
			objSection.className = "hiddenSection";
		}
	}
}

function fn_ToggleSection (strSectionName,strSectionType,strCaptionShow,strCaptionHide) {
	var strATag = 'a_' + strSectionName;
	
	//get elements
	var eATag = document.getElementById(strATag);
	var eSection = document.getElementById(strSectionType + '_' + strSectionName);
	var eHiddenClass = document.getElementById('class_' + strSectionType + '_' + strSectionName);
	
	//display/hide section
	if (eSection.className == "hiddenSection") {
		eSection.className = "";
		eATag.innerHTML = "[ " + strCaptionHide + " ]";
	} else {
		eSection.className = "hiddenSection";
		eATag.innerHTML = "[ " + strCaptionShow + " ]";
	}
	if (eHiddenClass) eHiddenClass.value = eSection.className;
}

//show or hide an element
// example of initial html on page ... <div id="123" style="display:none">
function ShowHideElement(elementID) {
	var prop
	if (document.getElementById) 
		prop = document.getElementById(elementID).style
	else if (document.all)
		prop = document.all[elementID].style
	else if (document.layers)
		prop = document.layers[elementID]
	
	if (prop.display=='none')
		prop.display = ''
	else
		prop.display = 'none'
}

function fn_CheckFileType(fileName, fileControl, fileTitle, required, showAlert, fileExtArray, fileExtList) {
	//validate the extension of the file is valid  extensionList
    fileTypeValid = false;
	if (fileName == '') {
		if (required) {
			fileTypeValid = false;
			fileControl.focus();
			if (showAlert) { 
				alert (fileTitle + ' is required'); 
			}
		} else {
			fileTypeValid = true;
		}
	} else {
		while (fileName.indexOf("\\") != -1)
			fileName = fileName.slice(fileName.indexOf("\\") + 1);
			ext = fileName.slice(fileName.indexOf(".")).toLowerCase();
		    for (var i = 0; i < extArray.length; i++) {
				if (fileExtArray[i] == ext) { fileTypeValid = true; break; }
	   		}
			if (!fileTypeValid) {
				fileControl.focus();
				if (showAlert) { 
					alert (fileTitle + ' file type is invalid.\n\nThe following file types are allowed:\n\n' + fileExtList);
				}
			}
	}
	return fileTypeValid;
}

//form checking
function limitText(limitField, limitNum) {
	if (limitField.value.length > limitNum) {
		limitField.value = limitField.value.substring(0, limitNum);
	}
}

//take action loop
function fn_TakeActionLoop () {
	if (confirm('The Take Action Loop is designed for quick actions for multiple items at a time.\n\nWould you like to read more on how to use the Take Action Loop?')) {
		var mywindow = window.open('help.cfm?section=actions#actions', "help", 'width=800,height=700,left=50,top=50,status=1,scrollbars=1,toolbar=1,menubar=1,location=1,resizable=1');
	  	fn_WindowFocus(mywindow);
	}
}

//******************************************* 
//popup windows

//open choose picture window
function fn_ChoosePicture(server,strControl,strFunction) {
	var mywindow = window.open(server+'/choosepicture.cfm?eControl='+strControl+'&eFunction='+strFunction, "ChoosePicture", 'width=700,height=600,left=25,top=25,status,scrollbars,resizable');
  	fn_WindowFocus(mywindow);
}

//open the client builder
function fn_ClientBuilder(strForm, strControl) {
	var mywindow = window.open('clientbuilder.cfm?eForm='+strForm+'&eControl='+strControl+'&popiFrame=', "clientbuilder", 'width=550,height=675,left=100,top=20,toolbar=no,status=no,scrollbars=no,resizable=no,location=no')
  	fn_WindowFocus(mywindow);
}

//open clipboard
function fn_ClipboardOpen(urlkey) {
	var mywindow = window.open('clipboard.cfm?urlkey='+urlkey, "Clipboard", 'width=700,height=300,left=25,top=25,status,scrollbars,resizable');
  	fn_WindowFocus(mywindow);
}

//open the connect window
function fn_Connect(params) {
	var url = fn_EncryptURLParamsJS('connect.cfm', params);
	var mywindow = window.open(url, "connect", 'width=230,height=500,left=100,top=100,toolbar=no,status=no,scrollbars=1,resizable=no,location=no')
  	fn_WindowFocus(mywindow);
}

//open the email builder
function fn_EmailBuilder(strForm, strControl) {
	var mywindow = window.open('emailbuilder.cfm?eForm='+strForm+'&eControl='+strControl+'&popiFrame=', "emailbuilder", 'width=550,height=375,left=100,top=100,toolbar=no,status=no,scrollbars=no,resizable=no,location=no')
  	fn_WindowFocus(mywindow);
}

//edit the gis plot
function fn_GISEditID(id) {
	return fn_GISEdit(id,'',0,0,0);
}

//edit the gis plot
function fn_GISEdit(id,src,srcid,lat,lng) {
	var mywindow = window.open('gisedit.cfm?id='+id+'&src='+escape(src)+'&srcid='+srcid+'&lat='+lat+'&lng='+lng, 'GetLocation', 'width=930,height=550,left=50,top=50,status,scrollbars,resizable');
  	fn_WindowFocus(mywindow);
	return mywindow;
}

//view the gis plot
function fn_GISView(srcid,src,srclat,srclng,destid,dest,destlat,destlng,printpage,thirdparty) {
	var left = 50;
	var top = 50;
	var target = "PlotInfo";
	
	//set the page location
	if (printpage == "Y") {
		left = 100;
		top = 100;
		target = "_blank";
	}
	
	//build the url string
	var url = 'gisview.cfm';
	url += '?srcid='+srcid;
	url += '&src='+escape(src);
	url += '&srclat='+escape(srclat);
	url += '&srclng='+escape(srclng);
	url += '&destid='+destid;
	url += '&dest='+escape(dest);
	url += '&destlat='+escape(destlat);
	url += '&destlng='+escape(destlng);
	url += '&printpage='+printpage;
	url += '&thirdparty='+thirdparty;
	
	//open the window
	var mywindow = window.open(url, target, 'width=265,height=350,left='+left+',top='+top+',status,scrollbars,resizable');
  	fn_WindowFocus(mywindow);
	return mywindow;
}

//view the gis plot
function fn_GISViewID(id) {
	return fn_GISView(0,'',0,0,id,'',0,0,'N','N');
}

//open the group builder
function fn_GroupBuilder(strForm, strControl) {
	var mywindow = window.open('groupbuilder.cfm?eForm='+strForm+'&eControl='+strControl+'&popiFrame=', "groupbuilder", 'width=550,height=675,left=100,top=20,toolbar=no,status=no,scrollbars=no,resizable=no,location=no')
  	fn_WindowFocus(mywindow);
}

//open htmllink insert window
function fn_HTMLLinkOpen(content) {
	var mywindow = window.open('htmllinkedit.cfm?content='+content, "HTMLLinkInsert", 'width=700,height=520,left=25,top=25,status,scrollbars,resizable');
  	fn_WindowFocus(mywindow);
}

//post to message board
function fn_MessageBoard(params) {
	var url = fn_EncryptURLParamsJS('messageboardpost.cfm', params);
	var mywindow = window.open(url, "MessageBoard", 'width=350,height=340,left=100,top=100,status,scrollbars,resizable');
  	fn_WindowFocus(mywindow);
}

//manage news feeds
function fn_NewsFeed(params) {
	var url = fn_EncryptURLParamsJS('playerexternalfeed.cfm', params);
	var mywindow = window.open(url, "NewsFeed", 'width=450,height=450,left=100,top=50,status,scrollbars,resizable');
  	fn_WindowFocus(mywindow);
}

//apply media template
function fn_MediaTemplate(params) {
	var url = fn_EncryptURLParamsJS('playermediatemplate.cfm', params);
	var mywindow = window.open(url, "MediaTemplate", 'width=600,height=625,left=50,top=50,status,scrollbars,resizable');
  	fn_WindowFocus(mywindow);
}

//popup wizard
function fn_PopupWizard(root,client,wizard,startpage,params,width,height,left,top) {
	var url = root + '/_custom/wizards/' + client + '/' + wizard + '/' + startpage;
	if (params != '') { 
		url = fn_EncryptURLParamsJS(url, params);
	}
	var mywindow = window.open(url, wizard, 'width='+width+',height='+height+',left='+left+',top='+top+',status,scrollbars,resizable');
  	fn_WindowFocus(mywindow);
}

//print the item - just the required content
function fn_PrintContent(page,urlParams,fontSize) {
	url = fn_EncryptURLParamsJS(page, urlParams) + '&printPage=Y&printContent=Y';
	if (fontSize != '') {
		url = url + '&fontSize=' + fontSize;
	}
	var mywindow = window.open(url, "print", 'width=720,height=700,left=50,top=50,status=1,scrollbars=1,toolbar=1,menubar=1,location=1,resizable')
  	fn_WindowFocus(mywindow);
}

//open report menu
function fn_ReportMenu(params) {
	var url = fn_EncryptURLParamsJS('_reporting/reportmenu/index.cfm', params);
	var mywindow = window.open(url, "ReportMenu", 'width=450,height=550,left=100,top=100,status,scrollbars,resizable');
  	fn_WindowFocus(mywindow);
}

//open report
function fn_ReportOpen(urlkey) {
	var mywindow = window.open('_reporting/report/index.cfm?urlkey='+urlkey, "Report", 'width=850,height=650,left=50,top=50,status,scrollbars,resizable');
  	fn_WindowFocus(mywindow);
}

//open the report
function fn_ShowReport(reportURL) {
	var mywindow = window.open(reportURL, "report", 'width=800,height=700,left=50,top=50,status=1,scrollbars=1,toolbar=1,menubar=1,location=1,resizable=1')
  	fn_WindowFocus(mywindow);
}

//share the item
function fn_share() {
	var mywindow = window.open(urlShare, "share", 'width=630,height=560,left=100,top=100,status,scrollbars,resizable')		
  	fn_WindowFocus(mywindow);
}

//open the zoom window
function fn_Zoom(strZoomURL, strForm, strControl, defaultMsg) {
	var mywindow = window.open(strZoomURL + '?eForm='+strForm+'&eControl='+strControl+'&defaultMsg='+defaultMsg+'&popiFrame=', "zoom", 'width=550,height=375,left=100,top=100,toolbar=no,status=no,scrollbars=no,resizable=no,location=no')
  	fn_WindowFocus(mywindow);
}

//window set focus
function fn_WindowFocus (mywindow) {
  	if (mywindow) {
		if (mywindow.opener == null)
		 	{ mywindow.opener = window; }
		if ( parseInt(navigator.userAgent.substring(8,9)) >=3 ) 
			{ mywindow.focus() }
	}
}

//******************************************* 
//trim functions
function trim(stringToTrim) {
	return stringToTrim.replace(/^\s+|\s+$/g,"");
}
function ltrim(stringToTrim) {
	return stringToTrim.replace(/^\s+/,"");
}
function rtrim(stringToTrim) {
	return stringToTrim.replace(/\s+$/,"");
}

function fn_SubMenuChange(sel) {
	//go to the selected link
	var val = sel.options[sel.selectedIndex].value;
	if (val != "") {
		if (val.substring(0,11) == 'Javascript:') {
			if (val.substring(11,27) == 'fn_MessageBoard:') {
				fn_MessageBoard(decodeURIComponent(val.substring(27,9999)));
			}
		} else {
			window.location.href = sel.options[sel.selectedIndex].value;
		}
		sel.selectedIndex = 0;
	}
}

function fn_setting(urlParams) {
	var params = 'urlkey=' + encodeURIComponent(urlParams);
	var result = rpc_Call('','Session',params,'');
}

//******************************************* 
//get object properties
var MAX_DUMP_DEPTH = 3;
function dumpObj(obj, name, indent, depth) {
	if (depth > MAX_DUMP_DEPTH) {
		return indent + name + ": <Maximum Depth Reached>\n";
	}
	if (typeof obj == "object") {
		var child = null;
		var output = indent + name + "\n";
    	indent += "\t";
		for (var item in obj)
		{
			try {
				child = obj[item];
	        } catch (e) {
		 		child = "<Unable to Evaluate>";
			}
	        if (typeof child == "object") {
		 		output += dumpObj(child, item, indent, depth + 1);
			} else {
		 		if (item != 'outerHTML' && item != 'outerText' && item != 'innerText' && item != 'innerHTML' && item != 'cookie') {
					output += indent + item + ": " + child + "\n";
				}
			}
		}
		return output;
	} else {
    	return obj;
    }
}

//check for element in an array
function arrayGetPosition(arr,ele) {
	for (var i = 0; i < arr.length; i++) {
		if (arr[i] == ele) {
			return i;
		}
	}
	return -1; //item not found in the array
}

//******************************************* 
//display of web pages - use parent.document. so code works when called from within a iframe web page
function fn_WebPage(encryptedURL) {
	fn_ChangeSection('vwebpage','sView');
	fn_IconSectionMenuHighlight('vmenu','vwebpage');
	parent.document.getElementById('webPage').src = fn_EncryptURLParamsJS('webpageview.cfm', encryptedURL);
}

function fn_WebPageMenuDropdownListChange(e) {
	if (e.selectedIndex) {
		fn_WebPage(decodeURIComponent(e.value));
		e.selectedIndex = 0;
	}
}

//******************************************* 
//iframe prepare
function fn_iFrameLoad(iframeid,heightBuffer,target){

	//for IE, need to set the iframe background color to match the parent
	/*
	var isIE = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;
	if (isIE) {
		var webPage = parent.getElementsByClassName('sectionDisplay');
		for (i=0; i<webPage.length; i++) {
			bgColor = webPage[0].currentStyle.backgroundColor;
			document['body'].style.backgroundColor = bgColor;
			break;
		}
	}
	*/
	
	//set the height of the parent page so the web page fits 'perfectly' and doesn't need to scroll
	var theHeight = document['body'].offsetHeight;
	if (theHeight != 0) {
		parent.document.getElementById(iframeid).height = theHeight + heightBuffer;
	}
	
	//set target for links added to the page so they don't open in the iframe
	if (document.getElementsByTagName) {
		var anchors = document.getElementsByTagName("a");
		for (var i=0; i<anchors.length; i++) {
			var anchor = anchors[i];
			if (anchor.getAttribute("href")) {
				if (anchor.target == '' || anchor.target == '_self') {
					anchor.target = target;
				}
			}
		} 
	}
}

//******************************************* 
//copy/paste

function pasteFromClipBoard(theField) {
	var val = document.getElementById(theField);
	val.focus();
	val.select();
	therange=val.createTextRange();
	therange.execCommand("Paste");
}

//******************************************* 
//search

function fn_checktag(frm,post) {
	if (trim(frm.tag.value) == "") {
		alert('Please enter the word[s] to search for');
		frm.tag.focus();
		return false;
	} else if (isNotValidChar(frm.tag.value,strInvalidTextChars)) {
		alert ('The word[s] to search for cannot contain the following characters: ' + strInvalidTextChars);
		frm.tag.focus();
		return false;
	} else {
		if (post) {
			frm.submit();
		} else {
			return true;
		}
	}
}


//*********************************************
//highlight the save button

//display the tooltip
function tooltipShow (id, text, delay) {
  	//get elements
	var eleHighlight = document.getElementById(id);
  	var eleToolTip = document.getElementById('toolTip');
  	var l = getObjectX(eleHighlight);
	if (eleHighlight.offsetWidth) {
		l = l + eleHighlight.offsetWidth + 5;
	}
  	var t = getObjectY(eleHighlight) - 8;
	//display the tooltip
	eleToolTip.innerHTML = text;
	eleToolTip.style.left = l + "px";
	eleToolTip.style.top = t + "px";
	eleToolTip.style.display = "block";
	//hide after set delay time (delay=seconds)
	setTimeout ( "tooltipHide()", (delay * 1000) );
}

//hide the tooptip
function tooltipHide () {
  	var eleToolTip = document.getElementById('toolTip');
	eleToolTip.innerHTML = "";
	eleToolTip.style.display = "none";
}

//display the tagtip
function tagtipShow (ele, evt, text) {
  	//get elements
  	var eleTagTip = document.getElementById('tagTip');
  	var pw = getWindowWidth();
	var ew = 0;
	var eh = 0;
	var textWidth = '';
	
	//get position of the element
	var l = getObjectX(ele);
	var t = getObjectY(ele);
	if (ele.offsetWidth) {
		ew = ele.offsetWidth;
	}
	if (ele.offsetHeight) {
		eh = ele.offsetHeight;
	}

	//left position
	if ((l+ew) > (pw*(3/4))) {
		//if we are in the right quarter of the page, then display the tip on the left of the element
		if (l >= 260) {
			//only display if we have enough space to do so
			tagClassName = "tagTipLeft";
			l = l - 260;
			t = t + 18;
			if (text.length < 50) {
				//scale the width of the box down to fit the amount of text
				textWidth = Math.round(((text.length / 45) * 250)) + 'px';
			}
		} else {
			//place it underneath the element
			tagClassName = "tagTipRight";
			l = l + 20;
			t = t + eh + 2;
		}
	} else {
		//display to the right of the element
		tagClassName = "tagTipRight";
		l = l + ew;
		t = t + 18;
	}
	//display the tagtip
	eleTagTip.className = tagClassName;
	eleTagTip.innerHTML = "<div class='tagTip'" + (textWidth != '' ? " style='float:right;width:"+textWidth + "'" : '' ) + ">" + text + "</div>";
	eleTagTip.style.left = l + "px";
	eleTagTip.style.top = t + "px";
	eleTagTip.style.display = "block";
}

//hide the tagtip
function tagtipHide () {
  	var eleTagTip = document.getElementById('tagTip');
	eleTagTip.innerHTML = "";
	eleTagTip.style.display = "none";
}

//add an event to an element
function addEvent(ele, evType, fn) {
	elm = document.getElementById(ele);
	if (elm != null) {
		if (elm.addEventListener) {
			elm.addEventListener(evType, fn, false);
			return true;
		}
		else if (elm.attachEvent) {
			var r = elm.attachEvent('on' + evType, fn);
			return r;
		}
		else {
			elm['on' + evType] = fn;
		}
	}
}

function selectElement(ele) {
	document.getElementById(ele).select();
}
//-->
