<!-- 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();


//AJAX FUNCTIONS
var xmlHttp;
var ajaxDoneCalls=new Array();

//function to initialize ajax object
function ajaxInit(){
	//reset xmlHttp variable
	xmlHttp=0;
	// Firefox, Opera 8.0+, Safari
	try{xmlHttp=new XMLHttpRequest();}
	catch(e){
		// Internet Explorer
		try{xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");}
		catch(e){
			try{xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");}
			catch(e){
				//alert("Your browser does not support AJAX.");
				return false;
			}
		}
	}
	//if xmlHttp initialize was successful, return true
	return true;
}

//function to initiate ajax call
function ajaxCall(cScript,cMethod,cSync,cDone){
	//alert('in ajaxCall');
	//first, make sure the ajax object has been initialized
	if(!xmlHttp){initOK=ajaxInit();}
	//setup defaults for ajax transfer if arguments are missing
	if(!cMethod){cMethod="GET";}if(!cSync || cSync=='true'){cSync=true;}else{cSync==false;}if(!cDone){cDone='default';}
	//alert(cSync);
	//place the cDone argument in the ajaxDone array for use when the call is complete
	//ajaxDoneCalls[ajaxDoneCalls.length]=cDone;
	ajaxDoneCalls.push(cDone);
	//alert(cMethod+","+cScript+","+cSync);
	//now, make the server script call - first argument is the request send method (GET, POST), then the script path to call, then asynchronous (true) or synchronous (false)
	xmlHttp.open(cMethod,cScript,cSync);
	xmlHttp.onreadystatechange=function(){
			/*possible readyState values:
			0	The request is not initialized
			1	The request has been set up
			2	The request has been sent
			3	The request is in process
			4	The request is complete*/
			//NOTE - THESE FUNCTIONS SHOULD BE PLACED IN THE SITE.JS FILE SINCE THESE ACTIONS WILL BE SITE SPECIFIC
			switch(xmlHttp.readyState){
				case 2:
					//alert('The request has been sent');
					ajaxStart();
				break
				
				case 3:
					//alert('The request is in process');
					ajaxProcess();
				break;
				
				case 4:
					//alert('The request is complete'); /*this function will receive the xmlHttp.responseText value*/
					ajaxDone();
				break;
			}
		}
	xmlHttp.send(null);
}

//END AJAX FUNCTIONS

function toggleDivShow(divName){
	//alert('in toggleDivShow'); 
	if(divObj=findObjectPath(divName)){
		displayChange = (divObj.style.display == 'none') ? 'block' : 'none';
		divObj.style.display=displayChange;
		fixIEBug();
	}
}	

function toggleDivVisible(divName,direction){
	//alert('in toggleDivVisible'); 
	if(divObj=findObjectPath(divName)){
		//alert(divObj);
		if(direction=='1'){divObj.style.display='block';}
		if(direction=='0'){divObj.style.display='none';}
		fixIEBug();
	}
}


function toggleTransp(objName,direction){
	if(obj=findObjectPath(objName)){
		//alert(obj.name);
		if(direction=='1'){ 
			obj.setAttribute("class", "semiTransparent");
			obj.setAttribute("className", "semiTransparent");
		}
		if(direction=='0'){
			obj.setAttribute("class", "opaque");
			obj.setAttribute("className", "opaque");
		}
	}
}


function assocListUpdate(colName,area){
	//alert('in assocListUpdate');
	pathPrefix=getPathPrefix(area,1);
	framePrefix=getPathPrefix(area,0);
	assocString="";
	assocList=framePrefix.frames['iframeList_'+colName].document.getElementsByTagName('input');
	for(i=0;i<assocList.length;i++){
		if(assocList[i].checked){
			//tilda separate values
			if(assocString!=""){assocString+="~";}
			assocString+=assocList[i].name;
		}
	}
	//alert(assocString);
	//alert(pathPrefix.tableForm['db__'+colName]);
	//now attach any value found for associated items to the hidden input element for this variable
	pathPrefix.tableForm['db__'+colName].value=assocString;
	//alert(pathPrefix.tableForm['db__'+colName].value);
	return true;
}


function toggleOpenNavFS(togVal){
	openFSobj=findObjectPath('openNavFS');
	//alert(openFSobj);
	if(openFSobj!=null){openFSobj.value=togVal;}
}


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,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!=null && startField!=null && selectList.selectedIndex==0 && startField.value!=""){
		//NOTE - if startField.value=="useCustomSelectStart", then call the customSelectStart function found in the site.js script
		if(startField.value=="useCustomSelectStart"){
			customSelectStart(checkName,area);
		}else{
			//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,arg5){
	//alert('in toggleFileDisplay, checkName='+checkName);
	//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":
			//NOTE - this is currently incompatible with popups wherein the image list is available as a select list BECAUSE in those cases, the javascript image list is not created
			//alert(checkName+"__array");
			//if(selectList=findObjectPath(checkName+'__select',area)){selectList.value="";}
			fileArray=checkName+"__array";
			//if a file upload is selected, ignore this whole sectiontoggleContDiv
			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("/");
					filename=basename[basename.length-1];
					basename=filename.substr(0,filename.length-4);
					//check for a file match - use the arg5 suffix if sent
					if(arg5==null){arg5="";}
					if((fieldText+arg5)==basename){
					 	//alert('found match');
						showFile=popWin[fileArray][inc];
						changeText('statDiv_'+checkName,'('+fType+'&nbsp;ok)','#174917',area);
						changeText('dispFileName_'+checkName,' : '+filename,'#000000',area);
						//reset the file upload, if there is one
						if(fileUpload=findObjectPath(checkName+"__new",area)){fileUpload.value="";}
						if(removeImage=findObjectPath(checkName+"__remove",area)){removeImage.value="0";}
						if(selectList=findObjectPath(checkName+'__select',area)){selectList.value=showFile;}
						break;
					}
				}
				//if no matching file was found, change thte title accordingly
				if(showFile==""){
					changeText('statDiv_'+checkName,'(no&nbsp;'+fType+')','#830000',area);
					changeText('dispFileName_'+checkName,'','#000000',area);
					if(removeImage=findObjectPath(checkName+"__remove",area)){removeImage.value="1";}
					if(selectList=findObjectPath(checkName+'__select',area)){selectList.value="";}
				}
				break;
			}
			break;
	}	
	//now update the image display
	if(showFile==""){
		//only proceed if selectList exists and is in fact a list and not a hidden input
		if((selectList=findObjectPath(checkName+'__select',area)) && (selectList.type!='hidden')){
			showFile=selectList.options[selectList.selectedIndex].value;
		}else{
			showFile="/_images/shared/_xc_image_none.jpg";
		}
	}
	//alert(showFile);
	//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('found previewFrame');
			previewFrame.src='/_libs/image_output.php?src='+showFile+'&output=thumbDoc';
		}
	}
}


