To sign up for our practitioner newsletter, you must be logged in as a practitioner and had your account upgraded to practitioner status.
$(document).ready(function(){
/*
This is the simplxRPC object to help you along your way. You dont need to use this,
a simplx json-rpc call is just a json string sent as a querystring.
But i thought you might find it convenient with a wrapper :)
*/
$('label.required').append(' * ');
var accordion = $("#accordion");//.accordion();
var current = 0;
var sect1 = new Array($('#username'),$('#password'),$('#password_confirm'),$('#fullname'));
var sect2 = new Array($('#email'));
var sect3 = new Array($('#zip'),$('#city'),$('#address'));
var sect4 = new Array($('#terms'));
var sec = new Array(sect1,sect2,sect3,sect4);
var err = new Array();
var accdivs = new Array($('#div-1'),$('#div-2'),$('#div-3'),$('#div-4'),$('#div-5'),$('#div-6'));
var map;
var centered;
var marker;
var infowindow;
//var origH = $('#div-1').height();
function collapseDivs(){
for(var n = 0;n < accdivs.length;n++) {
accdivs[n].hide();
}
}
function showMe(o,accdivs){
for(var n = 0;n < accdivs.length;n++){
accdivs[n].hide('fast');
}
o.show('slow');
}
collapseDivs();
accdivs[0].show('slow');
//////////////////
// This function requests data for the select box
function simplxRPC(config){
this.config = config;
this.execute = function(){
var usesnippetmatching = (config.usesnippetmatching == 1) ? "&usesnippetmatching=1" : "&usesnippetmatching=0";
var data = "";
if(config.dummyResponse == ""){
$.get(
(config.url+
'?id='+config.pageid+
'&simplxrpc='+
(JSON.stringify(config.rpc) + usesnippetmatching)
),
function(data){
config.callback(data);
return data;
}
);
}else{
config.callback(config.dummyResponse);
return config.dummyResponse;
}
};
}
//////////////////
// This function requests data for the select box
function updateStatesOptions() {
var countryid = $('#country option:selected').val();
var statesRPCConfig = {
"url":"http://www.enzymesinc.com/",
"pageid":"326",
"usesnippetmatching":"1",
"dummyResponse":"",
"rpc":{
"id":"1",
"method":"snippet.eic.get.states.json",
"params":{
"parents":"0",
"cid":countryid
}
},
"callback":parseStatesResponse
};
simplxRPCObject = new simplxRPC(statesRPCConfig);
simplxRPCObject.config.callback = parseStatesResponse;
simplxRPCObject.execute();
}
//////////////////
// This function is sent as a callback parameter in the config.
function parseStatesResponse(data){
try{
var jsobject = JSON.parse(data);
var options = '';
var oldstates = document.getElementById("state");
var rpc = document.getElementById("rpc_result");
rpc.removeChild(oldstates);
if(jsobject.result.length >= 1 ) {
var newstate = document.createElement("select");
newstate.setAttribute("name","state");
newstate.setAttribute("id","state");
rpc.appendChild(newstate);
for (var i = 0; i < jsobject.result.length; i++) {
options += '';
}
$("#state").html(options);
}
else {
var newstate = document.createElement("input");
newstate.setAttribute("type","textbox");
newstate.setAttribute("value","");
newstate.setAttribute("name","state");
newstate.setAttribute("id","state");
rpc.appendChild(newstate);
}
$('#json_source').html(data);
}
catch(e){
// Probably empty response...
//alert(e.description);
}
/*$('#accordion').accordion('activate',1);*/
return data;
}
//////////////////
// These function sets focus to pseudo acordion
function checkErrors(ele) {
var mysplit = ele.attr('name').split(':');
errmsg = '';
if(mysplit.length > 1) {
if(mysplit[1] == "required") {
if(ele.val() == "") {
errmsg = "This is a required field. ";
}
if(mysplit[2]) {
var propSplit = mysplit[2].split('=');
if(propSplit[0] == "minLength") {
if(ele.val().length < propSplit[1]) {
errmsg += 'The field must be at least ' + propSplit[1] + ' characters long.';
}
}
}
}
if(mysplit[1] == "exprequired") {
if(ele.val() == "") {
errmsg = "This is a required field. ";
}
if(mysplit[2]) {
var propSplit = mysplit[2].split('=');
if(propSplit[0] == "expminLength") {
if(ele.val().length < propSplit[1]) {
errmsg += 'The field must be at least ' + propSplit[1] + ' characters long.';
}
}
}
}
if(mysplit[1] == "password_confirm=`password`") {
if(ele.val() != $('#password').val()) {
errmsg = "Passwords do not match.";
}
}
if(mysplit[1] == "email") {
var emailReg = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/;
if(ele.val() == '') {
errmsg = "This is a required field.";
}
else if(!emailReg.test(ele.val())) {
errmsg = "This does not appear to be a valid e-mail address.";
}
}
if(mysplit[1] == "checked") {
if(ele.checked == 0) {
errmsg = "You must agree to the terms and conditions.";
}
}
}
if(errmsg != '') { err.push(new Array(ele,errmsg)); errmsg = ''; }
}
function clearErrors() {
err.length = 0;
$('span.error').html(' ');
}
function setErrors(err,n) {
if(err.length > 0) {
for(i = 0; i < err.length; i++){
if(err[i].length > 0) {
err[i][0].prev().prev().html(err[i][1]);
}
}
}
}
function initMap() {
var latlng = new google.maps.LatLng(-34.397, 150.644);
var myOptions = {
zoom: 8,
center: latlng,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
map = new google.maps.Map(document.getElementById("map_canvas"),
myOptions);
return map;
}
function resizeMap(map) {
google.maps.event.trigger(map, 'resize');
}
function codeAddress() {
var geocoder;
geocoder = new google.maps.Geocoder();
var concataddress = $('#address').val() + ' ' + $('#address2').val() + ' ' + $('#city').val() + ' ' + $('#state').val() + ' ' + $('#zip').val() + ' ' + $('#country').val();
var contentString = '