<!-- hide from old browsers
//alert('sharedscripts up')
var openDivs=new Array();
var validate=0;
var isIE  = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;    // true if we're on ie
var isWin = (navigator.appVersion.toLowerCase().indexOf("win") != -1) ? true : false; // true if we're on windows
//reset popwin variables
var popWin=0, popWin_x=0, popWin_y=0, popWin_h=0, popWin_w=0;
//reset nav variables
var curAccessArea="", navMainData=new Array(), navSubData=new Array();
//var defAdminPanel="";
var availableImgs1=new Array(), availableImgs2=new Array(), availableImgs3=new Array();


function assocFilesUpdate(dbColVar,area){
	//alert('in assocFilesUpdate');
	pathPrefix=getPathPrefix(area,1);
	framePrefix=getPathPrefix(area,0);
	assocFilesString="";
	allFiles=framePrefix.frames['iframeFileList'].document.getElementsByTagName('input');
	for(i=0;i<allFiles.length;i++){
		if(allFiles[i].checked){
			//tilda separate values
			if(assocFilesString!=""){assocFilesString+="~";}
			assocFilesString+=allFiles[i].name;
		}
	}
	//alert(assocFilesString);
	//now attach any value found for associated files to the hidden input element for this column
	pathPrefix.tableForm[dbColVar].value=assocFilesString;
	return true;
}


function updateTabState(navTab,newFlag,updateNav){
	//alert('in updateTabState, navTab='+navTab+" newFlag="+newFlag);
	//this function allows javascript to update the tabFlag entry in the navMainData array
	navTabs=navTab.split("__");
	for(i=0;i<navMainData.length;i++){
		if((navObj=findObjectPath(navMainData[i][1],'navTop')) && (navMainData[i][1]==navTabs[0])){
			//the nav tab was found, so update the tabFlag
			navMainData[i][4]=newFlag;
			//now update the nav bar, and exit the function
			if(updateNav){
				if(navObj && navMainData[i][4]=='dead'){
					navObj.className='headerNavDead';
				}else if(navObj && navMainData[i][4]=='done'){
					navObj.className='headerNavDone';
				}
			}
			break;
		}
	}
}


