1function ClickCancel(Destination,isTop){ 2 //if a cancel button is clicked do this. 3 //isTop is optional. 4 //if (Destination.length > 0 && confirm('Press \'OK\' to Cancel')){ 5 if (arguments[1]) 6 { 7 top.location.href = Destination; 8 } 9 else 10 { 11 location.href = Destination; 12 } 13 //} 14}//end of ClickCancel 15function jsTrim(inFieldValue){ 16 var inFieldLength = inFieldValue.length; 17 var i,startI,endI; 18 19 if (inFieldLength > 0){ 20 // 21 //start from beginning and find the fist non-space 22 // 23 for(i=0; i < inFieldLength; i++){ 24 25 if(inFieldValue.charAt(i) != ' '){ 26 startI = i; 27 i = inFieldLength; 28 } 29 } 30 // 31 //start from end and find the first non-space 32 // 33 for(i=inFieldLength-1; i >= 0; i--){ 34 //alert(inFieldValue.charAt(i)) 35 if(inFieldValue.charAt(i) != ' '){ 36 endI = i+1; 37 i = 0; 38 } 39 } 40 //alert('->'+inFieldValue.substring(startI,endI)+'<-'); 41 return inFieldValue.substring(startI,endI) 42 }//end of if() 43 else {return '';} 44}//end of jsTrim 45function NumericCheck(inForm,inElement) { 46 var re = /\,|\$|\./gi; 47 var formItem,formItem; 48 var i,returnNum; 49 50 // 51 //verify number is numeric 52 // 53 //GET element value 54 formItem = (GetVal(inForm, inElement)); 55 //remove all '$' ; '.' ; ',' 56 formItemre = formItem.replace(re, ""); 57 //check to see if number is numeric or base 10 58 if ( (parseInt(formItemre,10) !=formItemre) && formItemre != "" ) { 59 alert(inElement + " must be numeric"); 60 return false; 61 } 62 63 // 64 //Format number to display to customer 65 // 66 //remove '$' ; ',' 67 re = /\,|\$/gi; 68 formItemre = formItem.replace(re,"") 69 //split upon decimal 70 formItemre = formItemre.split("."); 71 //check to see if there are more than one decimal 72 if (formItemre.length > 2 ) { 73 alert(inElement + " has too many decimal points"); 74 return false; 75 } 76 //set returnNum = nothing 77 returnNum = ""; 78 //build return number to set in textbox 79 for(i=0;i<formItemre.length;i++){ 80 if (i>0){returnNum = returnNum + '.'} 81 returnNum = returnNum + formItemre[i]; 82 } 83 84 //Set the text value 85 SetVal(inForm,inElement,returnNum); 86 return true; 87}//end of NumericCheck() 88function jsTB(inName,inValue,inSize,inMaxLength){ 89 var T = ''; 90 var Size = 25; 91 var MaxLength = 255; 92 if (arguments[2]) 93 { 94 Size = inSize 95 } 96 if (arguments[3]) 97 { 98 MaxLength = inMaxLength 99 } 100 T += '<input type="text" name="'+inName+'" id="'+inName+'" value="'+inValue+'" class="FormElementInput" size="'+Size+'" maxlength="'+MaxLength+'" />'; 101 return T; 102}//end of jsTB 103function jsHI(inName,inValue){ 104 var H; 105 var hValue = ''; 106 if (arguments[1]) 107 { 108 hValue = inValue; 109 } 110 H = '<input type="hidden" name="'+inName+'" value="'+hValue+'" />' 111 return H; 112}//end of jsHI 113function GetFileExt(inImage){ 114 var ImageLength = inImage.length; 115 var tmpStr = ''; 116 if (ImageLength > 0){ 117 for (var i=(ImageLength-3); i<ImageLength; i++){ 118 tmpStr+= inImage.charAt(i); 119 } 120 return tmpStr.toLowerCase(); 121 }else{return false;} 122} 123function MakeThumbString(inImage){ 124 var ImageLength = inImage.length; 125 var tmpStr = ''; 126 if (ImageLength > 0){ 127 for (var i=0; i<ImageLength; i++){ 128 tmpStr+= inImage.charAt(i); 129 if (i == ImageLength-5){ 130 tmpStr+= '_thumb'; 131 } 132 } 133 return tmpStr.toLowerCase(); 134 }else{return false;} 135} 136 137 138 139function InventoryEntry(){ 140 this.Modifiers=new String(); 141 this.QtyOnHand=0; 142 this.AllowBackorder=false; 143 this.ItemCode= new String(); 144 this.ItemPrice = 0; 145 this.aryMod = new Array(); 146 this.ItemID = 0; 147 this.ItemConcurrencyID = 0; 148 this.Image = null; 149 this.UPC = ''; 150 this.HasUpload = false; 151 this.Active = true; 152 this.inStockMessage = 'YES'; 153 this.outOfStockMessage = 'NO - On Backorder.'; 154} 155 156InventoryEntry.prototype.AddModifier = function(ID){ 157 var doesExist = false; 158 159 for(var i=0; i<this.aryMod.length; i++) 160 if(parseInt(this.aryMod[i]) == parseInt(ID)) { 161 doesExist = true; 162 break; 163 } 164 165 if(!doesExist) 166 { 167 this.aryMod.push(ID); 168 this.aryMod.sort(); 169 this.Modifiers = this.aryMod.join(','); 170 } 171} 172 173InventoryEntry.prototype.isAvailable = function(Qty, Name){ 174 if (this.AllowBackorder) return true; 175 if (parseInt(this.QtyOnHand) >= parseInt(Qty)) return true; 176 if(parseInt(this.QtyOnHand) <= 0) 177 { 178 alert(Name + ' is currently out of stock.'); 179 180 }else 181 { 182 alert(Name + ' is only available in quantities of ' + this.QtyOnHand.toString() + ' or less.'); 183 } 184 return false; 185} 186//keep native code of Array.push function, so if you need restore the native code of Array.push, just write this:Array.prototype.push=ArrayPushNativeCode; 187var ArrayPushNativeCode=new Array().push; 188 189//revert array.push back to what it was. no need for this since it seems to not seem to add new features needed. 190/*Array.prototype.push = function(value){ 191 this[this.length] = value; 192}*/ 193 194//array of atts in form of NonInvAtts['a<modid>'] = true (if modid is a noninvatt) 195var NonInvAtts = new Object(); 196var aModData = new Array(); 197 198function AddToItemData(ItemData, ModID, ModName, ModAddDesc, ModTypeName, ModBriefDesc, Price, ItemCode, Onhand, Methods, Backorder, ItemID, ItemConcurrencyID, ItemImage, ModOneTime, UniqueImages, ModImage, ModHasUpload, ItemHasUpload, ItemUPC, ModDesc, ModHasTax, ItemActive, ItemInStock, ItemOutStock) 199{ 200 201 if(ItemData['Modifiers'] == null){ 202 ItemData['Modifiers'] = new Array(); 203 } 204 205 if(ItemData['Modifiers'][ModTypeName] == null){ 206 ItemData['Modifiers'][ModTypeName] = new Array(); 207 ItemData['Modifiers'][ItemData['Modifiers'].length] = ModTypeName; 208 } 209 210 var sItemUPC = '', bItemUpload = false, bItemActive = true; 211 var sItemInStock = '', sItemOutStock = ''; 212 var ModifierData = new Object(); 213 214 ModifierData.ID = ModID; 215 ModifierData.Name = ModName;
216 ModifierData.AddDesc = ModAddDesc; 217 ModifierData.IsInventory = ModBriefDesc; 218 ModifierData.Price = Price; 219 ModifierData.OneTime = false; 220 ModifierData.HasUniqueImages = false; 221 ModifierData.HasUpload = false; 222 ModifierData.HasTax = false; 223 ModifierData.Description = ''; 224 ModifierData.ModImage = ''; 225 226 switch(arguments.length) 227 { 228 case 25: sItemOutStock = ItemOutStock; 229 case 24: sItemInStock = ItemInStock; 230 case 23: bItemActive = ItemActive; 231 case 21: ModifierData.HasTax = ModHasTax; 232 case 21: ModifierData.Description = ModDesc; 233 case 20: sItemUPC = ItemUPC; 234 case 19: bItemUpload = ItemHasUpload; 235 case 18: ModifierData.HasUpload = ModHasUpload; 236 case 17: ModifierData.ModImage = ModImage; 237 case 16: ModifierData.HasUniqueImages = UniqueImages; 238 case 15: ModifierData.OneTime = ModOneTime; 239 } 240 241 //only add modifier data if not already added 242 if(ItemData['Modifiers'][ModTypeName]['a' + ModName.toString()] == null){ 243 ItemData['Modifiers'][ModTypeName].push(ModifierData); 244 ItemData['Modifiers'][ModTypeName]['a' + ModName.toString()] = true; 245 } 246 247 //this modifier has an image associated with it 248 if(Boolean(UniqueImages)) { 249 AddToModifierData(aModData, ModTypeName, ModID); 250 } 251 252 //this modifier is not associated with an item. 253 if (ItemCode == null || ItemCode == ''){ 254 NonInvAtts['a' + ModID] = true; 255 return false; 256 } 257 NonInvAtts['a' + ModID] = false; 258 259 //add to item definition 260 var ItemCode1 = 'item' + ItemCode.toString(); 261 if (ItemData[ItemCode1] == null){ 262 ItemData[ItemCode1] = new InventoryEntry(); 263 ItemData[ItemCode1].QtyOnHand = Onhand; 264 ItemData[ItemCode1].AllowBackorder = Backorder; 265 ItemData[ItemCode1].ItemCode = ItemCode; 266 ItemData[ItemCode1].ItemPrice = Price; 267 ItemData[ItemCode1].ItemID = ItemID; 268 ItemData[ItemCode1].Image = ItemImage; 269 ItemData[ItemCode1].ItemConcurrencyID = ItemConcurrencyID; 270 ItemData[ItemCode1].HasUpload = bItemUpload; 271 ItemData[ItemCode1].UPC = sItemUPC; 272 ItemData[ItemCode1].Active = ItemActive; 273 if(sItemInStock.length > 0) ItemData[ItemCode1].inStockMessage = sItemInStock; 274 if(sItemOutStock.length > 0) ItemData[ItemCode1].outOfStockMessage = sItemOutStock; 275 ItemData[ItemData.length] = ItemCode1; 276 } 277 278 ItemData[ItemCode1].AddModifier(ModID); 279 ItemData[ItemCode1].ItemPrice += Price; 280 281 return true; 282} 283 284function GetModString(ProductID){ 285 var x; 286 var Mods = new Array(); 287 var str; 288 var Props = GetTags('ProductProp' + ProductID.toString()); 289 290 for(x = 0; x < Props.length;x++){ 291 str = Props[x].value; 292 str = str.split(String.fromCharCode(28)); 293 294 if (NonInvAtts['a' + str[1]] == false){ 295 if (str[3]=='false' || str[3] == '0'){ 296 Mods.push(str[1]); 297 }} 298 299 } 300 301 Mods.sort(); 302 return Mods.join(','); 303} 304 305function GetInventoryEntry(ItemData, ProductID){ 306 307 var strMod = GetModString(ProductID); 308 for(x = 0; x < ItemData.length;x++){ 309 if (ItemData[ItemData[x]].Modifiers == strMod){ 310 return ItemData[ItemData[x]]; 311 } 312 } 313 return null; 314} 315 316function GetInventoryEntryByModString(ItemData, strMod){ 317 318 var x; 319 for(x = 0; x < ItemData.length;x++){ 320 if (ItemData[ItemData[x]].Modifiers == strMod){ 321 return ItemData[ItemData[x]]; 322 } 323 } 324 325 return null; 326} 327 328function MultiItemDatas(){ 329 this.ItemDatas = new Array(); 330} 331 332MultiItemDatas.prototype.AddToItemDatas = function(ProductID, ModID, ModName, ModAddDesc, ModTypeName, ModBriefDesc, Price, ItemCode, Onhand, Methods, Backorder, BasePrice, ItemID, ItemConcurrencyID, ItemImage, ModOneTime, UniqueImages, ModImage, ModHasUpload, ItemHasUpload, ItemUPC, ModDesc, ModHasTax, ItemActive, ItemInStock, ItemOutStock) 333{ 334 //if(this.ItemDatas == null) this.ItemDatas = new Array(); 335 336 if (this.ItemDatas[ProductID.toString()] == null){ 337 this.ItemDatas[ProductID.toString()] = new Array(); 338 this.ItemDatas[ProductID.toString()]['BasePrice']=BasePrice; 339 this.ItemDatas[this.ItemDatas.length] = ProductID.toString(); 340 } 341 342 var ItemData; 343 ItemData = this.ItemDatas[ProductID.toString()]; 344 345 AddToItemData(ItemData, ModID, ModName, ModAddDesc, ModTypeName, ModBriefDesc, Price, ItemCode, Onhand, Methods, Backorder, ItemID, ItemConcurrencyID, ItemImage, ModOneTime, UniqueImages, ModImage, ModHasUpload, ItemHasUpload, ItemUPC, ModDesc, ModHasTax, ItemActive, ItemInStock, ItemOutStock); 346} 347
348function DisplayProductDetail(ProductID, ItemData, onChange, Between, Spacer){ 349 350 //var ItemData = ItemDatas.ItemData[ProductID.toString()]; 351 352 var Modifiers = ItemData['Modifiers']; 353 var out = '<table border=0 cellspacing=0 cellpadding=0>'; 354 var i; 355 if (Modifiers != null){ 356 for(i=0;i<Modifiers.length;i++){ 357 //alert('drawing modifiers of type: ' + Modifiers[i] + ' out of ' + Modifiers.length); 358 //DrawModifierSelect(ProductID, Modifiers[Modifiers[i]], Modifiers[i], onChange, Between, Spacer); 359 if(Modifiers[i].length>0)out += GetModifierSelectRow(ProductID, Modifiers[Modifiers[i]], Modifiers[i], onChange, Between, Spacer); 360 361 } 362 } 363 out += '</table>'; 364 if (GetTag('ProductModifiers' + ProductID.toString()) != null) 365 GetTag('ProductModifiers' + ProductID.toString()).innerHTML = out; 366} 367 368function DrawModifierSelect(ProductID, Modifiers, TypeName, onChange, Between, Spacer){ 369 370 var Div =GetTag('ProductModifiers' + ProductID.toString()); 371 var AddDescLabel; 372 var AddDescHidden; 373 var Opt; 374 var Delim = String.fromCharCode(28); 375 376 //var Sel = document.createElement("select"); 377 var re = /,/gi; 378 379 var SelData = '<Select name="' + 'ProductProp' + ProductID.toString() + '" '; 380 var AddDescHidden = ''; 381 var AddDesc = false; 382 var OptionsString = new String(); 383 for(var i = 0; i < Modifiers.length;i++){ 384 385 Opt = new String(); 386 Opt = Modifiers[i].Name.toString() + (Modifiers[i].Price?' (' + (Modifiers[i].Price>0?'+':'') + formatCurrency(Modifiers[i].Price) +')':''); 387 388 OptionsString += '<option value="' + Modifiers[i].Name.toString().replace(re, '') + Delim + Modifiers[i].ID + Delim 389 + Modifiers[i].Price + Delim + Modifiers[i].AddDesc + Delim + TypeName + Delim + Modifiers[i].OneTime + Delim + Modifiers[i].HasUpload 390 + Delim + Modifiers[i].HasTax + '">' + Opt + '</option>'; 391 392 if(Modifiers[i].AddDesc) AddDesc = true; 393 if((AddDesc == true) && (AddDescHidden == '')) 394 { 395 AddDescLabel = Opt + ': '; 396 AddDescHidden = '<input type="hidden" name="' + 'ProductProp' + ProductID.toString() + '" value="' + Modifiers[i].Name.toString().replace(re, '') + Delim + Modifiers[i].ID + Delim + Modifiers[i].Price + Delim + Modifiers[i].AddDesc + Delim + TypeName + '">'; 397 } 398 } 399 400 SelData += 'onchange="' + onChange + '" '; 401 402 SelData += 'onkeyup="' + onChange + '" '; 403 404 SelData += 'onmouseup="' + onChange + '" '; 405 406 SelData += 'attType="Select" >'; 407 408 if(Between == null) Between=''; 409 if(Spacer == null) Spacer=' '; 410 411 if (AddDesc){ 412 var Reg = new RegExp("Message", "gi"); 413 if(Reg.test(TypeName)){ 414 Between = ' <TextArea rows=3 cols=35 onBlur="CheckTextArea(this, 210)" name="AddDesc' + TypeName + ProductID + '" onfocus="if (this.value == \'<'+ TypeName +'>\') this.value=\'\';"><'+ TypeName +'></textarea> ' + Between; 415 }else{ 416 Between = ((Modifiers.length > 1)?'<br>':' ') + '<input maxlength=210 type="text" name="AddDesc' + TypeName + ProductID + '" value="<'+ TypeName +'>" onfocus="if (this.value == \'<'+ TypeName +'>\') this.value=\'\';"> ' + Between; 417 }
418 document.write('<input type="hidden" name="AddDescNames' + ProductID + '" value="' + TypeName + '"'); 419 } 420 421 if(AddDesc){ 422 //alert(AddDescHidden); 423 Div.innerHTML+= Spacer.toString() + AddDescHidden + AddDescLabel + Between; 424 }else{ 425 Div.innerHTML+= (jsTrim(TypeName).replace(' ', ' ') + ':') + Spacer.toString() + SelData + OptionsString + '</SELECT>' + Between; 426 } 427} 428 429var RequiredFields = new Array(); 430 431function GetModifierSelectRow(ProductID, Modifiers, TypeName, onChange){ 432 var AddDescLabel; 433 var AddDescHidden; 434 var Opt; 435 var Delim = String.fromCharCode(28); 436 437 //var Sel = document.createElement("select"); 438 var re = /,/gi; 439 440 var SelData = '<Select class="comProdDropDown" name="' + 'ProductProp' + ProductID.toString() + '" '; 441 var Hidden = '<input type="hidden" name="ProductProp' + ProductID.toString() + '" value="'; 442 var AddDescHidden = ''; 443 var AddDesc = false; 444 var OptionsString = new String(); 445 for(var i = 0; i < Modifiers.length;i++){ 446 447 Opt = new String(); 448 Opt = Modifiers[i].Name.toString() + (Modifiers[i].Price?' (+'+ formatCurrency(Modifiers[i].Price) +')':''); 449 450 OptionsString += '<option value="' + Modifiers[i].Name.toString().replace(re, '') + Delim + Modifiers[i].ID + Delim + Modifiers[i].Price + Delim + Modifiers[i].AddDesc + Delim + TypeName + Delim + Modifiers[i].OneTime + Delim + Modifiers[i].HasUpload + '">' + Opt + '</option>'; 451 Hidden += Modifiers[i].Name.toString().replace(re, '') + Delim + Modifiers[i].ID + Delim + Modifiers[i].Price + Delim + Modifiers[i].AddDesc + Delim + TypeName + Delim + Modifiers[i].OneTime + Delim + Modifiers[i].HasUpload + '"/>'; 452 453 if(Modifiers[i].AddDesc) AddDesc = true; 454 if((AddDesc == true) && (AddDescHidden == '')) 455 { 456 AddDescLabel = Opt + ': '; 457 if(typeof Modifiers[i].OneTime != 'undefined') 458 { 459 AddDescHidden = '<input type="hidden" name="' + 'ProductProp' + ProductID.toString() + '" value="' + Modifiers[i].Name.toString().replace(re, '') + Delim + Modifiers[i].ID + Delim + Modifiers[i].Price + Delim + Modifiers[i].AddDesc + Delim + TypeName + Delim + Modifiers[i].OneTime + '">'; 460 } 461 else 462 { 463 AddDescHidden = '<input type="hidden" name="' + 'ProductProp' + ProductID.toString() + '" value="' + Modifiers[i].Name.toString().replace(re, '') + Delim + Modifiers[i].ID + Delim + Modifiers[i].Price + Delim + Modifiers[i].AddDesc + Delim + TypeName + '">'; 464 } 465 } 466 } 467 468 SelData += 'onchange="' + onChange + '" '; 469 470 SelData += 'onkeyup="' + onChange + '" '; 471 472 SelData += 'onmouseup="' + onChange + '" '; 473 474 SelData += 'attType="Select" >'; 475 476 var FirstOption; 477 switch(Modifiers[0].Description.toString().toLowerCase()) 478 { 479 case 'yes': 480 SelData += '<option value="">Select ' + TypeName + '</option>'; 481 FirstOption = true; 482 break; 483 case 'no': 484 //SelData += '<option value="">' + TypeName + '</option>'; 485 FirstOption = false; 486 break; 487 case 'undefined': 488 //nothing 489 break; 490 default: 491 if(Modifiers[0].Description.toLowerCase().length>0)SelData += '<option value="">' + Modifiers[0].Description + '</option>' 492 FirstOption = true; 493 break; 494 } 495 496 var Between=''; 497 var Spacer=' '; 498 if (AddDesc){ 499 if (ProductID.toString().indexOf('-') > 0) 500 { 501 pID = ProductID.split('-'); 502 pID = pID[1]; 503 }else{ 504 pID = ProductID; 505 } 506 RequiredFields[RequiredFields.length] = 'AddDesc' + TypeName + pID; 507 var Reg = new RegExp("Message", "gi"); 508 if(Reg.test(TypeName)){ 509 Between = '</td><td> </td></tr><tr><td colspan=2><TextArea touched="false" rows=3 style="width:100%;" onBlur="CheckTextArea(this, 210)" id="AddDesc' + TypeName + pID + '" name="AddDesc' + TypeName + pID + '" onfocus="this.touched = \'true\'; if (this.value == \'<'+ TypeName +'>\') this.value=\'\';"><'+ TypeName +'></textarea> ' + Between; 510 }else{ 511 Between = ((Modifiers.length > 1)?'<br>':' ') + '<input onfocus="this.touched = \'true\';if (this.value == \'<'+ TypeName +'>\') this.value=\'\';" touched="false" maxlength=210 type="text" id="AddDesc' + TypeName + pID + '" name="AddDesc' + TypeName + pID + '" value="<'+ TypeName +'>"'; 512 Reg = new RegExp("Email", "gi"); 513 Between += ' onfocus="if (this.value == \'<'+ TypeName +'>\') this.value=\'\';"> '; 514 if(Reg.test(TypeName)){ 515 AddDescLabel += '<div style="padding-top:2px;padding-bottom:2px;font-weight:bold;">Please re-type recipient email!</div>'; 516 Between += '<BR> <input type="text" maxlength="210" value="<Confirm Email>
516" id="ConfirmEmail' + TypeName + pID + '" onblur="compareEmails(\'AddDesc' + TypeName + pID + '\',this);">'; 517 } 518 } 519 document.write('<input type="hidden" name="AddDescNames' + pID + '" value="' + TypeName + '"'); 520 } 521 var out = ''; 522 if(AddDesc){ 523 //alert(AddDescHidden); 524 out = '<tr><td valign="top">' + AddDescHidden + AddDescLabel + '</td><td align="left">' + Between + '</td></tr>'; 525 } 526 if(Modifiers.length == 1 && !FirstOption){ 527 if(out.length > 0) {return out;}else{ 528 return '<tr><td valign="top">' + (jsTrim(TypeName).replace(' ', ' ') + ':') + ' </td><td> ' + Opt + Between+ Hidden +'</td></tr>'; 529 } 530 }else{ 531 return '<tr><td valign="top">' + (jsTrim(TypeName).replace(' ', ' ') + ':') + ' </td><td>' + SelData + OptionsString + '</SELECT>' + Between+ '</td></tr>'; 532 } 533 534} 535 536function compareEmails(OrigEmail,tag) 537{ 538 var eml = document.getElementById(OrigEmail).value; 539 540 if( /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/.test(eml)){ 541 //do nothing 542 }else{ 543 alert('Invalid email address.'); 544 //tag.focus(); 545 try { document.getElementById("addtocartBT").disabled = true; } catch(e) {} 546 return false; 547 } 548 if(tag.value != eml){ 549 alert('email addresses don\'t match, please check and try again.'); 550 tag.focus(); 551 try { document.getElementById("addtocartBT").disabled = true; } catch(e) {} 552 tag.style.backgroundColor = "#FEFBB4"; 553 return false; 554 } 555 556 try { document.getElementById("addtocartBT").disabled = false; } catch(e) {} 557 tag.style.backgroundColor = "#FFFFFF"; 558 559} 560 561function stCheckEmail(tag){ 562 563 var eml = tag.value; 564 565 if( /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/.test(eml)){ 566 //do nothing 567 }else{ 568 alert('Invalid email address.'); 569 tag.focus(); 570 return false; 571 } 572 573 if(prompt("Please confirm the recipient's email address.", "re-enter email here") != eml){ 574 alert('email addresses don\'t match, please check and try again.'); 575 tag.focus(); 576 return false; 577 } 578 579 580 581} 582 583function CheckTextArea(tag, max){ 584 if (tag.value.length > max){ 585 tag.focus(); 586 alert("This field must be " + max + " characters or less in length."); 587 588 } 589} 590function formatCurrency(num) { 591 var symbol="$"; 592 try{ 593 if(cfgPointsStore.toString().toLowerCase()=="true"){ 594 symbol=""; 595 } 596 }catch(ex){} 597 num = num.toString().replace(/\$|\,/g,''); 598 if(isNaN(num)) 599 num = "0"; 600 sign = (num == (num = Math.abs(num))); 601 num = Math.floor(num*100+0.50000000001); 602 cents = num%100; 603 num = Math.floor(num/100).toString(); 604 if(cents<10) 605 cents = "0" + cents; 606 for (var i = 0; i < Math.floor((num.length-(1+i))/3); i++) 607 num = num.substring(0,num.length-(4*i+3))+','+ 608 num.substring(num.length-(4*i+3)); 609 return (((sign)?'':'-') + symbol + num + '.' + cents); 610} 611 612var ResizeTimeout = new Array(); 613var ResizeImg1 = new Array(); 614var ResizeMaxW = new Array(); 615var ResizeMaxH = new Array(); 616 617function ResizeToFitBounds(Img1, MaxW, MaxH){ 618 619 ResizeImg1.push(Img1); 620 ResizeMaxW.push(MaxW); 621 ResizeMaxH.push(MaxH); 622 623 ResizeTimeout.push(setInterval('ResizeToFitBoundsDelayed('+ ResizeTimeout.length.toString() +')', '600')); 624} 625 626function ResizeToFitBoundsDelayed(Idx){ 627 //alert(Idx); 628 629 630 var Img1 = ResizeImg1[Idx]; 631 var MaxW = ResizeMaxW[Idx]; 632 var MaxH = ResizeMaxH[Idx]; 633 634 635 var Img = new Object(); 636 Img.src = Img1.src; 637 var imgAspect = Img1.width / Img1.height; 638 var newAspect = MaxW / MaxH; 639 640 //alert(imgAspect.toString() + ' to ' + newAspect.toString()); 641 //return true; 642 //image is proportional 643 if(imgAspect == newAspect){ 644 Img.width = MaxW; 645 Img.height = MaxH; 646 } 647 648 if (imgAspect > newAspect){ 649 //bound by width 650 Img.height = (MaxW * Img1.height) / Img1.width; 651 Img.width = MaxW; 652 }else{ 653 //bound by height 654 Img.width = (MaxH * Img1.width) / Img1.height; 655 Img.height = MaxH; 656 } 657 658 if (isNaN(Img.width)|| isNaN(Img.height)){ 659 660 }else{ 661 Img1.width = Img.width; 662 Img1.height = Img.height; 663 clearInterval(ResizeTimeout[Idx]); 664 //alert('cleared ' + Img.width.toString() + ' x ' + Img.height.toString()); 665 } 666} 667 668function AddToModifierData(ModifierData, TypeID, ModifierID){ 669 if(ModifierData['type:' + TypeID.toString()] == null){ 670 ModifierData.push('type:' + TypeID.toString()) ; 671 ModifierData['type:' + TypeID.toString()] = new Array(); 672 } 673 674 ModifierData['type:' + TypeID.toString()].push(ModifierID); 675} 676 677function GetModifierCombos(ModifierData, TypeIndex, Prepend, aryOut){ 678 if (ModifierData[ModifierData[TypeIndex]] == null) return false; 679 if(aryOut == null) aryOut = new Array(); 680 681 if(TypeIndex == ModifierData.length - 1){ 682 for(var x = 0;x<ModifierData[ModifierData[TypeIndex]].length;x++){ 683 var sCombo = Prepend + ModifierData[ModifierData[TypeIndex]][x].toString();
684 sCombo = sCombo.split(',').sort(NumStringSorter).join(','); 685 //alert(sCombo); 686 if(aryOut['dat' + sCombo] == null){ 687 aryOut['dat' + sCombo] = true; 688 aryOut['ModifierIDX:' + sCombo] = aryOut.length; 689 aryOut.push(sCombo); 690 } 691 } 692 }else{ 693 for(var x = 0;x<ModifierData[ModifierData[TypeIndex]].length;x++){ 694 GetModifierCombos(ModifierData, TypeIndex + 1, Prepend + ModifierData[ModifierData[TypeIndex]][x].toString() + ',', aryOut); 695 } 696 } 697} 698 699function GetModifierIDCombosForImages() 700{ 701 var ary = new Array(); 702 703 GetModifierCombos(aModData, 0, '', ary); 704 705 return ary; 706} 707 708function NumStringSorter(a, b) 709{ 710 return (Number(a) - Number(b)); 711} 712 713function SortString(strText){ 714var ar; 715 ar = strText.split(","); 716 ar.sort(); 717 718 return ar.join(","); 719} 720 721//this was added in for adding list items. currently booleans will not work correctly, so boolean datatypes are not allowed 722function COMttSelect(tag, aryTypes, selectedID, formName, tagName, aryDisplay) 723{ 724 //!! 725 //!tag CANNOT EQUAL tagName! 726 //!! 727 try 728 { 729 var strSelect = '<select name=\"' + tagName + '\" id=\"' + tagName + '\">'; 730 tag = GetTag(tag); 731 732 var SEL = document.createElement('select'); 733 var OPT = null; 734 735 SEL.id = tagName; 736 SEL.name = tagName; 737 if(arguments[5]) 738 { 739 for(var i = 0; i < aryDisplay.length; i++) 740 { 741 if(aryDisplay[i][0].toString().toLowerCase() != 'boolean') 742 { 743 OPT = document.createElement('option'); 744 OPT.value = aryDisplay[i][1]; 745 OPT.appendChild(document.createTextNode(aryDisplay[i][0])); 746 SEL.appendChild(OPT); 747 } 748 } 749 } 750 for(var i = 0; i < aryTypes.length; i++) 751 { 752 if(aryTypes[i][0].toString().toLowerCase() != 'boolean') 753 { 754 OPT = document.createElement('option'); 755 OPT.value = aryTypes[i][1]; 756 OPT.appendChild(document.createTextNode(aryTypes[i][0])); 757 758 if(aryTypes[i][1] == selectedID) 759 { 760 OPT.selected = true; 761 } 762 763 SEL.appendChild(OPT); 764 } 765 } 766 } 767 catch(er){} 768 tag.appendChild(SEL); 769 return SEL; 770} 771 772function QtyPriceBreak(Qty, IsPercent, Delta){ 773 this.Qty = Qty; 774 this.IsPercent = IsPercent; 775 this.Delta = Delta; 776} 777 778function QtyPriceStruct(){ 779 this.Breaks = new Array(); 780 this.Qtys = new Array(); 781} 782 783QtyPriceStruct.prototype.addBreak = function(Qty, isPercent, Delta){ 784 this.Breaks[this.Breaks.length] = new QtyPriceBreak(Qty, isPercent, Delta); 785 if(this.Qtys[Qty] == null){ 786 this.Qtys[Qty] = this.Breaks[this.Breaks.length - 1]; 787 }else{ 788 if(this.Qtys[Qty].Delta < Delta) 789 this.Qtys[Qty] = this.Breaks[this.Breaks.length]; 790 } 791 792} 793 794QtyPriceStruct.prototype.toString = function(BasePrice){ 795 796 var out = ''; 797 var isEven = true; 798 var sClass; 799 this.Breaks.sort(sortQtyPriceBreaks); 800 801 try{ 802 if(this.Qtys.length > 0) 803 { 804 out += '<table width="95%" border=0 cellpadding=3 cellspacing=0 class="TableWithBorder"><tbody class="Primary">'; 805 out += '<tr><td align=center colspan=2 class="SecondaryBoldText">Price Breaks</td></tr>'; 806 out += '<tr><td class="Primary">Min. Qty</td><td class="Primary">Discount Price</td></tr>'; 807 for(var i=0; i<this.Breaks.length; i++){ 808 window.status += 'a' + this.Breaks.length; 809 sClass = (isEven?'GridRowEven':'GridRowOdd') 810 out += '<tr><td class="' + sClass + '">' + this.Breaks[i].Qty + '</td><td class="' + sClass + '">' + this.Breaks[i].toString(BasePrice) + '</td></tr>'; 811 isEven = !isEven; 812 } 813 out += '</tbody></table>'; 814 } 815 } 816 catch(e){} 817 return out; 818} 819 820QtyPriceStruct.prototype.getBreak = function(Qty){ 821 if(this.Breaks.length == 0) return null; 822 var i = 0; 823 //if(Qty == 1000) throw 'holla!'; 824 while((i < this.Breaks.length) && (this.Breaks[i].Qty <= Qty)){ 825 i++; 826 } 827 if(i == this.Breaks.length && this.Breaks[i-1].Qty <= Qty) return this.Qtys[this.Breaks[i-1].Qty]; 828 if ((i == 0)|| i == this.Breaks.length) return null; //no discount found 829 i--; 830 //alert(this.Breaks[i].Qty); 831 return this.Qtys[this.Breaks[i].Qty]; 832} 833 834QtyPriceBreak.prototype.toString = function(BasePrice){ 835 if (BasePrice){ 836 837 }else{ 838 BasePrice = 0; 839 } 840 var tmpStr = "$"; 841 842 if(!this.IsPercent) { 843 844 //tmpStr += (BasePrice - this.Delta).toFixed(2); 845 tmpStr += stRound(BasePrice - this.Delta,2); 846 tmpStr += " ea."; 847 } else { 848 //tmpStr += (BasePrice - (BasePrice * (this.Delta * .01))).toFixed(2); 849 tmpStr += stRound(BasePrice - (BasePrice * (this.Delta * .01)),2); 850 tmpStr += " (" + this.Delta + "% off)"; 851 } 852 853 return tmpStr; 854} 855 856QtyPriceBreak.prototype.getDiscountedPrice = function(Price){ 857 if(this.IsPercent){
858 return Price - (Price * (this.Delta * .01)); 859 }else{ 860 return Price - this.Delta; 861 } 862} 863 864function sortQtyPriceBreaks(a,b) 865{ 866 if(parseInt(a.Qty) > parseInt(b.Qty)) return 1; 867 else if(parseInt(a.Qty) < parseInt(b.Qty)) return -1; 868 else return 0; 869} 870 871function DisplayPreview(src, w, h, AC){ 872// Script Source: CodeLifter.com 873// Copyright 2003 874// Do not remove this notice. 875 876if(src == "../vlimages/pixel.gif"){ 877alert("No Media Selected for this Image"); 878return false; 879} 880 881// SETUPS: 882// =============================== 883 884// Set the horizontal and vertical position for the popup 885 886PositionX = 100; 887PositionY = 100; 888 889// Set these value approximately 20 pixels greater than the 890// size of the largest image to be used (needed for Netscape) 891 892defaultWidth = 500; 893defaultHeight = 500; 894 895// Set autoclose true to have the window close automatically 896// Set autoclose false to allow multiple popup windows 897 898var AutoClose = false; 899 900if(AC != null){AutoClose = AC;} 901 902// Do not edit below this line... 903// ================================ 904if (parseInt(navigator.appVersion.charAt(0))>=4){ 905var isNN=(navigator.appName=="Netscape")?1:0; 906var isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;} 907var optNN='scrollbars=no,width='+w+',height='+h+',left='+PositionX+',top='+PositionY; 908var optIE='scrollbars=no,width=' + w + ',height=' + h + ',left='+PositionX+',top='+PositionY; 909var prvWin = null; 910if (AutoClose) {if(prvWin != null) {prvWin.close();}} 911if (isNN){prvWin=window.open('about:blank','',optNN);} 912if (isIE){prvWin=window.open('about:blank','',optIE);} 913with (prvWin.document){ 914writeln('<html><head><title>Loading...</title><style>body{margin:0px;}</style>');writeln('<sc'+'ript>'); 915writeln('var isNN,isIE;');writeln('if (parseInt(navigator.appVersion.charAt(0))>=4){'); 916writeln('isNN=(navigator.appName=="Netscape")?1:0;');writeln('isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;}'); 917writeln('function reSizeToImage(){');writeln('if (isIE){');writeln('window.resizeTo(' + w + ',' + h + ');'); 918writeln('width=' + w + ';'); 919writeln('height=' + h + ' + 20;'); 920writeln('window.resizeTo(width,height);}');writeln('if (isNN){'); 921writeln('window.innerWidth=' + w + ';');writeln('window.innerHeight=' + h + ';}}'); 922writeln('function doTitle(){document.title="Preview Window";}');writeln('</sc'+'ript>'); 923writeln('</head><body bgcolor=000000 scroll="no" onload="reSizeToImage();doTitle();self.focus()">') 924writeln('<EMBED name="George" src='+src+' border=0 width=' + w + ' height=' + h + '><div align="right"><a href="javascript: window.close();" STYLE="font-size:12;color:#555555;">close window</a></div></body></html>'); 925close(); 926} 927 928 929} 930 931function SelectOption(SelectID, OptionValue) 932{ 933 var sel = GetTag(SelectID); 934 935 for(var i = 0; i < sel.options.length;i++) 936 if (sel.options[i].value == OptionValue) 937 sel.options[i].selected = true; 938 else 939 sel.options[i].selected = false; 940} 941 942//this function replaces the contents of an element with 943//the appropriate element to submit an action. 944function ReplaceDeleteButton(index){ 945 946 GetTag("COMDelete"+index+"Span").innerHTML = ''; 947 var boton; 948 boton = document.createElement('INPUT') 949 boton.setAttribute('id','btn'+index); 950 boton.setAttribute('type','button'); 951 boton.setAttribute('value','Delete'); 952 boton.setAttribute('class','FormButtons'); 953 boton.setAttribute('className','FormButtons'); 954 boton.onclick=function(){delItem(index);}; 955 GetTag("COMDelete"+index+"Span").appendChild(boton); 956 957} 958 959function ReplaceButton(which, action) 960{ 961 var out = span = ''; 962 963 //alert(action); 964 965 switch(which.toLowerCase()) 966 { 967 case 'addtocart': 968 out = '<input class="FormButtons COMProdButton" type="button" value="Add to Cart" id="addtocartBT" onclick="' + action + '"/>'; 969 span = 'COMCartSpan'; 970 break; 971 case 'goback': 972 out = '<input class="FormButtons COMProdButton" type="button" value="Go Back" onclick="' + action + '"/>'; 973 span = 'COMBackSpan'; 974 break; 975 case 'search': 976 out = '<input class="FormButtons" type="button" value="Search" onclick="' + action + '"/>'; 977 span = 'COMSearchSpan'; 978 break; 979 case 'clearcart': 980 out = '<input class="FormButtons" type="button" value="Clear Cart" id="Cancel" onclick="' + action + '"/>'; 981 span = 'COMClearCSpan'; 982 break; 983 case 'checkout': 984 out = '<input class="FormButtons" type="button" value="Check Out" onclick="' + action + '"/>'; 985 span = 'COMCheckoutSpan'; 986 break; 987 case 'checkout1': 988 out = '<input class="FormButtons" type="button" value="Check Out" onclick="' + action + '">'; 989 span = 'COMCheckoutSpan1'; 990 break; 991 case 'checkoutpaypal': 992 out = '<input class="FormButtons" type="button" value="Check Out With PayPal" onclick="' + action + '"/>'; 993 span = 'COMCheckoutPaypalSpan'; 994 break; 995 case 'cshopping': 996 out = '<br><br><input class="FormButtons" type="button" value="Continue Shopping" onclick="' + action + '"/>';
997 span = 'COMConShopSpan'; 998 break; 999 case 'cshopping1': 1000 out = '<input class="FormButtons" type="button" value="Continue Shopping" onclick="' + action + '">'; 1001 span = 'COMConShopSpan1'; 1002 break; 1003 case 'savecart': 1004 out = '<input class="FormButtons" type="button" value="Save Cart" onclick="' + action + '"/>'; 1005 span = 'COMSaveCartSpan'; 1006 break; 1007 1008 } 1009 1010 GetTag(span).innerHTML = out; 1011} 1012 1013function ClearCart(PageID,ShopID) 1014{ 1015 var confirmed = confirm('Click "OK" to Clear your Cart.'); 1016 1017 if(confirmed) 1018 { 1019 var outstr = ''; 1020 1021 outstr += '<form action="/content/' + PageID + '.htm" method="get" name="CartForm" id="CartForm">'; 1022 outstr += '<input type="hidden" name="ShopID" value="' + ShopID + '">'; 1023 outstr += '<input type="hidden" name="ClearCart" value="TRUE">'; 1024 outstr += '</form>'; 1025 1026 document.body.innerHTML += outstr; 1027 GetTag('CartForm').submit(); 1028 } 1029} 1030 1031////////////////////////////////////////////////////////////////////////////// 1032// added 1/2007 to draw out quick order table to prod script 1033 1034var QuickOptions = new Array(); 1035 1036 function DrawModifierQuickTable(ProductID, ItemData, onChange, Between, Spacer,prodINFO,imageClick) 1037 { 1038 var Modifiers = ItemData['Modifiers']; 1039 var aDimension1; 1040 var aDimension2; 1041 var tempDim; 1042 1043 var outDiv = ''; 1044 var comma; 1045 var re = /,/gi; 1046 var Delim = String.fromCharCode(28); 1047 var TypeName; 1048 var cTypeName; 1049 1050 //get all dimensions (modifier Type names: size, color, etc...) 1051 switch(Modifiers.length){ 1052 1053 //0 dimensions - easy 1054 case 0: 1055 outDiv += '<table class="TableWithBorder"><tr>'; 1056 outDiv += '<td></td>'; 1057 outDiv += '</tr></table>'; 1058 break; 1059 1060 //1 dimension - not as easy 1061 case 1: 1062 //outDiv += '<table class="MultiOrderTable" ><tr>'; 1063 //outDiv += '<td class="SecondaryBoldText">' 1064 //outDiv += g_ModifierTypes['lookup' + ItemModifiers[0]] 1065 //outDiv += '</td>'; 1066 //for(var i = 0; i < ItemModifiers.length; i++){ 1067 // outDiv += '<td class="SecondaryBoldText">' + g_ModifierNames['lookup' + ItemModifiers[i]] + '</td>'; 1068 //} 1069 //outDiv += '</tR><tr><td></td>'; 1070 1071 //for(var i = 0; i < ItemModifiers.length; i++){ 1072 // outDiv += '<td>' + aItemFields['lookup' + ItemModifiers[i]] + '</td>'; 1073 //} 1074 //outDiv += '</tr></table>'; 1075 break; 1076 1077 1078 //2 dimensions - this sucks 1079 case 2: 1080 var d1Count = 0; 1081 var d2Count = 0; 1082 //color dimension should be down side for view images link to be seen 1083 for(var i = 0; i < 2; i++){ 1084 if (Modifiers[i] == 'Color') 1085 { 1086 aDimension2 = Modifiers[Modifiers[i]]; 1087 cTypeName = 'Color'; 1088 } 1089 else 1090 { 1091 aDimension1 = Modifiers[Modifiers[i]]; 1092 TypeName = Modifiers[i]; 1093 } 1094 1095 // } 1096 } 1097 1098 outDiv += '<div>Click on a Color Name to View That Color\'s Image</div><BR>'; 1099 outDiv += '<table class="MultiOrderTable"><tr><td class="SecondaryBoldText"> </td>'; 1100 for(var i = 0; i < aDimension1.length; i++){ 1101 outDiv += '<td class="SecondaryBoldText">' + aDimension1[i].Name + '</td>'; 1102 } 1103 outDiv += '</tr>'; 1104 1105 1106 for(var i = 0; i < aDimension2.length; i++){ 1107 outDiv += '<tr>'; 1108 outDiv += '<td class="SecondaryBoldText"><a class="imgColorLinks" href="javascript:changeAttrImage(\''+ProductID+'_'+aDimension2[i].ID+'\');" title="View Image">' + aDimension2[i].Name + '</a></td>'; 1109 for(y = 0; y < aDimension1.length; y++){ 1110 d1Count = QuickOptions.length; 1111 d2Count = d1Count + 1; 1112 outDiv += '<td><input type="textbox" style="width:25px;" value="0" id="Qtyprod_'+d1Count+'" name="Qtyprod_'+d1Count+'"'; 1113 outDiv += 'onclick='+onChange+' onkeyup='+onChange+' onchange='+onChange+' />'; 1114 outDiv += '<input type="hidden" id="ProductItemprod_'+d1Count+'" name="ProductItemprod_'+d1Count+'" value="'+prodINFO[0]+'" />'; 1115 outDiv += '<input type="hidden" id="PartNoprod_'+d1Count+'" name="PartNoprod_'+d1Count+'" value="'+prodINFO[1]+'" />'; 1116 outDiv += '<input type="hidden" id="ProductTaxableprod_'+d1Count+'" name="ProductTaxableprod_'+d1Count+'" value="'+prodINFO[2]+'" />'; 1117 outDiv += '<input type="hidden" id="ProductWeightprod_'+d1Count+'" name="ProductWeightprod_'+d1Count+'" value="'+prodINFO[3]+'" />'; 1118 outDiv += '<input type="hidden" id="ProductDescriptionprod_'+d1Count+'" name="ProductDescriptionprod_'+d1Count+'" value="'+prodINFO[4]+'" />'; 1119 outDiv += '<input type="hidden" id="ProductBasePriceprod_'+d1Count+'" name="ProductBasePriceprod_'+d1Count+'" value="'+prodINFO[5]+'" />'; 1120 outDiv += '<input type="hidden" id="ProductPageIDprod_'+d1Count+'" name="ProductPageIDprod_'+d1Count+'" value="'+prodINFO[6]+'" />'; 1121 outDiv += '<input type="hidden" id="ProductIDprod_'+d1Count+'" name="ProductIDprod_'+d1Count+'" value="'+ProductID+'" />'; 1122 outDiv += '<input type="hidden" id="ProductItemID_'+d1Count+'" name="ItemID" value="_'+d1Count+'" />'; 1123 outDiv += '<input type="hidden" id="AddProd_'+d1Count+'" name="AddProd_'+d1Count+'" value="TRUE" />'; 1124 outDiv += '<input type="hidden" id="ProductPropprod_'+d1Count+'" name="ProductPropprod_'+d1Count+'" value="'+aDimension1[y].Name.toString().replace(re, '') + Delim + aDimension1[y].ID + Delim + aDimension1[y].Price + Delim + aDimension1[y].AddDesc + Delim + TypeName + Delim + aDimension1[y].OneTime + Delim + aDimension1[y].HasUpload + '" />'; 1125 outDiv += '<input type="hidden" id="ProductPropprod_'+d1Count+'" name="ProductPropprod_'+d1Count+'" value="'+aDimension2[i].Name.toString().replace(re, '') + Delim + aDimension2[i].ID + Delim + aDimension2[i].Price + Delim + aDimension2[i].AddDesc + Delim + cTypeName + Delim + aDimension2[i].OneTime + Delim + aDimension2[i].HasUpload + '" />'; 1126 outDiv += '</td>'; 1127 AddToQuickOrderProduct('Qtyprod'+y+'-'+i+'-'+ProductID,0,aDimension2[i].Name,aDimension1[y].Name,aDimension2[i].ID,aDimension1[y].ID,aDimension1[y].Price) 1128 } // end for y 1129 outDiv += '</tr>'; 1130 } //end for i 1131 //outDiv += '<td class="SecondaryBoldText">' + g_ModifierNames['lookup' + ItemModifiers[i]] + '</td>'; 1132 //} 1133 1134 1135 //throw 'what?'; 1136 break; 1137 1138 default: 1139 alert('This script was not designed to work with products containing more than 2 dimensions of attributes.'); 1140 break; 1141 }// end switch 1142 1143 GetTag('ProductModifiers' + ProductID).innerHTML = outDiv; 1144 1145 } 1146 1147 1148function AddToQuickOrderProduct(ModID,CurQuant,Mod1Name,Mod2Name,Mod1ID,Mod2ID,Price) 1149{ 1150
1151 var QuickProd = new Object(); 1152 1153 QuickProd.Qtyprod = ModID; 1154 QuickProd.Quant = CurQuant; 1155 QuickProd.Mod1 = Mod1Name; 1156 QuickProd.Mod2 = Mod2Name; 1157 QuickProd.Mod1ID = Mod1ID; 1158 QuickProd.Mod2ID = Mod2ID; 1159 QuickProd.Price = Price; 1160 //QuickProd.OneTime = false; 1161 //QuickProd.ModImage = ''; 1162 //QuickProd.HasUniqueImages = false; 1163 //QuickProd.HasUpload = false; 1164 //QuickProd.Description = ''; 1165 1166 QuickOptions.push(QuickProd); 1167 //ModifierData['type:' + TypeID.toString()].push(ModifierID); 1168 1169} 1170 1171////////////////////////////////////////////////////////////////////////////// 1172 1173 1174function DisplayShopSelects(sShopID, sConnectedShops, sDropDownDefault) 1175{ 1176 sDropDownDefault = (sDropDownDefault==null)? '' : sDropDownDefault; 1177 var aShops = sConnectedShops.split(','); 1178 1179 if(aShops.length > 1) { 1180 document.write('<table cellspacing="0" cellpadding="6" border="0"><tr>'); 1181 document.write('<td class="PrimaryBoldText">Select Shop:</td><td class="PrimaryBoldText">'); 1182 1183 if(sDropDownDefault.length > 0) 1184 tSelect(Shop_COMMERCE, sShopID, 'ShopID', [[sDropDownDefault,'']], true, '', sConnectedShops); 1185 else 1186 tSelect(Shop_COMMERCE, sShopID, 'ShopID', null, true, '', sConnectedShops); 1187
1188 document.write('</td><td class="PrimaryBoldText"> <input type="button" value="Select Shop" ' 1189 + 'class="btn btn-success" onclick="ChangeShop(GetTag(\'ShopID\').value);"></td>'); 1190 document.write('</tr></table>'); 1191 } else { 1192 document.write('<input type="hidden" id="ShopID" name="ShopID" value="'+sConnectedShops+'">'); 1193 } 1194} 1195 1196 1197// PRECONDITION: pass in the ShopID and GroupID or said group you want the data for 1198//POSTCONDITION: returns the id, name, and typeId of the ShopID/GroupID combo passed in 1199function GetGroupFromShop(ShopID, GroupID, TypeName) 1200{ 1201 TypeName = (TypeName==null)? 'Public' : TypeName; 1202 1203 var obj = null; 1204 var groups = eval('Shop' + ShopID + '_' + TypeName + 'Groups'); 1205 GroupID = parseInt(GroupID); 1206 1207 for(var i=0; i<groups.length; i++) 1208 if(groups[i][1] == GroupID) { 1209 obj = { 1210 id:groups[i][1], 1211 name:groups[i][0], 1212 typeId:groups[i][2] 1213 }; 1214 break; 1215 } 1216 1217 return obj; 1218} 1219 1220 1221function CloneJSON(Struct) 1222{ 1223 var obj = new Object(); 1224 1225 for(var x in Struct) 1226 if(Struct[x] instanceof Array) { 1227 obj[x] = new Array(); 1228 for(var i=0; i<Struct[x].length; i++) 1229 obj[x].push(Struct[x][i]); 1230 } else { 1231 obj[x] = Struct[x]; 1232 } 1233 1234 return obj; 1235} 1236 1237// PRECONDITION: takes an array of "generic" objects that define which selector/property to get the value of. 1238//POSTCONDITION: returns an object with the "key"s defined as properties and the values of specified CSS selectors/properties. 1239function GetCSSPropVal(ary) 1240{ 1241 if(!document.styleSheets) return null; 1242 var CSSDoc = new Array(); 1243 var aVals = new Array(); 1244 1245 if(document.styleSheets[0].cssRules) 1246 CSSDoc = document.styleSheets[0].cssRules; 1247 else 1248 CSSDoc = document.styleSheets[0].rules; 1249 1250 for(var j=0; j<ary.length; j++) 1251 for(var i=0; i<CSSDoc.length; i++) 1252 if(CSSDoc[i].selectorText == ary[j].sel) { 1253 aVals.push(ary[j].key + ':"' + CSSDoc[i].style[ary[j].prop] + '"'); 1254 break; 1255 } 1256 1257 eval('var obj = {' + aVals.join(',') + '};') 1258 return obj; 1259} 1260 1261 1262// new cart model 1263 1264 1265function cItem() 1266{ 1267 this.Key = ""; 1268 this.ProductId = ""; 1269 this.ItemId = ""; 1270 this.PartNumber = ""; 1271 this.LocationId = ""; 1272 this.Quantity = ""; 1273 this.Name = ""; 1274 this.BasePrice = ""; 1275 this.Modifiers = []; 1276 this.Extra = ""; 1277} 1278function INCartModifier() 1279{ 1280 this.ModifierId = ""; 1281 this.Name = ""; 1282 this.Input = ""; 1283 this.Price = ""; 1284 this.OneTime = false; 1285 this.TypeName = ""; 1286}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.