/*
 * Cellblock general-purpose API wrapper, a component of the 
 * Gloto Platform.  See www.gloto.com for more information,
 * terms, and licensing.
 *
 * Copyright (C) 2005-2008, Gloto Corp.
 * http://www.cellblock.com/terms.htm
 */
 
/*****************************
 **                         **
 **     Utility Methods     **
 **                         **
 *****************************/

function JSONscriptRequest (fullUrl, callback) {
    this.fullUrl = fullUrl; 
    this.callback = callback;
    this.noCacheIE = '&noCacheIE=' + (new Date()).getTime();
    this.headLoc = document.getElementsByTagName("head").item(0);
    this.scriptId = 'JscriptId' + JSONscriptRequest.scriptCounter++;
}

JSONscriptRequest.scriptCounter = 1;
JSONscriptRequest.callbacks = {};

JSONscriptRequest.prototype.buildScriptTag = function () {
    this.scriptObj = document.createElement("script");
    this.scriptObj.setAttribute("type", "text/javascript");
    this.scriptObj.setAttribute("charset", "utf-8");
    this.scriptObj.setAttribute("src", this.fullUrl + this.noCacheIE + "&scriptId=" + this.scriptId + "&callback=data_handler");
    this.scriptObj.setAttribute("id", this.scriptId);
}
 
JSONscriptRequest.prototype.removeScriptTag = function () {
    this.headLoc.removeChild(this.scriptObj);  
}

JSONscriptRequest.prototype.addScriptTag = function () {
    this.headLoc.appendChild(this.scriptObj);
}

function data_handler (data) {
	var scriptId = data.scriptId;
	var bObj = JSONscriptRequest.callbacks[scriptId];
	delete JSONscriptRequest.callbacks[scriptId];
	bObj.callback(data); 
	bObj.removeScriptTag();
}


/*****************************
 **                         **
 **       Api Methods       **
 **                         **
 *****************************/
 
 
function AcceptedFrameInfoForCellblock (apiKey, id, offset, count, callback) {
	var url = "http://www.cellblock.com:80/api/rest/?method=AcceptedFrameInfoForCellblock&apiKey=" + apiKey + "&id=" + id +  (offset == null?"" :"&offset=" + offset) +  (count == null?"" :"&count=" + count);
	var bObj = new JSONscriptRequest(url, callback);
	JSONscriptRequest.callbacks[bObj.scriptId] = bObj;
	bObj.buildScriptTag();
	bObj.addScriptTag();
}


function AddExternalFrame (apiKey, id, caption, url, index, callback) {
	var url = "http://www.cellblock.com:80/api/rest/?method=AddExternalFrame&apiKey=" + apiKey + "&id=" + id + "&caption=" + caption + "&url=" + url +  (index == null?"" :"&index=" + index);
	var bObj = new JSONscriptRequest(url, callback);
	JSONscriptRequest.callbacks[bObj.scriptId] = bObj;
	bObj.buildScriptTag();
	bObj.addScriptTag();
}


function ApprovePendingFrame (apiKey, id, callback) {
	var url = "http://www.cellblock.com:80/api/rest/?method=ApprovePendingFrame&apiKey=" + apiKey + "&id=" + id;
	var bObj = new JSONscriptRequest(url, callback);
	JSONscriptRequest.callbacks[bObj.scriptId] = bObj;
	bObj.buildScriptTag();
	bObj.addScriptTag();
}


function CellblockIdsForUser (apiKey, screenName, realmId, callback) {
	var url = "http://www.cellblock.com:80/api/rest/?method=CellblockIdsForUser&apiKey=" + apiKey + "&screenName=" + screenName +  (realmId == null?"" :"&realmId=" + realmId);
	var bObj = new JSONscriptRequest(url, callback);
	JSONscriptRequest.callbacks[bObj.scriptId] = bObj;
	bObj.buildScriptTag();
	bObj.addScriptTag();
}


function CellblockInfo (apiKey, id, callback) {
	var url = "http://www.cellblock.com:80/api/rest/?method=CellblockInfo&apiKey=" + apiKey + "&id=" + id;
	var bObj = new JSONscriptRequest(url, callback);
	JSONscriptRequest.callbacks[bObj.scriptId] = bObj;
	bObj.buildScriptTag();
	bObj.addScriptTag();
}


function ConvertFrame (frameId, callback) {
	var url = "http://www.cellblock.com:80/api/rest/?method=ConvertFrame&frameId=" + frameId;
	var bObj = new JSONscriptRequest(url, callback);
	JSONscriptRequest.callbacks[bObj.scriptId] = bObj;
	bObj.buildScriptTag();
	bObj.addScriptTag();
}


function CopyFrame (apiKey, frameId, cellblockId, position, addMode, callback) {
	var url = "http://www.cellblock.com:80/api/rest/?method=CopyFrame&apiKey=" + apiKey + "&frameId=" + frameId + "&cellblockId=" + cellblockId +  (position == null?"" :"&position=" + position) +  (addMode == null?"" :"&addMode=" + addMode);
	var bObj = new JSONscriptRequest(url, callback);
	JSONscriptRequest.callbacks[bObj.scriptId] = bObj;
	bObj.buildScriptTag();
	bObj.addScriptTag();
}


function CreateCellblock (apiKey, title, email, callback) {
	var url = "http://www.cellblock.com:80/api/rest/?method=CreateCellblock&apiKey=" + apiKey + "&title=" + title +  (email == null?"" :"&email=" + email);
	var bObj = new JSONscriptRequest(url, callback);
	JSONscriptRequest.callbacks[bObj.scriptId] = bObj;
	bObj.buildScriptTag();
	bObj.addScriptTag();
}


function CreateCellblockAttributeDefinition (apiKey, realmId, attributeName, isPublic, callback) {
	var url = "http://www.cellblock.com:80/api/rest/?method=CreateCellblockAttributeDefinition&apiKey=" + apiKey + "&realmId=" + realmId + "&attributeName=" + attributeName + "&isPublic=" + isPublic;
	var bObj = new JSONscriptRequest(url, callback);
	JSONscriptRequest.callbacks[bObj.scriptId] = bObj;
	bObj.buildScriptTag();
	bObj.addScriptTag();
}


function CreateDisplayModel (apiKey, name, realmId, screenName, mobile, attributeList, callback) {
	var url = "http://www.cellblock.com:80/api/rest/?method=CreateDisplayModel&apiKey=" + apiKey +  (name == null?"" :"&name=" + name) +  (realmId == null?"" :"&realmId=" + realmId) +  (screenName == null?"" :"&screenName=" + screenName) +  (mobile == null?"" :"&mobile=" + mobile) +  (attributeList == null?"" :"&attributeList=" + attributeList);
	var bObj = new JSONscriptRequest(url, callback);
	JSONscriptRequest.callbacks[bObj.scriptId] = bObj;
	bObj.buildScriptTag();
	bObj.addScriptTag();
}


function CreateFrameAttributeDefinition (apiKey, realmId, attributeName, isPublic, callback) {
	var url = "http://www.cellblock.com:80/api/rest/?method=CreateFrameAttributeDefinition&apiKey=" + apiKey + "&realmId=" + realmId + "&attributeName=" + attributeName + "&isPublic=" + isPublic;
	var bObj = new JSONscriptRequest(url, callback);
	JSONscriptRequest.callbacks[bObj.scriptId] = bObj;
	bObj.buildScriptTag();
	bObj.addScriptTag();
}


