var sessionToken = "?token=null";
function isHtmlDoc(str) {
var i = str.lastIndexOf('.');
if (i > -1) {
var ext = str.substring(i).toLowerCase();
return (ext == ".htm" || ext == ".html")
}
return false;
}
function urlEncode(str) {
var encodedStr = escape(str);
encodedStr = encodedStr.replace(/\//g,"%2F");
encodedStr = encodedStr.replace(/\?/g,"%3F");
encodedStr = encodedStr.replace(/=/g,"%3D");
encodedStr = encodedStr.replace(/&/g,"%26");
encodedStr = encodedStr.replace(/@/g,"%40");
encodedStr = encodedStr.replace(/\+/g, "%2B");
return encodedStr;
}
function makeJavascriptSafe(fs) {
fs = fs.replace(/'/g, "~#~");
fs = fs.replace(/"/g, "~$~");
fs = fs.replace(/\\/g, "~*~");
fs = fs.replace(/~#~/g, "\\'");
fs = fs.replace(/~\$~/g, "\\\"");
fs = fs.replace(/~\*~/g, "\\\\");
fs = fs.replace(/\r/g, "");
fs = fs.replace(/\n/g, "\\n");
return fs;
}
function makeSafe(fs, encodeSpaces) {
// This is for when fs is the value of an input. i.e. value="fs". Similar perhaps to StringUtil.editHtml()
if (encodeSpaces){
fs = fs.replace(/ /g, " ");
}
fs = fs.replace(//g, ">");
fs = fs.replace(/"/g, """);
fs = fs.replace(/\n/g, "
");
return fs;
}
function getEl(elID) {
return document.all?document.all[elID]:document.getElementById(elID);
}
//-------------------------------------
/* HELPTIP FOLLOWs: usage:
*
*
* Help
*/
function showHelpTip(e, s) {
// find anchor element
var el = e.target ? e.target : e.srcElement;
while (el.tagName != "A")
el = el.parentNode;
// is there already a tooltip? If so, remove it
if (el._helpTip) {
document.body.removeChild(el._helpTip);
el._helpTip = null;
el.onblur = null;
return;
}
// create element and insert last into the body
var d = document.createElement("DIV");
d.className = "help-tooltip";
document.body.appendChild(d);
d.innerHTML = s;
// Allow clicks on A elements inside tooltip
d.onmousedown = function (e) {
if (!e) e = event;
var t = e.target ? e.target : e.srcElement;
while (t.tagName != "A" && t != d)
t = t.parentNode;
if (t == d) return;
el._onblur = el.onblur;
el.onblur = null;
};
d.onmouseup = function () {
el.onblur = el._onblur;
el.focus();
};
// position tooltip
var dw = document.width ? document.width : document.documentElement.offsetWidth - 25;
var scroll = getScroll();
if (e.clientX > dw - d.offsetWidth)
d.style.left = dw - d.offsetWidth + scroll.x + "px";
else
d.style.left = e.clientX - 2 + scroll.x + "px";
d.style.top = e.clientY + 18 + scroll.y + "px";
// add a listener to the blur event. When blurred remove tooltip and restore anchor
el.onblur = function () {
document.body.removeChild(d);
el.onblur = null;
el._helpTip = null;
};
// store a reference to the tooltip div
el._helpTip = d;
}
// returns the scroll left and top for the browser viewport.
function getScroll() {
if (document.body.scrollTop != undefined) { // IE model
var ieBox = document.compatMode != "CSS1Compat";
var cont = ieBox ? document.body : document.documentElement;
return {x : cont.scrollLeft, y : cont.scrollTop};
}
else {
return {x : window.pageXOffset, y : window.pageYOffset};
}
}
//------------------------------
function isCompatible(){
var isIE5 = (navigator.userAgent.indexOf("MSIE 5") > 0) ? 1 : 0;
var isIE55 = (navigator.userAgent.indexOf("MSIE 5.5") > 0) ? 1 : 0;
var isIE6 = (navigator.userAgent.indexOf("MSIE 6") > 0) ? 1 : 0;
var isNS6 = (navigator.userAgent.indexOf("Gecko") > 0) ? 1 : 0;
if(isIE5 || isIE55 || isIE6) {
return 1;
} else {
return 0;
}
}
function upload(){
popwithUpload('/Members/upload.jsp?token=null');
}
function confirmURL( url, message){
if (confirm(message)){
document.location=unescape(url);
}
}
function trim(s)
{
while ((s.substring(0,1) == ' ') || (s.substring(0,1) == '\n') || (s.substring(0,1) == '\r'))
{
s = s.substring(1,s.length);
}
while ((s.substring(s.length-1,s.length) == ' ') || (s.substring(s.length-1,s.length) == '\n') ||
(s.substring(s.length-1,s.length) == '\r'))
{
s = s.substring(0,s.length-1);
}
return s;
}
function isNewPara(contents) {
return (trim(contents) == '');
}
function uploadMulti(){
// window.open('/Members/uploadMulti.jsp?token=null','uploadMultiWin', 'width=600, height=355, resizeable=yes');
window.open('/Members/uploadMulti.jsp?token=null','', 'width=600, height=355, resizeable=yes');
}
function poptoken(newstr) {
popwith(newstr + '?token=null');
}
function popPageId(newstr) {
popwith(newstr + '?token=null&pageID=-1');
}
function popwith(newstr,w,h) {
// window.open(newstr,'small','width=400,height=140,resizable=yes');
var width = 400;
var height = 140;
if (arguments.length > 1) {
width = w;
height = h;
}
window.open(newstr,'','width=' + width + ',height=' + height + ',resizable=yes');
/* if(document.all) {
win = window.showModalDialog(newstr, null, 'help:no;status:no;dialogWidth:400px;dialogHeight:140px;');
} else {
win = window.open(newstr, null, 'modal,dialog,width=400px,height=140px');
}
return win;
*/
}
function popwithUpload(newstr) {
// window.open(newstr,'small','width=400,height=140,resizable=yes');
window.open(newstr,'upload','width=400,height=140,resizable=yes');
/* if(document.all) {
win = window.showModalDialog(newstr, null, 'help:no;status:no;dialogWidth:400px;dialogHeight:140px;');
} else {
win = window.open(newstr, null, 'modal,dialog,width=400px,height=140px');
}
return win;
*/
}
function getGoogleFormDef() {
var url = '