"use strict";

DATA_SDS_SCRIPTED_EVENTS["Grace_get_help"] = {
		0 : {
			customPre : function(cacheVars){
				cacheVars.meli = cacheVars.objMgr.getNamedObject("Meli");
				cacheVars.grace = cacheVars.objMgr.getNamedObject("Grace");
				cacheVars.melody = cacheVars.objMgr.getNamedObject("Melody");
				if (cacheVars.grace && cacheVars.meli){
					cacheVars.grace.direction = (cacheVars.grace.sprite.x>cacheVars.meli.sprite.x) ? -1 : 1;
				}
				
				if (DATA_SDS_DIALOGUE["Grace_c2_leaving_0"]){
					cacheVars.wait=true;
					cacheVars.dlgMgr.open("Grace_c2_leaving_0",function(index,retval){
						if (retval!=null){
							cacheVars.wait=false; // yay js scoping
							GLOBAL_DIARY.note(2,"HELP_GRACIE");
							// set Gracie to homing mode
							if (cacheVars.grace && cacheVars.meli && cacheVars.melody){
								cacheVars.grace.root=cacheVars.meli;
								cacheVars.grace.root_name="Meli";
								cacheVars.grace.target=cacheVars.melody;
								cacheVars.grace.target_name="Melody";
							}
						}
					});
				}
			},
			controls : {},
			customPost : noop
		},
	};

DATA_SDS_SCRIPTED_EVENTS["Meli_shrine2_pray"] = {
		0 : {
			customPre : function(cacheVars){
				cacheVars.meli = cacheVars.objMgr.getNamedObject("Meli");
				if (cacheVars.meli){
					// we'll be controlling Meli here, so...
					cacheVars.controls = cacheVars.meli.controls;
					cacheVars.meli.controls = new Controls();

					cacheVars.meli.overrideFrame = 27;
					cacheVars.meli.overrideFrame += cacheVars.meli.direction>0 ? 0 : 32;
				}
			},
			controls : {},
			customPost : noop
		},
		
		60 : {
			customPre : noop,
			controls : {},
			customPost : function(cacheVars){
				if (cacheVars.meli){
					cacheVars.meli.overrideFrame=null;
					cacheVars.meli.controls = cacheVars.controls;
					delete cacheVars.controls;
				}
				if (!GLOBAL_SCRATCHPAD.check("PRAYED") && !GLOBAL_DIARY.hasTear("S2_ALTAR")){
					//var altar = cacheVars.objMgr.getNamedObject("Altar");
					cacheVars.altar = cacheVars.objMgr.getNamedObject("Altar");
					if (cacheVars.altar){
						//var tear = new GO_Tear("S1_ALTAR");
						cacheVars.tear = new GO_Tear("S2_ALTAR");
						cacheVars.tear.spawnOnSprite(cacheVars.altar.sprite,cacheVars.objMgr);
						cacheVars.tear.sprite.y-=32;
						//var poof = new GO_Poof();
						cacheVars.poof = new GO_Poof();
						cacheVars.poof.spawnOnSprite(cacheVars.altar.sprite,cacheVars.objMgr);
						cacheVars.poof.sprite.y-=32;
					}
				}
				GLOBAL_SCRATCHPAD.note("PRAYED",true)
			}
		}
	};

