﻿var EN_EBASE = [5, 4, 5, 5, 4, 5, 5, 4, 5, 4, 5], EN_nBase = [], EN_vBase = [1], i$$inline_3; EN_nBase[0] = EN_EBASE[0] - 1; for (i$$inline_3 = 1; i$$inline_3 < EN_EBASE.length; i$$inline_3++) { EN_nBase[i$$inline_3] = EN_EBASE[i$$inline_3] - 1; EN_vBase[i$$inline_3] = EN_vBase[i$$inline_3 - 1] * EN_EBASE[i$$inline_3 - 1] } function EN_encodeGroup(a, b) { var c; for (c = 0; c < 4; c++) { var d = b % 67; a.e.value += "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789 *-._".charAt(d); b = (b - d) / 67 } a.d = 0 }
function EN_encode(a, b) { function c(h) { d += h * EN_vBase[a.d++]; if (a.d >= EN_EBASE.length) { EN_encodeGroup(a, d); d = 0 } } for (var d = a.p, f = EN_nBase[a.d]; b > 0; ) { var e = b % f; b = (b - e) / f; c(e); f = EN_nBase[a.d] } c(f); a.p = d; return a }; function WAU_findForm() { for (var a = document.forms, b = 0; b < a.length; b++) if (typeof a[b].method == "string" && a[b].method.toLowerCase() == "post") return a[b].name } function WAU_addLoadEvent(a) { var b = window.onload; window.onload = typeof window.onload != "function" ? a : function() { var c = undefined; try { b() } catch (d) { c = d } a(); if (c) throw c; } }; var KT_keydownHandler, KT_keypressHandler, KT_logEncoder, KT_lastElement = -1, KT_lastKeyCode = -1, KT_lastModifiers = -1, KT_logElement = 0, KT_stoppedLog, KT_ALLOW_FIELDS = { password: 1, text: 1 }, KT_lastTime, KT_inputs, KT_keyInputs = []; if (window.captureEvents) { Event.KEYPRESS && window.captureEvents(Event.KEYPRESS); Event.KEYDOWN && window.captureEvents(Event.KEYDOWN) } function KT_encode(a) { a < 0 ? KT_stopLog() : EN_encode(KT_logEncoder, a) }
function KT_init(a, b, c) { a = KT_logElement = a; if (!a.value) a.value = "A"; KT_logEncoder = { e: a, p: 0, d: 0 }; KT_initHandlers(c); b = b; if (!b.value) for (c = 1; c < KT_keyInputs.length; c++) b.value += KT_keyInputs[c].name + " " }
function KT_event(a, b) {
    try {
        if (KT_logElement.value.length > 3E3) { KT_encode(17); KT_stopLog() } else {
            var c, d = (new Date).getTime(), f = d - KT_lastTime; KT_lastTime = d; c = f; var e = a.k, h = a.t, g = a.m; if (!(a.m & 3)) {
                b |= 2; if (e >= 65 && e <= 90) e = 65; else if (e >= 48 && e <= 57) e = 48; else if (b & 1) if (e >= 97 && e <= 122) e = 65; else if (e == 197 || e == 229) b &= 5; else if (e >= 192 && e <= 687) e = 192; else if (e >= 1536) e = 1536; else if (e >= 912) e = 912; else if (e >= 160) e = 160; else if (e >= 127) b &= 5; else if (e >= 33) e = 59; else b &= 5; else if (e < 48) b &= 5; else if (e < 65) e = 59; else if (e < 96) b &=
5; else if (e < 112) e = 96; else if (e < 187) b &= 5; else e = 59
            } if (h != KT_lastElement) { KT_encode(b | 4); KT_encode(h); KT_lastElement = h } else { if (e == KT_lastKeyCode && g == KT_lastModifiers) { KT_encode(b | 8); KT_encode(c); return } KT_lastKeyCode = e; KT_lastModifiers = g; KT_encode(b) } KT_encode(e); KT_encode(g); KT_encode(c)
        } 
    } catch (i) { try { KT_stopLog() } catch (j) { } } 
}
function KT_initHandlers(a) { KT_keydownHandler = 0; KT_inputs = a; KT_stoppedLog = 0; var b = 1; for (a = 0; a < KT_inputs.length; a++) { var c = KT_inputs[a]; if (KT_ALLOW_FIELDS[c.type]) { c.onkeydown = KT_initKeyHandler; KT_keyInputs[b] = c; c.setAttribute("n", b++) } } } function KT_stopLog() { if (KT_keyInputs) for (var a = 1; a < KT_keyInputs.length; a++) { KT_keyInputs[a].onkeydown = 0; KT_keyInputs[a].onkeypress = 0 } KT_stoppedLog = 1 }
function KT_getEventModel(a) { if (!a) { a = window.event; if (typeof a.keyCode == "number") return 1; return 0 } if (typeof a.which == "number") return 3; if (typeof a.keyCode == "number") return 2; if (typeof a.charCode == "number") return 4; return 0 }
function KT_initKeyHandler(a) {
    try {
        var b, c, d = KT_logElement.value.length, f = ""; b = KT_getEventModel(a); switch (b) { case 1: a = window.event; f += "f=window.event;var b=f.keyCode;"; break; case 3: f += "var b=f.which;"; break; case 2: f += "var b=f.keyCode;"; break; case 4: f += "var b=f.charCode;" } KT_keypressHandler = 0; if (b != 0) {
            if (typeof a.modifiers == "number") f += "var c=f.modifiers;"; else if (typeof a.shiftKey == "boolean") f += "var c=f.shiftKey*4+f.ctrlKey*2+f.altKey;"; else KT_stopLog(); if (a.srcElement) f += "var d=f.srcElement;"; else if (a.target) f +=
"var d=f.target;"; else KT_stopLog()
        } else KT_stopLog(); if (!KT_stoppedLog) { f += 'var e=0;if(d.getAttribute("n")){e=d.getAttribute("n")}KT_event({k:b, m:c, t:e},'; KT_keydownHandler = new Function("f", f + "0)"); KT_keypressHandler = new Function("f", f + "1)"); KT_lastTime = (new Date).getTime(); KT_encode(0); KT_encode(KT_lastTime); if (d <= 1) { KT_encode(b); KT_encode(KT_keyInputs.length - 1) } } var e; for (c = 1; c < KT_keyInputs.length; c++) { e = KT_keyInputs[c]; if (KT_keydownHandler) { e.onkeydown = KT_keydownHandler; e.onkeypress = KT_keypressHandler } } KT_keydownHandler &&
KT_keydownHandler(a)
    } catch (h) { try { KT_stopLog() } catch (g) { } } 
}
function KT_initKeyStrokeTiming() {
    try {
        if (window.PF_global_data) window.PF_global_data.KT || (window.PF_global_data.KT = {}); else window.PF_global_data = { KT: {} }; if (!window.PF_global_data.KT.formName) window.PF_global_data.KT.formName = WAU_findForm(); var a = document.forms[window.PF_global_data.KT.formName], b = document.createElement("input"); b.type = "hidden"; b.name = "keylog"; b.value = window.PF_global_data.KT.keylog; if (b.value == "undefined") b.value = ""; b.id = "keylog"; a.appendChild(b); var c = document.createElement("input");
        c.type = "hidden"; c.name = "keyfields"; c.value = window.PF_global_data.KT.keyfields; if (c.value == "undefined") c.value = ""; c.id = "keyfields"; a.appendChild(c); KT_init(b, c, a.elements); var d = a.onsubmit || function() { return true }; a.onsubmit = function() { var e; if (e = d()) { if (KT_logEncoder) { if (KT_keydownHandler) { KT_encode(16); KT_initHandlers(KT_inputs) } e = KT_logEncoder; if (e.d != 0) { EN_encodeGroup(e, e.p); e.p = 0 } } e = true } return e } 
    } catch (f) { } 
} window.KT_event = KT_event; WAU_addLoadEvent(KT_initKeyStrokeTiming); var _whitespacePattern = /^\s*$/i, _numberPattern = /^\d+$/; function addLoadEvent(a) { var b = window.onload; window.onload = typeof window.onload != "function" ? a : function() { b(); a() } } function isIe() { return navigator.appName == "Microsoft Internet Explorer" }
function toggle(a, b) { var c = document.getElementById(a); if (c) if (c.style.display != "none" && isUndefined(b) || b == false) c.style.display = "none"; else if (c.tagName == "TABLE") try { c.style.display = isIe() ? "block" : "table" } catch (d) { c.style.display = "block" } else if (c.tagName == "TR") try { c.style.display = isIe() ? "block" : "table-row" } catch (f) { c.style.display = "block" } else if (c.tagName == "TD") try { c.style.display = isIe() ? "block" : "table-cell" } catch (e) { c.style.display = "block" } else c.style.display = "" }
function clearIfDefault(a, b) { if (a.value == b) a.value = "" } function setFieldValueById(a, b) { var c = getObjectById(a); if (c && !isUndefined(c.value)) c.value = b } function registerKeyPressHandler(a, b) { document.captureEvents && Event.KEYPRESS && document.captureEvents(Event.KEYPRESS); a.onkeypress = b }
function disallowEnter(a) { if (!a) if (window.event) a = window.event; else return true; var b; if (typeof a.keyCode == "number") { b = a.keyCode; if (b == 13 && a.cancelBubble) a.cancelBubble = true } else if (typeof a.which == "number") b = a.which; else if (typeof a.charCode == "number") b = a.charCode; else return; return b != 13 } function isUndefined(a) { return typeof a == "undefined" }
function getObjectById(a, b) { var c = b; c || (c = document); try { if (c.getElementById) return c.getElementById(a); else if (c.all) return c.all[a]; else if (c.layers) return c.layers[a] } catch (d) { } } function getStyleObject(a) { return document.getElementById && document.getElementById(a) ? document.getElementById(a).style : document.all && document.all(a) ? document.all(a).style : document.layers && document.layers[a] ? document.layers[a] : false } function changeObjectDisplay(a, b) { var c = getStyleObject(a); if (c) c.display = b }
String.prototype.trim = function() { return this.replace(/^\s+/, "").replace(/\s+$/, "") }; function setElementText(a, b) { if (isUndefined(a.innerText)) a.textContent = b; else a.innerText = b } var _changeObjectDisplay = changeObjectDisplay, _toggle = toggle, _registerKeyPressHandler = registerKeyPressHandler, _clearIfDefault = clearIfDefault, _disallowEnter = disallowEnter; window.toggle = toggle; window.getObjectById = getObjectById; window.addLoadEvent = addLoadEvent; window.setElementText = setElementText; window.isUndefined = isUndefined; var TOS_tosBoxId = "i18nToS", TOS_tosUrlId = "i18nToSUrl", TOS_numRetries = 0, _TOS_countryDropdownId, _TOS_tosUrlPreAnchor; function TOS_getTosUrl(a) { var b = getObjectById(TOS_tosUrlId); if (b && b.value) return TOS_updateTosUrl(b.value, a, null); return "" } function TOS_updateTosUrl(a, b, c) { var d = a.indexOf("?") == -1 ? "?" : "&"; a = a + d + "gl=" + b; if (c != null) return a + "#" + c; return a }
function TOS_set_ToS() { var a = getObjectById(_TOS_countryDropdownId), b = "US"; if (a != null) b = a.options[a.selectedIndex].value; if (b == "US") { TOS_seti18nToSDisplay(false); TOS_setUSToSDisplay(true) } else { TOS_setUSToSDisplay(false); TOS_seti18nToSDisplay(true); TOS_scrollToi18nToSSection(b) } } function TOS_seti18nToSDisplay(a) { var b = "i18nToSButtonRow", c = "i18nToSLinkToToSAndDivScrollbarRow"; toggle(b, a); toggle(c, a) }
function TOS_setUSToSDisplay(a) { toggle("usToSTextUnderButtonRow", a); toggle("usToSButtonRow", a); toggle("usToSLinkToToSRow", a); toggle("usToSSpacingBufferRow", a) }
function TOS_scrollToi18nToSSection(a) {
    getObjectById("i18nToSLink").href = TOS_updateTosUrl(_TOS_tosUrlPreAnchor, a, null); var b = getObjectById(TOS_tosBoxId); if (b) { if (b.countryCode != a) { b.countryCode = a; b.src = TOS_getTosUrl(a) } } else {
        b = a; var c = getObjectById(TOS_tosUrlId); if (c && c.value && c.parentNode) if (!document || !document.createElement) b = void 0; else {
            var d = document.createElement("iframe"); d.id = TOS_tosBoxId; d.name = TOS_tosBoxId; var f = d.style; f.width = "100%"; f.height = "120px"; f.border = "1px inset black"; f.padding =
"2px"; f.overflow = "auto"; d.countryCode = b; d.src = TOS_getTosUrl(b); d.frameborder = "0"; d.marginwidth = "0"; d.marginheight = "0"; c.parentNode.insertBefore(d, c); b = d
        } else b = void 0
    } if (b && !b.isInitializedForTos) a: if (c = getObjectById(TOS_tosBoxId)) {
        try { if (c.src && window && window.frames[TOS_tosBoxId]) { var e = window.frames[TOS_tosBoxId].document; c.doc = e; c.viewPane = e.body } } catch (h) { c.isInitializedForTos = true; break a } if (c.viewPane && c.doc) if (getObjectById("Other", c.doc) || TOS_numRetries >= 5) {
            c.isInitializedForTos = true; TOS_numRetries =
0
        } else TOS_numRetries++
    } if (!b || !b.isInitializedForTos) window.setTimeout("TOS_scrollToi18nToSSection('" + a + "')", 1E3); else if (b.viewPane) {
        e = a; getObjectById(e, b.doc) || (e = "Other"); b.viewPane.scrollTop = 0; var g = getObjectById(e, b.doc); if (g) {
            b = g.offsetLeft; c = g.offsetTop; d = g.offsetWidth; f = g.offsetHeight; if (g.parentNode != g.offsetParent) { b -= g.parentNode.offsetLeft; c -= g.parentNode.offsetTop } for (g = g.parentNode; g && g.nodeType == 1; ) {
                if (g.style.overflow == "auto" || g.style.overflow == "scroll") {
                    if (b < g.scrollLeft) g.scrollLeft =
b; if (b + d > g.scrollLeft + g.clientWidth) g.scrollLeft = b + d - g.clientWidth; if (c < g.scrollTop) g.scrollTop = c; if (c + f > g.scrollTop + g.clientHeight) g.scrollTop = c + f - 15
                } var i = g.offsetLeft, j = g.offsetTop; if (g.parentNode != g.offsetParent) { i -= g.parentNode.offsetLeft; j -= g.parentNode.offsetTop } b += i - g.scrollLeft; c += j - g.scrollTop; g = g.parentNode
            } 
        } getObjectById("i18nToSLink").href = TOS_updateTosUrl(_TOS_tosUrlPreAnchor, a, e)
    } 
}
function TOS_init_i18n_ToS_Width() { var a = getObjectById("creditcard_street1_label"), b = getObjectById("creditcard_street1"), c = "i18nToSTable"; c = getStyleObject(c); if (c != null) c.width = a.offsetWidth + b.offsetWidth + "px" } window.TOS_set_ToS = TOS_set_ToS; window.TOS_init_i18n_ToS_Width = TOS_init_i18n_ToS_Width; window.TOS_scrollToi18nToSSection = TOS_scrollToi18nToSSection; function Sprite(a, b, c, d, f, e, h, g) { this.url = b; this.imgId = a; this.width = c; this.height = d; this.xoffset = -f; this.xoffset_disabled = -(h ? h : f); this.yoffset = -e; this.yoffset_disabled = -(g ? g : e + d); this.enabled = true; this.setEnabled(true) }
Sprite.prototype.setEnabled = function(a) { this.enabled = a; var b = document.getElementById(this.imgId); if (b) { b.width = this.width; b.height = this.height; b.style.background = a ? "url(" + this.url + ") no-repeat " + this.xoffset + "px " + this.yoffset + "px" : "url(" + this.url + ") no-repeat " + this.xoffset_disabled + "px " + this.yoffset_disabled + "px" } }; function CC_PrefixRange(a, b, c) { this.top = b; this.bottom = a; this.digits = c } CC_PrefixRange.prototype.inRange = function(a) { var b = this.top, c = this.bottom; if (a.length > this.top.length) a = a.substring(0, this.top.length); else { b = this.top.substring(0, a.length); c = this.bottom.substring(0, a.length) } return b >= a && a >= c }; CC_PrefixRange.prototype.doesNumberMatch = function(a) { return a.length >= this.digits && this.inRange(a) }; function CC_CardBrandDetector(a, b) { this.brand = a; this.prefixes = b } CC_CardBrandDetector.prototype.doesNumberMatch = function(a) { for (var b = 0; b < this.prefixes.length; b++) if (this.prefixes[b].doesNumberMatch(a)) return true; return false }; var CC_brandDetectors = []; CC_brandDetectors[0] = new CC_CardBrandDetector("ORVIS_VISA", [new CC_PrefixRange("4227335", "4227335", 7), new CC_PrefixRange("441712298", "441712298", 9), new CC_PrefixRange("441711298", "441711298", 9)]);
CC_brandDetectors[1] = new CC_CardBrandDetector("GSA_CARD", [new CC_PrefixRange("4288", "4288", 4), new CC_PrefixRange("4486", "4486", 4), new CC_PrefixRange("4716", "4716", 4), new CC_PrefixRange("5568", "5568", 4)]);
CC_brandDetectors[2] = new CC_CardBrandDetector("RBS_CARD", [new CC_PrefixRange("400880", "400880", 6), new CC_PrefixRange("402193", "402193", 6), new CC_PrefixRange("404783", "404783", 6), new CC_PrefixRange("426393", "426393", 6), new CC_PrefixRange("445974", "445974", 6), new CC_PrefixRange("453929", "453929", 6), new CC_PrefixRange("453937", "453937", 6), new CC_PrefixRange("454305", "454305", 6), new CC_PrefixRange("454420", "454420", 6), new CC_PrefixRange("454438", "454438", 6), new CC_PrefixRange("456849", "456849", 6), new CC_PrefixRange("491007",
"491007", 6), new CC_PrefixRange("542851", "542851", 6), new CC_PrefixRange("543468", "543468", 6), new CC_PrefixRange("543480", "543480", 6), new CC_PrefixRange("543482", "543482", 6), new CC_PrefixRange("543484", "543484", 6), new CC_PrefixRange("543556", "543557", 6), new CC_PrefixRange("543699", "543699", 6), new CC_PrefixRange("545140", "545140", 6), new CC_PrefixRange("545142", "545142", 6), new CC_PrefixRange("545460", "545460", 6), new CC_PrefixRange("546016", "546016", 6), new CC_PrefixRange("546019", "546019", 6), new CC_PrefixRange("552085",
"552085", 6), new CC_PrefixRange("552213", "552213", 6)]); function CC_detectCardFromNumber(a) { if (!a) return null; a = a.replace(/[\-\s]/g, ""); if (a.length == 0 || /[^0-9]/.test(a)) return null; for (var b = 0; b < CC_brandDetectors.length; b++) if (CC_brandDetectors[b].doesNumberMatch(a)) return CC_brandDetectors[b]; return null }; var monthAbbreviations = ["jan", "feb", "mar", "apr", "may", "jun", "jul", "aug", "sep", "oct", "nov", "dec"], CC_is_IE = 0, CC_Mc = 0, CC_Visa = 1, CC_Amex = 2, CC_Disc = 3, CC_SwitchMaestro = 4, CC_Solo = 5, CC_nextObjId = 1; function CC_clearError(a, b) { if (a._ccError) { a._ccError = undefined; var c = getStyleObject(a.id); if (c) c.border = ""; a.onfocus = a._ccOldOnFocus; a._ccOldOnFocus = undefined; b && a.onfocus() } } function CC_Errors() { this._id = CC_nextObjId++; this._fields = []; this._msg = "" }
CC_Errors.prototype.alert = function() { for (var a = 0; a < this._fields.length; a++) { var b = getStyleObject(this._fields[a].id); if (b) b.border = "thin solid red" } this.isEmpty() || alert(this._msg) }; CC_Errors.prototype.clear = function() { this._msg = ""; for (var a = 0; a < this._fields.length; a++) CC_clearError(this._fields[a]); this._fields = [] };
CC_Errors.prototype.addField = function(a) { if (a._ccError != this._id) { a._ccError = this._id; var b = a.onfocus; b || (b = function() { }); a._ccOldOnFocus = b; a.onfocus = function() { CC_clearError(a, true) }; this._fields.push(a) } }; CC_Errors.prototype.append = function(a) { if (!a.match(_whitespacePattern) && this._msg.indexOf(a) == -1) { this._msg += a; this._msg += "\n" } if (arguments && arguments.length > 1) for (var b = 1; b < arguments.length; b++) this.addField(arguments[b]) }; CC_Errors.prototype.isEmpty = function() { return this._msg == "" };
CC_Errors.prototype.merge = function(a) { var b = a._fields, c; for (c in b) this.addField(b[c]); this.append(a._msg) };
function CC_validateDate(a, b, c, d) { var f = b.month.value.trim(), e = b.year.value.trim(), h = a.cc_mm_localized, g = a.cc_yyyy_localized; if (f == h) f = ""; if (e == g) e = ""; if (d && !f && !e) return true; d = parseFloat(f); h = parseFloat(e); CC_appendMonthAndYearError(d, f, b.month, a); CC_appendMonthAndYearError(h, e, b.year, a); if (b.month._ccError || b.year._ccError) return false; if (d < 1 || d > 12) { a.ccErrors.append("Please enter numbers for month and year.", b.month); return false } return c(a, b, d, h) }
function CC_appendMonthAndYearError(a, b, c, d) { if (isNaN(a)) { b ? d.ccErrors.append("Please enter numbers for month and year.", c) : d.ccErrors.append("Enter your card expiration date.", c); return true } return false }
var CC_DateCheckers = { expiration: function(a, b, c, d) { if (c == 12) { c = 0; d++ } var f = new Date, e = parseFloat(f.getFullYear()) + CC_EXPIRATION_OFFSET; if (d > e) { a.ccErrors.append("Please re-enter your card expiration date.  It is too far in the future.", b.year); return false } c = new Date(d, c, 1); if (f > c) { a.ccErrors.append("Your card has already expired.", b.month, b.year); return false } return true }, start: function(a, b, c, d) {
    c--; var f = new Date; c = new Date(d, c, 1); if (f < c) {
        a.ccErrors.append("Your card start date must be a date in the past.",
b.month, b.year); return false
    } return true
} 
}; function CC_Validator(a, b, c) { this.validNumberLengths = a; this.cvcLength = b; this.cvcLengthErrorMsg = c; this.requiresStartOrIssue = false } CC_Validator.prototype.checkMod10 = function(a) { for (var b = 0, c = 0, d = a.length - 1; d >= 0; --d) { var f = a.charCodeAt(d); f -= 48; f += c * f; f += Math.floor(f / 10); b += f; c = 1 - c } return b % 10 == 0 }; CC_Validator.prototype.checkLength = function(a) { for (var b = 0; b < this.validNumberLengths.length; b++) if (a.length == this.validNumberLengths[b]) return true; return false };
CC_Validator.prototype.checkCvcField = function(a, b) { var c = b.value.trim(); if (!c.match(_numberPattern) || this.cvcLength != c.length) { a.ccErrors.append(this.cvcLengthErrorMsg, b); return false } return true }; CC_Validator.prototype.checkExpirationDate = function(a, b) { CC_validateDate(a, b, CC_DateCheckers.expiration) };
CC_Validator.prototype.checkStartDateAndIssue = function(a, b, c) { if (this.requiresStartOrIssue) { var d = a.ccErrors; a.ccErrors = new CC_Errors; CC_validateDate(a, b, CC_DateCheckers.start, true); b = a.ccErrors; a.ccErrors = new CC_Errors; c.value.trim(); var f = a; c = c; var e = c.value.trim(); if (e) e.match(_numberPattern) || f.ccErrors.append("Please enter only numeric digits for the card number.", c); f = a.ccErrors; a.ccErrors = d; if (!(b.isEmpty() && f.isEmpty())) { a.ccErrors.merge(b); a.ccErrors.merge(f) } } };
function CC_CreditCard(a) { this.value = a; this.validator = this.cvchelp = null } CC_CreditCard.prototype.setHelpInfo = function(a) { this.cvchelp = a }; CC_CreditCard.prototype.setValidator = function(a) { this.validator = a }; CC_CreditCard.prototype.getHelpSrc = function() { if (this.cvchelp != null) return CC_img_loc + this.cvchelp.src }; CC_CreditCard.prototype.getHelpAlt = function() { if (this.cvchelp != null) return this.cvchelp.alt }; CC_CreditCard.prototype.getHelpDesc = function() { if (this.cvchelp != null) return this.cvchelp.desc };
function CC_CVCHelp(a, b, c) { this.src = a; this.alt = b; this.desc = c } CC_CreditCard.prototype.setSprite = function(a) { this.sprite = a }; CC_CreditCard.prototype.setImageObjectName = function(a) { this.imgObjectName = a }; CC_CreditCard.prototype.setNumberFormat = function(a) { this.format = a }; CC_CreditCard.prototype.getNumberFormat = function() { return this.format };
CC_CreditCard.prototype.doesNumberMatch = function(a) { if (!this.validator.checkMod10(a)) throw "unrecognized credit card"; if (!this.validator.checkLength(a)) return false; for (var b = 0; b < this.prefixes.length; b++) if (this.prefixes[b].doesNumberMatch(a)) return true; return false }; CC_CreditCard.prototype.checkCvcField = function(a, b) { this.validator.checkCvcField(a, b) }; var CC_Types = [], CC_Type_Null = new CC_CreditCard("NULL"), ccSpriteImageUrl = CC_img_loc + "cc2007-10-23.gif"; CC_Types[CC_Mc] = new CC_CreditCard("MC");
CC_Types[CC_Mc].setHelpInfo(new CC_CVCHelp("cv-mc.jpg", "Example of a MasterCard CVC location", "The CVC is a 3-digit number in the signature panel on the back of your MasterCard.")); CC_Types[CC_Mc].setNumberFormat([4, 4, 4, 4]); CC_Types[CC_Mc].setSprite(new Sprite("cc_img_MC", ccSpriteImageUrl, 33, 21, 33, 0)); CC_Types[CC_Mc].setImageObjectName("cc_img_MC"); CC_Types[CC_Mc].setValidator(new CC_Validator([16], 3, "Verification code must be three digits."));
CC_Types[CC_Mc].prefixes = Array(new CC_PrefixRange("51", "55", 2)); CC_Types[CC_Visa] = new CC_CreditCard("VISA"); CC_Types[CC_Visa].setHelpInfo(new CC_CVCHelp("cv-visa.jpg", "Example of a Visa CVC location", "The CVC is a 3-digit number in the signature panel on the back of your Visa card.")); CC_Types[CC_Visa].setNumberFormat([4, 4, 4, 4]); CC_Types[CC_Visa].setSprite(new Sprite("cc_img_VISA", ccSpriteImageUrl, 33, 21, 0, 0)); CC_Types[CC_Visa].setImageObjectName("cc_img_VISA");
CC_Types[CC_Visa].setValidator(new CC_Validator([13, 16], 3, "Verification code must be three digits.")); CC_Types[CC_Visa].prefixes = Array(new CC_PrefixRange("4", "4", 1)); CC_Types[CC_Amex] = new CC_CreditCard("AMEX"); CC_Types[CC_Amex].setHelpInfo(new CC_CVCHelp("cv-amex.gif", "Example of a American Express CVC location", "The CVC is a 4-digit number on the front of your American Express card.")); CC_Types[CC_Amex].setNumberFormat([4, 6, 5]);
CC_Types[CC_Amex].setSprite(new Sprite("cc_img_AMEX", ccSpriteImageUrl, 33, 21, 66, 0)); CC_Types[CC_Amex].setImageObjectName("cc_img_AMEX"); CC_Types[CC_Amex].setValidator(new CC_Validator([15], 4, "Verification code must be four digits.")); CC_Types[CC_Amex].prefixes = [new CC_PrefixRange("34", "34", 2), new CC_PrefixRange("37", "37", 2)]; CC_Types[CC_Disc] = new CC_CreditCard("DISCOVER"); CC_Types[CC_Disc].setHelpInfo(new CC_CVCHelp("cv-discover.gif", "Example of a Discover CVC location", "The CVC is a 3-digit number in the signature panel on the back of your Discover card."));
CC_Types[CC_Disc].setNumberFormat([4, 4, 4, 4]); CC_Types[CC_Disc].setSprite(new Sprite("cc_img_DISC", ccSpriteImageUrl, 33, 21, 99, 0)); CC_Types[CC_Disc].setImageObjectName("cc_img_DISC"); CC_Types[CC_Disc].setValidator(new CC_Validator([16], 3, "Verification code must be three digits.")); CC_Types[CC_Disc].prefixes = [new CC_PrefixRange("6011", "6011", 4), new CC_PrefixRange("650", "650", 3)]; CC_Types[CC_SwitchMaestro] = new CC_CreditCard("SWITCH");
CC_Types[CC_SwitchMaestro].setHelpInfo(new CC_CVCHelp("cv-mc.jpg", "Example of a Switch/Maestro CVC location", "The CVC is a 4-digit number on the front of your Switch/Maestro card.")); CC_Types[CC_SwitchMaestro].setNumberFormat([6, 12]); CC_Types[CC_SwitchMaestro].setSprite(new Sprite("cc_img_SWITCHMAESTRO", ccSpriteImageUrl, 33, 21, 132, 0)); CC_Types[CC_SwitchMaestro].setImageObjectName("cc_img_SWITCHMAESTRO"); var switchValidator = new CC_Validator([16, 18, 19], 3, "Verification code must be three digits.");
switchValidator.checkLength = function(a) { if (a.length >= 16) { var b = a.substring(0, 6); return b >= "490302" && b <= "490309" || b >= "490335" && b <= "490340" || b >= "491174" && b <= "491182" || b >= "675938" && b <= "675940" ? a.length == 18 : b >= "493600" && b <= "493699" || b == "560398" || b == "633301" || b == "675901" || b == "675905" || b == "675918" || b >= "675950" && b <= "675962" || b == "675998" ? a.length == 19 : a.length == 16 } return false }; switchValidator.requiresStartOrIssue = true; CC_Types[CC_SwitchMaestro].setValidator(switchValidator);
CC_Types[CC_SwitchMaestro].prefixes = [new CC_PrefixRange("490302", "490309", 6), new CC_PrefixRange("490335", "490340", 6), new CC_PrefixRange("490525", "490529", 6), new CC_PrefixRange("491100", "491102", 6), new CC_PrefixRange("491174", "491182", 6), new CC_PrefixRange("4936", "4936", 4), new CC_PrefixRange("560398", "560398", 6), new CC_PrefixRange("564182", "564182", 6), new CC_PrefixRange("633110", "633110", 6), new CC_PrefixRange("6333", "6333", 4), new CC_PrefixRange("6759", "6759", 4)]; CC_Types[CC_Solo] = new CC_CreditCard("SOLO");
CC_Types[CC_Solo].setHelpInfo(new CC_CVCHelp("cv-mc.jpg", "Example of a Solo CVC location", "The CVC is a 3-digit number in the signature panel on the back of your Solo card.")); CC_Types[CC_Solo].setNumberFormat([4, 4, 4, 4, 3]); CC_Types[CC_Solo].setSprite(new Sprite("cc_img_SOLO", ccSpriteImageUrl, 16, 21, 165, 0)); CC_Types[CC_Solo].setImageObjectName("cc_img_SOLO"); var soloValidator = new CC_Validator([16, 18, 19], 3, "Verification code must be three digits.");
soloValidator.checkLength = function(a) { if (a.length >= 16) { var b = a.substring(0, 6); return b == "633461" || b == "633473" || b == "633478" || b == "633494" || b == "633499" || b == "676703" || b == "676740" || b == "676774" || b == "676779" || b == "676782" || b == "676795" ? a.length == 18 : b == "633476" || b == "633481" || b == "633498" || b == "676701" || b == "676705" || b == "676718" || b >= "676750" && b <= "676762" || b == "676770" || b == "676798" ? a.length == 19 : a.length == 16 } return false }; soloValidator.requiresStartOrIssue = true; CC_Types[CC_Solo].setValidator(soloValidator);
CC_Types[CC_Solo].prefixes = [new CC_PrefixRange("633450", "633499", 6), new CC_PrefixRange("6767", "6767", 4)]; if (document.all) CC_is_IE = 1;
function CC_manageCreditCard(a) {
    if (!isShowingCardSummary()) {
        var b = getObjectById(a.ccFieldId); if (b) a.CC_selected = CC_getCardFromNumber(b.value); var c = a; b = getObjectById(c.ccFieldId); if (!(!b || c.CC_selected == CC_Type_Null)) {
            var d = b.value; if (d.length > 23) b.value = d.substring(0, 23); else {
                var f = d.substring(d.length - 1, d.length); if (!(f == " " || f == "-")) {
                    d = d.replace(/ /g, ""); d = d.replace(/-/g, ""); if (c.CC_selected == null) b.value = d; else {
                        c = c.CC_selected.getNumberFormat(); for (var e = f = 0, h = ""; f < d.length && e < c.length; ) {
                            if (c[e] !=
null) { if (e > 0) h += "-"; h += d.substring(f, f + c[e]); f += c[e] } e++
                        } if (e >= c.length) h += d.substring(f, d.length); b.value = h
                    } 
                } 
            } 
        } b = a; if (b.CC_selected != b.CC_lastSelected) { b.CC_lastSelected = b.CC_selected; for (d = 0; d < CC_Types.length; d++) CC_Types[d].sprite.setEnabled(true) } if (b.CC_selected) { changeObjectDisplay("cc_error", "none"); for (d = 0; d < CC_Types.length; d++) changeObjectDisplay(CC_Types[d].imgObjectName, "inline"); if (b.CC_selected != CC_Type_Null) for (d = 0; d < CC_Types.length; d++) b.CC_selected != CC_Types[d] && CC_Types[d].sprite.setEnabled(false) } else {
            for (b =
0; b < CC_Types.length; b++) changeObjectDisplay(CC_Types[b].imgObjectName, "none"); changeObjectDisplay("cc_error", "inline")
        } b = getObjectById(a.CC_typeFieldId); d = a.CC_selected; if (b && d) b.value = d.value; b = getObjectById(a.CC_lastDigitsFieldId); d = getObjectById(a.ccFieldId); if (b && d) { b = b; d = d.value; d = d.replace(/ /g, ""); d = d.replace(/-/g, ""); d = d.length < 5 ? d : d.substring(d.length - 4); b.value = d } b = a.ukCCDivId; a.CC_selected == CC_Types[CC_SwitchMaestro] || a.CC_selected == CC_Types[CC_Solo] ? changeObjectDisplay(b, "inline") : changeObjectDisplay(b,
"none"); if (a.CC_selected != null && a.CC_selected != CC_Type_Null) { a = a; if (b = getObjectById(a.CC_cardBrandFieldId)) b.value = ""; b = (b = getObjectById(a.ccFieldId)) ? CC_detectCardFromNumber(b.value) : null; if (b) if (a = getObjectById(a.CC_cardBrandFieldId)) a.value = b ? b.brand : "" } else if (a = getObjectById(a)) a.value = ""
    } 
}
function CC_getCardFromNumber(a) { a = a.replace(/ /g, ""); a = a.replace(/-/g, ""); if (a.length == 0) return CC_Type_Null; try { for (var b = CC_Types.length - 1; b >= 0; b--) if (CC_Types[b].doesNumberMatch(a)) { if (CC_Types[b].isValid) return CC_Types[b]; return null } } catch (c) { if (c == "unrecognized credit card") return null; throw c; } return CC_Type_Null }
function CC_checkMonth(a) { var b = a.value; if (b.match(/^\d$/)) a.value = "0" + b; else { b = b.toLowerCase(); for (var c = 0; c < monthAbbreviations.length; c++) if (b.indexOf(monthAbbreviations[c]) > -1) a.value = "0" + (c + 1) } } function CC_checkYear(a) { var b = a.value, c = (new Date).getUTCFullYear().toString(); if (b.match(/^\d+$/) && b.length < 4) a.value = c.substring(0, 4 - b.length) + b }
function CC_togglecvc(a) { var b = a.CC_selected; if (b != null && b != CC_Type_Null) { var c = getObjectById(a.cvcHelpId); c.style.display = c.style.display != "none" ? "none" : "block"; if (CC_is_IE && window.event) { window.event.cancelBubble = true; window.event.returnValue = false } if (c.style.display == "block") { document.images.cvcimg.src = b.getHelpSrc(); document.images.cvcimg.alt = b.getHelpAlt(); getObjectById(a.cvcExpId).innerHTML = b.getHelpDesc() } if (CC_is_IE && window.event) { window.event.cancelBubble = true; window.event.returnValue = false } return false } return true }
function isShowingCardSummary() { var a = getStyleObject("cc_number_row"); return a && a.display == "none" }
function CC_revealCCFields(a) { CC_clearEncryptedCCFields(a); CC_setMaxLengthConstraint(a.ccFieldId, a.ccFieldMaxlength); CC_setMaxLengthConstraint(a.cvcFieldId, a.cvcFieldMaxlength); toggle(a.ccSummaryRow, false); toggle(a.ccNumberRow, true); toggle(a.ccLogoRow, true); toggle(a.ccExtraRow, true); toggle(a.ukCcExtraRow, true); var b = getObjectById(a.formId); if (b && a.efeFormAction) b.action = a.efeFormAction; CC_manageCreditCard(a) }
function CC_removeMaxLengthConstraint(a) { CC_setMaxLengthConstraint(a.ccFieldId, 1E3); CC_setMaxLengthConstraint(a.cvcFieldId, 1E3) } function CC_setMaxLengthConstraint(a, b) { var c = getObjectById(a); c.maxLength = b } function CC_clearEncryptedCCFields(a) { setFieldValueById(a.ccFieldId, ""); setFieldValueById(a.cvcFieldId, ""); setFieldValueById(a.ccExpMonth, ""); setFieldValueById(a.ccExpYear, "") }
function CC_getCCSelectedFromCCName(a) { if (!a || a == "") return null; for (var b = 0; b < CC_Types.length; b++) if (CC_Types[b].value == a) return CC_Types[b]; return null }
function CC_presubmitCheck(a) {
    if (isShowingCardSummary()) return true; if (!a.CC_selected || a.CC_selected == CC_Type_Null) { alert("Please enter a valid card number."); return false } if (!a.ccErrors) a.ccErrors = new CC_Errors; a.ccErrors.clear(); var b = getObjectById(a.cvcFieldId); b && a.CC_selected.checkCvcField(a, b); b = a; var c = b.CC_selected, d = CC_getDateFields(b.ccExpMonth, b.ccExpYear); d && c.validator.checkExpirationDate(b, d); d = CC_getDateFields(b.ccStartMonth, b.ccStartYear); var f = getObjectById(b.ccIssueId); d && f && c.validator.checkStartDateAndIssue(b,
d, f); a.ccErrors.alert(); return a.ccErrors.isEmpty()
} function CC_getDateFields(a, b) { var c = getObjectById(a), d = getObjectById(b); if (c && d) return { month: c, year: d }; return null } window._CC_manageCreditCard = CC_manageCreditCard; window._CC_getCardFromNumber = CC_getCardFromNumber; window._CC_checkMonth = CC_checkMonth; window._CC_checkYear = CC_checkYear; window._CC_togglecvc = CC_togglecvc; window._CC_getCCSelectedFromCCName = CC_getCCSelectedFromCCName; window.CC_presubmitCheck = CC_presubmitCheck; window.CC_Mc = CC_Mc;
window.CC_Visa = CC_Visa; window.CC_Amex = CC_Amex; window.CC_Disc = CC_Disc; window.CC_SwitchMaestro = CC_SwitchMaestro; window.CC_Solo = CC_Solo; window.CC_Type_Null = CC_Type_Null; window.CC_Types = CC_Types; window.CC_clearEncryptedCCFields = CC_clearEncryptedCCFields; window.CC_revealCCFields = CC_revealCCFields; window.CC_removeMaxLengthConstraint = CC_removeMaxLengthConstraint;



        
var CC_img_loc = "https://checkout.google.com/img/";
var CC_EXPIRATION_OFFSET = 21;

