aboutsummaryrefslogtreecommitdiff
path: root/web/images/tooltip.js
blob: 56687bdf1b648dfb62b72b1adaa86aedb4a1da62 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
 /**********************************************************
 *             Popup Window Definition Part                *
 *                                                         *
 * To add a popup window, add a string definition below.   *
 * To include the item in the printing friendly page,      *
 * modify the longStr by adding the item to it.            *
 * Don't change anything else.                             *
 **********************************************************/

var htmlOpener = "<html><head><title>Tooltip and Popup Window Demo</title>"+
		 "</head><body bgcolor='navyblue'><p>"
var htmlCloser = "</body></html>"

 demo1 = "<center><b>Title Here.</b></center><p>It is fun. Don't forget to put a line break here.<p>"

 demo2 = "No title in this window. Just plain text.<p>"
 
 demo3 = "How much is a picture worth? <p><center><img src='corr.gif'>"+
         "</center><p>"

/****END OF STRING DEFINITION*****/

 var popupWin
 var wholeWin
  function popup(term)  // write corresponding content to the popup window
  {
    popupWin = window.open("", "puWin",  "width=480,height=200,scrollbars,dependent,resizable");
   popupWin.document.open("text/html", "replace"); 
   popupWin.document.write(htmlOpener);
   popupWin.document.write(term);
   popupWin.document.write(htmlCloser);
   popupWin.document.close();  // close layout stream
   popupWin.focus();  // bring the popup window to the front
  }
 
  function closeDep() {
  if (popupWin && popupWin.open && !popupWin.closed) popupWin.close();
  if (wholeWin && wholeWin.open && !wholeWin.closed) wholeWin.close();

  }

   
/***********************END OF FUNCTION POPUP******************************/

  function printwhole()
  {
	longStr ="<center><h2>Annotated Output for Proc Univariate</h2></center>";
	longStr += demo1 + demo2 + demo3;
	
	wholeWin = window.open("","wWin", "width=800,height=500,dependent=yes,scrollbars=yes,resizable=yes,toolbar=yes,menubar=yes");
	wholeWin.document.open("text/html","replace");
	wholeWin.document.write(htmlOpener);
	wholeWin.document.write(longStr);
	wholeWin.document.write(htmlCloser);
	wholeWin.document.close();
	wholeWin.focus();}

/*******End of popup window stuff*********/


/***************************Tooltip Part Begins***************************/
  var style = ((NS4 && document.test) || IE4) ? 1 : 0;
  var timerID = null;
  var padding = 3; // < 4 recommended
  var bgcolor = "beige";
  var borWid = 1; // for no border, assign null
  var borCol = "#0000cc";
  var borSty = "solid";
  var str = "<STYLE TYPE='text/css'>";

  str += ".tooltip {";
  str += "position: absolute;";
  str += "visibility: hidden;";
  str += "left: 0; top: 0;";

  if (borWid > 0) { // if a border is specified

  str += "border-width: " + borWid + ";";
  str += "border-color: " + borCol + ";";
  str += "border-style: " + borSty + ";";

}

  if (NS4) {

  if (borWid > 0 && padding <= 3) {
    str += "padding: 0;";
    str += "layer-background-color: " + bgcolor + ";"; } 
    
    else if (borWid > 0 && padding > 3) {
    str += "padding: " + (padding - 3) + ";";
    str += "background-color: " + bgcolor + ";";

  } else if (borWid == 0) {
    str += "padding: " + padding + ";";
    str += "layer-background-color: " + bgcolor + ";";

  }

} else {
  str += "padding: " + padding + ";";
  str += "background-color: " + bgcolor + ";";
}

  str += "}";
  str += "</STYLE>";


  if (style) {
  document.write(str);
  if (NS4) window.onload = init;
}

/**************************************************
*        Making your tooltip text here            *
* This is the only place that need to be modified.*
* The first argument is the name of the tooltip.  *
* The second argument is the width and last one   *
* is the content of the tooltip.                  *
**************************************************/


makeEl("map", 200, "<font size=3>This will do an interval regression using your data against the chromosome you just selected </font>");
makeEl("chrs", 200, "<font size=3>This will allow you to choose the chromosome you want to do the interval mapping</font>");
makeEl("normal", 200, "<font size=3>This will generate a graph to assess if your data is normally distributed</font>");
makeEl("link", 200, "<font size=3>This will do a Marker Regression using your data.</font>");
makeEl("save", 200, "<font size=3>This will save the data you just input into a text file</font>");


/*************************End of making tooltip text*************************/

function init() {
  setTimeout("window.onresize = redo", 1000);
}

function redo() {
  window.location.reload();
}

function makeEl(id, width, code) {
  if (!style) return;

  var str = "<STYLE TYPE='text/css'>";
  str += "#" + id + " {";
  str += "width: " + width + ";";
  str += "}";
  str += "</STYLE>";
  str += "<DIV CLASS='tooltip' ID='" + id + "'><center>" + code + "</center></DIV>";
   
  document.write(str);
}

function displayEl(left, top) {

  if (NS4) document.releaseEvents(Event.MOUSEMOVE);
  document.onmousemove = null;
  var whichEl = (NS4) ? document[active] : document.all[active].style;
  whichEl.left = left;
  whichEl.top = top;
  whichEl.visibility = (NS4) ? "show" : "visible";
}

function clearEl() {

  if (!style) return;
  var whichEl = (NS4) ? document[active] : document.all[active].style;
  whichEl.visibility = (NS4) ? "hide" : "hidden";
  active = null;

  if (timerID) clearTimeout(timerID);
  if (NS4) document.releaseEvents(Event.MOUSEMOVE);
  document.onmousemove = null;

}

function activateEl(id, e) {
  if (!style) return;
  active = id;

  if (NS4) document.captureEvents(Event.MOUSEMOVE);
  document.onmousemove = checkEl;
  checkEl(e);

  }

function checkEl(e) {
  if (timerID) clearTimeout(timerID);
  var left = (NS4) ? e.pageX : event.clientX + document.body.scrollLeft;
  var top = (NS4) ? e.pageY + 20 : event.clientY + document.body.scrollTop + 20;
  timerID = setTimeout("displayEl(" + left + ", " + top + ")", 300);
}