//--------------------------------------------------------------
// Copyright (C) 2006 Michael Schwarz (http://www.ajaxpro.info).
// All rights reserved.
//--------------------------------------------------------------

// prototype.js
Object.extend = function(dest, source, replace) {
for(var prop in source) {
if(replace == false && dest[prop] != null) { continue; }
dest[prop] = source[prop];
}
return dest;
};

Object.extend(Function.prototype, {
apply: function(o, a) {
var r, x = "__fapply";
if(typeof o != "object") { o = {}; }
o[x] = this;
var s = "r = o." + x + "(";
for(var i=0; i<a.length; i++) {
if(i>0) { s += ","; }
s += "a[" + i + "]";
}
s += ");";
eval(s);
delete o[x];
return r;
},
bind: function(o) {
if(!Function.__objs) {
Function.__objs = [];
Function.__funcs = [];
}
var objId = o.__oid;
if(!objId) {
Function.__objs[objId = o.__oid = Function.__objs.length] = o;
}

var me = this;
var funcId = me.__fid;
if(!funcId) {
Function.__funcs[funcId = me.__fid = Function.__funcs.length] = me;
}

if(!o.__closures) {
o.__closures = [];
}

var closure = o.__closures[funcId];
if(closure) {
return closure;
}

o = null;
me = null;

return Function.__objs[objId].__closures[funcId] = function() {
return Function.__funcs[funcId].apply(Function.__objs[objId], arguments);
};
}
}, false);

Object.extend(Array.prototype, {
push: function(o) {
this[this.length] = o;
},
addRange: function(items) {
if(items.length > 0) {
for(var i=0; i<items.length; i++) {
this.push(items[i]);
}
}
},
clear: function() {
this.length = 0;
return this;
},
shift: function() {
if(this.length == 0) { return null; }
var o = this[0];
for(var i=0; i<this.length-1; i++) {
this[i] = this[i + 1];
}
this.length--;
return o;
}
}, false);

Object.extend(String.prototype, {
trimLeft: function() {
return this.replace(/^\s*/,"");
},
trimRight: function() {
return this.replace(/\s*$/,"");
},
trim: function() {
return this.trimRight().trimLeft();
},
endsWith: function(s) {
if(this.length == 0 || this.length < s.length) { return false; }
return (this.substr(this.length - s.length) == s);
},
startsWith: function(s) {
if(this.length == 0 || this.length < s.length) { return false; }
return (this.substr(0, s.length) == s);
},
split: function(c) {
var a = [];
if(this.length == 0) return a;
var p = 0;
for(var i=0; i<this.length; i++) {
if(this.charAt(i) == c) {
a.push(this.substring(p, i));
p = ++i;
}
}
a.push(s.substr(p));
return a;
}
}, false);

Object.extend(String, {
format: function(s) {
for(var i=1; i<arguments.length; i++) {
s = s.replace("{" + (i -1) + "}", arguments[i]);
}
return s;
},
isNullOrEmpty: function(s) {
if(s == null || s.length == 0) {
return true;
}
return false;
}
}, false);

if(typeof addEvent == "undefined")
addEvent = function(o, evType, f, capture) {
if(o == null) { return false; }
if(o.addEventListener) {
o.addEventListener(evType, f, capture);
return true;
} else if (o.attachEvent) {
var r = o.attachEvent("on" + evType, f);
return r;
} else {
try{ o["on" + evType] = f; }catch(e){}
}
};

if(typeof removeEvent == "undefined")
removeEvent = function(o, evType, f, capture) {
if(o == null) { return false; }
if(o.removeEventListener) {
o.removeEventListener(evType, f, capture);
return true;
} else if (o.detachEvent) {
o.detachEvent("on" + evType, f);
} else {
try{ o["on" + evType] = function(){}; }catch(e){}
}
};
//--------------------------------------------------------------
// Copyright (C) 2006 Michael Schwarz (http://www.ajaxpro.info).
// All rights reserved.
//--------------------------------------------------------------

// core.js
Object.extend(Function.prototype, {
getArguments: function() {
var args = [];
for(var i=0; i<this.arguments.length; i++) {
args.push(this.arguments[i]);
}
return args;
}
}, false);

var MS = {"Browser":{}};

Object.extend(MS.Browser, {
isIE: navigator.userAgent.indexOf('MSIE') != -1,
isFirefox: navigator.userAgent.indexOf('Firefox') != -1,
isOpera: window.opera != null
}, false);

var AjaxPro = {};

