1(function() { 2 var current_orientation = 'portrait'; 3 OS.event.add(window, 'orientation'); 4 5 if((OS.browser.client_os == 'iPhone/iPod')||(OS.browser.client_os == 'iPad')||(OS.browser.client_os == 'Android')){ 6 // Find matches 7 var mql = window.matchMedia("(orientation: portrait)"); 8 9 // If there are matches, we're in portrait 10 if(mql.matches) { 11 current_orientation = 'portrait'; 12 } else { 13 current_orientation = 'landscape'; 14 } 15 16 // Add a media query change listener 17 mql.addListener(function(m) {if(m.matches) { 18 if(current_orientation !== 'portrait') { 19 current_orientation = 'portrait'; 20 OS.event.fire(window, 'orientation', {orientation: current_orientation}); 21 } 22 } else { 23 if(current_orientation !== 'landscape') { 24 current_orientation = 'landscape'; 25 OS.event.fire(window, 'orientation', {orientation: current_orientation}); 26 } 27 } 28 }); 29 30 // Listen for orientation changes 31 window.addEventListener("orientationchange", function() { 32 if(window.orientation === -90 || window.orientation === 90) { 33 if(current_orientation !== 'landscape') { 34 current_orientation = 'landscape'; 35 OS.event.fire(window, 'orientation', {orientation: current_orientation}); 36 } 37 } else { 38 if(current_orientation !== 'portrait') { 39 current_orientation = 'portrait'; 40 OS.event.fire(window, 'orientation', {orientation: current_orientation}); 41 } 42 } 43 }, false); 44 } 45 // Return Current Orientation 46 OS.dom.device_orientation = function() { 47 return current_orientation; 48 }; 49})(); 50 51 52 53 54OS.event.observe(window, 'orientation', function(e) { 55 if(e.orientation === 'portrait') { 56 document.querySelector('meta[name="viewport"]').content = 'width=device-width, height=device-height, initial-scale=1.0, maximum-scale=1.0, user-scalable=no'; 57 } else { 58 document.querySelector('meta[name="viewport"]').content = 'width=device-height, height=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no'; 59 } 60}); 61 62 63 64 65var vb_account_handler = (function() { 66 67 var mob = function(o1, o2){ // merge objects - properties of o2 are overwritten by properties of o1 68 var ret = {}; 69 for(var ind in o2) {ret[ind] = o2[ind];} 70 for(var ind in o1) {ret[ind] = o1[ind];} 71 return ret; 72 }; 73 74 //debugger; 75 var in_style = {webkitAppearance:'none', color:'black', fontWeight:'normal', padding:'0px 0px 0px 10px', marginBottom:'6px', fontSize:'16px', lineHeight:'40px', border:'1px solid rgb(191,191,191)', textAlign:'left', backgroundColor:'white', backgroundColor: 'rgb(255,255,255)', verticalAlign: 'baseline', width:'100%', height: '40px', display: 'inline-block', fontFamily:'inherit'}; 76 //height: '40px', fontSize: '18px', width: '100%'}; 77 // 78 var bb_style = {cursor:'pointer', webkitTapHighlightColor:'rgba(0,0,0,0)', color:'white', backgroundColor:S.btn_blue, height: '38px', lineHeight:'38px', fontSize: '18px', textAlign:'center', paddingLeft:'15px', paddingRight:'15px', display:'inline-block', whiteSpace:'nowrap', marginBottom: '6px'}; 79 var gb_style = {cursor:'pointer', webkitTapHighlightColor:'rgba(0,0,0,0)', color:'white', backgroundColor:'#AAAAAA', height: '38px', lineHeight:'38px', fontSize: '18px', textAlign:'center', paddingLeft:'15px', paddingRight:'15px', display:'inline-block', whiteSpace:'nowrap', marginBottom: '6px'}; 80 81 in_style[S.p('borderRadius')] = '5px'; 82 bb_style[S.p('borderRadius')] = '5px'; 83 gb_style[S.p('borderRadius')] = '5px'; 84 85 in_style[S.p('boxSizing')] = 'border-box'; 86 87 var link = {}; 88 var layout = {}; 89 //var layout = (function() { 90 // Clear screen 91 //OS.dom.delete_children(document.body); 92 //OS.dom.add_element('div', document.body, {}, {id: 'fb-root'}); 93 // Set up the basic layout 94 95 document.body.style.margin = '0px'; 96 //document.body.style.fontFamily = 'tahoma, sans-serif'; 97 98 //var fb_root_div = OS.dom.add_element('div', document.body, {}, {id: 'fb-root'}); 99 //var background = OS.dom.add_element('div', document.body, {width: '100%', height: '100%'}); 100 var main_table = OS.gui.add_table(document.body, 1, 1); 101 OS.dom.hs(main_table, '', {display:'none', width:'100%', height:'100%'}); 102 //OS.dom.hs(t1.td[0][0], '', {}); 103 104 //allcenter = OS.dom.add_element('div', document.body, {position:'absolute', display:'table-cell', top:'0px', bottom: '0px', left:'0px', right: '0px'}); 105 106 var container = OS.dom.add_element('div', main_table.td[0][0], {marginBottom:'80px'}, {className: 'container'}); // this is the one to position absolutely and top %/negative margin_top 107 108 // Title Container 109 var title_div = OS.dom.add_element('div', container, {textAlign:'center'}, {className: 'masthead'}); 110 111 // Organization's logo 112 113 // The main content area 114 var row_main = OS.dom.add_element('div', container, {}, {className: 'row'}); 115 var main_content = OS.dom.add_element('div', row_main, {paddingRight:'20px', paddingLeft:'20px'}, {className: 'span6 offset3'}); 116 layout.well = OS.dom.add_element('div', main_content, {padding:'19px 19px 13px 19px', marginBottom:'30px', backgroundColor:'#eeeeee', border:'1px solid #e3e3e3', maxWidth:'400px', marginLeft:'auto', marginRight:'auto'}, {className: 'well'}); 117 if(ie_lt(8)) { 118 layout.well.style.width = '350px'; 119 layout.well.style.display = 'inline-block'; 120 main_content.style.textAlign = 'center'; 121 } 122 S.borderRadius(layout.well, '8px'); 123 124 125 126 //link.forgot = OS.dom.add_element('div', ret.l_buttons_inner, {textAlign:'center', color:S.btn_blue}).txt('Forgot Username or Password'); 127 link.forgot = OS.dom.add_element('div', container, {cursor:'pointer', webkitTapHighlightColor:'rgba(0,0,0,0)', textAlign:'center', fontSize:'18px', padding:'10px', color:S.btn_blue}).txt('Forgot Username or Password') 128 link.sign_up = OS.dom.add_element('div', container, {cursor:'pointer', webkitTapHighlightColor:'rgba(0,0,0,0)', textAlign:'center', fontSize:'18px', padding:'10px', color:S.btn_blue}).txt('Create New Account') 129 link.login = OS.dom.add_element('div', container, {cursor:'pointer', webkitTapHighlightColor:'rgba(0,0,0,0)', textAlign:'center', fontSize:'18px', padding:'10px', color:S.btn_blue}).txt('Already Have an Account?') 130 131 OS.event.observe(link.forgot, 'click', function() {draw.forgot_pw();}); 132 OS.event.observe(link.sign_up, 'click', function(e) {signup_fn();}); 133 OS.event.observe(link.login, 'click', function(e) {login_fn();}); 134 135 136 layout.form = OS.dom.add_element('form', layout.well, {display: '', marginBottom: '0px'}); 137 138 layout.reset = function(){ 139 OS.dom.delete_children(layout.form); 140 layout.form.style.display = ''; 141 142 link.forgot.style.display = 'none'; 143 link.sign_up.style.display = 'none'; 144 link.login.style.display = 'none'; 145 } 146 147 148 var draw = {}; 149 150 draw.signup_em = function(act_data) { 151 //debugger; 152 var ret = {}; 153 154 layout.reset(); 155 link.login.style.display = ''; 156 157 // Sign Up Page 158 159 if(typeof act_data !== 'undefined'){ 160 /*OS.dom.add_element('div', layout.form, { 161 textAlign: 'center', 162 padding: '0px 0px', 163 backgroundColor: '#f5f5f5' 164 }).txt('<b>Activation Code Accepted:</b>'); */ 165 OS.dom.add_element('div', layout.form, {marginBottom: '2px'}).txt('Activation Code Account Setup'); 166 } else if((typeof email_key !== 'undefined') && (email_key !== '')){ 167 OS.dom.add_element('div', layout.form, {textAlign:'center', fontSize:'24px', marginTop:'5px', marginBottom:'20px'}).txt('Create New Account'); 168 //OS.dom.add_element('div', layout.form, {color:'rgb(168,168,168)', fontSize: '12px', marginBottom:'8px'}).txt('To: '+email_key); 169 } 170 171 OS.no_fb = true; // temporary force no facebook. remove when adding facebook back in 172 if(OS.no_fb !== true) { 173 ret.fb_signup_group = OS.dom.add_element('div', layout.form, { 174 margin: '18px auto', 175 marginBottom: '10px'/*, 176 display: 'none'*/ 177 }); 178 facebook_elements.push(ret.fb_signup_group); 179 OS.fb.add_login_button(ret.fb_signup_group, {}, 'Log in with Facebook'); 180 181 /*var ln = OS.dom.add_element('div', layout.form, { 182 width: '90%', 183 margin: '10px auto', 184 height: '1px', 185 backgroundColor: 'rgb(200,200,200)' 186 }); 187 var or_cont = OS.dom.add_element('div', layout.form, { 188 width: '90%', 189 margin: 'auto', 190 position: 'relative', 191 top: '-22px', 192 color: 'black', 193 textAlign: 'center', 194 fontSize: '16px', 195 marginBottom: '-15px' 196 }); 197 var or_txt = OS.dom.add_element('div', or_cont, { 198 width: 'auto', 199 display: 'inline-block', 200 padding: '0px 5px', 201 backgroundColor: '#f5f5f5' 202 }).txt('or');*/ 203 var or_ele = draw.or(layout.form); 204 205 //facebook_elements.push(ln); 206 facebook_elements.push(or_ele); 207 } 208 var email_signup_link = OS.dom.add_element('div', layout.form, { 209 margin: 'auto', 210 width: '200px', 211 display: 'block', 212 marginTop: '15px', 213 marginBottom: '60px' 214 }, {className: 'btn'}).txt('Create account using your email'); 215 216 var show_signup = function(){ 217 ret.sign_up_hider.style.display = ''; 218 //ln.style.display = 'none'; 219 //or_cont.style.display = 'none'; 220 email_signup_link.style.display = 'none'; 221 //ret.fb_signup_group.style.display = 'none'; 222 //or_ele.style.display = 'none'; 223 }; 224 OS.event.observe(email_signup_link, 'click', function(e){show_signup();});
225 ret.sign_up_hider = OS.dom.add_element('div', layout.form, {display: 'none'}); 226 227 ret.s_username = ig(ret.sign_up_hider, in_style, {id: 's_username', placeholder: 'Username', autocapitalize: 'off', autocomplete: 'off', spellcheck: 'false', autocorrect: 'off', type: 'text', required: true}); 228 229 230 OS.event.observe(ret.s_username.input, 'keyup', function(e){ 231 if(ret.s_username.input.value.length < 3) set_ue(''); 232 }); 233 234 var set_ue = function(str, color){ 235 if(typeof color === 'undefined') color = 'red'; 236 ret.s_username.error.style.display = ''; 237 ret.s_username.error.style.color = color; 238 ret.s_username.error.innerHTML = str; 239 } 240 241 var set_input_error = function(inp, str, color){ 242 if(typeof color === 'undefined') color = 'red'; 243 inp.error.style.display = ''; 244 inp.error.style.color = color; 245 inp.error.innerHTML = str; 246 } 247 248 OS.live_search_init(ret.s_username.input, {tx_ms: 500, 249 output_elem: {view_id: 0}, 250 default_text: '', 251 server_search_fn_name: '/members/os_login.php?a=ajax_username_check&fb_id='+fb_id+'&email_key='+email_key+'&invite_key='+invite_key, 252 client_fn: function(dat) { 253 console.log(dat); 254 if (dat.count >= 1) { 255 set_ue('"'+dat.username+'" is not avaliable'); 256 } else { 257 //var pattern = /^[a-z0-9_]+$/i; // only letters and numbers allowed 258 if(dat.username.length < 3) set_ue('"'+dat.username+'" is too short'); 259 else if (dat.username.length > 41) set_ue('"'+dat.username+'" is too long'); 260 else set_ue('"'+dat.username+'" is avaliable', 'green'); 261 } 262 } 263 }); 264 265 password_cont = OS.dom.add_element('div', ret.sign_up_hider, {whiteSpace: 'nowrap'}); 266 267 var t1a = OS.gui.add_table(password_cont, 1, 2); 268 OS.dom.hs(t1a, '', {width:'100%'}); 269 OS.dom.hs(t1a.td[0][0], '', {verticalAlign:'bottom', paddingRight:'3px'}); 270 OS.dom.hs(t1a.td[0][1], '', {verticalAlign:'bottom', paddingLeft:'3px', width:'50%'}); 271 272 ret.s_password1 = ig(t1a.td[0][0], in_style, {id: 's_password1', placeholder: 'Password', type: 'password', required: true}); 273 ret.s_password2 = ig(t1a.td[0][1], in_style, {id: 's_password2', placeholder: 'Retype Password', type: 'password', required: true}); 274 275 OS.dom.add_element('div', password_cont, {}, {className: 'clearfix'}); 276 277 //name_cont = OS.dom.add_element('div', ret.sign_up_hider, {whiteSpace: 'nowrap'}); 278 279 var t1 = OS.gui.add_table(ret.sign_up_hider, 1, 2); 280 OS.dom.hs(t1, '', {width:'100%'}); 281 OS.dom.hs(t1.td[0][0], '', {verticalAlign:'bottom', paddingRight:'3px'}); 282 OS.dom.hs(t1.td[0][1], '', {verticalAlign:'bottom', paddingLeft:'3px', width:'50%'}); 283 284 ret.s_first = ig(t1.td[0][0], in_style, {id: 's_first', placeholder: 'First Name', autocapitalize: 'on', autocomplete: 'off', spellcheck: 'false', autocorrect: 'off', type: 'text', required: true}); 285 ret.s_last = ig(t1.td[0][1], in_style, {id: 's_last', placeholder: 'Last Name', autocapitalize: 'on', autocomplete: 'off', spellcheck: 'false', autocorrect: 'off', type: 'text', required: true}); 286 287 //OS.dom.add_element('div', name_cont, {}, {className: 'clearfix'}); 288 289 if(typeof act_data === 'undefined') { 290 ret.s_email = ig(ret.sign_up_hider, in_style, {id: 's_email', type: 'hidden', value: email_key}); 291 } else { 292 ret.s_email = ig(ret.sign_up_hider, in_style, {id: 's_email', placeholder: 'Email Address', autocapitalize: 'off', autocomplete: 'off', spellcheck: 'false', autocorrect: 'off', type: 'text', required: true}); 293 } 294 295 OS.event.observe(ret.s_password1.input, 'blur', function(e) { 296 var errors = []; 297 ret.s_password1.group.className = 'control-group'; 298 ret.s_password1.error.txt(''); 299 300 // -- Password 301 if(ret.s_password1.input.value.length < 4) { 302 errors.push({ 303 inp: ret.s_password1, 304 elem: ret.s_password1.input, 305 val: 'Password too short. <br>Must be 4 to 15 characters.' 306 }); 307 } else if(ret.s_password1.input.value.length > 25) { 308 errors.push({ 309 inp: ret.s_password1, 310 elem: ret.s_password1.input, 311 val: 'Password too long. <br>Must be 4 to 25 characters.' 312 }); 313 } 314 315 if(errors.length > 0) { 316 for(var i = 0, len = errors.length; i < len; ++i) { 317 set_input_error(errors[i].inp, errors[i].val); 318 //errors[i].elem.parentNode.className = 'control-group error'; 319 //errors[i].elem.parentNode.firstChild.childNodes[1].txt(errors[i].val); 320 } 321 } 322 }); 323 324 OS.event.observe(ret.s_password2.input, 'blur', function(e) { 325 var errors = []; 326 ret.s_password2.group.className = 'control-group'; 327 ret.s_password2.error.txt(''); 328 329 // -- Password 330 if(ret.s_password1.input.value !== ret.s_password2.input.value) { 331 errors.push({ 332 inp: ret.s_password2, 333 elem: ret.s_password2.input, 334 val: 'Passwords don\'t match' 335 }); 336 } 337 338 if(errors.length > 0) { 339 for(var i = 0, len = errors.length; i < len; ++i) { 340 set_input_error(errors[i].inp, errors[i].val); 341 //errors[i].elem.parentNode.className = 'control-group error'; 342 //errors[i].elem.parentNode.firstChild.childNodes[1].txt(errors[i].val); 343 } 344 } 345 }); 346 347 348 349 ret.s_buttons_outer = OS.dom.add_element('div', ret.sign_up_hider, {}, {className: 'control-group'}); 350 ret.s_buttons_inner = OS.dom.add_element('div', ret.s_buttons_outer, {}, {className: 'controls'}); 351 ret.s_submit_button = OS.dom.add_element('div', ret.s_buttons_inner, bb_style, {className: 'btn btn-large btn-success'}).txt('Create Account'); 352 353 354 OS.dom.add_element('div', layout.form, {textAlign:'center', color:'rgb(188,188,188)', fontSize: '11px', marginTop: '20px'}).txt('Invitation from '+global_dat.invited_by+' to '+email_key); 355 356 //ret.s_back_button = OS.dom.add_element('div', ret.s_buttons_inner, {marginLeft: '10px'}, {className: 'btn btn-large'}).txt('Go Back'); 357 358 /* 359 OS.event.observe(ret.s_back_button, 'click', function(e) { 360 ret.sign_up_hider.style.display = 'none'; 361 ret.fb_signup_group.style.display = ''; 362 //ln.style.display = ''; 363 //or_cont.style.display = ''; 364 or_ele.style.display=''; 365 email_signup_link.style.display = 'block'; 366 }); 367 */ 368 369 /* 370 if(typeof act_data === 'undefined') { 371 //ret.bottom_link.login = OS.dom.add_element('div', layout.form, {fontSize: '12px', display: 'block', width: '210px', margin: 'auto', marginTop: '15px'}, {className: 'btn'}).txt('Already have an account? Log in'); 372 ret.bottom_login = OS.dom.add_element('div', layout.form, {marginTop: '10px'}); 373 ret.bottom_login_text = OS.dom.add_element('span', ret.bottom_login).txt('Already have an account? '); 374 ret.bottom_link.login = OS.dom.add_element('a', ret.bottom_login_text, { 375 color: 'rgb(0, 136, 204)', 376 cursor: 'pointer' 377 }, {href: '#'}).txt('Log in now'); 378 379 380 381 OS.event.observe(ret.bottom_link.login, 'click', function() { 382 //layout.sign_up_nav.className = ''; 383 //layout.login_nav.className = 'active'; 384 385 //layout.sign_up_nav.innerHTML = '<a>Create New Account</a>'; 386 //layout.login_nav.innerHTML = '<a><strong> Login </strong></a>'; 387 388 layout.form.style.display = 'none'; 389 layout.form.style.display = ''; 390 }); 391 } 392 */ 393 OS.event.observe(ret.s_submit_button, 'click', function() { 394 full_sign_up_submit(ret, act_data); 395 }); 396 397 show_signup(); 398 399 return ret; 400 }; 401 402 403 draw.login = function() { 404 //debugger;
405 switch(error_code) { 406 case -1: 407 error_text = 'Invalid username and/or password. Please sign in again.'; 408 break; 409 case -2: 410 error_text = 'Invalid username and/or password. Please sign in again.'; 411 break; 412 case -3: 413 error_text = 'Invalid username and/or password. Please sign in again.'; 414 break; 415 case -4: 416 if(exp_msg) error_text = exp_msg; 417 else error_text = 'Your account has been temporarily deactivated. Contact staff to reactivate your account.'; 418 break; 419 case -5: 420 error_text = 'Your account has been deactivated.' 421 break; 422 } 423 424 //layout.nav.style.display = ''; 425 // Clear login form 426 427 428 layout.reset(); 429 if(rs_id === false) { 430 link.forgot.style.display = ''; 431 link.sign_up.style.display = ''; 432 } 433 434 //sign_up_form.style.display = 'none'; 435 //login_form.style.display = ''; 436 //OS.dom.delete_children(layout.form); 437 438 // Login Page 439 var ret = {}; 440 441 442 443 ret.error_div = OS.dom.add_element('div', layout.form, {display: error_text !== '' ? '' : 'none', margin:'0 0 18px 0', color:'red', fontSize:'13px'}, {className: 'alert alert-error'}).txt(error_text); 444 445 OS.no_fb = true; // temporary force no facebook. remove when adding facebook back in 446 if(OS.no_fb !== true) { 447 ret.fb_login_group = OS.dom.add_element('div', layout.form, { 448 margin: '25px', 449 marginBottom: '15px'/*, 450 display: 'none'*/ 451 }); 452 453 facebook_elements.push(ret.fb_login_group); 454 OS.fb.add_login_button(ret.fb_login_group); 455 /* 456 var ln = OS.dom.add_element('div', layout.form, { 457 width: '90%', 458 margin: '10px auto', 459 height: '1px', 460 backgroundColor: 'rgb(200,200,200)' 461 }); 462 var or_cont = OS.dom.add_element('div', layout.form, { 463 width: '90%', 464 margin: 'auto', 465 position: 'relative', 466 top: '-22px', 467 color: 'black', 468 textAlign: 'center', 469 fontSize: '16px'
470 }); 471 var or_txt = OS.dom.add_element('div', or_cont, { 472 width: 'auto', 473 display: 'inline-block', 474 padding: '0px 5px', 475 backgroundColor: '#f5f5f5' 476 }).txt('or'); 477 facebook_elements.push(ln); 478 facebook_elements.push(or_cont);*/ 479 var or_ele = draw.or(layout.form); 480 481 //facebook_elements.push(ln); 482 facebook_elements.push(or_ele); 483 484 } 485 486 ret.l_username = ig(layout.form, in_style, {id: 'l_username', placeholder: 'Username', autocapitalize: 'off', autocomplete: 'off', spellcheck: 'false', autocorrect: 'off', type: 'text', value: typeof query_obj.username !== 'undefined' ? query_obj.username : ''}); 487 ret.l_username.input.setAttribute("autocorrect", "off"); 488 ret.l_username.input.setAttribute("spellcheck", "false"); 489 490 491 var t1 = OS.gui.add_table(layout.form, 1, 2); 492 OS.dom.hs(t1, '', {width:'100%'}); 493 OS.dom.hs(t1.td[0][1], '', {paddingLeft:'6px', width:'60px'}); 494 495 ret.l_password = ig(t1.td[0][0], in_style, {id: 'l_password', placeholder: 'Password', type: 'password', required: true}); 496 497 ret.l_buttons_outer = OS.dom.add_element('div', t1.td[0][1], {marginBottom: '0px'}, {className: 'control-group'}); 498 ret.l_buttons_inner = OS.dom.add_element('div', ret.l_buttons_outer, {}, {className: 'controls'}); 499 500 ret.l_submit_button = OS.dom.add_element('div', ret.l_buttons_inner, bb_style, {className: 'btn btn-success'}).txt('Log In'); 501 OS.event.observe(ret.l_submit_button, 'click', function() {login_submit(ret);}); 502 503 504 /* 505 ret.l_forgot_button = OS.dom.add_element('div', ret.l_buttons_inner, {marginLeft: '5px'}, {className: 'btn btn'}).txt('Forgot Username or Password'); 506 OS.event.observe(ret.l_forgot_button, 'click', function() { 507 draw.forgot_pw(); 508 }); 509 */ 510 OS.event.observe(layout.form, 'keydown', function(e) { 511 var kc = window.event ? e.keyCode : e.which; 512 if(kc == 13) { 513 login_submit(ret); 514 }; 515 }); 516 return ret; 517 }; 518 519 draw.signup_ac = function() { 520 debugger; 521 layout.reset(); 522 link.login.style.display = ''; 523 524 var ret = {}; 525 ret.alert_box = OS.dom.add_element('div', layout.form, {marginBottom: '6px', paddingLeft: '6px'}, {className: 'alert alert-info'}).txt('Contact staff to gain access.'); 526 527 ret.ac_activation_code = ig(layout.form, in_style, {id: 'l_activation_code', placeholder: 'Activation Code', autocapitalize: 'off', autocomplete: 'off', spellcheck: 'false', autocorrect: 'off', type: 'text', required: true}); 528 ret.ac_staff_name = ig(layout.form, in_style, {id: 'ac_staff_name', placeholder: 'Staff Name', autocapitalize: 'off', autocomplete: 'off', spellcheck: 'false', autocorrect: 'off', type: 'text'}); 529 530 ret.ac_buttons_outer = OS.dom.add_element('div', layout.form, {marginBottom: '0px'}, {className: 'control-group'}); 531 ret.ac_buttons_inner = OS.dom.add_element('div', ret.ac_buttons_outer, {}, {className: 'controls'}); 532 ret.ac_submit_button = OS.dom.add_element('div', ret.ac_buttons_inner, bb_style, {className: 'btn btn-success'}).txt('Create Account'); 533 534 OS.event.observe(ret.ac_submit_button, 'click', function() {activation_code_submit(ret);}); 535 }; 536 537 draw.forgot_pw = function() { 538 debugger; 539 layout.reset(); 540 541 OS.dom.add_element('div', layout.form, {marginBottom: '6px'}).txt('Forgot Username or Password'); 542 543 var ret = {}; 544 545 ret.error_alert = OS.dom.add_element('div', layout.form,{display: 'none'}, {className: 'alert alert-error'}); 546 ret.success_alert = OS.dom.add_element('div', layout.form,{display: 'none'}, {className: 'alert alert-success'}); 547 548 ret.f_email = {}; 549 550 ret.f_email = ig(layout.form, in_style, {id: 'f_email', placeholder: 'Enter Email', type: 'text', autocapitalize: 'off', autocomplete: 'off', spellcheck: 'false', autocorrect: 'off', required: true}); 551 ret.f_username = ig(layout.form, in_style, {id: 'f_username', placeholder: 'or Username', type: 'text', autocapitalize: 'off', autocomplete: 'off', spellcheck: 'false', autocorrect: 'off', required: true}); 552 553 ret.f_buttons_outer = OS.dom.add_element('div', layout.form, {marginBottom: '0px'}, {className: 'control-group'}); 554 ret.f_buttons_inner = OS.dom.add_element('div', ret.f_buttons_outer, {}, {className: 'controls'}); 555 ret.f_submit_button = OS.dom.add_element('div', ret.f_buttons_inner, bb_style, {className: 'btn btn-success'}).txt('Submit'); 556 ret.f_forgot_button = OS.dom.add_element('div', ret.f_buttons_inner, mob({marginLeft:'5px'}, gb_style), {className: 'btn btn'}).txt('Cancel'); 557 558 OS.event.observe(ret.f_submit_button, 'click', function() { 559 forgot_submit(ret); 560 }); 561 OS.event.observe(ret.f_forgot_button, 'click', function() { 562 login_fn(); 563 }); 564 }; 565 566 draw.payment_info = function() { 567 debugger; 568 layout.reset(); 569 570 OS.dom.add_element('div', layout.form, {marginBottom: '6px'}).txt('Payment Information'); 571 572 var ret = {}; 573 574 ret.error_alert = OS.dom.add_element('div', layout.form,{display: 'none'}, {className: 'alert alert-error'}); 575 ret.success_alert = OS.dom.add_element('div', layout.form,{display: 'none'}, {className: 'alert alert-success'}); 576 577 ret.f_email = {}; 578 579 ret.f_email = ig(layout.form, in_style, {id: 'f_email', placeholder: 'Enter Email', type: 'text', autocapitalize: 'off', autocomplete: 'off', spellcheck: 'false', autocorrect: 'off', required: true}); 580 ret.f_username = ig(layout.form, in_style, {id: 'f_username', placeholder: 'or Username', type: 'text', autocapitalize: 'off', autocomplete: 'off', spellcheck: 'false', autocorrect: 'off', required: true}); 581 582 ret.f_buttons_outer = OS.dom.add_element('div', layout.form, {marginBottom: '0px'}, {className: 'control-group'}); 583 ret.f_buttons_inner = OS.dom.add_element('div', ret.f_buttons_outer, {}, {className: 'controls'}); 584 ret.f_submit_button = OS.dom.add_element('div', ret.f_buttons_inner, bb_style, {className: 'btn btn-success'}).txt('Submit'); 585 ret.f_forgot_button = OS.dom.add_element('div', ret.f_buttons_inner, mob({marginLeft:'5px'}, gb_style), {className: 'btn btn'}).txt('Cancel'); 586 587 OS.event.observe(ret.f_submit_button, 'click', function() { 588 forgot_submit(ret); 589 }); 590 OS.event.observe(ret.f_forgot_button, 'click', function() { 591 login_fn(); 592 }); 593 }; 594 595 draw.reset_pw = function() { 596 // Clear login form 597 debugger; 598 //layout.nav.style.display = 'none'; 599 600 layout.reset(); 601 //link.forgot.style.display = ''; 602 //link.sign_up.style.display = ''; 603 604 //sign_up_form.style.display = 'none'; 605 //login_form.style.display = ''; 606 607 //OS.dom.delete_children(layout.form); 608 609 OS.dom.add_element('div', layout.form, {marginBottom: '6px'}).txt('Choose a New Password'); 610 611 var ret = {}; 612 /* 613 ret.r_password0 = {}; 614 ret.r_password0.group = OS.dom.add_element('div', layout.form, {}, {className: 'control-group'}); 615 ret.r_password0.label = OS.dom.add_element('label', ret.r_password0.group, {}, {className: 'control-label', htmlFor: 'r_password0'}).txt(''); 616 ret.r_password0.error = OS.dom.add_element('span', ret.r_password0.label, {}, {className: 'help-block'}); 617 */ 618 ret.r_password0 = ig(layout.form, in_style, {id: 'r_password0', placeholder: 'New Password', type: 'password', required: true}); 619 620 /* 621 ret.r_password1 = {}; 622 ret.r_password1.group = OS.dom.add_element('div', layout.form, {}, {className: 'control-group'}); 623 ret.r_password1.label = OS.dom.add_element('label', ret.r_password1.group, {}, {className: 'control-label', htmlFor: 'r_password1'}).txt(''); 624 ret.r_password1.error = OS.dom.add_element('span', ret.r_password1.label, {}, {className: 'help-block'}); 625 */ 626 ret.r_password1 = ig(layout.form, in_style, {id: 'r_password1', placeholder: 'Confirm New Password', type: 'password', required: true}); 627 628 ret.r_buttons_outer = OS.dom.add_element('div', layout.form, {marginBottom: '0px'}, {className: 'control-group'}); 629 ret.r_buttons_inner = OS.dom.add_element('div', ret.r_buttons_outer, {}, {className: 'controls'}); 630 ret.r_submit_button = OS.dom.add_element('div', ret.r_buttons_inner, bb_style, {className: 'btn btn-success'}).txt('Submit'); 631 ret.r_forgot_button = OS.dom.add_element('div', ret.r_buttons_inner, mob({marginLeft:'5px'}, gb_style), {className: 'btn btn'}).txt('Cancel'); 632 633 OS.event.observe(ret.r_submit_button, 'click', function() { 634 reset_submit(ret); 635 }); 636 OS.event.observe(ret.r_forgot_button, 'click', function() { 637 login_fn(); 638 }); 639 OS.event.observe(layout.form, 'keydown', function(e) { 640 var kc = window.event ? e.keyCode : e.which; 641 if(kc == 13) reset_submit(ret); 642 }); 643 }; 644 645 draw.fb_no_user = function() { 646 debugger; 647 648 // Clear login form 649 layout.reset(); 650 link.forgot.style.display = ''; 651 link.sign_up.style.display = ''; 652 653 //sign_up_form.style.display = 'none'; 654 //login_form.style.display = ''; 655 656 //OS.dom.delete_children(layout.form); 657 658 // Login Page 659 var ret = {}; 660 ret.error_div = OS.dom.add_element('div', layout.form, {display: error_text !== '' ? '' : 'none'}, {className: 'alert alert-error'}).txt(error_text); 661 662 ret.ask_for_access = OS.dom.add_element('div', layout.form, {
663 color: 'rgb(70,70,70)', 664 fontFamily: 'arial', 665 fontSize: '14px', 666 textAlign: 'center', 667 marginBottom: '35px' 668 }).txt('<strong>Invitation required.</strong><br>Contact staff for access.'); 669 670 var ln = OS.dom.add_element('div', layout.form, { 671 width: '90%', 672 margin: '10px auto', 673 height: '1px', 674 backgroundColor: 'rgb(200,200,200)' 675 }); 676 var or_cont = OS.dom.add_element('div', layout.form, { 677 width: '90%', 678 margin: 'auto', 679 position: 'relative', 680 top: '-22px', 681 color: 'black', 682 textAlign: 'center', 683 fontSize: '16px' 684 }); 685 var or_txt = OS.dom.add_element('div', or_cont, { 686 width: 'auto', 687 display: 'inline-block', 688 padding: '0px 5px', 689 backgroundColor: '#f5f5f5', 690 color: 'rgb(80,80,80)', 691 fontSize: '14px' 692 }).txt('or'); 693 var or_txt = OS.dom.add_element('div', or_cont, { 694 width: 'auto', 695 display: 'inline-block', 696 paddingTop: '10px', 697 backgroundColor: '#f5f5f5', 698 color: 'rgb(80,80,80)', 699 fontSize: '14px', 700 marginBottom: '-20px' 701 }).txt('Connect Facebook to existing account'); 702 703 /* 704 ret.fb_no_user_username = {}; 705 ret.fb_no_user_username.group = OS.dom.add_element('div', layout.form, {}, {className: 'control-group'}); 706 ret.fb_no_user_username.label = OS.dom.add_element('label', ret.fb_no_user_username.group, {margin: 0}, {className: 'control-label', htmlFor: 'fb_no_user_username'});//.txt('<strong> Username </strong>'); 707 ret.fb_no_user_username.error = OS.dom.add_element('span', ret.fb_no_user_username.label, {}, {className: 'help-block'}); 708 */ 709 ret.fb_no_user_username = ig(layout.form, in_style, {id: 'fb_no_user_username', placeholder: 'Existing Username', autocapitalize: 'off', autocomplete: 'off', spellcheck: 'false', autocorrect: 'off', type: 'text', required: true, value: typeof query_obj.username !== 'undefined' ? query_obj.username : ''}); 710 711 /* 712 ret.fb_no_user_password = {}; 713 ret.fb_no_user_password.group = OS.dom.add_element('div', layout.form, {}, {className: 'control-group'}); 714 ret.fb_no_user_password.label = OS.dom.add_element('label', ret.fb_no_user_password.group, {margin: 0}, {className: 'control-label', htmlFor: 'fb_no_user_username'});//.txt('<strong> Username </strong>'); 715 ret.fb_no_user_password.error = OS.dom.add_element('span', ret.fb_no_user_password.label, {}, {className: 'help-block'}); 716 */ 717 ret.fb_no_user_password = ig(layout.form, in_style, {id: 'fb_no_user_password', placeholder: 'Existing Password', type: 'password', required: true}); 718 719 ret.fb_no_user_buttons_outer = OS.dom.add_element('div', layout.form, {marginBottom: '0px'}, {className: 'control-group'}); 720 ret.fb_no_user_buttons_inner = OS.dom.add_element('div', ret.fb_no_user_buttons_outer, {}, {className: 'controls'}); 721 ret.fb_no_user_submit_button = OS.dom.add_element('div', ret.fb_no_user_buttons_inner, {}, {className: 'btn btn-success'}).txt('Connect to Facebook'); 722 723 OS.event.observe(ret.fb_no_user_submit_button, 'click', function() { 724 fb_no_user_submit(ret); 725 }); 726 OS.event.observe(layout.form, 'keydown', function(e) { 727 var kc = window.event ? e.keyCode : e.which; 728 if(kc == 13) { 729 fb_no_user_submit(ret); 730 }; 731 }); 732 return ret; 733 }; 734 735 draw.or = function(elem){ 736 debugger; 737 var str = '<div style="margin-top:4px;height:1px;background-color:rgb(200,200,200);"></div>'; 738 var tb = OS.gui.add_table(elem, 1, 3); tb.style.width='95%'; tb.style.marginBottom='6px'; 739 tb.td[0][1].style.width = '30px'; tb.td[0][1].style.textAlign = 'center'; 740 tb.td[0][0].innerHTML = str; 741 tb.td[0][1].innerHTML = 'or'; 742 tb.td[0][2].innerHTML = str; 743 return(tb); 744 } 745 746 var ig = function(elem, style, att){ 747 var ob = {}; 748 var saved_style = style; 749 ob.group = OS.dom.add_element('div', elem, {position:'relative', zoom:1}, {className: 'control-group'}); 750 ob.label = OS.dom.add_element('label', ob.group, {}, {className: 'control-label', htmlFor: att.id}); 751 ob.error = OS.dom.add_element('span', ob.label, {fontSize:'13px', color:'red'}, {className: 'help-block'}); 752 ob.tb = OS.gui.add_table(ob.group, 1, 2); 753 OS.dom.hs(ob.tb, '', {width:'100%'}); 754 OS.dom.hs(ob.tb.td[0][1], '', {display:'none', width:'1px', whiteSpace:'nowrap'}); 755 ob.input = OS.dom.add_element('input', ob.tb.td[0][0], style, att); 756 ob.set_end_str = function(str){ 757 ob.tb.td[0][1].innerHTML = str; 758 ob.tb.td[0][1].style.display = ''; 759 }; 760 ob.clear_end_str = function(){ 761 ob.tb.td[0][1].innerHTML = ''; 762 ob.tb.td[0][1].style.display = 'none'; 763 }; 764 var saved_border = ''; 765 var err_flag = false;
766 ob.set_err = function(str){ 767 err_flag = true; 768 ob.error.txt(str); 769 ob.error.style.color = 'red'; 770 ob.error.style.display = ''; 771 //saved_border = ob.input.style.border; 772 ob.input.style.border = '1px solid red'; 773 }; 774 ob.clear_err = function(){ 775 err_flag = false; 776 ob.error.txt(''); 777 ob.error.style.display = 'none'; 778 OS.dom.hs(ob.input, '', saved_style); 779 }; 780 OS.event.observe(ob.input, 'keydown', function(){ 781 if(err_flag) ob.clear_err(); 782 }); 783 //ob.input.style.visibility = 'hidden'; 784 if(ie_lt(10)){ 785 if(typeof att !== 'undefined' && typeof att.placeholder !== 'undefined'){ 786 var ph = att.placeholder; 787 ob.placeholder = OS.dom.add_element('div', ob.group, {display:'none', position:'absolute', left:'11px', bottom:'11px', color:'rgb(128,128,128)', fontWeight:'normal', fontSize:'18px', fontFamily:'inherit'}); 788 var showing = false; 789 var setp = function(){ 790 if(ob.input.value === ''){ 791 if(showing === false){ 792 showing = true; 793 OS.dom.hs(ob.placeholder, ph, {display:''}); 794 } 795 } else { 796 if(showing === true){ 797 showing = false; 798 ob.placeholder.style.display = 'none'; 799 } 800 } 801 }; 802 setTimeout(function(){setp();}, 100); 803 var in_interval = false; 804 OS.event.observe(ob.input, 'focus', function(){ 805 if(in_interval === false) in_interval = setInterval(function(){setp();}, 200); 806 }); 807 OS.event.observe(ob.input, 'blur', function(){ 808 clearInterval(in_interval); 809 in_interval = false; 810 }); 811 OS.event.observe(ob.placeholder, 'click', function(){ 812 if(in_interval === false) ob.input.focus(); 813 }); } 814 } 815 return ob; 816 }; 817 818 819 var set_errors = function(errors){ 820 // Throw errors 821 debugger; 822 for(var i = 0, len = errors.length; i < len; ++i) { 823 var err = errors[i]; 824 err.ig.set_err(err.val); 825 //errors[i].elem.parentNode.className = 'control-group error'; 826 //errors[i].elem.parentNode.firstChild.childNodes[1].txt(errors[i].val); 827 } 828 } 829 830 blank_check = function(in_group, str, errors){ 831 in_group.clear_err(); 832 if(in_group.input.value == '') {errors.push({ig:in_group, val:str});} 833 return errors; 834 } 835 836 var login_submit = function(inputs) { 837 //debugger; 838 var errors = []; 839 errors = blank_check(inputs.l_username, 'Please enter a username', errors); 840 errors = blank_check(inputs.l_password, 'Please enter a password', errors); 841 842 if(errors.length > 0) { 843 set_errors(errors); 844 } else { 845 login_redirect(inputs.l_username.input.value, inputs.l_password.input.value); 846 /* 847 ref = ref.replace("email_key%3D", "foo1%3D"); // on login, these were sometimes causing problems because it thaught the invitation was the destination ("=" is %3d) 848 ref = ref.replace("invite_key%3D", "foo2%3D"); 849 ref = ref.replace("username%3D", "foo3%3D"); 850 OS.util.post('/members/login/?referer='+ref+urlencode(hash), { 851 username: inputs.l_username.input.value, 852 password: inputs.l_password.input.value, 853 email_key: email_key, 854 invite_key: invite_key, 855 tx_fb_id: tx_fb_id, 856 f_type: f_type, 857 f_id: f_id, 858 vb_redirect: vb_redirect 859 }); 860*/ 861 } 862 }; 863 864 var activation_code_submit = function(inputs) { 865 debugger; 866 var errors = []; 867 errors = blank_check(inputs.ac_activation_code, 'Please enter an activation code', errors); 868 if(errors.length > 0) { 869 set_errors(errors); 870 } else { 871 var req = { 872 url: '/members/os_login.php', 873 data: { 874 a: 'ajax_act_code_check', 875 act_code: inputs.ac_activation_code.input.value, 876 pg_id: pg_id 877 }, 878 cb_fn: function(dat) { 879 if(dat.count === 0) errors.push({ig: inputs.ac_activation_code, val: 'Please enter a valid activation code'}); 880 else if(dat.user_id !== null) errors.push({ig: inputs.ac_activation_code, val: 'Activation code already in use'}); 881 882 if(errors.length > 0) { 883 set_errors(errors); 884 } else { // Success 885 var d = {act_code: inputs.ac_activation_code.input.value, staff_name: inputs.ac_staff_name.input.value}; 886 OS.cookie.write('VB_ACT_DATA', urlencode(OS.json.encode(d))); 887 draw.signup_em({act_code: inputs.ac_activation_code.input.value, staff_name: inputs.ac_staff_name.input.value }); 888 } 889 } 890 }; 891 multi_tx(req); 892 } 893 }; 894 895 var full_sign_up_submit = function(inputs, act_data) { 896 debugger; 897 /* 898 inputs.s_username.group.className = 'control-group'; 899 inputs.s_username.error.txt(''); 900 901 inputs.s_password1.group.className = 'control-group'; 902 inputs.s_password1.error.txt(''); 903 904 inputs.s_password2.group.className = 'control-group'; 905 inputs.s_password2.error.txt(''); 906 907 inputs.s_first.group.className = 'control-group'; 908 inputs.s_first.error.txt(''); 909 910 inputs.s_last.group.className = 'control-group'; 911 inputs.s_last.error.txt(''); 912 913 inputs.s_email.group.className = 'control-group'; 914 inputs.s_email.error.txt(''); 915 */ 916 917 var errors = []; 918 errors = blank_check(inputs.s_username, 'Please enter a username', errors); 919 errors = blank_check(inputs.s_password1, 'Enter password', errors); 920 errors = blank_check(inputs.s_password2, 'Validate password', errors); 921 errors = blank_check(inputs.s_first, 'Enter first name', errors); 922 errors = blank_check(inputs.s_last, 'Enter last name', errors); 923 errors = blank_check(inputs.s_email, 'Enter your email address', errors); 924 925 926 // Validate 927 // -- Username 928 929 /*if (inputs.s_username.input.value == '') { 930 errors.push({ 931 elem: inputs.s_username.input, 932 val: 'Please enter a username' 933 }); 934 } else */ 935 if(inputs.s_username.input.value.length > 0 && inputs.s_username.input.value.length < 3) errors.push({ig:inputs.s_username, val:'Username too short.'}); 936 if(inputs.s_username.input.value.length > 40) errors.push({ig:inputs.s_username, val:'Username too long.'}); 937 938 if(inputs.s_password1.input.value !== inputs.s_password2.input.value) errors.push({ig: inputs.s_password2, val: 'Passwords don\'t match'}); 939 if(inputs.s_password1.input.value.length > 0 && inputs.s_password1.input.value.length < 4) errors.push({ig: inputs.s_password1, val: 'Password too short. <br>It must contain at least 4 characters.'}); 940 if(inputs.s_password1.input.value.length > 40) errors.push({ig: inputs.s_password1, val: 'Password too long.'}); 941 942 // Email 943 if(inputs.s_email.input.value.length > 0 && validateEmail(inputs.s_email.input.value) === false) errors.push({ig: inputs.s_email, val: 'Please enter a valid email.'}); 944 945 if(errors.length > 0) { 946 //if(1) { 947 set_errors(errors); 948 } else { 949 // -- Ajax Validation 950 var request_array = [ 951 { url: '/members/os_login.php', data: {a: 'ajax_username_check', fb_id: fb_id, email_key: email_key, invite_key: invite_key, value: inputs.s_username.input.value}}, 952 { url: '/members/os_login.php', data: {a: 'ajax_email_check', fb_id: fb_id, email_key: email_key, invite_key: invite_key, value: inputs.s_email.input.value}} 953 ]; 954 955 var request_obj = multi_tx(request_array); 956 OS.event.observe(request_obj, 'complete', function(e) { 957 var email_dat = e.ajax_email_check; 958 var username_dat = e.ajax_username_check; 959 960 if (email_dat.count >= 1) errors.push({ig: inputs.s_email, val: 'E-Mail already in use.'}); 961 if (username_dat.count >= 1) {errors.push({ig: inputs.s_username, val: '"'+username_dat.username+'" is not avaliable'});} 962 963 if(errors.length > 0) { 964 set_errors(errors); 965 } else { 966 //layout.form.style.display = 'none'; 967 //display none nav 968 969 var a_shield = OS.dom.add_element('div', document.body, {position:'absolute', backgroundColor:'black', top:'0px', bottom:'0px', left:'0px', right:'0px'}, {className: 'container'});
970 OS.dom.set_opacity(a_shield, .5); 971 var a_t0 = OS.dom.add_element('div', document.body, {position:'absolute', top:'0px', bottom:'0px', left:'0px', right:'0px'}, {className: 'container'}); 972 var a_table = OS.gui.add_table(a_t0, 1, 1); 973 OS.dom.hs(a_table, '', {width:'100%', height:'100%'}); 974 //OS.dom.hs(a_table.td[0][0], '', {textAlign:'center'}); 975 976 //allcenter = OS.dom.add_element('div', document.body, {position:'absolute', display:'table-cell', top:'0px', bottom: '0px', left:'0px', right: '0px'}); 977 978 var a_table2 = OS.gui.add_table(a_table.td[0][0], 2, 2); 979 OS.dom.hs(a_table2, '', {margin:'auto', width:'260px', backgroundColor:'white'}); 980 OS.dom.hs(a_table2.td[0][0], '', {textAlign:'center'}, {colSpan:'2'}); 981 OS.dom.hs(a_table2.td[1][0], 'Cancel', {cursor:'pointer', color:S.btn_blue, borderTop:'1px solid rgb(230,230,230)', textAlign:'center', width:'50%', height:'45px'}); 982 OS.dom.hs(a_table2.td[1][1], 'Agree', {cursor:'pointer', color:S.btn_blue, borderTop:'1px solid rgb(230,230,230)', borderLeft:'1px solid rgb(230,230,230)', textAlign:'center'}); 983 S.borderRadius(a_table2, '8px'); 984 985 OS.dom.add_element('div', a_table2.td[0][0], {marginTop:'15px', marginBottom:'15px'}).txt('<b>Terms and Conditions</b>'); 986 987 //a_table2.style.height = '440px'; 988 var inner1 = OS.dom.add_element('div', a_table2.td[0][0], {marginBottom:'15px', fontSize:'14px', paddingLeft:'20px', paddingRight:'20px'}).txt('By setting up this account, I agree to the <span style="color:'+S.btn_blue+'; cursor:pointer;">Terms and Conditions</span>'); 989 var inner2 = OS.dom.add_element('div', a_table2.td[0][0], {display:'none', textAlign:'left', fontSize:'12px', paddingLeft:'10px', paddingRight:'10px', height:'250px', overflow:'auto', webkitOverflowScrolling:'touch'}).txt('1. NOT ALL NUTRITION OR EXERCISE PROGRAMS ARE SUITABLE FOR EVERYONE. THE MATERIAL IN THE VITABOT WEBSITE IS PROVIDED FOR EDUCATIONAL AND INFORMATIONAL PURPOSES ONLY AND IS NOT INTENDED AS MEDICAL ADVICE. THE INFORMATION CONATINED IN THIS WEBSITE SHOULD NOT BE USED TO DIAGNOSE OR TREAT ANY ILLNESS, METABOLIC DISORDER, DISEASE, OR HEALTH PROBLEM. ALWAYS CONSULT YOUR PHYSICIAN OR HEALTH CARE PROVIDER BEFORE BEGINNING ANY NUTRITION OR EXERCISE PROGRAM. USE OF THE PROGRAMS, ADVICE, AND INFORMATION CONTAINED IN THIS WEBSITE IS AT THE SOLE CHOICE AND RISK OF THE READER.<br><br>2. SERVICES PROVIDED. VITABOT OPERATES AN ONLINE, COMPUTERIZED INTERACTIVE INFORMATION, COMMUNICATION AND TRANSACTION SYSTEM (THE "SYSTEM") WHICH PROVIDES ACCESS TO A VARIETY OF NUTRITIONAL INFORMATION. VITABOT WILL PROVIDE TO CUSTOMER THE SERVICES (THE "SERVICES"). THE TERM "CUSTOMER" SHALL, WHEN THE CONTEXT PERMITS, INCLUDE CUSTOMER\'S OFFICERS, EMPLOYEES, AGENTS AND CONTRACTORS.<br><br>3. DISCLAIMER OF WARRANTY. CUSTOMER EXPRESSLY AGREES THAT USE OF THE SERVICES AND THE SYSTEM AND THE MATERIAL THEREIN AND STORAGE OF INFORMATION WHICH APPEARS IN THE SYSTEM IS AT CUSTOMER\'S SOLE RISK. THE SERVICES AND THE SYSTEM ARE PROVIDED ON AN "AS IS" AND "AS AVAILABLE" BASIS WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO WARRANTIES OF TITLE OR NONINFRINGEMENT OR IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE OR USE OTHER THAN THOSE WARRANTIES WHICH ARE IMPLIED BY AND INCAPABLE OF EXCLUSION, RESTRICTION OR MODIFICATION UNDER THE LAWS APPLICABLE TO THIS AGREEMENT. NO ADVICE OR INFORMATION GIVEN BY VITABOT, ITS CONTRACTORS, AGENTS, AFFILIATES OR VENDORS OR THEIR RESPECTIVE EMPLOYEES SHALL CREATE A WARRANTY.<br><br>4. INDEMNITY. CUSTOMER AGREES TO DEFEND, INDEMNIFY AND HOLD VITABOT, ITS AFFILIATES, CONTRACTORS, AGENTS, VENDORS AND THEIR RESPECTIVE EMPLOYEES HARMLESS FROM ANY AND ALL LIABILITIES, COSTS AND EXPENSES, INCLUDING REASONABLE ATTORNEYS\' FEES, RELATED TO OR ARISING FROM: (A) ANY VIOLATION OF THIS AGREEMENT BY CUSTOMER, (B) THE USE OF THE SYSTEM OR THE INTERNET OR THE PLACEMENT OR TRANSMISSION OF ANY MESSAGE, INFORMATION OR OTHER MATERIALS ON THE SYSTEM OR THE INTERNET BY CUSTOMER, (C) ACT
989S OR OMISSIONS OF CUSTOMER IN CONNECTION WITH THE CONSTRUCTION, INSTALLATION, MAINTENANCE, PRESENCE, USE OR REMOVAL OF SYSTEMS, CHANNELS, OR TERMINAL EQUIPMENT OR SOFTWARE NOT PROVIDED BY VITABOT WHICH ARE CONNECTED OR ARE TO BE CONNECTED TO THE SYSTEM; AND (D) CLAIMS FOR INFRINGEMENT OF PATENTS ARISING FROM THE USE OF EQUIPMENT AND SOFTWARE, APPARATUS AND SYSTEMS NOT PROVIDED BY VITABOT IN CONNECTION WITH THE SERVICES AND THE SYSTEM.<br><br>5. RIGHT TO RESTRICT ACCESS. VITABOT MAY DENY CUSTOMER ACCESS TO ALL OR PART OF THE SYSTEM WITHOUT NOTICE IF CUSTOMER ENGAGES IN ANY CONDUCT OR ACTIVITIES THAT VITABOT IN ITS SOLE DISCRETION BELIEVES VIOLATES ANY OF THE TERMS AND CONDITIONS IN THIS AGREEMENT. IF VITABOT DENIES CUSTOMER ACCESS TO THE SYSTEM BECAUSE OF SUCH A VIOLATION, THE CUSTOMER SHALL HAVE NO RIGHT (1) TO ACCESS THROUGH VITABOT ANY MATERIALS STORED ON THE SYSTEM, (2) TO OBTAIN ANY CREDIT(S) OTHERWISE DUE TO CUSTOMER, AND SUCH CREDIT(S) WILL BE FORFEITED, (3) TO ACCESS THIRD PARTY SERVICES, MERCHANDISE OR INFORMATION ON THE SYSTEM THROUGH VITABOT, AND VITABOT SHALL HAVE NO OBLIGATION TO NOTIFY ANY THIRD-PARTY PROVIDERS OF SERVICES, MERCHANDISE OR INFORMATION NOR ANY RESPONSIBILITY FOR ANY CONSEQUENCES RESULTING FROM LACK OF NOTIFICATION OR RESTRICTION OF CUSTOMER\'S ACCESS.<br><br>6. SECURITY. ACCESS TO THE SYSTEM, AND TO CERTAIN ONLINE TRANSACTIONS INVOLVES THE USE OF IDENTIFICATION NUMBERS, PASSWORDS, CHARGE OR DEBIT ACCOUNTS OR OTHER INDIVIDUALIZED NONPUBLIC INFORMATION ("PRIVATE DOCUMENTATION"). CUSTOMER SHALL USE ITS BEST EFFORTS TO PREVENT UNAUTHORIZED USE OF THE SYSTEM OR OF ANY PRIVATE DOCUMENTATION, AND SHALL PROMPTLY REPORT TO VITABOT ANY SUSPECTED UNAUTHORIZED USE OR OTHER BREACH OF SECURITY. CUSTOMER SHALL BE RESPONSIBLE FOR ANY UNAUTHORIZED USE OF ITS IDENTIFICATION NUMBERS OR PASSWORDS UNTIL VITABOT RECEIVES WRITTEN NOTICE OF A BREACH OF SECURITY AND A REQUEST TO BLOCK FURTHER ACCESS FOR SUCH NUMBERS AND PASSWORDS. VITABOT SHALL NOT BE LIABLE FOR ANY UNAUTHORIZED USE OF CHARGE, DEBIT OR OTHER CREDIT ACCOUNTS.<br><br>7. TERM AND TERMINATION. THIS AGREEMENT SHALL BE AUTOMATICALLY RENEWED FOR SUCCESSIVE ONE-MONTH PERIODS, UNTIL CANCELED BY CUSTOMER. VITABOT SHALL HAVE THE RIGHT TO TERMINATE THIS AGREEMENT IMMEDIATELY IN THE EVENT OF A BREACH OF ANY OF ITS TERMS BY CUSTOMER OR WITHOUT CAUSE.<br><br>8. ENTIRE AGREEMENT; GUIDELINES. ALL PRIOR OR CONTEMPORANEOUS AGREEMENTS, CONTRACTS, PROMISES, REPRESENTATIONS, IF ANY, BETWEEN THE PARTIES OR THEIR REPRESENTATIVES RELATED TO THE SUBJECT MATTER OF THIS AGREEMENT ARE MERGED INTO THIS AGREEMENT AND THE APPLICATION FORM(S). THESE TERMS AND CONDITIONS, ALONG WITH ANY OPERATING RULES OR GUIDELINES PUBLISHED OVER THE SYSTEM BY VITABOT, CONSTITUTE THE ENTIRE AGREEMENT BETWEEN VITABOT AND CUSTOMER WITH RESPECT TO THE SERVICES. NO AMENDMENT TO THIS AGREEMENT SHALL BE EFFECTIVE UNLESS ACKNOWLEDGED IN WRITING BY VITABOT. CUSTOMER AGREES TO COMPLY WITH VITABOT\'S OPERATING RULES AND GUIDELINES, WHICH MAY BE AMENDED FROM TIME TO TIME AT VITABOT\'S SOLE DISCRETION.<br><br>9. GOVERNING LAW; JURISDICTION AND VENUE. THIS AGREEMENT SHALL BE GOVERNED BY, AND CONSTRUED IN ACCORDANCE WITH, THE LAWS OF THE STATE OF MARYLAND, EXCLUSIVE OF CHOICE OF LAW RULES. VENUE FOR ANY ACTION ARISING OUT OF OR IN MARYLAND WITH THIS AGREEMENT SHALL BE IN PRINCE GEORGE\'S COUNTY, MARYLAND. THE PARTIES EACH HEREBY CONSENT TO THE JURISDICTION AND VENUE IN PRINCE GEORGE\'S COUNTY AND WAIVE ANY OBJECTIONS TO SUCH JURISDICTION AND VENUE.<br><br>10. ENFORCEABILITY. IF ANY PORTION OF THIS AGREEMENT IS WHOLLY OR PARTIALLY UNENFORCEABLE, FOR ANY REASON, SUCH UNENFORCEABILITY SHALL NOT AFFECT THE BALANCE HEREOF.<br><br>11. ASSIGNMENT. CUSTOMER MAY NOT ASSIGN ITS RIGHTS OR OBLIGATIONS UNDER THIS AGREEMENT WITHOUT THE PRIOR WRITTEN CONSENT OF VITABOT, WHICH MAY BE WITHHELD IN VITABOT\'S SOLE DISCRETION.<br><br>12. NO WAIVER. VITABOT\'S FAILURE TO INSIST UPON OR ENFORCE ANY PROVISION OF THIS AGREEMENT SHALL NOT BE CONSTRUED AS A WAIVER OF ANY PROVISION OR RIGHT.<br><br>13. WRITTEN AGREEMENT. THIS AGREEMENT (AND ANY AMENDMENTS HERETO) REPRESENTS A BINDING WRITTEN CONTRACT, WHETHER EXECUTED BY EACH PARTY ON PAPER OR ACCEPTED BY ELECTRONIC COMMUNICATION.'); 990 991 OS.event.observe(inner1, 'click', function(){ 992 inner1.style.display='none'; 993 inner2.style.display=''; 994 }); 995 OS.event.observe(a_table2.td[1][0], 'click', function(){
996 OS.dom.delete_element(a_shield); 997 OS.dom.delete_element(a_t0); 998 }); 999 1000 /* 1001 var conf = OS.dom.add_element('div', layout.well, { 1002 MozBorderRadius: '5px 5px 5px 5px', 1003 WebkitBorderRadius: '5px 5px 5px 5px', 1004 borderRadius: '5px 5px 5px 5px', 1005 backgroundColor: 'white', 1006 MozBoxShadow: '0px 0px 3px black', 1007 WebkitBoxShadow: '0px 0px 3px black', 1008 boxShadow: '0px 0px 3px black', 1009 overflow: 'hidden' 1010 }); 1011 var h3 = OS.dom.add_element('div', conf, {textAlign: 'center'}).txt('Vitabot Member Service Agreement'); 1012 var inner = OS.dom.add_element('div', conf, {padding: '10px', maxHeight: '200px', 1013 overflow: 'auto', 1014 backgroundColor: 'white', 1015 WebkitOverflowScrolling: 'touch' 1016 }).txt('1. NOT ALL NUTRITION OR EXERCISE PROGRAMS ARE SUITABLE FOR EVERYONE. THE MATERIAL IN THE VITABOT WEBSITE IS PROVIDED FOR EDUCATIONAL AND INFORMATIONAL PURPOSES ONLY AND IS NOT INTENDED AS MEDICAL ADVICE. THE INFORMATION CONATINED IN THIS WEBSITE SHOULD NOT BE USED TO DIAGNOSE OR TREAT ANY ILLNESS, METABOLIC DISORDER, DISEASE, OR HEALTH PROBLEM. ALWAYS CONSULT YOUR PHYSICIAN OR HEALTH CARE PROVIDER BEFORE BEGINNING ANY NUTRITION OR EXERCISE PROGRAM. USE OF THE PROGRAMS, ADVICE, AND INFORMATION CONTAINED IN THIS WEBSITE IS AT THE SOLE CHOICE AND RISK OF THE READER.<br><br>2. SERVICES PROVIDED. VITABOT OPERATES AN ONLINE, COMPUTERIZED INTERACTIVE INFORMATION, COMMUNICATION AND TRANSACTION SYSTEM (THE "SYSTEM") WHICH PROVIDES ACCESS TO A VARIETY OF NUTRITIONAL INFORMATION. VITABOT WILL PROVIDE TO CUSTOMER THE SERVICES (THE "SERVICES"). THE TERM "CUSTOMER" SHALL, WHEN THE CONTEXT PERMITS, INCLUDE CUSTOMER\'S OFFICERS, EMPLOYEES, AGENTS AND CONTRACTORS.<br><br>3. DISCLAIMER OF WARRANTY. CUSTOMER EXPRESSLY AGREES THAT USE OF THE SERVICES AND THE SYSTEM AND THE MATERIAL THEREIN AND STORAGE OF INFORMATION WHICH APPEARS IN THE SYSTEM IS AT CUSTOMER\'S SOLE RISK. THE SERVICES AND THE SYSTEM ARE PROVIDED ON AN "AS IS" AND "AS AVAILABLE" BASIS WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO WARRANTIES OF TITLE OR NONINFRINGEMENT OR IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE OR USE OTHER THAN THOSE WARRANTIES WHICH ARE IMPLIED BY AND INCAPABLE OF EXCLUSION, RESTRICTION OR MODIFICATION UNDER THE LAWS APPLICABLE TO THIS AGREEMENT. NO ADVICE OR INFORMATION GIVEN BY VITABOT, ITS CONTRACTORS, AGENTS, AFFILIATES OR VENDORS OR THEIR RESPECTIVE EMPLOYEES SHALL CREATE A WARRANTY.<br><br>4. INDEMNITY. CUSTOMER AGREES TO DEFEND, INDEMNIFY AND HOLD VITABOT, ITS AFFILIATES, CONTRACTORS, AGENTS, VENDORS AND THEIR RESPECTIVE EMPLOYEES HARMLESS FROM ANY AND ALL LIABILITIES, COSTS AND EXPENSES, INCLUDING REASONABLE ATTORNEYS\' FEES, RELATED TO OR ARISING FROM: (A) ANY VIOLATION OF THIS AGREEMENT BY CUSTOMER, (B) THE USE OF THE SYSTEM OR THE INTERNET OR THE PLACEMENT OR TRANSMISSION OF ANY MESSAGE, INFORMATION OR OTHER MATERIALS ON THE SYSTEM OR THE INTERNET BY CUSTOMER, (C) ACT
1016S OR OMISSIONS OF CUSTOMER IN CONNECTION WITH THE CONSTRUCTION, INSTALLATION, MAINTENANCE, PRESENCE, USE OR REMOVAL OF SYSTEMS, CHANNELS, OR TERMINAL EQUIPMENT OR SOFTWARE NOT PROVIDED BY VITABOT WHICH ARE CONNECTED OR ARE TO BE CONNECTED TO THE SYSTEM; AND (D) CLAIMS FOR INFRINGEMENT OF PATENTS ARISING FROM THE USE OF EQUIPMENT AND SOFTWARE, APPARATUS AND SYSTEMS NOT PROVIDED BY VITABOT IN CONNECTION WITH THE SERVICES AND THE SYSTEM.<br><br>5. RIGHT TO RESTRICT ACCESS. VITABOT MAY DENY CUSTOMER ACCESS TO ALL OR PART OF THE SYSTEM WITHOUT NOTICE IF CUSTOMER ENGAGES IN ANY CONDUCT OR ACTIVITIES THAT VITABOT IN ITS SOLE DISCRETION BELIEVES VIOLATES ANY OF THE TERMS AND CONDITIONS IN THIS AGREEMENT. IF VITABOT DENIES CUSTOMER ACCESS TO THE SYSTEM BECAUSE OF SUCH A VIOLATION, THE CUSTOMER SHALL HAVE NO RIGHT (1) TO ACCESS THROUGH VITABOT ANY MATERIALS STORED ON THE SYSTEM, (2) TO OBTAIN ANY CREDIT(S) OTHERWISE DUE TO CUSTOMER, AND SUCH CREDIT(S) WILL BE FORFEITED, (3) TO ACCESS THIRD PARTY SERVICES, MERCHANDISE OR INFORMATION ON THE SYSTEM THROUGH VITABOT, AND VITABOT SHALL HAVE NO OBLIGATION TO NOTIFY ANY THIRD-PARTY PROVIDERS OF SERVICES, MERCHANDISE OR INFORMATION NOR ANY RESPONSIBILITY FOR ANY CONSEQUENCES RESULTING FROM LACK OF NOTIFICATION OR RESTRICTION OF CUSTOMER\'S ACCESS.<br><br>6. SECURITY. ACCESS TO THE SYSTEM, AND TO CERTAIN ONLINE TRANSACTIONS INVOLVES THE USE OF IDENTIFICATION NUMBERS, PASSWORDS, CHARGE OR DEBIT ACCOUNTS OR OTHER INDIVIDUALIZED NONPUBLIC INFORMATION ("PRIVATE DOCUMENTATION"). CUSTOMER SHALL USE ITS BEST EFFORTS TO PREVENT UNAUTHORIZED USE OF THE SYSTEM OR OF ANY PRIVATE DOCUMENTATION, AND SHALL PROMPTLY REPORT TO VITABOT ANY SUSPECTED UNAUTHORIZED USE OR OTHER BREACH OF SECURITY. CUSTOMER SHALL BE RESPONSIBLE FOR ANY UNAUTHORIZED USE OF ITS IDENTIFICATION NUMBERS OR PASSWORDS UNTIL VITABOT RECEIVES WRITTEN NOTICE OF A BREACH OF SECURITY AND A REQUEST TO BLOCK FURTHER ACCESS FOR SUCH NUMBERS AND PASSWORDS. VITABOT SHALL NOT BE LIABLE FOR ANY UNAUTHORIZED USE OF CHARGE, DEBIT OR OTHER CREDIT ACCOUNTS.<br><br>7. TERM AND TERMINATION. THIS AGREEMENT SHALL BE AUTOMATICALLY RENEWED FOR SUCCESSIVE ONE-MONTH PERIODS, UNTIL CANCELED BY CUSTOMER. VITABOT SHALL HAVE THE RIGHT TO TERMINATE THIS AGREEMENT IMMEDIATELY IN THE EVENT OF A BREACH OF ANY OF ITS TERMS BY CUSTOMER OR WITHOUT CAUSE.<br><br>8. ENTIRE AGREEMENT; GUIDELINES. ALL PRIOR OR CONTEMPORANEOUS AGREEMENTS, CONTRACTS, PROMISES, REPRESENTATIONS, IF ANY, BETWEEN THE PARTIES OR THEIR REPRESENTATIVES RELATED TO THE SUBJECT MATTER OF THIS AGREEMENT ARE MERGED INTO THIS AGREEMENT AND THE APPLICATION FORM(S). THESE TERMS AND CONDITIONS, ALONG WITH ANY OPERATING RULES OR GUIDELINES PUBLISHED OVER THE SYSTEM BY VITABOT, CONSTITUTE THE ENTIRE AGREEMENT BETWEEN VITABOT AND CUSTOMER WITH RESPECT TO THE SERVICES. NO AMENDMENT TO THIS AGREEMENT SHALL BE EFFECTIVE UNLESS ACKNOWLEDGED IN WRITING BY VITABOT. CUSTOMER AGREES TO COMPLY WITH VITABOT\'S OPERATING RULES AND GUIDELINES, WHICH MAY BE AMENDED FROM TIME TO TIME AT VITABOT\'S SOLE DISCRETION.<br><br>9. GOVERNING LAW; JURISDICTION AND VENUE. THIS AGREEMENT SHALL BE GOVERNED BY, AND CONSTRUED IN ACCORDANCE WITH, THE LAWS OF THE STATE OF MARYLAND, EXCLUSIVE OF CHOICE OF LAW RULES. VENUE FOR ANY ACTION ARISING OUT OF OR IN MARYLAND WITH THIS AGREEMENT SHALL BE IN PRINCE GEORGE\'S COUNTY, MARYLAND. THE PARTIES EACH HEREBY CONSENT TO THE JURISDICTION AND VENUE IN PRINCE GEORGE\'S COUNTY AND WAIVE ANY OBJECTIONS TO SUCH JURISDICTION AND VENUE.<br><br>10. ENFORCEABILITY. IF ANY PORTION OF THIS AGREEMENT IS WHOLLY OR PARTIALLY UNENFORCEABLE, FOR ANY REASON, SUCH UNENFORCEABILITY SHALL NOT AFFECT THE BALANCE HEREOF.<br><br>11. ASSIGNMENT. CUSTOMER MAY NOT ASSIGN ITS RIGHTS OR OBLIGATIONS UNDER THIS AGREEMENT WITHOUT THE PRIOR WRITTEN CONSENT OF VITABOT, WHICH MAY BE WITHHELD IN VITABOT\'S SOLE DISCRETION.<br><br>12. NO WAIVER. VITABOT\'S FAILURE TO INSIST UPON OR ENFORCE ANY PROVISION OF THIS AGREEMENT SHALL NOT BE CONSTRUED AS A WAIVER OF ANY PROVISION OR RIGHT.<br><br>13. WRITTEN AGREEMENT. THIS AGREEMENT (AND ANY AMENDMENTS HERETO) REPRESENTS A BINDING WRITTEN CONTRACT, WHETHER EXECUTED BY EACH PARTY ON PAPER OR ACCEPTED BY ELECTRONIC COMMUNICATION.');; 1017 1018 var footer = OS.dom.add_element('div', conf, { 1019 backgroundColor: 'rgb(250,250,250)', 1020 textAlign: 'right', 1021 padding: '10px', 1022 borderTop: '1px solid rgb(230,230,230)' 1023 }); 1024 1025 var conf_button = OS.dom.add_element('div', footer, {}, {className: 'btn btn-success btn-large'}).txt('I agree'); 1026 //OS.event.stop_observing(layout.login_nav, 'click'); 1027 */ 1028 OS.event.observe(a_table2.td[1][1], 'click', function(e) {
1029 OS.event.stop_observing(a_table2.td[1][1], 'click'); 1030 a_table2.td[1][1].innerHTML = ''; 1031 var spinner = OS.dom.add_element('img', a_table2.td[1][1], {}, {src: '/images/w_nav/busyspin.gif'}); 1032 // if the user chooses to "Create New Account" instead of logging in through facebook 1033 var a_data = { 1034 a: 'ajax_create_os_user', 1035 email_key: email_key, 1036 invite_key: invite_key, 1037 email: inputs.s_email.input.value, 1038 uname: inputs.s_username.input.value, 1039 pword: inputs.s_password1.input.value, 1040 full_name: inputs.s_first.input.value + ' ' + inputs.s_last.input.value, 1041 first_name: inputs.s_first.input.value, 1042 last_name: inputs.s_last.input.value, 1043 pg_id: pg_id 1044 }; 1045 1046 if(typeof act_data !== 'undefined') { 1047 delete a_data.email_key; 1048 delete a_data.invite_key; 1049 a_data.act_code = act_data.act_code, 1050 a_data.staff_name = act_data.staff_name 1051 } 1052 1053 TxAjax('/members/os_login.php?nc='+nc(), a_data, { 1054 fn: function(dat) { 1055 //conf_button.txt('Success!'); 1056 /* 1057 if(ie_lt(11)) { 1058 ref = '%2Fmembers%2Fmobile_redirect_to_vitabot.php'; 1059 hash = ''; 1060 } 1061 1062 ref = ref.replace("email_key%3D", "foo1%3D"); // on login, these were sometimes causing problems because it thaught the invitation was the destination ("=" is %3d) 1063 ref = ref.replace("invite_key%3D", "foo2%3D"); 1064 ref = ref.replace("username%3D", "foo3%3D"); 1065 1066 if (dat.message == 'OK') window.location = '/members/login/?username='+inputs.s_username.input.value+'&password='+inputs.s_password1.input.value+'&referer='+ref+urlencode(hash); 1067 */ 1068 1069 if (dat.message == 'OK') login_redirect(inputs.s_username.input.value, inputs.s_password1.input.value); 1070 else alert(dat.message); 1071 } 1072 }); 1073 }); 1074 1075 } 1076 }); 1077 } 1078 }; 1079 1080 var forgot_submit = function(inputs) { 1081 debugger; 1082 var errors = []; 1083 1084 inputs.f_email.clear_err(); 1085 inputs.f_username.clear_err(); 1086 1087 if (inputs.f_email.input.value == '' && inputs.f_username.input.value == '') { 1088 errors.push({ig: inputs.f_email, val: 'Please fill in one of the text fields below.'}); 1089 } 1090 //if(email_dat.count >= 1) errors.push({ig: inputs.s_email, val: 'E-Mail already in use.'}); 1091 1092 if (inputs.f_email.input.value !== '' && inputs.f_username.input.value == '' && validateEmail(inputs.f_email.input.value) === false) { 1093 errors.push({ig: inputs.f_email, val: 'The email you entered wasn\'t valid.'}); 1094 } 1095 1096 if(errors.length > 0) { 1097 set_errors(errors); 1098 } else { 1099 var ajax_obj = { 1100 a: 'ajax_send_reset_pw', 1101 invite_key: invite_key, 1102 pg_id: global_dat.pg_id, 1103 url: window.location.href, 1104 tx_fb_id: tx_fb_id, 1105 f_type: 'application', 1106 f_id: 52, 1107 vb_redirect: vb_redirect 1108 }; 1109 1110 if(inputs.f_email.input.value !== '') { 1111 ajax_obj.email = inputs.f_email.input.value; 1112 } else { 1113 ajax_obj.username = inputs.f_username.input.value; 1114 } 1115 OS.ajax.tx('/members/os_login.php?nc='+nc(), ajax_obj, { 1116 fn: function(dat) { 1117 if (is_set(dat) && dat != null) { 1118 1119 if(dat.count>1) errors.push({ig: inputs.f_email, val: 'There is more than one account associated with that address. Contact customer service to recover your password.'}); 1120 else if(dat.count != 1) errors.push({ig: inputs.f_email, val: 'We couldn\'t find your account with that information.'}); 1121 1122 if(errors.length > 0) { 1123 set_errors(errors); 1124 } else { 1125 OS.dom.delete_children(layout.form); 1126 var success_alert = OS.dom.add_element('div', layout.form, {marginBottom: '6px'}, {className: 'alert alert-success'}).txt('<strong> A link to reset your password has been sent to your email address. </strong>'); 1127 var bo = OS.dom.add_element('div', layout.form, {marginBottom: '0px'}, {className: 'control-group'}); 1128 var bi = OS.dom.add_element('div', bo, {}, {className: 'controls'}); 1129 OS.event.observe(OS.dom.add_element('div', bi, gb_style, {className: 'btn btn'}).txt('Close'), 'click', function() {login_fn();}); 1130 } 1131 1132 } 1133 } 1134 }); 1135 } 1136 }; 1137 1138 var reset_submit = function(inputs) { 1139 debugger; 1140 /* 1141 inputs.r_password0.group.className = 'control-group'; 1142 inputs.r_password0.error.txt(''); 1143 1144 inputs.r_password1.group.className = 'control-group'; 1145 inputs.r_password1.error.txt(''); 1146 */ 1147 inputs.r_password0.clear_err(); 1148 inputs.r_password1.clear_err(); 1149 var errors = []; 1150 // -- Password 1151 /* 1152 if(inputs.r_password0.input.value === '') { 1153 errors.push({ 1154 elem: inputs.r_password0.input, 1155 val: 'Please enter a password' 1156 }); 1157 } else if(inputs.r_password0.input.value.length < 6) { 1158 errors.push({ 1159 elem: inputs.r_password0.input, 1160 val: 'Password too short. It must be between 6 and 15 characters.' 1161 }); 1162 } else if(inputs.r_password0.input.value.length > 15) { 1163 errors.push({ 1164 elem: inputs.r_password0.input, 1165 val: 'Password too long. It must be between 6 and 15 characters.' 1166 }); 1167 } else if(inputs.r_password0.input.value !== inputs.r_password1.input.value) { 1168 errors.push({ 1169 elem: inputs.r_password1.input, 1170 val: 'Passwords don\'t match' 1171 }); 1172 } 1173 */ 1174 1175 1176 if(inputs.r_password0.input.value === '') errors.push({ig: inputs.r_password0, val: 'Please enter a password'}); 1177 else if(inputs.r_password0.input.value.length < 6) errors.push({ig: inputs.r_password0, val: 'Password too short. <br>It must contain at least 6 characters.'}); 1178 else if(inputs.r_password0.input.value.length > 40) errors.push({ig: inputs.r_password0, val: 'Password too long.'}); 1179 else if(inputs.r_password0.input.value !== inputs.r_password1.input.value) errors.push({ig: inputs.r_password1, val: 'Passwords don\'t match'}); 1180 1181 1182 /*else if(inputs.r_password0.input.value === '') errors.push({ig: inputs.r_password1, val: 'Passwords don\'t match'}); 1183 else if(inputs.r_password0.input.value.length < 6) errors.push({ig: inputs.r_password1, val: 'Passwords don\'t match'}); 1184 else if(inputs.r_password0.input.value.length > 15) errors.push({ig: inputs.r_password1, val: 'Passwords don\'t match'}); 1185 else if(inputs.r_password0.input.value !== inputs.r_password1.input.value) errors.push({ig: inputs.r_password1, val: 'Passwords don\'t match'});*/ 1186 /*if(errors.length > 0) { 1187 // Throw errors 1188 for(var i = 0, len = errors.length; i < len; ++i) { 1189 console.log('ERROR!!!'); 1190 } 1191 } else {*/ 1192 1193 1194 1195 if(errors.length > 0) { 1196 set_errors(errors); 1197 } else { 1198 TxAjax('os_login.php?nc='+nc(), {a: 'ajax_reset_pw', password: inputs.r_password0.input.value, 1199 id: query_obj.id, pw_key: query_obj.pw_key, email: email_key}, { 1200 fn: function(dat) { 1201 debugger; 1202 if(is_set(dat) && dat != null && dat.count > 0) { 1203 // logs you right in 1204 //OS.util.post('/members/login/?referer='+ref+urlencode(hash), { 1205 1206 if(ie_lt(11)) { 1207 login_redirect(global_dat.username, inputs.r_password0.input.value); 1208 } else { 1209 OS.util.post('/members/login/?referer='+urlencode('/members/os.php#f_type=application&f_id=52'), { 1210 username: global_dat.username, 1211 password: inputs.r_password0.input.value, 1212 email_key: email_key, 1213 invite_key: invite_key, 1214 tx_fb_id: tx_fb_id, 1215 f_type: 'application', 1216 f_id: 52, 1217 vb_redirect: 1 1218 }); 1219 } 1220 } else { 1221 errors.push({ig: inputs.r_password0, val: 'Your password reset link has expired.'}); 1222 set_errors(errors); 1223 } 1224 } 1225 }); 1226 } 1227 }; 1228 1229 var fb_no_user_submit = function(inputs) { 1230 //debugger; 1231 var errors = []; 1232 inputs.fb_no_user_username.group.className = 'control-group'; 1233 //inputs.l_username.error.txt(''); 1234 1235 inputs.fb_no_user_password.group.className = 'control-group'; 1236 //inputs.l_password.error.txt(''); 1237 1238 if (inputs.fb_no_user_username.input.value == '') { 1239 errors.push({ 1240 elem: inputs.fb_no_user_username.input, 1241 val: 'Please enter a username' 1242 }); 1243 } 1244 1245 if (inputs.fb_no_user_password.input.value === '') { 1246 errors.push({ 1247 elem: inputs.fb_no_user_password.input, 1248 val: 'Please enter a password' 1249 }); 1250 } 1251 1252 if(errors.length > 0) { 1253 // Throw errors 1254 for(var i = 0, len = errors.length; i < len; ++i) { 1255 errors[i].elem.parentNode.className = 'control-group error'; 1256 errors[i].elem.parentNode.firstChild.firstChild.txt(errors[i].val); 1257 } 1258 } else { 1259 var request_array = [ 1260 { url: '/members/os_login.php', data: {a: 'ajax_fb_connect', uname: inputs.fb_no_user_username.input.value, pword: inputs.fb_no_user_password.input.value}} 1261 ]; 1262 var request_obj = multi_tx(request_array); 1263 1264 OS.event.observe(request_obj, 'complete', function(e) { 1265 if(e['ajax_fb_connect'].message === 'OK') { 1266 var hash = OS.cookie.read('VB_LOGIN_HASH'); 1267 OS.cookie.erase('VB_LOGIN_HASH'); 1268 OS.cookie.erase('VB_LOGIN_QUERY'); 1269 debugger; 1270 window.location = '/members/os.php'+((hash !== '' && hash !== null) ? hash : window.location.hash); 1271 } else { 1272 alert(e['ajax_fb_connect'].message); 1273 } 1274 }); 1275 } 1276 }; 1277 1278 1279 var login_redirect = function(u_str, p_str){ 1280 1281 if(ie_lt(11)) { 1282 ref = '%2Fmembers%2Fmobile_redirect_to_vitabot.php'; 1283 hash = ''; 1284 } 1285 1286 ref = ref.replace("email_key%3D", "foo1%3D"); // on login, these were sometimes causing problems because it thaught the invitation was the destination ("=" is %3d) 1287 ref = ref.replace("invite_key%3D", "foo2%3D"); 1288 ref = ref.replace("pw_key%3D", "foo3%3D"); 1289 ref = ref.replace("username%3D", "foo4%3D"); 1290 1291 /* 1292 if (dat.message == 'OK') window.location = '/members/login/?username='+inputs.s_username.input.value+'&password='+inputs.s_password1.input.value+'&referer='+ref+urlencode(hash); 1293 else alert(dat.message); 1294 */ 1295 1296 OS.util.post('/members/login/?referer='+ref+urlencode(hash), { 1297 username: u_str, 1298 password: p_str, 1299 email_key: email_key, 1300 invite_key: invite_key, 1301 tx_fb_id: tx_fb_id,
1302 f_type: f_type, 1303 f_id: f_id, 1304 vb_redirect: vb_redirect 1305 }); 1306 } 1307 1308 var pg_id = false; 1309 var rs_id = false; 1310 var exp_msg = false; 1311 var ab = false; 1312 1313 var signup_fn; 1314 var login_fn; 1315 var login_url; 1316 //debugger; 1317 console.log(global_dat); 1318 1319 var query_obj = get_query_obj(); 1320 if(typeof query_obj.pg_id !== 'undefined') pg_id = query_obj.pg_id; 1321 1322 // Declare Variables 1323 var hash_obj = get_hash_obj(); // Get hash values 1324 if(typeof hash_obj.pg_id !== 'undefined') pg_id = hash_obj.pg_id; 1325 if(typeof hash_obj.invite_key !== 'undefined') invite_key = hash_obj.invite_key; 1326 if(typeof hash_obj.email_key !== 'undefined') email_key = decodeURIComponent(hash_obj.email_key); 1327 1328 is_invite = !(invite_key == '' && email_key == ''), 1329 user_exists = is_invite === true && global_dat.count >= 1, 1330 error_code = false, error_text = '', pg_login = typeof pg_id === 'undefined' ? false : true; 1331 force_login = typeof hash_obj.login !== 'undefined' ? hash_obj.login : false, 1332 facebook_elements = []; 1333 1334 if(typeof hash_obj.login_error !== 'undefined') { 1335 error_code = parseInt(hash_obj.login_error); 1336 } else if(typeof query_obj.login_error !== 'undefined') { 1337 error_code = parseInt(query_obj.login_error); 1338 } 1339 1340 var resp_func = function(dat) { 1341 1342 //debugger; 1343 //console.log(dat); 1344 if(typeof dat !== 'object'){ 1345 dat = {}; 1346 if((typeof global_dat === 'object') && (typeof global_dat.pg_id !== 'undefined') && (global_dat.pg_id > 0)){ 1347 dat.logo_url = 'https://secure.rocketos.com/microwavescorp/nutrition/pg/logo/m'+global_dat.pg_id+'.gif'; 1348 } else { 1349 dat.logo_url = 'https://secure.rocketos.com/microwavescorp/nutrition/pg/logo/m3345.gif'; 1350 } 1351 } 1352 1353 if(typeof dat === 'object' && typeof dat.login_url === 'string' && !force_login){ 1354 window.location.replace(dat.login_url); 1355 return; 1356 } 1357 1358 main_table.style.display = ''; 1359 1360 if(typeof dat !== 'undefined') { 1361 if(dat.pg_id>0) pg_id = dat.pg_id; 1362 if(dat.rs_id>0) rs_id = dat.rs_id; 1363 if(typeof dat.exp_msg === 'string' && dat.exp_msg !== '') exp_msg = dat.exp_msg; 1364 } 1365 1366 var logo_str; 1367 if(typeof dat.logo_url === 'string' && dat.logo_url != '') logo_str = dat.logo_url; else logo_str = 'https://secure.rocketos.com/microwavescorp/nutrition/pg/logo/m3345.gif'; 1368 var org_logo = OS.dom.add_element('img', title_div, {maxWidth:'400px', maxHeight:'225px', margin:'15px 15px'}, {src:logo_str}); 1369 1370 /* 1371 if(pg_id>0) var org_logo = OS.dom.add_element('img', title_div, {margin: '15px 15px'}, {src: 'https://secure.rocketos.com/microwavescorp/nutrition/pg/logo/m' + pg_id + '.gif'}); 1372 else if(rs_id>0) var org_logo = OS.dom.add_element('img', title_div, {margin: '15px 15px'}, {src: 'https://secure.rocketos.com/microwavescorp/nutrition/resellers/logo/m' + rs_id + '.gif'}); 1373 else var org_logo = OS.dom.add_element('img', title_div, {margin: '15px 15px'}, {src: 'https://secure.rocketos.com/microwavescorp/nutrition/pg/logo/m3345.gif'}); 1374 */ 1375 1376 1377 1378 OS.no_fb = typeof OS.no_fb !== 'undefined' ? OS.no_fb : false; 1379 if(pg_id === false) OS.no_fb = true; 1380 OS.no_fb = true; // temporary force no facebook. remove when adding facebook back in 1381 1382 if(OS.no_fb === false) { 1383 for(var i = 0, len = facebook_elements.length; i < len; ++i) { 1384 facebook_elements[i].style.display = ''; 1385 } 1386 } 1387 // Tag line, perhaps this should be customizable by the organization as well 1388 // var tag = OS.dom.add_element('h4', title_div, {}).txt('Online Meal Planning'); 1389 1390 var page = 'login'; 1391 1392 login_fn = draw.login; 1393 1394 if(!is_invite || user_exists) { 1395 signup_fn = draw.signup_ac; 1396 } else { 1397 signup_fn = draw.signup_em; 1398 } 1399 1400 1401 var startup_fn = login_fn; 1402 if(hash_obj.page == 'reset_pw') startup_fn = draw.reset_pw; 1403 if(hash_obj.page == 'payment_info') startup_fn = draw.payment_info; 1404 1405 1406 if(is_invite && !user_exists) startup_fn = signup_fn; 1407 1408 /* 1409 if(typeof hash_obj.page !== 'undefined') { 1410 debugger; 1411 switch(hash_obj.page) { 1412 case 'reset_pw': 1413 draw.reset_pw(); 1414 break; 1415 default: 1416 1417 break; 1418 } 1419 } else { 1420 if(OS.fb_connect_no_user === true) { 1421 draw.fb_no_user(); 1422 } else { 1423 global_login = draw.login(); 1424 } 1425 } 1426 */ 1427 1428 startup_fn(); 1429 1430 /* 1431 if(pg_id >0 && (force_login == 1 && (user_exists || error_code !== false)) || typeof hash_obj.ab !== 'undefined') { 1432 draw.login(); 1433 } else if(pg_id >0) { 1434 draw.signup_ac(); 1435 } else { 1436 draw.login(); 1437 }*/ 1438 }; 1439 1440 if(typeof hash_obj.ab !== 'undefined') { 1441 OS.ajax.tx('/members/os_login.php?nc='+nc(), { 1442 a: 'ajax_ab_pg_id', 1443 ab: hash_obj.ab 1444 }, { 1445 fn: resp_func 1446 }); 1447 } else { 1448 setTimeout(function(){resp_func();}, 0); 1449 } 1450 1451})(); 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.