function CreateRealm (apiKey, email, callback) {
	var url = "http://www.cellblock.com:80/api/rest/?method=CreateRealm&apiKey=" + apiKey + "&email=" + email;
	var bObj = new JSONscriptRequest(url, callback);
	JSONscriptRequest.callbacks[bObj.scriptId] = bObj;
	bObj.buildScriptTag();
	bObj.addScriptTag();
}


function CreateRealmAttributeDefinition (apiKey, realmId, attributeName, isPublic, callback) {
	var url = "http://www.cellblock.com:80/api/rest/?method=CreateRealmAttributeDefinition&apiKey=" + apiKey + "&realmId=" + realmId + "&attributeName=" + attributeName + "&isPublic=" + isPublic;
	var bObj = new JSONscriptRequest(url, callback);
	JSONscriptRequest.callbacks[bObj.scriptId] = bObj;
	bObj.buildScriptTag();
	bObj.addScriptTag();
}


function CreateRealmCellblock (apiKey, title, realmId, email, callback) {
	var url = "http://www.cellblock.com:80/api/rest/?method=CreateRealmCellblock&apiKey=" + apiKey + "&title=" + title +  (realmId == null?"" :"&realmId=" + realmId) +  (email == null?"" :"&email=" + email);
	var bObj = new JSONscriptRequest(url, callback);
	JSONscriptRequest.callbacks[bObj.scriptId] = bObj;
	bObj.buildScriptTag();
	bObj.addScriptTag();
}


function CreateUser (apiKey, realmId, screenName, email, password, mobileNumber, privilege, login, attributes, callback) {
	var url = "http://www.cellblock.com:80/api/rest/?method=CreateUser&apiKey=" + apiKey + "&realmId=" + realmId + "&screenName=" + screenName +  (email == null?"" :"&email=" + email) + "&password=" + password +  (mobileNumber == null?"" :"&mobileNumber=" + mobileNumber) +  (privilege == null?"" :"&privilege=" + privilege) +  (login == null?"" :"&login=" + login) +  (attributes == null?"" :"&attributes=" + attributes);
	var bObj = new JSONscriptRequest(url, callback);
	JSONscriptRequest.callbacks[bObj.scriptId] = bObj;
	bObj.buildScriptTag();
	bObj.addScriptTag();
}


function CreateUserAttributeDefinition (apiKey, realmId, attributeName, isPublic, callback) {
	var url = "http://www.cellblock.com:80/api/rest/?method=CreateUserAttributeDefinition&apiKey=" + apiKey + "&realmId=" + realmId + "&attributeName=" + attributeName + "&isPublic=" + isPublic;
	var bObj = new JSONscriptRequest(url, callback);
	JSONscriptRequest.callbacks[bObj.scriptId] = bObj;
	bObj.buildScriptTag();
	bObj.addScriptTag();
}


function DeleteAttributeDefinition (apiKey, realmId, attribute, target, callback) {
	var url = "http://www.cellblock.com:80/api/rest/?method=DeleteAttributeDefinition&apiKey=" + apiKey + "&realmId=" + realmId + "&attribute=" + attribute + "&target=" + target;
	var bObj = new JSONscriptRequest(url, callback);
	JSONscriptRequest.callbacks[bObj.scriptId] = bObj;
	bObj.buildScriptTag();
	bObj.addScriptTag();
}


function DeleteCellblock (apiKey, id, expunge, callback) {
	var url = "http://www.cellblock.com:80/api/rest/?method=DeleteCellblock&apiKey=" + apiKey + "&id=" + id +  (expunge == null?"" :"&expunge=" + expunge);
	var bObj = new JSONscriptRequest(url, callback);
	JSONscriptRequest.callbacks[bObj.scriptId] = bObj;
	bObj.buildScriptTag();
	bObj.addScriptTag();
}


function DeleteComment (apiKey, id, realmName, userName, frameId, index, callback) {
	var url = "http://www.cellblock.com:80/api/rest/?method=DeleteComment&apiKey=" + apiKey +  (id == null?"" :"&id=" + id) +  (realmName == null?"" :"&realmName=" + realmName) +  (userName == null?"" :"&userName=" + userName) +  (frameId == null?"" :"&frameId=" + frameId) + "&index=" + index;
	var bObj = new JSONscriptRequest(url, callback);
	JSONscriptRequest.callbacks[bObj.scriptId] = bObj;
	bObj.buildScriptTag();
	bObj.addScriptTag();
}


function DeleteDisplayModel (apiKey, id, callback) {
	var url = "http://www.cellblock.com:80/api/rest/?method=DeleteDisplayModel&apiKey=" + apiKey + "&id=" + id;
	var bObj = new JSONscriptRequest(url, callback);
	JSONscriptRequest.callbacks[bObj.scriptId] = bObj;
	bObj.buildScriptTag();
	bObj.addScriptTag();
}


function DeleteFrame (apiKey, id, callback) {
	var url = "http://www.cellblock.com:80/api/rest/?method=DeleteFrame&apiKey=" + apiKey + "&id=" + id;
	var bObj = new JSONscriptRequest(url, callback);
	JSONscriptRequest.callbacks[bObj.scriptId] = bObj;
	bObj.buildScriptTag();
	bObj.addScriptTag();
}


function DeleteUser (apiKey, realmId, screenName, callback) {
	var url = "http://www.cellblock.com:80/api/rest/?method=DeleteUser&apiKey=" + apiKey + "&realmId=" + realmId + "&screenName=" + screenName;
	var bObj = new JSONscriptRequest(url, callback);
	JSONscriptRequest.callbacks[bObj.scriptId] = bObj;
	bObj.buildScriptTag();
	bObj.addScriptTag();
}


function EmailDisposition (apiKey, emails, callback) {
	var url = "http://www.cellblock.com:80/api/rest/?method=EmailDisposition&apiKey=" + apiKey + "&emails=" + emails;
	var bObj = new JSONscriptRequest(url, callback);
	JSONscriptRequest.callbacks[bObj.scriptId] = bObj;
	bObj.buildScriptTag();
	bObj.addScriptTag();
}


function FrameInfoForCellblock (apiKey, id, offset, count, sortBy, direction, extended, realmId, frameType, callback) {
	var url = "http://www.cellblock.com:80/api/rest/?method=FrameInfoForCellblock&apiKey=" + apiKey + "&id=" + id +  (offset == null?"" :"&offset=" + offset) +  (count == null?"" :"&count=" + count) +  (sortBy == null?"" :"&sortBy=" + sortBy) +  (direction == null?"" :"&direction=" + direction) +  (extended == null?"" :"&extended=" + extended) +  (realmId == null?"" :"&realmId=" + realmId) +  (frameType == null?"" :"&frameType=" + frameType);
	var bObj = new JSONscriptRequest(url, callback);
	JSONscriptRequest.callbacks[bObj.scriptId] = bObj;
	bObj.buildScriptTag();
	bObj.addScriptTag();
}


function GetAnnotation (apiKey, frameId, callback) {
	var url = "http://www.cellblock.com:80/api/rest/?method=GetAnnotation&apiKey=" + apiKey + "&frameId=" + frameId;
	var bObj = new JSONscriptRequest(url, callback);
	JSONscriptRequest.callbacks[bObj.scriptId] = bObj;
	bObj.buildScriptTag();
	bObj.addScriptTag();
}


