function popup2(topic) { aPopUp= window.open(topic,'PopupViewer','scrollbars=yes,location=no,status=no,menubar=0,directories=no,top=0,left=0,width=754,height=200,titlebar=no') self.aNoteWin = aPopUp; return false; } function popup(topic, width, height) { aPopUp= window.open(topic,'PopupViewer','scrollbars=yes,location=no,status=no,menubar=0,directories=no,top=0,left=0,width='+width+',height='+height+',titlebar=no') self.aNoteWin = aPopUp; return false; } function getDocHeight(IFrameDoc) { return (typeof IFrameDoc.height != 'undefined') ? IFrameDoc.height : (IFrameDoc.body && typeof IFrameDoc.body.scrollHeight != 'undefined') ? IFrameDoc.body.scrollHeight : null; } function sizeToContent(iframe_ref) { var IFrameDoc, oIframe = document.getElementById(iframe_ref); if (typeof oIframe != null) { if (oIframe.contentDocument) IFrameDoc = oIframe.contentDocument; else if (oIframe.contentWindow) IFrameDoc = oIframe.contentWindow.document; else if (oIframe.document) IFrameDoc = oIframe.document; var hgt = getDocHeight(IFrameDoc); if (hgt) oIframe.style.height = String(hgt + 'px'); } } function popupWindow(image_id, product_id) { LeftPosition = (screen.width) ? (screen.width-500)/2 : 0; TopPosition = (screen.height) ? (screen.height-500)/2 : 0; settings = 'height=696,width=754,top='+TopPosition+',left='+LeftPosition+',toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=1'; win = window.open("/view_image.html?image_id=" + image_id+ "&product_id="+product_id,null,settings); } function facebookPopUp(url) { LeftPosition = (screen.width) ? (screen.width-500)/2 : 0; TopPosition = (screen.height) ? (screen.height-500)/2 : 0; settings = 'height=500,width=600,top='+TopPosition+',left='+LeftPosition+',toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=1'; win = window.open("http://www.facebook.com/sharer.php?u="+url,null,settings); } function checkPassword(strPassword) { var intScore = 0 var strVerdict = "weak" var strLog = "" var intPercent = 0 // PASSWORD LENGTH if (strPassword.length<5) // length 4 or less { intScore = (intScore+3) strLog = strLog + "3 points for length (" + strPassword.length + ")\n" } else if (strPassword.length>4 && strPassword.length<8) // length between 5 and 7 { intScore = (intScore+6) strLog = strLog + "6 points for length (" + strPassword.length + ")\n" } else if (strPassword.length>7 && strPassword.length<16)// length between 8 and 15 { intScore = (intScore+12) strLog = strLog + "12 points for length (" + strPassword.length + ")\n" } else if (strPassword.length>15) // length 16 or more { intScore = (intScore+18) strLog = strLog + "18 point for length (" + strPassword.length + ")\n" } // LETTERS (Not exactly implemented as dictacted above because of my limited understanding of Regex) if (strPassword.match(/[a-z]/)) // [verified] at least one lower case letter { intScore = (intScore+1) strLog = strLog + "1 point for at least one lower case char\n" } if (strPassword.match(/[A-Z]/)) // [verified] at least one upper case letter { intScore = (intScore+5) strLog = strLog + "5 points for at least one upper case char\n" } // NUMBERS if (strPassword.match(/\d+/)) // [verified] at least one number { intScore = (intScore+5) strLog = strLog + "5 points for at least one number\n" } if (strPassword.match(/(.*[0-9].*[0-9].*[0-9])/)) // [verified] at least three numbers { intScore = (intScore+5) strLog = strLog + "5 points for at least three numbers\n" } // SPECIAL CHAR if (strPassword.match(/.[!,@,#,$,%,^,&,*,?,_,~]/)) // [verified] at least one special character { intScore = (intScore+5) strLog = strLog + "5 points for at least one special char\n" } // [verified] at least two special characters if (strPassword.match(/(.*[!,@,#,$,%,^,&,*,?,_,~].*[!,@,#,$,%,^,&,*,?,_,~])/)) { intScore = (intScore+5) strLog = strLog + "5 points for at least two special chars\n" } // COMBOS if (strPassword.match(/([a-z].*[A-Z])|([A-Z].*[a-z])/)) // [verified] both upper and lower case { intScore = (intScore+2) strLog = strLog + "2 combo points for upper and lower letters\n" } if (strPassword.match(/(\d.*\D)|(\D.*\d)/)) // [FAILED] both letters and numbers, almost works because an additional character is required { intScore = (intScore+2) strLog = strLog + "2 combo points for letters and numbers\n" } // [verified] letters, numbers, and special characters if (strPassword.match(/([a-zA-Z0-9].*[!,@,#,$,%,^,&,*,?,_,~])|([!,@,#,$,%,^,&,*,?,_,~].*[a-zA-Z0-9])/)) { intScore = (intScore+2) strLog = strLog + "2 combo points for letters, numbers and special chars\n" } if(intScore < 16) { strVerdict = "very weak" } else if (intScore > 15 && intScore < 25) { strVerdict = "weak" } else if (intScore > 24 && intScore < 35) { strVerdict = "mediocre" } else if (intScore > 34 && intScore < 45) { strVerdict = "strong" } else { strVerdict = "stronger" } //document.forms.passwordForm.score.value = (intScore) //document.forms.passwordForm.verdict.value = (strVerdict) //document.forms.passwordForm.matchlog.value = (strLog) intPercent = intScore * 3; //intScore = intScore * 2 objBar = document.getElementById("passBar"); if (intPercent > 0) { if (intPercent>100) { intPercent=100; // just to check if it goes over 100 } objBar.style.width = intPercent + "%"; if (intPercent < 50) { objBar.style.background = "#cc0000"; } else if(intPercent < 84) { objBar.style.background = "#FFD700"; } else { objBar.style.background = "#00A601"; } } else { objBar.style.width = 0; } } function comparePassword () { var password = document.getElementById('password').value; var password_confirm = document.getElementById('password_confirm').value; if (password == password_confirm) { document.getElementById('password_confirmation_text').style.display="none"; } else { document.getElementById('password_confirmation_text').style.display=""; } } function validate_register_form() { var valid=true; if (document.register_form.first_name.value == "") { document.getElementById('register_error').style.display=""; document.register_form.man_first_name.focus(); valid=false; } if (valid && document.register_form.surname.value == "") { document.getElementById('register_error').style.display=""; document.register_form.man_surname.focus(); valid=false; } if (valid && document.register_form.m.value == "") { document.getElementById('register_error').style.display=""; document.register_form.man_date.focus(); valid=false; } if (valid && document.register_form.email_address.value == "") { document.getElementById('register_error').style.display=""; document.register_form.man_email_address.focus(); valid=false; } } function confirmAction(strMsg) { var bAnswer = confirm (strMsg); if (bAnswer) { return true; } else { return false; } } /* Generic Form Validation */ window.onload = attachFormHandlers; function attachFormHandlers() { if (document.getElementsByTagName) { var objForm = document.getElementsByTagName('form'); for (var iCounter=0; iCounter'; } function scrollUp() { var scroller = document.getElementById('image_right_holder'); if (scroller.scrollTop > 0) { scroller.scrollTop = scroller.scrollTop - 121; } } function scrollDown() { var scroller = document.getElementById('image_right_holder'); if (scroller.scrollTop < scroller.scrollHeight) { scroller.scrollTop = scroller.scrollTop + 121; } } function scrollForward() { var scroller = document.getElementById('product_thumbs_box'); if (scroller.scrollLeft < scroller.scrollWidth) { scroller.scrollLeft = scroller.scrollLeft + 71; } } function scrollBack() { var scroller = document.getElementById('product_thumbs_box'); if (scroller.scrollLeft > 0) { scroller.scrollLeft = scroller.scrollLeft - 71; } } var account_code = 'DELIM11112'; var license_code = 'EX86-YY38-WM26-XT28'; function pcaFastAddressBegin() { var postcode = document.getElementById('postcode').value; var building = document.getElementById('house').value; if(postcode != '' && building != '') { var scriptTag = document.getElementById("pcaScriptTag"); var headTag = document.getElementsByTagName("head").item(0); var strUrl = ""; //Build the url strUrl = "http://services.postcodeanywhere.co.uk/inline.aspx?"; strUrl += "&action=fetch"; strUrl += "&postcode=" + escape(postcode); strUrl += "&building=" + escape(building); strUrl += "&account_code=" + escape(account_code); strUrl += "&license_code=" + escape(license_code); strUrl += "&callback=pcaFastAddressEnd"; //Make the request if (scriptTag) { //The following 2 lines perform the same function and should be interchangeable headTag.removeChild(scriptTag); //scriptTag.parentNode.removeChild(scriptTag); } scriptTag = document.createElement("script"); scriptTag.src = strUrl scriptTag.type = "text/javascript"; scriptTag.id = "pcaScriptTag"; headTag.appendChild(scriptTag); } else { alert("Please enter your house number or name and a valid postcode and try again."); return false; } } function pcaFastAddressEnd() { //Test for an error if (pcaIsError) { //Show the error message alert(pcaErrorMessage); return false; } else { //Check if there were any items found if (pcaRecordCount==0) { alert("Sorry, no matching items found"); return false; } else { document.getElementById('address1').value = '' + pca_line1[0]; document.getElementById('address2').value = '' + pca_line2[0]; document.getElementById('town').value = '' + pca_post_town[0]; document.getElementById('county').value = '' + pca_county[0]; document.getElementById('postcode').value = '' + pca_postcode[0]; return false; } } }