AjaxPro.IFrameXmlHttp = function() {};
AjaxPro.IFrameXmlHttp.prototype = {
onreadystatechange: null, headers: [], method: "POST", url: null, async: true, iframe: null,
status: 0, readyState: 0, responseText: null,
abort: function() {
},
readystatechanged: function() {
var doc = this.iframe.contentDocument || this.iframe.document;
if(doc != null && doc.readyState == "complete" && doc.body != null && doc.body.res != null) {
this.status = 200;
this.statusText = "OK";
this.readyState = 4;
this.responseText = doc.body.res;
this.onreadystatechange();
return;
}
setTimeout(this.readystatechanged.bind(this), 10);
},
open: function(method, url, async) {
if(async == false) {
alert("Synchronous call using IFrameXMLHttp is not supported.");
return;
}
if(this.iframe == null) {
var iframeID = "hans";
if (document.createElement && document.documentElement &&
(window.opera || navigator.userAgent.indexOf('MSIE 5.0') == -1))
{
var ifr = document.createElement('iframe');
ifr.setAttribute('id', iframeID);
ifr.style.visibility = 'hidden';
ifr.style.position = 'absolute';
ifr.style.width = ifr.style.height = ifr.borderWidth = '0px';

this.iframe = document.getElementsByTagName('body')[0].appendChild(ifr);
}
else if (document.body && document.body.insertAdjacentHTML)
{
document.body.insertAdjacentHTML('beforeEnd', '<iframe name="' + iframeID + '" id="' + iframeID + '" style="border:1px solid black;display:none"></iframe>');
}
if (window.frames && window.frames[iframeID]) {
this.iframe = window.frames[iframeID];
}
this.iframe.name = iframeID;
this.iframe.document.open();
this.iframe.document.write("<html><body></body></html>");
this.iframe.document.close();
}
this.method = method;
this.url = url;
this.async = async;
},
setRequestHeader: function(name, value) {
for(var i=0; i<this.headers.length; i++) {
if(this.headers[i].name == name) {
this.headers[i].value = value;
return;
}
}
this.headers.push({"name":name,"value":value});
},
getResponseHeader: function(name, value) {
return null;
},
addInput: function(doc, form, name, value) {
var ele;
var tag = "input";
if(value.indexOf("\n") >= 0) {
tag = "textarea";
}

if(doc.all) {
ele = doc.createElement("<" + tag + " name=\"" + name + "\" />");
}else{
ele = doc.createElement(tag);
ele.setAttribute("name", name);
}
ele.setAttribute("value", value);
form.appendChild(ele);
ele = null;
},
send: function(data) {
if(this.iframe == null) {
return;
}
var doc = this.iframe.contentDocument || this.iframe.document;
var form = doc.createElement("form");

doc.body.appendChild(form);

form.setAttribute("action", this.url);
form.setAttribute("method", this.method);
form.setAttribute("enctype", "application/x-www-form-urlencoded");

for(var i=0; i<this.headers.length; i++) {
switch(this.headers[i].name.toLowerCase()) {
case "content-length":
case "accept-encoding":
case "content-type":
break;
default:
this.addInput(doc, form, this.headers[i].name, this.headers[i].value);
}
}
this.addInput(doc, form, "data", data);
form.submit();

setTimeout(this.readystatechanged.bind(this), 0);
}
};

var progids = ["Msxml2.XMLHTTP", "Microsoft.XMLHTTP"];
var progid = null;

if(typeof ActiveXObject != "undefined") {
var ie7xmlhttp = false;
if(typeof XMLHttpRequest == "object") {
try{ var o = new XMLHttpRequest(); ie7xmlhttp = true; }catch(e){}
}
if(typeof XMLHttpRequest == "undefined" || !ie7xmlhttp) {
XMLHttpRequest = function() {
var xmlHttp = null;
if(!AjaxPro.noActiveX) {
if(progid != null) {
return new ActiveXObject(progid);
}
for(var i=0; i<progids.length && xmlHttp == null; i++) {
try {
xmlHttp = new ActiveXObject(progids[i]);
progid = progids[i];

}catch(e){}
}
}
if(xmlHttp == null && MS.Browser.isIE) {
return new AjaxPro.IFrameXmlHttp();
}
return xmlHttp;
};
}
}