function GetAttributeDefinitions (apiKey, realmId, offset, count, callback) {
	var url = "http://www.cellblock.com:80/api/rest/?method=GetAttributeDefinitions&apiKey=" + apiKey + "&realmId=" + realmId + "&offset=" + offset + "&count=" + count;
	var bObj = new JSONscriptRequest(url, callback);
	JSONscriptRequest.callbacks[bObj.scriptId] = bObj;
	bObj.buildScriptTag();
	bObj.addScriptTag();
}


function GetCellblockAttributeValue (apiKey, id, attributeName, callback) {
	var url = "http://www.cellblock.com:80/api/rest/?method=GetCellblockAttributeValue&apiKey=" + apiKey + "&id=" + id + "&attributeName=" + attributeName;
	var bObj = new JSONscriptRequest(url, callback);
	JSONscriptRequest.callbacks[bObj.scriptId] = bObj;
	bObj.buildScriptTag();
	bObj.addScriptTag();
}


function GetCellblockAttributeValues (apiKey, realmId, id, callback) {
	var url = "http://www.cellblock.com:80/api/rest/?method=GetCellblockAttributeValues&apiKey=" + apiKey + "&realmId=" + realmId + "&id=" + id;
	var bObj = new JSONscriptRequest(url, callback);
	JSONscriptRequest.callbacks[bObj.scriptId] = bObj;
	bObj.buildScriptTag();
	bObj.addScriptTag();
}


function GetCellblockInfo (apiKey, id, displayModel, extended, callback) {
	var url = "http://www.cellblock.com:80/api/rest/?method=GetCellblockInfo&apiKey=" + apiKey + "&id=" + id +  (displayModel == null?"" :"&displayModel=" + displayModel) +  (extended == null?"" :"&extended=" + extended);
	var bObj = new JSONscriptRequest(url, callback);
	JSONscriptRequest.callbacks[bObj.scriptId] = bObj;
	bObj.buildScriptTag();
	bObj.addScriptTag();
}


function GetCellblocks (apiKey, extended, cellblockType, since, realmId, screenName, offset, count, callback) {
	var url = "http://www.cellblock.com:80/api/rest/?method=GetCellblocks&apiKey=" + apiKey +  (extended == null?"" :"&extended=" + extended) + "&cellblockType=" + cellblockType +  (since == null?"" :"&since=" + since) + "&realmId=" + realmId +  (screenName == null?"" :"&screenName=" + screenName) +  (offset == null?"" :"&offset=" + offset) +  (count == null?"" :"&count=" + count);
	var bObj = new JSONscriptRequest(url, callback);
	JSONscriptRequest.callbacks[bObj.scriptId] = bObj;
	bObj.buildScriptTag();
	bObj.addScriptTag();
}


function GetComments (apiKey, id, realmName, userName, frameId, offset, count, filter, direction, newComments, callback) {
	var url = "http://www.cellblock.com:80/api/rest/?method=GetComments&apiKey=" + apiKey +  (id == null?"" :"&id=" + id) +  (realmName == null?"" :"&realmName=" + realmName) +  (userName == null?"" :"&userName=" + userName) +  (frameId == null?"" :"&frameId=" + frameId) +  (offset == null?"" :"&offset=" + offset) +  (count == null?"" :"&count=" + count) +  (filter == null?"" :"&filter=" + filter) +  (direction == null?"" :"&direction=" + direction) +  (newComments == null?"" :"&newComments=" + newComments);
	var bObj = new JSONscriptRequest(url, callback);
	JSONscriptRequest.callbacks[bObj.scriptId] = bObj;
	bObj.buildScriptTag();
	bObj.addScriptTag();
}


function GetDisplayModel (apiKey, id, callback) {
	var url = "http://www.cellblock.com:80/api/rest/?method=GetDisplayModel&apiKey=" + apiKey + "&id=" + id;
	var bObj = new JSONscriptRequest(url, callback);
	JSONscriptRequest.callbacks[bObj.scriptId] = bObj;
	bObj.buildScriptTag();
	bObj.addScriptTag();
}


function GetDisplayModels (apiKey, realmId, screenName, mobile, offset, count, callback) {
	var url = "http://www.cellblock.com:80/api/rest/?method=GetDisplayModels&apiKey=" + apiKey +  (realmId == null?"" :"&realmId=" + realmId) +  (screenName == null?"" :"&screenName=" + screenName) +  (mobile == null?"" :"&mobile=" + mobile) +  (offset == null?"" :"&offset=" + offset) +  (count == null?"" :"&count=" + count);
	var bObj = new JSONscriptRequest(url, callback);
	JSONscriptRequest.callbacks[bObj.scriptId] = bObj;
	bObj.buildScriptTag();
	bObj.addScriptTag();
}


function GetDocumentation (apiKey, methodOfInterest, tagName, engineName, tagStyle, callback) {
	var url = "http://www.cellblock.com:80/api/rest/?method=GetDocumentation&apiKey=" + apiKey +  (methodOfInterest == null?"" :"&methodOfInterest=" + methodOfInterest) +  (tagName == null?"" :"&tagName=" + tagName) +  (engineName == null?"" :"&engineName=" + engineName) +  (tagStyle == null?"" :"&tagStyle=" + tagStyle);
	var bObj = new JSONscriptRequest(url, callback);
	JSONscriptRequest.callbacks[bObj.scriptId] = bObj;
	bObj.buildScriptTag();
	bObj.addScriptTag();
}


function GetFrameAttributeValue (apiKey, id, attributeName, callback) {
	var url = "http://www.cellblock.com:80/api/rest/?method=GetFrameAttributeValue&apiKey=" + apiKey + "&id=" + id + "&attributeName=" + attributeName;
	var bObj = new JSONscriptRequest(url, callback);
	JSONscriptRequest.callbacks[bObj.scriptId] = bObj;
	bObj.buildScriptTag();
	bObj.addScriptTag();
}


function GetFrameAttributeValues (apiKey, id, callback) {
	var url = "http://www.cellblock.com:80/api/rest/?method=GetFrameAttributeValues&apiKey=" + apiKey + "&id=" + id;
	var bObj = new JSONscriptRequest(url, callback);
	JSONscriptRequest.callbacks[bObj.scriptId] = bObj;
	bObj.buildScriptTag();
	bObj.addScriptTag();
}


function GetFrameInfo (apiKey, frameId, format, callback) {
	var url = "http://www.cellblock.com:80/api/rest/?method=GetFrameInfo&apiKey=" + apiKey + "&frameId=" + frameId +  (format == null?"" :"&format=" + format);
	var bObj = new JSONscriptRequest(url, callback);
	JSONscriptRequest.callbacks[bObj.scriptId] = bObj;
	bObj.buildScriptTag();
	bObj.addScriptTag();
}


function GetFramesNewerThan (apiKey, id, wIndex, callback) {
	var url = "http://www.cellblock.com:80/api/rest/?method=GetFramesNewerThan&apiKey=" + apiKey + "&id=" + id + "&wIndex=" + wIndex;
	var bObj = new JSONscriptRequest(url, callback);
	JSONscriptRequest.callbacks[bObj.scriptId] = bObj;
	bObj.buildScriptTag();
	bObj.addScriptTag();
}


