function submitSearch() { console.log('submitting search to RD'); $('#Body').prepend('
'); $('#RDSearchForm').append(''); $('#RDSearchForm').submit(); } function submitLogin() { console.log('submitting login to RD'); $('#Body').prepend('
'); $('#RDLoginForm').append(''); $('#RDLoginForm').append(''); $('#RDLoginForm').submit(); } function getAbsoluteURL(target) { if(target[0] == '/') { return 'http:/'+'/www.afsinc.org'+target; } return target; } $(document).ready(function() { $('#header').css('height', '230px'); $.get('http:/'+'/www.afsinc.org/populateMenus.cfm?json=1', function(json){ $('#nav').html(''); $.each(json.RECORDSET,function(i,t){ $('#nav').append(''); $.get('http:/'+'/www.afsinc.org/populateMenus.cfm?json=1&parent='+t.itemnumber+'', function(subNavJson) { $('#menu'+t.itemnumber).append('
'); $.each(subNavJson.RECORDSET, function(j,s) { $('#submenu'+t.itemnumber).append('
  • '+s.resourcename+'
  • '); }); }, "jsonp"); }); }, "jsonp"); $('#header_utility').html(''); $.get('http:/'+'/www.afsinc.org/populateMenus.cfm?json=1&'+'navID=3797', function(json) { $.each(json.RECORDSET,function(i,t){ $('#header_utility').append(''+t.resourcename+''); if(i < json.RECORDSET.length - 1) { $('#header_utility').append(' | '); } }); }, "jsonp"); $('#footer_utility').html(''); var base = 'www.afsinc.org'; $.get('http:/'+'/'+base+'/populateMenus.cfm?json=1&'+'navID=3803', function(json) { $.each(json.RECORDSET,function(i,t){ if(t.targeturl[0] == '/') { t.targeturl = 'http:/'+'/'+base+t.targeturl; } $('#footer_utility').append(''+t.resourcename+''); $('#footer_utility').append('|'); }); $('#footer_utility').append('Log In'); }, "jsonp"); $('#Form').submit(function(){ console.log('submition of form.'); if($('input[name="keywords"]').val().length > 0) { console.log('keywords, so search AFS'); submitSearch(); return false; } console.log($('input[name="username"]').val()); console.log($('input[name="password"]').val()); if($('input[name="username"]').val().length > 0 && $('input[name="password"]').val().length > 0) { console.log('user/pass, so login to AFS'); submitLogin(); return false; } return true; }); });