// RetroFrog CharPane Recasting Script
//
// ==UserScript==
// @name           CharPane Recasting Script
// @namespace      http://retrofrog.hardcoreoxygenation.com
// @include        *kingdomofloathing.com/charpane.php*
// @include        *127.0.0.1:600*/charpane.php*
// @include        *kingdomofloathing.com/*
// @include        *127.0.0.1:600*/*
// @description    Version 1.0
//
// ==/UserScript==


/********************************** Recent Changes **********************************************
Recent Updates:
	1.0	Fixed the problem with compact mode/replace icons with text made some stati not work & removed the amount selection
		options. (Possibly a similar problem with other configurations.)
		Updated to 1.0 for no good reason.
	0.9.1	NS-13 - bunch of new effects, updated effect ids (thanks hola!)
	0.8	Switched the way the charpane reloads, should be much faster now (thanks for the tip, bigfreak)
	0.7	Added the option to hide the results from buffing (the charpane will still reload on success, so
		you'll know it succeeded if you magically have more of the buff)
		Added options for what to do when clicking on some of the negative status buffs
		Added option for maximum number of times you want to recast (i.e., how many radio buttons show up)
		Added option to shrug applicable effects via right clicking on the effect
	0.6	Fix conflict with the WISNAR recasting script, insert results into the current page instead
		of replacing it, lots of new config options (Tool menu), heal by clicking on the hp (requires configuration),
		added the new effects from the manor
	0.5	Replaced the icon with text in brief mode, colorized turns left if < 5, allow you to choose
		number of times to rebuff (thanks CDMoyer for the ideas!)
	0.4	Made it a little more clear which icons will actually recast/reuse; added some more effects
	0.3	Updated with a lot of item effects, so that clicking on those will attempt to reuse the item
	0.2	Updated to cache the user data, so it is much faster to run.  This fixes the annoying
		issue where if you click too fast after the pane has refreshed, you get the help instead
		of a cast
	0.1	First version!  Replaces the help text you get when clicking on the effect image
		with a (single) recast of the skill.

********************************************************************************************/
GM_setValue("scriptVer","1.0");
GM_setValue("scriptName","CharPaneRecast");
GM_setValue("scriptURL","http://retrofrog.hardcoreoxygenation.com/charpane_recast.user.js");

var SGEE = 588;
var DEF_QUANTITY_KEY = "RetroFrog_CharPane_Recast_Default_Quantity";
var REPLACE_ICONS_KEY = "RetroFrog_CharPane_Recast_Replace_Icons";
var COLORIZE_KEY = "RetroFrog_CharPane_Recast_Colorize_Durations";
var ROLLOVER_EFFECT_KEY = "RetroFrog_CharPane_Recast_Rollover_Effect";
var REPEAT_MAX_COUNT_KEY = "RetroFrog_CharPane_Recast_Repeat_Max_Count";
var DISPLAY_RESULTS_KEY = "RetroFrog_CharPane_Recast_Display_Results";
var NEG_EFFECTS_ACTION_KEY = "RetroFrog_CharPane_Recast_Negative_Effects";
var NEG_EFFECTS_ACTION_KEY2 = "RetroFrog_CharPane_Recast_Negative_Effects2";
var NEG_EFFECTS_ACTION_NOTHING = -1;
var NEG_EFFECTS_ACTION_POWERNAP = 5007;
var NEG_EFFECTS_ACTION_DISCOPOWERNAP = 5011;
var NEG_EFFECTS_ACTION_SGEE = SGEE;
var BEATEN_UP_ACTION_KEY = "RetroFrog_CharPane_Recast_Beaten_Up";
var BEATEN_UP_ACTION_NOTHING = -1;
var BEATEN_UP_ACTION_OTTER = 1007;
var BEATEN_UP_ACTION_WALRUS = 1010;
var BEATEN_UP_ACTION_HOUSE = 592;
var BEATEN_UP_ACTION_SGEE = SGEE;
var POISONED_ACTION_KEY = "RetroFrog_CharPane_Recast_Poisoned";
var POISONED_ACTION_NOTHING = -1;
var POISONED_ACTION_ANTIDOTE = 829;
var POISONED_ACTION_SGEE = SGEE;
var QUANTITY_LISTBOXES_KEY = "RetroFrog_CharPane_Recast_Replace_Radios_With_Listboxes";
var QUANTITY_DISPLAY_KEY = "RetroFrog_CharPane_Recast_Quantity_Display";
var QUANTITY_DISPLAY_TOP = 1;
var QUANTITY_DISPLAY_BOTTOM = 2;
var QUANTITY_DISPLAY_BOTH = 3;
var QUANTITY_DISPLAY_NEITHER = 4;
var HEAL_DISPLAY_KEY = "RetroFrog_CharPane_Recast_Heal_Skill";
var HEAL_ACTION_NOTHING = 0;
var HEAL_ACTION_COCOON = 3012;
var HEAL_ACTION_WALRUS = 1010;
var HEAL_ACTION_OTTER = 1007;
var HEAL_ACTION_LASAGNA = 3009;
var HEAL_ACTION_POWERNAP = 5011;
var HEAL_ACTION_DISCONAP = 5007;

var shrugArray = {
	"18":"Ghostly Shell",
	"19":"Reptilian Fortitude",
	"48":"Smile of Mr.",
	"50":"Empathy",
	"51":"Tenacity of the Snapper",
	"52":"Astral Shell",
	"53":"Elemental Saucesphere",
	"54":"Jalapeno Saucesphere",
	"55":"Jabanero Saucesphere",
	"60":"Aloysius\\' Antiphon of Aptitude",
	"61":"Moxious Madrigal",
	"62":"Cletus\\'s Canticle of Celerity",
	"63":"Polka of Plenty",
	"64":"Magical Mojomuscular Melody",
	"65":"Power Ballad of the Arrowsmith",
	"66":"Brawnee\\'s Anthem of Absorption",
	"67":"Fat Leon\\'s Phat Loot Lyric",
	"68":"Psalm of Pointiness",
	"69":"Jackasses\\' Symphony of Destruction",
	"70":"Stevedave\\'s Shanty of Superiority",
	"71":"Ode to Booze",
	"162":"The Sonata of Sneakiness",
	"163":"Carlweather\\'s Cantata of Confrontation",
	"164":"Ur-Kel\\'s Aria of Annoyance",
	"224":"Scarysauce",
	"225":"Dirge of Dreadfulness"
};