function GetImageFilterInfo (apiKey, realmId, callback) {
	var url = "http://www.cellblock.com:80/api/rest/?method=GetImageFilterInfo&apiKey=" + apiKey + "&realmId=" + realmId;
	var bObj = new JSONscriptRequest(url, callback);
	JSONscriptRequest.callbacks[bObj.scriptId] = bObj;
	bObj.buildScriptTag();
	bObj.addScriptTag();
}


function GetLanguageFilterInfo (apiKey, realmId, offset, count, callback) {
	var url = "http://www.cellblock.com:80/api/rest/?method=GetLanguageFilterInfo&apiKey=" + apiKey + "&realmId=" + realmId +  (offset == null?"" :"&offset=" + offset) +  (count == null?"" :"&count=" + count);
	var bObj = new JSONscriptRequest(url, callback);
	JSONscriptRequest.callbacks[bObj.scriptId] = bObj;
	bObj.buildScriptTag();
	bObj.addScriptTag();
}


function GetMediaFilterInfo (apiKey, cellblockId, callback) {
	var url = "http://www.cellblock.com:80/api/rest/?method=GetMediaFilterInfo&apiKey=" + apiKey + "&cellblockId=" + cellblockId;
	var bObj = new JSONscriptRequest(url, callback);
	JSONscriptRequest.callbacks[bObj.scriptId] = bObj;
	bObj.buildScriptTag();
	bObj.addScriptTag();
}


function GetPublicApiMethods (apiKey, category, callback) {
	var url = "http://www.cellblock.com:80/api/rest/?method=GetPublicApiMethods&apiKey=" + apiKey +  (category == null?"" :"&category=" + category);
	var bObj = new JSONscriptRequest(url, callback);
	JSONscriptRequest.callbacks[bObj.scriptId] = bObj;
	bObj.buildScriptTag();
	bObj.addScriptTag();
}


function GetRating (apiKey, id, realmName, userName, frameId, extended, callback) {
	var url = "http://www.cellblock.com:80/api/rest/?method=GetRating&apiKey=" + apiKey +  (id == null?"" :"&id=" + id) +  (realmName == null?"" :"&realmName=" + realmName) +  (userName == null?"" :"&userName=" + userName) +  (frameId == null?"" :"&frameId=" + frameId) +  (extended == null?"" :"&extended=" + extended);
	var bObj = new JSONscriptRequest(url, callback);
	JSONscriptRequest.callbacks[bObj.scriptId] = bObj;
	bObj.buildScriptTag();
	bObj.addScriptTag();
}


function GetRealmAttributeValue (apiKey, realmId, attributeName, callback) {
	var url = "http://www.cellblock.com:80/api/rest/?method=GetRealmAttributeValue&apiKey=" + apiKey + "&realmId=" + realmId + "&attributeName=" + attributeName;
	var bObj = new JSONscriptRequest(url, callback);
	JSONscriptRequest.callbacks[bObj.scriptId] = bObj;
	bObj.buildScriptTag();
	bObj.addScriptTag();
}


function GetRealmAttributeValues (apiKey, realmId, callback) {
	var url = "http://www.cellblock.com:80/api/rest/?method=GetRealmAttributeValues&apiKey=" + apiKey + "&realmId=" + realmId;
	var bObj = new JSONscriptRequest(url, callback);
	JSONscriptRequest.callbacks[bObj.scriptId] = bObj;
	bObj.buildScriptTag();
	bObj.addScriptTag();
}


function GetRealmCellblocks (apiKey, offset, count, realmId, extended, since, callback) {
	var url = "http://www.cellblock.com:80/api/rest/?method=GetRealmCellblocks&apiKey=" + apiKey +  (offset == null?"" :"&offset=" + offset) +  (count == null?"" :"&count=" + count) + "&realmId=" + realmId +  (extended == null?"" :"&extended=" + extended) +  (since == null?"" :"&since=" + since);
	var bObj = new JSONscriptRequest(url, callback);
	JSONscriptRequest.callbacks[bObj.scriptId] = bObj;
	bObj.buildScriptTag();
	bObj.addScriptTag();
}


function GetRealmInfo (apiKey, realmId, callback) {
	var url = "http://www.cellblock.com:80/api/rest/?method=GetRealmInfo&apiKey=" + apiKey + "&realmId=" + realmId;
	var bObj = new JSONscriptRequest(url, callback);
	JSONscriptRequest.callbacks[bObj.scriptId] = bObj;
	bObj.buildScriptTag();
	bObj.addScriptTag();
}


function GetSessionInfo (apiKey, callback) {
	var url = "http://www.cellblock.com:80/api/rest/?method=GetSessionInfo&apiKey=" + apiKey;
	var bObj = new JSONscriptRequest(url, callback);
	JSONscriptRequest.callbacks[bObj.scriptId] = bObj;
	bObj.buildScriptTag();
	bObj.addScriptTag();
}


function GetTransactionResult (apiKey, id, callback) {
	var url = "http://www.cellblock.com:80/api/rest/?method=GetTransactionResult&apiKey=" + apiKey + "&id=" + id;
	var bObj = new JSONscriptRequest(url, callback);
	JSONscriptRequest.callbacks[bObj.scriptId] = bObj;
	bObj.buildScriptTag();
	bObj.addScriptTag();
}


function GetUserAttributeValue (apiKey, realmId, screenName, attributeName, callback) {
	var url = "http://www.cellblock.com:80/api/rest/?method=GetUserAttributeValue&apiKey=" + apiKey + "&realmId=" + realmId + "&screenName=" + screenName + "&attributeName=" + attributeName;
	var bObj = new JSONscriptRequest(url, callback);
	JSONscriptRequest.callbacks[bObj.scriptId] = bObj;
	bObj.buildScriptTag();
	bObj.addScriptTag();
}


function GetUserAttributeValues (apiKey, realmId, screenName, callback) {
	var url = "http://www.cellblock.com:80/api/rest/?method=GetUserAttributeValues&apiKey=" + apiKey + "&realmId=" + realmId + "&screenName=" + screenName;
	var bObj = new JSONscriptRequest(url, callback);
	JSONscriptRequest.callbacks[bObj.scriptId] = bObj;
	bObj.buildScriptTag();
	bObj.addScriptTag();
}


function GetUserCellblocks (apiKey, screenName, realmId, offset, count, extended, callback) {
	var url = "http://www.cellblock.com:80/api/rest/?method=GetUserCellblocks&apiKey=" + apiKey + "&screenName=" + screenName +  (realmId == null?"" :"&realmId=" + realmId) +  (offset == null?"" :"&offset=" + offset) +  (count == null?"" :"&count=" + count) +  (extended == null?"" :"&extended=" + extended);
	var bObj = new JSONscriptRequest(url, callback);
	JSONscriptRequest.callbacks[bObj.scriptId] = bObj;
	bObj.buildScriptTag();
	bObj.addScriptTag();
}


function GetUserFrames (apiKey, screenName, realmId, offset, count, order, extended, callback) {
	var url = "http://www.cellblock.com:80/api/rest/?method=GetUserFrames&apiKey=" + apiKey + "&screenName=" + screenName + "&realmId=" + realmId +  (offset == null?"" :"&offset=" + offset) +  (count == null?"" :"&count=" + count) +  (order == null?"" :"&order=" + order) +  (extended == null?"" :"&extended=" + extended);
	var bObj = new JSONscriptRequest(url, callback);
	JSONscriptRequest.callbacks[bObj.scriptId] = bObj;
	bObj.buildScriptTag();
	bObj.addScriptTag();
}


