function PopUp(d,c,a,b){window.open(d,"childwin","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,width="+c+",height="+a+",resizable="+b)}function WinOpen(d,c,a,b){window.open(d,"childwin","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,width="+c+",height="+a+",resizable="+b)}function openWinView(a){winview=window.open(a,"winview","toolbar=yes,location=yes,directories=no,status=yes,menubar=yes,resizable=yes,width=600,height=500,scrollbars=yes");winview.focus()}function getDigitCount(d){var b=d.match(/\d+/g);var c=0;for(var a=0;a<b.length;a++){c+=b[a].length}return c}function trim(a){if(a){return a.replace(/^\s+/,"").replace(/\s+$/,"")}else{return a}}function isValidPhoneNumber(a){return/^\+?(\(\d+\)\-?)?\d+(-?\d+)+$/.test(a)&&getDigitCount(a)>=10}function isValidEmail(a){return/^\w+([\.-]\w+)*@\w+([\.-]\w+)*(\.\w{2,4})+$/.test(a)}function isValidNumber(a){return/^\d+$/.test(a)}function isValidPassword(a){return !/[^\w\d@\-_\.]/.test(a)}var errorMessage="";var errorDiv;$(function(){errorDiv=$("#globalError")});function addError(a){errorMessage+=a+", "}function showError(a){if(a){errorMessage=a}if(errorMessage){errorDiv.html(errorMessage.replace(/[,\s\.]+$/,"."));window.scroll(0,0);errorDiv.show("fast")}}function clearError(){errorMessage="";errorDiv.hide()}function showErrorWithHeader(a){if(errorMessage){errorMessage="<h4>"+a+"</h4><br />"+errorMessage;showError()}}function hideFormError(b){clearFormError(b);var a=$("#"+b+"_message");a.addClass("form_message_accept")}function showFormError(d,c){d="#"+d;var b=$(d);var a=$(d+"_message");b.addClass("form_error");a.text(c);a.addClass("form_message_error");a.removeClass("form_message_accept")}function clearFormError(c){c="#"+c;var b=$(c);var a=$(c+"_message");b.removeClass("form_error");a.text("");a.removeClass("form_message_error");a.removeClass("form_message_accept")}function scrollToError(){var b=errorDiv;if(!b.is(":visible")){var c=$(".form_error:visible:first");var a=$(".form_message_error:visible:first");var e=c.offset();var d=a.offset();if(e.top==d.top){if(e.left<d.left){b=c}else{b=a}}else{if(e.top<d.top){b=c}else{b=a}}}$.scrollTo(b,500,{offset:-22})}function entSub(b,a){if(b.keyCode==13){$("#alert_ok").click();a();return false}}var Url={encode:function(a){return escape(this._utf8_encode(a))},decode:function(a){a=this.replaceAll(a,"+"," ");return this._utf8_decode(unescape(a))},_utf8_encode:function(b){b=b.replace(/\r\n/g,"\n");var a="";for(var e=0;e<b.length;e++){var d=b.charCodeAt(e);if(d<128){a+=String.fromCharCode(d)}else{if((d>127)&&(d<2048)){a+=String.fromCharCode((d>>6)|192);a+=String.fromCharCode((d&63)|128)}else{a+=String.fromCharCode((d>>12)|224);a+=String.fromCharCode(((d>>6)&63)|128);a+=String.fromCharCode((d&63)|128)}}}return a},_utf8_decode:function(a){var b="";var d=0;var e=c1=c2=0;while(d<a.length){e=a.charCodeAt(d);if(e<128){b+=String.fromCharCode(e);d++}else{if((e>191)&&(e<224)){c2=a.charCodeAt(d+1);b+=String.fromCharCode(((e&31)<<6)|(c2&63));d+=2}else{c2=a.charCodeAt(d+1);c3=a.charCodeAt(d+2);b+=String.fromCharCode(((e&15)<<12)|((c2&63)<<6)|(c3&63));d+=3}}}return b},replaceAll:function(e,c,d){var b=e;var a=b.indexOf(c);while(a!=-1){b=b.replace(c,d);a=b.indexOf(c)}return b}};function nop(){}function displayAlert(a){document.getElementById("alert_msg").innerHTML+=a+"<br />";var b=$("#alert_display");b.modal({position:["5%"],close:false})}function clearAlert(){$.modal.close();document.getElementById("alert_msg").innerHTML=""};