var effectArray = {
	"":1, //Light!
	"35b38533640fed03c12460b1dca98e81":2, //Sleepy
	"d335051a5afb4fa12036998ac13f167b":3, //Confused
	"c489e39537ea426cd1b8fae88ed5032c":4, //Embarrassed
	"5ad503e9df2df73bfbbb5377b622c8c4":5, //Far Out
	"8cdb75aeb628bb9b9594908b7d0bfa74":6, //Wings
	"acf143c704afaf7504ac07375084f79e":7, //Beaten Up
	"13e148b2f71301e54e27001d6e603584":8, //Hardly Poisoned at All
	"12f74ff515842399be4b67bbc3550f79":9, //Knob Goblin Perfume
	"28abefa0a5f2e63058cdb32e0a23b131":10, //Steroid Boost
	"3e2c81c59d65d6e8332d64e073f6cc18":11, //Knob Goblin Lust Frenzy
	"ac188a357b0bfba487c9308ffa3af551":12, //Sharp Weapon
	"":13, //
	"b7bda390dc07f7526b12bcfcede19d36":14, //Hennaliciousness
	"21bbf1fc30240ba896c783e810fc737b":15, //Bloody Hand
	"2d6d3ab04b40e1523aa9c716a04b3aab":16, //Leash of Linguini
	"83695b70e0470a36125feca3198a16b4":17, //Sugar Rush
	"9d5cb67507556bb105664b1dc9e8bf9a":18, //Ghostly Shell
	"6c7b4a5a3c6807d21493f1253bf8dfd9":19, //Reptilian Fortitude
	"8ae7c039ea59f198c8a56228ea63dc1f":20, //Uncertain
	"93e55821ba196181627eae905eb1f052":21, //Seal Clubbing Frenzy
	"13d514f97d8701d2507c8623b88897ff":22, //Patience of the Tortoise
	"583619abc0e4380d80629babe3677aed":23, //Pasta Oneness
	"2817b71ed041fdffb5b4b514c8be662d":24, //Saucemastery
	"869b501ce3b0e8ba139e7f3807db0c1f":25, //Disco State of Mind
	"c0a491f833b3490be4763e48a0a4c317":26, //Mariachi Mood
	"79bc05cd8f6cdf869c66a840f79ce2d3":27, //Temporary Lycanthropy
	"04bc18fe47f495a894774fa1bbb9713d":28, //Butt-Rock Hair
	"20f081726fb8cfa9a64736d6fb8333a4":29, //Contemptible Emanations
	"fd5616e89e1c2ecb0b01b61929682d2d":30, //Incredibly Hulking
	"2ca6aa31e5eed5cd125e9fd374b74a78":31, //Superhuman Sarcasm
	"1eb060ef5cd5a7cff1a210edc5b62748":32, //Tomato Power
	"e176f70d3a673e928e6c93aa523b5e14":33, //Phorcefullness
	"e4f2a1e71b5609afa4ad710a4a37cbdd":34, //Pronounced Potency
	"7cb1ce3c6611696ed66b0f180fcb79d4":35, //Concentration
	"df21506858f7dfabf69c62d6562dc574":36, //Mystically Oiled
	"e29bedb34840827fd6c9e6887d04d2b4":37, //Expert Oiliness
	"22a24325a136bd388cd85852ffee92e3":38, //Gr8tness
	"eb4f2cac29d8c2a73a6b0f1d532f61c9":39, //Hernia!
	"e0e05fe6a88713716c5f8644379c1aeb":40, //Red Neck
	"8b5481d9989685d266fcbb5028cd6929":41, //Chapped Legs
	"309b9f895dcc011a120b12453c1bc7e5":42, //Sunburned
	"84e619e8ff038d639085cbe8ea74752b":43, //Wussiness
	"cf78b055a699cad5e45443be2345a354":44, //Draggin' Balls
	"70679877d6ac73627d6576ca7cb72f62":45, //1337p4n7Z
	"89acaef20b7c355d36fdf0990bf6a5ec":46, //Spiky Hair
	"b00a05823151fd7e6c8fe7697c0420ca":47, //Complete Delusion
	"59e9f58e87d531b3ef613515a3417210":48, //The Smile of Mr. A.
	"a02c6fb27a3f9f4bf2c48d59584adc56":49, //Macho Profundo
	"ac32e95f470a7e0999863fa0db58d808":50, //Empathy
	"c05dc4b01f6f2826be599f07620979f7":51, //Tenacity of the Snapper
	"4e66acac6b908fb6f70b49092dcff375":52, //Astral Shell
	"e3d1d1099648703e192a55a9aea17a1e":53, //Elemental Saucesphere
	"432fc725db5720e9237438147bc6516e":54, //Jalape&ntilde;o Saucesphere
	"bf3c7c4fa0642b582ad55a36f1105b82":55, //Jaba&ntilde;ero Saucesphere
	"621865253dfe04259868b41e367a62e8":56, //Extreme Muscle Relaxation
	"a47ef21c02a4b8ba3b1da929f4566934":57, //Rainy Soul Miasma
	"cb5404472a27b435aa6fad1ba528b1b8":58, //Teleportitis
	"0f35dcc9f22cd0ee2e6ef690c3512a01":59, //Wanged
	"3f875f7c9c4cc7b64f4c7d7b7eea1ef6":60, //Aloysius' Antiphon of Aptitude
	"c77eb3298c1bcba5e0147eba77a5a802":61, //The Moxious Madrigal
	"fe25963fb651fc5d81ed5a098b509030":62, //Cletus's Canticle of Celerity
	"c26a911b8ec2c57f7eef57f9ff5fdc24":63, //Polka of Plenty
	"80224f21d262123e7e370d440ce36937":64, //The Magical Mojomuscular Melody
	"695f24467176d2e76738e7c5e1148a42":65, //Power Ballad of the Arrowsmith
	"bcbbb5a02c92d158e45fd9c736950380":66, //Brawnee's Anthem of Absorption
	"63e73adb3ecfb0cbf544db435eeeaf00":67, //Fat Leon's Phat Loot Lyric
	"5abc19b33b53e0cb7749472a07311c6a":68, //Psalm of Pointiness
	"fca62260f2f750e32f104f868ed1a3a5":69, //Jackasses' Symphony of Destruction
	"2e5a803cf1be5b3d2aaa897e60f29138":70, //Stevedave's Shanty of Superiority
	"626c8ef76cfc003c6ac2e65e9af5fd7a":71, //Ode to Booze
	"":72, //Sleeping with the Fishes
	"6e54ea1584f2410c94c93032c5a038f0":73, //Ticking Clock
	"a12c86c626c44ecd48540d1e55bf1204":74, //Fresh Scent
	"70ff46e1347de854172cb7a644f2854e":75, //Hippy Stench
	"":76, //Wreathed in Merriment
	"":77, //Fury of the Bells
	"":78, //Yuletide Sappiness
	"":79, //
	"c6100ac99a847dc3b60d9f8c1a2c223d":80, //Missing Fingers
	"":81, //Gnawed-Off Arm
	"":82, //Broken Knees
	"":83, //And Your Family Too
	"":84, //
	"":85, //
	"":86, //Missing Eyebrows
	"":87, //
	"":88, //
	"5a7834b36760978ce7766b95753fa4f2":89, //Tingly Wrists
	"54aa2c7ffc56b273ae9a6bfe26f10aad":90, //Tingly Elbows
	"fbf879a2f5e27198361d24f57cfd1130":91, //Tingly Biceps
	"652fac966f18c8d0051cc3af5ad42740":92, //Sticky Hands
	"58e37fc744c725866f00b6e96da534a8":93, //Clean-Shaven
	"":94, //Aspect of the GravyPlum Fairy
	"":95, //Rushin' Hands
	"":96, //Reedy Pipes
	"":97, //Oriental Mysticism
	"":98, //Arabian Knighthood
	"":99, //
	"8a69297f136daef36aea0330f986bc78":100, //Stabilizing Oiliness
	"1598c6d326da799034f65bc9da00c288":101, //Slippery Oiliness
	"24e328972b5792ebdde69889edf2edc9":102, //Strength of Ten Ettins
	"d7d4abd1987ec257ebf1b386a9060052":103, //Strange Mental Acuity
	"2b0bab3aa6c3cabbe27d693dc4a2c8c0":104, //Izchak's Blessing
	"8af5fd34414f0f52907fabfa3287fa2b":105, //Corroded Weapon
	"8a3629f6e6d964a3e491b3a393348a46":106, //Canadianity
	"":107, //Enraged
	"":108, //Ancestral Disapproval
	"0f3c00c6477cf3c3ca13602bfee2d863":109, //Whitened Teeth
	"061ca4225eeb3189b93a4a6c5e47351e":110, //Hopped Up on Goofballs
	"29b44ff4d574d3698bb85eb97c4d37bc":111, //Goofball Withdrawal
	"ea9571b76d8c4d7df9ba47e27058bcf2":112, //Antsy in your Pantsy
	"ab4ca3339e28ef091322625f1b62c71b":113, //Popping Stomach
	"99f5e9eb51172bcac524605eace88feb":114, //Dwarven Hardiness
	"4ecdbe1ae06dfa3e3caa02cbf3676ffe":115, //Apathy
	"93a84005b9089f8b39237450c0af0ff3":116, //Radio Head
	"587b577f3cf49f2d944450aa4751584d":117, //Free Bird
	"c182e3297f3732ed05601d63d5980f1d":118, //Shiny Happy Weapon
	"68ea640257b2b74627e74ce275a555fc":119, //On the Shoulders of Giants
	"":120, //Shot in the Arse
	"4bd0338c8030f6aaa95ea5eda777484c":121, //Cock of the Walk
	"5ca8ae9f3177d3f1bfee8ceccde554b7":122, //Eggs-tra Sensory Perception
	"3cef8a2a9750292400d4380caacda408":123, //Egg-stortionary Tactics
	"f571d1555a2465e9e8fb0fb3b31b18e5":124, //Egg-stra Arm
	"e6b783e02fa92072ca81c7585912ba37":125, //Egg-headedness
	"f7347c1d229420acff2226dac4125a0a":126, //Egg-cellent Vocabulary
	"06cb86ddd689278c5af31423a8210a72":127, //Gothy
	"e91ceabee446030ff33cc79d06a8d551":128, //Flower Power
	"19a38797f559f112930b8d33f3dd48e3":129, //Eye of the Lihc
	"bb44871dd165d4dc9b4d35daa46908ef":130, //Springy Fusilli
	"5c8d3b5b4a6d403f95f27f5d29528c59":131, //Rage of the Reindeer
	"1ff58ec4d8337eaec65044933bf7ab34":132, //Engorged Weapon
	"dfcd77bff25d3dd413644f5decfbf4e8":133, //Mysteriously Handsome
	"e407923afccaaed539c8a4038caac922":134, //Tamarind Torment
	"c5bcb9561c847d10fd5b6e74ba99ed8c":135, //Spicy Limeness
	"c48f3970d1829eb3fc950c2d0f1b4a9b":136, //Mystic Pickleness
	"66aa65422caa01f4ed8ebb6fdd3b2293":137, //Spicy Mouth
	"63c3d6ed003472fbf82f8ffb03f39c20":138, //Hombre Muerto Caminando
	"454d465127f34454808d75bdbd388f29":139, //Purple Tongue
	"94e112e9d9e9899f283bbd1ddde77396":140, //Green Tongue
	"61c56f6a7d09a562062c41239da75670":141, //Orange Tongue
	"a4a570ed8e0e103525775af34f31f030":142, //Red Tongue
	"ec5873195c3e3b217cc8124e1ac211cf":143, //Blue Tongue
	"cf48440dfd1ae655ab1d2c447e0091e2":144, //Black Tongue
	"d8857a40fb6a9b575a9c8d4449db9d39":145, //Object Detection
	"":146, //
	"":147, //
	"":148, //
	"":149, //
	"db5d031554e0f69e1b5944c381082691":150, //Twinklebritches
	"953ebb5fcf3e23283531ff99376ab89c":151, //Flame-Retardant Trousers
	"3b0d4cfc8148fe08e27cd1b8da9fb4d3":152, //Insulated Trousers
	"83e4984577a731e8e6bb9d635092b051":153, //Spookypants
	"34d33b93e87226a6a03dbaa09af69292":154, //Smelly Pants
	"ed2942d1ca5f87dd6f87f90507dd0f75":155, //Sleaze-Resistant Trousers
	"05616ca967054eee4f9d2fd34727c315":156, //Twinkly Weapon
	"f1421b135e777cd1a778c596fef500b7":157, //Flaming Weapon
	"80131d07257f059a699368cf30fc670d":158, //Frigid Weapon
	"d774d576335ec8cc8c061e6891ff41c5":159, //Spooky Weapon
	"c927edbace02490d4c66ee8271c64e2e":160, //Stinky Weapon
	"fe75c03d60169594193a0733c513a853":161, //Sleazy Weapon
	"b757f23feb7f08bd250f63586e03cf4a":162, //The Sonata of Sneakiness
	"06e123f9b46d3d180c97efc5ab0ad150":163, //Carlweather's Cantata of Confrontation
	"59a1ac48440e1ea1f869f2b37753f9cc":164, //Ur-Kel's Aria of Annoyance
	"173a9c4b4bbef78643fe4ec1a93b1cfc":165, //Smooth Movements
	"5e788aac76c7451c42ce19d2acf6de18":166, //Musk of the Moose
	"050dd88888b1ac9a2192cd71fd175a45":167, //Spirit of Cayenne
	"518f53443c261c2b61ea11fe8716a715":168, //Spirit of Peppermint
	"83888384e62aa31604f5619a1adb1169":169, //Spirit of Garlic
	"4d36ad259b82421689a27b2b843a7e3b":170, //Spirit of Wormwood
	"6938d4564e4225d47983a1a834a09604":171, //Spirit of Bacon Grease
	"3dbc5202908b9b8e507d7f062360b293":172, //Yellow Tongue
	"55b5adcb51868b248c9808720b1884f8":173, //Big Veiny Brain
	"76a38896d00f40442e3741d7e94bb5df":174, //Peeled Eyeballs
	"c9cd2df50d6fb5a9d8d7544892c7e5b2":175, //Wasabi Sinuses
	"0bbb62f04a5dd69a88b608fe656a7752":176, //Heavy Petting
	"":177, //
	"4dd00fb300f035693ca9ac4f6e33c4f4":178, //Bootyliciousness
	"2b0a872a72b015c6db5c4974140f0483":179, //Make Meat FA$T!
	"1b3d98f1187a8572fc12cf6fd02f35c3":180, //Temporary Blindness
	"d847d0fc434d9f9b69d6c029b7b91582":181, //Jazz Hands
	"":182, //
	"51e5c65bc1771744da18fc0cd3a2fe92":183, //Half-Astral
	"606df8164432029da3468eee90911ca3":184, //Cupcake of Choice
	"b39f26406457a1cb49de24b309086b84":185, //Shiny Happy Cupcake
	"2fd48447d0a555ccbddacb61a37d1961":186, //Tiny Bubbles in the Cupcake
	"09e15a3419f7729ab6d732654c9a01a2":187, //Your Cupcake Senses Are Tingling
	"baccc1c6b61bad39426ae19a104c926d":188, //The Cupcake of Wrath
	"087638005205a407f827277524f22ebb":189, //Hotform
	"a3c8719b97cd5b55d8004e16f83995e8":190, //Coldform
	"9574facc09b31e3b425537360569658f":191, //Spookyform
	"9a6852a35cf5a2336a0c4cc3112416a0":192, //Stenchform
	"801f28e129c806afbe88215103960c4b":193, //Sleazeform
	"7ecbd57bcb86d63be06bb6d4b8e7229f":194, //Hot Breath
	"d29d87fa48e08fa8a341183db3121e1c":195, //Cold Breath
	"da5e91136fd36708b61f6d383376ff78":196, //Spooky Breath
	"8be4aecc48d39b0b8b7a0fd671bd4330":197, //Stinky Breath
	"572a0d269f2609e685ae3f56327a2998":198, //Sleazy Breath
	"f27e3dcf9fd6b46b30347743c18ccb1b":199, //Aspect of the Twinklefairy
	"c3dce41845c995ec4c2bd986cbc28364":200, //Hot Blooded
	"3d9befb3ebd8553b81c3792efb85a85a":201, //Cold Blooded
	"89099ac4df5c9d8171b4930a79feaeae":202, //Spooky Demeanor
	"798bb9ee21a7f86fea8ed2a1c8fc9be1":203, //Stenchtastic
	"9251834d917d63e231fac176d8842811":204, //Supafly
	"a5416e0b53cb9482aaa8294b3ebf58b5":205, //Provocative Perkiness
	"00fb00c69272d752ee0bab0e83ea729f":206, //Ermine Eyes
	"e81a1fd67fb48499d12619574610759f":207, //Eau D'enmity
	"c857c096f180a92bbd6b378c363f8b63":208, //Ocelot Eyes
	"7f39a1d79d44181871af122ba6c8c851":209, //Ponderous Potency
	"4815faee551d03188624535356609c76":210, //Concentrated Concentration
	"225aa10e75476b0ad5fa576c89df3901":211, //Got Milk
	"62f614c0cd7832fcaf864d74bea81c01":212, //Papowerful
	"52cf0120a2ecbc702da6ef92e588d242":213, //Frog In Your Throat
	"1c2325ff89b6a58b386e5563da098e46":214, //Salamander In Your Stomach
	"46a5628ca44d03f0f26bdf3467f1c0c2":215, //Newt Gets In Your Eyes
	"":216, //
	"":217, //
	"e8430f88372ba98df5e361f0b091fe65":218, //Amorous
	"6ede1a75e47f82c98a429c9a50d067b4":219, //Bubble Bubble
	"4becdf2ac82c2bf30dd433dd54465918":220, //Sticky Fingers
	"3e2eed0d70d0e023a11619655a3f48c0":221, //Chalky Hand
	"2968e9397d3aa977b8cb3e9817ad8cdd":222, //Snarl of the Timberwolf
	"360467118bd69ef869a1af2002117e63":223, //Dreams and Lights
	"f7551a889b9c61510fc3f73f96ecc98e":224, //Scarysauce
	"6121ba486d7ad86165d117ea62794d09":225, //Dirge of Dreadfulness
	"defbfe64c65b2d495dc0133506223c1f":226, //Talking Like a Pirate
	"295f414c903d22c44ec2f92f789cad71":227, //The 'Tussin
	"9c9794f2ff9a0fcb1090c281c2c442f1":228, //Pie in the Face
	"37f9f99df81ca3d29abe85139a302f67":229, //Hip to Be Square Dancin'
	"5c5335bc77cdd6fe54de544d277089b7":230, //Livin' Large
	"48e2cebc9f34ef44ac6026fdf7cdb76f":231, //Wistfully Nostalgic
	"05b9aad038c530dd3d2c5b3ab146a4b8":232, //Happy Salamander
	"883d712b08a134d70b832aec956767cb":233, //Techno Bliss
	"f382bb82f0d7f335581f353670922479":234, //Material Witness
	"65a1f6d8bc0b9141678d2a121d5eac48":235, //No Worries
	"796240a217e3686b23ecffef8a804729":236, //Metal Speed
	"b1952cfcb421593dfe0a16edd41a913d":237, //Radium Radicality
	"33a94f73f343e88ee4b17d18e516bd49":238, //Wintergreen Warmongery
	"40047d675d023d456eca562f0479656a":239, //Also Schmeckt Zarathustra
	"30b35877440e5cc89f36a65b15274a04":240, //Vitamin-Maxed
	"4021090627813d8ea662ca050395f338":241, //Got Your Boots On
	"4d1451739cd618bf2dcdff61af68ae65":242, //The Q Is Talking To You
	"d7d35d7b14c7322fef4ddd80a0847473":243, //Bad Luck
	"05bc11c2da34e7f6fe1511ec6850fe2e":244, //Deadly Flashing Blade
	"6d4452e978741bda60e82e316fdd7ba5":245, //Locks Like the Raven
	"e6f64babb5a6850783db4f82fe7e239b":246, //Smugness
	"fc58931f52d46bd271785815f479c1e4":247, //Good Karma
	"e8b6209d5764f91f803c9591ab9ecd7c":248, //Pumped Up
	"c4c76755cb4ca109b5685550cab4a4e6":249, //Head on Fire Ass Catching
	"3d2c6dbafa315b2615f5e9a203cc9984":250, //Violent Night
	"6a5ee9b52fca0b73200c4d9cd7539094":251, //White Knuckles
	"3274dfef654333f140b86d07a4f43de8":252, //Don't Rest Ye Bold Adventurer
	"c4e7639fba33b5124ab46b6eef619ddf":253, //Frosty the Hitman
	"8ffbe4ce5828976f89a1df3f425f3986":254, //Coy to the Hurled
	"0d86141cfa07cfa79f952f00fddc5269":255, //Crimbo Epiphany
	"00a9f64c702e34cc2e74b51240c379bd":256, //Bells in the Batfry
	"886179246e72ce517325f3b57a2df35a":257, //Carol of the Bones
	"68588a080497011bee2f48c1b273d605":258, //Get Me Off This Crazy Thing!
	"e8b4295bb508c8a821c6acbb9a733d6b":259, //Very Clean Teeth
	"":260, //Arse-a'fire
	"":261, //Lemon Enlightenment
	"":262, //Squirming Like a Toad
	"f3a452bc7787ab2f5985d28d164a4fb0":263, //Eau D'tortue
	"37b23526c38b844f4983a17a72ad992e":264, //Majorly Poisoned
	"c22c212fdf9d6b611be955785ff37775":265, //Tenuous Grip on Reality
	"555395c91aca7ddf5a60688c63214f73":266, //Turned Into a Skeleton
	"cb28fec658f97af4ee56590184223497":267, //Barking Dogs
	"dd5d7d48bca51bd1ddfa197b584a5623":268, //Prestidigysfunction
	"c444fec2c3237f47d985c83248b81687":269, //Heart of White
	"f0ceb6af2b415596e1d062323a77119e":270, //Heart of Pink
	"2bcdff73267cc4e57efe3207396127e8":271, //Heart of Orange
	"280ae237b5bb6ba02d9b1cd17719b84e":272, //Heart of Lavender
	"63f75386af7076f2dddae1aad2ba9069":273, //Heart of Yellow
	"c5981aab5e82b8b7acaa03836f2b8207":274, //Heart of Green
	"ec7f2f9d649f3de48a27c5eaa1147afe":275, //Ultrahydrated
	"":276, //Disco Inferno
	"":277, //Disco Nirvana
	"":278, //Disco Concentration
	"":279, //
	"8348ca470188c975bcb78c67a58c39ab":280, //Kiss of the Black Fairy
	"":281, //
	"15e7e83d8630cf9b824a2645851458c5":282, //A Little Bit Poisoned
	"189ac7bc3487eabe0d4f1dd8b2b34897":283, //Somewhat Poisoned
	"c14002a0af245653e9a319078a686d37":284, //Really Quite Poisoned
	"f3549dbe538c81c2aa59362e8e8cc7cc":285, //Filthworm Larva Stench
	"36f72cea3c79d16aa285a02d9551f412":286, //Filthworm Drone Stench
	"eb09f56d4f878745cfedeef7e0815414":287, //Filthworm Guard Stench
	"06f177f0b563384e679d5b7283184546":288, //
	"567ae2968ee07d280efeb2cbee97ff29":289, //Bananas!
	"a284f06ff0d8158f530b9bfa3e689ce8":290, //What's That Smell?
	"8fa35398bfe0b6c599fe776a7311fbc4":291, //Mad at Science
	"79289e27b54236f174122c1a7703242a":292, //Tetanus
	"6732cdf4bc1898533e87e667da4460f7":293, //Half-Eaten Brain
	"ced2750c51d5d10b45f6a169a8661c83":294, //Fearless
	"":295, //Socialismydia
	"198f28c9fb6022af5663275f0f201d4e":296, //Axe Wound
	"c699071097b9cbff95fbb3e92d73a547":297, //Temporary Amnesia
	"4308b32a8ded408e0dae1bc504397dec":298, //Grilled
	"20c1767b3206b69e212bfdad1dc931a5":299, //&quot;The Disease&quot;
	"":300, //Infinite Loop
	"9a12b9329e0701252387afe75dee34ee":301, //Cunctatitis
	"30ef4348fb5125c55c5be56867b795dd":302, //Mild Lycanthropy
	"":303, //Lycanthropy Eh?
	"7162d29ed4d4ab9247e32a65fdc0508a":304, //Roids of the Rhinoceros
	"0d08ec701054748c0ff754e1eb8993fa":305, //Happy Trails
	"326cfa0c7a97220cda6575f7d887c38f":306, //Piratastic
	"179ea341b15b46366812867e26705ed0":307, //Healthy Green Glow
	"81577de719bc99a5780d4e0cb5ca81a5":308, //Sinuses For Miles
	"a676cca5283da6c64fe7a853bffe43b3":309, //One Very Clear Eye
	"deb5f1d2384c25301d1a81839d8f8a77":310, //Pop-eyed
	"df55e784c72b808b1e00973d23ca14e6":311, //Flamingly Floral
	"943504f00bdffe88dd982e1851707aec":312, //Permafrosty
	"f2780f015462419680ea5b12b76a34c7":313, //Bloody Bloody Bloody!
	"80081dfb463917dad6233a3b5f4ba222":314, //Chauve-Souris Merde Fou
	"943504f00bdffe88dd982e1851707aec":315, //Cuts Like a Buttered Knife
	"4a7e1d0ef97a354031271c7590dfe698":316, //Impregnably Delicious
	"2bf98e882e69d84ef7184450c88383f3":317, //Fireproof Lips
	"":318, //
	"6b0edfbc94593d4516065493f3607d93":319, //Hyphemariffic
	"":320, //
	"":321, //
	"":322, //
	"ff1abd7eea34159903507bb907c56803":323, //Burning Hands
	"992e3b84ebe746affc1cf6038cd854ff":324, //Burning Ears
	"c1f2b28c6d4c9b1e2388dde1d5fe44cd":325, //Burning Soul
	"e5ea21c55cab22529647b7437e81532b":326, //Frozen Hands
	"3f23f479b29e6cce697e5ac2ecc9d531":327, //Frozen Shoulders
	"ac1584de4a0d6359c4738bf0bae571a1":328, //Soul Freeze
	"1e776d50f7d0c07ae3bf04aa1ea13e49":329, //Broken Fast
	"89a2e36f2f2fa3c6c4053a6a35c2a12a":330, //Hoity Toity
	"91635be2834f8a07c8ff9e3b47d2e43a":331, //On the Trail
	"3f23af7d42cd450e5a198ba091a842c1":332, //Moon'd
	"dd0d5b24b28fff02cb53607f45d0d220":333, //Dilated Pupils
	"63965c29290f23349477c4199c9b10c3":334, //Optimist Primal
	"7db86298da3afb00bd686f76ac0eaff7":335, //Elvish
	"148cc90a0b393072039a3fe128c61138":336, //Winklered
	"97065b953792aa434bb4d6ef1bbc29c5":337, //White-boy Angst
	"55fd0e02c574f2ba680d8e64a5542bf8":338, //Fustulent
	"3ceed6b8764068dd53325bab6b7b5681":339, //Tin Man
	"76a0c3b8b2ddd3cffbbb2c1de01fd41f":340, //Can't Be a Chooser
	"0a630b7a78a5959d97c5ce48cb23287f":341, //Ass Over Teakettle
	"0acfb47ada804935ca1acf6ee1ae6dd7":342, //Bestial Sympathy
	"957a452386df5dec88778c089e53b60e":343, //La Bamba
	"3f2ef271da5513fce8fd5f8ea8c27de8":344, //Blessing of Pikachutlotal
	"5a1caad47f9f3340c58af489d69bf55b":345, //Blessing of Charcoatl          
	"24d6ac5a1c833ff5b1ccb07a997ca10b":346, //Blessing of Squirtlcthulli
	"c59051266b90a4b990b4e92e29945228":347, //Blessing of Bulbazinalli
	"5626ff49dbfe5c3bc7732a3dc9c1ea4e":348, //All Fired Up
	"943ba3b11499412f041807f8a7835d75":349, //Go Get 'Em Tiger!
	"c45d2469bf8cfd8c9bbc953e2a44f3c4":350, //Starry-Eyed
	"e81282d9c752ffcf7d033dd0bd8fec6f":351, //Comic Violence
	"e6d8c1e5ee549f897340b97b3cc26053":352, //Tranquilized Mind
	"c884a8b10f7b236002288fc760129e09":353, //Woad Warrior
	"08c89971feb489d775ce5e8b2b845503":354, //Red Door Syndrome
	"e5bd49c7432e33b1684e494f3b7ec1c3":355, //Spirit of Alph
	"7404a77ea90f3e51ec8b1e1e3450351b":356, //Night Vision
	"ebaff6fa82fe65630faccf2d1177b7cc":357, //Absinthe-Minded
	"57f86c875130ff236081eb409213be09":358, //Rat-Faced
	"f52232fc8d5e5fcdd13c8266f2be1b62":359, //Dancing Prowess
	"d43b6af05c4093274e2d58050e4d234e":360, //No Vertigo
	"a057b3c7dfb85e4711ec6b0a82d383c9":361, //Good with the Ladies
	"3188a0b4d646a166ad32ee827d5b0f8b":362, //Bats in the Belfry
	"52816dcf5d94b5eba565c8688f04ed24":363, //Unusual Fashion Sense
	"92c569a3c9aa120e4c79c5914c37c7e3":364, //Feelin' Philosophical
	"733e8838261278c9b6173d392a4d09d7":365, //Moon June Spooned
	"cee83e927355a2c84cd8ee46745bd87a":366, //Inspired!
	"547a82f65523083eb7ea2349b1dd97a3":367, //Ringing Ears
	"2842a345ac05d148c862015d1fcc4e4b":368, //Man's Worst Enemy
	"c3ef42f53a008404112cf3a9dd744404":369, //Extremely Poor Taste
	"526472c3f3acbe7a8068ccf92628a40a":370, //The Real Deal
	"731ba2df034beec5412f82879eec9392":371, //Memento Moir&eacute;
	"eaa0f2cd06a00116af53bd65177fdf4b":372, //Flashing Eyes
	"bd27dcbc85c224d16256b51a8ca02db5":373, //Mmmmmelon
	"86bb1d1be1a84c4554906852f4273f90":374, //Contagious Bad Luck
	"a735ff0b16a7d7491c0dbb79c2e7895c":375, //Sparkling Consciousness
	"1539b9172f5093b00da60bf5764477a6":376, //Sneaky Serpentine Subtlety
	"47a740988991d8f1ef1ab26e72ee2a86":377, //Adrenaline Rush
	"81b2fce49b337b3ef3c6a1b11d77c2df":378, //Crusty Head
	"c6eba521aa725f3dbd0a27ac95cabaab":379, //Florid Cheeks
	"":380, //
	"":381, //
	"a25aa7677bc87baea8d0350e61b04e9d":382, //Seeing Colors
	"c74fee3997d020f53cc3e077d4897c10":383, //Black Face
	"bf4f8342a8efe1d4c27054fa73ec1d7a":384, //Erudite
	"3de3c7f145ae87e58ee391127ed697fd":385, //Radiating Black Body&trade;
	"":386, //
	"":387, //
	"":388, //
	"":389, //
	"":390, //
	"":391, //
	"":392, //
	"":393, //
	"":394, //
	"":395, //
	"":396, //
	"":397, //
	"":398, //
	"":399, //
	"":400, //
	"":401, //
	"":402, //
	"":403, //
	"":404, //
	"":405, //
	"":406, //
	"":407, //
	"":408, //
	"":409, //
	"":410, //
	"":411, //
	"":412, //
	"":413, //
	"":414, //
	"":415, //
	"":416, //
	"":417, //
	"":418, //
	"":419, //
	"":420, //
	"":421, //
	"":422, //
	"":423, //
	"":424, //
	"":425, //
	"":426, //
	"":427, //
	"fcfb0679f0e80509cbff567a600ca998":428, //Compensatory Cruelness
	"a8e35050197871d1fbe5b3afc865af7e":429, //Mutated
	"dd78d480e08de5cc8e633202d699844f":430, //Seriously Mutated
	"":431, //
	"a148b9106d6593dbec45dad76cedc163":432, //Flared Nostrils
	"4b7988bd236d2b89dc8cbe162b697fa6":433, //Easily Embarrassed
	"37acab3aa7b7cc31532cffb27ed5037e":434, //All Covered In Whatsit
	"fb06ebe1f825ce046930e2630203969a":435, //Beer in Your Shoes
	"b17642b2ee44782a692b2d7861b50ac0":436, //Toad In The Hole
	"65e393732d2282a4a698417581c1e899":437, //Strangulated
	"a71e21c4a39a13558719fef8980422d4":438, //Ham-fisted
	"8a3686b9ef4909ca99587bc6489008c4":439, //Baconstoned
	"7a1d33bd3c697d55c26eb70a1845a5d5":440 //Je Ne Sais Porquoise
};