function goNavFrame(navTab,filePath,udpateNav,linkVars){
	//alert('in goNavFrame');
	//navMainData and navSubData are arrays created by the navTop.php script - curAccessArea holds the current accessArea name
	decision=true;
	//first see if there are any warnings or pre-processing required for the area we are GOING TO
	switch(navTab){
		case "adminPanels":
			//reset the default admin panel for initial display
			//if(defAdminPanel==null){defAdminPanel=0;}
			if(defAdminObj=findObjectPath("defAdminPanel",'navTop')){parseInt(defAdminPos=defAdminObj.value);}else{defAdminPos=0;}
			//if(selectObj=findObjectPath('panelList','navTop')){selectObj.options[defAdminPanel].selected=1;}
			if(selectObj=findObjectPath('panelList','navTop')){selectObj.options[defAdminPos].selected=1;}
			if(addRecsObj=findObjectPath('addRecords','navTop')){addRecsObj.style.display='none';}
		break;
	}
	//alert('next step');
	//next see if there are any warnings or pre-processing required for the area we are LEAVING (curAccessArea is the CURRENTLY LIVE TAB)
	//alert(curAccessArea.indexOf('cciModules'));
	switch(curAccessArea){
		case "posasap":
		case "marketingMaterials__posasap":
			decision=confirm('Are you sure you want to leave P.O.S. ASAP?\nAny unsaved changes will be lost.');
		break;
	}
	if(curAccessArea.indexOf('cciModules')==0){
		decision=confirm('Are you sure you want to leave the current training module?');
	}
	//if the user didnt click cancel on an option dialog above, continue here
	if(decision==true){
		navArrayLoc=0;
		navTabs=navTab.split("__");
		//reset main and sub nav
		if(udpateNav==1){
			titleObj=findObjectPath('navTitle','navTop');
			titleObj.innerHTML="";
			//subTitleObj=findObjectPath('navSubTitle','navTop');
			//subTitleObj.innerHTML="";
			//alert(navTabs[0]);
			//alert(navMainData.length);
			for(i=0;i<navMainData.length;i++){
				//toggle the sub nav if it exists
				if((subObj=findObjectPath(navMainData[i][1]+"_sub",'navTop')) && (navMainData[i][1]+"_sub"==navTabs[0]+"_sub")){
					subObj.style.display='block';
					subObj.className='headerSubMenu';
					//also set the correct sub menu link hilighting
					for(ii=0;ii<navSubData[navArrayLoc].length;ii++){
						if((subLinkObj=findObjectPath(navSubData[i][ii],'navTop')) && (navTab==navSubData[i][ii])){
							//alert('found sub');
							subLinkObj.className='headerSubLive';
							//update the sub title as well
							//subTitleObj.innerHTML='&nbsp;&#x203a; '+subLinkObj.innerHTML;
						}else if(subLinkObj){
							subLinkObj.className='headerSub';
						}
					}
				}else if(subObj){
					subObj.style.display='none';
					subObj.className='offScreen';
				}
				//toggle the main nav if it exists
				if((navObj=findObjectPath(navMainData[i][1],'navTop')) && (navMainData[i][1]==navTabs[0])){
					//capture the array position of this nav item
					navArrayLoc=i;
					//insert the correct title 
					titleObj.innerHTML=navMainData[navArrayLoc][3];
					//setup the correct CSS class
					navObj.className='headerNavLive';
				}else if(navObj && navMainData[i][4]=='dead'){
					navObj.className='headerNavDead';
				}else if(navObj && navMainData[i][4]=='done'){
					navObj.className='headerNavDone';
				}else if(navObj){
					navObj.className='headerNavLink';
				}
			}
		}
		//save the new accessArea variable
		curAccessArea=navTab; goString="";
		//now go to the requested nav frame
		if(filePath=='useRouter'){
			//alert(navMainData[navArrayLoc][1])
			//goString='/_libs/access_router.php?navlnk=1&accessArea='+navTab+"&";
			goString='/_libs/access_router.php?accessArea='+navTab+"&";
		}else if(filePath!=null && filePath!=''){
			goString=filePath+"?";
		}
		//add any GET link variables we need to pass along (mm_index uses this)
		if(linkVars!=null){goString+=linkVars;}
		//finally GO FORTH!
		//alert('goString='+goString);
		window.top.bottomFrame.location=goString;
	}
}


/*function resizePopup(resizeHeight,resizeWidth){
	//alert('resizeHeight='+resizeHeight+" resizeWidth="+resizeWidth);
	if(resizeHeight==1 || resizeWidth==1){
		//find the content div width and height
		divObj=findObjectPath('contentDiv','popWin');
		h = divObj.offsetHeight;
		w = divObj.offsetWidth;
		//add border padding for various browser and platform cases
		if(isWin==true){
			if(isIE==true){
				w+=80,h+=90;
			}else{
				w+=70,h+=65;
			}
		}else{
			w+=75,h+=45;
		}
		//dont let the height get larger than the screen height or width minus 46
		if(h>(screen.height-40)){h=screen.height-46;}
		y=Math.round((screen.height - h)/2);
		if(w>(screen.width-40)){w=screen.width-46;}
		x=Math.round((screen.width - w)/2);
		//now resize and reposition the popup window
		if(resizeHeight==0){y=popWin_y;h=popWin_h;}
		if(resizeWidth==0){x=popWin_x;w=popWin_w;}
		popWin.moveTo(x,y)
		popWin.resizeTo(w,h);
		//save the current x,y,h & w
		popWin_x=x, popWin_y=y, popWin_h=h, popWin_w=w;
	}
}*/


