if(!Wrsgroup){var Wrsgroup={}}if(!Wrsgroup.Sf){Wrsgroup.Sf={}}if(!Wrsgroup.Sf.Dom){Wrsgroup.Sf.Dom={}}Wrsgroup.Sf.Dom.dispNoneClass="displayNone";Wrsgroup.Sf.Dom.appendClass=function(d,a){if(typeof d=="undefined"){return false}if(typeof d.className=="undefined"){d.className=a}else{var c=false;var e=d.className.split(" ");for(var b=0;b<e.length;b++){if(e[b]===a){var c=true}}if(!c){d.className+=" "+a}}};Wrsgroup.Sf.Dom.stripClass=function(c,a){if(typeof c=="undefined"){return false}if(c.className===a){c.className=""}else{var d=c.className.split(" ");if(d.length>1){for(var b=0;b<d.length;b++){if(d[b]===a){d.splice(b,1)}}}c.className=d.join(" ")}};Wrsgroup.Sf.Dom.fillAndShow=function(c,b){var a=document.getElementById(c);if(!a){return false}Wrsgroup.Sf.Dom.stripClass(a,Wrsgroup.Sf.Dom.dispNoneClass);a.innerHTML=b};Wrsgroup.Sf.Dom.emptyAndHide=function(b){var a=document.getElementById(b);if(!a){return false}Wrsgroup.Sf.Dom.appendClass(a,Wrsgroup.Sf.Dom.dispNoneClass);a.innerHTML=""};Wrsgroup.Sf.Form=function(a){this.formName=a;var b=document.forms[a];this.errTarget="Wrsgroup-Sf-errorMsg";this.successTarget="Wrsgroup-Sf-success";this.emailErrMsg="Please make sure the e-mail address you entered is valid.";this.reqErrMsg="Please fill in all the required fields.";this.reqErrMsgs={};this.errFocus=true;b.obj=this;b.onsubmit=function(){return b.obj.validateForm()}};Wrsgroup.Sf.Form.prototype.formName;Wrsgroup.Sf.Form.prototype.errTarget;Wrsgroup.Sf.Form.prototype.successTarget;Wrsgroup.Sf.Form.prototype.emailErrMsg;Wrsgroup.Sf.Form.prototype.reqErrMsg;Wrsgroup.Sf.Form.prototype.errFocus;Wrsgroup.Sf.Form.labelErrClass="Wrsgroup-Sf-error";Wrsgroup.Sf.Form.fieldErrClass="Wrsgroup-Sf-error";Wrsgroup.Sf.Form.validateEmail=function(b){var a=/^.+@.+\..{2,3}$/;if(!a.test(b)){return false}return true};Wrsgroup.Sf.Form.prototype.validateEmails=function(){var d=this.getFormElems({elName:"email"});var b=document.forms[this.formName];for(var a=0;a<d.length;a++){var c=b.elements[d[a]];if(c.value===null||c.value===""){continue}if(!Wrsgroup.Sf.Form.validateEmail(c.value)){this.setError(c,this.emailErrMsg);return false}}return true};Wrsgroup.Sf.Form.prototype.required=[];Wrsgroup.Sf.Form.prototype.validateRequired=function(){this.required=this.getFormElems({cssClass:"Wrsgroup-Sf-required"});var b=document.forms[this.formName];for(var a=0;a<this.required.length;a++){var c=b.elements[this.required[a]];if(c.value===null||c.value===""){var d=this.reqErrMsg;if(this.reqErrMsgs[c.attributes.name.nodeValue]){d=this.reqErrMsgs[c.attributes.name.nodeValue]}this.setError(c,d);return false}}return true};Wrsgroup.Sf.Form.highlightLabel=function(b){if(b.parentNode.tagName==="LABEL"){Wrsgroup.Sf.Dom.appendClass(b.parentNode,Wrsgroup.Sf.Form.labelErrClass)}else{var c=document.getElementsByTagName("label");for(var a=0;a<c.length;a++){if(c[a].attributes["for"]&&c[a].attributes["for"].nodeValue===b.getAttribute("id")){Wrsgroup.Sf.Dom.appendClass(c[a],Wrsgroup.Sf.Form.labelErrClass)}}}};Wrsgroup.Sf.Form.unhighlightLabels=function(b){var c=document.forms[b].getElementsByTagName("label");for(var a=0;a<c.length;a++){if(c[a].className.indexOf(Wrsgroup.Sf.Form.labelErrClass)>-1){Wrsgroup.Sf.Dom.stripClass(c[a],Wrsgroup.Sf.Form.labelErrClass)}}};Wrsgroup.Sf.Form.highlightField=function(a){if(a.tagName==="SELECT"||a.tagName==="TEXTAREA"){Wrsgroup.Sf.Dom.appendClass(a,Wrsgroup.Sf.Form.fieldErrClass)}else{if(a.tagName==="INPUT"&&a.getAttribute("type")==="text"){Wrsgroup.Sf.Dom.appendClass(a,Wrsgroup.Sf.Form.fieldErrClass)}}};Wrsgroup.Sf.Form.unhighlightFields=function(b){var c=document.forms[b].elements;for(var a=0;a<c.length;a++){if(c[a].className.indexOf(Wrsgroup.Sf.Form.fieldErrClass)>-1){Wrsgroup.Sf.Dom.stripClass(c[a],Wrsgroup.Sf.Form.fieldErrClass)}}};Wrsgroup.Sf.Form.prototype.setError=function(a,b){Wrsgroup.Sf.Form.highlightLabel(a);Wrsgroup.Sf.Form.highlightField(a);Wrsgroup.Sf.Dom.fillAndShow(this.errTarget,b);this.focusOnErr(a)};Wrsgroup.Sf.Form.prototype.oldSubmit=[];Wrsgroup.Sf.Form.prototype.changeSubmitText=function(c){var a=document.forms[this.formName].getElementsByTagName("input");for(var b=0;b<a.length;b++){if(a[b].getAttribute("type")==="submit"){this.oldSubmit=a[b].value;a[b].value=c}}};Wrsgroup.Sf.Form.prototype.resetSubmitText=function(){var a=document.forms[this.formName].getElementsByTagName("input");for(var b=0;b<a.length;b++){if(a[b].getAttribute("type")==="submit"){a[b].value=this.oldSubmit;a[b].blur()}}};Wrsgroup.Sf.Form.prototype.focusOnErr=function(a){if(this.errFocus){a.focus()}};Wrsgroup.Sf.Form.prototype.getFormElems=function(f){var e=document.forms[this.formName];var c=[];for(var b=0;b<e.elements.length;b++){var d=e.elements[b];var a=false;var g=false;if(typeof f.cssClass!="undefined"){if(d.className.indexOf(f.cssClass)!=-1){a=true}}if(typeof f.elName!="undefined"){if(d.name.indexOf(f.elName)!=-1){g=true}}if(a&&g){c.push(d.name)}else{if(typeof f.cssClass=="undefined"&&g){c.push(d.name)}else{if(typeof f.elName=="undefined"&&a){c.push(d.name)}}}}return c};Wrsgroup.Sf.Form.prototype.validateForm=function(){Wrsgroup.Sf.Form.unhighlightLabels(this.formName);Wrsgroup.Sf.Form.unhighlightFields(this.formName);Wrsgroup.Sf.Dom.emptyAndHide(this.errTarget);Wrsgroup.Sf.Dom.emptyAndHide(this.successTarget);if(!this.validateRequired()){return false}if(!this.validateEmails()){return false}return true};Wrsgroup.Sf.Form.instantiateForms=function(){Wrsgroup.Sf.forms={};for(var b=0;b<document.forms.length;b++){var c=document.forms[b];if(c.className.indexOf("Wrsgroup-Sf-Form")!=-1){var a=c.attributes.name.nodeValue;if(typeof Wrsgroup.Sf[a]!="undefined"){Wrsgroup.Sf.forms[a]=new Wrsgroup.Sf[a](a)}else{Wrsgroup.Sf.forms[a]=new Wrsgroup.Sf.Form(a)}}}};Wrsgroup.Sf.SendEmail=function(a){Wrsgroup.Sf.Form.call(this,a);var b=document.forms[a];b.elements.inquiry.onchange=Wrsgroup.Sf.SendEmail.toggleKeycodeFields;Wrsgroup.Sf.SendEmail.toggleKeycodeFields();this.successTarget="SendEmail-success";b.onsubmit=function(){if(!b.obj.validateForm()){return false}else{b.obj.handleGoodInput();return false}}};Wrsgroup.Sf.SendEmail.prototype=Wrsgroup.Sf.Form.prototype;Wrsgroup.Sf.SendEmail.toggleKeycodeFields=function(){var a=document.forms.SendEmail.elements.inquiry;if(a.options[a.selectedIndex].text=="Remove from mailing list"){Wrsgroup.Sf.Dom.stripClass(document.getElementById("custno").parentNode,Wrsgroup.Sf.Dom.dispNoneClass);Wrsgroup.Sf.Dom.stripClass(document.getElementById("keycode").parentNode,Wrsgroup.Sf.Dom.dispNoneClass);Wrsgroup.Sf.Dom.stripClass(document.getElementById("comments"),"Wrsgroup-Sf-required")}else{Wrsgroup.Sf.Dom.appendClass(document.getElementById("custno").parentNode,Wrsgroup.Sf.Dom.dispNoneClass);Wrsgroup.Sf.Dom.appendClass(document.getElementById("keycode").parentNode,Wrsgroup.Sf.Dom.dispNoneClass);Wrsgroup.Sf.Dom.appendClass(document.getElementById("comments"),"Wrsgroup-Sf-required")}};Wrsgroup.Sf.SendEmail.prototype.handleGoodInput=function(){var d=document.forms[this.formName];var c=d.elements.inquiry;var a=c.options[c.selectedIndex].text;this.changeSubmitText("Sending ...");Wrsgroup.Sf.Dom.appendClass(d,"faded");var b=new Wrsgroup.Sf.XmlHttp();b.sendRequest({method:"POST",destination:d.getAttribute("action"),data:"name="+d.elements.name.value+"&email="+d.elements.email.value+"&inquiry="+a+"&custno="+d.elements.custno.value+"&keycode="+d.elements.keycode.value+"&comments="+d.elements.comments.value,callback:"handleAjax",object:this})};Wrsgroup.Sf.SendEmail.prototype.handleAjax=function(b){var a=document.forms[this.formName];Wrsgroup.Sf.Dom.fillAndShow(this.successTarget,b.responseText);Wrsgroup.Sf.Dom.stripClass(a,"faded");this.resetSubmitText();if(b.responseText.indexOf("E-mail sent successfully!")>-1){a.reset()}};Wrsgroup.Sf.RequestCatalogForm=function(b){Wrsgroup.Sf.Form.call(this,b);var d=document.forms[b];var a=Wrsgroup.Sf.RequestCatalogForm.catalogs;for(var c=0;c<a.length;c++){d.elements[a[c]].onclick=Wrsgroup.Sf.RequestCatalogForm.highlightTr;Wrsgroup.Sf.RequestCatalogForm.highlightTr(d.elements[a[c]])}d.onsubmit=function(){if(!d.obj.validateForm()){return false}else{if(!d.obj.validateCatalogs()){return false}else{if(!d.obj.validateState()){return false}}}return true};this.reqErrMsgs.name="Please enter your name.";this.reqErrMsgs.address="Please enter your address.";this.reqErrMsgs.city="Please enter your city.";this.reqErrMsgs.zip="Please enter your ZIP or postal code."};Wrsgroup.Sf.RequestCatalogForm.prototype=Wrsgroup.Sf.Form.prototype;Wrsgroup.Sf.RequestCatalogForm.catalogs=["HE_Health","HE_School","Childbirth_Graphics_US","Childbirth_Graphics_European","Health_Impressions"];Wrsgroup.Sf.RequestCatalogForm.prototype.validateState=function(){var a=document.forms[this.formName];var b=a.elements.state;var d=a.elements.country.value;if((b.value===null||b.value==="")&&(d=="US"||d=="CA")){var c="Please select your state.";this.setError(b,c);return false}return true};Wrsgroup.Sf.RequestCatalogForm.prototype.validateCatalogs=function(){var b=false;var d=document.forms[this.formName];var a=Wrsgroup.Sf.RequestCatalogForm.catalogs;for(var c=0;c<a.length;c++){if(d.elements[a[c]].checked===true){b=true;break}}if(!b){Wrsgroup.Sf.Dom.fillAndShow(this.errTarget,"Please select a catalog.");return false}return true};Wrsgroup.Sf.RequestCatalogForm.highlightTr=function(a){if(typeof a=="undefined"||!a.parentNode){a=this}if(a.checked){Wrsgroup.Sf.Dom.appendClass(a.parentNode.parentNode,"trSelected")}else{Wrsgroup.Sf.Dom.stripClass(a.parentNode.parentNode,"trSelected")}};Wrsgroup.Sf.Item=function(a){this.itmId=a.itmId;this.context=a.context;if(a.context=="detail"){this.findDetailNodes();this.setTitle();this.hideAddlImgs();this.showDiscountBurst()}else{this.findBrowseNodes(a.tdNode)}this.addDollarSign()};Wrsgroup.Sf.Item.prototype.itmId;Wrsgroup.Sf.Item.prototype.context;Wrsgroup.Sf.Item.prototype.nodes={};Wrsgroup.Sf.Item.discountItems=[79204];Wrsgroup.Sf.Item.discountPrices=[158.25];Wrsgroup.Sf.Item.prototype.findDetailNodes=function(){var c=document.getElementsByTagName("td");for(var a=0;a<c.length;a++){if(c[a].className=="item"){this.nodes.itmNum=c[a]}else{if(c[a].className=="text"){if(c[a].getAttribute("colspan")==4){this.nodes.itmName=c[a]}else{if(c[a].getAttribute("colspan")==1){this.nodes.price=c[a]}}}}}var b=document.getElementById("1").getElementsByTagName("td");this.nodes.itmText=b[0]};Wrsgroup.Sf.Item.prototype.findBrowseNodes=function(c){var d=c.parentNode.getElementsByTagName("td");for(var a=0;a<d.length;a++){switch(d[a].className){case"resultsitem":this.nodes.itmNum=d[a];break;case"resultsdescbottom":this.nodes.itmNameBottom=d[a];break;case"resultsprice":this.nodes.price=d[a];break}}var b=c.parentNode.previousSibling;while(b&&b.nodeType!=1){b=b.previousSibling}if(b){d=b.getElementsByTagName("td");this.nodes.itmText=d[0];b=b.previousSibling;while(b&&b.nodeType!=1){b=b.previousSibling}if(b){d=b.getElementsByTagName("td");this.nodes.itmName=d[1]}}};Wrsgroup.Sf.Item.prototype.addDollarSign=function(){var a=this.nodes.price.innerHTML.replace(/^\s+|\s+$/g,"");if(a.substring(0,1)!="$"){this.nodes.price.innerHTML="$"+a}};Wrsgroup.Sf.Item.prototype.setTitle=function(){var a=this.nodes.itmName.innerHTML.replace(/^\s+|\s+$/g,"");document.title=a};Wrsgroup.Sf.Item.prototype.hideAddlImgs=function(){var g=document.getElementsByTagName("tr");for(var c=0;c<g.length;c++){if(g[c].className=="tabtr"){if(g[c].cells[0].innerHTML.indexOf("Additional Images")>-1){var e=g[c].parentNode.parentNode;break}}}if(typeof e!="undefined"){var f=document.getElementsByTagName("table");for(var c=0;c<f.length;c++){if(f[c]==e){var d=c+1;var b=f[d];break}}}if(typeof b!="undefined"){var a=b.getElementsByTagName("img");if(a.length>1){Wrsgroup.Sf.Dom.appendClass(a[0],Wrsgroup.Sf.Dom.dispNoneClass)}else{if(a.length==1){Wrsgroup.Sf.Dom.appendClass(e,Wrsgroup.Sf.Dom.dispNoneClass);Wrsgroup.Sf.Dom.appendClass(b,Wrsgroup.Sf.Dom.dispNoneClass)}}}};Wrsgroup.Sf.Item.prototype.showDiscountBurst=function(){var a=this.nodes.itmNum.innerHTML.replace(/^\s+|\s+$/g,"");for(var b=0;b<Wrsgroup.Sf.Item.discountItems.length;b++){if(Wrsgroup.Sf.Item.discountItems[b]==a){var c=this.nodes.price.innerHTML.replace(/^\s+|\s+$/g,"");if(isNaN(this.nodes.price.innerHTML)){c=c.substring(0,1)}if(Wrsgroup.Sf.Item.discountPrices[b]==c){Wrsgroup.Sf.Dom.stripClass(document.getElementById("online-only-burst"),Wrsgroup.Sf.Dom.dispNoneClass)}}}};Wrsgroup.Sf.Item.instantiateItems=function(){Wrsgroup.Sf.items={};var b=0;if(location.href.indexOf("itemdetail.do")>-1){var c=document.getElementsByTagName("input");for(var a=0;a<c.length;a++){if(c[a].getAttribute("type")=="hidden"&&c[a].attributes.name.nodeValue=="itm_id"){Wrsgroup.Sf.items[b]=new Wrsgroup.Sf.Item({itmId:c[a].value,context:"detail"});break}}}else{var c=document.getElementsByTagName("input");for(var a=0;a<c.length;a++){if(c[a].getAttribute("type")=="hidden"&&c[a].attributes.name.nodeValue.indexOf("itm")==0){Wrsgroup.Sf.items[b]=new Wrsgroup.Sf.Item({itmId:c[a].value,tdNode:c[a].parentNode,context:"browse"});b++}}}};Wrsgroup.Sf.XmlHttp=function(){if(window.XMLHttpRequest){this.requester=new XMLHttpRequest()}else{if(window.ActiveXObject){try{this.requester=new ActiveXObject("Msxml2.XMLHTTP")}catch(a){this.requester=new ActiveXObject("Microsoft.XMLHTTP")}}}};Wrsgroup.Sf.XmlHttp.prototype.requester;Wrsgroup.Sf.XmlHttp.prototype.sendRequest=function(c){if(c.asynchronous===false){var b=false}else{var b=true}if(c.asynchronous=="GET"){this.requester.open("GET",c.destination+"?"+c.data,b);this.requester.send(null)}else{this.requester.open("POST",c.destination,b);this.requester.setRequestHeader("Content-type","application/x-www-form-urlencoded");this.requester.send(c.data)}var a=this;this.requester.onreadystatechange=function(){if(a.requester.readyState==4){if(a.requester.status==200){if(typeof c.object=="undefined"){c.callback(a.requester)}else{c.object[c.callback](a.requester)}}else{}}return true}};Wrsgroup.Sf.EmailAddress=function(a){a.innerHTML=a.getAttribute("id").replace("::","@");a.href="mailto:"+a.innerHTML};Wrsgroup.Sf.EmailAddress.instantiateEmailAddresses=function(){Wrsgroup.Sf.emailAddresses={};var b=document.getElementsByTagName("a");for(var c=0;c<b.length;c++){if(b[c].className=="Wrsgroup-Sf-email"){Wrsgroup.Sf.emailAddresses[c]=new Wrsgroup.Sf.EmailAddress(b[c])}}};Wrsgroup.Sf.Form.instantiateForms();Wrsgroup.Sf.Item.instantiateItems();Wrsgroup.Sf.EmailAddress.instantiateEmailAddresses();