DATA_SDS_SCRIPTED_EVENTS["Melody_free"] = {
		0 : {
			customPre : function(cacheVars){
				cacheVars.grace = cacheVars.objMgr.getNamedObject("Grace");
				if (cacheVars.grace){
					cacheVars.grace.root=null;
					cacheVars.grace.root_name=null;
					cacheVars.grace.target=null;
					cacheVars.grace.target_name=null;
				}

				cacheVars.meli = cacheVars.objMgr.getNamedObject("Meli");
				if (cacheVars.meli){
					// this is a multi-dialog event; we want to lock down movement between them
					cacheVars.controls = cacheVars.meli.controls;
					cacheVars.meli.controls = new Controls();
				}
				cacheVars.melody = cacheVars.objMgr.getNamedObject("Melody");
				if (cacheVars.melody && cacheVars.meli){
					cacheVars.melody.direction = (cacheVars.melody.sprite.x>cacheVars.meli.sprite.x) ? -1 : 1;
				}
				
				if (DATA_SDS_DIALOGUE["Melody_c2_gracie_0"]){
					cacheVars.wait=true;
					cacheVars.dlgMgr.open("Melody_c2_gracie_0",function(index,retval){
						if (retval!=null){
							cacheVars.wait=false; // yay js scoping
						}
					});
				}
			},
			controls : {},
			customPost : noop
		},
		1 : {
			customPre : noop,
			controls : {
				"Melody":{A:true}
			},
			customPost : noop
		},
		6 : {
			customPre : noop,
			controls : {
				"Melody":{A:false}
			},
			customPost : noop
		},
		11 : {
			customPre : noop,
			controls : {
				"Melody":{A:true}
			},
			customPost : noop
		},
		16 : {
			customPre : noop,
			controls : {
				"Melody":{A:false}
			},
			customPost : noop
		},
		30 : {
			customPre : noop,
			controls : {
				"Melody":{A:true}
			},
			customPost : noop
		},
		45 : {
			customPre : function(cacheVars){
				if (DATA_SDS_DIALOGUE["Melody_c2_gracie_1"]){
					cacheVars.wait=true;
					cacheVars.dlgMgr.open("Melody_c2_gracie_1",function(index,retval){
						if (retval!=null){
							cacheVars.wait=false; // yay js scoping
						}
					});
				}
			},
			controls : {},
			customPost : noop
		},
		46 : {
			customPre : function(cacheVars){
				if (DATA_SDS_DIALOGUE["Grace_c2_melody_offer"]){
					cacheVars.wait=true;
					cacheVars.dlgMgr.open("Grace_c2_melody_offer",function(index,retval){
						if (retval!=null){
							cacheVars.wait=false; // yay js scoping
						}
					});
				}
			},
			controls : {},
			customPost : noop
		},
		47 : {
			customPre : function(cacheVars){
				if (DATA_SDS_DIALOGUE["Melody_c2_gracie_2"]){
					cacheVars.wait=true;
					cacheVars.dlgMgr.open("Melody_c2_gracie_2",function(index,retval){
						if (retval!=null){
							cacheVars.wait=false; // yay js scoping
						}
					});
				}
			},
			controls : {},
			customPost : noop
		},
		48 : {
			customPre : noop,
			controls : {},
			customPost : function(cacheVars){
				GLOBAL_DIARY.note(2,"HELP_MELODY");

				if (cacheVars.meli && cacheVars.controls){
					cacheVars.meli.controls = cacheVars.controls;
					delete cacheVars.controls;
				}

				//var grace = cacheVars.objMgr.getNamedObject("Grace");
				// set Gracie to homing mode
				if (cacheVars.grace && cacheVars.meli){
					cacheVars.grace.root=cacheVars.meli;
					cacheVars.grace.root_name="Meli";
					cacheVars.grace.target=null; // until the shrine door is in place
					cacheVars.grace.target_name="SubDoor";
				}

			}
		},
	};