function GetUserInfo (apiKey, realmId, screenName, extended, callback) {
	var url = "http://www.cellblock.com:80/api/rest/?method=GetUserInfo&apiKey=" + apiKey + "&realmId=" + realmId + "&screenName=" + screenName +  (extended == null?"" :"&extended=" + extended);
	var bObj = new JSONscriptRequest(url, callback);
	JSONscriptRequest.callbacks[bObj.scriptId] = bObj;
	bObj.buildScriptTag();
	bObj.addScriptTag();
}


function GetUsersInRealm (apiKey, realmId, offset, count, minPrivilege, maxPrivilege, minDate, maxDate, sortBy, extended, callback) {
	var url = "http://www.cellblock.com:80/api/rest/?method=GetUsersInRealm&apiKey=" + apiKey + "&realmId=" + realmId +  (offset == null?"" :"&offset=" + offset) +  (count == null?"" :"&count=" + count) +  (minPrivilege == null?"" :"&minPrivilege=" + minPrivilege) +  (maxPrivilege == null?"" :"&maxPrivilege=" + maxPrivilege) +  (minDate == null?"" :"&minDate=" + minDate) +  (maxDate == null?"" :"&maxDate=" + maxDate) +  (sortBy == null?"" :"&sortBy=" + sortBy) +  (extended == null?"" :"&extended=" + extended);
	var bObj = new JSONscriptRequest(url, callback);
	JSONscriptRequest.callbacks[bObj.scriptId] = bObj;
	bObj.buildScriptTag();
	bObj.addScriptTag();
}


function LatestFramesAcrossRealm (apiKey, realmId, offset, count, callback) {
	var url = "http://www.cellblock.com:80/api/rest/?method=LatestFramesAcrossRealm&apiKey=" + apiKey +  (realmId == null?"" :"&realmId=" + realmId) +  (offset == null?"" :"&offset=" + offset) +  (count == null?"" :"&count=" + count);
	var bObj = new JSONscriptRequest(url, callback);
	JSONscriptRequest.callbacks[bObj.scriptId] = bObj;
	bObj.buildScriptTag();
	bObj.addScriptTag();
}


function LatestFramesForUser (apiKey, screenName, realmId, callback) {
	var url = "http://www.cellblock.com:80/api/rest/?method=LatestFramesForUser&apiKey=" + apiKey + "&screenName=" + screenName + "&realmId=" + realmId;
	var bObj = new JSONscriptRequest(url, callback);
	JSONscriptRequest.callbacks[bObj.scriptId] = bObj;
	bObj.buildScriptTag();
	bObj.addScriptTag();
}


function Login (apiKey, screenName, password, realmId, cellblockId, clear, callback) {
	var url = "http://www.cellblock.com:80/api/rest/?method=Login&apiKey=" + apiKey + "&screenName=" + screenName + "&password=" + password + "&realmId=" + realmId +  (cellblockId == null?"" :"&cellblockId=" + cellblockId) +  (clear == null?"" :"&clear=" + clear);
	var bObj = new JSONscriptRequest(url, callback);
	JSONscriptRequest.callbacks[bObj.scriptId] = bObj;
	bObj.buildScriptTag();
	bObj.addScriptTag();
}


function Logout (apiKey, callback) {
	var url = "http://www.cellblock.com:80/api/rest/?method=Logout&apiKey=" + apiKey;
	var bObj = new JSONscriptRequest(url, callback);
	JSONscriptRequest.callbacks[bObj.scriptId] = bObj;
	bObj.buildScriptTag();
	bObj.addScriptTag();
}


function ModerateImageFilter (apiKey, realmId, frameId, action, callback) {
	var url = "http://www.cellblock.com:80/api/rest/?method=ModerateImageFilter&apiKey=" + apiKey + "&realmId=" + realmId + "&frameId=" + frameId + "&action=" + action;
	var bObj = new JSONscriptRequest(url, callback);
	JSONscriptRequest.callbacks[bObj.scriptId] = bObj;
	bObj.buildScriptTag();
	bObj.addScriptTag();
}


function More (apiKey, id, direction, maxWIndex, lastIndex, callback) {
	var url = "http://www.cellblock.com:80/api/rest/?method=More&apiKey=" + apiKey + "&id=" + id + "&direction=" + direction +  (maxWIndex == null?"" :"&maxWIndex=" + maxWIndex) +  (lastIndex == null?"" :"&lastIndex=" + lastIndex);
	var bObj = new JSONscriptRequest(url, callback);
	JSONscriptRequest.callbacks[bObj.scriptId] = bObj;
	bObj.buildScriptTag();
	bObj.addScriptTag();
}


function MoveApprovedFrame (apiKey, id, newPosition, callback) {
	var url = "http://www.cellblock.com:80/api/rest/?method=MoveApprovedFrame&apiKey=" + apiKey + "&id=" + id + "&newPosition=" + newPosition;
	var bObj = new JSONscriptRequest(url, callback);
	JSONscriptRequest.callbacks[bObj.scriptId] = bObj;
	bObj.buildScriptTag();
	bObj.addScriptTag();
}


function NumAcceptedFrames (apiKey, id, callback) {
	var url = "http://www.cellblock.com:80/api/rest/?method=NumAcceptedFrames&apiKey=" + apiKey + "&id=" + id;
	var bObj = new JSONscriptRequest(url, callback);
	JSONscriptRequest.callbacks[bObj.scriptId] = bObj;
	bObj.buildScriptTag();
	bObj.addScriptTag();
}


function NumFrames (apiKey, id, callback) {
	var url = "http://www.cellblock.com:80/api/rest/?method=NumFrames&apiKey=" + apiKey + "&id=" + id;
	var bObj = new JSONscriptRequest(url, callback);
	JSONscriptRequest.callbacks[bObj.scriptId] = bObj;
	bObj.buildScriptTag();
	bObj.addScriptTag();
}


function NumPendingFrames (apiKey, id, callback) {
	var url = "http://www.cellblock.com:80/api/rest/?method=NumPendingFrames&apiKey=" + apiKey + "&id=" + id;
	var bObj = new JSONscriptRequest(url, callback);
	JSONscriptRequest.callbacks[bObj.scriptId] = bObj;
	bObj.buildScriptTag();
	bObj.addScriptTag();
}


function NumRealmCellblocks (apiKey, realmId, callback) {
	var url = "http://www.cellblock.com:80/api/rest/?method=NumRealmCellblocks&apiKey=" + apiKey + "&realmId=" + realmId;
	var bObj = new JSONscriptRequest(url, callback);
	JSONscriptRequest.callbacks[bObj.scriptId] = bObj;
	bObj.buildScriptTag();
	bObj.addScriptTag();
}


function NumRealmUsers (apiKey, realmId, callback) {
	var url = "http://www.cellblock.com:80/api/rest/?method=NumRealmUsers&apiKey=" + apiKey + "&realmId=" + realmId;
	var bObj = new JSONscriptRequest(url, callback);
	JSONscriptRequest.callbacks[bObj.scriptId] = bObj;
	bObj.buildScriptTag();
	bObj.addScriptTag();
}


function ParseSpreadsheet (apiKey, handle, callback) {
	var url = "http://www.cellblock.com:80/api/rest/?method=ParseSpreadsheet&apiKey=" + apiKey + "&handle=" + handle;
	var bObj = new JSONscriptRequest(url, callback);
	JSONscriptRequest.callbacks[bObj.scriptId] = bObj;
	bObj.buildScriptTag();
	bObj.addScriptTag();
}


