/*
 jquery-ocms.js - JQuery class that can be used to save content and attributes on content as well as
 retrieve some general things like field lists and picklist values.

 Copyright (c) 2010 - Stantive Technologies Group (http://www.stantive.com)
 All Rights Reserved.
 NOTE: THIS FILE IS GENERATED, PLEASE MODIFY THE FILE LOCATED IN "other-src/web/ocmsJS/" DIRECTORY.
*/
(function($){$.orchestracmsRestProxy={doAjaxJsonCall:function $$$orchestracmsRestProxy$doAjaxJsonCall$(endpoint,data,cbHandler,bAsync,namespace,dataType,method,mimetype){var cms=$(document).data("cms");var reg=new RegExp("^(http|https)","i");var context=null;if(cms.context.type!==undefined)context=cms.context.type;else context=cms.context;if(mimetype!==undefined&&mimetype!==null)data["cms-mimetype"]=mimetype;if(cms!=null&&context=="site"&&reg.exec(endpoint)==null){if(endpoint.substr(0,1)==="/")endpoint=
endpoint.substr(1);if(namespace!=undefined&&namespace!=null&&namespace!=""&&endpoint.substr(0,namespace.length+2)!==namespace+"__")endpoint=namespace+"__"+endpoint;if(cms.site_prefix!=undefined&&cms.site_prefix!=null&&cms.site_prefix!="")endpoint=cms.site_prefix+"/"+endpoint;else endpoint="/"+endpoint;$.ajax({url:endpoint,async:bAsync,dataType:dataType==undefined?"json":dataType,data:data,type:"POST",success:function(json,textStatus,xhr){if($.isFunction(cbHandler))cbHandler(json,textStatus,xhr)}})}else{data["cms-endpoint"]=
endpoint;if(namespace!==undefined)data["cms-namespace"]=namespace;if(method!==undefined)data["cms-method"]=method;var proxy;if(context=="site")if(cms.site_prefix!=undefined&&cms.site_prefix!=null&&cms.site_prefix!="")proxy=cms.site_prefix+"/cms__RESTProxy";else proxy="/cms__RESTProxy";else proxy="/apex/RESTProxy";$.ajax({url:"/apex/RESTProxy",async:bAsync,dataType:dataType==undefined?"json":dataType,data:data,type:"POST",success:function(json,textStatus,xhr){if($.isFunction(cbHandler))cbHandler(json,
textStatus,xhr)}})}},getEndpoint:function $$$orchestracmsRestProxy$getEndpoint$(endpoint,namespace){var cms=$(document).data("cms");var context=null;if(cms.context.type!==undefined)context=cms.context.type;else context=cms.context;var reg=new RegExp("^(http|https)","i");if(cms!=null&&context=="site"&&reg.exec(endpoint)==null){if(endpoint.substr(0,1)==="/")endpoint=endpoint.substr(1);if(namespace!=undefined&&namespace!=null&&namespace!=""&&endpoint.substr(0,namespace.length+2)!==namespace+"__")endpoint=
namespace+"__"+endpoint;if(cms.site_prefix!=undefined&&cms.site_prefix!=null&&cms.site_prefix!="")return cms.site_prefix+"/"+endpoint;else return"/"+endpoint}else if(context=="site")if(cms.site_prefix!=undefined&&cms.site_prefix!=null&&cms.site_prefix!="")return cms.site_prefix+"/cms__RESTProxy";else return"/cms__RESTProxy";else return"/apex/RESTProxy"},getDataObject:function $$$orchestracmsRestProxy$getDataObject$(endpoint,namespace,method,mimetype){var cms=$(document).data("cms");var context=null;
if(cms.context.type!==undefined)context=cms.context.type;else context=cms.context;var reg=new RegExp("^(http|https)","i");var data={};if(cms!=null&&context!=null&&(context!="site"||reg.exec(endpoint)!=null)){data["cms-endpoint"]=endpoint;if(mimetype!==undefined&&mimetype!==null)data["cms-mimetype"]=mimetype;if(method!==undefined&&method!==null)data["cms-method"]=method;if(namespace!==undefined&&namespace!==null)data["cms-namespace"]=namespace}return data}}})(jQuery);
