function uploadPhotoFormSubmit(){if($("photoFile").value==null||$("photoFile").value==""){alert(upload_photo_empty);return false;}$("UploadPhotoFormWrapper").hide();showUploadPhotoProgress();return true;}function startMatchingProgress(_111d){new Ajax.Request(LOOK_ACTIONS_PATH+"/GetUploadPhotoProgress.do?uploadPhotoId="+_111d+"&random="+Math.random(),{method:"get",onSuccess:function (_111e){executeScript("var json = "+_111e.responseText);if(json.resultCode=="0"){showMatchingProgress(json.matchingProgress);window.setTimeout("startMatchingProgress('"+_111d+"');",MATCH_PROGRESS_REQUESTING_INTERVAL);} else{if(json.resultCode=="1"){document.location.href=LOOK_ACTIONS_PATH+"/MatchingProcess.do?uploadPhotoId="+_111d;} else{showNoMatchingResults(json.resultCode);}}},onFailure:function (_111f){showNoMatchingResults();}});}function showUploadPhotoProgress(_1120){$("ProgressText").update(uploading_file);$("ProgressStatus").update((_1120!=null)?_1120+"%":"");$("ProgressWrapper").show();}function showMatchingProgress(_1121){$("ProgressText").update(scanning_for_celebresults);$("ProgressStatus").update((_1121!=null)?_1121+"%":"");$("ProgressWrapper").show();}function showNoMatchingResults(_1122){if(!_1122){_1122=8;}$("ProgressWrapper").hide();$("photoFile").value="";$("UploadPhotoFormWrapper").show();if(_1122==7){$("MatchingResultText").innerHTML=face_not_found;} else{if(_1122==8){$("MatchingResultText").innerHTML=no_celebrities_found;} else{if(_1122==2){$("MatchingResultText").innerHTML=process_failed;} else{if(_1122==10){$("MatchingResultText").innerHTML=process_failed_big_image;}}}}$("MatchingResultText").show();$("UploadPhotoFormText").update(select_another_photo);}function sendLinkProcessAction(){$("SendLinkFormMessage").hide();if($("SendLinkFormEmails").value==null||$("SendLinkFormEmails").value==""||!Validation.isEmails($("SendLinkFormEmails").value)){alert(send_link_empty);return;}$("SendLinkFormEmails").disable();$("SendLinkFormSubmit").disable();new Ajax.Request(LOOK_ACTIONS_PATH+"/SendLinkProcess.do",{method:"post",parameters:{"emails":$("SendLinkFormEmails").value},onSuccess:function (_1123){executeScript("var json = "+_1123.responseText);if(json.resultCode=="0"){$("SendLinkFormMessage").show();$("SendLinkFormEmails").enable();$("SendLinkFormEmails").value="";$("SendLinkFormSubmit").enable();} else{alert("Error "+json.resultCode+": "+json.message);}},onFailure:function (_1124){alert("Error: failure while sending request");}});}function voteForMatchProcessAction(_1125,_1126,_1127){if(!_1127){_1127="";}$(_1127+"VoteButtonsBlock").hide();$(_1127+"VoteProgressBlock").show();new Ajax.Request(LOOK_ACTIONS_PATH+"/VoteForMatchProcess.do?matchId="+_1125+"&voteValue="+_1126,{method:"get",onSuccess:function (_1128){executeScript("var json = "+_1128.responseText);if(json.resultCode=="0"||json.resultCode=="9"){countNoVotes=json.match.countNoVotes;countYesVotes=json.match.countYesVotes;percentNoVotes=Math.round(((countNoVotes/(countNoVotes+countYesVotes))*100))+"%";percentYesVotes=Math.round(((countYesVotes/(countNoVotes+countYesVotes))*100))+"%";$(_1127+"VoteResultBlockCountNoVotes").update(percentNoVotes);$(_1127+"VoteResultBlockCountYesVotes").update(percentYesVotes);$(_1127+"VoteResultBlockCountNoVotesScale").setStyle({"width":percentNoVotes});$(_1127+"VoteResultBlockCountYesVotesScale").setStyle({"width":percentYesVotes});$(_1127+"VoteProgressBlock").hide();$(_1127+"VoteResultBlock").show();window.setTimeout("redirectToVoting();",VOTING_DELAY_BEFORE_REDIRECT);} else{alert("Error "+json.resultCode+": "+json.message);$(_1127+"VoteProgressBlock").hide();$(_1127+"VoteButtonsBlock").show();}},onFailure:function (_1129){alert("Error: failure while sending request");$(_1127+"VoteProgressBlock").hide();$(_1127+"VoteButtonsBlock").show();}});return false;}function redirectToVoting(){location.href=LOOK_ACTIONS_PATH+"/Voting.do";}function addMatchCommentFormSubmit(_112a){if($("AddMatchCommentFormNameError")!=null){$("AddMatchCommentFormNameError").hide();}if($("AddMatchCommentFormEmailError")!=null){$("AddMatchCommentFormEmailError").hide();}if($("AddMatchCommentFormBodyError")!=null){$("AddMatchCommentFormBodyError").hide();}if($("AddMatchCommentFormCaptchaError")!=null){$("AddMatchCommentFormCaptchaError").hide();}validated=true;if($("AddMatchCommentFormName")!=null&&($("AddMatchCommentFormName").value==null||$("AddMatchCommentFormName").value=="")){$("AddMatchCommentFormNameError").show();validated=false;}if($("AddMatchCommentFormEmail")!=null&&($("AddMatchCommentFormEmail").value==null||$("AddMatchCommentFormEmail").value=="")){$("AddMatchCommentFormEmailError").show();validated=false;}if($("AddMatchCommentFormBody").value==null||$("AddMatchCommentFormBody").value==""){$("AddMatchCommentFormBodyError").show();validated=false;}if($("AddMatchCommentFormCaptcha")!=null&&($("AddMatchCommentFormCaptcha").value==null||$("AddMatchCommentFormCaptcha").value=="")){$("AddMatchCommentFormCaptchaError").show();validated=false;}if(validated){$("AddMatchCommentFormSubmitButton").disable();parametersList=$("AddMatchCommentFormName")!=null?{name:$("AddMatchCommentFormName").value,email:$("AddMatchCommentFormEmail").value,body:$("AddMatchCommentFormBody").value,captcha:$("AddMatchCommentFormCaptcha").value}:{body:$("AddMatchCommentFormBody")==null?null:$("AddMatchCommentFormBody").value};new Ajax.Request(LOOK_ACTIONS_PATH+"/AddMatchCommentProcess.do?matchId="+_112a+"&random="+Math.random(),{method:"post",parameters:parametersList,onSuccess:function (_112b){$("AddMatchCommentFormSubmitButton").enable();executeScript("var json = "+_112b.responseText);if(json.resultCode=="0"){location.href=LOOK_ACTIONS_PATH+"/Voting.do?matchId="+_112a;} else{if(json.resultCode=="6"){$("AddMatchCommentFormCaptchaError").show();} else{if(json.resultCode=="5"){$("AddMatchCommentFormCaptcha").value="";$("CaptchaImage").src=$("CaptchaImage").src+"?rnd="+(Math.random()*100);$("AddMatchCommentFormCaptchaError").show();} else{alert("Error "+json.resultCode+": "+json.message);}}}},onFailure:function (_112c){$("AddMatchCommentFormSubmit").enable();alert("Error: failure while sending request");}});}return false;}function refreshCaptchaImage(){$("CaptchaImage").src=APP_PATH+"/CaptchaImage.jpg?random="+Math.random();return false;}function matchingResultFormSubmit(){if(!alreadyDeleted){$("MatchingResultFormDescription").value="";}if($("MatchingResultFormDescription").value.length>100){alert(description_length_validation);return false;}return true;}