var CC_mm_localized = "mm";
var CC_yyyy_localized = "yyyy";

if (!CC_scope_container) {
    var CC_scope_container = {};
}

CC_scope_container["CC_context_creditcard"] = {};
CC_scope_container["CC_context_creditcard"].ccFieldId = "creditcard.CreditCardNumberTextField";
CC_scope_container["CC_context_creditcard"].cvcFieldId = "creditcard.CreditCardCvvTextField";
CC_scope_container["CC_context_creditcard"].cvcHelpId = "creditcard.cvcHelp";
CC_scope_container["CC_context_creditcard"].cvcExpId = "creditcard.cvcExp";
CC_scope_container["CC_context_creditcard"].ukCCDivId = "creditcard.ukdebitfields";
CC_scope_container["CC_context_creditcard"].CC_typeFieldId = "creditcard.type";
CC_scope_container["CC_context_creditcard"].CC_cardBrandFieldId = "creditcard.cardBrand";
CC_scope_container["CC_context_creditcard"].CC_lastDigitsFieldId = "creditcard.lastDigits";
CC_scope_container["CC_context_creditcard"].CC_selected = _CC_getCCSelectedFromCCName("");
CC_scope_container["CC_context_creditcard"].CC_lastSelected = null;
CC_scope_container["CC_context_creditcard"].ccExpMonth = "creditcard.ccExpMonth";
CC_scope_container["CC_context_creditcard"].ccExpYear = "creditcard.ccExpYear";
CC_scope_container["CC_context_creditcard"].ccStartMonth = "creditcard.ccStartMonth";
CC_scope_container["CC_context_creditcard"].ccStartYear = "creditcard.ccStartYear";
CC_scope_container["CC_context_creditcard"].ccIssueId = "creditcard.ccIssueId";
CC_scope_container["CC_context_creditcard"].ccSummaryRow = "cc_summary_row";
CC_scope_container["CC_context_creditcard"].ccNumberRow = "cc_number_row";
CC_scope_container["CC_context_creditcard"].ccLogoRow = "cc_logo_row";
CC_scope_container["CC_context_creditcard"].ccExtraRow = "cc_extra_row";
CC_scope_container["CC_context_creditcard"].ukCcExtraRow = "uk_cc_extra_row";
CC_scope_container["CC_context_creditcard"].formId = "createaccount";
CC_scope_container["CC_context_creditcard"].efeFormAction = "https://checkout.google.com/efe/buyerValidateCreateAccount?service\x3dsierra\x26signupAgent\x3dsierraAgent\x26gclid\x3dhomepage\x26hsk\x3d1\x26tzfp\x3dwg-14ArD\x26csr\x3dhttps://checkout.google.com/buyerSignup?service%3Dsierra%26signupAgent%3DsierraAgent%26gclid%3Dhomepage%26hsk%3D1%26dsh%3D-8062829768635496016\x26s7e\x3dcreditcard.cardNumber:n;creditcard.cvv:n";
CC_scope_container["CC_context_creditcard"].cc_mm_localized = CC_mm_localized;
CC_scope_container["CC_context_creditcard"].cc_yyyy_localized = CC_yyyy_localized;
CC_scope_container["CC_context_creditcard"].ccFieldMaxlength = 23;
CC_scope_container["CC_context_creditcard"].cvcFieldMaxlength = 4;

