// Number Place Series Free
// (c) 2006 www.numberpuzzles.com Inc. All rights reserved.  
//
// Version History

// Global variables "NP_customerID" and "NP_puzzleID" will be provided by the customer web site.
// Based on these variables, we can use whatever logic we want here to determine which number puzzle to display.
if (window.NP_customerID == null) {
	NP_customerID = "Demo";			// use default value if this variable was not provided
}

// Global vars "NP_daysAgo" (and possibly NP_pubdateOffset) may be provided by the customer website.  
// If so, publication date will be used to derive the puzzleID.

if (window.NP_pubdateOffset == null) {
	NP_pubdateOffset = 0;
}
if (window.NP_daysAgo == null) {	// if Date not specified, use today
	NP_daysAgo = 0;
}

// Global variables OUT

var NP_soln;		// string representing solution is box-row-col order
var NP_mask;		// string representing starting state (1=revealed)
var NP_for_date;	// output string: publication date in pretty format
var NP_difficulty;	// output: one of Easy, Medium, Hard. Very Hard.  
var NP_data;		// output string representing puzzle
var NP_puzzleID;	// output string representing puzzle ID

// Hold puzzledefs in arrays

var NP_dateArray = new Array();
var NP_IDArray = new Array();
var NP_effArray = new Array();
var NP_solnArray = new Array();
var NP_maskArray = new Array();

function NP_addPuzzle(pubyyyymmdd,puzzID,effort,soln,mask){
	var year = parseInt(pubyyyymmdd/10000);
	var month = (parseInt(pubyyyymmdd/100) % 100)-1;
	var day = pubyyyymmdd % 100;
	var newdate = new Date(year, month, day);
	var newuct = newdate.getTime();
	var newdate = new Date(newuct+(NP_pubdateOffset*24*60*60*1000));
	var idx = NP_dateArray.length;
	NP_dateArray[idx] = newdate;
	NP_IDArray[idx] = puzzID;
	NP_effArray[idx] = effort;
	NP_solnArray[idx] = soln;
	NP_maskArray[idx] = mask;
}

// START OF PUZZLE DEFS --------------------------------------------------------------------