function openPopPreview(checkName,area){
	//capture the popup link data from the preview iframe and use it to open the media preview popup
	if(lData=top.frames[area]["iframe_"+checkName].document.getElementById('popLink')){
		//alert(lData);
		lData=lData.toString();
		lData=lData.substring(21,lData.length-1).split(',');
		for(x in lData){lData[x]=lData[x].substring(1,lData[x].length-1);}
		goURL(lData[0],lData[1],lData[2],lData[3],lData[4],lData[5]);
	}
}


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)){
		//if the div tog sign is an image, toggle it here
		if(openName=='image'){
			if(divObj.style.display=='none'){
				signalObj.src=stringReplace(signalObj.src,'_open','_closed');
			}else{
				signalObj.src=stringReplace(signalObj.src,'_closed','_open');
			}
		}else{
			switch(signalObj.innerHTML){
				case openName:
					signalObj.innerHTML=closeName;
					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;
					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(anchorName);
	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("~","$","&","?","@","\"","\\","”","¡","À","«");
	charList=Array("~","$","&","?","@","\"","\\","”","i","«");
	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+' url='+url+' target='+target);
	//create the popup according to indended target
	switch(target){
		case 'top':
			window.location=url;
			break;
		case 'popup':
			//only a 'popup' target gets assigned the popWin variable, other popups (media previews) are NOT tracked, as an open popWin may spawn those requests
			closePopup();
			popWin=0;
		case 'previewPop':
		case 'img_pop':
			//set variable defaults
			if(!resize){resize=1;}
			if(!scrollbars){scrollbars=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);
			tempWin=window.open('','','width=' + popWidth + ',height=' + popHeight + ',left=' + winLeft + ',top=' + winTop + ',resizable=' + resize +',scrollbars=' + scrollbars);
			if(target=="previewPop" || target=="popup"){tempWin.location=url;}
			if(target=="img_pop"){
				tempWin.document.write('<html><head><title>Image Window</title><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"></head>');
				tempWin.document.write('<body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">');	
				tempWin.document.write('<table id="imageTable" width="100%" height="100%" border="0" cellpadding="0" cellspacing="0"><tr><td align="center" valign="middle">');
				tempWin.document.write('<img src="'+url+'"><br /><img src="/_images/spacer.gif" width="1" height="10"><br />');
				tempWin.document.write('<input type="button" name="close" id="close" value="Close Window" onClick="JavaScript:window.close();" /></td></tr></table></body></html>');
			}
			tempWin.focus();
			//only set the popWin variable for a popup target
			if(target=="popup"){popWin=tempWin;}
			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,newClass){
	//alert('in clearText');
	//alert("in clearText, objID="+objID);
	if ((objPath=findObjectPath(objID,area))!=null){
		//alert("objPath="+objPath);
		//alert("objPath.value="+objPath.value);
		objPath.value="";
		//if a newClass value was sent, apply this class to the current input
		if(newClass!=null){
			objPath.className=newClass;
		}
	}
}


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')
	//alert('objID='+objID+' area='+area);
	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
	if(!area){
		pathPrefix=window;
	}else{
		switch(area){
			
			case(""):
			case(0):
			case(null):
			pathPrefix=window;
			break;
			
			case("popWin"):		
			pathPrefix=popWin;
			break;
			
			case("navBottom"):
			pathPrefix=window.top.bottomFrame;
			break;
			
			case("navTop"):
			pathPrefix=window.top.topFrame;
			break;
			
			case("navBottomEmailer"):
			pathPrefix=window.top.bottomFrame.iframe_emailer;
			break;
			
			default:
			//if another area argument was sent,assume it is the name of the target frame 
			pathPrefix=window.top[area];
			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;
}


//-->