CC_Types[CC_Visa].isValid = true;
CC_Types[CC_Mc].isValid = true;
CC_Types[CC_Amex].isValid = true;
CC_Types[CC_Disc].isValid = true;
CC_Types[CC_Solo].isValid = true;
CC_Types[CC_SwitchMaestro].isValid = false;




_CC_manageCreditCard(CC_scope_container["CC_context_creditcard"]);

// SEE Functions


// ----------------------------------------------------------------------------
// AddClassName
//
// Description : adds a class to the class attribute of a DOM element
//    built with the understanding that there may be multiple classes
//
// Arguments:
//    objElement              - element to manipulate
//    strClass                - class name to add
//
function AddClassName(objElement, strClass, blnMayAlreadyExist) {

    // if there is a class
    if (objElement.className) {

        // the classes are just a space separated list, so first get the list
        var arrList = objElement.className.split(' ');

        // if the new class name may already exist in list
        if (blnMayAlreadyExist) {

            // get uppercase class for comparison purposes
            var strClassUpper = strClass.toUpperCase();

            // find all instances and remove them
            for (var i = 0; i < arrList.length; i++) {

                // if class found
                if (arrList[i].toUpperCase() == strClassUpper) {

                    // remove array item
                    arrList.splice(i, 1);

                    // decrement loop counter as we have adjusted the array's contents
                    i--;

                }

            }

        }

        // add the new class to end of list
        arrList[arrList.length] = strClass;

        // add the new class to beginning of list
        //arrList.splice(0, 0, strClass);

        // assign modified class name attribute
        objElement.className = arrList.join(' ');

    }
    // if there was no class
    else {

        // assign modified class name attribute      
        objElement.className = strClass;

    }

}
// 
// AddClassName
// ----------------------------------------------------------------------------