NP_addPuzzle(20060127,'24433362',441,'543827196187946523962135487978412365465379218213658749681754239732891654594326871','101000011110110000000011101111100000001110100000100111011000110001011001100011010');
NP_addPuzzle(20060128,'21606064',466,'716984325523671894498523761459837261182469735376152849673542198958316247214987635','011010010010000111100111000101100100001110010100100011001000111100101001011011000');
NP_addPuzzle(20060129,'36432624',2073,'389241765145673982267859314516427893394851267782936145678932154439516728521478693','100000011100011000100001100000011010110010000100000011101000100100001001000011010');
NP_addPuzzle(20060130,'92976922',421,'146789532895423167723615948895213674346579218172864359368921457752634981491587236','101110000000100111011001010111100000100000111000111001000011011011001010110100100');
NP_addPuzzle(20060131,'40830356',462,'176325894243198765985476321713582469682934517549617832658237941471859326293164758','011000101001110001100011001100000111111001000000111010010110001010110100110000101');
NP_addPuzzle(20060201,'23214418',521,'987231546453698712261457839378125694245369871196748523813459762526137984974682315','011010001011001010000011110001110010101110000001000111101100100110000101000111100');
NP_addPuzzle(20060202,'13269663',578,'148756239276493518359218674893514627657932184421867935965382471821745369743196582','100110100101000011100110001001111000011010010100000111011011000100100101010001011');
NP_addPuzzle(20060203,'49558359',640,'786594312321678954945312678651423978897165432234789561169245837583716249427893156','000110101111100000100010101000001111111100000100110010001110010010001011011001001');
NP_addPuzzle(20060204,'12686795',1317,'362758194451932768978461235617439285893215647524786193871923546526184379349657812','011010000010000011000110100101100000100110000000000111110001000000001101010001001');
NP_addPuzzle(20060205,'59371471',1460,'896534712231678549457129836967251483854793126312684795379128645415967382268543971','000101010100010010011000010001011000000000111101010000010100100001101000100000101');
NP_addPuzzle(20060206,'80702704',441,'196835472478261359523947861627514389895623147314798652943258761716934582285176439','111001000100110100000100111010000111111001000000111010110100001011010001000011101');
NP_addPuzzle(20060207,'66731668',462,'836457219795312468241986735748563921526179834193824567685372194947681253312459678','100011010000001111111100000100001110110010100100011100110001001101010001000011011');
NP_addPuzzle(20060208,'08315140',527,'761534892859261347234987516175243689694178532328695741458327916926415783173869452','100110001100011100011000101011010001000110101110010100000101110010001011111001000');
NP_addPuzzle(20060209,'83788365',529,'534721698261893457897465123352419867786325914914786352946175283172638549538249671','011110000110100001000100111001100011100001110011011000110100001000011011011100100');
NP_addPuzzle(20060210,'79516375',600,'523461897769582314184397625145739682278146953963852471218954376637821495549736218','010101010000110101111000001101110000001000111010101100101000011011100010000111010');
NP_addPuzzle(20060211,'62289542',1317,'984765312712483695356291487531648279269357841874129563193426857526178934748935612','100011000010010001100000101000110001110000100100010010111000000000001101000011001');
NP_addPuzzle(20060212,'70671690',1542,'893245167175368294462917538321584679746921583859673241412936758857412639396785124','010110000101100000000000111111000000000010101000110010101001000010001010000001101');
NP_addPuzzle(20060213,'09494150',418,'147352896593867412268914537283714965651239748479685321479521638126384975853796142','110100100100011100010100011001000111110110000001101100010011001001011001011000110');
NP_addPuzzle(20060214,'28491253',458,'869432175375681924241795836597283614248196537163574928758341926469752813312689457','100000111111100000000111010011110000000010111011010100010101001001101010101000101');
NP_addPuzzle(20060215,'46245903',500,'314978652589362714726145389269537481471698253538214697846723195125946837973851462','000100111111000100100111000011010100100000111100111000110001001001011010001010011');
NP_addPuzzle(20060216,'35332507',536,'789241536543679821216853794658123974432795186179468532867395412954218367321647985','011100100101110000000100111011110000011000011000011110011001100001110100100001011');
NP_addPuzzle(20060217,'67526186',599,'539184672278635194614792385243968715517342986869571423491857326763421859258936147','111100000100101100000100111111010000100011010000010111101001010001010011100011001');
NP_addPuzzle(20060218,'98144013',1297,'275316984834295716916487523421697538653128479798345261763859142941362587852174639','001011000101100000000000111110010000001100010000001011101100000010000011000110100');
NP_addPuzzle(20060219,'08685285',1647,'362145897579328461148796235519783624642915837387624519238456971796183254451972863','000010101100001100110100000101010000001110000000000111100011000011000010000001011');
NP_addPuzzle(20060220,'97674876',425,'524968371713524968869137425145896732632157849798243516487619253391275486652384971','010001011101110000001001011010011100101000011100011010100100101101010010100110100');
NP_addPuzzle(20060221,'01355273',464,'835927461179864235246531798158792643493516782627483915376589214921347658854162379','010110100011010001001001110111100000001010101000011101011001001100110100010100110');
NP_addPuzzle(20060222,'18348163',514,'168935724295746813743182956879256413364179528215438697392687541457931682861524379','111100000100110001000100111000101011011100001011010100110011000001010110100001011');
NP_addPuzzle(20060223,'31707758',578,'598324167472561398613879452635712849147986235928534761951283476624759813387146295','011110000011100001000100111000100111110101000011100001001110001101010010100010011');
NP_addPuzzle(20060224,'38147640',936,'492753186716289354358146927214675938673498521895213764867321549942865137531479682','001011000100010001010000110110000100010100100000011001101000010001010001000101100');
NP_addPuzzle(20060225,'07244670',1180,'978623451451798623236145879862139745374582916591467328297514386835267149614983752','010100100101000010000101010010010001110010000000100011000001101101000001010101000');
NP_addPuzzle(20060226,'49579716',2087,'872451369695372814413689572523148796968537241147296835235687914189423756764951328','100010100101100000000100011100000011000101010110100000010001001010001010010001001');
NP_addPuzzle(20060227,'32870442',439,'638214795579863412421957386146587923795234186832169745461859372327641958598273614','111100000001010110000110011111100000100100110000011011001011010001001011101100100');
NP_addPuzzle(20060228,'52837121',457,'572369184918245367634781592896713245472859631153426978638921457794586123215347869','110100100101001100000011011011101000010010011001001110011010001100001110100110100');
NP_addPuzzle(20060301,'97106647',518,'749235681856917342123468795178562493234189765956347812857924316691573428234681579','110011000110100010000010111000010111101010100011110000001101100001001011101001100');
NP_addPuzzle(20060302,'33606732',576,'426387519137594862985126734765138294489625713312497658641872953958341276273569841','100100011001010110101011000101000110110011000000110011001010011000101101111100000');
NP_addPuzzle(20060303,'74532908',594,'132894765679125348458763192546213978987456213231879546687321459592764831314985627','011011000010110100001000111111100000010110001000010111101110000001001101100100011');
NP_addPuzzle(20060304,'14150095',1193,'298314675465789312713562894562783149148296537379145286931856427824973651657421938','010110000010010100100000011011000100100011000000100110100001001000101001011000001');
NP_addPuzzle(20060305,'56095135',1565,'921465837368271945475839612314682579597413682268597143246753198839124756751986324','000011010011100000010000101010101000100100001001000110101100000010001010000010101');
NP_addPuzzle(20060306,'25668907',393,'857294361369571824412368795413928576256147938987536241785639142413782695629154873','100100011111010000000011101111100000100101001000010111011011000000010111011100100');
NP_addPuzzle(20060307,'75849795',495,'623859471147362598985147632345967182879214635261853479534796218981423756726518394','111010000010110100000100111011001100001000111100111000101100010101001010000011011');
NP_addPuzzle(20060308,'43358141',523,'483156279275439681196278543318524697746918523925367814962841735857362194431759682','110100100101011000000100111010010011100110001011100001001101001110010001100010011');
NP_addPuzzle(20060309,'05665803',575,'645897132798312564123465897256389714471256839389714256461973528927185643538642971','001100110000011101111001000010110100100100011011100010011001001110011000000100111');
NP_addPuzzle(20060310,'30102241',626,'358694127129537846476128935739465812685712493214389657541273986368954271792861543','100101010110100100010100011100011001110001010001010110011100010001001011100101001');
NP_addPuzzle(20060311,'95231521',1303,'897231645534697281612584973583764129149823765726159348458976312376412958291835467','110100000100011000000000111110010000100011000000000111001001001110000001000101010');
NP_addPuzzle(20060312,'18597275',1491,'126475389843291576957368142792834561354162789681579234643958217918627435725413896','010001001100011000001000110100110000001100100100000101101010000010001010000010011');
NP_addPuzzle(20060313,'74265337',408,'243158796967234581581796342321564987479812356865937214872415639643798125159623478','000100111001011010111010000111010000100101010000010111011100001110100001000101101');
NP_addPuzzle(20060314,'41194654',476,'271589643483612579695437812135824967867951234249376581356792418198345726724168953','001011001111100000000100111110110000000011011110000011011100100010101100010001101');
NP_addPuzzle(20060315,'02334291',527,'314625789867139254259487613456978132718623495932145876543297861986341572721568394','010001011111000010000111100010010101001101100101100010100101100001110010011000011');
NP_addPuzzle(20060316,'24324369',533,'568917423312648975794235681742135896589467231163928547689251374753894126412376859','101010010000100111011011000011000011010010011100111000101100100101101000000100111');
NP_addPuzzle(20060317,'19173265',848,'765849312214357698839261457178296453425831976693745128981524637562783149374916582','000100110011010000010100010000011001110000100100100010110001000000001101001001001');
NP_addPuzzle(20060318,'99578732',1160,'986423751127569348543817926392165874756482913481379652647539218235871694198264735','111000000000001110000011001000010011100001010011100000100101000010000101010100100');
NP_addPuzzle(20060319,'21969897',1447,'431568792875942136629317845813924657257613489496758132275389146361724598984561273','001011000100100100100000011100110000001010001001000011001100010010011000100000110');
NP_addPuzzle(20060320,'37125969',374,'536124897912387645748965123759682413861473259234591687278945361536128794419376852','000110110001011100111000001100001011101100100100101010000011101010010011111010000');
NP_addPuzzle(20060321,'85749334',456,'718569342342178569965423718837456921216937485549281376695284173721653894834197652','000101110111100000001001101001000111010011100110011000101010010010101001100010110');
NP_addPuzzle(20060322,'96041799',512,'879612543653498712241375968351284967876931524429657813436725198187369245592184736','001001011110001001100110010010111000011010100010000111110100100100110001001001101');
NP_addPuzzle(20060323,'60062551',592,'589213467346579128271468935834956721762431895159827643372695148914287653586314792','011110000110100100000100111011001100001100011010101010010101100001010011101001010');
NP_addPuzzle(20060324,'48679906',634,'124365897678129543953874612236759418784316952591428367583942671297861435146735289','000100111011110000011010010000001111110100001011101000011010100100001011100101100');
NP_addPuzzle(20060325,'06798691',1221,'951386247642957813378241695798612435435798126126453987829563174371284569564719832','010110000000100011011000100110100000001000110000011100001001001000100011011100000');
NP_addPuzzle(20060326,'21170759',2245,'689345127124976538537821496298716453341859267675342918972534861485612793163789254','010010100100101000001000110000011001010100010011000100101000100010001001000101010');
NP_addPuzzle(20060327,'04745305',385,'639857412245136879781294356523178946461952387879463512385791264694523718127648935','101100100100011100100100110111010000100101001000010111001011010010010011011001001');
NP_addPuzzle(20060328,'96023065',473,'978654312123879456564123798463589721218367594975412836895137246732645981641289357','101010001100010101010011010110000011101001100000111001110101000010010011100100101');
NP_addPuzzle(20060329,'64883077',511,'361472958459138762728695341539214687216387594874569132843125796971643825256987413','010010101010101100011100001110011000100110010010000111100101001011001001001100110');
NP_addPuzzle(20060330,'49429500',546,'415837269927645183863129475546173928798254316231986547654782391831569472792314658','001010011011001001010110100000001111001110010111100000110100100100100110001011001');
NP_addPuzzle(20060331,'66735607',630,'198325674567481932342967581869532417214678359753194628986741253123895746475236819','000011101010110100111000100000111010011100100101000110011100100011001001000011011');
NP_addPuzzle(20060401,'08649343',1102,'348716259726539148159482637672491583983657412541823796165937824294865371378214965','011010000100001100000100011011100000100010001000001011001100100011000010000110100');
NP_addPuzzle(20060402,'74511337',1629,'425869371379241658681735294946213587523784196178956423732194658465832917819567342','110100000001110000000000111000111000101000100100000110010001001010010001010001001');
NP_addPuzzle(20060403,'28926367',449,'512867934496123875378495621725689341318247659946153782276458193534961782819237564','100010011010110010011100001011010001110000101000111100100100101101001001100011010');
NP_addPuzzle(20060404,'72985256',482,'897635124126749835543812976718943256692578413354621789581372469364981257297465138','001100011101000011001111000010010101110011000100100011111000100100001110000111010');
NP_addPuzzle(20060405,'55567670',525,'672314589839657412145829673861235947245796381397418562196428753528173964734956281','100000111110101000100110100110001001011001001000101011001110010010100110011001010');
NP_addPuzzle(20060406,'27821380',572,'512386479867924135439571826697843125513276489284915763764931258398752641152648397','111001000000011011100100011001101100001011100101000101010010110110100100010011010');
NP_addPuzzle(20060407,'35312772',626,'214753896698241573753869124427938561315764982698512347649172385857436129231985476','011110000011000011000011110001011100001011100110000011101100010110100100000101101');
NP_addPuzzle(20060408,'51463425',1287,'563421978978653241241798365142635897869724135537819426714386259592417386683952174','100001001110010000000010011011010000001100100000100110100100010001000011001101000');
NP_addPuzzle(20060409,'59452599',1440,'685721493341689275927543618876234519913856427452179386358947162162538794794261835','100000011011010000000011001101100000010100001000010101001010010000100101110100000');
NP_addPuzzle(20060410,'44148010',439,'781243956359186274462579318128594367963712548745836291472639815891425637653187924','101110000001001101010001011111100000001010110000011101010011001100010110110100100');
NP_addPuzzle(20060411,'76223254',488,'356789412412635879789412563165827943923154786847936251638271594597348261124695378','101110000110100100000001111000010111010111000111000100010101001011001001010010101');
NP_addPuzzle(20060412,'76026928',514,'291356487687214935435897126735924168421863759689571342679542813148396572253718964','010110001111010000000100111011101000000001111011010010000100111110100001101101000');
NP_addPuzzle(20060413,'92267358',534,'534289617691754238827136594968421753475863912213975468846172395329586147751349682','001011100101100100001010101100010101101001010100011100111010000010010011000110011');
NP_addPuzzle(20060414,'47957915',611,'351267894467598312982134765423685719651279843897413256578936142126784935349521678','001110010101110000001000111010101010101100001010100110100001101011010010010101001');
NP_addPuzzle(20060415,'98957825',1151,'832947651697158342145362789123769584584231976976458213498315276725469813631827594','101100000100110000000000111101010000100011000000000111001010010010001001100010001');
NP_addPuzzle(20060416,'94065905',1870,'178946325352817496946523871892413567645728931317695482234789651579163284168254739','111000000000110001000100110011000001010101000000100011110000100001010100000011001');
NP_addPuzzle(20060417,'48001111',334,'798264351651379248243518796149573682823164795675982134837926415512487936469351827','000100111110011000110010100101010100101011000000001111001011010000110101111000001');
NP_addPuzzle(20060418,'63736761',478,'592634817317598246684127359463285179985671423712493865928751346764839152531246978','000100111111100000100110100111100000010110100000010111000011011011001001011001001');
NP_addPuzzle(20060419,'54494673',522,'461752389789634152235981746876134295415296873392578614923648517541327968867159423','100000111100101010011011000010010011111001000000101011001100101011010100100110100');
NP_addPuzzle(20060420,'65223497',581,'436257189591683724827149365948621375356479812712538694813562794245937168976481253','111001000000010111010110100111001000100000111000111001100010110111001000000101011');
NP_addPuzzle(20060421,'72694945',618,'946521783871934562235768149157638294246159783893472516865479312317625498924381657','000110110100101100111000010110101000110001001000001111001011001010011010110000101');
NP_addPuzzle(20060422,'85612214',1385,'897413562342567189615829347259678134813294675764531298946381725728956431153472986','011010000100110000000000111010000101110001000000011001100000101011001000000110100');
NP_addPuzzle(20060423,'24285072',1958,'246789135815634927793521468657394812491782563832615947961573428278149356354286179','100101000110100000000000111111000000000101001000010110001010010001010010100001001');
NP_addPuzzle(20060424,'10680139',433,'289613475513724698476589312157924368486351972923867154892736541137845269645291738','100101001000001111111100000010101010110110000010000111101010010011001100000101011');
NP_addPuzzle(20060425,'66816777',493,'249315867317268459586974231521638974746192583893457162182453796635971824749628315','110110000011010100000100111011010001000001111101011000101000101011100100000111010');
NP_addPuzzle(20060426,'25901240',524,'435621798197834526268957413173849256952361478684725139914382567685719243372546891','000011011001110001111000001010010101111000010000111100101100100110101000000010111');
NP_addPuzzle(20060427,'59264082',557,'148569732765213489923748561381624957954378621276159384896273415537146892412895637','100001110011000101100111000010101001110000011010011100110011000011100100000001111');
NP_addPuzzle(20060428,'66453445',604,'582637419134259786679841235763895241945312678182467593324156978567893421918724356','111000010000101011010110100110001001011011000000100111110101000100100110001001011');
NP_addPuzzle(20060429,'59210700',1382,'451693872792458361386712459127589346934176285865234197918735264647829513523641978','001100100110100000000100110111000000000001011000101010001010010010101000001000011');
NP_addPuzzle(20060430,'23501098',1923,'986573241142896357753124896312754698689213574547689312827169435435728961961435278','101000100010100100000101100000010011100001001011100000101010000001010010000010011');
NP_addPuzzle(20060501,'68990946',434,'134726958986354271572918346863412579149567823257893461345697281718432695629185734','111100000100110100000001111100111000110000011010001011001011010001001011110100100');
NP_addPuzzle(20060502,'24228352',474,'798253614623491857451768239386471925572369184194825376167532849245918736983647512','001111000001100101011000011011110000001100110100001110101000110011010010000111100');
NP_addPuzzle(20060503,'21656501',497,'853462197417839562629571384248619375753248691196735842926734581385126974417958263','000110101110101000011000101101000110010100011100111000001010011100001011011110000');
NP_addPuzzle(20060504,'54614329',536,'495137862621845973387926451346521789598734162172698534954213678286457319713869245','010101100001110010101000110001111000010100011110000101111000010000101101010011001');
NP_addPuzzle(20060505,'31511301',608,'714385269568972341239461875572846931813297654946513728623198457785426139194357682','011100010100000111010111000111010000010011100000100111100001101001110001101010001');
NP_addPuzzle(20060506,'68908000',1222,'264598371135476892798132564685739412914258763327641985923857146581649327476213859','111000000000011100000100011100101000100010100100000011000011010001000011101010000');
NP_addPuzzle(20060507,'00539249',1560,'693458127827691534415273689379281546156943278842567391934865712782319465156724938','010010100100010100001010100000001110001001100101100000101000001010010001000011010');
NP_addPuzzle(20060508,'12580192',361,'124586793368972154759143628319268475245713689867495312651842937897531426234976581','011010010000001111110101000000110101011101000110000011001100101110110000010001101');
NP_addPuzzle(20060509,'02841806',468,'978245361456713289231698457614837529592641378783925146786193452925864137314572869','101000110001111000100001011101000110100101001100101100010011001110010010010010011');
NP_addPuzzle(20060510,'78998035',518,'312947586795861342468253917798421653613587924524396781269835174438179256175642839','101110000110100010000010111010001101011110000001010101100010011101001001100101010');
NP_addPuzzle(20060511,'04934764',584,'248675139135948726697312854893526417417389562265471938361782954854691273729543186','110011000101010001000100111001011001100110010011000110100110100100001011110001001');
NP_addPuzzle(20060512,'54803902',632,'482391657957682341631574928513274968876195234492386157845726139763519428219843765','110001001010100110010110010010001110111010000000110101100011100001001101101001001');
NP_addPuzzle(20060513,'24227083',1106,'342567891619483572857291643789425613156397824432186975136258974748931265529764318','111000000000010011000011100011100000100101000000000111111000000000000111000111000');
NP_addPuzzle(20060514,'77749515',2084,'892153674167894253534276918437581269526349781891627345716925348935478612482163759','101001000100001010000100110111000000000001110000110001000010110001100010011001000');
NP_addPuzzle(20060515,'61606318',414,'623789145951324678478156329314592876792816435685743291257438961183269547964517832','101101000000011011011000101111001000100010011000011110110010010100100101100011100');
NP_addPuzzle(20060516,'96375704',469,'789134526156792384324865197971843265465279813238516479417652398638941527952783641','100111000011100100100000111101010100010000111100111000000011011011100001011001010');
NP_addPuzzle(20060517,'73734379',522,'726345819493281765158697342937158462612374958584269713571694283829137546436825971','000110011100001101111001000001010011100010011110101000100100101011000110010111000');
NP_addPuzzle(20060518,'17514688',541,'968152734321674958745839162495673281182549736376218954827316549463295817591487623','010000111011110000010101100100110100101110000100000111011001001011100001000011011');
NP_addPuzzle(20060519,'97760201',627,'674251389983746251125389674897413562312675498456892713746935128129867534538241967','110001001010000111100111000100100011001111000011000110011110000010100101010001101');
NP_addPuzzle(20060520,'25774682',1129,'128534796697812345534697128917863452286451739345972861271389645563124978489756213','100000101010110000100010001100001001001110000100000011010010010101001000000100011');
NP_addPuzzle(20060521,'08531737',2024,'234651897671948352598273614925176483467839125381425769512348769784296513936157842','100101000001000011100100001011100000100011000000000111000010011110000100010011000');
NP_addPuzzle(20060522,'38272232',429,'586379241917452683234168579918625734746391528325847916862493157179265834453781692','111010000100001011000110101001100101100111000011000011000011110110011000110000101');
NP_addPuzzle(20060523,'41280121',472,'928637514517924683643158297476189352238456791519732864841265793375849162926371485','100010011101010010001011001010011001110110000010000111100101100001001101110100100');
NP_addPuzzle(20060524,'40770090',511,'524613897738954261619728435756182349823495176941367582935278461612349587874156293','001010011111001000000101110111001000010110001000100111110100100010101100010001011');
NP_addPuzzle(20060525,'25752181',585,'879241365241356879653978142432756918687192435591834267694127583728563914315489726','111000100010001110000111010001011100111100000000001111001110010010001101011100100');
NP_addPuzzle(20060526,'17247403',722,'452681937193547268786239514293568714451379826678142953126849375734615982895327461','011010000000110010001000011011000100100010001000011010101100000000001101100100100');
NP_addPuzzle(20060527,'09596556',1372,'621789534345612789987534216973245168261978534845361792397412856426853197158679423','001010100000101001101000010001110000101000010000001011111000000000110010000100110');
NP_addPuzzle(20060528,'53940934',1619,'839127456274653198651498723512698743846735921379142586371285964489367512265914837','111000000000010101000110010111000000000110001000100011001100010010001100001100001');
NP_addPuzzle(20060529,'89430684',404,'251689473793415862864372915867312594549687321231459786935726148174958236628143597','110101000101010100000001111111000001100010110000111010011010100011001001000110101');
NP_addPuzzle(20060530,'95818859',492,'893215647517643892642978351954136728761284935283597164581369472426178359739425816','101110000000010111101010100000001111111010000100101001111010000000101101010010011');
NP_addPuzzle(20060531,'79113787',507,'142795368357682149896134572256983471978416235413725968627539814594821763381647259','010100101100100011101110000101110000010000111100101001000011011101001010011010010');
NP_addPuzzle(20060601,'22218543',546,'867945213251736984943128567681534729579612843432789651476158392398427165215396874','011110000001011010100000111001110001010110001101000101001110100101100100010010011');
NP_addPuzzle(20060602,'49092376',610,'945623817137845692826791534374586192218974563965213487238459761751386429649172358','001011100100110001011000110011110000010101001010000111111000100010101010000101101');
NP_addPuzzle(20060603,'17480338',1165,'695871342834926157127543698157968234493215768286734951729486513381572649465319872','011010000000001101010100001101000010100100010000011010100001100011000010000101100');
NP_addPuzzle(20060604,'83914995',1418,'451387926269541738873269514635798142824613957791452386273569814186472395945138627','010110000001100100001000110010001100110010000000100011101001000010001001000010101');
NP_addPuzzle(20060605,'20741421',440,'958421637236795418714836259769182543523647981481593627274396815159872364368145972','111100000000011110100100110000101110011110000011000110000011011101001100011001001');
NP_addPuzzle(20060606,'37122333',492,'692471358435896172178235469849735126561249783327816594964217583318654927752983641','000001111001011100111001000001101100110100010100100011110010010101000011000111010');
NP_addPuzzle(20060607,'19092703',508,'179345286342968715568271943628914537579236481134857629761452893853197624492386715','001110010000001111111010000000101110001110010111000100010001101000101110111001000');
NP_addPuzzle(20060608,'40305197',574,'426317958857294136139685742163789542482563719597214863295831674648975321371426958','010011001100000111110101000110000110110101000000011011001101100001010011011100100');
NP_addPuzzle(20060609,'01050252',626,'124356897376289145895714326568719432493862517172453689981673245654928731237541968','000001111010101100111100000001001110101010001100110010000110110101010010011001001');
NP_addPuzzle(20060610,'81091201',1323,'457891263932675814618234795124386975359741286867529143739518642128463597456972381','001011000000001011101000100011100000100100001000010101010100100010110000010000011');
NP_addPuzzle(20060611,'25244159',1823,'683941572452837619971265384798216354345798261126453798169427835573186924842539617','000010011111000000000011100001110000011001000000000111001100100110100000000001110');
NP_addPuzzle(20060612,'93431801',416,'713958246492361758865724139321697584679845123458312697139472865284516937576983241','100100110000011011111100000011100010001000111010111000001011001100110100101000011');
NP_addPuzzle(20060613,'12287766',457,'689123754735469218412587639815932467693847521724156893596248371172356984348971265','001110010100010011110100010001110100000110110111000100010001101101001001001011001');
NP_addPuzzle(20060614,'65337843',512,'985347612312695478476812935738524169156739824249168753871293456963541287524687391','110001100100001011010011010001010110010001011101101000011100001110100100000101110');
NP_addPuzzle(20060615,'98467720',552,'134579268867231459592846713821457396374916528965238471915743682642185793387629154','010000111100011010011011000001001011011100001100110100110100100010100101001110001');