function PendingFrameInfoForCellblock (apiKey, id, offset, count, callback) {
	var url = "http://www.cellblock.com:80/api/rest/?method=PendingFrameInfoForCellblock&apiKey=" + apiKey + "&id=" + id +  (offset == null?"" :"&offset=" + offset) +  (count == null?"" :"&count=" + count);
	var bObj = new JSONscriptRequest(url, callback);
	JSONscriptRequest.callbacks[bObj.scriptId] = bObj;
	bObj.buildScriptTag();
	bObj.addScriptTag();
}


function Ping (apiKey, num, responsePage, callback) {
	var url = "http://www.cellblock.com:80/api/rest/?method=Ping&apiKey=" + apiKey +  (num == null?"" :"&num=" + num) +  (responsePage == null?"" :"&responsePage=" + responsePage);
	var bObj = new JSONscriptRequest(url, callback);
	JSONscriptRequest.callbacks[bObj.scriptId] = bObj;
	bObj.buildScriptTag();
	bObj.addScriptTag();
}


function PostComment (apiKey, comment, id, realmName, userName, frameId, index, source, newState, newFlag, rating, attributeList, callback) {
	var url = "http://www.cellblock.com:80/api/rest/?method=PostComment&apiKey=" + apiKey +  (comment == null?"" :"&comment=" + comment) +  (id == null?"" :"&id=" + id) +  (realmName == null?"" :"&realmName=" + realmName) +  (userName == null?"" :"&userName=" + userName) +  (frameId == null?"" :"&frameId=" + frameId) +  (index == null?"" :"&index=" + index) + "&source=" + source +  (newState == null?"" :"&newState=" + newState) +  (newFlag == null?"" :"&newFlag=" + newFlag) +  (rating == null?"" :"&rating=" + rating) +  (attributeList == null?"" :"&attributeList=" + attributeList);
	var bObj = new JSONscriptRequest(url, callback);
	JSONscriptRequest.callbacks[bObj.scriptId] = bObj;
	bObj.buildScriptTag();
	bObj.addScriptTag();
}


function PublishCellblockEmailAddress (apiKey, id, publish, callback) {
	var url = "http://www.cellblock.com:80/api/rest/?method=PublishCellblockEmailAddress&apiKey=" + apiKey + "&id=" + id + "&publish=" + publish;
	var bObj = new JSONscriptRequest(url, callback);
	JSONscriptRequest.callbacks[bObj.scriptId] = bObj;
	bObj.buildScriptTag();
	bObj.addScriptTag();
}


function RealmLogin (apiKey, realmId, realmPassword, clear, callback) {
	var url = "http://www.cellblock.com:80/api/rest/?method=RealmLogin&apiKey=" + apiKey + "&realmId=" + realmId + "&realmPassword=" + realmPassword +  (clear == null?"" :"&clear=" + clear);
	var bObj = new JSONscriptRequest(url, callback);
	JSONscriptRequest.callbacks[bObj.scriptId] = bObj;
	bObj.buildScriptTag();
	bObj.addScriptTag();
}


function RefreshExternalFrame (apiKey, id, callback) {
	var url = "http://www.cellblock.com:80/api/rest/?method=RefreshExternalFrame&apiKey=" + apiKey + "&id=" + id;
	var bObj = new JSONscriptRequest(url, callback);
	JSONscriptRequest.callbacks[bObj.scriptId] = bObj;
	bObj.buildScriptTag();
	bObj.addScriptTag();
}


function RotateFrameLeft (apiKey, id, callback) {
	var url = "http://www.cellblock.com:80/api/rest/?method=RotateFrameLeft&apiKey=" + apiKey + "&id=" + id;
	var bObj = new JSONscriptRequest(url, callback);
	JSONscriptRequest.callbacks[bObj.scriptId] = bObj;
	bObj.buildScriptTag();
	bObj.addScriptTag();
}


function RotateFrameRight (apiKey, id, callback) {
	var url = "http://www.cellblock.com:80/api/rest/?method=RotateFrameRight&apiKey=" + apiKey + "&id=" + id;
	var bObj = new JSONscriptRequest(url, callback);
	JSONscriptRequest.callbacks[bObj.scriptId] = bObj;
	bObj.buildScriptTag();
	bObj.addScriptTag();
}


function SendCellblockToPhone (apiKey, id, phone, carrier, format, serviceKey, pageName, frameId, callback) {
	var url = "http://www.cellblock.com:80/api/rest/?method=SendCellblockToPhone&apiKey=" + apiKey +  (id == null?"" :"&id=" + id) + "&phone=" + phone +  (carrier == null?"" :"&carrier=" + carrier) +  (format == null?"" :"&format=" + format) +  (serviceKey == null?"" :"&serviceKey=" + serviceKey) +  (pageName == null?"" :"&pageName=" + pageName) +  (frameId == null?"" :"&frameId=" + frameId);
	var bObj = new JSONscriptRequest(url, callback);
	JSONscriptRequest.callbacks[bObj.scriptId] = bObj;
	bObj.buildScriptTag();
	bObj.addScriptTag();
}


function SetAnnotation (apiKey, frameId, text, font, fontColor, fontSize, fontEffect, fontStyle, xLocation, yLocation, xAlign, yAlign, replace, annotationId, save, imageURI, scale, callback) {
	var url = "http://www.cellblock.com:80/api/rest/?method=SetAnnotation&apiKey=" + apiKey + "&frameId=" + frameId +  (text == null?"" :"&text=" + text) +  (font == null?"" :"&font=" + font) +  (fontColor == null?"" :"&fontColor=" + fontColor) +  (fontSize == null?"" :"&fontSize=" + fontSize) +  (fontEffect == null?"" :"&fontEffect=" + fontEffect) +  (fontStyle == null?"" :"&fontStyle=" + fontStyle) +  (xLocation == null?"" :"&xLocation=" + xLocation) +  (yLocation == null?"" :"&yLocation=" + yLocation) +  (xAlign == null?"" :"&xAlign=" + xAlign) +  (yAlign == null?"" :"&yAlign=" + yAlign) +  (replace == null?"" :"&replace=" + replace) +  (annotationId == null?"" :"&annotationId=" + annotationId) +  (save == null?"" :"&save=" + save) +  (imageURI == null?"" :"&imageURI=" + imageURI) +  (scale == null?"" :"&scale=" + scale);
	var bObj = new JSONscriptRequest(url, callback);
	JSONscriptRequest.callbacks[bObj.scriptId] = bObj;
	bObj.buildScriptTag();
	bObj.addScriptTag();
}


function SetCellblockAttributeValue (apiKey, id, attributeName, attributeValue, callback) {
	var url = "http://www.cellblock.com:80/api/rest/?method=SetCellblockAttributeValue&apiKey=" + apiKey + "&id=" + id + "&attributeName=" + attributeName + "&attributeValue=" + attributeValue;
	var bObj = new JSONscriptRequest(url, callback);
	JSONscriptRequest.callbacks[bObj.scriptId] = bObj;
	bObj.buildScriptTag();
	bObj.addScriptTag();
}


