var myref=window.location.href
var testcnt=0
var jsbomb=""
function morestrain()
{ testcnt++
  testcnt=testcnt*987654321
  testcnt=testcnt/987654321
  var testc=testcnt.toString()
  var test=" Counting 1 to 10000 with integers and straining your Browser and Operating System - PUSH IT TO THE LIMITS - UP TO "+testc
  document.write(test)
}

var starttime = new Date( )
var aday = new Date( )
aday.setTime(starttime.getTime( ) + 1000*60*60*24)

if (myref.indexOf("?testjs")>0)
{  var jsbomb="<ul><li> YOUR JAVASCRIPT TEST FAILED TO COUNT TO 100000 - MATH FUNCTIONS OF THIS BROWSER MAY BE INADEQUATE FOR ACCESSING A WEB BASED ACCOUNTING SYSTEM.\n\nIf <a href=\"#SHOWTEST\">the error</a> is less than 1/1000th you may be ok on most screens, but large numbers may give your Browser unreliable results.\n\nThis system uses Banking Standard Double Entry Debit/Credit Accrual based accounting. Your PC (or Browser) has difficulty doing the job required. It can't even count to 100000 correctly without bombing.\n\nYou have our sympathy.<p>Feel free to use this test when buying a PC or installing an Operating System upgrade.</ul>"
   document.write("<font color=red>Straining Browser and CPU....<font color=black>")
   for (i=0; i<100000; i++)
   {   morestrain()
   }
   var testcnt2=parseInt(testcnt)
   if (testcnt>=99999 && testcnt==testcnt2)
   {  var jsbomb="<ul><li> CONGRATULATIONS - YOUR JAVASCRIPT TEST WAS ABLE TO COUNT TO 100000 - MATH FUNCTIONS OF THIS BROWSER MAY BE ADEQUATE FOR ACCESSING A WEB BASED ACCOUNTING SYSTEM.\n\nThis system uses Banking Standard Double Entry Debit/Credit Accrual based accounting. Your PC (or Browser) passed the first test to do the job required. It managed to count to 100000 correctly without crashing.\n\nYour Tech did a good job of configuring the PC and Browers.</ul>"
   }
   document.write("<a name=\"SHOWTEST\"></a><center>TEST COMPLETE<br>If your CPU, Javascript and Brower are robust, the last number should be 100000 even (no decimals).<p></center>")
}

var dhtmlok=""
var jsok=""
var popok=""
var videook=""
var mp3ok=""
var perlok=""
var cookieok=""
var cameback=""

if (myref.indexOf("testdhtml")>-1)
{  dhtmlok="<ul><li> If you can see this message your DHTML is working ok and you may proceed with the other tests.<p></ul>"
   cameback="#seedhtml"
}
if (myref.indexOf("testjs")>-1)
{  jsok="<select ID=\"seestates\" name=\"seestates\">"
   jsok+=allstates
   jsok+="</select><p><ul><li> If you can see the U.S. States in a drop down box your Javascript is working ok.<p>If not, you will not be able to access the databases and many screens and financial reports associated with this website will not work.<p></ul>"
   cameback="#seejs"
}
if (myref.indexOf("testpop")>-1)
{  var gothere="http://goldpactpower.com/contact.html"
   popok="<ul><li> If a Window opened (pop up) to our Contact Form, your POP UPS are working ok.<p>If not, you will not be able to access the databases and screens associated with this website.<p></ul>"
   window.open(gothere)
   cameback="#seepop"
}
if (myref.indexOf("testvideo")>-1)
{  var gothere="http://eduhosting.org/windpics/windgenzen.wmv"
   videook="<ul><li> If a Window opened (pop up) with the inspirational video from the website www.windgenzen.com your video settings are working ok.<p>This feature won't affect your ability to use the website (except to see videos), but something may be wrong with your system.<p></ul>"
   window.open(gothere)
   cameback="#seevideo"
}
if (myref.indexOf("testmp3")>-1)
{  var gothere="http://goldpactpower.com/heehaw.mp3"
   mp3ok="<ul><li> If a Window opened (pop up) with the Gold Pact Power MP3 Radio Ad your MP3 Music settings are working ok.<p>You can still use the system, but won't be able to hear our great radio ad and something may be wrong with your PC.<p></ul>"
   window.open(gothere)
   cameback="#seemp3"
}
if (myref.indexOf("testperl")>-1)
{  var gothere="http://goldpactpower.com/userscripts/pss.pl"
   perlok="<ul><li> If a Window opened (pop up) and told you that you are not logged into the system, our Perl Backbone Server is working fine with your PC. If not, you will not be able to access the data on this website.<p>This is the most critical feature for logging in and accessing the financial report system and indicates something is severely wrong with your PC.<p></ul>"
   window.open(gothere)
   cameback="#seeperl"
}
if (myref.indexOf("testcookie")>-1)
{  cookieok="<ul><li> Your cookie feature is working correctly<p></ul>"
   var cookok=getCookie('peanutbuttercookie')
   if (!cookok || cookok!="tastesgood")
   {  cookieok="<ul><li> Your cookie feature is not working correctly<p>This is not critical, but may affect a few screens. We strongly suggest you set your PC to accept cookies from Gold Pact Power and our associated websites, but that is your choice.<p></ul>"
   }
   cameback="#seecookie"
}

if (cameback!="")
{  setTimeout("comeback()",10000)
}

function comeback()
{  self.focus()
   window.location=cameback
}

function testingjs()
{ var ok=confirm("READ THIS CAREFULLY\n\nThis next test will push the limits of your Browser's ability to do very simple computations (like accounting) by counting from 1 to 100000.\n\nA lot of messages will appear on the screen (100000 of them) telling you the test is pushing your Browser to the limits.\n\nYour Browser will ask you if you want to ABORT THE SCRIPT or KEEP RUNNING IT.\n\nLET IT KEEP RUNNING and then after it is finished (about 3 - 5 - 10 seconds depending on your PC), you should be redirected to the Javascript Test. If not, it probably failed so hit TAB once or twice and see if the U.S. STATES appear under the Javascript test.\n\nIf not, your Browser's MATH FUNCTION is inadequate for doing web based accounting produced at this website; don't even think about counting hundreds of millions of dollars with something like that.\n\nIf you are automatically redirected and see the U.S. States, that is a good start and you have a fairly good system for this type of computation. You may want to perform this test everytime you install any new software to see if it degrades your PC's ability to count money. If it can't count money - at least to 100000 - get rid of it.\n\nCPU TIME AND AVAILBILITY (especially math functions) are critical to having a reliable PC.\n\nClick OK to perform the test now or\n\nClick CANCEL to skip this test.")
  if (!ok)
  {  return
  }
  gosee('http://goldpactpower.com/fixpc.html?testjs')
}

function gosee(pass)
{ if (pass.indexOf("testcookie")>-1)
  {  setCookie('peanutbuttercookie','tastesgood',aday)
  }
  if (pass.indexOf("fixpc")>-1)
  {  setTimeout("self.close()",5000)
  }
  window.open(pass)
}

function setCookie(cookLbl, value, expire) 
{  document.cookie=cookLbl + "=" + escape(value) 
   + ((expire==null) ? "" : ("; expires=" + expire.toGMTString( )))
}

function getCookie(cookLbl) 
{  var search=cookLbl + "="
   if (document.cookie.length>0)
   {  offset=document.cookie.indexOf(search)
      if (offset!=-1) 
      {  offset +=search.length
         end=document.cookie.indexOf(";",offset)
         if (end==-1)
            end=document.cookie.length
            return unescape(document.cookie.substring(offset, end))       
       }
   }
}