function resizePopup(resizeHeight,resizeWidth,forceHeight,forceWidth){
	//alert('resizeHeight='+resizeHeight+" resizeWidth="+resizeWidth);
	//if height or width force sizing was sent, use that
	if(resizeHeight==1 || resizeWidth==1){
		//find the content div width and height
		divObj=findObjectPath('contentDiv','popWin');
		if(forceHeight!=null && forceHeight!=0){h=forceHeight;}else{h=divObj.offsetHeight;}
		if(forceWidth!=null && forceWidth!=0){w=forceWidth;}else{w=divObj.offsetWidth;}
		//add border padding for various browser and platform cases
		if(isWin==true){
			if(isIE==true){
				w+=80,h+=90;
			}else{
				w+=70,h+=65;
			}
		}else{
			w+=75,h+=45;
		}
		//dont let the height get larger than the screen height or width minus 46
		if(h>(screen.height-40)){h=screen.height-46;}
		y=Math.round((screen.height - h)/2);
		if(w>(screen.width-40)){w=screen.width-46;}
		x=Math.round((screen.width - w)/2);
		//now resize and reposition the popup window
		if(resizeHeight==0){y=popWin_y;h=popWin_h;}
		if(resizeWidth==0){x=popWin_x;w=popWin_w;}
		popWin.moveTo(x,y)
		popWin.resizeTo(w,h);
		//save the current x,y,h & w
		popWin_x=x, popWin_y=y, popWin_h=h, popWin_w=w;
	}
}


function existingFileDownload(checkName,curFile,area){
	//if there is an image select menu for this checkName, then use its value for download, otherwise
	if(selectList=findObjectPath(checkName+"__select",area)){
		//alert('select list found');
		newFile=selectList.options[selectList.selectedIndex].value;
		//if the selection in the select menu has a value, then use it as the download image
		if(newFile!=""){curFile=newFile;}
	}
	location.href='/_libs/file_download.php?src='+curFile;

}


function toggleUnderline(checkName,toggle,area){
	if(textObj=findObjectPath(checkName,area)){
		switch(toggle){
			case 'over':
				textObj.style.textDecoration='underline';
				break;
				
			case 'norm':
				textObj.style.textDecoration='none';
				break;
		}
	}
}


function fileSelectStart(checkName,area){
	//function to automatically move a select list to a given entry based upon text found in the startField - good for moving around in huge select lists
	//alert('in fileSelectStart');
	selectList=findObjectPath(checkName+"__select",area);
	startField=findObjectPath("fileSelectStart",area);
	if(selectList && startField && selectList.selectedIndex==0 && startField.value!=""){
		//alert('ok to reposition');
		for(ii=0;ii<selectList.options.length;ii++){
			if(selectList.options[ii].value.indexOf(startField.value)!=-1){
				//alert('found match');
				selectList.selectedIndex=ii-1;
				break;
			}
		}
	}
}


function restrictSelect(checkName,area){
	//function to automatically restrict a list selection to selections whose value includes the value of the startField
	//alert('in fileSelectStart');
	selectList=findObjectPath(checkName+"__select",area);
	startField=findObjectPath("fileSelectStart",area);
	if(selectList && startField && selectList.selectedIndex!=0 && startField.value!=""){
		if(selectList.options[selectList.selectedIndex].value.indexOf(startField.value)==-1){
			selectList.selectedIndex=0;
		}
	}
}