function SetCellblockInfo (apiKey, id, playMode, message, preview, name, publicUpload, tags, receiptEnabled, receiptSubject, receiptBody, email, previewComments, publishEmailAddress, acceptingContent, attributes, callback) {
	var url = "http://www.cellblock.com:80/api/rest/?method=SetCellblockInfo&apiKey=" + apiKey + "&id=" + id +  (playMode == null?"" :"&playMode=" + playMode) +  (message == null?"" :"&message=" + message) +  (preview == null?"" :"&preview=" + preview) +  (name == null?"" :"&name=" + name) +  (publicUpload == null?"" :"&publicUpload=" + publicUpload) +  (tags == null?"" :"&tags=" + tags) +  (receiptEnabled == null?"" :"&receiptEnabled=" + receiptEnabled) +  (receiptSubject == null?"" :"&receiptSubject=" + receiptSubject) +  (receiptBody == null?"" :"&receiptBody=" + receiptBody) +  (email == null?"" :"&email=" + email) +  (previewComments == null?"" :"&previewComments=" + previewComments) +  (publishEmailAddress == null?"" :"&publishEmailAddress=" + publishEmailAddress) +  (acceptingContent == null?"" :"&acceptingContent=" + acceptingContent) +  (attributes == null?"" :"&attributes=" + attributes);
	var bObj = new JSONscriptRequest(url, callback);
	JSONscriptRequest.callbacks[bObj.scriptId] = bObj;
	bObj.buildScriptTag();
	bObj.addScriptTag();
}


function SetCellblockInfoExtended (apiKey, id, receiptFromAddress, accessLevel, restrictedMediaTypes, callback) {
	var url = "http://www.cellblock.com:80/api/rest/?method=SetCellblockInfoExtended&apiKey=" + apiKey + "&id=" + id +  (receiptFromAddress == null?"" :"&receiptFromAddress=" + receiptFromAddress) +  (accessLevel == null?"" :"&accessLevel=" + accessLevel) +  (restrictedMediaTypes == null?"" :"&restrictedMediaTypes=" + restrictedMediaTypes);
	var bObj = new JSONscriptRequest(url, callback);
	JSONscriptRequest.callbacks[bObj.scriptId] = bObj;
	bObj.buildScriptTag();
	bObj.addScriptTag();
}


function SetDisplayModel (apiKey, id, attributes, md5s, action, callback) {
	var url = "http://www.cellblock.com:80/api/rest/?method=SetDisplayModel&apiKey=" + apiKey + "&id=" + id + "&attributes=" + attributes +  (md5s == null?"" :"&md5s=" + md5s) +  (action == null?"" :"&action=" + action);
	var bObj = new JSONscriptRequest(url, callback);
	JSONscriptRequest.callbacks[bObj.scriptId] = bObj;
	bObj.buildScriptTag();
	bObj.addScriptTag();
}


function SetExternalEmailAddress (apiKey, id, email, callback) {
	var url = "http://www.cellblock.com:80/api/rest/?method=SetExternalEmailAddress&apiKey=" + apiKey + "&id=" + id +  (email == null?"" :"&email=" + email);
	var bObj = new JSONscriptRequest(url, callback);
	JSONscriptRequest.callbacks[bObj.scriptId] = bObj;
	bObj.buildScriptTag();
	bObj.addScriptTag();
}


function SetFrameAttributeValue (apiKey, id, attributeName, attributeValue, callback) {
	var url = "http://www.cellblock.com:80/api/rest/?method=SetFrameAttributeValue&apiKey=" + apiKey + "&id=" + id + "&attributeName=" + attributeName + "&attributeValue=" + attributeValue;
	var bObj = new JSONscriptRequest(url, callback);
	JSONscriptRequest.callbacks[bObj.scriptId] = bObj;
	bObj.buildScriptTag();
	bObj.addScriptTag();
}


function SetFrameCaption (apiKey, id, caption, callback) {
	var url = "http://www.cellblock.com:80/api/rest/?method=SetFrameCaption&apiKey=" + apiKey + "&id=" + id + "&caption=" + caption;
	var bObj = new JSONscriptRequest(url, callback);
	JSONscriptRequest.callbacks[bObj.scriptId] = bObj;
	bObj.buildScriptTag();
	bObj.addScriptTag();
}


function SetFrameInfo (apiKey, frameId, previewComments, caption, flavor, url, attributes, frameType, newFlag, callback) {
	var url = "http://www.cellblock.com:80/api/rest/?method=SetFrameInfo&apiKey=" + apiKey + "&frameId=" + frameId +  (previewComments == null?"" :"&previewComments=" + previewComments) +  (caption == null?"" :"&caption=" + caption) +  (flavor == null?"" :"&flavor=" + flavor) +  (url == null?"" :"&url=" + url) +  (attributes == null?"" :"&attributes=" + attributes) +  (frameType == null?"" :"&frameType=" + frameType) +  (newFlag == null?"" :"&newFlag=" + newFlag);
	var bObj = new JSONscriptRequest(url, callback);
	JSONscriptRequest.callbacks[bObj.scriptId] = bObj;
	bObj.buildScriptTag();
	bObj.addScriptTag();
}


function SetFrameOrder (apiKey, cellblockId, frameOrder, position, callback) {
	var url = "http://www.cellblock.com:80/api/rest/?method=SetFrameOrder&apiKey=" + apiKey + "&cellblockId=" + cellblockId + "&frameOrder=" + frameOrder + "&position=" + position;
	var bObj = new JSONscriptRequest(url, callback);
	JSONscriptRequest.callbacks[bObj.scriptId] = bObj;
	bObj.buildScriptTag();
	bObj.addScriptTag();
}


function SetFrameVisibility (apiKey, id, visibility, callback) {
	var url = "http://www.cellblock.com:80/api/rest/?method=SetFrameVisibility&apiKey=" + apiKey + "&id=" + id + "&visibility=" + visibility;
	var bObj = new JSONscriptRequest(url, callback);
	JSONscriptRequest.callbacks[bObj.scriptId] = bObj;
	bObj.buildScriptTag();
	bObj.addScriptTag();
}


function SetImageFilterInfo (apiKey, realmId, corpusCellblock, filterMode, matchThreshold, autolearnThreshold, callback) {
	var url = "http://www.cellblock.com:80/api/rest/?method=SetImageFilterInfo&apiKey=" + apiKey + "&realmId=" + realmId +  (corpusCellblock == null?"" :"&corpusCellblock=" + corpusCellblock) +  (filterMode == null?"" :"&filterMode=" + filterMode) +  (matchThreshold == null?"" :"&matchThreshold=" + matchThreshold) +  (autolearnThreshold == null?"" :"&autolearnThreshold=" + autolearnThreshold);
	var bObj = new JSONscriptRequest(url, callback);
	JSONscriptRequest.callbacks[bObj.scriptId] = bObj;
	bObj.buildScriptTag();
	bObj.addScriptTag();
}


function SetLanguageFilterInfo (apiKey, realmId, enabled, word, replacement, suffixList, dictId, clear, callback) {
	var url = "http://www.cellblock.com:80/api/rest/?method=SetLanguageFilterInfo&apiKey=" + apiKey + "&realmId=" + realmId +  (enabled == null?"" :"&enabled=" + enabled) +  (word == null?"" :"&word=" + word) +  (replacement == null?"" :"&replacement=" + replacement) +  (suffixList == null?"" :"&suffixList=" + suffixList) +  (dictId == null?"" :"&dictId=" + dictId) +  (clear == null?"" :"&clear=" + clear);
	var bObj = new JSONscriptRequest(url, callback);
	JSONscriptRequest.callbacks[bObj.scriptId] = bObj;
	bObj.buildScriptTag();
	bObj.addScriptTag();
}


