<!-- hide from old browsers//alert('sharedscripts up')var openDivs=new Array();var popWin=0;var validate=0;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 showCity(query){	//alert('showCity');	if(query==null){		//if parameters are void, assume this call is coming from the dropdown list		query=window.document.cityLocate.citySelect.options[window.document.cityLocate.citySelect.selectedIndex].value;	}	if(query!='none'){		window.location='locate.php?'+query;	}}function listCities(letter){	//alert('listCities');	//close all but the current city div	allLetters=new Array('A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z');	//allLetters=new Array('A','B');	for(curLoc in allLetters){		curLetter=allLetters[curLoc];		divObj=findObjectPath("div_"+curLetter);		if(curLetter==letter){			//alert('found letter match');			divObj.style.display='block';		}else{			if(divObj!=null && divObj.style.display!='none'){divObj.style.display='none';}		}	}	fixIEBug();}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)){		switch(signalObj.innerHTML){			case openName:				signalObj.innerHTML=closeName;				if(closeColor){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(openColor){signalObj.style.color=openColor;}				break;		}	}	//alert('going to fixIEBug');	fixIEBug();	//alert('going to scrollTonchor');}function fixIEBug(){	//alert("in fixIEDbug")	///Defeat IE6 fixed bug by opening and closing the last div	x = document.getElementById('defeatIEBug');	currentStyle = x.style.display;	newStyle = (currentStyle == 'none') ? 'block' : 'none';	x.style.display = newStyle;	x.style.display = currentStyle;}function refreshImage(dbColumn,outputFolder,area){	//alert('in refreshImage,dbColumn='+dbColumn);	switch(area){		case("popWin"):				pathPrefix=popWin;		break;				case("adminBottom"):		pathPrefix=window.top.bottomFrame;		break;				default:		pathPrefix=window;		break;	}	selectList=dbColumn;	previewFrame="iframe_"+dbColumn;	if(sourceObj=pathPrefix.document.getElementById(selectList)){		imgFile=sourceObj.options[sourceObj.selectedIndex].value;		//if(imgFile!="Select One"){		//make sure there are no spaces being sent via GET		//dbColumn=escape(dbColumn);		//imgFile=imgFile.replace(/'/gi,"\\'");		//alert("pathPrefix.frames[previewFrame]="+pathPrefix.frames[previewFrame])		switch(outputFolder){		case "thumb":			pathPrefix.frames[previewFrame].location.href='/_libs/image_output.php?src='+imgFile+'&maxW=140&maxH=140&format=jpg&quality=75&save=1&output=iframe&closeBtn=0&outputFolder='+outputFolder;			break;					case "screen":			pathPrefix.frames[previewFrame].location.href='/_libs/image_output.php?src='+imgFile+'&maxW=430&maxH=400&format=jpg&quality=90&save=1&output=iframe&closeBtn=0&outputFolder='+outputFolder;			break;		}		//}	}}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':			popWin=0;			if (!popWidth) {				popWidth=450;			}			if (!popHeight) {				popHeight=450;			}			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 submitRescoOrder(){	//alert('in submitRescoOrder');	//create the validator object to check the input fields	validate = new Validator("tableForm");	validate.addValidation("orderName","req","An order name is required");	validate.addValidation("name","req","Your name is required");	validate.addValidation("store","req","Store name is required");	validate.addValidation("address","req","Your address is required");	validate.addValidation("city","req","Your city is required");	validate.addValidation("state","req","Your state is required");	validate.addValidation("zip","req","Your zip code is required");	//validate.addValidation("email","req","Your email address is required");	//validate.addValidation("email","email","A valid email address is required");	validate.addValidation("deliverBy","req","A delivery deadline is required");	//now invoke the validator	if(document.tableForm.validateNow()){		document.tableForm.action="/orders/order_process.php";		document.tableForm.submit();	}else{		validate=0;	}}function modifyOrder(area,itemId,curPage){	//FIRST MAKE SURE THERE IS CURRENTLY NO VALIDATOR OBJECT TO GET IN OUR WAY	validate=0;	//alert('in modifyOrder');	//alert('in modifyOrder,area='+area+', itemId='+itemId+', curPage='+curPage);	openDivList=captureOpenDivs(area);	switch(area){		case "admin":			pathPrefix=window.top.bottomFrame.document;			break;		default:			pathPrefix=document;			break;	}	newQty=pathPrefix.tableForm[itemId].options[pathPrefix.tableForm[itemId].selectedIndex].text;	//alert(newQty);	goAction=pathPrefix.tableForm.action;	pathPrefix.tableForm.action=goAction+'?newQty='+newQty+'&itemId='+itemId+'&curPage='+curPage+"&openDivs="+openDivList;	pathPrefix.tableForm.submit();}function openIndexLink(type,loginArea,linkData){	switch(type){		case "select":			if(document.tableForm[linkData].options[document.tableForm[linkData].selectedIndex].text!="Select One"){				linkData=document.tableForm[linkData].options[document.tableForm[linkData].selectedIndex].value;				if(linkData && linkData!="title"){					closePopup2();					document.tableForm.loginArea.value=loginArea;					document.tableForm.linkVars.value=linkData;					document.tableForm.submit();				}			}			break;					case "selectFromPop":			if(popWin.document.tableForm[linkData].options[popWin.document.tableForm[linkData].selectedIndex].text!="Select One"){				linkData=popWin.document.tableForm[linkData].options[popWin.document.tableForm[linkData].selectedIndex].value;				if(linkData && linkData!="title"){					closePopup2();					document.tableForm.loginArea.value=loginArea;					document.tableForm.linkVars.value=linkData;					document.tableForm.submit();				}			}			break;			case "url":			document.tableForm.loginArea.value=loginArea;			document.tableForm.linkVars.value=linkData;			document.tableForm.submit();			break;					case "selectPop":			//create a popup window with the appropriate select list for the current index item			goURL('/marketing_materials/mm_popup.php?popType=selectList&recordID='+linkData,'popup',540,160,1,1)			return;			break;	}}function rescoSubmit(area){	//alert("in rescoSubmit, area="+area);	//gather any checkbox information about product association, as well as if a file and an image category have been selected.	switch(area){		case "popWin":			pathPrefix=popWin.document;			framePrefix=popWin;			break;		case "users":			pathPrefix=document;			framePrefix=window;			break;	}	//check for description	if(!pathPrefix.tableForm.description.value){		alert("You must enter a title/description for this item")		pathPrefix.tableForm.description.focus();		return;	}	//check for image category selection	if(pathPrefix.tableForm.mmCat.options[pathPrefix.tableForm.mmCat.selectedIndex].text=="Select One"){		alert("You must select an Item Category for this item.")		pathPrefix.tableForm.catSelect.focus();		return;	}	//check for increment	if(!pathPrefix.tableForm.increment.value){		alert("You must enter a quantity increment for this item")		pathPrefix.tableForm.increment.focus();		return;	}	//check for iterations	if(!pathPrefix.tableForm.iterations.value){		alert("You must enter quantity iterations for this item")		pathPrefix.tableForm.iterations.focus();		return;	}	//now check the associated products - NOTE that no product associations is ok, as long as there is an image category	assocProdString="";	allProds=framePrefix.frames['iframeProdNames'].document.getElementsByTagName('input');	for(i=0;i<allProds.length;i++){		if(allProds[i].checked){			if(assocProdString==""){				assocProdString+=allProds[i].name;			}else{				assocProdString+="~"+allProds[i].name;			}		}	}	//alert(assocProdString);	//now attach any value found for associated products to the hidden input element, 'assocProds'	pathPrefix.tableForm.assocProds.value=assocProdString;	//finally, submit the page	//alert("submitting image");	pathPrefix.tableForm.submit();}function imgLibSubmit(area){	//alert("in imgLibSubmit");	//gather any checkbox information about product association, as well as if a file and an image category have been selected.	switch(area){		case "popWin":			pathPrefix=popWin.document;			framePrefix=popWin;			break;		case "users":			pathPrefix=document;			framePrefix=window;			break;	}	//check to make sure an image has been selected for upload	if(area!='popWin' && !pathPrefix.tableForm.newImage.value){		alert("You must select an image file to submit.")		pathPrefix.tableForm.newImage.focus();		return;	}	//check for description	if(!pathPrefix.tableForm.description.value){		alert("You must enter a title/description for this image")		pathPrefix.tableForm.description.focus();		return;	}	//check for image category selection	if(pathPrefix.tableForm.catSelect.options[pathPrefix.tableForm.catSelect.selectedIndex].text=="Select One"){		alert("You must select an Image Category for this image.")		pathPrefix.tableForm.catSelect.focus();		return;	}	//now check the associated products - NOTE that no product associations is ok, as long as there is an image category	assocProdString="";	allProds=framePrefix.frames['iframeProdNames'].document.getElementsByTagName('input');	for(i=0;i<allProds.length;i++){		if(allProds[i].checked){			if(assocProdString==""){				assocProdString+=allProds[i].name;			}else{				assocProdString+="~"+allProds[i].name;			}		}	}	//alert(assocProdString);	//now, if the user selected to use this image in POSASAP, then there MUST be at least on associated product chosen	if(pathPrefix.tableForm.posasapUse.checked && assocProdString==""){		alert("You must select at least one associated product to use this image in P.O.S. ASAP.")		pathPrefix.tableForm.posasapUse.focus();		return;	}	//now attach any value found for associated products to the hidden input element, 'assocProds'	pathPrefix.tableForm.assocProds.value=assocProdString;	//finally, submit the page	//alert("submitting image");	pathPrefix.tableForm.submit();}function filterRecords(area){	//alert("in filterRecords, area="+area);	openDivList=captureOpenDivs(area);	switch(area){		case "admin":			pathPrefix=window.top.bottomFrame.document;			break;		default:			pathPrefix=document;			break;	}	goAction=pathPrefix.tableForm.action;	pathPrefix.tableForm.action=goAction+"?curPage=1&newFilters=1&openDivs="+openDivList;	pathPrefix.tableForm.submit();}function clearFilter(area){	//alert("in filterRecords, area="+area);	openDivList=captureOpenDivs(area);	switch(area){		case "admin":			pathPrefix=window.top.bottomFrame;			break;		default:			pathPrefix=window;			break;	}	goAction=pathPrefix.document.tableForm.action;	pathPrefix.location.href=goAction+"?curPage=1&newFilters=1&openDivs="+openDivList;}function flipPage(selectList,area,goPage){//alert("in flipPage, area="+area+" selectList="+selectList);	openDivList=captureOpenDivs(area);	switch(area){		case "admin":			pathPrefix=window.top.bottomFrame.document;			break;		default:			pathPrefix=document;			break;	}	goAction=pathPrefix.tableForm.action;	if(!goPage){		goPage=pathPrefix.tableForm[selectList].options[pathPrefix.tableForm[selectList].selectedIndex].text;	}	pathPrefix.tableForm.action=goAction+"?curPage="+goPage+"&openDivs="+openDivList;	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	switch(area){		case "admin":			pathPrefix=window.top.bottomFrame.document;			break;					default:			pathPrefix=document;			break;	}	x=pathPrefix.getElementsByTagName('div');	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(area=="admin"){area="adminBottom";}	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 removeOrder(removeBtn,curOrderID){	//alert("in removeOrder");	decision=confirm('Are you sure you want to remove this order?');	if(decision==true){		decision=confirm('Alert the RBM that this order has been received and approved?');		if(decision==true){			window.location='/orders/order_process.php?route=orderRemovedNotify&orderID=' + curOrderID;		}else{			window.location='/orders/order_process.php?route=orderRemoved&orderID=' + curOrderID;		}	}else{		//uncheck the checkox if it was checked by accident		document.tableForm[removeBtn].checked=false;	}}function orderShippedGate(curOrderID){	//alert('in posasapCloseGate');	//first make sure a shipment tracking number was entered	if(!document.tableForm.shipTracking.value){		alert('You must first enter a shipment tracking number before confirming order shipment.');		document.tableForm.shipTracking.focus();		return;	}else{		decision=confirm('Please confirm that this order has shipped.');		if(decision==true){			//set up variables for submission and submit the form for processing\			document.tableForm.orderID.value=curOrderID;			document.tableForm.route.value='posasapShipped';			document.tableForm.action='/orders/order_process.php';			document.tableForm.submit();			//window.location='/orders/order_process.php?route=posasapShipped&orderID=' + curOrderID;		}	}}function posasapCloseGate(loginArea,curUserID,curPage) {	//alert('in posasapCloseGate');	decision=confirm('Are you sure you want to leave P.O.S. ASAP? Any unsaved changes will be lost.');	if (decision==true) {		if(curPage){			window.location='/_libs/login_gate.php?loginArea=' + loginArea + '&userID=' + curUserID + '&curPage=' + curPage;		}else{			window.location='/_libs/login_gate.php?loginArea=' + loginArea + '&userID=' + curUserID;		}	}}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;	}	//note that this function resides in admin.js and will only invoke if admin.js is also available	refreshTables();}*/function closePopup2() {	//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) { 	//alert('in imageSwap')	imageInfo=null;	if ((imgObjPath=findObjectPath(objID))!=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;	}}//controls images swaping for both mouseEnter & mouseLeave actions on modelsfunction modelimageSwap(mouseDir,objID,model) { 	//alert('in imageSwap')	imageInfo=null;	if ((imgObjPath=findObjectPath(objID))!=null){  		switch (mouseDir) {			case'enter':  				newImgPath=stringReplace(imgObjPath.src,'_norm','_'+model);				imgObjPath.src = newImgPath;				//alert('enter path:'+newImgPath);				break;			case'leave':  				newImgPath=stringReplace(imgObjPath.src, '_'+model,'_norm');				imgObjPath.src = newImgPath;				//alert('leave path:'+newImgPath);				break;		}	}}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	switch(area){		case("popWin"):				pathPrefix=popWin.document;		break;				case("adminBottom"):		pathPrefix=window.top.bottomFrame.document;		break;				case("adminTop"):		pathPrefix=window.top.topFrame.document;		break;				default:		pathPrefix=document;		break;	}	//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;}//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;}//-->