function changeImage(a){$("#"+a).attr("src","http://www.DressilyMe.com/Ajax/ValidateCode.aspx?"+Math.random())}function ReviewDetailChar(){var a=$("#reviewContent").text();if(a==""){a=$("#reviewContent").val()}if(a.length<2000){return}else{$("#reviewContent").text(a.substring(0,2000));$("#reviewContent").val(a.substring(0,2000))}}function isEmail(b){var a=/^\s*[-_A-Za-z0-9]+(\.[-_A-Za-z0-9]+)*@([_A-Za-z0-9]+\.)+[A-Za-z0-9]{2,3}\s*$/;if(a.test(b)){return true}return false}var bFlag=true;var reviewcontent="Tell us what you think about this item*, and share your opinion with our other customers. \nPlease make sure that your review is moderated and focus on this item. All the reviews will be posted within two business days, excluding inappropriate ones. \n* This message is for product reviews only, any query about products and orders will not be replied here.";function ContentMsgFocus(){if(bFlag==true){$("#reviewContent").val("");bFlag=false}else{if($("#reviewContent").val()==""){$("#reviewContent").val(reviewcontent);bFlag=true}}}function SubmitReview(){var d=$("#nicknameTxt").val();var c=$("#emailTxt").val();var b=$("#passwordTxt").val();var g=$("#reviewContent").val();var f=$("#ReviewProductId").val();var a=$("#txtRVerify").val();var e=$("#product_score").val();if(g==""||g==reviewcontent){$("#reviewContent").focus();$("#ContentMsg").html('<span><img src="http://www.dressilyme.com/Images/MyAccountImages/Icon_ArrowError.gif" /></span> Review content can not be empty.');$("#ContentMsg").css("display","");return}else{if(!isValidString(g)){$("#reviewContent").focus();$("#ContentMsg").html('<span><img src="http://www.dressilyme.com/Images/MyAccountImages/Icon_ArrowError.gif" /></span> Format of Input Review Message is invalid.');$("#ContentMsg").css("display","");return}else{if(g.length>2000){$("#reviewContent").focus();$("#ContentMsg").html('<span><img src="http://www.dressilyme.com/Images/MyAccountImages/Icon_ArrowError.gif" /></span> Review Message must be less than 2000 characters.');$("#ContentMsg").css("display","");return}else{$("#ContentMsg").html('<span><img src="http://www.dressilyme.com/Images/Icon_Right.gif" /></span> ');$("#ContentMsg").css("display","none")}}}if(d!=null){if($.trim(d)==""){$("#nicknameTxt").focus();$("#NickNameMsg").html('<span><img src="http://www.dressilyme.com/Images/MyAccountImages/Icon_ArrowError.gif" /></span> Sorry,Nickname is required');$("#NickNameMsg").css("display","");return}else{if(d.length>100){$("#nicknameTxt").focus();$("#NickNameMsg").html('<span><img src="http://www.dressilyme.com/Images/MyAccountImages/Icon_ArrowError.gif" /></span> Sorry,Nickname must be 100 characters');$("#NickNameMsg").css("display","");return}else{$("#PasswordMsg").html('<span><img src="http://www.dressilyme.com/Images/Icon_Right.gif" /></span> ');$("#NickNameMsg").css("display","none")}}}if(c!=null){if($.trim(c)==""){$("#emailTxt").focus();$("#EmailMsg").html('<span><img src="http://www.dressilyme.com/Images/MyAccountImages/Icon_ArrowError.gif" /></span> Sorry,E-mail Address information is required');$("#EmailMsg").css("display","");return}if(!isEmail($.trim(c))){$("#emailTxt").focus();$("#EmailMsg").html('<span><img src="http://www.dressilyme.com/Images/MyAccountImages/Icon_ArrowError.gif" /></span> Invalid e-mail address format.');$("#EmailMsg").css("display","");return}else{$("#EmailMsg").html('<span><img src="http://www.dressilyme.com/Images/Icon_Right.gif" /></span> ');$("#EmailMsg").css("display","none")}}if(b!=null){if($.trim(b)==""){$("#passwordTxt").focus();$("#PasswordMsg").html('<span><img src="http://www.dressilyme.com/Images/MyAccountImages/Icon_ArrowError.gif" /></span> Sorry,Password is required');$("#PasswordMsg").css("display","");return}else{$("#PasswordMsg").html('<span><img src="http://www.dressilyme.com/Images/Icon_Right.gif" /></span> ');$("#PasswordMsg").css("display","none")}}if($("#txtRVerify").val()!=null){if($("#txtRVerify").val()==""){$("#txtRVerify").focus();$("#RvalidateMsg").html('<span><img src="http://www.dressilyme.com/Images/MyAccountImages/Icon_ArrowError.gif" /></span> Please enter the verify code and try again.');$("#RvalidateMsg").css("display","");return}if($("#txtRVerify").val()!=""){if(!CheckVerify($("#txtRVerify").val())){$("#txtRVerify").focus();$("#RvalidateMsg").html('<span><img src="http://www.dressilyme.com/Images/MyAccountImages/Icon_ArrowError.gif" /></span> The Verification Code you input is invalid.');$("#RvalidateMsg").css("display","");return}}else{$("#RvalidateMsg").css("display","none");$("#RvalidateMsg").html("")}}$("#ReviewSubmit").attr("disabled",true);$.ajax({type:"POST",url:"/Ajax/ProductReview.ashx",data:{productId:f,email:$.trim(c),password:b,text:g,nickName:d,txtrverify:a,rating:e},dataType:"json",cache:false,timeout:15000,success:function(h){if(h[0].Result=="loginerror"){alert("Login Fail.Please check you Email and password.");$("#ReviewSubmit").attr("disabled",false)}if(h[0].Result=="inserterror"){alert("Review Submit Unsuccesfully, please try again.");$("#ReviewSubmit").attr("disabled",false)}if(h[0].Result=="insertsuccess"){alert("Thank you for your valued feedback!");window.location.reload()}if(h[0].Result=="rverifyerror"){changeImage("RvalidateImg");$("#txtRVerify").focus();$("#RvalidateMsg").css("display","");$("#RvalidateMsg").html('<span><img src="http://www.dressilyme.com/Images/MyAccountImages/Icon_ArrowError.gif" /></span> The Verification Code you input is invalid.');$("#ReviewSubmit").attr("disabled",false)}},error:function(){alert("webpage is invalid.");$("#ReviewSubmit").attr("disabled",false)}})}function CheckVerify(b){var a=/^\d{5}$/;if(a.test(b)){return true}return false}function isValidString(b){var a='"><';for(i=0;i<a.length;i++){aChar=a.substring(i,i+1);if(b.indexOf(aChar)>-1){return false}}return true}function addFavorite(a){window.location="http://www.dressilyme.com/Action/AddToFavorite.ashx?Type=Product&Item="+a};