Object.extend(AjaxPro, {
noOperation: function() {},
onLoading: function() {},
onError: function() {},
onTimeout: function() {},
onStateChanged: function() {},
cryptProvider: null,
queue: null,
token: "",
version: "6.10.4.1",
ID: "AjaxPro",
noActiveX: false,
timeoutPeriod: 10*1000,
queue: null,
noUtcTime: false,
m : {
'\b': '\\b',
'\t': '\\t',
'\n': '\\n',
'\f': '\\f',
'\r': '\\r',
'"' : '\\"',
'\\': '\\\\'
},
toJSON: function(o) {
if(o == null) {
return "null";
}
var v = [];
var i;
var c = o.constructor;
if(c == Number) {
return isFinite(o) ? o.toString() : AjaxPro.toJSON(null);
} else if(c == Boolean) {
return o.toString();
} else if(c == String) {
if (/["\\\x00-\x1f]/.test(o)) {
o = o.replace(/([\x00-\x1f\\"])/g, function(a, b) {
var c = AjaxPro.m[b];
if (c) {
return c;
}
c = b.charCodeAt();
return '\\u00' +
Math.floor(c / 16).toString(16) +
(c % 16).toString(16);
});
            }
return '"' + o + '"';
} else if (c == Array) {
for(i=0; i<o.length; i++) {
v.push(AjaxPro.toJSON(o[i]));
}
return "[" + v.join(",") + "]";
} else if (c == Date) {
var d = {};
d.__type = "System.DateTime";
if(AjaxPro.noUtcTime == true) {
d.Year = o.getFullYear();
d.Month = o.getMonth() +1;
d.Day = o.getDate();
d.Hour = o.getHours();
d.Minute = o.getMinutes();
d.Second = o.getSeconds();
d.Millisecond = o.getMilliseconds();
} else {
d.Year = o.getUTCFullYear();
d.Month = o.getUTCMonth() +1;
d.Day = o.getUTCDate();
d.Hour = o.getUTCHours();
d.Minute = o.getUTCMinutes();
d.Second = o.getUTCSeconds();
d.Millisecond = o.getUTCMilliseconds();
}
return AjaxPro.toJSON(d);
}
if(typeof o.toJSON == "function") {
return o.toJSON();
}
if(typeof o == "object") {
for(var attr in o) {
if(typeof o[attr] != "function") {
v.push('"' + attr + '":' + AjaxPro.toJSON(o[attr]));
}
}
if(v.length>0) {
return "{" + v.join(",") + "}";
}
return "{}";
}
return o.toString();
},
dispose: function() {
if(AjaxPro.queue != null) {
AjaxPro.queue.dispose();
}
}
}, false);

addEvent(window, "unload", AjaxPro.dispose);

AjaxPro.Request = function(url) {
this.url = url;
this.xmlHttp = null;
};

AjaxPro.Request.prototype = {
url: null,
callback: null,
onLoading: AjaxPro.noOperation,
onError: AjaxPro.noOperation,
onTimeout: AjaxPro.noOperation,
onStateChanged: AjaxPro.noOperation,
args: null,
context: null,
isRunning: false,
abort: function() {
if(this.timeoutTimer != null) {
clearTimeout(this.timeoutTimer);
}
if(this.xmlHttp) {
this.xmlHttp.onreadystatechange = AjaxPro.noOperation;
this.xmlHttp.abort();
}
if(this.isRunning) {
this.isRunning = false;
this.onLoading(false);
}
},
dispose: function() {
this.abort();
},
getEmptyRes: function() {
return {
error: null,
value: null,
request: {method:this.method, args:this.args},
context: this.context,
duration: this.duration
};
},
endRequest: function(res) {
this.abort();
if(res.error != null) {
this.onError(res.error, this);
}

if(typeof this.callback == "function") {
this.callback(res, this);
}
},
mozerror: function() {
if(this.timeoutTimer != null) {
clearTimeout(this.timeoutTimer);
}
var res = this.getEmptyRes();
res.error = {Message:"Unknown",Type:"ConnectFailure",Status:0};
this.endRequest(res);
},
doStateChange: function() {
this.onStateChanged(this.xmlHttp.readyState, this);

if(this.xmlHttp.readyState != 4 || !this.isRunning) {
return;
}

this.duration = new Date().getTime() - this.__start;

if(this.timeoutTimer != null) {
clearTimeout(this.timeoutTimer);
}

var res = this.getEmptyRes();
if(this.xmlHttp.status == 200 && this.xmlHttp.statusText == "OK") {
res = this.createResponse(res);
} else {
res = this.createResponse(res, true);
res.error = {Message:this.xmlHttp.statusText,Type:"ConnectFailure",Status:this.xmlHttp.status};
}

this.endRequest(res);
},
createResponse: function(r, noContent) {
if(!noContent) {
var responseText = "" + this.xmlHttp.responseText;

if(AjaxPro.cryptProvider != null && typeof AjaxPro.cryptProvider == "function") {
responseText = AjaxPro.cryptProvider.decrypt(responseText);
}

if(this.xmlHttp.getResponseHeader("Content-Type") == "text/xml") {
r.value = this.xmlHttp.responseXML;
} else {
if(responseText != null && responseText.trim().length > 0) {
r.json = responseText;
eval("r.value = " + responseText + "*" + "/");
}
}
}
/* if(this.xmlHttp.getResponseHeader("X-" + AjaxPro.ID + "-Cache") == "server") {
r.isCached = true;
} */
return r;
},
timeout: function() {
this.duration = new Date().getTime() - this.__start;
var r = this.onTimeout(this.duration, this);
if(typeof r == "undefined" || r != false) {
this.abort();
} else {
this.timeoutTimer = setTimeout(this.timeout.bind(this), AjaxPro.timeoutPeriod);
}
},
invoke: function(method, args, callback, context) {
this.__start = new Date().getTime();

if(this.xmlHttp == null) {
this.xmlHttp = new XMLHttpRequest();
}

this.isRunning = true;
this.method = method;
this.args = args;
this.callback = callback;
this.context = context;

var async = typeof(callback) == "function" && callback != AjaxPro.noOperation;

if(async) {
if(MS.Browser.isIE) {
this.xmlHttp.onreadystatechange = this.doStateChange.bind(this);
} else {
this.xmlHttp.onload = this.doStateChange.bind(this);
this.xmlHttp.onerror = this.mozerror.bind(this);
}
this.onLoading(true);
}

var json = AjaxPro.toJSON(args) + "";
if(AjaxPro.cryptProvider != null) {
json = AjaxPro.cryptProvider.encrypt(json);
}

this.xmlHttp.open("POST", this.url, async);
this.xmlHttp.setRequestHeader("Content-Type", "text/plain; charset=utf-8");
this.xmlHttp.setRequestHeader("X-" + AjaxPro.ID + "-Method", method);

if(AjaxPro.token != null && AjaxPro.token.length > 0) {
this.xmlHttp.setRequestHeader("X-" + AjaxPro.ID + "-Token", AjaxPro.token);
}

if(!MS.Browser.isIE) {
this.xmlHttp.setRequestHeader("Connection", "close");// Mozilla Bug #246651
}

this.timeoutTimer = setTimeout(this.timeout.bind(this), AjaxPro.timeoutPeriod);

try{ this.xmlHttp.send(json); }catch(e){}// IE offline exception

if(!async) {
return this.createResponse({error: null,value: null});
}

return true;
}
};

AjaxPro.RequestQueue = function(conc) {
this.queue = [];
this.requests = [];
this.timer = null;

if(isNaN(conc)) { conc = 2; }

for(var i=0; i<conc; i++) {// max 2 http connections
this.requests[i] = new AjaxPro.Request();
this.requests[i].callback = function(res) {
var r = res.context;
res.context = r[3][1];

r[3][0](res, this);
};
this.requests[i].callbackHandle = this.requests[i].callback.bind(this.requests[i]);
}
};

AjaxPro.RequestQueue.prototype = {
process: function() {

this.timer = null;
if(this.queue.length == 0) {
return;
}
for(var i=0; i<this.requests.length && this.queue.length > 0; i++) {
if(this.requests[i].isRunning == false) {
var r = this.queue.shift();

this.requests[i].url = r[0];
this.requests[i].onLoading = r[3].length >2 && r[3][2] != null && typeof r[3][2] == "function" ? r[3][2] : AjaxPro.onLoading;
this.requests[i].onError = r[3].length >3 && r[3][3] != null && typeof r[3][3] == "function" ? r[3][3] : AjaxPro.onError;
this.requests[i].onTimeout = r[3].length >4 && r[3][4] != null && typeof r[3][4] == "function" ? r[3][4] : AjaxPro.onTimeout;
this.requests[i].onStateChanged = r[3].length >5 && r[3][5] != null && typeof r[3][5] == "function" ? r[3][5] : AjaxPro.onStateChanged;

this.requests[i].invoke(r[1], r[2], this.requests[i].callbackHandle, r);
r = null;
}
}
if(this.queue.length > 0 && this.timer == null) {
this.timer = setTimeout(this.process.bind(this), 0);
}
},
add: function(url, method, args, e) {

// txt += "\r\nqueue.add " + (new Date().getTime() - ss);

this.queue.push([url, method, args, e]);
/*
if(this.timer == null) {
this.timer = setTimeout(this.process.bind(this), 0);
}
*/
this.process();
},
abort: function() {
this.queue.length = 0;
if (this.timer != null) {
clearTimeout(this.timer);
}
this.timer = null;
for(var i=0; i<this.requests.length; i++) {
if(this.requests[i].isRunning == true) {
this.requests[i].abort();
}
}
},
dispose: function() {
for(var i=0; i<this.requests.length; i++) {
var r = this.requests[i];
r.dispose();
}
this.requests.clear();
}
};

AjaxPro.queue = new AjaxPro.RequestQueue(2);// 2 http connections

AjaxPro.AjaxClass = function(url) {
this.url = url;
};

AjaxPro.AjaxClass.prototype = {
invoke: function(method, args, e) {

if(e != null) {
if(e.length != 6) {
for(;e.length<6;) { e.push(null); }
}
if(e[0] != null && typeof(e[0]) == "function") {
return AjaxPro.queue.add(this.url, method, args, e);
}
}
var r = new AjaxPro.Request();
r.url = this.url;
return r.invoke(method, args);
}
};
//--------------------------------------------------------------
// Copyright (C) 2006 Michael Schwarz (http://www.ajaxpro.info).
// All rights reserved.
//--------------------------------------------------------------

// ms.js
var addNamespace = function(ns) {
var nsParts = ns.split(".");
var root = window;
for(var i=0; i<nsParts.length; i++) {
if(typeof root[nsParts[i]] == "undefined") {
root[nsParts[i]] = {};
}
root = root[nsParts[i]];
}
};

Object.extend(window, {
$: function() {
var elements = [];
for(var i=0; i<arguments.length; i++) {
var e = arguments[i];
if(typeof e == 'string') {
e = document.getElementById(e);
}
if(arguments.length == 1) {
return e;
}
elements.push(e);
}
return elements;
},
Class: {
create: function() {
return function() {
if(typeof this.initialize == "function") {
this.initialize.apply(this, arguments);
}
};
}
}
}, false);

addNamespace("MS.Debug");
MS.Debug = {};// has been removed to debug version of core.ashx

addNamespace("MS.Position");

Object.extend(MS.Position, {
getLocation: function(ele) {
var x = 0;
var y = 0;
var p;
for(p=ele; p; p=p.offsetParent) {
// if(p.style.position == "relative" || p.style.position == "absolute") break;
if(p.offsetLeft && p.offsetTop) {
x += p.offsetLeft;
y += p.offsetTop;
}
}
return {left:x,top:y};
},
getBounds: function(ele) {
var offset = MS.Position.getLocation(ele);
var width = ele.offsetWidth;
var height = ele.offsetHeight;
return {left:offset.left,top:offset.top,width:width,height:height};
},
setLocation: function(ele, loc) {
ele.style.position = "absolute";
ele.style.left = loc.left + "px";
ele.style.top = loc.top + "px";
},
setBounds: function(ele, rect) {
if(rect.left && rect.top) {
MS.Position.setLocation(ele, rect);
}
ele.style.width = rect.width + "px";
ele.style.height = rect.height + "px";
}
}, false);

addNamespace("MS.Keys");

Object.extend(MS.Keys, {
TAB: 9,
ESC: 27,
KEYUP: 38,
KEYDOWN: 40,
KEYLEFT: 37,
KEYRIGHT: 39,
SHIFT: 16,
CTRL: 17,
ALT: 18,
ENTER: 13,
getCode: function(e) {
e = MS.getEvent(e);
if(e != null) { return e.keyCode; }
return -1;
}
}, false);

Object.extend(MS, {
setText: function(ele, text) {
if(ele == null) { return; }
if(document.all) {
ele.innerText = text;
} else {
ele.textContent = text;
}
},
setHtml: function(ele, html) {
if(ele == null) { return; }
ele.innerHTML = html;
},
cancelEvent: function(e) {
e = MS.getEvent(e);
if(window.event) {
e.returnValue = false;
} else if(e) {
e.preventDefault();
e.stopPropagation();
}
},
getEvent: function(e) {
if(window.event) { return window.event; }
if(e) { return e; }
return null;
},
getTarget: function(e) {
e = MS.getEvent(e);
if(window.event) { return e.srcElement; }
if(e) { return e.target; }
}
}, false);

var StringBuilder = function() {
this.v = [];
};

Object.extend(StringBuilder.prototype, {
append: function(s) {
this.v.push(s);
},
appendLine: function(s) {
this.v.push(s + "\r\n");
},
clear: function() {
this.v.clear();
},
toString: function() {
return this.v.join("");
}
}, true);
//--------------------------------------------------------------
// Copyright (C) 2006 Michael Schwarz (http://www.ajaxpro.info).
// All rights reserved.
//--------------------------------------------------------------
// Converter.js

// DataSetConverter
if(typeof Ajax == "undefined") Ajax={};
if(typeof Ajax.Web == "undefined") Ajax.Web={};
if(typeof Ajax.Web.DataSet == "undefined") Ajax.Web.DataSet={};

Ajax.Web.DataSet = function(t) {
this.__type = "System.Data.DataSet,System.Data";
this.Tables = [];
this.addTable = function(t) {
this.Tables.push(t);
};
if(t != null) {
for(var i=0; i<t.length; i++) {
this.addTable(t[i]);
}
}
};

// NameValueCollectionConverter
if(typeof Ajax == "undefined") Ajax={};
if(typeof Ajax.Web == "undefined") Ajax.Web={};
if(typeof Ajax.Web.NameValueCollection == "undefined") Ajax.Web.NameValueCollection={};

Ajax.Web.NameValueCollection = function(items) {
this.__type = "System.Collections.Specialized.NameValueCollection";
this.keys = [];
this.values = [];

if(items != null && !isNaN(items.length)) {
for(var i=0; i<items.length; i++)
this.add(items[i][0], items[i][1]);
}
};
Object.extend(Ajax.Web.NameValueCollection.prototype, {
add: function(k, v) {
if(k == null || k.constructor != String || v == null || v.constructor != String)
return -1;
this.keys.push(k);
this.values.push(v);
return this.values.length -1;
},
containsKey: function(key) {
for(var i=0; i<this.keys.length; i++) {
if(this.keys[i] == key) return true;
}
return false;
},
getKeys: function() {
return this.keys;
},
getValue: function(k) {
for(var i=0; i<this.keys.length && i<this.values.length; i++) {
if(this.keys[i] == k) return this.values[i];
}
return null;
},
setValue: function(k, v) {
if(k == null || k.constructor != String || v == null || v.constructor != String)
return -1;
for(var i=0; i<this.keys.length && i<this.values.length; i++) {
if(this.keys[i] == k) this.values[i] = v;
return i;
}
return this.add(k, v);
},
toJSON: function() {
return AjaxPro.toJSON({__type:this.__type,keys:this.keys,values:this.values});
}
}, true);

// DataTableConverter
if(typeof Ajax == "undefined") Ajax={};
if(typeof Ajax.Web == "undefined") Ajax.Web={};
if(typeof Ajax.Web.DataTable == "undefined") Ajax.Web.DataTable={};

Ajax.Web.DataTable = function(c, r) {
this.__type = "System.Data.DataTable,System.Data";
this.Columns = [];
this.Rows = [];
this.addColumn = function(name, type) {
this.Columns.push({Name:name,__type:type});
};
this.toJSON = function() {
var dt = {};
var i;
dt.Columns = [];
for(i=0; i<this.Columns.length; i++)
dt.Columns.push([this.Columns[i].Name, this.Columns[i].__type]);
dt.Rows = [];
for(i=0; i<this.Rows.length; i++) {
var row = [];
for(var j=0; j<this.Columns.length; j++)
row.push(this.Rows[i][this.Columns[j].Name]);
dt.Rows.push(row);
}
return AjaxPro.toJSON(dt);
};
this.addRow = function(row) {
this.Rows.push(row);
};
if(c != null) {
for(var i=0; i<c.length; i++)
this.addColumn(c[i][0], c[i][1]);
}
if(r != null) {
for(var y=0; y<r.length; y++) {
var row = {};
for(var z=0; z<this.Columns.length && z<r[y].length; z++)
row[this.Columns[z].Name] = r[y][z];
this.addRow(row);
}
}
};

// IDictionaryConverter
if(typeof Ajax == "undefined") Ajax={};
if(typeof Ajax.Web == "undefined") Ajax.Web={};
if(typeof Ajax.Web.Dictionary == "undefined") Ajax.Web.Dictionary={};

Ajax.Web.Dictionary = function(type,items) {
this.__type = type;
this.keys = [];
this.values = [];

if(items != null && !isNaN(items.length)) {
for(var i=0; i<items.length; i++)
this.add(items[i][0], items[i][1]);
}
};
Object.extend(Ajax.Web.Dictionary.prototype, {
add: function(k, v) {
this.keys.push(k);
this.values.push(v);
return this.values.length -1;
},
containsKey: function(key) {
for(var i=0; i<this.keys.length; i++) {
if(this.keys[i] == key) return true;
}
return false;
},
getKeys: function() {
return this.keys;
},
getValue: function(key) {
for(var i=0; i<this.keys.length && i<this.values.length; i++) {
if(this.keys[i] == key){ return this.values[i]; }
}
return null;
},
setValue: function(k, v) {
for(var i=0; i<this.keys.length && i<this.values.length; i++) {
if(this.keys[i] == k){ this.values[i] = v; }
return i;
}
return this.add(k, v);
},
toJSON: function() {
return AjaxPro.toJSON({__type:this.__type,keys:this.keys,values:this.values});
}
}, true);
if(typeof ProductWiki == "undefined") ProductWiki={};
if(typeof ProductWiki.Web == "undefined") ProductWiki.Web={};
if(typeof ProductWiki.Web.BasePage == "undefined") ProductWiki.Web.BasePage={};
if(typeof ProductWiki.Web.BasePage.PWPage == "undefined") ProductWiki.Web.BasePage.PWPage={};
ProductWiki.Web.BasePage.PWPage_class = function() {};
Object.extend(ProductWiki.Web.BasePage.PWPage_class.prototype, Object.extend(new AjaxPro.AjaxClass(), {
TrackGoogleAdsenseClick: function() {
return this.invoke("TrackGoogleAdsenseClick", {}, this.TrackGoogleAdsenseClick.getArguments().slice(0));
},
TrackShoppingDotComClick: function(product_label) {
return this.invoke("TrackShoppingDotComClick", {"product_label":product_label}, this.TrackShoppingDotComClick.getArguments().slice(1));
},
TrackQuadrusClick: function() {
return this.invoke("TrackQuadrusClick", {}, this.TrackQuadrusClick.getArguments().slice(0));
},
url: '/ajaxpro/ProductWiki.Web.BasePage.PWPage,ProductWiki.Web.ashx'
}));
ProductWiki.Web.BasePage.PWPage = new ProductWiki.Web.BasePage.PWPage_class();
if(typeof ProductWiki == "undefined") ProductWiki={};
if(typeof ProductWiki.Web == "undefined") ProductWiki.Web={};
if(typeof ProductWiki.Web.UserControls == "undefined") ProductWiki.Web.UserControls={};
if(typeof ProductWiki.Web.UserControls.Search_v3 == "undefined") ProductWiki.Web.UserControls.Search_v3={};
ProductWiki.Web.UserControls.Search_v3_class = function() {};
Object.extend(ProductWiki.Web.UserControls.Search_v3_class.prototype, Object.extend(new AjaxPro.AjaxClass(), {
getResults: function(query, idx) {
return this.invoke("getResults", {"query":query, "idx":idx}, this.getResults.getArguments().slice(2));
},
url: '/ajaxpro/ProductWiki.Web.UserControls.Search_v3,ProductWiki.Web.ashx'
}));
ProductWiki.Web.UserControls.Search_v3 = new ProductWiki.Web.UserControls.Search_v3_class();
if(typeof ProductWiki == "undefined") ProductWiki={};
if(typeof ProductWiki.Web == "undefined") ProductWiki.Web={};
if(typeof ProductWiki.Web.UserControls == "undefined") ProductWiki.Web.UserControls={};
if(typeof ProductWiki.Web.UserControls.NavigationBar == "undefined") ProductWiki.Web.UserControls.NavigationBar={};
ProductWiki.Web.UserControls.NavigationBar_class = function() {};
Object.extend(ProductWiki.Web.UserControls.NavigationBar_class.prototype, Object.extend(new AjaxPro.AjaxClass(), {
GetCategories: function(label) {
return this.invoke("GetCategories", {"label":label}, this.GetCategories.getArguments().slice(1));
},
url: '/ajaxpro/ProductWiki.Web.UserControls.NavigationBar,ProductWiki.Web.ashx'
}));
ProductWiki.Web.UserControls.NavigationBar = new ProductWiki.Web.UserControls.NavigationBar_class();
if(typeof ProductWiki == "undefined") ProductWiki={};
if(typeof ProductWiki.Web == "undefined") ProductWiki.Web={};
if(typeof ProductWiki.Web.UserControls == "undefined") ProductWiki.Web.UserControls={};
if(typeof ProductWiki.Web.UserControls.ListFilter_v3 == "undefined") ProductWiki.Web.UserControls.ListFilter_v3={};
ProductWiki.Web.UserControls.ListFilter_v3_class = function() {};
Object.extend(ProductWiki.Web.UserControls.ListFilter_v3_class.prototype, Object.extend(new AjaxPro.AjaxClass(), {
GetSliderURL: function(range_type, specification_type, current_url, facetlabel, min, max) {
return this.invoke("GetSliderURL", {"range_type":range_type, "specification_type":specification_type, "current_url":current_url, "facetlabel":facetlabel, "min":min, "max":max}, this.GetSliderURL.getArguments().slice(6));
},
url: '/ajaxpro/ProductWiki.Web.UserControls.ListFilter_v3,ProductWiki.Web.ashx'
}));
ProductWiki.Web.UserControls.ListFilter_v3 = new ProductWiki.Web.UserControls.ListFilter_v3_class();

if(typeof ProductWiki == "undefined") ProductWiki={};
if(typeof ProductWiki.Web == "undefined") ProductWiki.Web={};
if(typeof ProductWiki.Web.UserControls == "undefined") ProductWiki.Web.UserControls={};
if(typeof ProductWiki.Web.UserControls.GlobalRegister == "undefined") ProductWiki.Web.UserControls.GlobalRegister={};
ProductWiki.Web.UserControls.GlobalRegister_class = function() {};
Object.extend(ProductWiki.Web.UserControls.GlobalRegister_class.prototype, Object.extend(new AjaxPro.AjaxClass(), {
CheckUserName: function(Username) {
return this.invoke("CheckUserName", {"Username":Username}, this.CheckUserName.getArguments().slice(1));
},
ClearSession: function() {
return this.invoke("ClearSession", {}, this.ClearSession.getArguments().slice(0));
},
SetFacebookEmailSetting: function(value) {
return this.invoke("SetFacebookEmailSetting", {"value":value}, this.SetFacebookEmailSetting.getArguments().slice(1));
},
LogoutUser: function() {
return this.invoke("LogoutUser", {}, this.LogoutUser.getArguments().slice(0));
},
GetUserID: function() {
return this.invoke("GetUserID", {}, this.GetUserID.getArguments().slice(0));
},
PerformFacebookUserSignUp: function(Name, FacebookID, EmailAddress, AvatarURL) {
return this.invoke("PerformFacebookUserSignUp", {"Name":Name, "FacebookID":FacebookID, "EmailAddress":EmailAddress, "AvatarURL":AvatarURL}, this.PerformFacebookUserSignUp.getArguments().slice(4));
},
url: '/ajaxpro/ProductWiki.Web.UserControls.GlobalRegister,ProductWiki.Web.ashx'
}));
ProductWiki.Web.UserControls.GlobalRegister = new ProductWiki.Web.UserControls.GlobalRegister_class();
if(typeof ProductWiki == "undefined") ProductWiki={};
if(typeof ProductWiki.Web == "undefined") ProductWiki.Web={};
if(typeof ProductWiki.Web.UserControls == "undefined") ProductWiki.Web.UserControls={};
if(typeof ProductWiki.Web.UserControls.GlobalRegister_v3 == "undefined") ProductWiki.Web.UserControls.GlobalRegister_v3={};
ProductWiki.Web.UserControls.GlobalRegister_v3_class = function() {};
Object.extend(ProductWiki.Web.UserControls.GlobalRegister_v3_class.prototype, Object.extend(new AjaxPro.AjaxClass(), {
RegisterV3: function(userName, PW1, emailAddr) {
return this.invoke("RegisterV3", {"userName":userName, "PW1":PW1, "emailAddr":emailAddr}, this.RegisterV3.getArguments().slice(3));
},
SignInV3: function(username, pw) {
return this.invoke("SignInV3", {"username":username, "pw":pw}, this.SignInV3.getArguments().slice(2));
},
ResetPasswordV3: function(email) {
return this.invoke("ResetPasswordV3", {"email":email}, this.ResetPasswordV3.getArguments().slice(1));
},
CheckUserName: function(Username) {
return this.invoke("CheckUserName", {"Username":Username}, this.CheckUserName.getArguments().slice(1));
},
ClearSession: function() {
return this.invoke("ClearSession", {}, this.ClearSession.getArguments().slice(0));
},
SetFacebookEmailSetting: function(value) {
return this.invoke("SetFacebookEmailSetting", {"value":value}, this.SetFacebookEmailSetting.getArguments().slice(1));
},
LogoutUser: function() {
return this.invoke("LogoutUser", {}, this.LogoutUser.getArguments().slice(0));
},
GetUserID: function() {
return this.invoke("GetUserID", {}, this.GetUserID.getArguments().slice(0));
},
PerformFacebookUserSignUp: function(Name, FacebookID, EmailAddress, AvatarURL) {
return this.invoke("PerformFacebookUserSignUp", {"Name":Name, "FacebookID":FacebookID, "EmailAddress":EmailAddress, "AvatarURL":AvatarURL}, this.PerformFacebookUserSignUp.getArguments().slice(4));
},
url: '/ajaxpro/ProductWiki.Web.UserControls.GlobalRegister_v3,ProductWiki.Web.ashx'
}));
ProductWiki.Web.UserControls.GlobalRegister_v3 = new ProductWiki.Web.UserControls.GlobalRegister_v3_class();
if(typeof AjaxPro != "undefined") AjaxPro.timeoutPeriod=120*1000;

function bindDeferred(element) {
//parse event binding attribute or something
var bindelement=document.getElementById(element.id+'_bindelement').value;
var bindevent=document.getElementById(element.id+'_bindevent').value;
var loadinghtml=document.getElementById(element.id+'_loadinghtml');

if(loadinghtml) loadinghtml.style.display='';

if ((bindelement == "") || (bindevent == "")) {
getDeferredHTML(element);
}
else {
$("#" + bindelement).bind(bindevent,element,function(e){
getDeferredHTML(e.data);
});
}
}

function getDeferredHTML(element) {
var url=document.getElementById(element.id+'_url').value;
var id=document.getElementById(element.id+'_id').value;
ProductWiki.Web.UserControls.Deferred.DeferredControl.GetDefferedHTML(url,id,deferredCallBack.bind(element));
}

function deferredCallBack(res) {
var loadinghtml=document.getElementById(this.id+'_loadinghtml');
var html=res.value;
if (html == null) html = "";
this.innerHTML = html;
loadinghtml.style.display='none';
}