// END OF PUZZLE DEFS ----------------------------------------------------------------------


// RETRIEVAL AND FORMATTING FUNCTIONS

var one_day = 24*60*60*1000;

function NP_formatDate(uct){
	var thedate=new Date();
	thedate.setTime(uct);
	var year=thedate.getYear();
	if (year < 1000) year+=1900;
	var day=thedate.getDay();
	var month=thedate.getMonth();
	var daym=thedate.getDate();
	if (daym<10) daym="0"+daym;

	var dayarray=new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday");
	var montharray=new Array("January","February","March","April","May","June","July","August","September","October","November","December");
	return (dayarray[day]+", "+montharray[month]+" "+daym+", "+year);
}

function NP_formatDiff(effort){		// Produce pretty version of effort - use July2005 scale
	if (effort<530) return 'Easy';
	if (effort<650) return 'Medium';
	if (effort<1300) return 'Hard';
	return 'Very Hard';
}

//function days_between(date1, date2) {
//    var date1_ms = date1.getTime()
//    var date2_ms = date2.getTime()
//    var difference_ms = Math.abs(date1_ms - date2_ms);
//    return Math.round(difference_ms/one_day);
//}

function NP_lookup(daysago){		// Look up puzzle by daysago
	var targdate = new Date();
	targdate -= (daysago*one_day);
	NP_for_date = NP_formatDate(targdate);

	var numdays=parseInt(targdate/(24*60*60*1000))-daysago;
	var idx=(numdays+6) % NP_dateArray.length;
	NP_puzzleID = NP_IDArray[idx];
	NP_difficulty = NP_formatDiff(NP_effArray[idx]);
	NP_soln = NP_solnArray[idx];
	NP_mask = NP_maskArray[idx];
}

function unused(){ 	// delete later


	var td_ms = new Date.UTC();
//	td =- (daysago*one_day);
	var dawn_ms = new Date.UTC(2005,12,31);
	var diff_ms = td_ms - dawn_ms;
	document.write('diff_ms='+diff_ms);
	var diff = Math.round(diff_ms/one_day);
	document.write(' diff='+diff);

	var idx = diff % NP_dateArray.length;

	NP_puzzleID = NP_IDArray[idx];
	NP_difficulty = NP_formatDiff(NP_effArray[idx]);
	NP_soln = NP_solnArray[idx];
	NP_mask = NP_maskArray[idx];
	
}

// Retrieve puzzle by number of days ago

NP_lookup(NP_daysAgo);

// -----------------------