function toggleFileDisplay(checkName,toggle,area,arg4){
	//get the file type, if there is one
	//alert('in toggleFileDisplay');
	if(fileType=findObjectPath(checkName+"__fType",area)){fType=fileType.value;}else{fType='file';}
	showFile="";hidePreview=0;
	switch(toggle){
		case "select":
			//reset the file upload, if there is one
			if(fileUpload=findObjectPath(checkName+"__new",area)){fileUpload.value="";}
			//reset remove checkbox if there is one
			if(removeBox=findObjectPath(checkName+'__remove',area)){removeBox.checked=0;}
			//modify the selection if needed
			if(selectList=findObjectPath(checkName+'__select',area)){
				selectFile=selectList.options[selectList.selectedIndex].value;
				if(selectFile==""){
					//if there is no saved image, set status to 'no image', otherwise revert to the saved image
					if(savedFile=findObjectPath(checkName+"__saved",area)){
						toggleFileDisplay(checkName,'saved',area);
						//revertToSaved(checkName,area);
					}else{
						//update the image status if there is one
						changeText('statDiv_'+checkName,'(no&nbsp;'+fType+')','#830000',area);
						showFile='/_images/shared/_xc_image_noUpload.jpg';
						hidePreview=1;
					}
				}else{
					//if the current selected image matches the saved image, say 'image ok', otherwise say 'new selection'
					if((savedFile=findObjectPath(checkName+"__saved",area)) && (savedFile.value==selectFile)){
						toggleFileDisplay(checkName,'saved',area);
					}else{
						//update the image status if there is one
						changeText('statDiv_'+checkName,'(new&nbsp;selection)','#A99228',area);
					}
				}
			}
			break;
		case "new":
			//reset the select list if there is one
			if(selectList=findObjectPath(checkName+"__select",area)){selectList.selectedIndex=0;}
			//reset remove checkbox if there is one
			if(removeBox=findObjectPath(checkName+'__remove',area)){removeBox.checked=0;}
			//update the image status if there is one
			changeText('statDiv_'+checkName,'(new&nbsp;upload)','#A99228',area);
			//show the upload image placeholder in the preview frame
			showFile="/_images/shared/_xc_image_uploadReady.jpg";
			break;
		case "remove":
			if(checkObj=findObjectPath(checkName+'__remove',area)){
				if(checkObj.checked==1){
					//reset the file upload, if there is one
					if(fileUpload=findObjectPath(checkName+"__new",area)){fileUpload.value="";}
					//reset file rename, if there is one
					if(fileRename=findObjectPath(checkName+"__rename",area)){fileRename.value="";}
					//reset the select list if there is one
					if(selectList=findObjectPath(checkName+"__select",area)){selectList.selectedIndex=0;}
					//update the image status if there is one
					changeText('statDiv_'+checkName,'(remove&nbsp;'+fType+')','#A99228',area);
					//show the upload image placeholder in the preview frame
					showFile="/_images/shared/_xc_image_remove.jpg";
					hidePreview=1;
				}else{
					//revert to the saved image (remove button wouldn't be available if there wasn't one)
					toggleFileDisplay(checkName,'saved',area);
					//revertToSaved(checkName,area);
				}
			}
			break;
		case "saved":
			//reset the file upload, if there is one
			if(fileUpload=findObjectPath(checkName+"__new",area)){fileUpload.value="";}
			//reset remove checkbox if there is one
			if(removeBox=findObjectPath(checkName+'__remove',area)){removeBox.checked=0;}
			//make sure we havge a saved image before continuing
			if(savedFile=findObjectPath(checkName+"__saved",area)){
				//if there is a select list, move it to the position of the saved image
				if(selectList=findObjectPath(checkName+"__select",area)){
					//find the saved image in the list
					for(ii=0;ii<selectList.options.length;ii++){
						if(selectList.options[ii].value==savedFile.value){
							selectList.selectedIndex=ii;
							//refresh the image preview
							//toggleFileDisplay(checkName,'select',area);
							break;
						}
					}
				}
				//use the saved image in the image preview
				showFile=savedFile.value;
				//update the image status if there is one
				changeText('statDiv_'+checkName,'('+fType+'&nbsp;ok)','#174917',area);
			}
			break;
		case "matchField":
			//alert(checkName+"__array");
			fileArray=checkName+"__array";
			//if a file upload is selected, ignore this whole section
			if((fileUpload=findObjectPath(checkName+"__new",area)) && (fileUpload.value!="")){return;}
				//now search for file matches
			if((fieldObj=findObjectPath(arg4,area)) && (popWin[fileArray]!=null)){
				fieldText=fieldObj.value;
				for(inc in popWin[fileArray]){
					 basename=popWin[fileArray][inc].split("/");
					 basename=basename[basename.length-1].substr(0,basename[basename.length-1].length-4);
					 //found a file match
					 if(fieldText==basename){
					 	//alert('found match');
						showFile=popWin[fileArray][inc];
						changeText('statDiv_'+checkName,'('+fType+'&nbsp;ok)','#174917',area);
						//reset the file upload, if there is one
						if(fileUpload=findObjectPath(checkName+"__new",area)){fileUpload.value="";}
						break;
					}
				}
				//save this matched filename (or lack thereof) in the hidden select input
				//if(hiddenSelect=findObjectPath(checkName+"__select",area)){hiddenSelect.value=showFile;}
				//if no matching file was found, change thte title accordingly
				if(showFile==""){changeText('statDiv_'+checkName,'(no&nbsp;'+fType+')','#830000',area);}
				break;
			}
			break;
	}	
	//now update the image display
	if(showFile==""){
		if(selectList=findObjectPath(checkName+'__select',area)){
			showFile=selectList.options[selectList.selectedIndex].value;
		}else{
			showFile="/_images/shared/_xc_image_none.jpg";
		}
	}
	//toggle image preview visibility
	if(hidePreview==1){
		if(divObj=findObjectPath("filePrevTitle_"+checkName,area)){divObj.style.display='none';}
		if(divObj=findObjectPath("filePrevCont_"+checkName,area)){divObj.style.display='none';}
	}else{
		if(divObj=findObjectPath("filePrevTitle_"+checkName,area)){divObj.style.display='block';}
		if(divObj=findObjectPath("filePrevCont_"+checkName,area)){divObj.style.display='block';}
		//now see if there is an anchor tag that we should scroll to
		scrollToAnchor("anchor_"+checkName,area);
		//update the preview pane
		if(previewFrame=findObjectPath("iframe_"+checkName,area)){
			//alert('previewFrame='+previewFrame);
			previewFrame.src='/_libs/image_output.php?src='+showFile+'&output=thumbDoc';
		}
	}
}