DATA_SDS_SCRIPTED_EVENTS["Paola_meet_paola"] = {
		0 : {
			customPre : function(cacheVars){
				cacheVars.grace = cacheVars.objMgr.getNamedObject("Grace");
				cacheVars.paola = cacheVars.objMgr.getNamedObject("Paola");
				cacheVars.meli = cacheVars.objMgr.getNamedObject("Meli");
				if (cacheVars.grace && cacheVars.paola){
					cacheVars.grace.direction = (cacheVars.grace.sprite.x>cacheVars.paola.sprite.x) ? -1 : 1;
					cacheVars.paola.direction = (cacheVars.grace.sprite.x>cacheVars.paola.sprite.x) ? 1 : -1;
				}
				if (cacheVars.paola && cacheVars.meli){
					//cacheVars.paola.direction = (cacheVars.paola.sprite.x>cacheVars.meli.sprite.x) ? -1 : 1;
				}

				
				if (cacheVars.meli){
					// this is a multi-dialog event; we want to lock down movement between them
					cacheVars.controls = cacheVars.meli.controls;
					cacheVars.meli.controls = new Controls();
				}

				
				
				if (DATA_SDS_DIALOGUE["Paola_c2_meetpaola_0"]){
					cacheVars.wait=true;
					cacheVars.dlgMgr.open("Paola_c2_meetpaola_0",function(index,retval){
						if (retval!=null){
							cacheVars.wait=false; // yay js scoping
						}
					});
				}
			},
			controls : {},
			customPost : noop
		},
		
		1 : {
			customPre : function(cacheVars){
				if (DATA_SDS_DIALOGUE["Grace_c2_meetpaola_0"]){
					cacheVars.wait=true;
					cacheVars.dlgMgr.open("Grace_c2_meetpaola_0",function(index,retval){
						if (retval!=null){
							cacheVars.wait=false; // yay js scoping
						}
					});
				}
			},
			controls : {},
			customPost : noop
		},

		2 : {
			customPre : function(cacheVars){
				if (DATA_SDS_DIALOGUE["Paola_c2_meetpaola_1"]){
					cacheVars.wait=true;
					cacheVars.dlgMgr.open("Paola_c2_meetpaola_1",function(index,retval){
						if (retval!=null){
							cacheVars.wait=false; // yay js scoping
						}
					});
				}
			},
			controls : {},
			customPost : noop
		},

		3 : {
			customPre : function(cacheVars){
				if (DATA_SDS_DIALOGUE["Grace_c2_meetpaola_1"]){
					cacheVars.wait=true;
					cacheVars.dlgMgr.open("Grace_c2_meetpaola_1",function(index,retval){
						if (retval!=null){
							cacheVars.wait=false; // yay js scoping
						}
					});
				}
			},
			controls : {},
			customPost : noop
		},

		4 : {
			customPre : function(cacheVars){
				if (DATA_SDS_DIALOGUE["Paola_c2_meetpaola_2"]){
					cacheVars.wait=true;
					cacheVars.dlgMgr.open("Paola_c2_meetpaola_2",function(index,retval){
						if (retval!=null){
							cacheVars.wait=false; // yay js scoping
						}
					});
				}
			},
			controls : {},
			customPost : noop
		},

		5 : {
			customPre : function(cacheVars){
				if (DATA_SDS_DIALOGUE["Grace_c2_meetpaola_2"]){
					cacheVars.wait=true;
					cacheVars.dlgMgr.open("Grace_c2_meetpaola_2",function(index,retval){
						if (retval!=null){
							cacheVars.wait=false; // yay js scoping
						}
					});
				}
			},
			controls : {},
			customPost : noop
		},

		6 : {
			customPre : function(cacheVars){
				if (DATA_SDS_DIALOGUE["Paola_c2_meetpaola_3"]){
					cacheVars.wait=true;
					cacheVars.dlgMgr.open("Paola_c2_meetpaola_3",function(index,retval){
						if (retval!=null){
							cacheVars.wait=false; // yay js scoping
						}
					});
				}
			},
			controls : {},
			customPost : noop
		},

		7 : {
			customPre : function(cacheVars){
				if (DATA_SDS_DIALOGUE["Grace_c2_meetpaola_3"]){
					cacheVars.wait=true;
					cacheVars.dlgMgr.open("Grace_c2_meetpaola_3",function(index,retval){
						if (retval!=null){
							cacheVars.wait=false; // yay js scoping
						}
					});
				}
			},
			controls : {},
			customPost : noop
		},

		8 : {
			customPre : function(cacheVars){
				if (DATA_SDS_DIALOGUE["Paola_c2_meetpaola_4"]){
					cacheVars.wait=true;
					cacheVars.dlgMgr.open("Paola_c2_meetpaola_4",function(index,retval){
						if (retval!=null){
							cacheVars.wait=false; // yay js scoping
						}
					});
				}
			},
			controls : {},
			customPost : noop
		},

		9 : {
			customPre : noop,
			controls : {
				"Paola":{left:true, down:true}
			},
			customPost : noop
		},

		99 : {
			customPre : noop,
			controls : {
				"Paola":{left:true, down:false}
			},
			customPost : noop
		},

		219 : {
			customPre : noop,
			controls : {
				"Paola":{left:false, down:false}
			},
			customPost : function(cacheVars){

				if (cacheVars.paola){
					cacheVars.paola.sprite.map_room.removeSprite(cacheVars.paola.sprite);
					cacheVars.objMgr.remove(cacheVars.paola);
				}

			}
		},

		220 : {
			customPre : function(cacheVars){
				if (DATA_SDS_DIALOGUE["Nautilus_vestibule_open"]){
					cacheVars.wait=true;
					cacheVars.dlgMgr.open("Nautilus_vestibule_open",function(index,retval){
						if (retval!=null){
							cacheVars.wait=false; // yay js scoping
						}
					});
				}
			},
			controls : {},
			customPost : noop
		},

		
		221 : {
			customPre : noop,
			controls : {},
			customPost : function(cacheVars){
				GLOBAL_DIARY.note(2,"MET_PAOLA");

				if (cacheVars.meli && cacheVars.controls){
					cacheVars.meli.controls = cacheVars.controls;
					delete cacheVars.controls;
				}

				if (cacheVars.grace){
					cacheVars.grace.target_name="Passage_Back";
					cacheVars.grace.target=null;
				}

			}
		},
	};

	DATA_SDS_SCRIPTED_EVENTS["Paola_bossfight_1"] = {
		0 : {
			customPre : function(cacheVars){
				cacheVars.grace = cacheVars.objMgr.getNamedObject("Grace");
				cacheVars.paola = cacheVars.objMgr.getNamedObject("Paola");
				cacheVars.meli = cacheVars.objMgr.getNamedObject("Meli");
				if (cacheVars.meli && cacheVars.paola){
					cacheVars.paola.direction = (cacheVars.meli.sprite.x>cacheVars.paola.sprite.x) ? 1 : -1;
				}
				
				if (DATA_SDS_DIALOGUE["Paola_c2_bossstart"]){
					cacheVars.wait=true;
					cacheVars.dlgMgr.open("Paola_c2_bossstart",function(index,retval){
						if (retval!=null){
							cacheVars.wait=false; // yay js scoping
						}
					});
				}
			},
			controls : {},
			customPost : noop
		},
		
		1 : {
			customPre : noop,
			controls : {},
			customPost : function(cacheVars){
				if (cacheVars.grace){
					cacheVars.grace.target_name=null;
					cacheVars.grace.target=null;
					cacheVars.grace.bossfight=true;
				}
				if (cacheVars.paola){
					cacheVars.paola.startFight();
				}

				SDS.switchBgm("a Tea Party with Death and Cookies",true);

			}
		},
	};

	DATA_SDS_SCRIPTED_EVENTS["Paola_bossfight_2"] = {
		0 : {
			customPre : function(cacheVars){
				cacheVars.grace = cacheVars.objMgr.getNamedObject("Grace");
				cacheVars.paola = cacheVars.objMgr.getNamedObject("Paola");
				cacheVars.meli = cacheVars.objMgr.getNamedObject("Meli");
				if (cacheVars.meli && cacheVars.paola){
					cacheVars.paola.direction = (cacheVars.meli.sprite.x>cacheVars.paola.sprite.x) ? 1 : -1;
				}

				if (cacheVars.grace){
					cacheVars.grace.target_name="Paola";
					cacheVars.grace.target=null;
					cacheVars.grace.bossfight=false;
				}
				
				if (cacheVars.grace){
					if (cacheVars.grace.hp>0){
						if (DATA_SDS_DIALOGUE["Paola_c2_bossend_good"]){
							cacheVars.wait=true;
							cacheVars.dlgMgr.open("Paola_c2_bossend_good",function(index,retval){
								if (retval!=null){
									cacheVars.wait=false; // yay js scoping
									GLOBAL_DIARY.note(2,"BOSS_GOOD");
								}
							});
						}
					}
					else{
						if (DATA_SDS_DIALOGUE["Paola_c2_bossend_fail"]){
							cacheVars.wait=true;
							cacheVars.dlgMgr.open("Paola_c2_bossend_fail",function(index,retval){
								if (retval!=null){
									cacheVars.wait=false; // yay js scoping
									GLOBAL_DIARY.note(2,"BOSS_BAD");
								}
							});
						}
					}
				}
			},
			controls : {},
			customPost : noop
		},
		
		1 : {
			customPre : noop,
			controls : {},
			customPost : function(cacheVars){
				if (cacheVars.grace){
					cacheVars.grace.target_name=null; // TODO: Necklace
					cacheVars.grace.target=null;
					cacheVars.grace.bossfight=false;
				}
				if (cacheVars.paola){
					cacheVars.paola.cleanupFight();
				}

			}
		},
	};

	DATA_SDS_SCRIPTED_EVENTS["Paola_revisit"] = {
		0 : {
			customPre : function(cacheVars){
				cacheVars.paola = cacheVars.objMgr.getNamedObject("Paola");
				cacheVars.meli = cacheVars.objMgr.getNamedObject("Meli");
				if (cacheVars.meli && cacheVars.paola){
					cacheVars.paola.direction = (cacheVars.meli.sprite.x>cacheVars.paola.sprite.x) ? 1 : -1;
				}
				
				
				if (DATA_SDS_DIALOGUE["Paola_c2_bossend_good_revisit"]){
					cacheVars.wait=true;
					cacheVars.dlgMgr.open("Paola_c2_bossend_good_revisit",function(index,retval){
						if (retval!=null){
							cacheVars.wait=false; // yay js scoping
						}
					});
				}
					
					
				
			},
			controls : {},
			customPost : noop
		},
		
		1 : {
			customPre : noop,
			controls : {},
			customPost : function(cacheVars){
				if (cacheVars.paola){
					cacheVars.paola.dropSoul();
				}

			}
		},
	};

	DATA_SDS_SCRIPTED_EVENTS["Gar_return"] = {
		0 : {
			customPre : function(cacheVars){
				cacheVars.meli = cacheVars.objMgr.getNamedObject("Meli");
				
				if (DATA_SDS_DIALOGUE["Gar_return"]){
					cacheVars.wait=true;
					cacheVars.dlgMgr.open("Gar_return",function(index,retval){
						if (retval!=null){
							cacheVars.wait=false; // yay js scoping
							
							if (retval && cacheVars.meli){ // implicit ===1
								cacheVars.pass = new GO_Passage(
									1<<4,
									1<<4,
									function(){return "shallows";},
									function(sprite){
										sprite.x = 10<<4;
										sprite.y = 10<<4;
										sprite.game_object.direction = 1; // since this should always be Meli, or at least a NPC
									});
								cacheVars.pass.spawnOnSprite(cacheVars.meli.sprite,cacheVars.meli.manager);
							}
						}
					});
				}
			},
			controls : {},
			customPost : noop
		},
	};

	DATA_SDS_SCRIPTED_EVENTS["Nosce_Te_Ipsum"] = {
		0 : {
			customPre : function(cacheVars){
				cacheVars.meli = cacheVars.objMgr.getNamedObject("Meli");
				cacheVars.desk = cacheVars.objMgr.getNamedObject("MeliDesk");
				if (cacheVars.meli && cacheVars.desk){
					// we'll be controlling Meli here, so...
					cacheVars.controls = cacheVars.meli.controls;
					cacheVars.meli.controls = new Controls();

					cacheVars.meli.direction = 1;
					cacheVars.meli.sprite.x = cacheVars.desk.sprite.x+2;
					//cacheVars.meli.overrideFrame = 27;
					//cacheVars.meli.overrideFrame += cacheVars.meli.direction>0 ? 0 : 32;
				}
				
				if (DATA_SDS_DIALOGUE["Nosce_Te_Ipsum"]){
					cacheVars.wait=true;
					cacheVars.dlgMgr.open("Nosce_Te_Ipsum",function(index,retval){
						if (retval!=null){
							cacheVars.wait=false; // yay js scoping
						}
					});
				}
			},
			controls : {},
			customPost : noop
		},
		
		1 : {
			customPre : noop,
			controls : {},
			customPost : function(cacheVars){
				if (cacheVars.meli){
					cacheVars.soul = new GO_MeliSoul();
					cacheVars.soul.spawnOnSprite(cacheVars.meli.sprite,cacheVars.objMgr);
					cacheVars.soul.sprite.y-=16;

					cacheVars.poof = new GO_Poof();
					cacheVars.poof.spawnOnSprite(cacheVars.meli.sprite,cacheVars.objMgr);
					cacheVars.poof.sprite.y-=16;

					cacheVars.meli.overrideFrame=null;
					cacheVars.meli.controls = cacheVars.controls;
					delete cacheVars.controls;
				}
				
			}
		}
	};

	
	DATA_SDS_SCRIPTED_EVENTS["Meli_Soul"] = {};
	var evt = DATA_SDS_SCRIPTED_EVENTS["Meli_Soul"];
	var t=0;
	evt[t] = {
			customPre : function(cacheVars){
				cacheVars.meli = cacheVars.objMgr.getNamedObject("Meli");
				if (cacheVars.meli){
					// we'll be controlling Meli here, so...
					cacheVars.controls = cacheVars.meli.controls;
					cacheVars.meli.controls = new Controls();
				}

				//cacheVars.bgmName = SDS.bgmName;
				SDS.bgm.stop();
				
				if (DATA_SDS_DIALOGUE["Get_MeliSoul"]){
					cacheVars.wait=true;
					cacheVars.dlgMgr.open("Get_MeliSoul",function(index,retval){
						if (retval!=null){
							cacheVars.wait=false; // yay js scoping
						}
					});
				}
			},
			controls : {},
			customPost : noop
		};
	evt[++t] = {
			customPre : function(cacheVars){
				if (cacheVars.meli){
					cacheVars.meli.overrideFrame = 16; // rising/aspirational
					cacheVars.meli.overrideFrame += cacheVars.meli.direction>0 ? 0 : 32;
				}
				SDS.switchBgm("Self; Pity",true);
				
				if (DATA_SDS_DIALOGUE["Meli_Soul_0"]){
					cacheVars.wait=true;
					cacheVars.dlgMgr.open("Meli_Soul_0",function(index,retval){
						if (retval!=null){
							cacheVars.wait=false; // yay js scoping
							if (cacheVars.meli) cacheVars.meli.overrideFrame = null;
						}
					});
				}
			},
			controls : {},
			customPost : noop
		};
	// allow enough time to fall/land
	evt[t+=15] = {
			customPre : function(cacheVars){
				if (cacheVars.meli){
					cacheVars.meli.overrideFrame = 27; // prayer/reflection
					cacheVars.meli.overrideFrame += cacheVars.meli.direction>0 ? 0 : 32;
				}
				
				if (DATA_SDS_DIALOGUE["Meli_Soul_1"]){
					cacheVars.wait=true;
					cacheVars.dlgMgr.open("Meli_Soul_1",function(index,retval){
						if (retval!=null){
							cacheVars.wait=false; // yay js scoping
						}
					});
				}
			},
			controls : {},
			customPost : noop
		};
	evt[++t] = {
			customPre : function(cacheVars){
				if (cacheVars.meli){
					cacheVars.meli.overrideFrame = 24; // "kick windup", also, a good leaning/lounging frame
					cacheVars.meli.direction = 1; // face the picture
					cacheVars.meli.overrideFrame += cacheVars.meli.direction>0 ? 0 : 32;
				}
				
				SDS.switchBgm("a Breath of Darkness",false);

				if (DATA_SDS_DIALOGUE["Meli_Soul_2"]){
					cacheVars.wait=true;
					cacheVars.dlgMgr.open("Meli_Soul_2",function(index,retval){
						if (retval!=null){
							cacheVars.wait=false; // yay js scoping
						}
					});
				}
			},
			controls : {},
			customPost : noop
		};
	evt[++t] = {
			customPre : function(cacheVars){
				if (cacheVars.meli){
					cacheVars.meli.overrideFrame = 19; // prone
					cacheVars.meli.overrideFrame += cacheVars.meli.direction>0 ? 0 : 32;
				}
				
				SDS.bgm.stop();

				if (DATA_SDS_DIALOGUE["Meli_Soul_3"]){
					cacheVars.wait=true;
					cacheVars.dlgMgr.open("Meli_Soul_3",function(index,retval){
						if (retval!=null){
							cacheVars.wait=false; // yay js scoping
						}
					});
				}
			},
			controls : {},
			customPost : noop
		};
	evt[++t] = {
			customPre : function(cacheVars){
				if (cacheVars.meli){
					cacheVars.meli.overrideFrame = 27; // prayer/reflection
					cacheVars.meli.overrideFrame += cacheVars.meli.direction>0 ? 0 : 32;
				}
			},
			controls : {},
			customPost : noop
		};
	evt[t+=20] = {
			customPre : noop,
			controls : {},
			customPost : function(cacheVars){
				if (cacheVars.meli){
					cacheVars.meli.overrideFrame=null;
					cacheVars.meli.controls = cacheVars.controls;
					delete cacheVars.controls;
				}
				//SDS.switchBgm(cacheVars.bgmName,true);
				SDS.switchBgm("The Toll of Peace",true);
			}
		};

evt = null;
t=null;
