/* Copyright 2002, Prelude Systems, Inc. All Rights Reserved. www.prelude.com Duplication,
Retransmission or Reproduction in part or whole is forbidden without Written Consent of Prelude Systems Inc. */
//var changeflag = false;
var multiMode=0;
function DocumentSubmit()
{
document.forms[0].submit();
}
function CursorWait()
{
this.window.status="Retrieving Data Please Wait";
if (navigator.appName == "Microsoft Internet Explorer")
{
document.body.style.cursor="wait";
}
}
function change()
{
var fieldName=getObj("changeflag");
fieldName.value="true";
// changeflag="true";
}
function changeMultiCart()
{
var fieldName=getObj("changeflag");
fieldName.value="true";
var AC=getObj("ActiveCartId");
if (typeof AC != "undefined")
{
AC.disabled=true;
}
multiMode=1;
}
function changeMultiFavorite()
{
var fieldName=getObj("changeflag");
fieldName.value="true";
var AF=getObj("ActiveFavoriteId");
if (typeof AF != "undefined")
{
AF.disabled=true;
}
multiMode=2;
}
function changeMultiCartAndFavorite()
{
var fieldName=getObj("changeflag");
fieldName.value="true";
var AC=getObj("ActiveCartId");
var AF=getObj("ActiveFavoriteId");
if (typeof AC != "undefined" && typeof AF != "undefined")
{
AC.disabled=true;
document.forms[0].ActiveCartId.disabled=true;
AF.disabled=true;
}
multiMode=3;
}
function checkChange(m9,autoPost,changedPrompt)
{
var fieldName=getObj("changeflag");
if (typeof fieldName != "undefined")
{
if (fieldName.value==null)
{
fieldName.value="false";
}
if (fieldName.value=="true")
{
// have to ask user to save changes
if (changedPrompt)
{
if (confirm(m9))
{
document.forms[0].submit();
}
}else
{
// data changed but not supposed to ask
if (autoPost)
{
document.forms[0].submit();
}
}
}
}
}
function convertText(qtyFieldName)
{
var pattern = /\s+/ig;
var txtFld=getObj(qtyFieldName);
var newVal=txtFld.value.replace(pattern,"^");
txtFld.value=newVal;
}
function replaceSpaces(conversionString)
{
var pattern = /\s+/ig;
var pattern2 = /\"+/ig;
conversionString = conversionString.replace(pattern,"^")
conversionString = conversionString.replace(pattern2,"{");
return conversionString;
}
function replaceVariable(conversionString,from,to)
{
conversionString = conversionString.replace(from,to)
return conversionString;
}
function specialReset()
{
//???? var activeFavorite=document.forms[0].ActiveFavoriteId.selectedIndex;
//alert("acttive favorite is "+activeFavorite);
document.forms[0].reset();
var activeFavoriteField=getObj("ActiveFavoriteId");
activeFavoriteId.setSelectedIndex=1;
}
function postIt()
{
var fieldName=document.getElementById('changeflag');
var activeCartId=getObj("ActiveCartId");
var activeFavoriteId=getObj("ActiveFavoriteId");
if (fieldName != null)
{
if (typeof fieldName != "undefined")
{
fieldName.value="false";
//alert("body unload event is "+document.body.onunload);
}
document.body.onunload="";
}
CursorWait();
if (multiMode==1 || multiMode==3)
{
activeCartId.disabled=false;
//document.forms[0].ActiveCartId.disabled=false;
}
if (multiMode==2 || multiMode==3)
{
//document.forms[0].ActiveFavoriteId.disabled=false;
activeFavoriteId.disabled=false;
}
document.forms[0].submit();
}
function postIt2()
{
var fieldName=document.getElementById('changeflag');
var activeCartId=getObj("ActiveCartId");
var activeFavoriteId=getObj("ActiveFavoriteId");
fieldName.value="true";
displayBlock("UpdateDiv10");
displayBlock("UpdateDiv11");
CursorWait();
if (multiMode==1 || multiMode==3)
{
ativeCartId.disabled=false;
}
if (multiMode==2 || multiMode==3)
{
activeFavoriteId.disabled=false;
}
document.forms[0].submit();
}
function postItnClose()
{
CursorWait();
document.forms[0].submit();
parent.close();
}
function doTip(evt,txt)
{
// depricated
}
function hideTip()
{
// Going to be Depricated in next Release
}
/** Code to place a checkmark for all products in the Mark For Favorites column.
This code needs to have a hidden field somewhere in the calling .jsp page to
work correctly which must be named tableLength and have VALUE equal to the
number of dataTable rows
Ex:
*/
function markAll()
{
var fieldName;
var formName=document.forms[0].name;
var length = eval("document." + formName + ".tableLength.value");
for (x=0; x < length; x++)
{
fieldName=getObj("ptcFlg_" + x);
if (typeof fieldName != "undefined")
{
fieldName.checked=true;
change();
}
}
}
function markAll1(lineNum)
{
var fieldName;
var formName=document.forms[0].name;
fieldName=getObj("ptcFlg_" + lineNum);
if (typeof fieldName != "undefined")
{
fieldName.checked=true;
}
change();
}
/**
This function will close the current browser window that calls this function
*/
function closeWindow()
{
parent.close();
}
/**
* This method checks to see if the user hit 'enter'. If they did, we either execute the form's POST method
* or the field's 'ONBLUR' event depending on what was passed in the 'mode' variable.
*/
function detectEnter(e,mode)
{
var nav4 = window.Event ? true : false;
if (nav4)
{
var whichCode = e.which
} else
{
if (e.type=="keypress")
{
var whichCode=e.keyCode
}
}
if (e.type == "keypress" && whichCode=="13")
{
if (mode == "post")
{
postIt();
} else
{
e.srcElement.blur();
}
}
}
/**
This function displays/hides a section of HTML code. Typically the block of code is
within tags that have an ID associated with them. You pass that tag id to this function.
*/
function displayBlock(elementId)
{
var styleObject = document.getElementById(elementId);
if (styleObject.style.display == "none")
{
styleObject.style.display = "";
} else
{
styleObject.style.display = "none";
}
}
function displayMenuBlock(elementId,menuGroup,selectedColor,unselectedColor,selectedBG,unselectedBG)
{
for (x=0;x<10;x++)
{
// reset all menu options to closed or none
var xstyleObject = getObj("menu_"+x);
if (xstyleObject != null)
{
xstyleObject.style.display = "none";
xstyleObject.style.color=unselectedColor;
xstyleObject.style.backgroundColor=selectedBG;
}
var xob= new getObj("menuGroup"+x);
// reset all menu groups to standard colors
if (xob.style != undefined)
{
xob.style.color=unselectedColor;
xob.style.backgroundColor=unselectedBG;
}
var styleObject = new getObj(elementId);
}
if (styleObject.style.display == "none")
{
styleObject.style.display = "";
// set menu group to different color so know its selected
var ob = new getObj(menuGroup);
ob.style.color =selectedColor;
ob.style.backgroundColor=selectedBG;
} else
{
styleObject.style.display = "none";
}
}
function displayMenuBlockImage(elementId,menuGroup,selectedBG,unselectedBG)
{
for (x=0;x<10;x++)
{
// reset all menu options to closed or none
var xstyleObject = getObj("menu_"+x);
if (xstyleObject != null && elementId != "menu_"+x )
{
xstyleObject.style.display = "none";
//?? setBackgroundImage(xstyleObject,unselectedBG);
}
var xob= new getObj("menuGroup"+x);
// reset all menu groups to standard colors
}
var styleObject = new getObj(elementId);
if (styleObject.style.display == "none")
{
styleObject.style.display = "";
// set menu group to different color so know its selected
var ob = new getObj(menuGroup);
ob.style.display="";
// ob.style.color =selectedColor;
// ob.style.backgroundColor=selectedBG;
// alert("ob is "+ob+" selected bg is "+selectedBG+" Unselected is "+unselectedBG);
// setBackgroundImage(ob,selectedBG);
} else
{
styleObject.style.display = "none";
}
}
function printWindow()
{
if (window.print)
{
window.print() ;
} else
{
var WebBrowser = '';
document.body.insertAdjacentHTML('beforeEnd', WebBrowser);
WebBrowser1.ExecWB(6, 2);//Use a 1 vs. a 2 for a prompting dialog box WebBrowser1.outerHTML = "";
}
}
function validatePhone(field,msg,country)
{
var formName=document.forms[0].name;
var areaCodePat = /(\d{3})-(\d{3})-(\d{4})/;
var fld = eval("document."+formName+"."+field);
var phone=fld.value;
var phoneMatch = phone.match(areaCodePat);
var countryCheck = eval("document."+formName+"."+country+".value");
if (phone != "" && phoneMatch == null && countryCheck == "US")
{
alert(msg);
fld.focus();
}
}
function validateZip(field,msg,country)
{
var formName=document.forms[0].name;
var zipCodePat = /(\d{5})-(\d{4})/;
var fld = eval("document."+formName+"."+field);
var zip = fld.value;
var zipMatch = zip.match(zipCodePat);
var countryCheck = eval("document."+formName+"."+country+".value");
if (zip.length > "5" && zip != "")
{
if (zipMatch == null && countryCheck == "US")
{
alert(msg);
fld.focus();
}
} else
{
if (zip != "" && zip.length < "5" && countryCheck == "US")
{
alert(msg);
fld.focus();
}
}
}
/**
This function validates the cart quantity that the user entered.
If the Enforce Min Sell Qty flag is "Y", then this function will verify that the quantity
entered is greater than the minimum sell qty AND is a multiple of the minimum selling quantity.
Currently the selling package quantity is only used to initially default the quantity but not
used for any kind of validation.
@param lineNum The line number of the product the user changed quantities on
@param minSellQty The minimum quantity is used is allowed to buy of this product. Also used
to see if the entered quantity is a multiple of this quantity
@param increment The quantity that will be added when the user hits the up arrow
@param defQty The quantity that defaults in the quantity box, comes from Selling Package Qty in ADS
@param inCartQty The current cart quantity that the user entered
@param enforceFlag Y/N flag to determine if we are enforcing the minimum sell quantities
@param minOrderQty is the limit the web user can purchase this products
@param maxOrderQty is the limit the web user can purchase for this product
@param M1 Resource DIALOG_NEUMERIC_ONLY
@param M2 Resource DIALOG_QTY_BELOW_MIN
@param M3 Resource DIALOG_QTY_NOT_MULTIPLE_PKG
@param M4 Resource DIALOG_QTY_BELOW_MIN_ORDER
@param M5 DIALOG_QTY_MAX_ORDER
@param boolean ShowMarkForcartField if false then must do autocheck else user must click it
@param boolean showChanged flag
*
*
*
*/
function qtyValidate(lineNum,minSellQty,increment,defQty,inCartQty,enforceFlag,minOrderQty,maxOrderQty,M1,M2,M3,M4,M5)
{
var currentQtyField = getObj("icQty_" + lineNum);
var currentQty = currentQtyField.value;
//eval("document.forms[0].icQty_" + lineNum + ".value");
//var ptcflagField = eval("document.forms[0].ptcFlg_"+lineNum);
var newCurrentQty=currentQty;
//if (showMarkForCart="false")
//{
// autoCheck=true;
//} else
//{
// autoCheck=false;
//}
if (isNaN(currentQty))
{
alert( M1);
currentQtyField.focus();
return 1;
}
var msg="";
if (currentQty.indexOf("+") > -1)
{
newCurrentQty = inCartQty + parseInt(currentQty);
} else if (currentQty.indexOf("-") > -1)
{
newCurrentQty = inCartQty + parseInt(currentQty);
}
if (enforceFlag && newCurrentQty!="0" && minSellQty!="0")
{
var remainder = newCurrentQty % increment;
if (newCurrentQty < minSellQty)
{
msg=M2;
msg=replaceVariable(msg,"$1",minSellQty);
currentQtyField.value = minSellQty;
currentQtyField.focus();
} else if (remainder > 0)
{
if (enforceFlag)
{
msg=M3;
msg=replaceVariable(msg,"$1",minSellQty);
currentQtyField.value = (newCurrentQty - remainder) + increment;
currentQtyField.focus();
}
}
}
if (minOrderQty!="0" && maxOrderQty!="0" && newCurrentQty!="0")
{
if (newCurrentQty < minOrderQty)
{
msg=M4;
qmsg=replaceVariable(msg,"$1",minSellQty);
currentQtyField.value = minOrderQty;
currentQtyField.focus();
} else
{
if (newCurrentQty > maxOrderQty)
{
msg=M5;
msg=replaceVariable(msg,"$1",minSellQty);
currentQtyField.value = maxOrderQty;
currentQtyField.focus();
}
}
}
if (msg != "")
{
alert(msg);
return 1;
} else
{
currentQtyField.value = newCurrentQty;
return 0;
}
}
/*
Date Check functions
*/
function checkdate(objName,leadTime,m1,m2)
{
var datefield = objName;
if (objName.value.length == 0)
{
return;
}
if (objName.value.length <6)
{
alert(m1);
datefield.select();
datefield.focus();
return false;
}
if (chkdate(objName) == false)
{
datefield.select();
alert(m1);
datefield.focus();
return false;
} else
{
if (checkLeadTime(objName,leadDate) == false)
{
var leadDate=calcLeadTimeDate(objName,leadTime);
alert(m2);
datefield.select();
datefield.focus();
return false;
} else
{
return true;
}
}
}
function chkdate(objName)
{
var strDatestyle = "US"; //United States date style
//var strDatestyle = "EU"; //European date style
var strDate;
var strDateArray;
var strDay;
var strMonth;
var strYear;
var intday;
var intMonth;
var intYear;
var booFound = false;
var datefield = objName;
var strSeparatorArray = new Array("-"," ","/",".");
var intElementNr;
var err = 0;
var strMonthArray = new Array(12);
strMonthArray[0] = "Jan";
strMonthArray[1] = "Feb";
strMonthArray[2] = "Mar";
strMonthArray[3] = "Apr";
strMonthArray[4] = "May";
strMonthArray[5] = "Jun";
strMonthArray[6] = "Jul";
strMonthArray[7] = "Aug";
strMonthArray[8] = "Sep";
strMonthArray[9] = "Oct";
strMonthArray[10] = "Nov";
strMonthArray[11] = "Dec";
strDate = datefield.value;
if (strDate.length < 1)
{
return true;
}
for (intElementNr = 0; intElementNr < strSeparatorArray.length; intElementNr++)
{
if (strDate.indexOf(strSeparatorArray[intElementNr]) != -1)
{
strDateArray = strDate.split(strSeparatorArray[intElementNr]);
if (strDateArray.length != 3)
{
err = 1;
return false;
} else
{
strDay = strDateArray[0];
strMonth = strDateArray[1];
strYear = strDateArray[2];
}
booFound = true;
}
}
if (booFound == false)
{
if (strDate.length>5)
{
strDay = strDate.substr(0, 2);
strMonth = strDate.substr(2, 2);
strYear = strDate.substr(4);
}
}
if (strYear.length < 2)
{
strYear=fmt00(strYear);
}
if (strYear.length == 2)
{
strYear = '20' + strYear;
}
// US style
if (strDatestyle == "US")
{
strTemp = strDay;
strDay = strMonth;
strMonth = strTemp;
}
intday = parseInt(strDay, 10);
if (isNaN(intday))
{
err = 2;
return false;
}
intday=fmt00(intday);
intMonth = parseInt(strMonth, 10);
if (isNaN(intMonth))
{
for (i = 0;i<12;i++)
{
if (strMonth.toUpperCase() == strMonthArray[i].toUpperCase())
{
intMonth = i+1;
strMonth = strMonthArray[i];
i = 12;
}
}
if (isNaN(intMonth))
{
err = 3;
return false;
}
}
intMonth=fmt00(intMonth);
intYear = parseInt(strYear, 10);
if (isNaN(intYear))
{
err = 4;
return false;
}
if (intMonth>12 || intMonth<1)
{
err = 5;
return false;
}
if ((intMonth == 1 || intMonth == 3 || intMonth == 5 || intMonth == 7 || intMonth == 8 || intMonth == 10 || intMonth == 12) && (intday > 31 || intday < 1))
{
err = 6;
return false;
}
if ((intMonth == 4 || intMonth == 6 || intMonth == 9 || intMonth == 11) && (intday > 30 || intday < 1))
{
err = 7;
return false;
}
if (intMonth == 2)
{
if (intday < 1)
{
err = 8;
return false;
}
if (LeapYear(intYear) == true)
{
if (intday > 29)
{
err = 9;
return false;
}
} else
{
if (intday > 28)
{
err = 10;
return false;
}
}
}
intYear=fmt00(intYear);
if (strDatestyle == "US")
{
datefield.value = fmt00(intMonth) + "/" + fmt00(intday)+"/" + fmt00(strYear);
} else
{
datefield.value = fmt00(intday) + " " + strMonthArray[intMonth-1] + " " + fmt00(strYear);
}
return true;
}
function LeapYear(intYear)
{
if (intYear % 100 == 0)
{
if (intYear % 400 == 0)
{
return true;
}
} else
{
if ((intYear % 4) == 0)
{
return true;
}
}
return false;
}
function doDateCheck(from, to)
{
if (Date.parse(from.value) <= Date.parse(to.value))
{
return true;
// alert("The dates are valid.");
} else
{
if (from.value == "" || to.value == "")
alert("Both dates must be entered.");
else
alert("To date must occur after the from date.");
}
}
function calcLeadTimeDate(dte,leadDays)
{
var sysDate=new Date();
var dys=sysDate.getDate()+leadDays;
var dateplusLead = new Date(sysDate.getYear(),sysDate.getMonth(),dys);
return dateplusLead;
}
function checkLeadTime(dte,leadDate)
{
var testDate = new Date(dte.value);
if ( testDate <= leadDate)
{
return false;
} else
{
return true;
}
}
function fmt00(b)
{
var d = b.value;
// fmt00: Tags leading zero onto numbers 0 - 9.
// Particularly useful for displaying results from Date methods.
//
if (parseInt(b) < 0) var neg = true;
if (Math.abs(parseInt(b)) < 10)
{
b = "0"+ Math.abs(b);
}
if (neg) b = "-"+b;
return b;
}
/**
* 1/16/04 (SRG) - made changes to clearField(), performSearch(), SearchDetectEnter() and convertSearch() to make
* the retrieval of fields more generic. Before we were relying on 'document.forms[0]....', but if we move the
* search function to somewhere like the menu bar, then the fields are not in a 'form' and must be retrieved some
* other way such as 'getElementsByName'.
*/
function clearField(s1)
{
var searchFld = document.getElementsByName("dsearchText");
if (searchFld[0].value == s1)
{
searchFld[0].value="";
}
}
/**
* Takes the contents of one variable 'searchString', converts spaces within it, checks for single character keywords
* and then passes the converted keyword to 'hfield'.
*/
function convertSearch(searchString,hfield,msg)
{
var pattern = /\s+/ig;
var pattern2 = /\"+/ig;
var formName=document.forms[0].name;
var sfld=document.getElementsByName(searchString);
/* this removes duplicate spaces */
var _regExp=/\s\s/gi;
var _foundStr="";
var newVal=sfld[0].value;
while (newVal.match(_regExp)!=null)
{
_foundStr=newVal.match(_regExp)[0];
newVal=newVal.replace(new RegExp(_foundStr,"gmi")," ");
}
var error=false;
var nstring=newVal.split(" ");
for (var i=nstring.length;i>=0;i--)
{
if ((nstring[i]!=null ))
{
if (nstring[i].length<=1)
{
alert(msg);
error=true;
}
}
}
/*convert spaces into ^ for transmission */
newVal=newVal.replace(pattern,"^");
newVal=newVal.replace(pattern2,"{");
var tfld=document.getElementsByName(hfield);
tfld[0].value=newVal;
if (error)
{
return false;
} else
{
return true;
}
}
/**
* Checks if the user hit the enter key. If we do find the enter key then we run the performSearch() routine.
* This method is only used from the search field in advertiseFrame.jsp.
*/
function SearchDetectEnter(e,msg)
{
var nav4 = window.Event ? true : false;
if (nav4)
{
var whichCode = e.which
} else
{
if (e.type=="keypress")
{
var whichCode=e.keyCode
}
}
if (e.type == "keypress" && whichCode=="13")
{
window.status= "Retrieving Data Please Wait";
performSearch(msg);
}
}
function performSearch(msg)
{
if (convertSearch('dsearchText','searchText',msg))
{
var keywords;
var searchFld = document.getElementsByName("searchText");
var refineFld = document.forms[0].refineButton;
if (refineFld != null)
{
if (refineFld.checked == true)
{
keywords = searchFld[0].value + "$REFINE$";
} else
{
keywords = searchFld[0].value;
}
} else
{
keywords = searchFld[0].value;
}
if (document.forms[0].req != null)
{
document.forms[0].req.value="viaListProducts.jsp?searchText="+keywords+"&modifier=SEARCH&reqTitle=TITLE_VIASEARCHRESULT";
}
document.forms[0].action="viaListProducts.jsp?searchText="+keywords+"&modifier=SEARCH&reqTitle=TITLE_VIASEARCHRESULT";
DocumentSubmit();
}
}
/** Code to place a checkmark for all products in the Delete Item column.
This code needs to have a hidden field somewhere in the calling .jsp page to
work correctly which must be named tableLength and have VALUE equal to the
number of dataTable rows
Ex:
*/
function DeleteAll()
{
var fieldName;
var formName=document.forms[0].name;
var qtyField;
var length = eval("document." + formName + ".tableLength.value");
for (x=0; x < length; x++)
{
qtyField=eval(getElementById("icQty_" + x));
qtyField.value = 0;
fieldName=getElementById(".ptcFlg_" + x);
if (typeof fieldName != "undefined")
{
fieldName.checked=true;
}
}
change();
postIt();
}
function textCounter( field, maxlimit,m1 )
{
if ( field.value.length > maxlimit )
{
m1=replaceVariable(m1,"$1",maxlimit);
field.value = field.value.substring( 0, maxlimit );
alert(m1);
return false;
}
}
function changeField(FieldName,vlu)
{
var formName=document.forms[0].name;
var txtFld=eval("document."+formName+"."+FieldName);
txtFld.value=vlu;
}
/**
* Code to display Changed Icon if Values of A product have been changed
*
* @param currentField Field which this function was called from, required as some should not trigger a Mark for cart call
* @param active results from Method called ot see if Show changed is enabled
* @param ShowMark results from method call to see if mark for cart is displayed
* @param prodLineNumber internal line number that you wish to set the changed icon for.
* @param soldonWebflag sold on web for the specific product you are dealing with
* */
function setChangedIcon(currentField,active,showMark,prodLineNumber,soldOnWeb)
{
if (active)
{
var ptcflagField = getObj("ptcFlg_"+prodLineNumber);
var chgfld=getObj("Changed_"+prodLineNumber);
chgfld.src=chgfld.src.replace(/Un/g,"");
}
if (!showMark && soldOnWeb=="Y" && currentField!="lsFlg_")
{
markForCart(prodLineNumber)
}
}
function UP(qtyFieldName,increment,lineNum,minSellQty,defQty,inCartQty,enforceFlag,minOrderQty,maxOrderQty,showChanged,showMark,soldOnWeb,autoPost)
{
if (increment > 0)
{
var formName=document.forms[0].name;
var qtyField=eval("document." + formName + "." + qtyFieldName);
var curQty=qtyField.value;
if (curQty!="")
{
qtyField.value=parseInt(curQty)+increment;
} else
{
qtyField.value=1;
}
qtyValidate(lineNum,minSellQty,increment,defQty,inCartQty,enforceFlag,minOrderQty,maxOrderQty);
setChangedIcon(qtyFieldName,showChanged,showMark,lineNum,soldOnWeb,autoPost);
}
}
function DOWN(qtyFieldName,increment,lineNum,minSellQty,defQty,inCartQty,enforceFlag,minOrderQty,maxOrderQty,showChanged,showMark,soldOnWeb,autoPost)
{
if (increment > 0)
{
var formName=document.forms[0].name;
var qtyField=eval("document." + formName + "." + qtyFieldName);
var origQty = qtyField.value;
var curQty=qtyField.value;
if ((curQty!="") && (parseInt(curQty) > 0))
{
qtyField.value=parseInt(curQty)-increment;
}
qtyValidate(lineNum,minSellQty,increment,defQty,inCartQty,enforceFlag,minOrderQty,maxOrderQty);
setChangedIcon(qtyFieldName,showChanged,showMark,lineNum,soldOnWeb,autoPost);
}
}
/**
* Code to Change String contents from a Field in Page ***NOTE*** Only to Be used for value Contents
*
* @param inField Field Name to change contents of
* @param oldString old string this can be space or multi character
* @param newString newString - new String this can be space or multi character
*/
function replaceString(inField,oldString,newString)
{
var chgFld=getObj(inField);
var pattern="/"+oldstring+"/g";
var pattern2 = /\s+/ig;
if (oldString==" " || newString==" ")
{
if (oldString==" ")
{
chgFld = chgFld.replace(pattern2,newString);
}
if (newString==" ")
{
chgFld=chgFld.replace(oldString,pattern2);
}
} else
{
chgfld=chgfld.replace(pattern,newString);
}
}
function markForCart(lineNum)
{
var fieldName;
fieldName=getObj("ptcFlg_"+lineNum);
//alert("fieldName is "+fieldName);
if (typeof fieldName != "undefined")
{
if (typeof fieldName =="checkbox")
{
fieldName.checked=true;
} else
{
fieldName.value="true";
}
}
change();
}
function highlightMenuOption(ImageName,imageUrl)
{
setBackgroundImage(ImageName,imageUrl);
}
function setBackgroundImage (id, imageURL)
{
if (document.layers)
document[id].background.src = imageURL == 'none' ? null : imageURL;
else if (document.all)
document.all[id].style.backgroundImage = imageURL == 'none' ? 'none' : 'url(' + imageURL + ')';
else if (document.getElementById)
document.getElementById(id).style.backgroundImage = imageURL == 'none' ? 'none' : 'url(' + imageURL + ')';
}
function blankprice(field,M10)
{
var fieldName;
fieldName=document.getElementById(field);
if (typeof fieldName != "undefined")
{
fieldName.innerHTML=M10;
}
return 0;
}
function getObj(name)
{
var obj;
if (document.all)
{
// Microsoft DOM code old ie 4
obj = document.all[name];
}
if (document.layers)
{
// Netscape DOM code ns 4
obj = document.layers[name];
}
if (document.getElementById)
{
// W3C DOM code newer browsers Gecko, Internet Explorer 5+, Opera 5+
obj = document.getElementById(name);
}
return obj;
}
function setListFlag(lineNum)
{
var dataField=getObj("listChanged_"+lineNum);
dataField.value="1";
}