function changeText(objID,newText,newColor,area){
	//alert('toggleContDiv');
	if(divObj=findObjectPath(objID,area)){
		divObj.innerHTML=newText;
		if(newColor!=0 && newColor!=null){divObj.style.color=newColor;}
	}
}


function toggleContDiv(checkName,openName,openColor,closeName,closeColor,area){
	//alert('toggleContDiv');
	divObj=findObjectPath("contDiv_"+checkName,area);
	displayChange = (divObj.style.display == 'none') ? 'block' : 'none';
	divObj.style.display=displayChange;
	if(signalObj=findObjectPath("divTogSign_"+checkName,area)){
		//alert(signalObj.innerHTML);
		switch(signalObj.innerHTML){
			case openName:
				signalObj.innerHTML=closeName;
				if(closeColor!=null){signalObj.style.color=closeColor;}
				//now see if there is an anchor tag that we should scroll to
				scrollToAnchor("anchor_"+checkName,area);
				break;
				
			case closeName:
				signalObj.innerHTML=openName;
				if(closeColor!=null){signalObj.style.color=openColor;}
				break;
		}
	}
	//alert('going to fixIEBug');
	fixIEBug();
	//alert('going to scrollTonchor');
}


//function to scroll document to a given anchor
function scrollToAnchor(anchorName,area){
	//alert('scrollToAnchor');
	if(anchorObj=findObjectPath(anchorName,area)){
		//get the correct pathprefix
		pathPrefix=getPathPrefix(area,0);
		//NOTE that the getAnchorPosition script must be directly linked to whatever page is specified in the pathprefix 
		//(ie, popwin must have this script directly attached)
		scrollCoords=pathPrefix.getAnchorPosition(anchorName);
		//find the actual height of the popWin
		if(pathPrefix.innerHeight){
			frameHeight = pathPrefix.innerHeight;
		}else if(pathPrefix.document.documentElement && pathPrefix.document.documentElement.clientHeight){
			frameHeight = pathPrefix.document.documentElement.clientHeight;
		}else if(pathPrefix.document.body){
			frameHeight = pathPrefix.document.body.clientHeight;
		}
		//grab the current scroll position
		//scrollx = (pathPrefix.document.all)?pathPrefix.document.body.scrollLeft:pathPrefix.pageXOffset;
  		scrolly = (pathPrefix.document.all)?pathPrefix.document.body.scrollTop:pathPrefix.pageYOffset; 
		//now, if the desired anchor is below the window height, scroll down just enough to reveal that anchor
		if((frameHeight+scrolly)<scrollCoords.y){
			//alert('scrolly='+scrolly+' frameHeight='+frameHeight+' scrollCoords.y='+scrollCoords.y);
			pathPrefix.scrollTo(0,(scrollCoords.y-frameHeight)+10);
		}
	}
}


