var ft1=true; function openEmailFormDig(type){ if(ft1){ $("body").append(""); resizeEmailFormDig(); $("body").append(""); ft1=false; } $(window).resize(resizeEmailFormDig); scrollEmailFormDig(); $(window).scroll(scrollEmailFormDig); //$("#emailUsFormDIGIn").draggable(); $("#emailUsFormDIG").fadeTo(1,0.6); //window.scroll(0,0); $("#emailUsFormDIGIn").load("/show_email_us.jsp?subjectPD="+type+"&t="+new Date().getTime(),function(){$("#showEmailLoadIMG").hide();$("#emailUsFormDIGIn").show(); //$("#emailUsFormDIGIn").fadeIn("slow",function(){$("#emailUsFormDIGIn").fadeTo(1,1);}); afterFirstLoad(); }); } function scrollEmailFormDig(){ document.getElementById("emailUsFormDIGIn").style.top=getEmailUSTop1(0.13)+"px"; } function getEmailUSTop1(percent){ return (document.body.scrollTop+(percent*$(window).height())); } function resizeEmailFormDig(){ $("#emailUsFormDIG").height(document.body.scrollHeight); $("#emailUsFormDIG").width(document.body.scrollWidth); document.getElementById("showEmailLoadIMG").style.top=(getEmailUSTop1(0.4))+"px"; } function closeEmailFormDig(){ $(".showEmailUs").hide(); } function emailInputCheckerTF1(obj) { var temp1=$.trim(obj.value); obj.value=temp1; var regex=new RegExp(/^[a-zA-Z0-9\._%\+\-]+@[a-zA-Z0-9\.\-%]+\.[a-zA-Z]{2,4}$/); return (temp1.match(regex,"g")); } function submitingEmailFormDig(){ var result=true; if(result && $.trim(document.showEmailUsForm.fullname.value).length<=2){ alert("Please enter your name."); document.showEmailUsForm.fullname.focus(); result=false; } var emailOk=false; try{ emailOk=emailInputCheckerTF1(document.showEmailUsForm.email); }catch(e){alert(e);} if(result && !emailOk){ alert("Please enter your email."); document.showEmailUsForm.email.focus(); result=false; } if(result&& $.trim(document.showEmailUsForm.email.value)!=$.trim(document.showEmailUsForm.emailconfirm.value)){ alert("Email addresses do not match. Please verify.") document.showEmailUsForm.emailconfirm.focus(); result=false; } //alert($.trim(document.showEmailUsForm.subject.value).length); if(result&& $.trim(document.showEmailUsForm.subject.value).length<=2){ alert("Please enter a subject.") document.showEmailUsForm.subject.focus(); result=false; } if(result&& $.trim(document.showEmailUsForm.message.value).length<=2){ alert("Please enter a message.") document.showEmailUsForm.message.focus(); result=false; } var selIdx=document.showEmailUsForm.subjectPD.selectedIndex; if(result&& selIdx==0){ alert("Please select a help topic.") document.showEmailUsForm.subjectPD.focus(); result=false; } //if(result&& selIdx==2&&$.trim(document.showEmailUsForm.orderid.value).length<=2){ // alert("Please enter an order number.") // document.showEmailUsForm.orderid.focus(); // result=false; // } if(result){ var params=($(document.showEmailUsForm).serializeArray()); $("#emailUsFormDIGIn").hide(); $("#showEmailLoadIMG").show(); $("#emailUsFormDIGIn").load("/show_email_us.jsp",params,function(){$("#showEmailLoadIMG").hide();$("#emailUsFormDIGIn").show()}); result=false; } return result; } function changeSelect(){ var selIdx=document.showEmailUsForm.subjectPD.value; $(".subjectPDTxt").hide(); $(".subjectPD"+selIdx).show(); } function messageCheck(){ var len=document.showEmailUsForm.message.value.length; if(len>4000){ document.showEmailUsForm.message.value=document.showEmailUsForm.message.value.substring(0,4000); len=document.showEmailUsForm.message.value.length; alert("You have reached the maximum length (4000)."); } $("#currentLength").html(len); } function afterFirstLoad(){ document.showEmailUsForm.subjectPD.selectedIndex=document.showEmailUsForm.sis.value; changeSelect(); document.showEmailUsForm.u1.value=encodeURIComponent(window.location); resizeEmailFormDig(); }