function SetMediaFilterInfo (apiKey, cellblockId, filterId, type, name, mode, lat1, lon1, radius1, time1, time2, deleteFilter, callback) {
	var url = "http://www.cellblock.com:80/api/rest/?method=SetMediaFilterInfo&apiKey=" + apiKey + "&cellblockId=" + cellblockId +  (filterId == null?"" :"&filterId=" + filterId) +  (type == null?"" :"&type=" + type) +  (name == null?"" :"&name=" + name) +  (mode == null?"" :"&mode=" + mode) +  (lat1 == null?"" :"&lat1=" + lat1) +  (lon1 == null?"" :"&lon1=" + lon1) +  (radius1 == null?"" :"&radius1=" + radius1) +  (time1 == null?"" :"&time1=" + time1) +  (time2 == null?"" :"&time2=" + time2) +  (deleteFilter == null?"" :"&deleteFilter=" + deleteFilter);
	var bObj = new JSONscriptRequest(url, callback);
	JSONscriptRequest.callbacks[bObj.scriptId] = bObj;
	bObj.buildScriptTag();
	bObj.addScriptTag();
}


function SetPendingFrame (apiKey, id, sideEffects, callback) {
	var url = "http://www.cellblock.com:80/api/rest/?method=SetPendingFrame&apiKey=" + apiKey + "&id=" + id +  (sideEffects == null?"" :"&sideEffects=" + sideEffects);
	var bObj = new JSONscriptRequest(url, callback);
	JSONscriptRequest.callbacks[bObj.scriptId] = bObj;
	bObj.buildScriptTag();
	bObj.addScriptTag();
}


function SetPreviewStatus (apiKey, id, status, callback) {
	var url = "http://www.cellblock.com:80/api/rest/?method=SetPreviewStatus&apiKey=" + apiKey + "&id=" + id + "&status=" + status;
	var bObj = new JSONscriptRequest(url, callback);
	JSONscriptRequest.callbacks[bObj.scriptId] = bObj;
	bObj.buildScriptTag();
	bObj.addScriptTag();
}


function SetRating (apiKey, rating, id, realmName, userName, frameId, callback) {
	var url = "http://www.cellblock.com:80/api/rest/?method=SetRating&apiKey=" + apiKey + "&rating=" + rating +  (id == null?"" :"&id=" + id) +  (realmName == null?"" :"&realmName=" + realmName) +  (userName == null?"" :"&userName=" + userName) +  (frameId == null?"" :"&frameId=" + frameId);
	var bObj = new JSONscriptRequest(url, callback);
	JSONscriptRequest.callbacks[bObj.scriptId] = bObj;
	bObj.buildScriptTag();
	bObj.addScriptTag();
}


function SetRealmAttributeValue (apiKey, realmId, attributeName, attributeValue, callback) {
	var url = "http://www.cellblock.com:80/api/rest/?method=SetRealmAttributeValue&apiKey=" + apiKey + "&realmId=" + realmId + "&attributeName=" + attributeName + "&attributeValue=" + attributeValue;
	var bObj = new JSONscriptRequest(url, callback);
	JSONscriptRequest.callbacks[bObj.scriptId] = bObj;
	bObj.buildScriptTag();
	bObj.addScriptTag();
}


function SetRealmInfo (apiKey, realmId, previewComments, callback) {
	var url = "http://www.cellblock.com:80/api/rest/?method=SetRealmInfo&apiKey=" + apiKey + "&realmId=" + realmId +  (previewComments == null?"" :"&previewComments=" + previewComments);
	var bObj = new JSONscriptRequest(url, callback);
	JSONscriptRequest.callbacks[bObj.scriptId] = bObj;
	bObj.buildScriptTag();
	bObj.addScriptTag();
}


function SetUserAttributeValue (apiKey, realmId, screenName, attributeName, attributeValue, callback) {
	var url = "http://www.cellblock.com:80/api/rest/?method=SetUserAttributeValue&apiKey=" + apiKey + "&realmId=" + realmId + "&screenName=" + screenName + "&attributeName=" + attributeName + "&attributeValue=" + attributeValue;
	var bObj = new JSONscriptRequest(url, callback);
	JSONscriptRequest.callbacks[bObj.scriptId] = bObj;
	bObj.buildScriptTag();
	bObj.addScriptTag();
}


function SetUserInfo (apiKey, realmId, screenName, email, password, previewComments, newScreenName, addACL, deleteACL, attributes, callback) {
	var url = "http://www.cellblock.com:80/api/rest/?method=SetUserInfo&apiKey=" + apiKey + "&realmId=" + realmId + "&screenName=" + screenName +  (email == null?"" :"&email=" + email) +  (password == null?"" :"&password=" + password) +  (previewComments == null?"" :"&previewComments=" + previewComments) +  (newScreenName == null?"" :"&newScreenName=" + newScreenName) +  (addACL == null?"" :"&addACL=" + addACL) +  (deleteACL == null?"" :"&deleteACL=" + deleteACL) +  (attributes == null?"" :"&attributes=" + attributes);
	var bObj = new JSONscriptRequest(url, callback);
	JSONscriptRequest.callbacks[bObj.scriptId] = bObj;
	bObj.buildScriptTag();
	bObj.addScriptTag();
}


function UploadFile (apiKey, uploadFile, responsePage, callback) {
	var url = "http://www.cellblock.com:80/api/rest/?method=UploadFile&apiKey=" + apiKey + "&uploadFile=" + uploadFile +  (responsePage == null?"" :"&responsePage=" + responsePage);
	var bObj = new JSONscriptRequest(url, callback);
	JSONscriptRequest.callbacks[bObj.scriptId] = bObj;
	bObj.buildScriptTag();
	bObj.addScriptTag();
}


function UploadFrame (apiKey, id, caption, uploadFile, index, attributeList, responsePage, flavor, url, callback) {
	var url = "http://www.cellblock.com:80/api/rest/?method=UploadFrame&apiKey=" + apiKey + "&id=" + id + "&caption=" + caption + "&uploadFile=" + uploadFile +  (index == null?"" :"&index=" + index) +  (attributeList == null?"" :"&attributeList=" + attributeList) +  (responsePage == null?"" :"&responsePage=" + responsePage) +  (flavor == null?"" :"&flavor=" + flavor) +  (url == null?"" :"&url=" + url);
	var bObj = new JSONscriptRequest(url, callback);
	JSONscriptRequest.callbacks[bObj.scriptId] = bObj;
	bObj.buildScriptTag();
	bObj.addScriptTag();
}


function UploadRemoteFrame (apiKey, id, caption, url, index, attributeList, responsePage, callback) {
	var url = "http://www.cellblock.com:80/api/rest/?method=UploadRemoteFrame&apiKey=" + apiKey + "&id=" + id + "&caption=" + caption + "&url=" + url +  (index == null?"" :"&index=" + index) +  (attributeList == null?"" :"&attributeList=" + attributeList) +  (responsePage == null?"" :"&responsePage=" + responsePage);
	var bObj = new JSONscriptRequest(url, callback);
	JSONscriptRequest.callbacks[bObj.scriptId] = bObj;
	bObj.buildScriptTag();
	bObj.addScriptTag();
}