//**************************** SEE KitPage JS ***********************************************/

function MutExRadioButtonList(rbt, rbtListID) {
    //var rbtTable = document.getElementById('ctl00_PageContent_SEEProductPage1_dtlItemColor');                
    var rbtTable = document.getElementById(rbtListID);

    var rbts = rbtTable.getElementsByTagName("input");

    for (var i = 0; i < rbts.length; i++) {
        if (rbts[i] != rbt && rbt.checked) {
            rbts[i].checked = false;
        }
    }
}

function MutExTextArea(rbt, rbtListID, objDataList, firstFlag) {
    //var rbtTable = document.getElementById('ctl00_PageContent_SEEProductPage1_dtlItemColor');
    var rbtTable = document.getElementById(objDataList);

    var objTextAreas = rbtTable.getElementsByTagName("textarea");

    rbtTable = document.getElementById(rbtListID);

    var rbts = rbtTable.getElementsByTagName("input");

    for (var i = 0; i < objTextAreas.length; i++) {
        //if (objTextAreas[i] != rbt && rbt.checked) {
        objTextAreas[i].disabled = 'true';
    }

    if (firstFlag == 'true') {
        $(objTextAreas[0]).removeAttr('disabled');
    }

    for (var j = 0; j < rbts.length; j++) {
        if (rbts[j] == rbt && rbt.checked) {
            //rbts[i].checked = false;                        
            //$(objTextAreas[j]).removeAttr('disabled');
            $($($(rbts[j]).parent().parent().next().children()[0]).children()[0]).removeAttr('disabled');
        }
    }

}

