//preload price buttons price_000_on = new Image(); price_000_off = new Image(); price_099_on = new Image(); price_099_off = new Image(); price_199_on = new Image(); price_199_off = new Image(); price_249_on = new Image(); price_249_off = new Image(); price_299_on = new Image(); price_399_on = new Image(); price_499_on = new Image(); price_599_on = new Image(); price_699_on = new Image(); price_799_on = new Image(); price_899_on = new Image(); price_999_on = new Image(); buy_off = new Image(); buy_on = new Image(); listen_on = new Image(); listen_off = new Image(); btn_subscribe = new Image(); function initializePriceBuyButtons(baseUrl) { price_000_on.src = baseUrl + "/cingular/images/free.on.gif"; price_000_off.src = baseUrl + "/cingular/images/get.off.gif"; price_099_on.src = baseUrl + "/cingular/images/99.on.gif"; price_099_off.src = baseUrl + "/cingular/images/99.off.gif"; price_199_on.src = baseUrl + "/cingular/images/199.on.gif"; price_199_off.src = baseUrl + "/cingular/images/199.off.gif"; price_249_on.src = baseUrl + "/cingular/images/249.on.gif"; price_249_off.src = baseUrl + "/cingular/images/249.off.gif"; price_299_on.src = baseUrl + "/cingular/images/btn_299.gif"; price_399_on.src = baseUrl + "/cingular/images/btn_399.gif"; price_499_on.src = baseUrl + "/cingular/images/btn_499.gif"; price_599_on.src = baseUrl + "/cingular/images/btn_599.gif"; price_699_on.src = baseUrl + "/cingular/images/btn_699.gif"; price_799_on.src = baseUrl + "/cingular/images/btn_799.gif"; price_899_on.src = baseUrl + "/cingular/images/btn_899.gif"; price_999_on.src = baseUrl + "/cingular/images/btn_999.gif"; buy_off.src = baseUrl + "/cingular/images/buy.off.gif"; buy_on.src = baseUrl + "/cingular/images/buy.on.gif"; listen_on.src = baseUrl + "/cingular/images/hear.on.gif"; listen_off.src = baseUrl + "/cingular/images/hear.off.gif"; btn_subscribe.src = baseUrl + "/cingular/images/btn_subscribe.gif"; } function demosms(baseUrl) { window.open(baseUrl + "/cingular/demo_textmsg.html","demo","width=437,height=431,status=no,toolbar=no,menubar=no,scrollbars=no,resizable=yes,location=no,directories=no,status=no"); } function demowireless(baseUrl) { window.open(baseUrl + "/cingular/demo_wireless.html","demo","width=437,height=431,status=no,toolbar=no,menubar=no,scrollbars=no,resizable=yes,location=no,directories=no,status=no"); } function move_cursor(fromObject, toObject, maxCharacters) { if(fromObject.value.length == maxCharacters) { toObject.focus(); } } function forward_cursor(event,frm,fieldnum) { var which = event.which ? event.which : event.keyCode; if ( (which >= 48 && which <= 57) || (which >= 96 && which <= 105)) { if (fieldnum == 1) { if (frm.phone1.value.length == 3) { frm.phone2.focus(); } } if (fieldnum == 2) { if (frm.phone2.value.length == 3) { frm.phone3.focus(); } } } } function isAlphaNumericChar( ch ) { return ((ch >= "A" && ch <= "Z") || (ch >= "a" && ch <= "z") || (ch >= "0" && ch <= "9")) } function isAlphaNumericTest( s ) { var begin = 0; var end = s.length; //Remove leading white space while (begin < end ) { var testchar = s.substring(begin, begin + 1); if( isAlphaNumericChar( testchar ) == false ) { return false; } begin++; } return true } function purchase_check(frm) { //Check the phone number phone = trim(frm.phone1.value) + trim(frm.phone2.value) + trim(frm.phone3.value); if (phone.length < 10 || isNaN(phone)) { alert("Please enter a valid phone number"); frm.phone1.value = trim(frm.phone1.value); frm.phone2.value = trim(frm.phone2.value); frm.phone3.value = trim(frm.phone3.value); frm.phone1.focus(); return false; } //Check the coupon code if (frm.couponCode != undefined) { var trimmed = trim(frm.couponCode.value); if (trimmed.length != 0) { if( (trimmed.length == 8) || (trimmed.length == 10) ){ if((frm.allowCoupon.value == "true" && frm.allowToneCard.value == "true") && (!isAlphaNumericTest(trimmed) || !(trimmed.length == 10 || trimmed.length == 8))) { alert("Oops! That Tone Card code is not valid. Please try again."); frm.couponCode.value = trimmed; frm.couponCode.focus(); return false; } else if((frm.allowToneCard.value == "true" && frm.allowCoupon.value == "false") && (!isAlphaNumericTest(trimmed) || trimmed.length != 8)) { alert("Oops! Your Tone Card is not valid. Please try again."); frm.couponCode.value = trimmed; frm.couponCode.focus(); return false; } else if((frm.allowCoupon.value == "true" && frm.allowToneCard.value == "false") && (!isAlphaNumericTest(trimmed) || trimmed.length != 10)) { alert("Oops! Your coupon is not valid. Please try again."); frm.couponCode.value = trimmed; frm.couponCode.focus(); return false; } } else{ alert("Oops! That Tone Card code is not valid. Please try again."); frm.couponCode.value = trimmed; frm.couponCode.focus(); return false; } } } return true; } function is_valid_phone_format(str) { var begin = 0; var end = str.length; var numCount = 0; while(begin < end){ var c = str.substring(begin, begin + 1); // crude, but effective enough if(c >= "0" && c <= "9"){ numCount++; }else if(c == "-" || c == "." || c == "(" || c == ")" || c == " "){ // no-op }else{ return false; } begin++; } return (numCount == 10); } function tell_check(frm) { var textExists = false; //Check the phone numbers if(frm.phone1.value.length > 0){ textExists = true; //if(frm.phone1.value.length < 10 || isNaN(frm.phone1.value)){ if(!(is_valid_phone_format(frm.phone1.value))){ alert("That number is not valid - please enter a 10-digit phone number."); frm.phone1.focus(); return false; } } if(frm.phone2.value.length > 0){ textExists = true; //if(frm.phone2.value.length < 10 || isNaN(frm.phone2.value)){ if(!(is_valid_phone_format(frm.phone2.value))){ alert("That number is not valid - please enter a 10-digit phone number."); frm.phone2.focus(); return false; } } if(frm.phone3.value.length > 0){ textExists = true; //if(frm.phone3.value.length < 10 || isNaN(frm.phone3.value)){ if(!(is_valid_phone_format(frm.phone3.value))){ alert("That number is not valid - please enter a 10-digit phone number."); frm.phone3.focus(); return false; } } if(frm.phone4.value.length > 0){ textExists = true; //if(frm.phone4.value.length < 10 || isNaN(frm.phone4.value)){ if(!(is_valid_phone_format(frm.phone4.value))){ alert("That number is not valid - please enter a 10-digit phone number."); frm.phone4.focus(); return false; } } if(frm.phone5.value.length > 0){ textExists = true; //if(frm.phone5.value.length < 10 || isNaN(frm.phone5.value)){ if(!(is_valid_phone_format(frm.phone5.value))){ alert("That number is not valid - please enter a 10-digit phone number."); frm.phone5.focus(); return false; } } if(frm.phone6.value.length > 0){ textExists = true; //if(frm.phone6.value.length < 10 || isNaN(frm.phone6.value)){ if(!(is_valid_phone_format(frm.phone6.value))){ alert("That number is not valid - please enter a 10-digit phone number."); frm.phone6.focus(); return false; } } if(!textExists){ alert("Please enter at least one 10-digit phone number."); frm.phone1.focus(); return false; } return true; } function search_check(frm) { var trimmed = trim(frm.searchTerm.value); if (trimmed.length < 2) { alert('Search term must be at least 2 characters in length.'); frm.searchTerm.value = trimmed; frm.searchTerm.focus(); return false; } return true; } function popup_view_url(url) { popup_listen_url(url); } function popup_listen_url(url) { window.open(url,"preview","width=355,height=290,status=no,toolbar=no,menubar=no,scrollbars=no,resizable=no,location=no,directories=no,status=no"); } function popup_preview_url(url) { window.open( url, "preview", "width=355, height=374, status=no, toolbar=no, menubar=no, scrollbars=no, resizable=no, location=no, directories=no, status=no" ); } function popup_promo_listen(url) { window.open(url,"preview","width=355,height=290,status=no,toolbar=no,menubar=no,scrollbars=no,resizable=no,location=no,directories=no,status=no"); } function release_alert(deviceCategory) { window.open("endUserHTMLReleaseAlert?catalogName=Cingular+Extras+en&lang=en&promo=false&showCodes=false&dc=" + deviceCategory, "release", "width=480,height=480,status=no,toolbar=no,menubar=no,scrollbars=no,resizable=yes,location=no,directories=no,status=no"); } function att_wireless( baseUrl) { window.open( baseUrl + "/cingular/attwireless.html","demo","width=437,height=631,status=no,toolbar=no,menubar=no,scrollbars=no,resizable=yes,location=no,directories=no,status=no"); } function subclub_info( baseUrl ) { window.open( baseUrl + "/cingular/subclubinfo.html","Info","width=437,height=631,status=no,toolbar=no,menubar=no,scrollbars=no,resizable=yes,location=no,directories=no,status=no"); } function nopromo(type) { alert("We're sorry, but " + type + " are not available for your handset."); } function nopromo_full(msg) { alert(msg); } function no_listen_preview(cdcid,ctid) { alert("Sorry, there is no audio preview available"); } function no_video_preview(cdcid,ctid) { alert( "Sorry, there is no video preview available" ); } //subnav var promoval = '&promo=false'; function isCategoryTreeDiv(div) { return (div.className == "categoryTreeLevel1" || div.className == "categoryTreeLevel2"); } function repop_nav(catid, baseUrl) { var divs = document.getElementsByTagName("div"); var open = 0; for (var i = 0; (i 0 || end < s.length) ? s.substring(begin, end) : s; } function download_steps() { window.open( "../storefront/endUserPurchaseDownloadSteps.html","Info","width=500,height=470,status=no,toolbar=no,menubar=no,scrollbars=no,resizable=yes,location=no,directories=no,status=no"); } function clickElementOnEnterKeyPress(event, elementId) { var keyCode = event ? (event.which ? event.which : event.keyCode) : event.keyCode; if (keyCode == 13) { document.getElementById(elementId).click(); return false; } return true; }