var infoDialog;var myLoginDialog;var loginSuccessFunc;var loginCancelFunc;var captchaReadyFunc;var myCaptchaDialog;var myFeedbackDialog;var myFeedbackConfirmationDialog;var myFeedbackDialogKeyListener;function showFeedbackDialog(a){$("body").addClass("yui-skin-sam");if($("#feedbackDialogContainer").length==0){$("body").append('<div id="feedbackDialogContainer"><div class="hd"></div><div id="feedbackDialogBody" class="bd"></div></div>');myFeedbackDialog=new YAHOO.widget.Dialog("feedbackDialogContainer",{width:"470px",fixedcenter:false,visible:false,constraintoviewport:true,modal:true,close:true,hideaftersubmit:false,postmethod:"none",zIndex:100});myFeedbackDialog.beforeShowEvent.subscribe(function(){loadFeedbackDialogContent(a);myFeedbackDialog.center()});myFeedbackDialogKeyListener=new YAHOO.util.KeyListener(document,{keys:13},{fn:processFeedback,scope:myFeedbackDialog,correctScope:true});myFeedbackDialog.cfg.queueProperty("keylisteners",myFeedbackDialogKeyListener);myFeedbackDialog.submitEvent.subscribe(function(){processFeedback()});myFeedbackDialog.render();$("#feedbackDialogContainer").show()}myFeedbackDialog.show()}function processFeedback(){doProcessFeedback()}function loadFeedbackDialogContent(a){$.ajax({async:false,url:a,cache:false,success:function(b){$("#feedbackDialogBody").html(b);myFeedbackDialog.fireEvent("changeBody");myFeedbackDialog.fireEvent("changeContent");$("#feedbackText").focus(function(){myFeedbackDialogKeyListener.disable()});$("#feedbackText").blur(function(){myFeedbackDialogKeyListener.enable()})}})}function changeLocation(a){var b=a.replace(/([\?&])rnd=[^&]+/i,"");location.search.replace(/([\?&])q(?:=[^&]*)?/,"$1");b+=b.indexOf("?")>=0?"&":"?";b+="rnd="+(new Date()).getTime();window.location.href=b}function getTop(a){var c=a;var b=0;while(c.tagName!="HTML"){b+=c.offsetTop||0;if(c.offsetParent){c=c.offsetParent}else{break}}return b}function getLeft(a){var c=a;var b=0;while(c.tagName!="HTML"){b+=c.offsetLeft||0;if(c.offsetParent){c=c.offsetParent}else{break}}return b}function numberInputKeyPressHandler(d){var a=d.keyCode?d.keyCode:d.charCode;var b=["0","8","9","36","37","38","39","40","46","48","49","50","51","52","53","54","55","56","57"];for(var c=0;c<b.length;c++){if(b[c]==a){if(a!="46"){return true}else{return d.charCode==0&&a=="46"}}}return false}function showInfoDialog(e,d,c,a,b){if($("#infoDialogContainer").length==0){$("body").addClass("yui-skin-sam");$("body").append('<div id="infoDialogContainer"><div class="hd"></div><div id="infoDialogBody" class="bd" style="overflow:auto"></div><div class="ft"></div></div>');infoDialog=new YAHOO.widget.Panel("infoDialogContainer",{width:c,height:a,fixedcenter:false,visible:false,constraintoviewport:true,close:true,modal:true,hideaftersubmit:false,postmethod:"none",zIndex:100});infoDialog.render();$("#infoDialogContainer").show()}$.ajax({async:false,url:b,cache:false,success:function(f){$("#infoDialogBody").html(f);infoDialog.setHeader(e);infoDialog.setFooter(d);infoDialog.cfg.setProperty("width",c);infoDialog.cfg.setProperty("height",a);infoDialog.fireEvent("changeBody");infoDialog.fireEvent("changeContent")},error:function(){$("#infoDialogBody").html("Unexpected error occurred.");infoDialog.setHeader("Unexpected error occurred");infoDialog.cfg.setProperty("width","250px");infoDialog.cfg.setProperty("height","100px")}});infoDialog.center();$("#infoDialogBody").scrollTop(0);infoDialog.show()}function login(b,a){initLoginOrRegister(b,a,function(){openLogin()})}function register(b,a){initLoginOrRegister(b,a,function(){openRegister()})}function showUnauthorizedDialog(b,a){initLoginOrRegister(b,a,function(){openUnauthorizedDialog()})}function initLoginOrRegister(b,a,c){$("body").addClass("yui-skin-sam");$("#loginDialog").remove();$("body").append("<div id='loginDialog'></div>");$("#loginDialog").load(contextPath+"/login/showLoginOrRegister.do",null,function(){startLogin(b,a);c()})}function startLogin(b,a){loginSuccessFunc=b;loginCancelFunc=a;myLoginDialog=new YAHOO.widget.Dialog("loginDialog",{width:"500px",fixedcenter:false,visible:false,constraintoviewport:true,close:true,modal:true,hideaftersubmit:false,zIndex:100,postmethod:"none"});myLoginDialog.render();myLoginDialog.show()}function captcha(a){initCaptcha(a)}function initCaptcha(a){$("body").addClass("yui-skin-sam");if($("#captchaDialog").length==0){$("body").append("<div id='captchaDialog'></div>")}else{$("#captchaDialog").contents("")}$("#captchaDialog").load(contextPath+"/security/showVerifyCaptcha.do",null,function(){startCaptcha(a)})}function startCaptcha(a){myCaptchaDialog=new YAHOO.widget.Dialog("captchaDialog",{width:"375px",fixedcenter:false,visible:false,constraintoviewport:true,close:false,modal:true,hideaftersubmit:false,zIndex:100,postmethod:"none"});captchaReadyFunc=a;myCaptchaDialog.render();myCaptchaDialog.show();myCaptchaDialog.center();openCaptcha()}function jsonRequest(f,d,b,e,c,a){f.setHeader(e);$.ajax({async:false,url:d,data:$("#"+b+"Form").serializeArray(),cache:false,success:function(g){$("#"+b+"Form [id$='.error']").html("");$("#"+b+"PanelError").hide();if(g.result=="OK"){$("#"+b+"Form input").val("");a()}else{processJsonErrorResponse(g,b);f.setHeader(c)}},dataType:"json",type:"POST"})}function processJsonErrorResponse(b,a){handleJsonErrorResponse(b,function(e,d,c){if(e!=null){$("#"+a+"Form\\."+e+"\\.error").html(c);if(e=="captcha"&&d=="error.captcha.locked"){newCaptcha("#"+a+"Form",true)}if(e=="password"&&d=="error.badCredentials"){$("#loginForm\\.password").val("")}}else{$("#"+a+"Form\\.error").html(c);$("#"+a+"PanelError").show()}})}function handleJsonErrorResponse(b,d){for(var c=0;c<b.errors.fieldErrors.length;c++){var f=b.errors.fieldErrors[c].field;var a=b.errors.fieldErrors[c].code;var e=b.errors.fieldErrors[c].message;d(f,a,e)}for(c=0;c<b.errors.globalErrors.length;c++){var h=b.errors.globalErrors[c].code;var g=b.errors.globalErrors[c].message;d(null,h,g)}}function newCaptcha(c,a){var b=new Image();$(b).load(function(){$(c+" #captchaImage").html("");$(c+" #captchaImage").append(b)}).attr("src",contextPath+"/security/captcha.do?rand="+Math.random());var d=c+" input[name='captcha']";$(d).val("");if(a){$(d).focus()}}function showImagePopup(a,b){$("#"+b).css("left",$(a).position().left);$("#"+b).css("top",$(a).position().top);hideAllImagePopups();$("#"+b).toggle(500);$("#"+b).css("cursor","pointer");return false}function hideImagePopup(a){$("#"+a).toggle(500);return false}function hideAllImagePopups(){$(".imagePopup").hide()};