function AddStockCheckBoxValue(checkBoxListID, rightSideBarLabel, ExtData) {
    var chkTable = document.getElementById(checkBoxListID);

    var chks = chkTable.getElementsByTagName("input");
    var tempSelection = '';
    var tempSelectionValues = '';

    for (var i = 0; i < chks.length; i++) {
        if (chks[i].checked) {
            if (tempSelection.length > 0) {
                tempSelection += ',';
                tempSelectionValues += ',';
            }
            tempSelection += $(chks[i]).attr('title');
            tempSelectionValues += $(chks[i]).val();
        }
    }

    if (tempSelection.length > 0) {
        $(rightSideBarLabel).text(tempSelection);
        $(ExtData).val(tempSelectionValues);
    }
    else { // Clean up
        $(rightSideBarLabel).text('');
        $(ExtData).val('');
    }
}

function AddStockTextBoxValue(textBoxListID, rightSideBarLabel, ExtData) {
    var txtTable = document.getElementById(textBoxListID);

    var txts = txtTable.getElementsByTagName("input");

    var tempSelection = '';
    var tempSelectionValues = '';

    for (var i = 0; i < txts.length; i++) {
        if (txts[i].value.length > 0) {
            if (tempSelection.length > 0) {
                tempSelection += ',';
                tempSelectionValues += '^:*#';
            }
            tempSelection += $(txts[i]).attr('title');
            tempSelectionValues += $(txts[i]).attr('data') + '*:^' + $(txts[i]).val();
        }
    }

    if (tempSelection.length > 0) {
        $(rightSideBarLabel).text(tempSelection);
        $(ExtData).val(tempSelectionValues);
    }
    else { // Clean up
        $(rightSideBarLabel).text('');
        $(ExtData).val('');
    }
}

