function validate_recipe_feedback(thisform) { // Validation of required input fields // Verify that all number forms are numbers and are within range // Verify that at least one form input has content (not null, not spaces, and not empty string) // If error, alert error and return false. Else no alert and return true. return true; //temp to disable js var err_temp; var err_alert = ""; var err_display = ""; with (thisform) { if (og.value<1 || og.value>1.5) { err_temp="OG out of range."; if (err_alert!="") {err_alert+="\n"; err_msg+="
";} err_alert+=err_temp; err_display+=err_temp; } if (fg.value==null || fg.value=="") { err_temp="Please enter a value for FG."; if (err_alert!="") {err_alert+="\n"; err_display+="
";} err_alert+=err_temp; err_display+=err_temp; } } if (err_alert != "") { alert(err_alert); document.getElementById("err_msg").innerHTML = err_display+"
"; return false; } else {return true;} } function validate_get_recipes(thisform) { // Validation of required input fields // Verify that all number forms are numbers and are within range // Verify that at least one form input has content (not null, not spaces, and not empty string) // If error, alert error and return false. Else no alert and return true. return true; //temp to disable js var err_temp; var err_alert = ""; var err_display = ""; with (thisform) { if (og.value<1 || og.value>1.5) { err_temp="OG out of range."; if (err_alert!="") {err_alert+="\n"; err_msg+="
";} err_alert+=err_temp; err_display+=err_temp; } if (fg.value==null || fg.value=="") { err_temp="Please enter a value for FG."; if (err_alert!="") {err_alert+="\n"; err_display+="
";} err_alert+=err_temp; err_display+=err_temp; } } if (err_alert != "") { alert(err_alert); document.getElementById("err_msg").innerHTML = err_display+"
"; return false; } else {return true;} } function validate_registration(thisform) { // Validation of required input fields // Verify that all values are adaquate // If error, alert error and return false. Else no alert and return true. return true; //temp to disable js var err_message = ""; with (thisform) { if( first_name.value && last_name.value && email.value && user_name.value && password.value ) { if( email.value==email_2.value ) { err_message=validate_email(email); } else {err_message="Email inputs do not match.";} } else {err_message="Please fill out all items.";} } if (err_message != "") { alert(err_message); document.getElementById("err_msg").innerHTML = err_message+"
"; return false; } else {return true;} } function logon() { cursor_wait(); var user_name=document.getElementById('logon_user_name').value; var password=document.getElementById('logon_password').value; // Confirm all information is filled out if( !user_name || !password ) { alert("Please fill out all items"); cursor_clear(); } else { // create new script element and set its relative URL (including ID arguments) var script = document.createElement( 'script' ); script.src = '/j/external_logon.php?user_name='+user_name+'&password='+password+'&pass=okay'; // attach (load) script element to document head document.getElementsByTagName( 'head' )[0].appendChild( script ); } } function validate_email(temail) { if( temail.indexOf("@")== -1 ) // look for an @ character return "No '@' in address"; else { var adr = temail.split("@"); // look for part address before the @ character if(adr[0].length < 1 ) return "User address absent"; else // look for a dot if(adr[1].indexOf(".")== -1) return "No dot"; else // look for domain name after the @ character if(adr[1].length < 3) return "Domain incorrect"; else return true; } } function fail(msg) // a function to display an error message { alert("Email Address Error:\n" +msg); } function logoff() { // create new script element and set its relative URL (including ID arguments) var script = document.createElement( 'script' ); script.src = '/j/external_logoff.php?pass=okay'; // attach (load) script element to document head document.getElementsByTagName( 'head' )[0].appendChild( script ); } function check_if_logged_on() { if(readCookie('auth')=="yes") return true; else {alert("Please Log In");return false;} } function get_recipes() { // document.forms.recipe_list.submit(); window.open("recipe_list.php","","top=20,left=20,width=250,height=500, status, location, menubar, resizable,scrollbars,toolbar"); } function CheckForm(form) { if ((form.logon_user_name.value) && (form.logon_password.value)) return true; else return false; } function noenter() { //prevents enter from working return !(window.event && window.event.keyCode == 13); } function enter_logon(e) { //calls logon() instead of enter // alert("enter_logon-event:"+e+" event.which:"+e.which); if (e && e.which == 13) {// alert("enter return"); logon();} else {// alert("enter not return"); return true;} } function enter(nextfield) { //goes to next form input instead of enter (not used?) if(window.event && window.event.keyCode == 13) { nextfield.focus(); return false; } else return true; } var g_controlMenu=null; //global variables used to show control panel display using showMenu in create_recipes only function showMenu(controlMenu) { //uses g_controlMenu declared in main js var l_controlMenu = document.getElementById(controlMenu); if (g_controlMenu==null) { l_controlMenu.style.display = "block"; g_controlMenu=l_controlMenu.id; } else { document.getElementById(g_controlMenu).style.display = "none"; if (g_controlMenu!=l_controlMenu.id) { l_controlMenu.style.display = "block"; g_controlMenu=l_controlMenu.id; } else { g_controlMenu=null; } } } function toggleMenu(currMenu) { if (document.getElementById) { thisMenu = document.getElementById(currMenu).style if (thisMenu.display == "block") { thisMenu.display = "none"; } else { thisMenu.display = "block"; } return false; } else { return true; } } function check_logged_on_status() { if(readCookie('auth')=="yes") { document.getElementById('not_logged_on').style.display = 'none'; document.getElementById('logged_on').style.display = 'block'; document.getElementById('logged_on').getElementsByTagName('h2')[0].firstChild.data = readCookie('user_name')+' is logged on'; } // write initial cookie cursor_wait(); var script = document.createElement( 'script' ); script.src = '/j/external_front_door.php?pass=okay'; document.getElementsByTagName( 'head' )[0].appendChild( script ); } function set_authorization_cookie() { alert("set_authorization_cookie never used?"); if(readCookie('auth')=="yes") document.getElementById('logoff').style.display = "block"; else document.getElementById('logon').style.display = "block"; } function save_history() { //fix this function // Verify date document.forms.submit_history.submit(); } // function recipe_feedback(id) { // window.open("recipe_feedback.php?id="+id,"","top=20,left=20,width-250,height=500, status, location, menubar, resizable,scrollbars,toolbar"); // } function recipe_history() {alert("code goes here");} function retrieve_user_values(source) // if source = 0, retrieve default valves. If 1, then stored valves. {cursor_wait(); var script = document.createElement( 'script' ); script.src = '/j/external_retrieve_user_values.php?source=' + source; document.getElementsByTagName( 'head' )[0].appendChild( script ); } function save_user_values() {cursor_wait(); var script = document.createElement( 'script' ); script.src = '/j/external_save_user_values.php?'; script.src +='mash_efficiency='+document.getElementById('mash_efficiency').value; script.src +='&fermentor_losses='+document.getElementById('fermentor_losses').value; script.src +='&debris_losses='+document.getElementById('debris_losses').value; script.src +='&mash_equipment_losses='+document.getElementById('mash_equipment_losses').value; script.src +='&false_bottom_volume='+document.getElementById('false_bottom_volume').value; script.src +='&maximum_kettle_size='+document.getElementById('maximum_kettle_size').value; script.src +='&altitude='+document.getElementById('altitude').value; document.getElementsByTagName( 'head' )[0].appendChild( script ); } function generate_address( username ) { // writes without anchors around. var domain = "tapmeister.com"; var recipient = username + "@" + domain; var url = "mailto:" + recipient; document.write(recipient.link(url)); } function instructions_create() {window.open("instructions_create.html","","top=20,left=20,width-250,height=500, status, location, menubar, resizable,scrollbars,toolbar");} //{window.location="instructions_create.html";} function instructions_get() {window.open("instructions_get.html");} function table_cell_to_string(table_id,column_no) { // alert(table_id.id+".rows.length="+table_id.rows.length); if(table_id.rows.length>0) { var a_php = ""; var glue=""; for (var i=0; i0) { var a_php = ""; var glue=""; for (var i=0; i0) { var a_php = ""; var glue=""; for (var i=0; i 12) {alert('month must be between 1 and 12'); return false;} if (yy != 0 && (yy < 1901 || yy > 2100)) {alert('year must be after 1900 and before 2101'); return false;} var dow = ['Sun','Mon','Tue','Wed','Thu','Fri','Sat']; var calendar = new Date(); var today = calendar.getDate(); var curm=calendar.getMonth(); //added var cury=calendar.getFullYear(); //added calendar.setDate(1); if (yy > 1900) calendar.setFullYear(yy); if (mm > 0) calendar.setMonth(mm - 1); var yy = year = calendar.getFullYear(); var month = calendar.getMonth(); calendar.setDate(today); var weekday = calendar.getDay(); var daysInMonth = monthlength(month+1,year); var hilite_start = ''; var td_start = ''; var cal = '
'; // alert("currentyear="+cury+"\ncurrentmonth="+curm+"\nyear="+year+"\nmonth="+month); //testing for(dex=0; dex < 7; dex++) { // if(weekday == dex) if(weekday == dex && month == curm && year == cury) // change so it is only highlighted for actual current day cal += td_start + '' + dow[dex] + '<\/b><\/td>'; //Highlight weekday (i.e. monday, tuesday) of current day else cal += td_start + dow[dex] + ''; } cal += '<\/tr>'; var day2 = today; for (dex = today; dex > 6; dex -=7) day2 = dex; weekday -= day2 - 1; while (weekday < 0) weekday += 7; for(dex=0; dex < weekday; dex++) cal += td_start + ' <\/td>'; for(dex=1; dex <= daysInMonth; dex++) { if(weekday == 7) {cal += ''; weekday = 0;} // if(today==dex) if(today == dex && month == curm && year == cury) // change so it is only highlighted for actual current day // Modify so "#" for anchors are no longer required // cal += hilite_start +'' + dex + '<\/a><\/b><\/td>'; cal += hilite_start +'' + dex + '<\/a><\/b><\/td>'; else // cal += td_start + '' + dex + '<\/a><\/td>'; cal += td_start + '' + dex + '<\/a><\/td>'; weekday += 1; } for(dex=weekday; dex < 7; dex++) cal += td_start + ' <\/td>'; cal += '<\/tr><\/table><\/div>'; if (document.getElementById) { var mmb = month; mm = month + 1; var yya = yyb = yy; if (mmb <1) {mmb += 12; yyb--;} var mma = month + 2; if (mma > 12) {mma -= 12; yya++;} var yb = yy -1; var ya = yy +1; //Displays change year and change month buttons with internal links // If "<<" is clicked, then new calander with year= yb and month= mm // If "<" is clicked, then new calander with year=yyb and month=mmb // If ">" is clicked, then new calander with year=yya and month=mma // If ">>" is clicked, then new calander with year= ya and month= mm // Remove "#" for anchor as they appear not to be needed // cal += '
' + moy[month] + ' ' + year + '<\/b><\/td><\/tr>
<<<>>>
'; cal += '
<<<>>>
'; } else {cal += '
';} cal += '
'; return cal; }