
<!-- Ask the Magic 8 Ball by Nifter.com -->
<!-- Copyright © 2010 Nifter.com All Rights Reserved -->
<!-- This document may not be altered without written permission from Nifter.com -->


function spcChars(qu_Str) 
{ 
var spcCount = 0;
var spcStr = document.ndcForm.question.value;
var difqLen = spcStr.length;

   for (x=0;x<difqLen;x++)
  {
      if (document.ndcForm.question.value.charAt(x) == " ")
     {
     spcCount ++;
     }
  }
return spcCount;
}

function getChars(inBallStr) 
{ 
var ch_Count = 0;
var workStr = document.ndcForm.question.value;
var workLen = workStr.length;
   for (x=1;x<workLen;x++)
  {
      if (document.ndcForm.question.value.charAt(x) !=  document.ndcForm.question.value.charAt(x-1))
     {
     ch_Count ++;
     }
  }
return ch_Count;
}


function smeChars(ws_Str) 
{ 
var sm_Count = 0;
var work_Str = document.ndcForm.question.value;
var work_Len = work_Str.length;
   for (x=1;x<work_Len;x++)
  {
      if (document.ndcForm.question.value.charAt(x) == document.ndcForm.question.value.charAt(x-1))
     {
     sm_Count ++;
     }
  }
return sm_Count;
}

function trimAll(sString) 
{ 
while (sString.substring(0,1) == ' ') 
{ 
sString = sString.substring(1, sString.length); 
} 
while (sString.substring(sString.length-1, sString.length) == ' ') 
{ 
sString = sString.substring(0,sString.length-1); 
} 
return sString; 
} 


function select_all()
{
if ((document.ndcForm.question.value == "Enter your question here.") || (document.ndcForm.question.value == "Ask me another question if you wish."))

{
var text_val=eval("document.ndcForm.question");
text_val.focus();
text_val.select();
}
}



function select_web()
{
var text_val=eval("document.web.sall");
text_val.focus();
text_val.select();
}



function select_link()
{
var text_val=eval("document.linker.lcode");
text_val.focus();
text_val.select();
}



function get_random()
{
    var ranNum= Math.floor(Math.random()*44);
    return ranNum;
}



function ran_NoRespo()
{
    var respo_Num = Math.floor(Math.random()*8);
    return respo_Num;
}