function AddStockTextAreaValue(textBoxListID, rightSideBarLabel, ExtData) {
    var txtTable = document.getElementById(textBoxListID);

    var txts = txtTable.getElementsByTagName("textarea");

    var tempSelection = '';
    var tempSelectionValues = '';

    for (var i = 0; i < txts.length; i++) {
        if (txts[i].value.length > 0) {
            if (tempSelection.length > 0) {
                tempSelection += ',';
                tempSelectionValues += '^:*#';
            }
            tempSelection += $(txts[i]).attr('title');
            tempSelectionValues += $(txts[i]).attr('data') + '*:^' + $(txts[i]).val();
        }
    }

    if (tempSelection.length > 0) {
        $(rightSideBarLabel).text(tempSelection);
        $(ExtData).val(tempSelectionValues);
    }
    else { // Clean up
        $(rightSideBarLabel).text('');
        $(ExtData).val('');
    }
}

function AddFileUploadValues(fileUploadListID, rightSideBarLabel, ExtData) {

    $(rightSideBarLabel).text('');
    $(ExtData).val('');

    var fileUploadTable = document.getElementById(fileUploadListID);

    //    var files = fileUploadTable.getElementsByTagName("input");

    //    var tempSelection = '';
    //    var tempSelectionValues = '';

    //    //alert(files.length);

    //    for (var i = 0; i < files.length; i++) {
    //        if (files[i].value.length > 0) {
    //            if (tempSelection.length > 0) {
    //                tempSelection += ',';
    //                tempSelectionValues += '^:*#';
    //            }
    //            tempSelection += $(files[i]).attr('title');
    //            var sFileName = $(files[i]).attr('id');
    //            sFileName = sFileName.substring(sFileName.indexOf('fileToUpload_') + 13);
    //            var sFileExt = $(files[i]).val();            
    //            sFileExt = fnProcessFilePath(sFileExt);
    //            //sFileExt = sFileExt.substring(sFileExt.indexOf('.'));                        
    //            //                        if (sFileExt.indexOf("\\") > 0) {
    //            //                            sFileExt = sFileExt.substring(sFileExt.lastIndexOf("\\") + 1);
    //            //                        }
    //            tempSelectionValues += $(files[i]).attr('data') + '*:^' + sFileName + '_' + sFileExt;
    //        }
    //    }

    var files = fileUploadTable.getElementsByTagName("button");

    var tempSelection = '';
    var tempSelectionValues = '';

    //alert(files.length);

    for (var i = 0; i < files.length; i++) {
        //alert($(files[i]).attr('id'));
        try {
            if ($(files[i]).attr('id').indexOf('btnPreview') > 0) {
                if ($(files[i]).attr('data').length > 0) {
                    if (tempSelection.length > 0) {
                        tempSelection += ',';
                        tempSelectionValues += '^:*#';
                    }
                    tempSelection += $(files[i]).attr('title');
                    var sFileName = $(files[i]).attr('data');
                    var sKitItemID = $(files[i]).attr('name');
                    tempSelectionValues += sKitItemID + '*:^' + sFileName;
                    //alert(tempSelectionValues);
                }
            }
        } catch (e) {
        }
    }

    if (tempSelection.length > 0) {
        $(rightSideBarLabel).text(tempSelection);
        $(ExtData).val(tempSelectionValues);
    }
    else { // Clean up
        $(rightSideBarLabel).text('');
        $(ExtData).val('');
    }
}

