var closeCount=5,errMsgsML=["The email address you entered is improperly formatted","Uh oh. We couldn't contact our mailing list partner. Please try again in a bit.","You have subscribed to ","There was a problem while trying to add you to our list. Please try again in a few minutes.","Closing in..."," AND "],errMsgsMLFR=["L’adresse courriel inclus n’est pas dans le propre format.","Nous avons rencontré un problème technique. Veuillez essayez d’abonner encore dans quelques minutes.","Vous recevrez désormais ","Nous avons rencontré un problème technique. Veuillez essayez d’abonner encore dans quelques minutes.","Cette boite fermera en..."," ET "];function getMsgML(a){if(pageLanguage==2){return errMsgsMLFR[a]}return errMsgsML[a]}function onClick(){var a=$(".MailingList input:text").val(),b=/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;a=jQuery.trim(a);if(a==null||a==""){return}if(!b.test(a)){showActionMsg(getMsgML(0),false)}showMLDialog(a)}function signUp(c){var b=[],a=$(".MailingList input:text").val();a=jQuery.trim(a);b.push("email="+a);b.push("listName="+c);jQueryCallWrapper("/Services/CHDataService/Service.asmx/AddToMailingList",b,signUp_Success,signUp_Error,c)}function signUp_Success(e,b){var a=e.d,k,c="",j=false,g,h,d,f;d=b.split("-;-");g=a.split("&");for(h=0;h<g.length;h++){k=g[h].split(";");if(k==null){c=getMsgML(1);break}else{if(k!=null&&k.length==2){c="There was a problem: "+k[1];break}else{if(k!=null&&k.length==3){if(k[0]=="0"){f=d[h].split("/ ");c+=getMsgML(2)+(pageLanguage==2?f[1]:f[0])+((g.length>1&&(h!=g.length-1))?getMsgML(5):"");j=true}else{if(k[0]=="-1"){c=getMsgML(3)}}}}}}showActionMsg(c,j)}function signUp_Error(a){alert("Error: "+a.responseText)}function showMLDialog(b){var a=$("#MailingListDialog");a.dialog({bgiframe:true,height:215,width:380,modal:true,autoOpen:false,close:function(c,d){hideActionMsg()}});a.dialog("open")}function timedClose(){if(closeCount==0){$("#MailingListDialog").dialog("close");closeCount=5}else{$("#pCloseMsg").html(getMsgML(4)+closeCount);closeCount--;setTimeout(timedClose,1000)}}function showActionMsg(b,a){$("#MailingListDialogOrigMsg").hide();document.getElementById("pActionMsg").innerHTML=b;$("#MailingListDialogActionMsg").css("text-align","center");$("#MailingListDialogActionMsg > p").addClass("subheadingnospace");$("#MailingListDialogActionMsg").show();if(a==true){$("#pCloseMsg").show();timedClose()}}function hideActionMsg(){$("#MailingListDialogActionMsg").hide();$("#MailingListDialogOrigMsg").show()}function clearMLeMailText(){var a=$(".MailingList input:text");if(a.val()=="Enter your email address"){a.val("")}}$(document).ready(function(){$(".MailingList input:text").focus(clearMLeMailText)});