if (!this.JSON) {
JSON = function () {
function f(n) { 
return n < 10 ? '0' + n : n; }
Date.prototype.toJSON = function () {
return this.getUTCFullYear() + '-' + f(this.getUTCMonth() + 1) + '-' + f(this.getUTCDate()) + 'T' + f(this.getUTCHours()) + ':' + f(this.getUTCMinutes()) + ':' + f(this.getUTCSeconds()) + 'Z'; }; var m = { 
'\b': '\\b', '\t': '\\t', '\n': '\\n', '\f': '\\f', '\r': '\\r', '"' : '\\"', '\\': '\\\\'
}; function stringify(value, whitelist) {
var a, i, k, l, r = /["\\\x00-\x1f\x7f-\x9f]/g, v; switch (typeof value) {
case 'string': return r.test(value) ?
'"' + value.replace(r, function (a) {
var c = m[a]; if (c) {
return c; }
c = a.charCodeAt(); return '\\u00' + Math.floor(c / 16).toString(16) + (c % 16).toString(16); }) + '"' : '"' + value + '"'; case 'number': return isFinite(value) ? String(value) : 'null'; case 'boolean': case 'null': return String(value); case 'object': if (!value) {
return 'null'; }
if (typeof value.toJSON === 'function') {
return stringify(value.toJSON()); }
a = []; if (typeof value.length === 'number' &&
!(value.propertyIsEnumerable('length'))) {
l = value.length; for (i = 0; i < l; i += 1) {
a.push(stringify(value[i], whitelist) || 'null'); }
return '[' + a.join(',') + ']'; }
if (whitelist) {
l = whitelist.length; for (i = 0; i < l; i += 1) {
k = whitelist[i]; if (typeof k === 'string') {
v = stringify(value[k], whitelist); if (v) {
a.push(stringify(k) + ':' + v); }}
}} else {
for (k in value) {
if (typeof k === 'string') {
v = stringify(value[k], whitelist); if (v) {
a.push(stringify(k) + ':' + v); }}
}}
return '{' + a.join(',') + '}'; }}
return {
stringify: stringify, parse: function (text, filter) {
var j; function walk(k, v) {
var i, n; if (v && typeof v === 'object') {
for (i in v) {
if (Object.prototype.hasOwnProperty.apply(v, [i])) {
n = walk(i, v[i]); if (n !== undefined) {
v[i] = n; }}
}}
return filter(k, v); }
if (/^[\],:{}\s]*$/.test(text.replace(/\\./g, '@').
replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(:?[eE][+\-]?\d+)?/g, ']').
replace(/(?:^|:|,)(?:\s*\[)+/g, ''))) {
j = eval('(' + text + ')'); return typeof filter === 'function' ? walk('', j) : j; }
throw new SyntaxError('parseJSON:\n' + text); }}; }(); }
function CACHE() {
var data = window.localStorage || (window.globalStorage ? globalStorage[location.hostname] : null); var isLocalStorage = data !== null; var jscache = document.cookie.match(/jscache=([^;]{0,})/); if (!isLocalStorage) {
data = {}; if (jscache === null) {
CreateOrReplaceCookie(); } else {
eval('data = ' + unescape(jscache[1]) + ";"); }}
function CreateOrReplaceCookie() {
if (!isLocalStorage) {
document.cookie = "jscache=" + escape(JSON.stringify(data)) + ";"; }}
this.SetData = function(index, cdata, isObject) {
if (typeof isObject == 'boolean' && isObject) {
data[index] = JSON.stringify(cdata); } else {
data[index] = cdata; }
CreateOrReplaceCookie(); }; this.GetData = function(index, isObject) {
if (index in data) {
if (typeof isObject == 'boolean' && isObject) {
try {
var tmp; eval("tmp = " + data[index] + ";"); return tmp; } catch(e) {
return null; }} else {
return data[index]; }} else {
return null; }}; this.RemoveData = function(index) {
if (index in data) {
try{
delete data[index]; } catch(e) {
data[index] = (function() {return;})(); }
CreateOrReplaceCookie(); }}; this.Session = typeof sessionStorage !== 'undefined' ? {
"set": function(index, value, isObject) {
if (typeof isObject == 'boolean' && isObject) {
sessionStorage.setItem(index, JSON.stringify(value)); } else {
sessionStorage.setItem(index, value); }}, "get": function(index, isObject) {
if (typeof isObject == 'boolean' && isObject) {
try {
var tmp; eval("tmp = " + sessionStorage.getItem(index) + ";"); return tmp; } catch(e) {
return null; }} else {
return sessionStorage.getItem(index); }}, "remove": function(index) {
sessionStorage.removeItem(index); }, "clear": function() {
sessionStorage.clear(); }} : null; }
var Cache = new CACHE(); var UserAgent = {
"FireFox":	'Firefox', "MSIE":		'MSIE', "Safari":	'Safari', "Chrome":	'Chrome', "Opera":	'Opera', "Flock":	'Flock', "Netscape":	'Netscape', "Dolfin": 'Dolfin', "toString": function() {
return "Knowed browser types."; }}; var UA = new (function() {
var __SELF__ = this; var data = {
"name": ""
}; (function Init() {
var value, subValues, values = navigator.userAgent.match(/(\([^\)]*\))|([^\s]*)/g); for(var i = 0; i < values.length; i++) {
value = values[i]; if (value != "") {
switch(true) {
case (value.indexOf("(") >= 0): subValues = value.replace(/[\(\)]/g,"").match(/([^,^;]*)[,;\s]*/g); for(var j = 0; j < subValues.length; j++) {
value = subValues[j].replace(/[;,]\s/,""); if (value != "") {
addValue(value); }}
break; default: addValue(value); break; }}
}
function addValue(value) {
var tmp, prop = "", propValue = true; switch(true) {
case (value.indexOf("/") >=0): tmp = value.split("/"); prop = setPropertyName(tmp[0]); propValue = tmp[1]; break; case (value.indexOf(" ") > 0): tmp = value.match(/(..*)[\s](.*)/); prop = setPropertyName(tmp[1]); if (typeof tmp[2] !== "undefined") {
propValue = tmp[2]; }
break; default: prop = setPropertyName(value); break; }
if (typeof propValue == "string") {
if (propValue.match(/^[0-9]+$/)) {
propValue = parseInt(propValue,10); } else if (propValue.match(/^[0-9]+\.[0-9]+$/)) {
propValue = parseFloat(propValue); }}
if (prop in data) {
if (typeof data[prop][0] === "undefined") {
data[prop] = [ data[prop] ]; }
data[prop][data[prop].length] = propValue; } else {
data[prop] = propValue; }
switch(prop) {
case UserAgent.Chrome: case UserAgent.Dolfin: case UserAgent.FireFox: case UserAgent.Flock: case UserAgent.MSIE: case UserAgent.Netscape: case UserAgent.Opera: data.name = prop; break; case UserAgent.Safari: if (data.name == "") {
data.name = prop; }
break; }}
function setPropertyName(name) {
return name.replace(/[\s\.]/g,"_"); }
(function flashParamsInit() {
var axo; var e; if (UserAgent.MSIE in data) {
try {
axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7"); data.flashVersion = axo.GetVariable("$version"); } catch (e) {
} if (!("flashVersion" in data)) {
try {
axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6"); data.flashVersion = "WIN 6,0,21,0"; axo.AllowScriptAccess = "always"; data.flashVersion = axo.GetVariable("$version"); } catch (e) {
}}
if (!("flashVersion" in data)) {
try {
axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3"); data.flashVersion = axo.GetVariable("$version"); } catch (e) {
}}
if (!("flashVersion" in data)) {
try {
axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3"); data.flashVersion = "WIN 3,0,18,0"; } catch (e) {
}}
if (!("flashVersion" in data)) {
try {
axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash"); data.flashVersion = "WIN 2,0,0,11"; } catch (e) {
data.flashVersion = 0; }}
if (data.flashVersion != "0") {
data.flashInstalled = true; }} else {
if (navigator.plugins != null && navigator.plugins.length > 0) {
if (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]) {
var swVer2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : ""; data.flashVersion = navigator.plugins["Shockwave Flash" + swVer2].description.replace(/Shockwave Flash[ ]*/,""); data.flashInstalled = true; }}
else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.6") != -1) {
data.flashVersion = 4; data.flashInstalled = true; }
else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.5") != -1) {
data.flashVersion = 3; data.flashInstalled = true; }
else if (navigator.userAgent.toLowerCase().indexOf("webtv") != -1) {
data.flashVersion = 2; data.flashInstalled = true; }}
})(); })(); this.toString = function() {
return navigator.userAgent; }; this.hasGeolocation = "geolocation" in navigator; this.getGetCurrentPosition = function() {
return __SELF__.hasGeolocation ? navigator.geolocation.getCurrentPosition() : null; }; this.get = function(_prop) {
return _prop in data ? data[_prop] : null; }; this.isWebKit = function() {
return "WebKit" in data || "AppleWebKit" in data; }; this.isIE = function() {
return UserAgent.MSIE in data; }; this.isChrome = function() {
return UserAgent.Chrome in data; }; this.isSafari = function() {
return UserAgent.Safari in data && !__SELF__.isChrome() && !__SELF__.isDolfin(); }; this.isFirefox = function() {
return UserAgent.FireFox in data; }; this.isOpera = function() {
return UserAgent.Opera in data; }; this.isDolfin = function() {
return UserAgent.Dolfin in data; }; this.isBada = function() {
return "Bada" in data; }; this.isAdobeAIR = function() {
return "AdobeAIR" in data; }; this.isAndroid = function() {
return "Android" in data; }; this.isIPad = function() {
return "iPad" in data; }; this.isIPhone = function() {
return "iPhone" in data; }; this.isMobile = function() {
return "Mobile" in data || __SELF__.isAndroid() || __SELF__.isIPad() || __SELF__.isIPhone() || __SELF__.isBada(); }; this.isFlashInstalled = function() {
return data.flashInstalled; }; this.getFlashVersion = function() {
return data.flashVersion; }; this.compareBrowserType = function(_type) {
return _type in data; }; this.getVersion = function() {
var ver = 0; if (data.name in data) {
ver = parseFloat(data[data.name]); }
return ver; }; })(); function getElementsByClassName(strClass, strTag, objContElm) {
strTag = strTag || "*"; objContElm = objContElm || document; var objColl = objContElm.getElementsByTagName(strTag), arr = [], delim = '', arrClass = null, arrObjClass = null, i = 0, j = 0, c = 0, k = 0, l = 0, m = 0, n = 0; if (!objColl.length && strTag === "*" && objContElm.all) {
objColl = objContElm.all; }
delim = (strClass.indexOf('|') !== -1 ? '|' : ' '); arrClass = strClass.split(delim); for (i = 0, j = objColl.length; i < j; i += 1) {
arrObjClass = objColl[i].className.split(' '); if (delim === ' ' && arrClass.length > arrObjClass.length) {
continue; }
c = 0; comparisonLoop: for (k = 0, l = arrObjClass.length; k < l; k += 1) {
for (m = 0, n = arrClass.length; m < n; m += 1) {
if (arrClass[m] === arrObjClass[k]) {
c += 1; }
if ((delim === '|' && c === 1) || (delim === ' ' && c === arrClass.length)) {
arr.push(objColl[i]); break comparisonLoop; }}
}}
return arr; }
Array.prototype.inArray = function (p_val, p_strict) {
var i = 0, l = this.length; if (true !== p_strict && false !== p_strict) {
p_strict = false; }
for (i = 0; i < l; i += 1) {
if (this[i] === p_val || (!p_strict && this[i].toString() === p_val.toString())) {
return true; }}
return false; }; if (!Array.prototype.push) {
Array.prototype.push = function (value) {
this[this.length] = value; }; }
Date.prototype.dayValue = 24 * 60 * 60 * 1000; Date.prototype.mounthDayNum = []; Date.prototype.realDayOfMonth = 0; Date.prototype.mounthDayNum[-1] = 0; Date.prototype.mounthDayNum[0] = Date.prototype.mounthDayNum[-1] + 31; Date.prototype.mounthDayNum[1] = Date.prototype.mounthDayNum[0] + 28; Date.prototype.mounthDayNum[2] = Date.prototype.mounthDayNum[1] + 31; Date.prototype.mounthDayNum[3] = Date.prototype.mounthDayNum[2] + 30; Date.prototype.mounthDayNum[4] = Date.prototype.mounthDayNum[3] + 31; Date.prototype.mounthDayNum[5] = Date.prototype.mounthDayNum[4] + 30; Date.prototype.mounthDayNum[6] = Date.prototype.mounthDayNum[5] + 31; Date.prototype.mounthDayNum[7] = Date.prototype.mounthDayNum[6] + 31; Date.prototype.mounthDayNum[8] = Date.prototype.mounthDayNum[7] + 30; Date.prototype.mounthDayNum[9] = Date.prototype.mounthDayNum[8] + 31; Date.prototype.mounthDayNum[10] = Date.prototype.mounthDayNum[9] + 30; Date.prototype.mounthDayNum[11] = Date.prototype.mounthDayNum[10] + 31; Date.prototype.addDay = function (day) {
day = Number(day) || 1; this.setDate(this.getDate() + day); return this; }; Date.prototype.addMonth = function (month) {
month = Number(month) || 1; var oldmonth = this.getMonth(), newmonth = (oldmonth + month) % 12, addYear = parseInt((oldmonth + month) / 12, 10), monthDate = null, daynum = 0; if (this.realDayOfMonth === 0) {
this.realDayOfMonth = this.getDate(); }
this.setMonth(newmonth); this.setYear(this.getFullYear() + addYear); if (this.getMonth() > newmonth) {
this.setMonth(newmonth); }
monthDate = new Date(this); monthDate.setMonth(newmonth); daynum = Math.min(monthDate.getLastDayOfMonth(), this.realDayOfMonth); this.setDate(daynum); return this; }; Date.prototype.addYear = function (year) {
year = Number(year) || 1; this.addMonth(12 * year); return this; }; Date.prototype.isWeekDay = function () {
var day = this.getDay(); return (day > 0 && day < 6); }; Date.prototype.isWeekEnd = function () {
var day = this.getDay(); return (day === 0 || day === 6); }; Date.prototype.isInDays = function (days) {
var day = this.getDay(); return days.inArray(day); }; Date.prototype.getWeek = function () {
return parseInt((this.getDayOfYear() + (7 - this.getDay()) % 7) / 7, 10) + 1; }; Date.prototype.getDayOfYear = function () {
var DoY = this.mounthDayNum[this.getMonth() - 1] + this.getDate(); if (this.isLeapYear() && this.getMonth() > 1) {
DoY += 1; }
return DoY; }; Date.prototype.isLeapYear = function () {
return new Date(this.getYear(), 1, 29).getDate() === 29; }; Date.prototype.getWeekDiff = function (date) {
var d1 = new Date(this < date ? this : date), d2 = new Date(this >= date ? this : date), startweek = d1.getWeek(), weeks = 0, i = 0, yearLastDay = null; for (i = d1.getFullYear(); i < d2.getFullYear(); i += 1) {
yearLastDay = new Date(i, 11, 31); weeks += yearLastDay.getWeek(); weeks -= 1; }
weeks -= startweek; weeks += d2.getWeek(); return weeks; }; Date.prototype.getWeekDiff2 = function (date) {
var d1 = new Date(this < date ? this : date), d2 = new Date(this >= date ? this : date), daydiff = (d2.valueOf() - d1.valueOf()) / this.dayValue; return daydiff / 7; }; Date.prototype.getLastDayOfMonth = function () {
var daynum = 31; while (new Date(this.getFullYear(), this.getMonth(), daynum).getMonth() !== this.getMonth()) {
daynum -= 1; }
return daynum; }; Date.prototype.getDayListOfMonth = function (week, days_id) {
var days = [], dates = [], date = null, date_ = null, i = 0; if (days_id >= 0) {
days.push((days_id + 1) % 7); } else if (days_id == -1) {
days.push(0, 6); } else if (days_id == -2) {
days.push(1, 2, 3, 4, 5); }
if (days.length === 0) {
date = new Date(this); date.setDate(week == 5 ? date.getLastDayOfMonth() : week); dates.push(date); } else {
date = new Date(this); if (week == 5) {
date.setDate(date.getLastDayOfMonth() - 6); } else {
date.setDate((week - 1) * 7 + 1); }
for (i = 0; i < 7; i += 1) {
date_ = new Date(date); if (i > 0) {
date_.addDay(i); }
if (days.inArray(date_.getDay())) {
dates.push(date_); }}
}
return dates; }; Number.prototype.binFromStr = function(_str) {
return parseInt(_str,2); }; Number.prototype.toBinStr = function() {
var tmp, num; tmp = ""; num = Math.abs(this); if (num === 0) {
return "0"; }
while(num > 0) {
if (num === 1) {
num = 0; tmp = "1" + tmp; } else {
tmp = (num%2).toString() + tmp; num = Math.floor(num/2); }}
return tmp; }; Number.prototype.firstComplement = function() {
var tmp = this.toBinStr(); var tmp2 = ""; var i; for(i = 0; i < tmp.length; i++) {
tmp2 = tmp2.concat((tmp.charAt(i) === "0" ? "1" : "0")); }
return tmp2; }; Number.prototype.secondComplement = function() {
return this.firstComplement().toNum() + 1; }
String.prototype.toNum = function() {
return parseInt(this,2); }; String.prototype.repeat = function(_count) {
var i, tmp; tmp = ""; for(i = 0; i < _count; i++) {
tmp = tmp.concat(this); }
return tmp; }; String.prototype.utf8_encode = function() {
var string = this.replace(/\r\n/g,"\n"); var utftext = ""; for (var n = 0; n < string.length; n++) {
var c = string.charCodeAt(n); if (c < 128) {
utftext += String.fromCharCode(c); }
else if((c > 127) && (c < 2048)) {
utftext += String.fromCharCode((c >> 6) | 192); utftext += String.fromCharCode((c & 63) | 128); }
else {
utftext += String.fromCharCode((c >> 12) | 224); utftext += String.fromCharCode(((c >> 6) & 63) | 128); utftext += String.fromCharCode((c & 63) | 128); }}
return utftext; }; String.prototype.utf8_decode = function() {
var utftext = this.toString(); var string = ""; var i = 0; var c = c1 = c2 = 0; while ( i < utftext.length ) {
c = utftext.charCodeAt(i); if (c < 128) {
string += String.fromCharCode(c); i++; }
else if((c > 191) && (c < 224)) {
c2 = utftext.charCodeAt(i+1); string += String.fromCharCode(((c & 31) << 6) | (c2 & 63)); i += 2; }
else {
c2 = utftext.charCodeAt(i+1); c3 = utftext.charCodeAt(i+2); string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63)); i += 3; }}
return string; }; String.prototype.base64_encode = function() {
var key = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="; var output = ""; var chr1, chr2, chr3, enc1, enc2, enc3, enc4; var i = 0; input = this.utf8_encode(this.toString()); while (i < input.length) {
chr1 = input.charCodeAt(i++); chr2 = input.charCodeAt(i++); chr3 = input.charCodeAt(i++); enc1 = chr1 >> 2; enc2 = ((chr1 & 3) << 4) | (chr2 >> 4); enc3 = ((chr2 & 15) << 2) | (chr3 >> 6); enc4 = chr3 & 63; if (isNaN(chr2)) {
enc3 = enc4 = 64; } else if (isNaN(chr3)) {
enc4 = 64; }
output = output + key.charAt(enc1) + key.charAt(enc2) + key.charAt(enc3) + key.charAt(enc4); }
return output; }; String.prototype.base64_decode = function() {
var key = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="; var output = ""; var chr1, chr2, chr3; var enc1, enc2, enc3, enc4; var i = 0; var input = this.toString().replace(/[^A-Za-z0-9\+\/\=]/g, ""); while (i < input.length) {
enc1 = key.indexOf(input.charAt(i++)); enc2 = key.indexOf(input.charAt(i++)); enc3 = key.indexOf(input.charAt(i++)); enc4 = key.indexOf(input.charAt(i++)); chr1 = (enc1 << 2) | (enc2 >> 4); chr2 = ((enc2 & 15) << 4) | (enc3 >> 2); chr3 = ((enc3 & 3) << 6) | enc4; output = output + String.fromCharCode(chr1); if (enc3 != 64) {
output = output + String.fromCharCode(chr2); }
if (enc4 != 64) {
output = output + String.fromCharCode(chr3); }}
return output.utf8_decode(); }
String.prototype.MD5 = function () {
var string = this.toString(); function RotateLeft(lValue, iShiftBits) {
return (lValue<<iShiftBits) | (lValue>>>(32-iShiftBits)); }
function AddUnsigned(lX,lY) {
var lX4,lY4,lX8,lY8,lResult; lX8 = (lX & 0x80000000); lY8 = (lY & 0x80000000); lX4 = (lX & 0x40000000); lY4 = (lY & 0x40000000); lResult = (lX & 0x3FFFFFFF)+(lY & 0x3FFFFFFF); if (lX4 & lY4) {
return (lResult ^ 0x80000000 ^ lX8 ^ lY8); }
if (lX4 | lY4) {
if (lResult & 0x40000000) {
return (lResult ^ 0xC0000000 ^ lX8 ^ lY8); } else {
return (lResult ^ 0x40000000 ^ lX8 ^ lY8); }} else {
return (lResult ^ lX8 ^ lY8); }}
function F(x,y,z) { return (x & y) | ((~x) & z); }
function G(x,y,z) { return (x & z) | (y & (~z)); }
function H(x,y,z) { return (x ^ y ^ z); }
function I(x,y,z) { return (y ^ (x | (~z))); }
function FF(a,b,c,d,x,s,ac) {
a = AddUnsigned(a, AddUnsigned(AddUnsigned(F(b, c, d), x), ac)); return AddUnsigned(RotateLeft(a, s), b); }; function GG(a,b,c,d,x,s,ac) {
a = AddUnsigned(a, AddUnsigned(AddUnsigned(G(b, c, d), x), ac)); return AddUnsigned(RotateLeft(a, s), b); }; function HH(a,b,c,d,x,s,ac) {
a = AddUnsigned(a, AddUnsigned(AddUnsigned(H(b, c, d), x), ac)); return AddUnsigned(RotateLeft(a, s), b); }; function II(a,b,c,d,x,s,ac) {
a = AddUnsigned(a, AddUnsigned(AddUnsigned(I(b, c, d), x), ac)); return AddUnsigned(RotateLeft(a, s), b); }; function ConvertToWordArray(string) {
var lWordCount; var lMessageLength = string.length; var lNumberOfWords_temp1=lMessageLength + 8; var lNumberOfWords_temp2=(lNumberOfWords_temp1-(lNumberOfWords_temp1 % 64))/64; var lNumberOfWords = (lNumberOfWords_temp2+1)*16; var lWordArray=Array(lNumberOfWords-1); var lBytePosition = 0; var lByteCount = 0; while ( lByteCount < lMessageLength ) {
lWordCount = (lByteCount-(lByteCount % 4))/4; lBytePosition = (lByteCount % 4)*8; lWordArray[lWordCount] = (lWordArray[lWordCount] | (string.charCodeAt(lByteCount)<<lBytePosition)); lByteCount++; }
lWordCount = (lByteCount-(lByteCount % 4))/4; lBytePosition = (lByteCount % 4)*8; lWordArray[lWordCount] = lWordArray[lWordCount] | (0x80<<lBytePosition); lWordArray[lNumberOfWords-2] = lMessageLength<<3; lWordArray[lNumberOfWords-1] = lMessageLength>>>29; return lWordArray; }; function WordToHex(lValue) {
var WordToHexValue="",WordToHexValue_temp="",lByte,lCount; for (lCount = 0;lCount<=3;lCount++) {
lByte = (lValue>>>(lCount*8)) & 255; WordToHexValue_temp = "0" + lByte.toString(16); WordToHexValue = WordToHexValue + WordToHexValue_temp.substr(WordToHexValue_temp.length-2,2); }
return WordToHexValue; }; var x=Array(); var k,AA,BB,CC,DD,a,b,c,d; var S11=7, S12=12, S13=17, S14=22; var S21=5, S22=9 , S23=14, S24=20; var S31=4, S32=11, S33=16, S34=23; var S41=6, S42=10, S43=15, S44=21; string = this.utf8_encode(string); x = ConvertToWordArray(string); a = 0x67452301; b = 0xEFCDAB89; c = 0x98BADCFE; d = 0x10325476; for (k=0;k<x.length;k+=16) {
AA=a; BB=b; CC=c; DD=d; a=FF(a,b,c,d,x[k+0], S11,0xD76AA478); d=FF(d,a,b,c,x[k+1], S12,0xE8C7B756); c=FF(c,d,a,b,x[k+2], S13,0x242070DB); b=FF(b,c,d,a,x[k+3], S14,0xC1BDCEEE); a=FF(a,b,c,d,x[k+4], S11,0xF57C0FAF); d=FF(d,a,b,c,x[k+5], S12,0x4787C62A); c=FF(c,d,a,b,x[k+6], S13,0xA8304613); b=FF(b,c,d,a,x[k+7], S14,0xFD469501); a=FF(a,b,c,d,x[k+8], S11,0x698098D8); d=FF(d,a,b,c,x[k+9], S12,0x8B44F7AF); c=FF(c,d,a,b,x[k+10],S13,0xFFFF5BB1); b=FF(b,c,d,a,x[k+11],S14,0x895CD7BE); a=FF(a,b,c,d,x[k+12],S11,0x6B901122); d=FF(d,a,b,c,x[k+13],S12,0xFD987193); c=FF(c,d,a,b,x[k+14],S13,0xA679438E); b=FF(b,c,d,a,x[k+15],S14,0x49B40821); a=GG(a,b,c,d,x[k+1], S21,0xF61E2562); d=GG(d,a,b,c,x[k+6], S22,0xC040B340); c=GG(c,d,a,b,x[k+11],S23,0x265E5A51); b=GG(b,c,d,a,x[k+0], S24,0xE9B6C7AA); a=GG(a,b,c,d,x[k+5], S21,0xD62F105D); d=GG(d,a,b,c,x[k+10],S22,0x2441453); c=GG(c,d,a,b,x[k+15],S23,0xD8A1E681); b=GG(b,c,d,a,x[k+4], S24,0xE7D3FBC8); a=GG(a,b,c,d,x[k+9], S21,0x21E1CDE6); d=GG(d,a,b,c,x[k+14],S22,0xC33707D6); c=GG(c,d,a,b,x[k+3], S23,0xF4D50D87); b=GG(b,c,d,a,x[k+8], S24,0x455A14ED); a=GG(a,b,c,d,x[k+13],S21,0xA9E3E905); d=GG(d,a,b,c,x[k+2], S22,0xFCEFA3F8); c=GG(c,d,a,b,x[k+7], S23,0x676F02D9); b=GG(b,c,d,a,x[k+12],S24,0x8D2A4C8A); a=HH(a,b,c,d,x[k+5], S31,0xFFFA3942); d=HH(d,a,b,c,x[k+8], S32,0x8771F681); c=HH(c,d,a,b,x[k+11],S33,0x6D9D6122); b=HH(b,c,d,a,x[k+14],S34,0xFDE5380C); a=HH(a,b,c,d,x[k+1], S31,0xA4BEEA44); d=HH(d,a,b,c,x[k+4], S32,0x4BDECFA9); c=HH(c,d,a,b,x[k+7], S33,0xF6BB4B60); b=HH(b,c,d,a,x[k+10],S34,0xBEBFBC70); a=HH(a,b,c,d,x[k+13],S31,0x289B7EC6); d=HH(d,a,b,c,x[k+0], S32,0xEAA127FA); c=HH(c,d,a,b,x[k+3], S33,0xD4EF3085); b=HH(b,c,d,a,x[k+6], S34,0x4881D05); a=HH(a,b,c,d,x[k+9], S31,0xD9D4D039); d=HH(d,a,b,c,x[k+12],S32,0xE6DB99E5); c=HH(c,d,a,b,x[k+15],S33,0x1FA27CF8); b=HH(b,c,d,a,x[k+2], S34,0xC4AC5665); a=II(a,b,c,d,x[k+0], S41,0xF4292244); d=II(d,a,b,c,x[k+7], S42,0x432AFF97); c=II(c,d,a,b,x[k+14],S43,0xAB9423A7); b=II(b,c,d,a,x[k+5], S44,0xFC93A039); a=II(a,b,c,d,x[k+12],S41,0x655B59C3); d=II(d,a,b,c,x[k+3], S42,0x8F0CCC92); c=II(c,d,a,b,x[k+10],S43,0xFFEFF47D); b=II(b,c,d,a,x[k+1], S44,0x85845DD1); a=II(a,b,c,d,x[k+8], S41,0x6FA87E4F); d=II(d,a,b,c,x[k+15],S42,0xFE2CE6E0); c=II(c,d,a,b,x[k+6], S43,0xA3014314); b=II(b,c,d,a,x[k+13],S44,0x4E0811A1); a=II(a,b,c,d,x[k+4], S41,0xF7537E82); d=II(d,a,b,c,x[k+11],S42,0xBD3AF235); c=II(c,d,a,b,x[k+2], S43,0x2AD7D2BB); b=II(b,c,d,a,x[k+9], S44,0xEB86D391); a=AddUnsigned(a,AA); b=AddUnsigned(b,BB); c=AddUnsigned(c,CC); d=AddUnsigned(d,DD); }
var temp = WordToHex(a)+WordToHex(b)+WordToHex(c)+WordToHex(d); return temp.toLowerCase(); }
String.prototype.urlencode = function() {
return escape(this.toString().replace(/%/g, '%25'))	.replace(/\+/g, '%2B')
.replace(/%20/g, '+')
.replace(/\*/g, '%2A')
.replace(/\//g, '%2F')
.replace(/@/g, '%40'); }
String.prototype.urldecode = function() {
return unescape(this.toString().replace(/\+/g, ' ')); }
function eventObject(obj) {
var SELF = this; this.e = null; this.isEvent = false; this.CurrentFramePos = null; if (this instanceof eventObject && (typeof obj === 'object')) {
if (UA.isIE()) {
if (window.event !== null) {
this.e = window.event; } else {
this.e = obj; }} else {
this.e = obj; }
this.isEvent = true; } else if (typeof obj != 'undefined') {
obj = Element(obj); }
if (!(this instanceof eventObject)) {
var tmpObj = {
"toString": function() {
return "eventObject temp object"; }}
tmpObj.addEvent = function(name, func, capture) {
if (typeof func != 'function') {
throw new Error("The function does not exists!"); }
if (typeof capture != 'boolean') {
capture = false; }
if (capture && UA.isOpera()) {
capture = false; }
try {
var index = "Event_" + (Math.random() * (new Date().getTime())).toString().replace(/\./,""); eventObject.EventListeners[index] = {
"func" : func, "capture" : capture
}; if (UA.isIE()) {
obj.attachEvent("on" + name,eventObject.EventListeners[index].func); } else {
obj.addEventListener(name,eventObject.EventListeners[index].func,capture); }
if (typeof eventObject.EventListeners[obj] === "undefined") {
eventObject.EventListeners[obj] = []; }
if (obj == window) {
if (typeof eventObject.EventListeners['window'] === 'undefined') {
eventObject.EventListeners['window'] = []; }
eventObject.EventListeners['window'].push(index); }
return index; } catch (ex) {
throw new Error('eventObject::addEvent("' + name + '", ..., ...)\n' + ex.message); }}; tmpObj.removeEvent = function(name, index) {
try {
if (index) {
if (UA.isIE()) {
obj.detachEvent("on" + name,eventObject.EventListeners[index].func); } else {
obj.removeEventListener(name, eventObject.EventListeners[index].func, eventObject.EventListeners[index].capture); }
delete eventObject.EventListeners[index]; return true; } else {
return false; }} catch(e) {
return false; }}; tmpObj.fireEvent = function(event){
if (document.createEventObject) {
if (typeof e === 'undefined') {
var evt = document.createEventObject(); } else {
var evt = document.createEventObject(e); }
return obj.fireEvent('on'+event,evt); } else {
var e = document.createEvent("HTMLEvents"); e.initEvent(event, true, true ); // event type,bubbling,cancelable
return !obj.dispatchEvent(e); }}; return tmpObj; }
if (this.isEvent) {
this.getTargetObject = function() {
return this.target; }; this.getRelatedTarget = function() {
if (UA.isIE()) {
return this.e.fromElement || this.e.toElement; } else {
return this.e.relatedTarget; }}; this.cancelBubble = function() {
switch(true) {
case UA.isIE(): this.e.cancelBubble = true; break; default: this.e.stopPropagation(); break; }}; this.preventDefault = function() {
switch(true) {
case UA.isIE(): this.e.returnValue = false; break; default: this.e.preventDefault(); break; }}; this.GetTopLevelMousePositions = function(win) {
var tmp = GetFramePositions(win); this.CurrentFramePos = {
"Top"	: tmp.Top, "Left"	: tmp.Left
}; var posX = tmp.Left + this.mouseX; var posY = tmp.Top + this.mouseY; if (!UA.isIE() && !(UA.isFirefox() && win == top)) {
posX -= win.document.body.scrollLeft; posX -= win.document.body.parentNode.scrollLeft; posY -= win.document.body.scrollTop; posY -= win.document.body.parentNode.scrollTop; }
if (UA.isIE() && win != top) {
posX -= top.document.body.scrollLeft; posX -= top.document.body.parentNode.scrollLeft; posY -= top.document.body.scrollTop; posY -= top.document.body.parentNode.scrollTop; }
return {
"X":posX, "Y":posY
}; }; this.type = this.e.type; switch(true) {
case UA.isIE(): this.target = this.e.srcElement; this.keyCode = this.e.keyCode; this.rightClick = this.e.button == 2; this.leftClick = this.e.button == 1; this.middleClick = this.e.button == 4; this.mouseX = this.e.clientX + document.body.scrollLeft + document.documentElement.scrollLeft; this.mouseY = this.e.clientY + document.body.scrollTop + document.documentElement.scrollTop; this.layerX = this.e.x; this.layerY = this.e.y; this.scrX = this.e.screenX; this.scrY = this.e.screenY; this.type = this.e.type; break; default: this.target = this.e.target; if (this.target.nodeType == 3) {
this.target = this.target.parentNode; }
this.keyCode = this.e.which || this.e.keyCode; this.rightClick = (this.e.which == 3?true:false); this.leftClick = (this.e.which == 1?true:false); this.middleClick = (this.e.which == 2?true:false); this.mouseX = this.e.pageX; this.mouseY = this.e.pageY; if (UA.isOpera()) {
this.layerX = this.e.x; this.layerY = this.e.y; } else {
this.layerX = this.e.layerX; this.layerY = this.e.layerY; }
this.scrX = this.e.pageX - document.body.scrollLeft - document.documentElement.scrollLeft; this.scrY = this.e.pageY - document.body.scrollTop - document.documentElement.scrollTop; break; }
this.character = String.fromCharCode(this.keyCode); this.shiftKey = this.e.shiftKey; this.altKey = this.e.altKey; this.ctrlKey = this.e.ctrlKey; this.toString = function() {
return "eventObject"; }; }}
eventObject.EventListeners = {}; var EventTypes = {
"MouseOver":	'mouseover', "MouseOut":		'mouseout', "MouseUp":		'mouseup', "MouseDown":	'mousedown', "MouseMove":	'mousemove', "Click":		'click', "DoubleClick":	'dblclick', "Change":		'change', "KeyPress":		'keypress', "KeyDown":		'keydown', "KeyUp":		'keyup', "Load":			'load', "UnLoad":		'unload', "BeforeUnLoad":	'beforeunload ', "Resize":		'resize', "DragEnter":	'dragenter', "DragOver":		'dragover', "Drop":			'drop', "Scroll":		'scroll', "Focus":		'focus', "Blur":			'blur', "ContextMenu": 'contextmenu'
}; eventObject.CreateEventObject = function(e) {
var evt; if (document.createEventObject) {
if (typeof e === 'undefined') {
var evt = document.createEventObject(); } else {
var evt = document.createEventObject(e); }} else {
evt = document.createEvent("HTMLEvents"); }
return evt; }; var AJAX = {
"TEXT" : 0, "JSON" : 1, "XML" : 2, "POST" : 5, "GET" : 6, "STATES" : {
"START" : 'start', "STOP" : 'stop'
}, "Version" : 'undefined', "CreatePostRequest": function(params, postParams) {
if (typeof postParams === 'undefined') {
postParams = {}; }
postParams.AJAX_ACTION = JSON.stringify(params).base64_encode(); return postParams; }, "ParseObjectToPostData": function(_obj) {
return JSON.stringify(_obj); }, "GetElmentInputsData": function(_element) {
_element = Element(_element); var i, inputs; var items = []; inputs = _element.getElementsByTagName('input'); for(i = 0; i < inputs.length; i++) {
items.push(inputs[i]); }
inputs = _element.getElementsByTagName('select'); for(i = 0; i < inputs.length; i++) {
items.push(inputs[i]); }
var editor; inputs = _element.getElementsByTagName('textarea'); for(i = 0; i < inputs.length; i++) {
if (typeof tinyMCE !== 'undefined') {
editor = tinyMCE.get(inputs[i].name); if (editor) {
inputs[i].value = editor.getContent(); }}
items.push(inputs[i]); }
return items; }, "CreateXMLHTTP" : function () {
var ActiveXXMLHttpVersions = [	'Msxml3.XMLHTTP', 'Msxml2.XMLHTTP.6.0', 'Msxml2.XMLHTTP.3.0', 'Msxml2.XMLHTTP', 'Microsoft.XMLHTTP' ]; var i = 0; var XMLHttp = null; try {
if (UA.isIE()) {
for (i = 0; i < ActiveXXMLHttpVersions.length; i += 1) {
try {
XMLHttp = new ActiveXObject(ActiveXXMLHttpVersions[i]); } catch (e) {
XMLHttp = null; if (i === ActiveXXMLHttpVersions.length - 1) {
XMLHttp = false; break; }
continue; }
AJAX.Version = ActiveXXMLHttpVersions[i]; break; }
if (!XMLHttp) {
if (typeof window.XMLHttpRequest !== 'undefined') {
AJAX.Version = "Native"; XMLHttp = new window.XMLHttpRequest(); }}
} else {
AJAX.Version = "Native"; XMLHttp = new window.XMLHttpRequest(); }} catch (ex) {
XMLHttp = false; }
return XMLHttp; }, "ConvertTextToPost" : function(_text) {
var tmp = _text.replace(/%/g,"%25"); tmp = tmp.replace(/&/g,"%26"); tmp = tmp.replace(/\+/g,"%2B"); tmp = tmp.replace(/@/g,"%40"); tmp = tmp.replace(/"/g,"%22"); tmp = tmp.replace(/'/g,"%27"); tmp = tmp.replace(/!/g,"%21"); tmp = tmp.replace(/\//g,"%2F"); tmp = tmp.replace(/=/g,"%3D"); tmp = tmp.replace(/\(/g,"%28"); tmp = tmp.replace(/\)/g,"%29"); tmp = tmp.replace(/</g,"%3C"); tmp = tmp.replace(/>/g,"%3E"); tmp = tmp.replace(/\{/g,"%7B"); tmp = tmp.replace(/\}/g,"%7D"); tmp = tmp.replace(/\*/g,"%2A"); tmp = tmp.replace(/\\/g,"%5C"); return tmp; }, "ConvertHTMLtoPOST" : function(html) {
var tmp = html.replace(/%/g,"%25"); tmp = tmp.replace(/\\/g,"%5C"); tmp = tmp.replace(/\+/g,"%2B"); tmp = tmp.replace(/ /g,"+"); tmp = tmp.replace(/&/g,"%26"); tmp = tmp.replace(/@/g,"%40"); tmp = tmp.replace(/"/g,"%22"); tmp = tmp.replace(/'/g,"%27"); tmp = tmp.replace(/!/g,"%21"); tmp = tmp.replace(/\//g,"%2F"); tmp = tmp.replace(/=/g,"%3D"); tmp = tmp.replace(/\(/g,"%28"); tmp = tmp.replace(/\)/g,"%29"); tmp = tmp.replace(/</g,"%3C"); tmp = tmp.replace(/>/g,"%3E"); tmp = tmp.replace(/\{/g,"%7B"); tmp = tmp.replace(/\}/g,"%7D"); tmp = tmp.replace(/\*/g,"%2A"); return tmp; }, "HideAndShowSelects" : function(state) {
if (UA.isIE() && UA.getVersion() < 7) {
var selects = document.getElementsByTagName('select'); if (selects.length > 0) {
var i, select, div; for (i = 0; i < selects.length; i++) {
select = selects[i]; switch(state) {
case 'start': if (typeof select.AJAX_REQUEST_COUNT === 'undefined' || isNaN(select.AJAX_REQUEST_COUNT)) {
select.AJAX_REQUEST_COUNT = 1; } else {
select.AJAX_REQUEST_COUNT++; }
if (select.AJAX_REQUEST_COUNT === 1) {
div = document.createElement('div'); div.style.display = 'inline'; if (select.options[select.selectedIndex]) {
div.innerHTML = '<span style="display: inline-block; width: ' + select.offsetWidth + 'px; text-align: left;">' + select.options[select.selectedIndex].text + '</span>'; } else {
div.innerHTML = '&nbsp;'; }
select.style.display = 'none'; select.parentNode.insertBefore(div, select); select.AJAX_TMP = select.previousSibling; }
break; case 'stop': select.AJAX_REQUEST_COUNT--; if (select.AJAX_REQUEST_COUNT === 0) {
if (typeof select.AJAX_TMP !== 'undefined' && select.AJAX_TMP !== null) {
select.parentNode.removeChild(select.AJAX_TMP); select.AJAX_TMP = null; }
select.style.display = ''; }
break; }}
}}
}, "Error" : function(message, e) {
this.message = message; }, "isError" : function(e) {
if (e instanceof AJAX.Error) {
return true; } else {
return false; }}, "CreateCall": function() {
var xmlHTTP = null; var args = AJAX.CreateCall['arguments']; var command = "xmlHTTP = new AJAX.XmlHTTP_request_object(", i = 0; for (i = 0; i < args.length; i += 1) {
if (i > 0) {
command += ", "; }
command += "args[" + i + "]"; }
command += ")"; eval(command); xmlHTTP.Call = function() {
xmlHTTP.sendRequest(); }; return xmlHTTP; }, "Call" : function() {
var xmlHTTP = null; var args = AJAX.Call['arguments']; var command = "xmlHTTP = new AJAX.XmlHTTP_request_object(", i = 0; for (i = 0; i < args.length; i += 1) {
if (i > 0) {
command += ", "; }
command += "args[" + i + "]"; }
command += ");"; eval(command); if (xmlHTTP) {
xmlHTTP.sendRequest(); }
return xmlHTTP; }, "XmlHTTP_request_object" : function() {
var rootObject = this, startTime = new Date(), i = 0; var ResponseHeaders = null; var Status = null
this.args = AJAX.XmlHTTP_request_object['arguments']; if (this.args === null) {
this.args = []; }
this.debug = false; this.async = true; this.sendType = AJAX.POST; this.getType = AJAX.TEXT; var exp = new Date(); this.requestHeader = [ ['Content-Type', 'application/x-www-form-urlencoded; charset=utf-8'], ['Ajax-Action', true], ["Pragma", "no-cache"], ['Cache-Control', 'no-cache'], ['Expires', exp.toGMTString()] ]; this.page = false; this.func = false; this.funcParams = []; this.xmlHTTP = false; this.loader = false; this.send = null; this.getXMLhttpObject = false; this.isActive = false; this.requestTime = null; this.GetAllResponseHeaders = function() {
return ResponseHeaders; }; this.GetStatus = function() {
return Status; }; this.set_xmlHTTP_Object = function () {
this.xmlHTTP = AJAX.CreateXMLHTTP(); if (false === this.xmlHTTP) {
alert("ERROR: The xmlHTTPrequest object could not be created."); return false; }}; this.get_xmlHTTP_Object = function () {
if (!this.xmlHTTP) {
this.set_xmlHTTP_Object(); }
return this.xmlHTTP; }; this.setCallBackFunction = function () {
var args = this.setCallBackFunction['arguments']; if (args.length > 0 && typeof args[0] === 'function') {
this.func = args[0]; if (args.length > 1) {
for (var i = 1; i < args.length; i += 1) {
this.funcParams[this.funcParams.length] = args[i]; }}
}}; this.setLoader = function (action) {
if (action === 'start') {
AJAX.HideAndShowSelects('start'); }
if (this.loader && typeof this.loader === 'object') {
if (action.toLowerCase() === 'start') {
if (typeof this.loader.Show === 'function') {
this.loader.Show(); } else {
this.loader.style.display = ''; }} else {
if (typeof this.loader.Close === 'function') {
this.loader.Close(); } else {
this.loader.style.display = 'none'; }}
} else if (this.loader && typeof this.loader === 'function') {
this.loader(action); }
if (action === 'stop') {
AJAX.HideAndShowSelects('stop'); }}; this.CreatePostData = function (obj, name) {
var i, data, temp; data = ''; for (i in obj) {
if (typeof obj[i] !== 'function') {
if (data !== '') {
data += '&'; }
if (typeof obj[i] === 'object') {
temp = this.CreatePostData(obj[i], (typeof name === 'undefined' ? i : name + "[" + i + "]")); if (temp === null) {
data += (typeof name === 'undefined' ? i : name + "[" + i + "]") + "=null"; } else {
data += temp; }} else {
data += (typeof name === 'undefined' ? i : name + "[" + i + "]") + "=" + (typeof obj[i] === "string" ? AJAX.ConvertTextToPost(obj[i]) : obj[i]); }}
}
if (data === '') {
return null; } else {
return data; }}; this.SendAsBinary = function(_data) {
var i = 0; if (!this.page) {
throw new Error('The request page is not set!'); }
this.isActive = true; this.set_xmlHTTP_Object(); this.xmlHTTP.open(( this.sendType === AJAX.POST ? "POST" : "GET"), this.page, this.async); for(i = 0; i < this.requestHeader.length; i++) {
this.xmlHTTP.setRequestHeader(this.requestHeader[i][0], this.requestHeader[i][1]); }
i = 0; this.setLoader('start'); if (!this.async) {
this.xmlHTTP.sendAsBinary(_data); rootObject.abort(true); switch (this.getType) {
case AJAX.XML: return this.xmlHTTP.responseXML; case AJAX.JSON: try {
var response = JSON.parse(this.xmlHTTP.responseText); }
catch (ex) {
throw new Error('ajaxplus::syncron call\n' + ex.message); }
return response; default: return this.xmlHTTP.responseText; }} else {
if (this.func && typeof this.func === 'function') {
this.xmlHTTP.onreadystatechange = function () {
if (rootObject.debug) {
try {
alert("Status: " + rootObject.xmlHTTP.status + "\n\rReadyState: " + rootObject.xmlHTTP.readyState + "\n\rResponseHeaders: " + rootObject.xmlHTTP.getAllResponseHeaders()); } catch (e) {
}}
var parancs = ''; var response = ''; if (rootObject.getXMLhttpObject) {
if (this.args.length > 0) {
parancs = 'func(xmlHTTP'; for (i = 0; i < this.args.length; i += 1) {
parancs += ',args[' + i + ']'; }
parancs += ');'; try {
eval(parancs); } catch (ex1) {
throw new Error('ajaxplus::onReadyStateChange\n' + ex1.message); }} else {
this.func(rootObject.xmlHTTP); }}
if (parseInt(rootObject.xmlHTTP.readyState,10) === 4) {
ResponseHeaders = rootObject.xmlHTTP.getAllResponseHeaders(); Status = rootObject.xmlHTTP.status; rootObject.isActive = false; if (rootObject.debug) {
alert(rootObject.xmlHTTP.responseText); }
if (!rootObject.getXMLhttpObject) {
if (rootObject.funcParams.length > 0 ) {// && rootObject.xmlHTTP.responseText) {
parancs = 'rootObject.func('; switch (rootObject.getType) {
case AJAX.XML: parancs += 'rootObject.xmlHTTP.responseXML'; break; case AJAX.JSON: try {
response = JSON.parse(rootObject.xmlHTTP.responseText); } catch (e1) {
response = new AJAX.Error("JSON parse failed!", e1); response.responseText = rootObject.xmlHTTP.responseText; }
parancs += 'response'; break; default: parancs += 'rootObject.xmlHTTP.responseText'; break; }
for (i = 0; i < rootObject.funcParams.length; i += 1) {
parancs += ',rootObject.funcParams[' + i + ']'; }
parancs += ');'; try {
eval(parancs); } catch (e2) {
if (window.console && typeof window.console.log === 'function') {
window.console.log(e2.message); }
throw new Error('ajaxplus::onReadStateChange\n' + e2.message); }} else {
switch (rootObject.getType) {
case AJAX.XML: rootObject.func(rootObject.xmlHTTP.responseXML); break; case AJAX.JSON: try {
response = JSON.parse(rootObject.xmlHTTP.responseText); } catch (e1) {
response = new AJAX.Error("JSON parse failed!",e1); response.responseText = rootObject.xmlHTTP.responseText; }
rootObject.func(response); break; default: rootObject.func(rootObject.xmlHTTP.responseText); break; }}
}
rootObject.abort(true); }}; } else {
this.xmlHTTP.onreadystatechange = function () {
if (rootObject.debug) {
alert(this.xmlHTTP.responseText); }
if (rootObject.xmlHTTP.readyState == 4) {
rootObject.abort(true); }}; }
this.xmlHTTP.sendAsBinary(_data); return true; }}; this.sendRequest = function () {
var i = 0; if (!this.page) {
throw new Error('The request page is not set!'); }
this.isActive = true; this.set_xmlHTTP_Object(); this.xmlHTTP.open(( this.sendType === AJAX.POST ? "POST" : "GET"), this.page, this.async); for(i = 0; i < this.requestHeader.length; i++) {
this.xmlHTTP.setRequestHeader(this.requestHeader[i][0], this.requestHeader[i][1]); }
i = 0; this.setLoader('start'); if (!this.async) {
this.xmlHTTP.send(this.send); rootObject.abort(true); switch (this.getType) {
case AJAX.XML: return this.xmlHTTP.responseXML; case AJAX.JSON: try {
var response = JSON.parse(this.xmlHTTP.responseText); }
catch (ex) {
throw new Error('ajaxplus::syncron call\n' + ex.message); }
return response; default: return this.xmlHTTP.responseText; }} else {
if (this.func && typeof this.func === 'function') {
this.xmlHTTP.onreadystatechange = function () {
if (rootObject.debug) {
try {
alert("Status: " + rootObject.xmlHTTP.status + "\n\rReadyState: " + rootObject.xmlHTTP.readyState + "\n\rResponseHeaders: " + rootObject.xmlHTTP.getAllResponseHeaders()); } catch (e) {
}}
var parancs = ''; var response = ''; if (rootObject.getXMLhttpObject) {
if (this.args.length > 0) {
parancs = 'func(xmlHTTP'; for (i = 0; i < this.args.length; i += 1) {
parancs += ',args[' + i + ']'; }
parancs += ');'; try {
eval(parancs); } catch (ex1) {
throw new Error('ajaxplus::onReadyStateChange\n' + ex1.message); }} else {
this.func(rootObject.xmlHTTP); }}
if (parseInt(rootObject.xmlHTTP.readyState,10) === 4) {
ResponseHeaders = rootObject.xmlHTTP.getAllResponseHeaders(); Status = rootObject.xmlHTTP.status; rootObject.isActive = false; if (rootObject.debug) {
alert(rootObject.xmlHTTP.responseText); }
if (!rootObject.getXMLhttpObject) {
if (rootObject.funcParams.length > 0 ) {// && rootObject.xmlHTTP.responseText) {
parancs = 'rootObject.func('; switch (rootObject.getType) {
case AJAX.XML: parancs += 'rootObject.xmlHTTP.responseXML'; break; case AJAX.JSON: try {
response = JSON.parse(rootObject.xmlHTTP.responseText); } catch (e1) {
response = new AJAX.Error("JSON parse failed!", e1); response.responseText = rootObject.xmlHTTP.responseText; }
parancs += 'response'; break; default: parancs += 'rootObject.xmlHTTP.responseText'; break; }
for (i = 0; i < rootObject.funcParams.length; i += 1) {
parancs += ',rootObject.funcParams[' + i + ']'; }
parancs += ');'; try {
eval(parancs); } catch (e2) {
if (window.console && typeof window.console.log === 'function') {
window.console.log(e2.message); }
throw new Error('ajaxplus::onReadStateChange\n' + e2.message); }} else {
switch (rootObject.getType) {
case AJAX.XML: rootObject.func(rootObject.xmlHTTP.responseXML); break; case AJAX.JSON: try {
response = JSON.parse(rootObject.xmlHTTP.responseText); } catch (e1) {
response = new AJAX.Error("JSON parse failed!",e1); response.responseText = rootObject.xmlHTTP.responseText; }
rootObject.func(response); break; default: rootObject.func(rootObject.xmlHTTP.responseText); break; }}
}
rootObject.abort(true); }}; } else {
this.xmlHTTP.onreadystatechange = function () {
if (rootObject.debug) {
alert(this.xmlHTTP.responseText); }
if (rootObject.xmlHTTP.readyState == 4) {
rootObject.abort(true); }}; }
this.xmlHTTP.send(this.send); return true; }}; this.abort = function (ignore) {
try {
var endTime = new Date(); this.requestTime = endTime.getTime() - startTime.getTime(); if (typeof ignore === 'undefined') {
this.xmlHTTP.abort(); delete this.xmlHTTP; }
this.setLoader('stop'); this.isActive = false; return true; } catch (e) {
this.isActive = false; return false; }}; var loader = null; var gt = null; var st = null; switch (this.args.length) {
case 0: break; case 1: if (typeof this.args[0] === 'string') {
this.page = this.args[0]; this.set_xmlHTTP_Object(); }
break; case 2: if (typeof this.args[0] === 'string' && (typeof this.args[1] === 'string' || typeof this.args[1] === 'object')) {
this.page = this.args[0]; if (typeof this.args[1] === 'object') {
this.send = this.CreatePostData(this.args[1]); } else {
this.send = this.args[1]; }
this.set_xmlHTTP_Object(); }
break; case 3: if (typeof this.args[0] === 'string' && (typeof this.args[1] === 'string' || typeof this.args[1] === 'object')) {
this.page = this.args[0]; if (typeof this.args[1] === 'object') {
this.send = this.CreatePostData(this.args[1]); } else {
this.send = this.args[1]; }
if (typeof this.args[2] === 'number') {
if (this.args[2] === AJAX.GET || this.args[2] === AJAX.POST) {
this.sendType = this.args[2]; }} else {
if (typeof this.args[2] === 'function') {
this.func = this.args[2]; }}
this.set_xmlHTTP_Object(); }
break; case 4: loader = false; gt = false; st = false; if (typeof this.args[0] === 'string' && (typeof this.args[1] === 'string' || typeof this.args[1] === 'object')) {
this.page = this.args[0]; if (typeof this.args[1] === 'object') {
this.send = this.CreatePostData(this.args[1]); } else {
this.send = this.args[1]; }
if (typeof this.args[2] === 'number') {
if (this.args[2] === AJAX.GET || this.args[2] === AJAX.POST) {
st = true; this.sendType = this.args[2]; } else if (this.args[2] === AJAX.TEXT || this.args[2] === AJAX.XML || this.args[2] === AJAX.JSON) {
gt = true; this.getType = this.args[2]; }} else {
if (typeof this.args[2] === 'object' || typeof this.args[2] === 'function') {
loader = true; this.loader = this.args[2]; } else if (typeof this.args[2] === 'boolean') {
loader = true; }}
if (!loader && typeof this.args[3] === 'number') {
if (!st && this.args[3] === AJAX.GET || this.args[3] === AJAX.POST) {
st = true; this.sendType = this.args[3]; } else if (!gt && this.args[3] === AJAX.TEXT || this.args[3] === AJAX.XML || this.args[3] === AJAX.JSON) {
gt = true; this.getType = this.args[3]; }} else {
if (typeof this.args[3] === 'function') {
this.func = this.args[3]; }}
this.set_xmlHTTP_Object(); }
break; default: if (this.args.length > 4) {
var callBack = false; loader = false; st = false; gt = false; if (typeof this.args[0] === 'string' && (typeof this.args[1] === 'string' || typeof this.args[1] === 'object')) {
this.page = this.args[0]; if (typeof this.args[1] === 'object') {
this.send = this.CreatePostData(this.args[1]); } else {
this.send = this.args[1]; }
if (typeof this.args[2] === 'number') {
if (this.args[2] === AJAX.GET || this.args[2] === AJAX.POST) {
st = true; this.sendType = this.args[2]; } else if (this.args[2] === AJAX.TEXT || this.args[2] === AJAX.XML || this.args[2] === AJAX.JSON) {
gt = true; this.getType = this.args[2]; }} else {
if (typeof this.args[2] === 'object' || typeof this.args[2] === 'function') {
loader = true; this.loader = this.args[2]; } else if (typeof this.args[2] === 'boolean') {
loader = true; }}
if (!loader && typeof this.args[3] === 'number') {
if (!st && this.args[3] === AJAX.GET || this.args[3] === AJAX.POST) {
st = true; this.sendType = this.args[3]; } else if (!gt && this.args[3] === AJAX.TEXT || this.args[3] === AJAX.XML || this.args[3] === AJAX.JSON) {
gt = true; this.getType = this.args[3]; }} else if (!loader) {
if (typeof this.args[3] === 'object' || typeof this.args[3] === 'function') {
loader = true; this.loader = this.args[3]; } else if (typeof this.args[3] === 'boolean') {
loader = true; }} else {
if (typeof this.args[3] === 'function') {
callBack = true; this.func = this.args[3]; } else if (typeof this.args[3] === 'boolean') {
callBack = true; }}
if (!callBack && !loader) {
if (typeof this.args[4] === 'object' || typeof this.args[4] === 'function') {
loader = true; this.loader = this.args[4]; } else if (typeof this.args[4] === 'boolean') {
loader = true; }
if (typeof this.args[5] === 'function') {
callBack = true; this.func = this.args[5]; } else if (typeof this.args[5] === 'boolean') {
callBack = true; }
if (callBack && this.func) {
for (i = 6; i < this.args.length; i += 1) {
this.funcParams.push(this.args[i]); }}
} else if (callBack) {
for (i = 4; i < this.args.length; i += 1) {
this.funcParams.push(this.args[i]); }} else if (!callBack) {
if (typeof this.args[4] === 'function') {
callBack = true; this.func = this.args[4]; } else if (typeof this.args[4] === 'boolean') {
callBack = true; }
if (callBack && this.func) {
for (i = 5; i < this.args.length; i += 1) {
this.funcParams.push(this.args[i]); }}
}
this.set_xmlHTTP_Object(); }}
break; }}
}; function Element(obj) {
if (this instanceof Element) {
throw new Error("This is not object!"); } else {
if (typeof obj === 'string') {
obj = document.getElementById(obj); }
if (!obj) {
return null; }
if (typeof obj.pareseStyleName === 'function' ) {
return obj; }
obj.parseStyleName = function(name) {
var tmp = name.replace(/-(.)/g,function(s, s2) {
return s2.toUpperCase(); }); return tmp; }; obj.GetStyle = function(what, type) {
var tmp; if (UA.isIE()) {
tmp = this.currentStyle[this.parseStyleName(what)]; } else {
tmp = this.style[this.parseStyleName(what)]; try {
var tmp2 = document.defaultView.getComputedStyle(obj, '').getPropertyValue(what); if (!(tmp !== "" || (tmp === "" && tmp2 === ""))) {
tmp = tmp2; }} catch(e) {
} try {
tmp2 = window.getComputedStyle(obj,"")[this.parseStyleName(what)]; if (tmp !== "" || tmp2 !== "") {
tmp = tmp2; }} catch(e) {
}}
if (typeof type !== 'undefined') {
switch(type.toUpperCase()) {
case 'INT': tmp = parseInt(tmp, 10); if (isNaN(tmp)) {
tmp = 0; }
break; case 'FLOAT': tmp = parseFloat(tmp); if (isNaN(tmp)) {
tmp = 0; }
break; }}
return tmp; }; obj.SetStyle = function(what, value) {
var command = "this.style." + this.parseStyleName(what) + "=" + (typeof value === 'number' ? value : "'" + value + "'") + ";"; eval(command); }; obj.Get = function(what) {
return this[what]; }; obj.Set = function(what, value) {
this[what] = value; }; obj.removeFrom = function(node) {
node.removeChild(this); }; obj.insertTo = function(node, child) {
if (typeof child === 'undefined') {
node.appendChild(this); } else {
node.insertBefore(this, child); }}; obj.RemoveClass = function(className) {
Element.RemoveClass(this, className); }; obj.AddClass = function(className) {
Element.AddClass(this, className); }; obj.isVerticalScrollBar = function() {
return this.offsetHeight < this.scrollHeight; }; obj.isHorizontalScrollBar = function() {
return this.offsetWidth < this.scrollWidth; }; return obj; }}; Element.Create = function(node) {
return Element(document.createElement(node)); }; Element.CreateText = function(text) {
return document.createTextNode(text); }; Element.RemoveClass = function(item, className) {
var re = new RegExp("(^| )"+className+"( |$)"); item.className = item.className.replace(re, " "); }; Element.AddClass = function(item, className) {
var re = new RegExp("(^| )"+className+"( |$)"); if ( !item.className.match(re) ) {
item.className += ' '+className; }}; function LastKeyDown(obj,e) {
var ev = new eventObject(e); obj.lastKeyPressed = ev.keyCode; }
function TextBoxKeyPress(tb,type, e) {
var ev = new eventObject(e); var functionKeys = []; functionKeys.push(8); functionKeys.push(9); functionKeys.push(46); functionKeys.push(37); functionKeys.push(39); functionKeys.push(192); functionKeys.push(40); functionKeys.push(38); functionKeys.push(91); functionKeys.push(27); functionKeys.push(35); functionKeys.push(33); functionKeys.push(36); functionKeys.push(19); if (typeof tb.lastKeyPressed !== "undefined") {
var lastKeyPressed = tb.lastKeyPressed; } else {
var lastKeyPressed = null; }
var selection = false; var sel = null; var startPos = 0; var endPos = 0; if (!functionKeys.inArray(ev.keyCode) || (ev.keyCode === 46 && lastKeyPressed === 190) || (ev.keyCode === 45 && lastKeyPressed === 189) || (ev.keyCode === 45 && lastKeyPressed === 109)) {
var temp = tb.value + "" + ev.character; if (document.selection) {
tb.focus(); sel = document.selection.createRange(); if (sel.text != "") {
var tmp = sel.text; sel.text = ""; temp = tb.value + "" + ev.character; sel.text = tmp; selection = true; }} else if ("selectionStart" in tb && (tb.selectionStart || tb.selectionStart == '0')) {
startPos = tb.selectionStart; endPos = tb.selectionEnd; if (tb.value.substring(startPos, endPos) != "") {
selection = true; temp = tb.value.substring(0, startPos) + tb.value.substring(endPos, tb.value.length) + "" + ev.character; }}
} else {
return true; }
switch(type.toUpperCase()) {
case Checks.Type.Float: case 'FLOAT': if (!functionKeys.inArray(ev.keyCode) || (ev.keyCode === 45 && lastKeyPressed === 189) || (ev.keyCode === 45 && lastKeyPressed === 109)) {
if (temp.match(/^[-]{0,1}[0-9]{0,}([\,\.]{0,1}[0-9]{0,}){0,1}$/) !== null) {
return true; }} else {
return true; }
break; case Checks.Type.Integer: case 'INTEGER': if ((!functionKeys.inArray(ev.keyCode) && !(ev.keyCode === 46 && lastKeyPressed === 190)) || (ev.keyCode === 45 && lastKeyPressed === 189) || (ev.keyCode === 45 && lastKeyPressed === 109)) {
if (temp.match(/^[-]{0,1}[0-9]{0,}$/) !== null) {
return true; }} else if (!(ev.keyCode === 46 && lastKeyPressed === 190)) {
return true; }
break; case Checks.Type.Date: case 'DATE': switch(temp.length) {
case 1: if (isNaN(parseInt(temp,10)) || temp === '-' || temp === '.') {
return false; }
break; case 2: if (temp.match(/^[0-9]{2}$/) === null || isNaN(parseInt(temp,10))) {
return false; }
break; case 3: if (temp.match(/^[0-9]{3}$/) === null || isNaN(parseInt(temp,10))) {
return false; }
break; case 4: if (temp.match(/^[0-9]{4}$/) === null || isNaN(parseInt(temp,10))) {
return false; }
break; case 5: if (ev.character != "-" && ev.character != ".") {
return false; }
break; case 6: if (isNaN(parseInt(temp.charAt(5),10)) || parseInt(temp.charAt(5),10) > 1) {
return false; }
break; case 7: if (temp.substring(5,7).match(/^[0-9]{2}$/) === null || isNaN(parseInt(temp.substring(5,7),10)) || parseInt(temp.substring(5,7),10) > 12 || parseInt(temp.substring(5,7),10) === 0) {
return false; }
break; case 8: if (ev.character != "-" && ev.character != ".") {
return false; }
break; case 9: if (isNaN(parseInt(temp.charAt(8),10)) || parseInt(temp.charAt(8),10) > 3) {
return false; }
break; case 10: if (temp.substring(8,10).match(/^[0-9]{2}$/) === null || isNaN(parseInt(temp.substring(8,10),10)) || parseInt(temp.substring(8,10),10) > 31 || parseInt(temp.substring(8,10),10) === 0) {
return false; }
break; default: return false; break; }
if (ev.shiftKey || ev.altKey || ev.ctrlKey) {
return false; }
if (selection) {
if (document.selection) {
if (sel) {
sel.text = ""; }} else if ("selectionStart" in tb) {
tb.value = tb.value.substring(0, startPos) + tb.value.substring(endPos, tb.value.length); }}
return true; break; case Checks.Type.Time: case 'TIME': if (!functionKeys.inArray(ev.keyCode)) {
switch(temp.length) {
case 1: if (isNaN(parseInt(temp,10))) {
return false; }
break; case 2: if (temp.match(/^([0-1][0-9])|(2[0-3])|([0-9]:)$/) === null || isNaN(parseInt(temp,10))) {
return false; }
break; case 3: if (temp.match(/^([0-1][0-9]:)|(2[0-3]:)|([0-9]:[0-5])$/) === null) {
return false; }
break; case 4: if (temp.match(/^([0-1][0-9]:[0-5])|(2[0-3]:[0-5])|([0-9]:[0-5][0-9])$/) === null) {
return false; }
break; case 5: if (temp.match(/^([0-1][0-9]:[0-5][0-9])|(2[0-3]:[0-5][0-9])$/) === null) {
return false; }
break; default: return false; break; }}
return true; break; case Checks.Type.HourAndMinutes: case "HOURANDMINUTES": if (!functionKeys.inArray(ev.keyCode)) {
if (temp.indexOf(":") >= 0) {
return (temp.match(/^[0-9]+[:]{1}[0-9]{0,2}$/) ? true : false); } else {
return (temp.match(/^[0-9]+$/) ? true : false); }}
return true; break; default: throw new Error("Wrong type!"); break; }
return false; }
function isEmtpyTextBox(_tb, _minLength) {
if (typeof _minLengh === 'undefined') {
_minLenght = 0; }
var value; if (typeof _tb.value === 'undefined') {
value = _tb; } else {
value = _tb.value.replace(/\s*/,""); }
return (value === "" || (value !== "" && value.length < _minLength)); }
var Checks = {
"Type": {
"Email": 1, "PhoneNumber": 2, "HourAndMinutes": 3, "Time": 4, "Date": 5, "DateTime": 6, "Integer": 7, "Float": 8
}, "isValid": function(_tb, _type) {
if (typeof _type === 'undefined') {
throw new Error("_type is not set!"); } else {
var value, valid = true; if (typeof _tb.value === 'undefined') {
value = _tb; } else {
value = _tb.value; }
switch(_type) {
case this.Type.Email: valid = value.match(/^[a-zA-Z\.]+[^\.]@[a-zA-Z\.]+[^\.]\.[a-z]{2,3}$/); break; case this.Type.Float: valid = value.match(/^[-]{0,1}[0-9]{0,}([\,\.]{0,1}[0-9]{0,}){0,1}$/); break; case this.Type.Integer: valid = value.match(/^[-]{0,1}[0-9]{0,}$/); break; case this.Type.Date: valid = value.match(/^[1-9]{1}[0-9]{3}[-\.]{1}((1[0-2])|(0[1-9]))[-\.]((3[0-1])|([0-2][0-9]))$/); break; case this.Type.Time: valid = value.match(/^([0-1][0-9]:[0-5][0-9])|(2[0-3]:[0-5][0-9])|([0-9]:[0-5][0-9])$/); break; case this.Type.DateTime: valid = value.match(/^[1-9]{1}[0-9]{3}[-\.]{1}((1[0-2])|(0[1-9]))[-\.]((3[0-1])|([0-2][0-9]))\s((2[0-3])|([0-1][0-9])):[0-5][0-9]$/); break; }
return valid; }}, "toString": function() {
return "Checks"; }}; function DestoryVariable() {
return; }
function importPrototypes() {
var _prototype = {}; for(var i = 0; i < arguments.length; i++) {
if (typeof arguments[i] === "object") {
for(var _proto in arguments[i]) {
_prototype[_proto] = arguments[i][_proto]; }} else {
if (typeof arguments[i] === "function") {
if ("name" in arguments[i]) {
_proto = arguments[i].name; } else {
_proto = arguments[i].toString().match(/.*function\s([^\(]+).*/); if (_proto) {
_proto = _proto[1]; _prototype[_proto] = arguments[i]; }}
}}
}
return _prototype; }
var StyleSheets = {
"AjaxCall" : false, "GetStyleSheet" : function(href, _callBack) {
if (typeof _callBack === 'function') {
if (arguments.length > 0) {
var i; var params = ""; for(i = 0; i < arguments.length; i++) {
params += ", arguments[" + i + "]"; }
eval("AJAX.Call(href, null, AJAX.TEXT, false , this.CreateStyleSheet, _callBack" + params + ");"); } else {
AJAX.Call(href, null, AJAX.TEXT, false , this.CreateStyleSheet, _callBack); }} else {
AJAX.Call(href, null, AJAX.TEXT, false , this.CreateStyleSheet, null); }}, "CreateStyleSheet" : function(code, _callBack) {
var success = true; if (StyleSheets.AjaxCall) {
if (AJAX.isError(code)) {
StyleSheets.AjaxCall = false; return false; }}
try {
if (UA.isIE()) {
var styleSheetObj = document.createStyleSheet(); var styleObj = styleSheetObj.owningElement || styleSheetObj.ownerNode; styleObj.setAttribute("type","text/css"); styleSheetObj.cssText = code; } else {
var sc = Element.Create('style'); sc.rel = "stylesheet"; sc.type = "text/css"; sc.media = "all"; if (UA.isSafari() || UA.isChrome()) {
sc.innerText = code; } else {
sc.innerHTML = code; }
var head = document.getElementsByTagName('head')[0]; head.appendChild(sc); }} catch(e) {
success = false; }
if (StyleSheets.AjaxCall) {
StyleSheets.AjaxCall = false; if (_callBack) {
_callBack(success); }}
}}; var Javascripts = {
"AjaxCall" : false, "GetJavascript" : function(href, _callBack) {
if (typeof _callBack === 'function') {
if (arguments.length > 0) {
var i; var params = ""; for(i = 0; i < arguments.length; i++) {
params += ", arguments[" + i + "]"; }
eval("AJAX.Call(href, null, AJAX.TEXT, false , this.CreateJavascript, _callBack" + params + ");"); } else {
AJAX.Call(href, null, AJAX.TEXT, false , this.CreateJavascript, _callBack); }} else {
AJAX.Call(href, null, AJAX.TEXT, false , this.CreateJavascript, null); }}, "CreateJavascript" : function(code, _callBack) {
var success = true; if (Javascripts.AjaxCall) {
if (AJAX.isError(code)) {
Javascripts.AjaxCall = false; return false; }}
try {
if (UA.isIE()) {
window.execScript(code); } else if (UA.isSafari() || UA.isChrome()) {
window.setTimeout(code, 0); } else {
window.eval(code); }} catch(e) {
success = false; }
if (Javascripts.AjaxCall) {
Javascripts.AjaxCall = false; if (_callBack) {
_callBack(success); }}
}}; if (!( "console" in window )) {
if ( window != top ) {
window.console = top.console; } else {
window.console = {
cont: null
}; console.init = function() {
console.cont = document.createElement('div'); console.cont.style.width = "100%"; console.cont.style.height = "150px"; console.cont.style.position = 'absolute'; console.cont.style.top = '0px'; document.body.appendChild(console.cont); }; console.info = function(info) {
if ( !console.cont ) {
console.init(); }
var infodiv = document.createElement('div'); infodiv.style.fontWeight = 'bold'; infodiv.innerHTML = info; console.cont.appendChild(infodiv); }; }}
var Download = {
"Start" : function(_link, _downloadAutomatic ,_checkCallBack, _callBackParams) {
if (typeof _downloadAutomatic === 'undefined') {
_downloadAutomatic = true; }
if (typeof _checkCallBack !== 'function') {
_checkCallBack = function() {}; }
if (typeof _callBackParams === 'undefined') {
_callBackParams = {}; }
var tmp = {
"xmlHTTP" : null, "link" : _link, "checkCallBack" : _checkCallBack, "callBackParams" : _callBackParams, "downloadAutomatic" : _downloadAutomatic
}; tmp.xmlHTTP = AJAX.Call(_link, {"CheckDownload" : true}, AJAX.JSON ,false, this.StartCallBack, tmp); }, "StartCallBack" : function(response, tmp) {
if (tmp.xmlHTTP.GetStatus() === 200) {
tmp.checkCallBack(true, tmp.callBackParams); if (tmp.downloadAutomatic) {
window.location.href = tmp.link; }} else {
tmp.checkCallBack(false, tmp.callBackParams); }}
}; function GetFramePositions(win) {
if (typeof win === 'undefined') {
win = window; }
var posX = 0; var posY = 0; if (win != top) {
var i, tmp2, tmp3, tmp4; var tmp = win; while(tmp != top) {
if (tmp.parent.frames.length > 0) {
for(i = 0; i < tmp.parent.frames.length; i++) {
if (tmp.parent.frames[i] == tmp) {
tmp2 = tmp.parent.frames[i].frameElement; while(tmp2) {
posX += tmp2.offsetLeft; posY += tmp2.offsetTop; tmp2 = tmp2.offsetParent; }}
}}
if (UA.isIE()) {
tmp = top; } else {
tmp = tmp.parent; }}
}
return {
"Top"	: posY, "Left"	: posX
}; }
var NodeOrMouseTopPositions = {
"getNodePosition": function(node) {
var positions = {
"top": 0, "left": 0
}, frames, i, found, tmpWindow = node.ownerDocument.defaultView ? node.ownerDocument.defaultView : node.ownerDocument.parentWindow, tmp = node; while(tmp) {
positions.top += tmp.offsetTop; positions.left += tmp.offsetLeft; if (tmpWindow != top && "scrollTop" in tmp && "scrollLeft" in tmp) {
positions.top -= tmp.scrollTop; positions.left -= tmp.scrollLeft; }
tmp = tmp.offsetParent; if (!tmp) {
found = false; if (tmpWindow.parent) {
if (tmpWindow.parent != top) {
positions.top -= tmpWindow.parent.document.body.parentNode.scrollTop; positions.left -= tmpWindow.parent.document.body.parentNode.scrollLeft; }
frames = tmpWindow.parent.document.getElementsByTagName("iframe"); if (frames && frames.length > 0) {
for(i = 0; i < frames.length; i++) {
if (frames[i].contentWindow == tmpWindow) {
tmp = frames[i]; tmpWindow = tmpWindow.parent; found = true; break; }}
}
if (!found) {
frames = tmpWindow.parent.document.getElementsByTagName("frame"); if (frames && frames.length > 0) {
for(i = 0; i < frames.length; i++) {
if (frames[i].contentWindow == tmpWindow) {
tmp = frames[i]; tmpWindow = tmpWindow.parent; found = true; break; }}
}}
}}
}
return positions; }, "getMousePosition": function(e) {
var ev = new eventObject(e); var positions = {
"top": ev.mouseY, "left": ev.mouseX
}, frames, i, found, tmp = null, tmpWindow = ev.getTargetObject().ownerDocument.defaultView ? ev.getTargetObject().ownerDocument.defaultView : ev.getTargetObject().ownerDocument.parentWindow; if (tmpWindow.parent) {
found = false; frames = tmpWindow.parent.document.getElementsByTagName("iframe"); if (frames && frames.length > 0) {
for(i = 0; i < frames.length; i++) {
if (frames[i].contentWindow == tmpWindow) {
tmp = frames[i]; tmpWindow = tmpWindow.parent; found = true; break; }}
}
if (!found) {
frames = tmpWindow.parent.document.getElementsByTagName("frame"); if (frames && frames.length > 0) {
for(i = 0; i < frames.length; i++) {
if (frames[i].contentWindow == tmpWindow) {
tmp = frames[i]; tmpWindow = tmpWindow.parent; found = true; break; }}
}}
while(tmp) {
positions.top += tmp.offsetTop; positions.left += tmp.offsetLeft; if (tmpWindow != top && "scrollTop" in tmp && "scrollLeft" in tmp) {
positions.top -= tmp.scrollTop; positions.left -= tmp.scrollLeft; }
tmp = tmp.offsetParent; if (!UA.isIE() && !tmp) {
found = false; if (tmpWindow.parent) {
if (tmpWindow.parent != top) {
positions.top -= tmpWindow.parent.document.body.parentNode.scrollTop; positions.left -= tmpWindow.parent.document.body.parentNode.scrollLeft; }
frames = tmpWindow.parent.document.getElementsByTagName("iframe"); if (frames && frames.length > 0) {
for(i = 0; i < frames.length; i++) {
if (frames[i].contentWindow == tmpWindow) {
tmp = frames[i]; tmpWindow = tmpWindow.parent; found = true; break; }}
}
if (!found) {
frames = tmpWindow.parent.document.getElementsByTagName("frame"); if (frames && frames.length > 0) {
for(i = 0; i < frames.length; i++) {
if (frames[i].contentWindow == tmpWindow) {
tmp = frames[i]; tmpWindow = tmpWindow.parent; found = true; break; }}
}}
}}
}}
return positions; }}; 