You are an abcteach Member, but you are logged in to the Free Site. To access all member features, log into the Member Site.

Healthy Gardeners

FILTER THIS CATEGORY:   What's This?
= Preview Document = Member Site Document = Pin to Pinterest


$(document).ready(function() { $('.form-search').submit(function() { $('#headerSearchButton').button('loading'); }); $('#searchQuery').focusin(function() { $(this).val(''); $(this).css('color', '#000'); }); //var randNum = Math.ceil(Math.random() * 10); //$("#sgk_adimage").attr("src",'http://static.abcteach.com/globals/images/ads/search-ad_'+ randNum + '.jpg'); }); function getCookie(cname) { // {{{ var name = cname + "="; var ca = document.cookie.split(';'); for(var i=0; i 29) { $('#sgk_login-toptitle').html('Hello!'); } else { $('#sgk_login-toptitle').html('Hello, ' + firstName + '!'); } } else { $('#sgk_login-toptitle').html('Hello!'); } } //}}} // setup and click events {{{ var checkLabel = '✔'; var xLabel = '✘'; var displayDoc = false; var abcl = $.cookie("abc_login"); var abcs = $.cookie("abc_session"); var abcfn = $.cookie("abc_first_name"); var abcmem = $.cookie("abc_member"); if (abcfn) { abcUpdateName(abcfn); } if (abcl == 1 || abcs) { hideLogInButtons(); } else { showLogInButtons(); } $('.sgk_freesite-login').click(function() { if ($(this).hasClass('sgk_freesite-logout')) { abcLogOut(); } else { clearLoginForm(); $('#logInPanel').modal('toggle'); } }); $('.sgk_freesite-logout').click(function() { abcLogOut(); }); $('.sgk_membsite-upgrade').click(function() { location.href = '/cmd/populate_renewal.php'; }); $('.sgk_freesite-upgrade').click(function() { location.href = '/cmd/populate_renewal.php'; }); $('.sgk_membsite-login').click(function() { event.preventDefault(); if ($(this).hasClass('sgk_membsite-upgrade') || $(this).hasClass('sgk_freesite-upgrade') || $(this).hasClass('sgk_membsite-renew')) { location.href = 'https://secure.abcteach.com/purchaser.php?t'; } else { location.href = 'http://members.abcteach.com/'; } }); $('.sgk_membsite-renew').click(function() { location.href = '/cmd/populate_renewal.php'; }); $('.dismissModal').click(function() { $('#logInPanel').modal('toggle'); }); $('#viewSignupPanel').click(function() { clearSignUpForm(); $('#signUpPanel').modal('toggle'); }); $('.dismissSignupModal').click(function() { $('#signUpPanel').modal('toggle'); }); $('#goToSignup').click(function() { $('#logInPanel').modal('toggle'); $('#signUpPanel').modal('toggle'); clearSignUpForm(); }); $('.goToSignup2').click(function() { $('#viewDocPanel').modal('toggle'); $('#signUpPanel').modal('toggle'); clearSignUpForm(); }); $('#goToSignup3').click(function() { $('#viewDocPanel').modal('toggle'); $('#signUpPanel').modal('toggle'); clearSignUpForm(); }); $('#goToLogin').click(function() { clearLoginForm(); $('#logInPanel').modal('toggle'); $('#signUpPanel').modal('toggle'); }); $('#signInButton').click(function() { $('#signUpPanelForm').submit(); }); $('#learnMoreButton').click(function() { location.href = '/membership.php'; }); $('#signUpFreeButton').click(function() { $('#viewDocPanel').modal('toggle'); $('#signUpPanel').modal('toggle'); clearSignUpForm(); }); $('#signInPanelButton').click(function() { location.href = '/membership.php'; }); $('#signInPanelButton2').click(function() { location.href = '/membership.php'; }); $('#signInPanelButtonFree').click(function() { location.href = '/membership.php'; }); $('#signInPanelButton3').click(function() { $('#viewMemDocPanel').modal('toggle'); $('#signUpPanel').modal('toggle'); clearSignUpForm(); }); $('#signInPanelButton1').click(function() { var href = $('#downloadButton').data('href'); location.href = 'http://members.abcteach.com' + href ; }); //}}} $('#logInPanelForm').submit(function() { // {{{ var rv = false; var email = $('#inputEmail').val(); if (!email) { $('#inputEmail').closest('.form-group').removeClass('has-success').addClass('has-error'); $('#msgContainer').text('Please enter your email address.'); $('#msgContainer').removeClass('hidden'); return false; } else { $('#inputEmail').closest('.form-group').addClass('has-success'); }; var password = $('#inputPassword').val(); if (!password) { $('#inputPassword').closest('.form-group').removeClass('has-success').addClass('has-error'); $('#msgContainer').text('Please enter your password.'); $('#msgContainer').removeClass('hidden'); return false; } else { $('#inputPassword').closest('.form-group').addClass('has-success'); }; $('#logInButton').button('loading'); var posting = $.post('/cmd/login.php?', $(this).serialize(), 'json'); posting.done(function(data) { var d = $.parseJSON(data); if (d['result'] == 'failure') { $('#msgContainer').text(d['message']); $('#msgContainer').removeClass('hidden'); $('#logInButton').button('reset'); } else { $.cookie("abc_member", d['member'], { path: '/' }); abcUpdateName(d['first_name']); $.cookie("abc_first_name", d['first_name'], { path: '/' }); $.cookie("abc_teacher_type", d['teacher_type'], { path: '/' }); hideLogInButtons(); $('#logInSuccess').removeClass('hidden'); $('#logInSuccess').show(); $.cookie("abc_login", 1, { path: '/' }); $('#logInPanel').modal('toggle'); $('#logInButton').button('reset'); var abcmem = $.cookie("abc_member"); var memDoc = $('#downloadButton').data('memberdoc'); if (displayDoc) { var href = $('#downloadButton').data('href'); if (href) { if (memDoc && abcmem) { window.open(href, '_blank'); } else if (memDoc) { $('#viewMemDocPanelFree').modal('toggle'); } else { window.open(href, '_blank'); } }; }; setTimeout(function(){ $("#logInSuccess").hide(); }, 1200); if (abcmem == '1') { var container = $( "#sgk_member-free-notice" ); if (container.is( ":visible" )){ //container.slideUp( 800 ); } else { container.slideDown( 800 ); } } } }); return false; }); //}}} $('#logInPanelForm2').submit(function() { // {{{ //event.preventDefault(); var rv = false; var email = $('#inputEmail2').val(); if (!email) { $('#inputEmail2').closest('.form-group').removeClass('has-success').addClass('has-error'); $('#msgContainer2').text('Please enter your email address.'); $('#msgContainer2').removeClass('hidden'); return false; } else { $('#inputEmail2').closest('.form-group').addClass('has-success'); }; var password = $('#inputPassword2').val(); if (!password) { $('#inputPassword2').closest('.form-group').removeClass('has-success').addClass('has-error'); $('#msgContainer2').text('Please enter your password.'); $('#msgContainer2').removeClass('hidden'); return false; } else { $('#inputPassword2').closest('.form-group').addClass('has-success'); }; $('#logInButton2').button('loading'); var posting = $.post('/cmd/login.php?', $(this).serialize(), 'json'); posting.done(function(data) { var d = $.parseJSON(data); if (d['result'] == 'failure') { $('#msgContainer2').text(d['message']); $('#msgContainer2').removeClass('hidden'); $('#logInButton2').button('reset'); return false; } else { // a lot of this can now go away because we are redirecting hideLogInButtons(); abcUpdateName(d['first_name']); $.cookie("abc_first_name", d['first_name'], { path: '/' }); $.cookie("abc_teacher_type", d['teacher_type'], { path: '/' }); $('#logInSuccess').removeClass('hidden'); $('#logInSuccess').show(); $.cookie("abc_login", 1, { path: '/' }); $('#viewDocPanel').modal('toggle'); $('#logInButton2').button('reset'); var abcmem = $.cookie("abc_member"); var memDoc = $('#downloadButton').data('memberdoc'); if (displayDoc) { var href = $('#downloadButton').data('href'); if (href) { if (memDoc && abcmem) { window.open(href, '_blank'); } else if (memDoc) { $('#viewMemDocPanelFree').modal('toggle'); } else { window.open(href, '_blank'); } }; }; setTimeout(function(){ $("#logInSuccess").hide(); }, 1200); var container = $( "#sgk_member-free-notice" ); if (container.is( ":visible" )){ //container.slideUp( 800 ); } else { container.slideDown( 800 ); } } }); return false; }); //}}} // change events {{{ $('#inputSUFirstName').change(function() { var fn = $('#inputSUFirstName').val(); if (!fn) { $('#inputSUFirstNameLabel').html(xLabel); $('#inputSUFirstNameLabel').removeClass('abcCheckMark').addClass('abcXMark'); $('#inputSUFirstName').closest('.form-group').removeClass('has-success').addClass('has-error'); $('#msgSignUpContainer').text('Please enter your first Name.'); $('#msgSignUpContainer').removeClass('hidden'); } else { $('#inputSUFirstNameLabel').removeClass('abcXMark').addClass('abcCheckMark'); $('#inputSUFirstName').closest('.form-group').removeClass('has-error').addClass('has-success'); $('#inputSUFirstNameLabel').html(checkLabel); $('#msgSignUpContainer').addClass('hidden'); }; }); $('#inputSUEmail').change(function() { var email = $('#inputSUEmail').val(); if (!email) { $('#inputSUEmailLabel').html(xLabel); $('#inputSUEmailLabel').removeClass('abcCheckMark').addClass('abcXMark'); $('#inputSUEmail').closest('.form-group').removeClass('has-success').addClass('has-error'); $('#msgSignUpContainer').text('Please enter your email address.'); $('#msgSignUpContainer').removeClass('hidden'); return false; } else if(!validateEmail(email)) { $('#inputSUEmailLabel').html(xLabel); $('#inputSUEmailLabel').removeClass('abcCheckMark').addClass('abcXMark'); $('#inputSUEmail').closest('.form-group').removeClass('has-success').addClass('has-error'); $('#msgSignUpContainer').text('Your email address is not valid.'); $('#msgSignUpContainer').removeClass('hidden'); return false; } else { $('#inputSUEmail').closest('.form-group').removeClass('has-error').addClass('has-success'); $('#inputSUEmailLabel').html(checkLabel); $('#inputSUEmailLabel').removeClass('abcXMark').addClass('abcCheckMark'); $('#msgSignUpContainer').addClass('hidden'); $('#msgSignUpContainer').text('.'); }; }); $('#inputSUConfirmEmail').change(function() { var confirmEmail = $('#inputSUConfirmEmail').val(); if (!confirmEmail) { $('#inputSUConfirmEmailLabel').html(xLabel); $('#inputSUConfirmEmailLabel').removeClass('abcCheckMark').addClass('abcXMark'); $('#inputSUConfirmEmail').closest('.form-group').removeClass('has-success').addClass('has-error'); $('#msgSignUpContainer').text('Please confirm your email address.'); $('#msgSignUpContainer').removeClass('hidden'); return false; } else { var email = $('#inputSUEmail').val(); if(!validateEmail(confirmEmail)) { $('#inputSUConfirmEmailLabel').html(xLabel); $('#inputSUConfirmEmailLabel').removeClass('abcCheckMark').addClass('abcXMark'); $('#inputSUConfirmEmail').closest('.form-group').removeClass('has-success').addClass('has-error'); $('#msgSignUpContainer').text('Your email address is not valid.'); $('#msgSignUpContainer').removeClass('hidden'); return false; } else if (email == confirmEmail) { $('#inputSUConfirmEmail').closest('.form-group').removeClass('has-success').addClass('has-success'); $('#inputSUConfirmEmailLabel').html(checkLabel); $('#inputSUConfirmEmailLabel').removeClass('abcXMark').addClass('abcCheckMark'); $('#inputSUEmail').closest('.form-group').removeClass('has-error').addClass('has-success'); $('#inputSUEmailLabel').html(checkLabel); $('#inputSUEmailLabel').removeClass('abcXMark').addClass('abcCheckMark'); $('#msgSignUpContainer').addClass('hidden'); $('#msgSignUpContainer').text('.'); } else { $('#inputSUConfirmEmailLabel').html(xLabel); $('#inputSUConfirmEmailLabel').removeClass('abcCheckMark').addClass('abcXMark'); $('#inputSUConfirmEmail').closest('.form-group').removeClass('has-success').addClass('has-error'); $('#inputSUEmailLabel').html(xLabel); $('#inputSUEmailLabel').removeClass('abcCheckMark').addClass('abcXMark'); $('#inputSUEmail').closest('.form-group').removeClass('has-success').addClass('has-error'); $('#msgSignUpContainer').text('email addresses do not match.'); $('#msgSignUpContainer').removeClass('hidden'); return false; } }; }); $('#inputSUPassword').change(function() { var password = $('#inputSUPassword').val(); if (!password) { $('#inputSUPasswordLabel').html(xLabel); $('#inputSUPasswordLabel').removeClass('abcCheckMark').addClass('abcXMark'); $('#inputSUPassword').closest('.form-group').removeClass('has-success').addClass('has-error'); if (!password) { $('#msgSignUpContainer').text('Please enter your password.'); } $('#msgSignUpContainer').removeClass('hidden'); return false; } else if(checkPassword(password)) { $('#inputSUPassword').closest('.form-group').removeClass('has-success').addClass('has-success'); $('#inputSUPasswordLabel').html(checkLabel); $('#inputSUPasswordLabel').removeClass('abcXMark').addClass('abcCheckMark'); $('#msgSignUpContainer').addClass('hidden'); } else { $('#inputSUPasswordLabel').html(xLabel); $('#inputSUPasswordLabel').removeClass('abcCheckMark').addClass('abcXMark'); $('#inputSUPassword').closest('.form-group').removeClass('has-success').addClass('has-error'); $('#msgSignUpContainer').text('Passwords must be at least 8 characters and include at least one character and one number.'); $('#msgSignUpContainer').removeClass('hidden'); }; }); $('#inputSUConfirmPassword').change(function() { var confirmPassword = $('#inputSUConfirmPassword').val(); if (!confirmPassword) { $('#inputSUConfirmPasswordLabel').html(xLabel); $('#inputSUConfirmPasswordLabel').removeClass('abcCheckMark').addClass('abcXMark'); $('#inputSUConfirmPassword').closest('.form-group').removeClass('has-success').addClass('has-error'); $('#msgSignUpContainer').text('Please confirm your password.'); $('#msgSignUpContainer').removeClass('hidden'); return false; } else if(!checkPassword(confirmPassword)) { $('#inputSUConfirmPasswordLabel').html(xLabel); $('#inputSUConfirmPasswordLabel').removeClass('abcCheckMark').addClass('abcXMark'); $('#inputSUConfirmPassword').closest('.form-group').removeClass('has-success').addClass('has-error'); $('#msgSignUpContainer').text('Passwords must be at least 8 characters and include at least one character and one number.'); $('#msgSignUpContainer').removeClass('hidden'); return false; } else { var password = $('#inputSUPassword').val(); if (password != confirmPassword) { $('#inputSUPasswordLabel').html(xLabel); $('#inputSUPasswordLabel').removeClass('abcCheckMark').addClass('abcXMark'); $('#inputSUPassword').closest('.form-group').removeClass('has-success').addClass('has-error'); $('#inputSUConfirmPasswordLabel').html(xLabel); $('#inputSUConfirmPasswordLabel').removeClass('abcCheckMark').addClass('abcXMark'); $('#inputSUConfirmPassword').closest('.form-group').removeClass('has-success').addClass('has-error'); $('#msgSignUpContainer').text('Invalid password confirmation.'); $('#msgSignUpContainer').removeClass('hidden'); return false; } $('#msgSignUpContainer').addClass('hidden'); $('#inputSUPassword').closest('.form-group').removeClass('has-error').addClass('has-success'); $('#inputSUPasswordLabel').html(checkLabel); $('#inputSUPasswordLabel').removeClass('abcXMark').addClass('abcCheckMark'); $('#inputSUConfirmPassword').closest('.form-group').removeClass('has-error').addClass('has-success'); $('#inputSUConfirmPasswordLabel').html(checkLabel); $('#inputSUConfirmPasswordLabel').removeClass('abcXMark').addClass('abcCheckMark'); }; }); // }}} $('#signUpPanelForm').submit(function() { // {{{ var fn = $('#inputSUFirstName').val(); if (!fn) { $('#inputSUFirstNameLabel').html(xLabel); $('#inputSUFirstNameLabel').removeClass('abcCheckMark').addClass('abcXMark'); $('#inputSUFirstName').closest('.form-group').removeClass('has-success').addClass('has-error'); $('#msgSignUpContainer').text('Please enter your first Name.'); $('#msgSignUpContainer').removeClass('hidden'); return false; } else { $('#inputSUFirstNameLabel').removeClass('abcXMark').addClass('abcCheckMark'); $('#inputSUFirstName').closest('.form-group').removeClass('has-error').addClass('has-success'); $('#inputSUFirstNameLabel').html(checkLabel); }; var email = $('#inputSUEmail').val(); if (!email) { $('#inputSUEmailLabel').html(xLabel); $('#inputSUEmailLabel').removeClass('abcCheckMark').addClass('abcXMark'); $('#inputSUEmail').closest('.form-group').removeClass('has-success').addClass('has-error'); $('#msgSignUpContainer').text('Please enter your email address.'); $('#msgSignUpContainer').removeClass('hidden'); return false; } else if(!validateEmail(email)) { $('#inputSUEmailLabel').html(xLabel); $('#inputSUEmailLabel').removeClass('abcCheckMark').addClass('abcXMark'); $('#inputSUEmail').closest('.form-group').removeClass('has-success').addClass('has-error'); $('#msgSignUpContainer').text('Your email address is not valid.'); $('#msgSignUpContainer').removeClass('hidden'); return false; } else { $('#inputSUEmail').closest('.form-group').removeClass('has-error').addClass('has-success'); $('#inputSUEmailLabel').html(checkLabel); $('#inputSUEmailLabel').removeClass('abcXMark').addClass('abcCheckMark'); }; var confirmEmail = $('#inputSUConfirmEmail').val(); if (!confirmEmail) { $('#inputSUConfirmEmailLabel').html(xLabel); $('#inputSUConfirmEmailLabel').removeClass('abcCheckMark').addClass('abcXMark'); $('#inputSUConfirmEmail').closest('.form-group').removeClass('has-success').addClass('has-error'); $('#msgSignUpContainer').text('Please confirm your email address.'); $('#msgSignUpContainer').removeClass('hidden'); return false; } else { $('#inputSUConfirmEmail').closest('.form-group').removeClass('has-success').addClass('has-success'); $('#inputSUConfirmEmailLabel').html(checkLabel); $('#inputSUConfirmEmailLabel').removeClass('abcXMark').addClass('abcCheckMark'); }; if (email != confirmEmail) { $('#inputSUConfirmEmailLabel').html(xLabel); $('#inputSUConfirmEmailLabel').removeClass('abcCheckMark').addClass('abcXMark'); $('#inputSUConfirmEmail').closest('.form-group').removeClass('has-success').addClass('has-error'); $('#inputSUEmailLabel').html(xLabel); $('#inputSUEmailLabel').removeClass('abcCheckMark').addClass('abcXMark'); $('#inputSUEmail').closest('.form-group').removeClass('has-success').addClass('has-error'); $('#msgSignUpContainer').text('email addresses do not match.'); $('#msgSignUpContainer').removeClass('hidden'); return false; }; var password = $('#inputSUPassword').val(); if (!password) { $('#inputSUPasswordLabel').html(xLabel); $('#inputSUPasswordLabel').removeClass('abcCheckMark').addClass('abcXMark'); $('#inputSUPassword').closest('.form-group').removeClass('has-success').addClass('has-error'); $('#msgSignUpContainer').text('Please enter your password.'); $('#msgSignUpContainer').removeClass('hidden'); return false; } else if(checkPassword(password)) { $('#inputSUPassword').closest('.form-group').removeClass('has-success').addClass('has-success'); $('#inputSUPasswordLabel').html(checkLabel); $('#inputSUPasswordLabel').removeClass('abcXMark').addClass('abcCheckMark'); $('#msgSignUpContainer').addClass('hidden'); } else { $('#inputSUPasswordLabel').html(xLabel); $('#inputSUPasswordLabel').removeClass('abcCheckMark').addClass('abcXMark'); $('#inputSUPassword').closest('.form-group').removeClass('has-success').addClass('has-error'); $('#msgSignUpContainer').text('Passwords must be at least 8 characters and include at least one character and one number.'); $('#msgSignUpContainer').removeClass('hidden'); }; var confirmPassword = $('#inputSUConfirmPassword').val(); if (!confirmPassword) { $('#inputSUConfirmPasswordLabel').html(xLabel); $('#inputSUConfirmPasswordLabel').removeClass('abcCheckMark').addClass('abcXMark'); $('#inputSUConfirmPassword').closest('.form-group').removeClass('has-success').addClass('has-error'); $('#msgSignUpContainer').text('Please confirm your password.'); $('#msgSignUpContainer').removeClass('hidden'); return false; } else if(!checkPassword(confirmPassword)) { $('#inputSUConfirmPasswordLabel').html(xLabel); $('#inputSUConfirmPasswordLabel').removeClass('abcCheckMark').addClass('abcXMark'); $('#inputSUConfirmPassword').closest('.form-group').removeClass('has-success').addClass('has-error'); $('#msgSignUpContainer').text('Passwords must be at least 8 characters and include at least one character and one number.'); $('#msgSignUpContainer').removeClass('hidden'); return false; } else { $('#inputSUConfirmPassword').closest('.form-group').addClass('has-success'); $('#inputSUConfirmPasswordLabel').html(checkLabel); $('#inputSUConfirmPasswordLabel').removeClass('abcXMark').addClass('abcCheckMark'); }; if (password != confirmPassword) { $('#inputSUPasswordLabel').html(xLabel); $('#inputSUPasswordLabel').removeClass('abcCheckMark').addClass('abcXMark'); $('#inputSUPassword').closest('.form-group').removeClass('has-success').addClass('has-error'); $('#inputSUConfirmPasswordLabel').html(xLabel); $('#inputSUConfirmPasswordLabel').removeClass('abcCheckMark').addClass('abcXMark'); $('#inputSUConfirmPassword').closest('.form-group').removeClass('has-success').addClass('has-error'); $('#msgSignUpContainer').text('Invalid password confirmation.'); $('#msgSignUpContainer').removeClass('hidden'); return false; }; if (!$('#termsCheckbox2').attr('checked')) { $('#msgSignUpContainer').text('Please agree to our terms.'); $('#msgSignUpContainer').removeClass('hidden'); return false; } $('#signInButton').button('loading'); var posting = $.post('/cmd/signup.php?', $(this).serialize(), 'json'); posting.done(function(data) { var d = $.parseJSON(data); if (d['result'] == 'failure') { var msg = d['message']; if (d['member'] == '1') { $('#msgSignUpContainer').html($('#msgLogInMembers').html()); } else { $('#msgSignUpContainer').html($('#msgLogIn').html()); } $('#msgSignUpContainer').removeClass('hidden'); } else { hideLogInButtons(); abcUpdateName(d['first_name']); $.cookie("abc_first_name", d['first_name'], { path: '/' }); $.cookie("abc_teacher_type", d['teacher_type'], { path: '/' }); $('#logInSuccess').removeClass('hidden'); $('#logInSuccess').show(); $.cookie("abc_login", 1, { path: '/' }); $.cookie("abc_member", 0, { path: '/' }); $('#signUpPanel').modal('toggle'); $('#signInButton').button('reset'); setTimeout(function(){ $("#logInSuccess").hide(); }, 1200); var href = $('#downloadButton').data('href'); if (href) { var matches = href.match(/(\d+)/); location.href = '/welcome.php?id=' + matches[1]; } else { location.href = '/welcome.php'; } } }); return false; }); //}}} $('#downloadButton, .abctoolsButton').click(function() { // {{{ var abcl = $.cookie("abc_login"); var abcs = $.cookie("abc_session"); if (abcl == 1 || abcs) { if ($(this).hasClass('abctoolsButton')) { location.href = $(this).attr('href'); } else { $('#logInThumb3').attr('src', $(this).data('thumb')); downloadDoc($(this).data('href'), $(this).data('memberdoc')); } } else { var memDoc = $(this).data('memberdoc'); if (memDoc == '1') { $('#signUpFreeButton').addClass('hidden') $('#logInThumb2').attr('src', $(this).data('thumb')); displayDoc = true; $('#viewMemDocPanel').modal('toggle'); } else { $('#signUpFreeButton').removeClass('hidden'); $('#signInPanelButton').addClass('hidden') $('#logInThumb').attr('src', $(this).data('thumb')); var href = $(this).attr('href'); if (href) { displayDoc = href; } else { displayDoc = true; } $('#viewDocPanel').modal('toggle'); } } event.preventDefault(); }); // }}} }); $(document).ready(function() { function whichImage(){ var randNum = Math.ceil(Math.random() * 10); var e = document.getElementById("sgk_adspace"); if (e) { var tt = $.cookie("abc_teacher_type"); if (tt == 7 || tt == 10) { e.innerHTML=''; } else { e.innerHTML=''; //e.innerHTML=''; } }; } whichImage(); // thumb/list toggle {{{ $("#viewThumbnails").click(function(){ $("#listView").hide(); $("#thumbnailView").fadeIn('slow'); $.cookie('abcDisplayToggle', 'thumbnails', {expires: 365 }); }); $("#viewList").click(function(){ $("#thumbnailView").hide(); $("#listView").fadeIn('slow'); $.cookie('abcDisplayToggle', 'list', {expires: 365 }); }); if ($.cookie('abcDisplayToggle') == 'list') { $("#thumbnailView").hide(); $("#listView").fadeIn('slow'); $('#viewList').button('toggle'); } else { $("#listView").hide(); $("#thumbnailView").fadeIn('slow'); $('#viewThumbnails').button('toggle'); } //}}} // preview modal and preview image navigation {{{ $('.previewImage').click(function() { $('#modalTitle').empty(); $('#modalTitle').append($(this).data('display-text')); var $img = $(this).data('preview-file'); $('#previewImage').attr('src', $img); var $cnt = $(this).data('preview-count'); $('#contentPreviewModal').data('preview-count', $cnt); $('#contentPreviewModal').data('content-id', $(this).data('content-id')); $('#contentPreviewModal').data('site-id', $(this).data('site-id')); $('#contentPreviewModal').data('location', $(this).data('location')); $('#contentPreviewModal').data('current', 0); $('#contentPreviewModal').modal({backdrop: false }); $('#previewPrevious').addClass('disabled'); if ($cnt == 1) { $('#previewNext').addClass('disabled'); $('#previewPrevious').addClass('disabled'); } $('#relatedCategories').empty(); $.getJSON('/cmd/related_categories.php?id=' + $(this).data('content-id'), function(data) { $.each(data, function(key, val) { $('#relatedCategories').append('
  • ' + val + '
  • '); }); }); }); $('#previewNext').click(function() { var $current = $('#contentPreviewModal').data('current'); var $cnt = $('#contentPreviewModal').data('preview-count'); if ($cnt > 1 && $current < $cnt - 1) { $current++; var $img = $('#previewImage').attr('src'); var $next = $img.replace(/\d+\.png$/, $current + '.png'); $('#contentPreviewModal').data('current', $current); $('#previewImage').attr('src', $next); $('#previewPrevious').removeClass('disabled'); if ($current == $cnt - 1) { $('#previewNext').addClass('disabled'); } } else { $('#previewNext').addClass('disabled'); } }); $('#previewPrevious').click(function() { var $current = $('#contentPreviewModal').data('current'); var $cnt = $('#contentPreviewModal').data('preview-count'); if ($cnt > 1 && $current > 0) { $current--; var $img = $('#previewImage').attr('src'); var $next = $img.replace(/\d+\.png$/, $current + '.png'); $('#contentPreviewModal').data('current', $current); $('#previewImage').attr('src', $next); $('#previewNext').removeClass('disabled'); if ($current == 0) { $('#previewPrevious').addClass('disabled'); }; } else { $('#previewPrevious').addClass('disabled'); } }); $('#downloadDocument').click(function() { var abcl = $.cookie("abc_login"); var abcs = $.cookie("abc_session"); if (abcl == 1 || abcs) { $(this).button('loading'); if ($('#contentPreviewModal').data('site-id') == '1') { window.location = '/' + $('#contentPreviewModal').data('location'); } else { window.location = 'http://members.abcteach.com/cmd/track_content.php?id=' + $('#contentPreviewModal').data('content-id'); } } else { $('#logInPanel').modal('toggle'); $('#contentPreviewModal').modal('toggle'); } }); // }}} $('.thumbnailImage').tooltip({delay: { show: 500, hide: 100 }}); $('.noPreviewAvailable').tooltip({title: 'There is no preview currently available for this document.'}); $('#filterHelpMessage').hover( function() { $('#filterHelpMessage').popover('show'); }, function() { $('#filterHelpMessage').popover('hide'); } ); $('.sortListItem').click(function() { $('#currentSort').button('loading'); var url = window.location.href.replace(/\d+-\d+$/, ''); url +=$(this).data('sort') + '-1' window.location.href = url; }); $(".heart").hover( function () { $(this).attr('src', "http://static.abcteach.com/images/search/heart_roll.png"); }, function () { $(this).attr('src', "http://static.abcteach.com/images/search/heart_norm.png"); } ); $(".preview").hover( function () { $(this).attr('src', "http://static.abcteach.com/images/search/preview_roll.png"); }, function () { $(this).attr('src', "http://static.abcteach.com/images/search/preview_norm.png"); } ); if ($(".preview").size() < 64) { $("#directorySky").hide(); } }); $(document).ready(function() { $('.showVideo').click(function(event) { event.preventDefault(); var matches = $(this).data('video-url').match(/^youtube:(.+)/); if(matches) { $('#videoTitle2').empty(); $('#videoTitle2').append($(this).data('display-text')); $('#videoModal2').modal({backdrop: false }); var params = { allowScriptAccess: "always" }; var atts = { id: "ytapiplayer" }; swfobject.embedSWF("http://www.youtube.com/v/"+ matches[1] +"?enablejsapi=1&playerapiid=ytplayer&version=3", "ytapiplayer", "500", "315", "8", null, null, params, atts); } else { $('#videoTitle').empty(); $('#videoTitle').append($(this).data('display-text')); $('#videoModal').modal({backdrop: false }); jwplayer('jwpContainer').setup({ 'flashplayer': 'http://www.abcteach.com/jwplayer/player.swf', 'file': $(this).data('video-url'), 'provider':'http', 'start':'0', 'plugins': { 'hd-2': { 'file': $(this).data('video-url-hd'), 'state': 'true' }, 'gapro-2': {} }, 'width': '540', 'height': '360', 'icons': 'false', 'image': 'http://static.abcteach.com/content_preview/a/abcteach_asl_words_to_ask_questions_p-1.png' }); } }); $('.dismissModal').click(function() { $('#videoModal').hide(); jwplayer('jwpContainer').stop(); }); $('.dismissModal2').click(function() { $('#videoModal2').hide(); var ytplayer = document.getElementById("myytplayer"); ytplayer.pauseVideo(); }); //testing });