framebreakout(); var forumWindow; function openForum(url){ forumWindow = window.open(url, "Forum", "width=700,height=400,resizable,scrollbars"); forumWindow.focus(); return false; } var card_logos = new Array('/images/logos/n4.gif', '/images/logos/mastercard.gif', '/images/logos/visa.gif', '/images/logos/delta.gif', '/images/logos/american_express.gif', '/images/logos/jcb.gif', '/images/logos/switch.gif', '/images/logos/solo.gif', '/images/logos/paybox.gif'); var number_Img = new Array('/images/phone_number.gif', '/images/card_number.gif'); var corners = new Array('/images/corner_green_tl.gif', '/images/corner_green_tr.gif', '/images/corner_green_bl.gif', '/images/corner_green_br.gif'); var processingorder = new Array('/images/new/cursor.gif', '/images/new/new_logo.gif'); function go(href) { window.location.replace(href); } function goex(href) { var newWindow; newWindow = window.open(href); } function setCookie(cookieName, cookieValue, cookiePath, cookieExpires) { cookieValue = escape(cookieValue); if (cookieExpires == "") { var nowDate = new Date(); nowDate.setMonth(nowDate.getMonth() + 12); cookieExpires = nowDate.toGMTString(); } if (cookiePath != "") { cookiePath = ";Path=" + cookiePath; } document.cookie = cookieName + "=" + cookieValue + ";expires=" + cookieExpires + cookiePath; } function getCookieValue(cookieName) { var cookieValue = document.cookie; var cookieStartsAt = cookieValue.indexOf(" " + cookieName + "="); if (cookieStartsAt == -1) { cookieStartsAt = cookieValue.indexOf(cookieName + "="); } if (cookieStartsAt == -1) { cookieValue = null; } else { cookieStartsAt = cookieValue.indexOf("=", cookieStartsAt) + 1; var cookieEndsAt = cookieValue.indexOf(";", cookieStartsAt); if (cookieEndsAt == -1) { cookieEndsAt = cookieValue.length; } cookieValue = unescape(cookieValue.substring(cookieStartsAt, cookieEndsAt)); } return cookieValue; } function browseForward(categoryName, catalogName, startingRecord, recordsToRetrieve){ document.frmCategory.txtCategory.value=categoryName; document.frmCategory.txtCatalog.value=cvalue=parseInt(startingRecord)+parseInt(recordsToRetrieve); document.frmCategory.txtRecordsToRetrieve.value=parseInt(recordsToRetrieve); document.frmCategory.submit() } function browseBack(categoryName, catalogName, startingRecord, recordsToRetrieve){ document.frmCategory.txtCategory.value=categoryName; document.frmCategory.txtCataloatalogName; document.frmCategory.txtStartingRecord.g.value=catalogName; if ((parseInt(startingRecord)-parseInt(recordsToRetrieve)) < 1) { document.frmCategory.txtStartingRecord.value=1; } else { document.frmCategory.txtStartingRecord.value=parseInt(startingRecord)-parseInt(recordsToRetrieve); } document.frmCategory.txtRecordsToRetrieve.value=parseInt(recordsToRetrieve); document.frmCategory.submit() } function productsPerPage(categoryName, catalogName, startingRecord, recordsToRetrieve, htmlpagename){ document.frmCategory.txtCategory.value=categoryName; document.frmCategory.txtCatalog.value=catalogName; document.frmCategory.txtStartingRecord.value=parseInt(startingRecord); document.frmCategory.txtRecordsToRetrieve.value=parseInt(recordsToRetrieve); document.frmCategory.ppp.value=parseInt(recordsToRetrieve); document.frmCategory.action = "/shop/" + startingRecord + "/" + recordsToRetrieve + "/" + htmlpagename + ".htm"; document.frmCategory.submit() } function doPreload() { preloadImages(card_logos); preloadImages(number_Img); preloadImages(corners); preloadImages(processingorder); } function preloadImages(the_images_array) { for(var loop = 0; loop < the_images_array.length; loop++) { var an_image = new Image(); an_image.src = the_images_array[loop]; } } function preloadMultiImages(the_images_array) { for(var loop = 0; loop < the_images_array.length; loop++) { var brand_image = new Image(); brand_image.src = the_images_array[loop][1]; } } function framebreakout() { if (top.location != location) { top.location.href = document.location.href ; } } function submitPayment() { if (SubmitCheckPayment()!=false) { document.frmAccountInfo.submit(); } } function stringFilter (input) { s = input.value; filteredValues = " "; // Characters stripped out var i; var returnString = ""; for (i = 0; i < s.length; i++) { // Search through string and append to unfiltered values to returnString. var c = s.charAt(i); if (filteredValues.indexOf(c) == -1) returnString += c; } input.value = returnString; } var method_index = 0; function SubmitCheckPayment(){ //Ensures user completes data entry forms // regular expression for string that only contains 0 or more whitespace chars // i.e. a sophisticated "blank field" check var reBlank = /^\s*$/; if (method_index == 0){ alert("Please select a payment method."); document.frmAccountInfo.txtBPaymentMethod.focus(); loading.visibility = 'hidden'; return false; } var sname=document.frmAccountInfo.txtBNameOnAcct.value; if (reBlank.test(sname)){ alert("You must enter the name on the account." + method_index); document.frmAccountInfo.txtBNameOnAcct.value=""; document.frmAccountInfo.txtBNameOnAcct.focus(); loading.visibility = 'hidden'; return false; } var saccountnum=document.frmAccountInfo.txtBCardNo.value; if (reBlank.test(saccountnum)){ alert("You must enter your credit or debit card number."); document.frmAccountInfo.txtBCardNo.value=""; document.frmAccountInfo.txtBCardNo.focus(); loading.visibility = 'hidden'; return false; } var scv2num=document.frmAccountInfo.txtCV2.value; if (reBlank.test(scv2num)){ alert("You must enter your card verification number (the last three digits on the back of your card)."); document.frmAccountInfo.txtCV2.value=""; document.frmAccountInfo.txtCV2.focus(); loading.visibility = 'hidden'; return false; } var sCard = document.frmAccountInfo.txtBPaymentMethod.value; if (sCard == 'American Express') { var reCV2 = /\b[0-9]{4}\b/; if (!(reCV2.test(scv2num))) { alert("Your card verification number should be four digits long."); document.frmAccountInfo.txtCV2.value=""; document.frmAccountInfo.txtCV2.focus(); loading.visibility = 'hidden'; return false; } } else { var reCV2 = /\b[0-9]{3}\b/; if (!(reCV2.test(scv2num))) { alert("Your card verification number should be three digits long."); document.frmAccountInfo.txtCV2.value=""; document.frmAccountInfo.txtCV2.focus(); loading.visibility = 'hidden'; return false; } } var pattern = /\s/g; document.frmAccountInfo.txtBCardNo.value = saccountnum.replace(pattern, ""); var payment_method = document.frmAccountInfo.txtBPaymentMethod[method_index].value; if (payment_method == 'Switch' || payment_method == 'Solo') { var issue_no = document.frmAccountInfo.txtIssueNo.value; var startMonth = document.frmAccountInfo.txtBCardStrtMth.value; var startYear = document.frmAccountInfo.txtBCardStrtYr.value; if (issue_no == '--' && (startMonth == '--' || startYear == '--')) { alert("If you are paying with Maestro or Solo please select an Issue Number or Start Date"); loading.visibility = 'hidden'; return false; } } if (payment_method == 'paybox') { var country_code = document.frmAccountInfo.payboxCCode.value; if (country_code == '--') { alert("If you are paying with paybox please select a country code below."); loading.visibility = 'hidden'; return false; } } } function changeCard(cardIndex) { document.card_logo.src=card_logos[cardIndex]; document.frmAccountInfo.txtBCardNo.focus(); method_index=cardIndex; if (document.frmAccountInfo.txtBPaymentMethod[cardIndex].value == 'paybox') { document.numberImg.src=number_Img[0]; } else { document.numberImg.src=number_Img[1]; } } function saveAddress(){ //Ensures user completes data entry forms // regular expression for string that only contains 0 or more whitespace chars // i.e. a sophisticated "blank field" check var reBlank = /^\s*$/; var bSubmit = true; var stxtListedAs=document.frmEditAddressBook.txtListedAs.value; if (reBlank.test(stxtListedAs)){ alert("Please enter the 'Listed As' information ."); document.frmEditAddressBook.txtListedAs.focus; bSubmit = false; } var saddressname=document.frmEditAddressBook.txtAddressName.value; if (reBlank.test(saddressname)){ if (bSubmit == true) { alert("Please enter the name of the recipient"); } document.frmEditAddressBook.txtAddressName.focus; bSubmit = false; } var saddress1=document.frmEditAddressBook.txtAddressLine1.value; if (reBlank.test(saddress1)){ if (bSubmit == true) { alert("You must enter at least one line of address."); } document.frmEditAddressBook.txtAddressLine1.focus; bSubmit = false; } var scity=document.frmEditAddressBook.txtCity.value; if (reBlank.test(scity)){ if (bSubmit == true) { alert("Please enter the town"); } document.frmEditAddressBook.txtCity.focus; bSubmit = false; } if (document.frmEditAddressBook.txtCountryName.value != "Republic of Ireland") { var szip=document.frmEditAddressBook.txtPostalCode.value; if (reBlank.test(szip)){ if (bSubmit == true) { alert(document.frmEditAddressBook.txtCountryName.value); } document.frmEditAddressBook.txtPostalCode.focus; bSubmit = false; } } var strPhone=document.frmEditAddressBook.txtPhoneNumber.value; if (reBlank.test(strPhone)){ if (bSubmit == true) { alert("Please provide a contact telephone number (for delivery and order issues)"); } document.frmEditAddressBook.txtPhoneNumber.focus; bSubmit = false; } if (checkInternationalPhone(strPhone)==false) { if (bSubmit == true) { alert("Your telephone number does not appear to be valid."); } document.frmEditAddressBook.txtPhoneNumber.focus; bSubmit = false; } if (bSubmit == true) { document.frmEditAddressBook.ProcessAction.value = "EditAddress"; document.frmEditAddressBook.submit(); } } function verifyAddress() { var reBlank = /^\s*$/; var bSubmit = true; var v_premise=document.frmEditAddressBook.v_premise.value; if (reBlank.test(v_premise)){ alert("Please enter the number or name of the property"); document.frmEditAddressBook.v_premise.focus; bSubmit = false; } var v_postcode=document.frmEditAddressBook.v_postcode.value; if (reBlank.test(v_postcode)){ alert("Please enter the post code of the address"); document.frmEditAddressBook.v_postcode.focus; bSubmit = false; } if (bSubmit == true) { document.frmEditAddressBook.ProcessAction.value = "VerifyAddress"; document.frmEditAddressBook.submit(); } } function selectAddress() { document.frmEditAddressBook.ProcessAction.value = "selectAddress"; document.frmEditAddressBook.submit(); } function SubmitCheck(){ //Ensures user enters a User Name and Password var sUserName = document.frmLogin.txtUserName.value; if (sUserName.length == 0) { alert("Please enter your email address") document.frmLogin.txtUserName.focus(); return false; } var sPassword = document.frmLogin.txtPassword.value; if (sPassword.length == 0){ alert("Please enter your password") document.frmLogin.txtPassword.focus(); return false; } return true; } function ForgotSubmitCheck(){ //Ensures user enters a User Name and Password var sUserName = document.frmLogin.txtUserName.value; if (sUserName.length == 0) { alert("Please enter your email address at the top so we can send you your password.") document.frmLogin.txtUserName.focus(); } else { document.frmForgot.txtUserName.value = sUserName; document.frmForgot.submit(); } } function RegSubmitCheck(){ //Ensures user enters Username, Password, and 'Confirm Password.' //Password must match 'Confirm Password' var susernamepreblanks = document.frmRegistration.txtFirstName.value; StripBlanks('txtFirstName') var susername = document.frmRegistration.txtFirstName.value; if (susernamepreblanks.length == 0) { alert("Please enter a username"); document.frmRegistration.txtFirstName.focus(); return false; } if (susername.length != susernamepreblanks.length) { alert("Please enter a name that does not begin or end with blank spaces."); document.frmRegistration.txtFirstName.value=""; document.frmRegistration.txtFirstName.focus(); return false; } StripBlanks('txtEmailAddress') var semail = document.frmRegistration.txtEmailAddress.value; if (semail.length == 0) { alert("Please enter a valid email address"); document.frmRegistration.txtEmailAddress.focus(); return false; } if (IsEmailValid("frmRegistration", "txtEmailAddress2") == false) { alert("This is not a valid email address"); document.frmRegistration.txtEmailAddress2.focus(); return false; } StripBlanks('txtEmailAddress2') var sconfirmemail = document.frmRegistration.txtEmailAddress2.value; if (sconfirmemail.length == 0) { alert("Please re-type your email address."); document.frmRegistration.txtEmailAddress2.focus(); return false; } if (IsEmailValid("frmRegistration", "txtEmailAddress2") == false) { alert("This is not a valid email address"); document.frmRegistration.txtEmailAddress2.focus(); return false; } if (sconfirmemail != semail){ alert("The two entries for your email address do not match."); document.frmRegistration.txtEmailAddress.focus() return false; } var spasswordpreblanks = document.frmRegistration.txtUserSecurityPassword.value; StripBlanks('txtUserSecurityPassword') var spassword = document.frmRegistration.txtUserSecurityPassword.value; if (spassword.length != spasswordpreblanks.length) { alert("Please enter a password that does not begin or end with blank spaces."); document.frmRegistration.txtUserSecurityPassword.value = ""; document.frmRegistration.txtUserSecurityPassword2.value = ""; document.frmRegistration.txtUserSecurityPassword.focus(); return false; } if (spassword.length == 0) { alert("Please choose a password"); document.frmRegistration.txtUserSecurityPassword.focus(); return false; } var sconfirmpreblanks = document.frmRegistration.txtUserSecurityPassword2.value; StripBlanks('txtUserSecurityPassword2') var sconfirm = document.frmRegistration.txtUserSecurityPassword2.value; if (sconfirm.length != sconfirmpreblanks.length) { alert("Please enter a password that does not begin or end with blank spaces."); document.frmRegistration.txtUserSecurityPassword.value = ""; document.frmRegistration.txtUserSecurityPassword2.value = ""; document.frmRegistration.txtUserSecurityPassword.focus(); return false; } if (sconfirm.length == 0) { alert("Please re-type your password."); document.frmRegistration.txtUserSecurityPassword2.focus(); return false; } if (sconfirm != spassword){ alert("The two entries for your new password do not match."); document.frmRegistration.txtUserSecurityPassword.value = ""; document.frmRegistration.txtUserSecurityPassword2.value = ""; document.frmRegistration.txtUserSecurityPassword.focus(); return false; } return true; } function StripBlanks(strFieldName) { // receives field name as input. Strips leading and trailing blanks from the specified form field. // regExp to match leading blanks var reStartBlanks = /^\s*/; // regExp to match trailing blanks var reEndBlanks = /\s*$/; // replace contents of specified form field with the current value with leading, then trailing // blanks replaced with empty string. document.frmRegistration(strFieldName).value = document.frmRegistration(strFieldName).value.replace(reStartBlanks,""); document.frmRegistration(strFieldName).value = document.frmRegistration(strFieldName).value.replace(reEndBlanks,""); } function StripBlanksLogin(strFieldName) { // receives field name as input. Strips leading and trailing blanks from the specified form field. // regExp to match leading blanks var reStartBlanks = /^\s*/; // regExp to match trailing blanks var reEndBlanks = /\s*$/; // replace contents of specified form field with the current value with leading, then trailing // blanks replaced with empty string. document.frmLogin(strFieldName).value = document.frmLogin(strFieldName).value.replace(reStartBlanks,""); document.frmLogin(strFieldName).value = document.frmLogin(strFieldName).value.replace(reEndBlanks,""); } function IsEmailValid(FormName,ElemName) { var EmailOk = true var Temp = document.forms[FormName].elements[ElemName] var AtSym = Temp.value.indexOf('@') var Period = Temp.value.lastIndexOf('.') var Space = Temp.value.indexOf(' ') var Length = Temp.value.length - 1 // Array is from 0 to length-1 if ((AtSym < 1) || // '@' cannot be in first position (Period <= AtSym+1) || // Must be atleast one valid char btwn '@' and '.' (Period == Length ) || // Must be atleast one valid char after '.' (Space != -1)) // No empty spaces permitted { EmailOk = false alert('Please enter a valid e-mail address!') Temp.focus() } return EmailOk } function profileSubmitCheck(){ //Ensures user completes data entry forms // regular expression for string that only contains 0 or more whitespace chars // i.e. a sophisticated "blank field" check var reBlank = /^\s*$/; var sfirstname=document.frmUserProfile.txtFirstName.value; if (reBlank.test(sfirstname)){ alert("You must enter your first name."); document.frmUserProfile.txtFirstName.value=""; document.frmUserProfile.txtFirstName.focus(); return false; } //var slastname=document.frmUserProfile.txtLastName.value; //if (reBlank.test(slastname)){ // alert("You must enter your last name."); // document.frmUserProfile.txtLastName.value=""; // document.frmUserProfile.txtLastName.focus; // return false; //} var semail=document.frmUserProfile.txtEmailAddress.value; if (reBlank.test(semail)){ alert("You must enter your Email Address."); document.frmUserProfile.txtEmailAddress.value=""; document.frmUserProfile.txtEmailAddress.focus(); return false; } } /** * DHTML phone number validation script. Courtesy of SmartWebby.com (http://www.smartwebby.com/dhtml/) */ // Declaring required variables var digits = "0123456789"; // non-digit characters which are allowed in phone numbers var phoneNumberDelimiters = "()- "; // characters which are allowed in international phone numbers // (a leading + is OK) var validWorldPhoneChars = phoneNumberDelimiters + "+"; // Minimum no of digits in an international phone no. var minDigitsInIPhoneNumber = 10; function isInteger(s) { var i; for (i = 0; i < s.length; i++) { // Check that current character is number. var c = s.charAt(i); if (((c < "0") || (c > "9"))) return false; } // All characters are numbers. return true; } function stripCharsInBag(s, bag) { var i; var returnString = ""; // Search through string's characters one by one. // If character is not in bag, append to returnString. for (i = 0; i < s.length; i++) { // Check that current character isn't whitespace. var c = s.charAt(i); if (bag.indexOf(c) == -1) returnString += c; } return returnString; } function checkInternationalPhone(strPhone){ s=stripCharsInBag(strPhone,validWorldPhoneChars); return (isInteger(s) && s.length >= minDigitsInIPhoneNumber); } function ValidatePhonenumber(){ var Phone=document.frmSample.txtPhone if ((Phone.value==null)||(Phone.value=="")){ alert("Please Enter your Phone Number") Phone.focus() return false } if (checkInternationalPhone(Phone.value)==false){ alert("Please Enter a Valid Phone Number") Phone.value="" Phone.focus() return false } return true } function changepwSubmitCheck() { // when the username is not entered, the user is notified they // need to enter there your name. StripBlanks('txtCurrentPassword'); var sopassword = document.frmChgPswd.txtCurrentPassword.value; if (sopassword.length == 0) { alert("Please enter your current password"); document.frmChgPswd.txtCurrentPassword.focus() return false; } var snpasswordpreblanks = document.frmChgPswd.txtNewPassword.value; StripBlanks('txtNewPassword'); var snpassword = document.frmChgPswd.txtNewPassword.value; if (snpassword.length != snpasswordpreblanks.length) { alert("Please enter a new password, that does not begin or end with blank spaces"); document.frmChgPswd.txtNewPassword.value=""; document.frmChgPswd.txtConfirmPassword.value=""; document.frmChgPswd.txtNewPassword.focus() return false; } if (snpassword.length == 0) { alert("Please enter a new password"); document.frmChgPswd.txtNewPassword.focus() return false; } var scpasswordpreblanks = document.frmChgPswd.txtConfirmPassword.value; StripBlanks('txtConfirmPassword'); var scpassword = document.frmChgPswd.txtConfirmPassword.value; if (scpassword.length != scpasswordpreblanks.length) { alert("Please enter a new password, that does not begin or end with blank spaces"); document.frmChgPswd.txtNewPassword.value=""; document.frmChgPswd.txtConfirmPassword.value=""; document.frmChgPswd.txtNewPassword.focus() return false; } if (scpassword.length == 0) { alert("Please re-type your new password"); document.frmChgPswd.txtConfirmPassword.focus() return false; } if (snpassword != scpassword) { alert("The new and re-typed password do not match"); document.frmChgPswd.txtNewPassword.value=""; document.frmChgPswd.txtConfirmPassword.value=""; document.frmChgPswd.txtNewPassword.focus() return false; } return true; } function changepwStripBlanks(strFieldName) { // receives field name as input. Strips leading and trailing blanks from the specified form field. // regExp to match leading blanks var reStartBlanks = /^\s*/; // regExp to match trailing blanks var reEndBlanks = /\s*$/; // replace contents of specified form field with the current value with leading, then trailing // blanks replaced with empty string. document.frmChgPswd(strFieldName).value = document.frmChgPswd(strFieldName).value.replace(reStartBlanks,""); document.frmChgPswd(strFieldName).value = document.frmChgPswd(strFieldName).value.replace(reEndBlanks,""); } function browseSearchResults(action, searchString, searchStartPos, searchRowsToReturn, searchCount) { if (action == 'next') { document.formReSearch.txtSearchPhrase.value = searchString; document.formReSearch.txtSearchStartPos.value = searchStartPos + searchRowsToReturn; document.formReSearch.txtSearchRowToReturn.value = searchRowsToReturn; document.formReSearch.submit(); } else if (action == 'previous') { document.formReSearch.txtSearchPhrase.value = searchString; if (searchStartPos - searchRowsToReturn < 1) { document.formReSearch.txtSearchStartPos.value = 1; } else { document.formReSearch.txtSearchStartPos.value = searchStartPos - searchRowsToReturn; } document.formReSearch.txtSearchRowToReturn.value = searchRowsToReturn; document.formReSearch.submit(); } else if (action == 'productsperpage') { document.formReSearch.txtSearchPhrase.value = searchString; document.formReSearch.txtSearchStartPos.value = searchStartPos; document.formReSearch.txtSearchRowToReturn.value = searchRowsToReturn; document.formReSearch.ppp.value = parseInt(searchRowsToReturn); document.formReSearch.submit(); } }