function triggerDateFilter(dateName,area){
	pathPrefix=getPathPrefix(area,1);
	radioSet=pathPrefix.forms['tableForm']['filter__'+dateName+'__dateRange'];
	//radioSet=findObjectPath('filter__'+dateName+'__dateRange',area);
	for(inc=0;inc<radioSet.length;inc++){
		if(radioSet[inc].value=='range'){radioSet[inc].checked=1;break;}
	}
}


function resizeOuterTo(w,h) {
 if (parseInt(navigator.appVersion)>3) {
   if (navigator.appName=="Netscape") {
    top.outerWidth=w;
    top.outerHeight=h;
   }
   else top.resizeTo(w,h);
 }
}


function checkChars(checkText,formCall){
//now check for illegal characters
	charList=Array("~","$","&","?","@","\"","\\","”","¡","À","«");
	for(i=0;i<charList.length;i++){
		if(checkText.indexOf(charList[i])!=-1){
			alert("Sorry, your text cannot contain the "+charList[i]+" character.");
			if(formCall){
				return false;
			}else{
				return;
			}
		}
	}
}

function fixIEBug(){
	//alert("in fixIEDbug")
	///Defeat IE6 fixed bug by opening and closing the last div
	if(x = document.getElementById('defeatIEBug')){
		currentStyle = x.style.display;
		newStyle = (currentStyle == 'none') ? 'block' : 'none';
		x.style.display = newStyle;
		x.style.display = currentStyle;
	}
	return;
}

function goURL(url,target,popWidth,popHeight,resize,scrollbars) {
			//alert(' popWidth='+popWidth+'popHeight='+popHeight);
			//alert(' url='+url);
	if(!resize){
		resize=1;
	}
	if(!scrollbars){
		scrollbars=0;
	}
	//alert('goURL, url= ' + url + ' target= ' + target)
	switch (target) {
		case 'top':
			window.location=url;
			break;
		case 'popup':
			closePopup();
			popWin=0;
			if(!popWidth){popWidth=400;}
			if(!popHeight){popHeight=400;}
			var winLeft=parseInt((screen.width - popWidth)/2);
			var winTop=parseInt((screen.height - popHeight)/2);
			//alert('width=' + popWidth + ',height=' + popHeight + ',left=' + winLeft + ',top=' + winTop + ',resizable=' + resize +',scrollbars=' + scrollbars);
			popWin=window.open('','','width=' + popWidth + ',height=' + popHeight + ',left=' + winLeft + ',top=' + winTop + ',resizable=' + resize +',scrollbars=' + scrollbars);
			popWin.location=url;
			popWin.focus();
			break;
	}
}


function filterRecords(area,xlsOutput,customXLS){
	//alert("in filterRecords, area="+area);
	openDivList=captureOpenDivs(area);
	pathPrefix=getPathPrefix(area,1);
	saveAction=pathPrefix.tableForm.action;
	pathPrefix.tableForm.action=pathPrefix.tableForm.action+"?curPage=1&newFilters=1&openDivs="+openDivList;
	//add the xlsOUtput variable if requested
	if(xlsOutput){pathPrefix.tableForm.action=pathPrefix.tableForm.action+"&xlsOutput="+xlsOutput+"&customXLS="+customXLS;}
	pathPrefix.tableForm.submit();
	//reset the tableForm action if we just did an xlsOutput
	pathPrefix.tableForm.action=saveAction;
}


function clearFilter(area){
	//alert("in clearFilter, area="+area);
	//DONT CAPTURE THE OPEN DIVS - WANT THEM TO BE CLOSED WHEN PAGE IS RELOADED
	//openDivList=captureOpenDivs(area);
	pathPrefix=getPathPrefix(area,0);
	goAction=pathPrefix.document.tableForm.action;
	obj=findObjectPath("useSavedFilters","navBottom");
	if(obj){obj.value=0;}
	//SKIP THE SUBMIT ACTION, AND THUS RESET THE FILTERS
	//pathPrefix.location.href=goAction+"?curPage=1&newFilters=1&openDivs="+openDivList;
	pathPrefix.location.href=goAction+"?curPage=1";
}


