﻿Integrify.service.client_root =  document.location.protocol + '//' + document.location.host;
Integrify.service.site = Integrify.service.client_root + "/service"
Integrify.service.root = Integrify.service.site + "/integrify-rest.svc";
Integrify.resources.root = Integrify.service.client_root + "/resources";

Integrify.tag_paths = {
p1: Integrify.resources.root + "/",
p2: Integrify.resources.root + "/integrify/widgets/"
};


Integrify.service.default_datatype = "script";
Integrify.service.debugging = true;



Integrify.uploadProxy = Integrify.service.site + "/upload.aspx?url="; 
Integrify.availProxies = [Integrify.service.client_root + "/proxy.aspx?url=",
                    Integrify.service.client_root + "/proxy.php?url="];

Integrify.preferredProxy = Integrify.availProxies[0];

Integrify.service.proxy = Integrify.preferredProxy;


//oauth settings

//sign on server using proxy, not client
Integrify.oauth.settings.signThroughProxy = true;

Integrify.oauth.settings.reqTokenEP = '/request_token';
Integrify.oauth.settings.exchTokenEP = '/exchange_token';
Integrify.oauth.settings.proxy = Integrify.service.proxy;

//custom auth window formatting

Integrify.oauth.settings.authDisplay = function(url) {
        window.location = url;
}

if (jQuery.cookie("iapi_reqtoken") != null) {
    Integrify.oauth.pendingTokenExchange = true;   
}

//override exts external blank image url
Ext.BLANK_IMAGE_URL = Integrify.resources.root + "/css/extjs/s.gif";

//any widget that calls addWidgetToPortal will be redirected to portal load
Integrify.portalRedirect = "http://www.integrify.com/50/portal.htm";

//function only to be executed if portal does not exist, will be overriden when portal is loaded

 var addWidgetToPortal = function(o) {
			var hashScript = "@@addWidgetToPortal(" + JSON.stringify(o) + ")";
		      document.location = Integrify.portalRedirect + "#" + hashScript;

		};







