diff --git a/index.html b/index.html
index 70a3310..e8199bc 100644
--- a/index.html
+++ b/index.html
@@ -31,7 +31,7 @@
-
+
diff --git a/js/surprise.js b/js/surprise.js
index 3139cce..9fe5b96 100644
--- a/js/surprise.js
+++ b/js/surprise.js
@@ -51,3 +51,66 @@ var eggSwitchHot = new Egg("h,o,t", function() {
var eggSaveDefaultHot = new Egg("s,e,x,y", function() {
isNowHot = setDefaultImg(isNowHot);
}).listen();
+
+
+
+function EggClick(n, f) {
+ var egg;
+ this.i = 0;
+ this.f = f;
+ this.clickNumber = n;
+ this.nextClick = nextClick;
+ this.endLongClick = endLongClick;
+ this.reinitState = reinitState;
+
+ $(".egg").click(function() {
+ egg.nextClick();
+ });
+
+ var pressTimer;
+ $(".egg").mouseup(function(){
+ clearTimeout(pressTimer);
+ return false;
+ }).mousedown(function(){
+ pressTimer = window.setTimeout(function() {
+ egg.endLongClick();
+ },
+ 2000)
+ return false;
+ });
+
+ $("body").click(function(e) {
+ if (!$(e.target).hasClass('egg')) {
+ egg.reinitState();
+ }
+ });
+ egg = this;
+}
+
+function nextClick () {
+ if(this.i < this.clickNumber )
+ this.i += 1;
+ else
+ this.reinitState();
+}
+
+function endLongClick () {
+ if(this.i == this.clickNumber)
+ this.f();
+ else
+ this.reinitState();
+}
+
+function reinitState () {
+ this.i = 0;
+}
+
+
+var eggSwitchHotClick = new EggClick("3", function() {
+ isNowHot = switchImg(isNowHot);
+});
+
+var eggSaveDefaultHot = new EggClick("5", function() {
+ isNowHot = setDefaultImg(isNowHot);
+});
+