function flipPage(selectList,area,goPage){
//alert("in flipPage, area="+area+" selectList="+selectList);
	openDivList=captureOpenDivs(area);
	pathPrefix=getPathPrefix(area,1);
	goAction=pathPrefix.tableForm.action;
	if(!goPage){goPage=pathPrefix.tableForm[selectList].options[pathPrefix.tableForm[selectList].selectedIndex].text;}
	pathPrefix.tableForm.action=goAction+"?curPage="+goPage+"&openDivs="+openDivList;
	//alert(pathPrefix.tableForm.action)
	pathPrefix.tableForm.submit();
}


function changeSort(sortBy,sortDir,area){
	//alert("in changeSort, area="+area+" sortBy="+sortBy);
	openDivList=captureOpenDivs(area);
	pathPrefix=getPathPrefix(area,1);
	//update the sortBy and sortDir hidden inputs
	objBy=findObjectPath("sortBy","navBottom");
	objBy.value=sortBy;
	objToggle=findObjectPath("sortDir","navBottom");
	objToggle.value=sortDir;
	//now add the openDivs list and go!
	goAction=pathPrefix.tableForm.action;
	pathPrefix.tableForm.action=goAction+"?openDivs="+openDivList;
	//alert(pathPrefix.tableForm.action)
	pathPrefix.tableForm.submit();
}


function captureOpenDivs(area){
	//alert("in captureOpenDivs");
	//capture a list of all open divs in openDivs array for the current resource page for use when the page reloads after the update
	pathPrefix=getPathPrefix(area,1);
	x=pathPrefix.getElementsByTagName('div');
	top.openDivs=new Array();
	closeLevel='c_container';
	closeLevInc=0;
	returnList="";
	for(i=0;i<x.length;i++){
		//alert(x[i].className)
		//reocrd any open divs in the current resource so we can reopen these after the resource has ben updated
		if (x[i].className==closeLevel){
			if(x[i].style.display=='block'){
				openDivs[openDivs.length]=1;
				returnList+="1,";
			}else{
				openDivs[openDivs.length]=0;
				returnList+="0,";
			}
		}
	}
	//NOTE that the openDivs array here is used for frameset actions so that this javascript array is preserved when calling a new frame
	//and the returnList is a comma seperated version of the openDivs for sending in the URL to pages which are not in frames and thus will not preserve the openDivs array
	if(returnList.length>1){
		returnList=returnList.substring(0,returnList.length-1)
	}
	return returnList;
}


function clearText(objID,area){
	//alert('in clearText');
	//alert("in clearText, objID="+objID);
	if ((imgObjPath=findObjectPath(objID,area))!=null){
		//alert("imgObjPath="+imgObjPath);
		//alert("imgObjPath.value="+imgObjPath.value);
		imgObjPath.value="";
	}
}


function clearAllText(){
	//alert("in clearAllText");
	decision=confirm('Are you sure you want clear all input fields?');
	if(decision){
		docForms=document.forms;
		//alert("total forms="+docForms.length);
		//now walk though all form inputs, find text inputs and set their value=""
		for(i=0;i<docForms.length;i++){
		//alert("current form length="+docForms[i].length);
			for(ii=0;i<docForms[i].length;ii++){
				if(docForms[i][ii].type=="text" && docForms[i][ii].readonly==null){
					//alert("found text input, value="+docForms[i][ii].value);
					docForms[i][ii].value="";
				}
			}
		}
	}
}


function preloadImages(imageList) { 
	//alert('preloading images')
	var doc=document; //put the document object into a variable for abbreviated handling
	if(doc.images){ //if this browser is capable of finding document images, then proceed
		if(!doc.loadedImages) doc.loadedImages=new Array(); //if the loadedimages array doesn't yet exist, create it & attach it to the document object
		var i,len=doc.loadedImages.length; //set up variables
		for(i=0; i<imageList.length; i++){//cycle through the image paths passed as arguments and preload them
  			doc.loadedImages[len]=new Image(); 
			doc.loadedImages[len++].src=imageList[i];//note that putting the ++ after "len" increments "len" AFTER the current expression is evaluated!
    		//alert(doc.loadedImages.length + ' images have been preloaded');
		}
	}
}


