function gold2_check() { var str = document.forms[0].elements[0].value; if(str == "1 3/4") { self.parent.top.location="gold3.html"; return false; } else { if(str == "2 1/8" || str == "3 1/4" || str == "2 3/4" || str == "1 7/8") { if(confirm("Maglev Input Warning:\nThere is a shorter route. Click \"Ok\" to proceed anyway, or \"Cancel\" to input a new distance address.\n\nWarning: Taking a longer route can sometimes cause the Maglev to short out.")) { self.parent.top.location="gold3.html"; return false; } } else { return MaglevErrorCheck( str, 1.75); } } } function gold3_check() { var str = document.forms[0].elements[0].value; if(str == "1 1/2") { self.parent.top.location="gold4.html"; return false; } else { return MaglevErrorCheck( str, 1.5 ); } } function gold4_check() { var str=document.forms[0].elements[0].value; if(str == "3/4") { self.parent.top.location="gold5.html"; return false; } else { return MaglevErrorCheck( str, 0.75 ); } } function gold5_check() { var str = document.forms[0].elements[0].value; if(str == "4 3/4") { self.parent.top.location="gold6.html"; return false; } else { return MaglevErrorCheck( str, 4.75 ); } } function gold6_check() { var str=document.forms[0].elements[0].value; if(str == "1 1/4") { self.parent.top.location="gold7.html"; return false; } else { return MaglevErrorCheck( str, 1); } } function gold7_check() { var str=document.forms[0].elements[0].value; if(str == "7/8") { self.parent.top.location="gold8.html"; return false; } else { return MaglevErrorCheck(str, 0.875); } } function gold8_check() { var str=document.forms[0].elements[0].value; if(str=="1 31/32") { self.parent.top.location="gold_conflict.html"; return false; } else { return MaglevErrorCheck(str, 1.96875); } } function gold_conflict_check() { var str=document.forms[0].elements[0].value; if(str == "10") { self.parent.top.location="valor.html"; return false; } else { alert("Ha Ha Ha Ha Ha! Your minuscule human cognition will never surpass my computational abilities!"); return false; } } function MaglevErrorCheck( str, decimalAnswer ) { if(IsAFraction(str)) { if(ParseFraction(str) == decimalAnswer) { alert("Maglev Input Error: \nThe Maglev requires fractions to be in reduced, mixed number form."); } else { alert("Maglev Input Error: \nThat Distance Address is either invalid, has already been accessed, is not active at this time, or is not a simplified mixed number.\n\nIn other words, it's the wrong answer."); } } else { alert("Maglev Input Error: \nThe Maglev only understands fractional notation."); } return false; } //Again, the fraction functions. function IsAFraction( str ) { var isFraction=true; if( str.length == 0 ) return false; for( var i = 0; i < str.length; i ++ ) { if( !IsValidChar(str[i]) ) { isFraction = false; } } return isFraction; } function IsValidChar( ch ) { return ( ch == 0 || ch == 1 || ch == 2 || ch == 3 || ch ==4 || ch ==5 || ch ==6 || ch ==7 || ch ==8 || ch ==9 || ch ==" " || ch =="/" ); } function ParseFraction( frac ) { var toReturn; var i; for( i=0; i < frac.length && frac[i] != " "; i++ ); toReturn = eval (frac.substr(0, i)); if(i < frac.length - 1) toReturn += eval (frac.substr(i+1, frac.length)); return toReturn; }