function numbersonly(e) {
    var unicode = e.charCode ? e.charCode : e.keyCode;
    if (unicode != 8) { //if the key isn't the backspace key (which we should allow)
        if (unicode < 48 || unicode > 57) //if not a number
            return false; //disable key press
        else
            return true;
    }
    else {
        return true;
    }
}

function iFrameLoading(objIFrame, sFilePath) {
    //alert(sFilePath);
    objIFrame = (objIFrame.contentWindow) ? objIFrame.contentWindow : (objIFrame.contentDocument.document) ? objIFrame.contentDocument.document : objIFrame.contentDocument;

    var sContent = "<html><head><meta http-Equiv='Cache-Control' Content='no-cache'><meta http-Equiv='Pragma' Content='no-cache'><meta http-Equiv='Expires' Content='0'></head><body><img src='" + sFilePath + "' height=150 width=150 /></body></html>";
    objIFrame.document.open();
    objIFrame.document.write(sContent);
    objIFrame.document.close();

    return false;
}

function AddToIframe(objIFrame, sFilePath, btnPreview, nCounter) {
    //alert('sFilePath: ' + sFilePath + ' btnPreview: ' + $(btnPreview).attr('data'));
    if (sFilePath.indexOf(".") > 0) {
        var sContent = "<html><head><meta http-Equiv='Cache-Control' Content='no-cache'><meta http-Equiv='Pragma' Content='no-cache'><meta http-Equiv='Expires' Content='0'></head><body><img src='" + sFilePath + "' height=150 width=150 /></body></html>";
    }
    else {
        var sFilePath = $(btnPreview).attr('data');
        sFilePath = fnProcessFilePath(sFilePath);
        var sContent = "<html><body><img src='" + sFilePath + "' height=150 width=150 /></body></html>";
    }

    //alert(sContent);

    try {
        var ifrm = document.getElementById(objIFrame);

        ifrm = (ifrm.contentWindow) ? ifrm.contentWindow : (ifrm.contentDocument.document) ? ifrm.contentDocument.document : ifrm.contentDocument;
        ifrm.document.open();
        ifrm.document.write(sContent);
        ifrm.document.close();
    } catch (e) {
        alert(e);
    }

    //alert(nCounter);
    //var nTempCounter = nCounter;
    //nTempCounter = Number(nTempCounter) + 1;
    //nCounter = nTempCounter;
    nCounter = Number(nCounter) + 1;
    //alert(nCounter);
    //var nInterValID1 = setTimeout("showPreview(document.getElementById('" + btnPreview.id + "'));", 5000);
    //var nInterValID2 = setTimeout("showPreview(document.getElementById('" + btnPreview.id + "'));", 3000);
    if (nCounter < 3) {
        setTimeout("AddToIframe('" + objIFrame + "','" + sFilePath + "',document.getElementById('" + btnPreview.id + "',Number(" + nCounter + ")))", 5000);
    } else {
        return false;
    }
    //clearInterval(nInterValID1);
    //clearInterval(nInterValID2);

    return false;
}

function fnProcessFilePath(sFilePath) {
    try {
        return sFilePath.match(/[-_\w]+[.][\w]+$/i)[0];
    } catch (e) {
        return sFilePath;
    }
}

//**************************** SEE KitPage JS ***********************************************/