/*function changeImageURL() { 
	//alert('preloading images')
	var doc=document; //put the document object into a variable for abbreviated handling
	if(doc.images){ //if this browser is capable of finding document images, then proceed
		//alert("there are "+doc.images.length+" images in this document")
		for(i=0;i<doc.images.length;i++){
			startPath=doc.images[i].src
			//alert(startPath)
			if(startPath.indexOf("_images")==-1){
				valueArray=startPath.split("images")
				//alert("subPath= "+valueArray[valueArray.length-1])
				newPath="http://www.jennieoturkeystore.com/images"+valueArray[valueArray.length-1]
				doc.images[i].src=newPath
				//return
			}
			//return
		}
	}
}*/


function closePopup() {
	//alert('in closePopup');
	//make sure the popUp is gone and update the main database display
	if(popWin){popWin.close(); popWin=0;}
}


//controls images swaping for both mouseEnter & mouseLeave actions
function imageSwap(mouseDir,objID,area) { 
	//alert('in imageSwap')
	imageInfo=null;
	if ((imgObjPath=findObjectPath(objID,area))!=null){
  		switch (mouseDir) {
			case'enter':
  				newImgPath=stringReplace(imgObjPath.src,'_norm','_over');
				imgObjPath.src = newImgPath;
				break;
			case'leave':
  				newImgPath=stringReplace(imgObjPath.src,'_over','_norm');
				imgObjPath.src = newImgPath;
				break;
		}
	}
}


//controls images swaping for both mouseEnter & mouseLeave actions
function newImage(imagePath,objID) { 
	//alert('in imageSwap')
	imageInfo=null;
	if ((imgObjPath=findObjectPath(objID))!=null){
  		//newImgPath=stringReplace(imgObjPath.src,'_over','_norm');
		imgObjPath.src = imagePath;
	}
}


function findObjectPath(objID,area){
	//alert('finding object path')
	var pathInfo;
	var pathPrefix;
	//first come up with a path prefix depending on where the object is
	pathPrefix=getPathPrefix(area,1);
	//now track down the element using the pathPrefix
	//return the appropriate object path depending on what browser we are using.
	if(pathPrefix.getElementById){
		//alert('found getElementByID, objID= ' + objID)
		pathInfo=pathPrefix.getElementById(objID);
	}else if (pathPrefix.all){
		//alert('found all, objID= ' + objID)
		pathInfo=pathPrefix.all[objID];
	}else if(pathPrefix.layers){
		//alert('found layers, objID= ' + objID)
		pathInfo=pathPrefix.images[objID];
	}else{ 
		//alert('unable to process DHTML on this browser')
		pathInfo=null;
	}
	//alert('pathInfo=' + pathInfo)
	return pathInfo;
}


function getPathPrefix(area,includeDoc){
	var pathPrefix;
	//create the window level path prefix
	switch(area){
		case("popWin"):		
		pathPrefix=popWin;
		break;
		
		case("navBottom"):
		pathPrefix=window.top.bottomFrame;
		break;
		
		case("navTop"):
		pathPrefix=window.top.topFrame;
		break;
		
		default:
		pathPrefix=window;
		break;
	}
	//add the document element if requested
	if(includeDoc){pathPrefix=pathPrefix.document;}
	return pathPrefix;
}


//this is a script to modify a given string with the given new string info
function stringReplace(modifyString,findString,replaceString) {
	//alert('in stringReplace')
	var pos=0,len=findString.length;
	pos=modifyString.indexOf(findString);
	//using the 'while(pos != -1)' here allows us to escape if the 'findString' we are sending isn't found in the 'modifyString' at all
	while(pos != -1) {
		preString=modifyString.substring(0,pos);
		postString=modifyString.substring(pos+len,modifyString.length);
		modifyString=preString+replaceString+postString;
		pos=modifyString.indexOf(findString);
	}
	return modifyString;
}


//-->