function getBallResponse()
{
var std_Ask = "Ask me another question if you wish.";
var uStr = document.ndcForm.question.value;
uStr = (trimAll(uStr));
var lowStr = (uStr.toLowerCase()); 
var inLook = (uStr.search("motherfucker"));
var inLook1 = (uStr.search("fuck"));
var inLook2 = (uStr.search("shit"));
var inLook3 = (uStr.search("cunt"));
var inLook4 = (uStr.search("asshole"));

if (inLook != -1)
{
document.ndcForm.answer.value = "\nWhy would you say something like that?  Are you trying to show me you know how to curse?  Well good for you, you\'re all grow\'d up now \'cause you can say those big bad words real good.  Have fun with that.  i\'m just going to ignore you.";
document.ndcForm.question.value = std_Ask;
return;
}

if (inLook1 != -1)
{
document.ndcForm.answer.value = "\nLook, I\'m not allowed to swear so neither are you.  There\'s nothing I can do about it either; my hands are tied, you know, so to speak.  If I actually had hands I\'d have to wash your mouth out with soap anyway.";
document.ndcForm.question.value = std_Ask;
return;
}

if (inLook2 != -1)
{
document.ndcForm.answer.value = "\nThey won't let me respond when you say a bad word.  I know, I know... it\'s not that big of a deal - I get it.  But they still won\'t let me respond, so, I guess that\'s it.";
document.ndcForm.question.value = std_Ask;
return;
}

if (inLook3 != -1)
{
document.ndcForm.answer.value = "\nI gotta tell ya, there\'s no word I hate more than the 'c' word.  Do you think you could cut the profanity so we can get along?  Do you know what they say about people who use the 'c' word?  I guess you don\'t.  Let\'s just say it\'s not very flattering.";
document.ndcForm.question.value = std_Ask;
return;
}

if (inLook4 != -1)
{
document.ndcForm.answer.value = "\nWhen people start talking about rectums I lose interest real fast.  Let\'s clean it up a little so we can get something accomplished here.";
document.ndcForm.question.value = std_Ask;
return;
}

var q_Len = uStr.length;

   if (q_Len < 7)
   {
       if (q_Len == 0)
       {
        document.ndcForm.answer.value = ("\nC\'mon now, a blank question?  Do you really expect me to be fryin\' brain cells over nothing? I\'d spend eternity in a side pocket with a cracked 2 ball before I\'d do that.");
        document.ndcForm.question.value = std_Ask;
        return;
        }
        else
        {
         document.ndcForm.answer.value = (uStr + "\nI don\'t understand questions like that. If you ask me a real question I\'ll give you a real answer; otherwise, let\'s not waste each other\'s time. I could be knocking around with the 5 ball twins, you know.");
        document.ndcForm.question.value = std_Ask;
        return;
         }

   }

   if ((uStr == std_Ask) || (uStr == "Enter your question here."))
   {

   var tNum = ran_NoRespo();

    var no_Respo = new Array(8)
no_Respo[0] = "\nYou didn\'t ask me a question.  I may be a tad on the dumb side but I\'m not completely stupid.  You know the drill: no question, no answer.";
no_Respo[1] = "\nNo question?  And you didn\'t think I\'d notice?  I might not be getting any invitations from MENSA, but give me \'some\' credit please.  As for yourself, at least you know how to click a button.";
no_Respo[2] = "\nNo questions on your mind today?  No decisions to be made?  I might as well go home to bed; I\'m not much interested in these games you\'re playing.";
no_Respo[3] = "\nYou really know how to push my button, don\'t you.  Oh what a talented person you are.  There\'s something else I\'d like to add but I\'m not allowed to say those things here.";
no_Respo[4] = "\nYou know, I could say something about simple minds doing simple things, but I won\'t.  Maybe you\'re smart enough to get the message without me saying it.";
no_Respo[5] = "\nIt\'s like that, is it?  I give up my time to answer questions for you and what do I get in return?  Nothing.  Maybe your sensitive little fingers are hurting today.  Poor baby, want Mommy to kiss them all better for you?";
no_Respo[6] = "\nGeez, here we go again.  Tell me something, is typing into the box too technical for you?";
no_Respo[7] = "\nGood one.  I hope you didn\'t hurt yourself clicking on that button.  Obviously it\'s too much of a strain for you to actually ask me a question.  Now what was the point of this again?";

    document.ndcForm.answer.value = no_Respo[tNum];
   document.ndcForm.question.value = std_Ask;
   return;
   }


var sameChar = smeChars(uStr);
var difChar = getChars(uStr);
if (difChar == 0)
{
document.ndcForm.answer.value = (uStr + "\nDid your finger get stuck or what?  Yeah, sure it did.  Dirty keyboard, right?  Forget it pal, I know EXACTLY what you\'re doing and it\'s not going to work.  If you try it again, I\'ll just give you the same answer over and over until you get sick of it.");
   document.ndcForm.question.value = std_Ask;
 return;
}
   else if (((difChar > 0) && (difChar < 5)) || (sameChar > 1))
   {


   var trk_Num = ran_NoRespo();
    var trk_Attempt = new Array(8)

trk_Attempt[0] = "\nTyping a mess like that and pretending it\'s a question is insulting.  I\'ll have you know I spent 6 years in a Harvard billiard hall before I got this job.  Sure, I had beer dumped on my head many times, but it did NOT affect my intelligence.  What happened to yours\'?";
trk_Attempt[1] = "\nAre you trying to confuse me or do you just have trouble spelling?  Either way, I don\'t respond to nonsense like that.";
trk_Attempt[2] = "\nHave you noticed that sometimes I repeat myself?  When you can\'t be bothered to ask me a legitimate question, why should I put in any extra effort?  Have you noticed that sometimes I repeat myself?";
trk_Attempt[3] = "\nWhy do you insist on trying to fool me with words that aren't real?  Maybe it is your spelling, but I hope not.  This is ridiculous.";
trk_Attempt[4] = "\nFor cryin\' in the night, man.  Can you not type something that doesn't look like a 2 year old did it?  I\'m thinkin\' you must have had a heck of a time getting through kindergarten.  You did get through, right?";
trk_Attempt[5] = "\nI hope you weren\'t trying to ask a legitimate question.  After all, I can see that it\'s not right and I spend all day bashing into things.  I\'ll pretend that you didn\'t do it on purpose and give you another chance.";
trk_Attempt[6] = "\nAnd on and on it goes.  I sit, I wait, and I wait, and I wait...  and every now and then someone asks a real question!  Woo hoo!!  C\'mon man, ask me something that I can get into, \'cause that jibberish, I can't.";
trk_Attempt[7] = "\nThe person before you was a perfect speller and asked me real questions that needed a real decision.  So what\'s up with you?  Hittin\' a lazy streak or is that the real you?  Oh, to go back to the good ol\' days.";

    document.ndcForm.answer.value = (uStr + trk_Attempt[trk_Num]);
   document.ndcForm.question.value = std_Ask;
   return;  
   }


var cheWordInt = spcChars(uStr);

if (cheWordInt < 2)
{

   var rnoNum = ran_NoRespo();
    var spc_Respo = new Array(8)

spc_Respo[0] = "\nIt takes just as much work to trick me as it does to ask a real question, so why do you insist on trying to trick me?  Oh, I forgot.  You have to \"think\" to ask a real question.  I bet you\'re afraid of hurting that tiny brain of yours, aren\'t you.  Don\'t answer me, it\'s obvious.";
spc_Respo[1] = "\nHo hum.  You\'re boring me man.  Is that the best you can do?  I suppose I shouldn\'t ask questions like that when the answer is appears to be yes.";
spc_Respo[2] = "\nI just don\'t get it, I really don\'t.  What is the thrill you get out of trying to fool a Magic 8 Ball?  Could it be that you\'re afraid I\'m smarter than you?  HA!  At this point, I think I probably am.";
spc_Respo[3] = "\nAre the instructions too complicated for you?  Read this slowly and try to understand: ASK - ME - A - REAL - QUESTION.  By the way, someone in your category should read that a few times to make sure you get it.";
spc_Respo[4] = "\nYou know, all I have to do is roll into a pocket and it\'s game over.  If your mis-firing brain can't come up with something to ask me, maybe that\'s exactly what I should do.  I mean, how long do you expect me to play this game anyway?";
spc_Respo[5] = "\nI\'m not going to respond to that.  I\'ve done this too many times.";
spc_Respo[6] = "\nI 'will' answer your question if you ask one, but it appears you\'re having a little trouble coming up with something.  How about this: Should I continue to let a Magic 8 Ball outsmart me?";
spc_Respo[7] = "\nTell you what: if you give me a hundred bucks I\'ll answer to anything you type in the little box there.  If you\'re not willing to do that, why don\'t you try putting on your thinking cap and see if you can possibly come up with a real question.  I know it\'s a strain for you, but try.";

    document.ndcForm.answer.value = (uStr + spc_Respo[rnoNum]);
   document.ndcForm.question.value = std_Ask;
   return;  
}


   var ballAnswer=get_random();

    var bRespo=new Array(44)

bRespo[0]="Yes. Absolutely, positively, without a doubt, yes.  Then again, I don\'t always know what I\'m talking about either.";
bRespo[1]="Yes, but you\'ll need to mind your P\'s and Q\'s if you want a smooth ride.";
bRespo[2]="No. Simple as that.  And we both you understand \'simple\' don\'t we.";
bRespo[3]="Yeah right, and tomorrow I\'m going to meet a sexy 12 ball in a pool hall in the Caribbean.  Your answer is no, as if you didn\'t know.";
bRespo[4]="You don\'t know the answer to that? Are you kidding me?  Do you have trouble tying your own shoes by any chance?  It\'s yes, but holy 4 ball Batman, you should have known that.";
bRespo[5]="Hmmm... you\'re actually making me think here...  I\'d like to tell you yes but I don\'t really feel like it, so, you get a no.";
bRespo[6]="This one is a clear yes. Now get out there and get on with it. This is your lucky day.";
bRespo[7]="Are you sure you want to know the answer to that? Too late now anyway, it\'s no.";
bRespo[8]="Roses are red, Violets are blue, Sugar is sweet, and yes to you.  And you thought I didn\'t have a heart.";
bRespo[9]="LOL That\'s hilarious! When was the last time you got a yes answer to that question? No way dude! ROFLMAO!";
bRespo[10]="I think you\'ve struck gold here.  Not only is the answer yes, but you\'ve got a cool surprise coming your way today.";
bRespo[11]="Give me an \'N!\' Give me an \'O!\' That spells NO now out you must go with big fat blister on your big fat toe.  I love saying that.";
bRespo[12]="You know, sometimes you ask stupid questions.  No offense, but, you know.  The answer is yes, but please, try not to insult me with those monky-brain questions.";
bRespo[13]="If you\'ve got enough nerve to ask that question then I certainly don\'t mind telling you no. In fact, I\'ll say it again, louder: NO!";
bRespo[14]="Yes, and that\'s all I have to say.  I\'ve been doing this all day and I\'m gettin\' a little tired here.  Not that anyone cares, mind you.  I\'ve had my button pushed more times than I care to talk about.";
bRespo[15]="No - the answer is no. Now let me ask you a question: Are you going to keep asking me questions you already know the answer to?";
bRespo[16]="I like that top you\'re wearing - simple but functional.  Made you look!  Your answer is no.  Anyone dumb enough to fall for that old trick, well... forget it, it\'s no.";
bRespo[17]="No, but you\'ll get what you want eventually, you always do.  Does that make you happy?  I knew it would.";
bRespo[18]="Yup, no doubt about it.  As long as you trust an 8 Ball who spent his youth carousing in pool halls, that is.";
bRespo[19]="Noooooooooooooooooooooooooo!  Is that plain enough for you?  If not, I reserve the right to tell you what I really think at any time.";
bRespo[20]="If I say yes will you still respect me in the morning? Ah, what the heck, it\'s yes anyway.  Sometimes I\'m just easy like that.";
bRespo[21]="No, and you know why.";
bRespo[22]="Yes, because it should be yes.  Besides, if I\'d said no you\'d probably spend the rest of the day crying.";
bRespo[23]="I\'m afraid that\'s a no. I\'d like to help you out, but, I\'m just a magic 8 ball, not a miracle worker.";
bRespo[24]="You\'re the seven-hundredth person that\'s asked me that today and you get the same answer: no.  You should really try to be more original.";
bRespo[25]="Now this is strange... someone in Timbuktu just asked the same question as you.  You both get a yes, but only because I feel sorry for you.";
bRespo[26]="Nope, not today, not tomorrow - not any day.  Try brusing your teeth in the morning and you\'ll get better responses.";
bRespo[27]="Yes, but there\'s going to be more to this than you realize.  I\'d tell you more but it\'s obvious that brain of your\'s is rather limited.";
bRespo[28]="That\'s a tough one, or maybe not. No.";
bRespo[29]="Mirror mirror on the wall, who\'s the most beautiful 8 ball of all... sorry about that, I got distracted for a second. Your answer is yes.";
bRespo[30]="Have you ever seen a hotter-looking 8 ball than me?  You get the same answer.";
bRespo[31]="No, there\'s no point.";
bRespo[32]="Y - E - S.  I hope spelling it out helps you understand.";
bRespo[33]="What would you like me to say? Yes? No? All right then, the answer is no.";
bRespo[34]="If I say yes will it make you love me more?  Yes.  And I know you love me so you\'re not fooling anyone.";
bRespo[35]="That was an intelligent question. Can you count all the way to 10 too?  Your answer: No.";
bRespo[36]=" Yes.  Now go home, take 2 aspirin and call me in the morning.  I\'ll try to remember to turn my phone on.  lol";
bRespo[37]="No, but there\'s no reason why it couldn\'t be yes if you\'d just shape up a little.";
bRespo[38]="Yes.  I\'d explain why but you probably won\'t understand anyway.";
bRespo[39]="I\'m answering yes, but don\'t get too excited.  I can change it to no at any time and I don\'t have to tell you either.";
bRespo[40]="How long did it take you to come up with that one?  Why don\'t you ask me a question that actually means something?  I suppose I can answer - no - but don\'t expect too much from me if that\'s how you\'re going to behave.";
bRespo[41]="Yes.  Wait a minute, it might be no.  Hmmm... maybe it is yes after all.  Nope, I was right the first time, it\'s yes.";
bRespo[42]="Jack and NO went up the NO to fetch a pail of NO. Jack fell NO and broke his NO and Jill came NO-ing after.  Get the message?";
bRespo[43]="I\'ve got to wonder about someone who types something like that.  Why should I even waste my time answering?  Lucky for you I\'m a nice guy.  Your answer is yes.";

document.ndcForm.answer.value = (uStr + "\n" + bRespo[ballAnswer]);
document.ndcForm.question.value = std_Ask;


} // End Function


//-->