function toShortName(skill) {
	var prep = /The |of |the |in |Tiny |Cupcake |Your |Spirit /g;
	skill = skill.replace(prep, "");
	prep = /Heart /g;
	skill = skill.replace(prep, "Hrt");
	prep = /Saucemastery/g;
	skill = skill.replace(prep, "Sauce");

	var conv = /(\S{4,})\s.*/;
	if (skill.match(conv)) {
		skill = skill.replace(conv, "$1");
	}
	return skill + "&nbsp;";
}
function loadXML(url, desc, displayResults, callback) {
        var req = new XMLHttpRequest();
        req.onreadystatechange = function () {
                if (req.readyState == 4) {
                        if (req.status == 200) {
				//document.location.reload();
				var resp = req.responseText;
				if (desc && desc != '') {
					resp = resp.replace(/Results:/, 'Results (' + desc + '):');
				}
				callback(resp, displayResults);
			}
                }
        }
        req.open("GET", url, true);
        req.send("");
	return true;
}
function submitAction(frm, target, source, displayResults) {
	var desc;
	if (source) {
		if (source.title) desc = source.title;
		if (source.innerHTML.indexOf("HP:") >= 0 || source.innerHTML.indexOf("hp.gif") >= 0) desc = "Heal";
		if (!desc) desc = source.innerHTML.replace(/<[a-zA-Z\/][^>]*>|\([^\)]*\)/g, '');
		//remove trailing spaces and the w from wikilink, if applicable
		desc = desc.replace(/&nbsp;w&nbsp;/, '');
		var quantity = 1 * frm.quantity.value;
		if (desc && quantity > 1) desc = desc + ' x ' + quantity;
		var fullHpReg = /.*(hp.gif|HP:).*>(\d+)(&nbsp;)?\/(&nbsp;)?(\d+)</;
		//effect in compact mode:  <td><span>spell/img</span><span>possible wiki link</span></td><td>(dur)</td>
		//effect in full mode:  <td>image</td><td><font size="2">skill (dur)</font></td>
		//hp in compact mode:  <td>HP:</td><td>hp</td>
		//hp in full mode:  <img><br><span>hp</span>
		if (source.innerHTML.search(fullHpReg) > -1) {
			//HP display
			var hp1 = RegExp.$2;
			var hp2 = RegExp.$5;
			//alert('hp1=[' + hp1 + '],hp2=[' + hp2 + ']');
			if (hp1 == hp2) {
				alert("Your HP is already at max...");
				return false;
			} else {
				source.innerHTML = source.innerHTML.replace(/>(\d*)(&nbsp;)?\/(&nbsp;)?(\d*)</, '><i>Loading...</i><');
			}
		} else if (source.innerHTML.indexOf("img") >= 0) {
			//image, put it in the 2nd cell
			source.innerHTML = "<td></td><td align=left><i><font size=2>Loading...</font></i></td>";
		} else {
			source.innerHTML = "<td colspan=2 align=left><i>Loading...</i></td>";
		}

	}
	var array = new Array();
	for (var i = 0; i < frm.elements.length; i++) {
		var element = frm.elements[i];
		if (element.name.length < 1) continue;
		array.push(element.name + "=" + escape(element.value));
	}
	var url = target + "?" + array.join("&");
	loadXML(url, desc, displayResults, function (text, displayResults) {
		if (displayResults != 0 ) {
			var main = window.top.frames[2];
			var div = main.document.getElementById('effdiv');
			if (true || !div) {
				var container = main.document.createElement('DIV');
				container.id = 'effdiv';
				container.innerHTML = text;
				main.document.body.insertBefore(container, main.document.body.firstChild);
				div = container;
			} else {
				div.innerHTML = text;
			}

			div.style.display = "block";
			main.scrollTo(0, 0);
		}
		//window.location.reload();
		window.location = '/charpane.php';
	});
}
setTimeout('submitAction = ' + ('' + submitAction).replace(/submitAction/, ''), 10);
setTimeout('loadXML = ' + ('' + loadXML).replace(/loadXML/, ''), 10);
function setQuantityListBoxOption() {
      var val = this.options[this.selectedIndex].value;
      var sel = document.getElementById('quantitySel1');
      if (this == sel) {
            sel = document.getElementById('quantitySel2');
      }
      sel.selectedIndex = this.selectedIndex;
      var qField = document.getElementById('quantity');
      GM_setValue(this.name, val);
      qField.value = val;
}
function setQuantityRadioOption() {
	var other;
	var val = this.id.substr(13);
	if (this.id.charAt(11) == '1') {
		other = 'quantitySel2_' + val;
	} else {
		other = 'quantitySel1_' + val;
	}
	var sel = document.getElementById(other);
	if (sel) {sel.checked = true;}
      var qField = document.getElementById('quantity');
	GM_setValue(this.name.substr(0, this.name.length - 1), val);
	qField.value = val;
}
function modifyCharPane(id, pwd) {
	var skillForm = document.createElement("form");
	skillForm.setAttribute("id", "quickskillform");
	skillForm.setAttribute("name", "skillform");
	skillForm.setAttribute("style", "display: none");

	skillForm.appendChild(createHiddenField("squelch", "1"));
	skillForm.appendChild(createHiddenField("ultrasquelch", "1"));
	skillForm.appendChild(createHiddenField("pwd", pwd));
	skillForm.appendChild(createHiddenField("targetplayer", id));
	skillForm.appendChild(createHiddenField("action", "Skillz"));
	skillForm.appendChild(createHiddenField("whichskill", ""));
	skillForm.appendChild(createHiddenField("whichitem", ""));
	skillForm.appendChild(createHiddenField("whichbuff", ""));
	skillForm.appendChild(createHiddenField("whicheffect", ""));
	skillForm.appendChild(createHiddenField("which", "3"));
	skillForm.appendChild(createHiddenField("using", "Yep."));
	skillForm.appendChild(createHiddenField("quantity", GM_getValue(DEF_QUANTITY_KEY, "1")));

	var mouseoverAction = 'this.style.opacity="0.5";';
	var mouseoutAction = 'this.style.opacity="1";';
	var displayResults = 1*GM_getValue(DISPLAY_RESULTS_KEY, 1);
	if (document.body){
		document.body.appendChild(skillForm);

		var images = document.getElementsByTagName('img');
		var effectImage = /eff\(\"([0-9a-z]*)\"\)/;
		//var effectImage = /[\s\S]*eff\(\"([0-9a-z]*)\"\)[\s\S]*/;
		var skillpage = (window.location.pathname == "/skills.php");
		var firstEffectRow;
		var rolloverEffect = 1*GM_getValue(ROLLOVER_EFFECT_KEY, 0);
		for (var i = images.length-1; i >= 0; i--) {
			var theImage = images[i];
			var source = theImage.parentNode.innerHTML;
			if (source.match(effectImage)) {
				var node = theImage;
				//var descId = source.replace(effectImage, "$1");
				var descId = "" + RegExp.$1;
				var effectId = effectArray[descId];
				var spell = getSpellFromEffect(effectId);
				// convert to a text node (but not if we're on the skills.php, leave the icon)
				if (GM_getValue(REPLACE_ICONS_KEY, 1) != '2' && node.getAttribute('alt') && !skillpage) {
					var textNode = document.createElement("span");
					textNode.innerHTML = toShortName(node.getAttribute('alt'));
					//textNode.setAttribute("title", node.getAttribute('alt'));
					node.parentNode.parentNode.setAttribute("title", node.getAttribute('alt'));
					node.parentNode.replaceChild(textNode, node);
					node = textNode;
				}
				var modified = false;
				if (spell >= 0) {
					modified = true;
					node.parentNode.parentNode.setAttribute("onclick", "var e=arguments[0];if (e.which != 1) return false;var skillz=document.getElementById('quickskillform');var actionFld=document.getElementById('action');skillz.action='skills.php';actionFld.value='Skillz';skillz.whichskill.value=" + spell + ";submitAction(skillz, 'skills.php', this, " + displayResults + ");");
					var shrug = shrugArray[effectId];
					if (shrug != undefined) {
						node.parentNode.parentNode.setAttribute("oncontextmenu", "var e=arguments[0];if (!confirm('Shrug off " + shrug + "?')) return false;var skillz=document.getElementById('quickskillform');var actionFld=document.getElementById('action');skillz.action='charsheet.php';actionFld.value='unbuff';skillz.whichbuff.value=" + effectId + ";submitAction(skillz, 'charsheet.php', this, 0);return false;");
					}
				} else {
					var item = getItemFromEffect(effectId);
					if (item >= 0) {
						modified = true;
						if (item == SGEE) {
							node.parentNode.parentNode.setAttribute("onclick", "if (!confirm('SGEE it?')) return false;var skillz=document.getElementById('quickskillform');var actionFld=document.getElementById('action');skillz.action='uneffect.php';actionFld.value='uneffect';skillz.whicheffect.value=" + effectId + ";submitAction(skillz, 'uneffect.php', this, 1);return false;");
							node.parentNode.parentNode.setAttribute("oncontextmenu", "if (!confirm('SGEE it?')) return false;var skillz=document.getElementById('quickskillform');var actionFld=document.getElementById('action');skillz.action='uneffect.php';actionFld.value='uneffect';skillz.whicheffect.value=" + effectId + ";submitAction(skillz, 'uneffect.php', this, 1);return false;");
						} else {
							node.parentNode.parentNode.setAttribute("onclick", "var skillz=document.getElementById('quickskillform');var q=document.getElementById('quantity').value;var actionFld=document.getElementById('action');skillz.action='multiuse.php';actionFld.value='useitem';skillz.whichitem.value=" + item + ";submitAction(skillz, (q=='1'?'inv_use.php':'multiuse.php'), this, " + displayResults + ");");
						}
					}
				}
				if (modified) {
					if (!firstEffectRow) firstEffectRow = node.parentNode.parentNode;
					if (rolloverEffect != 1) {
						node.parentNode.parentNode.setAttribute("onmouseover", mouseoverAction);
						node.parentNode.parentNode.setAttribute("onmouseout", mouseoutAction);
					}
					node.parentNode.parentNode.setAttribute("style", "cursor:pointer");
					// remove the existing on click event on the image (pops up the help)
					if (theImage) theImage.setAttribute("onclick", "");
				}
			}
		}
            var healSkill = 1*GM_getValue(HEAL_DISPLAY_KEY, HEAL_ACTION_NOTHING);
		if (healSkill != HEAL_ACTION_NOTHING) {
			var tables = document.getElementsByTagName("table");
			for (var i = 0; i < tables.length; i++) {
				if (tables[i].innerHTML.indexOf("HP:") >= 0 || tables[i].innerHTML.indexOf("hp.gif") >= 0) {
					var node = tables[i].rows[0];
					if (node.innerHTML.indexOf("hp.gif") >= 0) {
						//full mode, get the cell
						node = node.cells[0];
						//remove the help popup
						node.childNodes[0].setAttribute("onclick", "");
					}
					node.setAttribute("onclick", "var skillz=document.getElementById('quickskillform');var actionFld=document.getElementById('action');skillz.action='skills.php';actionFld.value='Skillz';skillz.quantity.value='1';skillz.whichskill.value=" + healSkill + ";submitAction(skillz, 'skills.php', this, " + displayResults + ");");
					if (rolloverEffect != 1) {
						node.setAttribute("onmouseover", mouseoverAction);
						node.setAttribute("onmouseout", mouseoutAction);
					}
					node.setAttribute("style", "cursor:pointer");
					break;
				}
			}
		}
		if (firstEffectRow) {
                  var tbl = firstEffectRow.parentNode;
			if (GM_getValue(COLORIZE_KEY, 1) != '2') {
                      		for (var curr_row = 0; curr_row < tbl.rows.length; curr_row++) {
	                               var oRow = tbl.rows[curr_row];
	                               for (var curr_cell = 0; curr_cell < oRow.cells.length; curr_cell++) {
	                                       var html = oRow.cells[curr_cell].innerHTML;
	                                       html = html.replace(/\(1\)/g, "(<font color='red'><b>1</b></font>)");
	                                       html = html.replace(/\(([1-5])\)/g, "(<font color='purple'><b>$1</b></font>)");
	                                       oRow.cells[curr_cell].innerHTML = html;
	                               }
	                       }
			}
			var quantityDisplay = 1*GM_getValue(QUANTITY_DISPLAY_KEY, 2);
			var defaultBuffCount = 1*GM_getValue(DEF_QUANTITY_KEY, "1");

			var topCell;
			var bottomCell;
			if (quantityDisplay == QUANTITY_DISPLAY_TOP || quantityDisplay == QUANTITY_DISPLAY_BOTH) {
				var topRow = firstEffectRow.parentNode.insertRow(0);
				topCell = topRow.insertCell(0);
				topCell.colSpan = "2";
				topCell.align = "center";
			}
			if (quantityDisplay == QUANTITY_DISPLAY_BOTTOM || quantityDisplay == QUANTITY_DISPLAY_BOTH) {
				var bottomRow = firstEffectRow.parentNode.insertRow(-1);
				bottomCell = bottomRow.insertCell(0);
				bottomCell.colSpan = "2";
				bottomCell.align = "center";
			}

			var radios1 = "";
			var radios2 = "";

			var useSelect = (1*GM_getValue(QUANTITY_LISTBOXES_KEY, 0)) == 1;
			if (useSelect) {
				radios1 = "<select name='" + DEF_QUANTITY_KEY + "' id='quantitySel1'>";
				radios2 = "<select name='" + DEF_QUANTITY_KEY + "' id='quantitySel2'>";
			}
			var maxRepeat = 1*GM_getValue(REPEAT_MAX_COUNT_KEY, 5);
			for (var i = 1; i <= maxRepeat; i++) {
				if (!useSelect) {
					radios1 += "<input type='radio' name='" + DEF_QUANTITY_KEY + "1' id='quantitySel1_" + i + "'";
					radios2 += "<input type='radio' name='" + DEF_QUANTITY_KEY + "2' id='quantitySel2_" + i + "'";
					if (i == defaultBuffCount) {
						radios1 += " checked";
						radios2 += " checked";
					}
					radios1 += " title='Cast/Use " + i + "x'";
					radios2 += " title='Cast/Use " + i + "x'";
					//radios1 += " ;
					//radios2 += " onclick=\"var sel = document.getElementById('quantitySel1_" + i + "');if (sel) {sel.checked = true;};var skillz=document.getElementById('quickskillform');GM_setValue('" + DEF_QUANTITY_KEY + "','" + i + "');skillz.quantity.value='" + i + "';\";";
					radios1 += "/>";
					radios2 += "/>";
				} else {
					radios1 += "<option value='" + i + "'";
					radios2 += "<option value='" + i + "'";
					if (i == defaultBuffCount) {
						radios1 += " selected";
						radios2 += " selected";
					}
					radios1 += ">" + i + "</option>";
					radios2 += ">" + i + "</option>";
				}
			}
			if (useSelect) {
				radios1 += "</select>";
				radios2 += "</select>";
			}

			if (topCell) topCell.innerHTML = radios1;
			if (bottomCell) bottomCell.innerHTML = radios2;

			if (useSelect) {
				document.getElementById('quantitySel1').addEventListener("change", setQuantityListBoxOption, false);
				document.getElementById('quantitySel2').addEventListener("change", setQuantityListBoxOption, false);
			} else {
				var radios = document.getElementsByName(DEF_QUANTITY_KEY + '1');
				for (var i = 0; i < radios.length; i++) {
					radios[i].addEventListener("click", setQuantityRadioOption, false);
				}
				radios = document.getElementsByName(DEF_QUANTITY_KEY + '2');
				for (var i = 0; i < radios.length; i++) {
					radios[i].addEventListener("click", setQuantityRadioOption, false);
				}
			}

		}
	}
}

function getUserData() {
	if (unsafeWindow.top.pwd && unsafeWindow.top.playerId) {
		//alert("got cached data! [" + unsafeWindow.top.pwd + "], [" + unsafeWindow.top.playerId + "]");
		modifyCharPane(unsafeWindow.top.playerId, unsafeWindow.top.pwd);
	} else {
		//alert("retrieving data...");
		GM_xmlhttpRequest({
		  method: 'GET',
		  url: 'http://'+location.host+'/skills.php?tiny=1',
		  headers: {'User-agent': 'Mozilla/4.0 (compatible) Greasemonkey','Accept': 'text/html',},
		  onload: function(responseDetails) {
			if (responseDetails.status == "200") {
				var pwd = "";
					var playerId = "";
					var rc = responseDetails.responseText;
				var findPwd = /name=pwd value=\'(\w*)\'/;
				var findPlayerId = /name=targetplayer value=(\d*)>/;
				var idx = rc.search(findPwd);
				if (idx > -1) {
					pwd = RegExp.$1;
				}
				idx = rc.search(findPlayerId);
				if (idx > -1) {
					playerId = RegExp.$1;
				}
				if (findPlayerId != "" && pwd != "") {
					unsafeWindow.top.pwd = pwd;
					unsafeWindow.top.playerId = playerId;
					modifyCharPane(playerId, pwd);
				}
			}
 	  	},
	  	onerror: function(responseDetails) {
			alert('charpane_recast.user.js:  error recovering user data!  script unable to continue.');
	  	}
		});
	}
}

function getItemFromEffect(effectId) {
	item = -1;
	switch (effectId) {
		case 1:  item = 193; break;  //Light!
		case 2:  item = 1*GM_getValue(NEG_EFFECTS_ACTION_KEY, NEG_EFFECTS_ACTION_NOTHING); break;  //Sleepy
		case 3:  item = 1*GM_getValue(NEG_EFFECTS_ACTION_KEY, NEG_EFFECTS_ACTION_NOTHING); break;  //Confused
		case 4:  item = 1*GM_getValue(NEG_EFFECTS_ACTION_KEY, NEG_EFFECTS_ACTION_NOTHING); break;  //Embarrassed
		case 5:  item = 208; break;  //Far Out
		case 6:  item = 226; break;  //Wings
		case 7:  item = 1*GM_getValue(BEATEN_UP_ACTION_KEY, BEATEN_UP_ACTION_NOTHING); break; //Beaten up
		case 8:  item = 1*GM_getValue(POISONED_ACTION_KEY, POISONED_ACTION_NOTHING); break;  //Poisoned
		case 9:  item = 307; break;  //Knob Goblin Perfume
		case 10:  item = 340; break;  //Steroid Boost
		case 11:  item = 341; break;  //Knob Goblin Lust Frenzy
		case 12:  item = 343; break;  //Sharp Weapon
		case 14:  item = 417; break;  //Hennaliciousness
		case 15:  item = 2; break;  //Bloody Hand
		//case 17:  item = ; break;  //Sugar Rush
		case 20:  item = 614; break;  //Uncertain
		case 27:  item = 687; break;  //Temporary Lycanthropy
		case 28:  item = 744; break;  //Butt-Rock Hair
		case 29:  item = 767; break;  //Contemptible Emanations
		case 30:  item = 418; break;  //Incredibly Hulking
		case 31:  item = 419; break;  //Superhuman Sarcasm
		case 32:  item = 420; break;  //Tomato Power
		case 33:  item = 421; break;  //Phorcefullness
		case 34:  item = 422; break;  //Pronounced Potency
		case 35:  item = 423; break;  //Concentration
		case 36:  item = 424; break;  //Mystically Oiled
		case 37:  item = 425; break;  //Expert Oiliness
		case 38:  item = 426; break;  //Gr8tness
		case 39:  item = 781; break;  //Hernia!
		case 43:  item = 1*GM_getValue(NEG_EFFECTS_ACTION_KEY, NEG_EFFECTS_ACTION_NOTHING); break;  //Wussiness
		case 46:  item = 587; break;  //Spiky Hair
		case 49:  item = 781; break;  //Macho Profundo
		case 56:  item = 618; break;  //Extreme Muscle Relaxation
		//case 57:  item = ; break;  //Rainy Soul Miasma
		case 58:  item = SGEE; break;  //Teleportitis
		case 73:  item = 1290; break;  //Ticking Clock
		case 74:  item = 1301; break;  //Fresh Scent
		case 75:  item = 1302; break;  //Hippy Stench
		case 76:  item = 1406; break;  //Wreathed in Merriment
		case 77:  item = 1407; break;  //Fury of the Bells
		case 78:  item = 1408; break;  //Yuletide Sappiness
		case 80:  item = 747; break;  //Missing Fingers
		//case 86:  item = ; break;  //Missing Eyebrows
		//case 87:  item = ; break;  //Two Left Feet
		//case 89:  item = 593; break;  //Tingly Wrists
		//case 90:  item = 593; break;  //Tingly Elbows
		//case 91:  item = 593; break;  //Tingly Biceps
		//case 92:  item = ; break;  //Sticky Hands
		case 93:  item = 866; break;  //Clean-Shaven
		case 100:  item = 793; break;  //Stabilizing Oiliness
		case 101:  item = 794; break;  //Slippery Oiliness
		//case 102:  item = ; break;  //Strength of Ten Ettins
		//case 103:  item = ; break;  //Strange Mental Acuity
		//case 104:  item = ; break;  //Izchak's Blessing
		//case 106:  item = ; break;  //Canadianity
		//case 107:  item = ; break;  //Enraged
		case 110:  item = 879; break;  //Hopped Up on Goofballs
		//case 111:  item = ; break;  //Goofball Withdrawal
		//case 112:  item = ; break;  //Antsy in your Pantsy
		case 113:  item = 906; break;  //Popping Stomach
		case 114:  item = 910; break;  //Dwarven Hardiness
		//case 115:  item = ; break;  //Apathy
		case 119:  item = 926; break;  //On the Shoulders of Giants
		case 121:  item = 1038; break;  //Cock of the Walk
		//case 122:  item = ; break;  //Eggs-tra Sensory Perception
		//case 123:  item = ; break;  //Egg-stortionary Tactics
		//case 124:  item = ; break;  //Egg-stra Arm
		//case 125:  item = ; break;  //Egg-headedness
		//case 126:  item = ; break;  //Egg-cellent Vocabulary
		//case 127:  item = ; break;  //Gothy
		//case 128:  item = ; break;  //Flower Power
		//case 129:  item = 171; break;  //Eye of the Lihc
		case 132:  item = 1158; break;  //Engorged Weapon
		case 133:  item = 133; break;  //Mysteriously Handsome
		case 134:  item = 297; break;  //Tamarind Torment
		case 135:  item = 298; break;  //Spicy Limeness
		case 136:  item = 299; break;  //Mystic Pickleness
		case 137:  item = 300; break;  //Spicy Mouth
		case 138:  item = 1163; break;  //Hombre Muerto Caminando
		//case 145:  item = ; break;  //Object Detection
		case 150:  item = 1438; break;  //Twinklebritches
		case 151:  item = 1439; break;  //Flame-Retardant Trousers
		case 152:  item = 1440; break;  //Insulated Trousers
		case 153:  item = 1441; break;  //Spookypants
		case 154:  item = 1442; break;  //Smelly Pants
		case 155:  item = 1443; break;  //Sleaze-Resistant Trousers
		case 156:  item = 1444; break;  //Twinkly Weapon
		case 157:  item = 1445; break;  //Flaming Weapon
		case 158:  item = 1446; break;  //Frigid Weapon
		case 159:  item = 1447; break;  //Spooky Weapon
		case 160:  item = 1448; break;  //Stinky Weapon
		case 161:  item = 1449; break;  //Sleazy Weapon
		case 173:  item = 1513; break;  //Big Veiny Brain
		case 174:  item = 1514; break;  //Peeled Eyeballs
		case 175:  item = 1515; break;  //Wasabi Sinuses
		case 176:  item = 1512; break;  //Heavy Pettin
		case 178:  item = -1; break;  //Bootyliciousness		case 179:  item = -1; break;  //Make Meat FA$T!		case 180:  item = -1; break;  //Temporary Blindness
		case 181:  item = 1599; break;  //Jazz Hands
		case 189:  item = 1637; break;  //Hotform
		case 190:  item = 1638; break;  //Coldform
		case 191:  item = 1639; break;  //Spookyform
		case 192:  item = 1640; break;  //Stenchform
		case 193:  item = 1641; break;  //Sleazeform
		case 194:  item = 1592; break;  //Hot Breath
		case 195:  item = 1593; break;  //Cold Breath
		case 196:  item = 1594; break;  //Spooky Breath
		case 197:  item = 1595; break;  //Stinky Breath
		case 198:  item = 1596; break;  //Sleazy Breath
		case 199:  item = 1450; break;  //Aspect of the Twinklefairy
		case 200:  item = 1451; break;  //Hot Blooded
		case 201:  item = 1452; break;  //Cold Blooded
		case 202:  item = 1453; break;  //Spooky Demeanor
		case 203:  item = 1454; break;  //Stenchtastic
		case 204:  item = 1455; break;  //Supafly
		case 205:  item = 1607; break;  //Provocative Perkiness
		case 206:  item = 1608; break;  //Ermine Eyes
		case 207:  item = 1609; break;  //Eau D'enmity
		case 208:  item = 1610; break;  //Ocelot Eyes
		case 209:  item = 1611; break;  //Ponderous Potency
		case 210:  item = 1612; break;  //Concentrated Concentration
		case 211:  item = 1650; break;  //Got Milk
		case 212:  item = 1695; break;  //Papowerful
		case 213:  item = 1694; break;  //Frog In Your Throat
		case 214:  item = 1692; break;  //Salamander In Your Stomach
		case 215:  item = 1693; break;  //Newt Gets In Your Eyes
		case 219:  item = -1; break;  //Bubble, Bubble
		case 218:  item = 1704; break;  //Amorous
		case 220:  item = 1787; break;  //Sticky Fingers
		case 221:  item = 1794; break;  //Chalky Hand
		case 223:  item = -1; break;  //Dreams and Lights		case 226:  item = -1; break;  //Talking Like a Pirate		case 227:  item = -1; break;  //The 'Tussin		case 228:  item = -1; break;  //Pie in the Face		case 229:  item = -1; break;  //Hip to Be Square Dancin'		case 230:  item = -1; break;  //Livin' Large		case 231:  item = -1; break;  //Wistfully Nostalgic		case 232:  item = -1; break;  //Happy Salamander		case 233:  item = -1; break;  //Techno Bliss			case 234:  item = -1; break;  //Material Witness		case 235:  item = -1; break;  //No Worries		case 236:  item = -1; break;  //Metal Speed		case 237:  item = -1; break;  //Radium Radicality		case 238:  item = -1; break;  //Wintergreen Warmongery		case 239:  item = -1; break;  //Also Schmeckt Zarathustra		case 240:  item = -1; break;  //Vitamin-Maxed		case 241:  item = -1; break;  //Got Your Boots On		case 242:  item = -1; break;  //The Q Is Talking To You		case 243:  item = -1; break;  //Bad Luck		case 244:  item = 2056; break;  //Deadly Flashing Blade		case 245:  item = 2059; break;  //Locks Like the Raven		case 246:  item = -1; break;  //Smugness		case 247:  item = -1; break;  //Good Karma		case 248:  item = -1; break;  //Pumped Up		case 249:  item = -1; break;  //Head on Fire, Ass Catching		case 250:  item = -1; break;  //Violent Night		case 251:  item = -1; break;  //White Knuckles		case 252:  item = -1; break;  //Don't Rest Ye, Bold Adventurer		case 253:  item = -1; break;  //Frosty the Hitman		case 254:  item = -1; break;  //Coy to the Hurled		case 255:  item = -1; break;  //Crimbo Epiphany		case 256:  item = -1; break;  //Bells in the Batfry		case 257:  item = -1; break;  //Carol of the Bones		case 258:  item = -1; break;  //Get Me Off This Crazy Thing!		case 259:  item = -1; break;  //Very Clean Teeth		case 260:  item = -1; break;  //Arse-a'fire		case 261:  item = -1; break;  //Lemon Enlightenment		case 262:  item = -1; break;  //Squirming Like a Toad		case 263:  item = -1; break;  //Eau de Tortue		case 264:  item = -1; break;  //Majorly Poisoned
		case 265:  item = 1*GM_getValue(NEG_EFFECTS_ACTION_KEY2, NEG_EFFECTS_ACTION_NOTHING); break;  //Tenuous Grip on Reality
		case 266:  item = -1; break;  //Turned Into a Skeleton		case 267:  item = -1; break;  //Barking Dogs
		case 268:  item = 1*GM_getValue(NEG_EFFECTS_ACTION_KEY2, NEG_EFFECTS_ACTION_NOTHING); break;  //Prestidigysfunction
		case 269:  item = 2304; break;  //White Heart
		case 270:  item = 2305; break;  //Pink Heart
		case 271:  item = 2306; break;  //Orange Heart
		case 272:  item = 2307; break;  //Lavender Heart
		case 273:  item = 2308; break;  //Yellow Heart
		case 274:  item = 2309; break;  //Green Heart		case 275:  item = -1; break;  //Ultrahydrated		case 276:  item = -1; break;  //Disco Inferno		case 277:  item = -1; break;  //Disco Nirvana		case 278:  item = -1; break;  //Disco Concentration		case 280:  item = -1; break;  //Kiss of the Black Fairy		case 281:  item = -1; break;  //Tangled Up		case 282:  item = -1; break;  //A Little Bit Poisoned		case 283:  item = -1; break;  //Somewhat Poisoned		case 284:  item = -1; break;  //Really Quite Poisoned		case 285:  item = 2344; break;  //Filthworm Larva Stench		case 286:  item = 2345; break;  //Filthworm Drone Stench		case 287:  item = 2346; break;  //Filthworm Guard Stench		case 289:  item = -1; break;  //Bananas!		case 290:  item = -1; break;  //What's That Smell?		case 291:  item = -1; break;  //Mad at Science
		case 292:  item = 1*GM_getValue(NEG_EFFECTS_ACTION_KEY2, NEG_EFFECTS_ACTION_NOTHING); break;  //Tetanus
		case 293:  item = -1; break;  //Half-Eaten Brain		case 294:  item = -1; break;  //Fearless
		case 295:  item = 1*GM_getValue(NEG_EFFECTS_ACTION_KEY2, NEG_EFFECTS_ACTION_NOTHING); break;  //Socialismydia
		case 300:  item = -1; break;  //Infinite Loop
		case 301:  item = 1*GM_getValue(NEG_EFFECTS_ACTION_KEY2, NEG_EFFECTS_ACTION_NOTHING); break;  //Cunctatitis
		case 302:  item = -1; break;  //Mild Lycanthropy		case 303:  item = -1; break;  //Lycanthropy, Eh?		case 304:  item = -1; break;  //Roids of the Rhinoceros		case 305:  item = -1; break;  //Happy Trails		case 306:  item = -1; break;  //Piratastic		case 307:  item = -1; break;  //Healthy Green Glow		case 308:  item = -1; break;  //Sinuses For Miles		case 309:  item = -1; break;  //One Very Clear Eye		case 310:  item = -1; break;  //Pop-eyed		case 311:  item = -1; break;  //Flamingly Floral		case 312:  item = -1; break;  //Permafrosty		case 313:  item = -1; break;  //Bloody Bloody Bloody!		case 314:  item = -1; break;  //Chauve-Souris Merde Fou		case 315:  item = -1; break;  //Cuts Like a Buttered Knife		case 316:  item = -1; break;  //Impregnably Delicious		case 317:  item = -1; break;  //Fireproof Lips
		case 319:  item = -1; break;  //Hyphemariffic
		case 323:  item = -1; break;  //Burning Hands		case 324:  item = -1; break;  //Burning Ears		case 325:  item = -1; break;  //Burning Soul		case 326:  item = -1; break;  //Frozen Hands		case 327:  item = -1; break;  //Frozen Shoulders		case 328:  item = -1; break;  //Soul Freeze		case 329:  item = -1; break;  //Broken Fast		case 330:  item = -1; break;  //Hoity Toity		case 331:  item = -1; break;  //On the Trail		case 332:  item = -1; break;  //Moon'd		case 333:  item = -1; break;  //Dilated Pupils
		case 334:  item = -1; break;  //Optimist Primal		case 335:  item = -1; break;  //Elvish		case 336:  item = -1; break;  //Winklered		case 337:  item = -1; break;  //White-boy Angst		case 338:  item = -1; break;  //Fustulent		case 339:  item = -1; break;  //Tin, Man		case 340:  item = -1; break;  //Can't Be a Chooser		case 341:  item = -1; break;  //Ass Over Teakettle		case 342:  item = -1; break;  //Bestial Sympathy		case 343:  item = -1; break;  //La Bamba		case 344:  item = -1; break;  //Blessing of Pikachutlotal		case 345:  item = -1; break;  //Blessing of Charcoatl		case 346:  item = -1; break;  //Blessing of Squirtlcthulli		case 347:  item = -1; break;  //Blessing of Bulbazinalli		case 348:  item = -1; break;  //All Fired Up
		case 349:  item = 2595; break;  //Ben-Gal Balm
		case 350:  item = -1; break;  //Starry-Eyed		case 351:  item = 2631; break;  //Comic Violence -> gremlin juice		case 352:  item = -1; break;  //Tranquilized Mind		case 353:  item = -1; break;  //Woad Warrior		case 354:  item = -1; break;  //Red Door Syndrome		case 355:  item = -1; break;  //Spirit of Alph		case 356:  item = -1; break;  //Night Vision		case 357:  item = -1; break;  //Absinthe-Minded		case 358:  item = -1; break;  //Rat-Faced		case 359:  item = -1; break;  //Dancing Prowess		case 360:  item = -1; break;  //No Vertigo		case 361:  item = -1; break;  //Good with the Ladies		case 362:  item = -1; break;  //Bats in the Belfry		case 363:  item = -1; break;  //Unusual Fashion Sense		case 364:  item = -1; break;  //Feelin' Philosophical		case 365:  item = -1; break;  //Moon June Spooned		case 366:  item = -1; break;  //Inspired!		case 367:  item = -1; break;  //Ringing Ears		case 368:  item = -1; break;  //Man's Worst Enemy		case 369:  item = -1; break;  //Extremely Poor Taste		case 370:  item = -1; break;  //The Real Deal		case 371:  item = -1; break;  //Memento MoirŽ		case 372:  item = -1; break;  //Flashing Eyes		case 373:  item = -1; break;  //Mmmmmelon		case 374:  item = -1; break;  //Contagious Bad Luck		case 375:  item = -1; break;  //Sparkling Consciousness		case 376:  item = -1; break;  //Sneaky Serpentine Subtlety		case 377:  item = -1; break;  //Adrenaline Rush		case 378:  item = 2356; break;  //Crusty Head
		case 379:  item = 2355; break;  //henna face paint
		case 382:  item = 2708; break;  //Funky dried mushroom
		case 383:  item = 2711; break;  //black facepaint
		case 384:  item = 2712; break;  //black sheepskin diploma
		case 385:  item = 2713; break;  //black body spray
		case 433:  item = 1*GM_getValue(NEG_EFFECTS_ACTION_KEY2, NEG_EFFECTS_ACTION_NOTHING); break;  //Easily Embarrassed
		default: item = -1;
	}
	return item;
}

function getSpellFromEffect(effectId) {
	spell = -1;
	var negEffects = 1*GM_getValue(NEG_EFFECTS_ACTION_KEY, NEG_EFFECTS_ACTION_NOTHING);
	var negEffects2 = 1*GM_getValue(NEG_EFFECTS_ACTION_KEY2, NEG_EFFECTS_ACTION_NOTHING);
	if (negEffects == NEG_EFFECTS_ACTION_NOTHING) negEffects = -1;
	if (negEffects2 == NEG_EFFECTS_ACTION_NOTHING) negEffects2 = -1;
	switch(effectId) {
		case 2:   spell = negEffects; break;  //Sleepy
		case 3:   spell = negEffects; break;  //Confused
		case 4:   spell = negEffects; break;  //Embarrassed
		case 7:   spell = 1*GM_getValue(BEATEN_UP_ACTION_KEY, BEATEN_UP_ACTION_NOTHING);
			  if (spell == BEATEN_UP_ACTION_SGEE) spell = -1;
			  break; //Beaten up
		case 16:  spell = 3010; break;  //Leash of Linguini
		case 18:  spell = 2007; break;  //Ghostly Shell
		case 19:  spell = 2008; break;  //Reptilian Fortitude
		case 21:  spell = 1000; break;  //Seal Clubbing Frenzy
		case 22:  spell = 2000; break;  //Patience of the Tortoise
		case 23:  spell = 3000; break;  //Pasta Oneness
		case 24:  spell = 4000; break;  //Saucemastery
		case 25:  spell = 5000; break;  //Disco State of Mind
		case 26:  spell = 6000; break;  //Mariachi Mood
		case 43:  spell = negEffects; break;  //Wussiness
		case 50:  spell = 2009; break;  //Empathy
		case 51:  spell = 2010; break;  //Tenacity of the Snapper
		case 52:  spell = 2012; break;  //Astral Shell
		case 53:  spell = 4007; break;  //Elemental Saucesphere
		case 54:  spell = 4008; break;  //Jalapeï¿½o Saucesphere
		case 55:  spell = 4011; break;  //Jabaï¿½ero Saucesphere
		case 60:  spell = 6003; break;  //Aloysius' Antiphon of Aptitude
		case 61:  spell = 6004; break;  //Moxious Madrigal
		case 62:  spell = 6005; break;  //Cletus's Canticle of Celerity
		case 63:  spell = 6006; break;  //Polka of Plenty
		case 64:  spell = 6007; break;  //Magical Mojomuscular Melody
		case 65:  spell = 6008; break;  //Power Ballad of the Arrowsmith
		case 66:  spell = 6009; break;  //Brawnee's Anthem of Absorption
		case 67:  spell = 6010; break;  //Fat Leon's Phat Loot Lyric
		case 68:  spell = 6011; break;  //Psalm of Pointiness
		case 69:  spell = 6012; break;  //Jackasses' Symphony of Destruction
		case 70:  spell = 6013; break;  //Stevedave's Shanty of Superiority
		case 71:  spell = 6014; break;  //Ode to Booze
		case 130:  spell = 3015; break;  //Springy Fusilli
		case 131:  spell = 1015; break;  //Rage of the Reindeer
		case 162:  spell = 6015; break;  //The Sonata of Sneakiness
		case 163:  spell = 6016; break;  //Carlweather's Cantata of Confrontation
		case 164:  spell = 6017; break;  //Ur-Kel's Aria of Annoyance
		case 165:  spell = 5017; break;  //Smooth Movements
		case 166:  spell = 1019; break;  //Musk of the Moose
		case 167:  spell = 3101; break;  //Spirit of Cayenne
		case 168:  spell = 3102; break;  //Spirit of Peppermint
		case 169:  spell = 3103; break;  //Spirit of Garlic
		case 170:  spell = 3104; break;  //Spirit of Wormwood
		case 171:  spell = 3105; break;  //Spirit of Bacon Grease
		case 222:  spell = 1020; break;  //Snarl of the Timberwolf
		case 224:  spell = 4019; break;  //Scarysauce
		case 225:  spell = 6018; break;  //Dirge of Dreadfulness
		case 265:  spell = negEffects2; break;  //Tenuous Grip on Reality
		case 268:  spell = negEffects2; break;  //Prestidigysfunction
		case 292:  spell = negEffects2; break;  //Tetanus
		case 295:  spell = negEffects2; break;  //Socialismydia
		case 301:  spell = negEffects2; break;  //Cunctatitis
		case 403:  spell = negEffects2; break;  //Easily Embarrassed
		default: spell = -1;
	}
	return spell;
}

function createHiddenField(name, val) {
	var field = document.createElement("input");
	field.setAttribute("type", "hidden");
	field.setAttribute("name", name);
	field.setAttribute("id", name);
	field.setAttribute("value", val);
	return field;
}
function setRadioOption() {
	GM_setValue(this.name, this.value);
	top.frames[1].location.reload();
}
function setListOption() {
	GM_setValue(this.name, this.value);
	//reset the default quantity to 1 if they are changing the display to none
	if (this.id == 'quantity' && this.value == QUANTITY_DISPLAY_NEITHER) GM_setValue(DEF_QUANTITY_KEY, '1');
	top.frames[1].location.reload();
}
function displayConfigMenu(e) {
        var configPanel = window.open("", "rfConfigPanel","width=750,height=550");

        var html = '<h1>CharPane Recaster Config</h1>';
	html += '<br/>version ' + GM_getValue("scriptVer","?") + '<br/>';
	var x = 1;

	var i = 1*GM_getValue(REPLACE_ICONS_KEY, 1);
	html += "<br/>" + x++ + ".  Replace icons with abbreviated effect text in brief mode?&nbsp;&nbsp;";
	html += "<input type='radio' name='" + REPLACE_ICONS_KEY + "' id='icons1' value='1' " + (i != 2?"checked":"") + "/>Yes&nbsp;&nbsp;";
	html += "<input type='radio' name='" + REPLACE_ICONS_KEY + "' id='icons2' value='2' " + (i == 2?"checked":"") + "/>No";

	var c = 1*GM_getValue(COLORIZE_KEY, 1);
	html += "<br/>" + x++ + ".  Colorize remaining effect duration (currently for durations <= 5)?&nbsp;&nbsp;";
	html += "<input type='radio' name='" + COLORIZE_KEY + "' id='color1' value='1' " + (c != 2?"checked":"") + "/>Yes&nbsp;&nbsp;";
	html += "<input type='radio' name='" + COLORIZE_KEY + "' id='color2' value='2' " + (c == 2?"checked":"") + "/>No";

	var r = 1*GM_getValue(ROLLOVER_EFFECT_KEY, 0);
	html += "<br/>" + x++ + ".  Hi-lite effects which are affected on mouse rollover?&nbsp;&nbsp;";
	html += "<input type='radio' name='" + ROLLOVER_EFFECT_KEY + "' id='rollover1' value='0' " + (r != 1?"checked":"") + "/>Yes&nbsp;&nbsp;";
	html += "<input type='radio' name='" + ROLLOVER_EFFECT_KEY + "' id='rollover2' value='1' " + (r == 1?"checked":"") + "/>No";

        var q = 1*GM_getValue(QUANTITY_DISPLAY_KEY, QUANTITY_DISPLAY_BOTTOM);
	html += "<br/>" + x++ + ".  Display quantity selectors?&nbsp;&nbsp;";
	html += "<select id='quantity' name='" + QUANTITY_DISPLAY_KEY + "'>";
	html += " <option value='" + QUANTITY_DISPLAY_TOP     + "' " + (q == QUANTITY_DISPLAY_TOP?    "selected":"") + ">Above Effects</option>";
	html += " <option value='" + QUANTITY_DISPLAY_BOTTOM  + "' " + (q == QUANTITY_DISPLAY_BOTTOM? "selected":"") + ">Below Effects</option>";
	html += " <option value='" + QUANTITY_DISPLAY_BOTH    + "' " + (q == QUANTITY_DISPLAY_BOTH?   "selected":"") + ">Both Above and Below Effects</option>";
	html += " <option value='" + QUANTITY_DISPLAY_NEITHER + "' " + (q == QUANTITY_DISPLAY_NEITHER?"selected":"") + ">Do not display</option>";
	html += "</select>";

	var i = 1*GM_getValue(QUANTITY_LISTBOXES_KEY, 0);
	html += "<br/>" + x++ + ".  How do you want the quantity of effects recast displayed?&nbsp;&nbsp;";
	html += "<input type='radio' name='" + QUANTITY_LISTBOXES_KEY + "' id='listboxes1' value='0' " + (i != 1?"checked":"") + "/>Radio Buttons&nbsp;&nbsp;";
	html += "<input type='radio' name='" + QUANTITY_LISTBOXES_KEY + "' id='listboxes2' value='1' " + (i == 1?"checked":"") + "/>List Boxes";

        var m = 1*GM_getValue(REPEAT_MAX_COUNT_KEY, 5);
	html += "<br/>" + x++ + ".  What is the upper limit on how many multicasts you want to be able select (i.e., at most 5 times? 6?)?&nbsp;&nbsp;";
	html += "<select id='maxCount' name='" + REPEAT_MAX_COUNT_KEY + "'>";
	for (var x = 2; x <= 10; x++) {
		html += " <option value='" + x + "' " + (m == x?"selected":"") + ">" + x + "</option>";
	}
	html += "</select>";

        var h = 1*GM_getValue(HEAL_DISPLAY_KEY, HEAL_ACTION_NOTHING);
	html += "<br/>" + x++ + ".  Which heal do you want to use when clicking on your HP in the char pane?&nbsp;&nbsp;";
	html += "<select id='heal' name='" + HEAL_DISPLAY_KEY + "'>";
	html += " <option value='" + HEAL_ACTION_NOTHING      + "' " + (h == HEAL_ACTION_NOTHING?     "selected":"") + ">None, I don't ever heal</option>";
	html += " <option value='" + HEAL_ACTION_LASAGNA      + "' " + (h == HEAL_ACTION_LASAGNA?     "selected":"") + ">Lasagna Bandages</option>";
	html += " <option value='" + HEAL_ACTION_COCOON       + "' " + (h == HEAL_ACTION_COCOON ?     "selected":"") + ">Cannelloni Cocoon</option>";
	html += " <option value='" + HEAL_ACTION_OTTER        + "' " + (h == HEAL_ACTION_OTTER  ?     "selected":"") + ">Tongue of the Otter</option>";
	html += " <option value='" + HEAL_ACTION_WALRUS       + "' " + (h == HEAL_ACTION_WALRUS ?     "selected":"") + ">Tongue of the Walrus</option>";
	html += " <option value='" + HEAL_ACTION_DISCONAP     + "' " + (h == HEAL_ACTION_DISCONAP?     "selected":"") + ">Disco Nap</option>";
	html += " <option value='" + HEAL_ACTION_POWERNAP     + "' " + (h == HEAL_ACTION_POWERNAP?     "selected":"") + ">Disco Power Nap</option>";
	html += "</select>";

	var d = 1*GM_getValue(DISPLAY_RESULTS_KEY, 1);
	html += "<br/>" + x++ + ".  Do you want to display the results of buffing/healing (in the main window)?&nbsp;&nbsp;";
	html += "<input type='radio' name='" + DISPLAY_RESULTS_KEY + "' id='results1' value='1' " + (d != 0?"checked":"") + "/>Yes&nbsp;&nbsp;";
	html += "<input type='radio' name='" + DISPLAY_RESULTS_KEY + "' id='results2' value='0' " + (d == 0?"checked":"") + "/>No";

        var n = 1*GM_getValue(NEG_EFFECTS_ACTION_KEY, NEG_EFFECTS_ACTION_NOTHING);
	html += "<br/>" + x++ + ".  What should happen when you click on Wussiness, Sleepy, Embarrassed, or Confused effects?&nbsp;&nbsp;";
	html += "<select id='negeffects' name='" + NEG_EFFECTS_ACTION_KEY + "'>";
	html += " <option value='" + NEG_EFFECTS_ACTION_NOTHING       + "' " + (n == NEG_EFFECTS_ACTION_NOTHING?      "selected":"") + ">Nothing</option>";
	html += " <option value='" + NEG_EFFECTS_ACTION_POWERNAP      + "' " + (n == NEG_EFFECTS_ACTION_POWERNAP?     "selected":"") + ">Disco Nap</option>";
	html += " <option value='" + NEG_EFFECTS_ACTION_DISCOPOWERNAP + "' " + (n == NEG_EFFECTS_ACTION_DISCOPOWERNAP?"selected":"") + ">Disco Power Nap</option>";
	html += " <option value='" + NEG_EFFECTS_ACTION_SGEE          + "' " + (n == NEG_EFFECTS_ACTION_SGEE?         "selected":"") + ">SGEE</option>";
	html += "</select>";

        var n = 1*GM_getValue(NEG_EFFECTS_ACTION_KEY2, NEG_EFFECTS_ACTION_NOTHING);
	html += "<br/>" + x++ + ".  What should happen when you click on Cunctatitis, Prestidigysfunction, Tetanus, Easily Embarrassed, Tenuous Grip on Reality?&nbsp;&nbsp;";
	html += "<select id='negeffects2' name='" + NEG_EFFECTS_ACTION_KEY2 + "'>";
	html += " <option value='" + NEG_EFFECTS_ACTION_NOTHING       + "' " + (n == NEG_EFFECTS_ACTION_NOTHING?      "selected":"") + ">Nothing</option>";
	html += " <option value='" + NEG_EFFECTS_ACTION_DISCOPOWERNAP + "' " + (n == NEG_EFFECTS_ACTION_DISCOPOWERNAP?"selected":"") + ">Disco Power Nap</option>";
	html += " <option value='" + NEG_EFFECTS_ACTION_SGEE          + "' " + (n == NEG_EFFECTS_ACTION_SGEE?         "selected":"") + ">SGEE</option>";
	html += "</select>";

        var b = 1*GM_getValue(BEATEN_UP_ACTION_KEY, BEATEN_UP_ACTION_NOTHING);
	html += "<br/>" + x++ + ".  What should happen when you click on the Beaten Up effect?&nbsp;&nbsp;";
	html += "<select id='beaten' name='" + BEATEN_UP_ACTION_KEY + "'>";
	html += " <option value='" + BEATEN_UP_ACTION_NOTHING + "' " + (b == BEATEN_UP_ACTION_NOTHING? "selected":"") + ">Nothing</option>";
	html += " <option value='" + BEATEN_UP_ACTION_OTTER   + "' " + (b == BEATEN_UP_ACTION_OTTER?   "selected":"") + ">Tongue of the Otter</option>";
	html += " <option value='" + BEATEN_UP_ACTION_WALRUS  + "' " + (b == BEATEN_UP_ACTION_WALRUS?  "selected":"") + ">Tongue of the Walrus</option>";
	html += " <option value='" + BEATEN_UP_ACTION_HOUSE    + "' " + (b == BEATEN_UP_ACTION_HOUSE?    "selected":"") + ">Tiny House</option>";
	html += " <option value='" + BEATEN_UP_ACTION_SGEE    + "' " + (b == BEATEN_UP_ACTION_SGEE?    "selected":"") + ">SGEE</option>";
	html += "</select>";

        var p = 1*GM_getValue(POISONED_ACTION_KEY, POISONED_ACTION_NOTHING);
	html += "<br/>" + x++ + ".  What should happen when you on the Poisoned effect?&nbsp;&nbsp;";
	html += "<select id='poisoned' name='" + POISONED_ACTION_KEY + "'>";
	html += " <option value='" + POISONED_ACTION_NOTHING       + "' " + (p == POISONED_ACTION_NOTHING?      "selected":"") + ">Nothing</option>";
	html += " <option value='" + POISONED_ACTION_ANTIDOTE      + "' " + (p == POISONED_ACTION_ANTIDOTE?     "selected":"") + ">Anti-anti-antidote</option>";
	html += " <option value='" + POISONED_ACTION_SGEE          + "' " + (p == POISONED_ACTION_SGEE?         "selected":"") + ">SGEE</option>";
	html += "</select>";


	html += "<br/><br/>Close this window when done; changes take effect immediately.";

	configPanel.document.write(html);
	configPanel.document.close();

	configPanel.document.getElementById('icons1').addEventListener("click", setRadioOption, false);
	configPanel.document.getElementById('icons2').addEventListener("click", setRadioOption, false);
	configPanel.document.getElementById('color1').addEventListener("click", setRadioOption, false);
	configPanel.document.getElementById('color2').addEventListener("click", setRadioOption, false);
	configPanel.document.getElementById('rollover1').addEventListener("click", setRadioOption, false);
	configPanel.document.getElementById('rollover2').addEventListener("click", setRadioOption, false);
	configPanel.document.getElementById('listboxes1').addEventListener("click", setRadioOption, false);
	configPanel.document.getElementById('listboxes2').addEventListener("click", setRadioOption, false);
	configPanel.document.getElementById('quantity').addEventListener("change", setListOption, false);
	configPanel.document.getElementById('maxCount').addEventListener("change", setListOption, false);
	configPanel.document.getElementById('heal').addEventListener("change", setListOption, false);
	configPanel.document.getElementById('results1').addEventListener("click", setRadioOption, false);
	configPanel.document.getElementById('results2').addEventListener("click", setRadioOption, false);
	configPanel.document.getElementById('poisoned').addEventListener("change", setListOption, false);
	configPanel.document.getElementById('negeffects').addEventListener("change", setListOption, false);
	configPanel.document.getElementById('negeffects2').addEventListener("change", setListOption, false);
	configPanel.document.getElementById('beaten').addEventListener("change", setListOption, false);
	configPanel.document.title = "RetroFrog's CharPane Recaster Configuration";
}

GM_registerMenuCommand("RetroFrog's CharPane Recaster Config", displayConfigMenu);
if (window.location.pathname == "/charpane.php") {
	getUserData();
}

