function LoadGallery(pictureName, imageFile) { var preload = document.getElementById('preload_'+current_preload); if(document.all) { document.getElementById('preloaded_img_'+current_preload).style.filter="blendTrans(duration=1)"; document.getElementById('preloaded_img_'+current_preload).filters.blendTrans.Apply(); document.getElementById('preloaded_img_'+current_preload).filters.blendTrans.Play(); } sty = preload.style; sty.display = 'none'; var new_preload = document.getElementById('preload_'+imageFile); if (document.all) { document.getElementById('preloaded_img_'+imageFile).style.filter="blendTrans(duration=1)"; document.getElementById('preloaded_img_'+imageFile).filters.blendTrans.Apply(); document.getElementById('preloaded_img_'+imageFile).filters.blendTrans.Play(); } sty = new_preload.style; sty.display = 'block'; current_preload = imageFile; } function popup2(topic) { aPopUp= window.open(topic,'PopupViewer','scrollbars=yes,location=no,status=no,menubar=0,directories=no,top=0,left=0,width=390,height=360,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 popupWindow(image_id, product_id) { LeftPosition = (screen.width) ? (screen.width-500)/2 : 0; TopPosition = (screen.height) ? (screen.height-500)/2 : 0; settings = 'height=125,width=50,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 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 validate_register_form() { if ( document.register_form.first_name!=null && ( document.register_form.first_name.value == "" || document.register_form.first_name.value.length < 1 ) ) { alert( 'You must enter your first name.' ); document.register_form.first_name.focus(); return false; } if ( document.register_form.last_name!=null && ( document.register_form.last_name.value == "" || document.register_form.last_name.value.length < 1 ) ) { alert( 'You must enter your last name' ); document.register_form.last_name.focus(); return false; } if ( document.register_form.email_address!=null && ( document.register_form.email_address.value == "" || document.register_form.email_address.value.length < 6 ) ) { alert( 'You must enter your email address.' ); document.register_form.email_address.focus(); return false; } if ( document.register_form.address1!=null && document.register_form.address1.value == "" ) { alert( 'You must enter an address.' ); document.register_form.address1.focus(); return false; } if ( document.register_form.town!=null && document.register_form.town.value == "" ) { alert( 'You must enter a town.' ); document.register_form.town.focus(); return false; } /* if ( document.register_form.county!=null && document.register_form.county.value == "" ) { alert( 'You must enter a county.' ); document.register_form.county.focus(); return false; } */ if ( document.register_form.telephone!=null && ( document.register_form.telephone.value == "" || document.register_form.telephone.value.length < 5 ) ) { alert( 'You must provide your telephone number.' ); document.register_form.telephone.focus(); return false; } if ( document.register_form.email!=null && document.register_form.email.value == "" ) { alert( 'You must enter an email address.' ); document.register_form.email.focus(); return false; } if ( document.register_form.password!=null && document.register_form.password.value == "" ) { alert( 'You must provide your password.' ); document.register_form.password.focus(); return false; } return true; } function validate_reminder_service() { if ( document.reminder_service_form.name!=null && document.reminder_service_form.name.value == "" ) { alert( 'You must enter your name.' ); document.reminder_service_form.name.focus(); return false; } if ( document.reminder_service_form.address!=null && document.reminder_service_form.address.value == "" ) { alert( 'You must enter your address.' ); document.reminder_service_form.address.focus(); return false; } if ( document.reminder_service_form.postcode!=null && document.reminder_service_form.postcode.value == "" ) { alert( 'You must enter your postcode.' ); document.reminder_service_form.postcode.focus(); return false; } if ( document.reminder_service_form.email_address!=null && document.reminder_service_form.email_address.value == "" ) { alert( 'You must enter your email address.' ); document.reminder_service_form.email_address.focus(); return false; } if ( document.reminder_service_form.tel!=null && document.reminder_service_form.tel.value == "" ) { alert( 'You must enter your telephone number.' ); document.reminder_service_form.tel.focus(); return false; } if ( document.reminder_service_form.make!=null && document.reminder_service_form.make.value == "" ) { alert( 'You must enter The make of your car.' ); document.reminder_service_form.make.focus(); return false; } if ( document.reminder_service_form.model!=null && document.reminder_service_form.model.value == "" ) { alert( 'You must enter the model of your car.' ); document.reminder_service_form.modelfocus(); return false; } if ( document.reminder_service_form.registration!=null && document.reminder_service_form.registration.value == "" ) { alert( 'You must enter your car registration.' ); document.reminder_service_form.registration.focus(); return false; } return true; } function validate_payment_form() { if( document.postcode_search_form.name_on_card.value == "" ) { alert( 'You must enter the name embossed on your card.' ); document.postcode_search_form.name_on_card.focus(); return false; } if( document.postcode_search_form.card_number.value == "" ) { alert( 'You must enter the long number found on the front of your card.' ); document.postcode_search_form.card_number.focus(); return false; } if( document.postcode_search_form.cvv2.value == "" ) { alert( 'You must enter the 3 digit security code found on the back of your card.' ); document.postcode_search_form.cvv2.focus(); return false; } return true; } function validate_postcode_search_form() { if ( document.postcode_search_form.postcode.value == "" || document.postcode_search_form.postcode.value == "Postcode..." ) { alert('You must enter a valid UK postcode.'); return false; } else { return true; } } 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