var Legenda = {};

Legenda.page = {
    width: 974
};

Legenda.contextroot = {
	webpageServer: 'http://hinv.jp/legenda/', 
	jsonServer: 'http://hinv.jp/legenda/'
};

Legenda.httpConnectionOptions = {
	method: 'POST', 
	timeout: 360000
};

Legenda.createHttpConnection = function(url) {
	var opts = Legenda.httpConnectionOptions;
	opts.url = url;
	return new Ext.data.Connection(Legenda.httpConnectionOptions);
};

Legenda.createHttpProxy = function(url) {
	return new Ext.data.HttpProxy(Legenda.createHttpConnection(url));
};

Legenda.createScriptTagProxy = function(url) {
	var opts = Legenda.httpConnectionOptions;
	opts.url = url;
	return new Ext.data.ScriptTagProxy(opts);
};


Legenda.categories = [{
    name: 'any'
}, {
    name: 'Gene'
}, {
    name: 'Disease'
}, {
    name: 'Tissue'
}, {
    name: 'Gene Function'
}, {
    name: 'Substance'
}];

Legenda.linkTypeToIconPath = {
	omim: "images/omim.png"
};

// Cookieを利用可能にする
Ext.state.Manager.setProvider(new Ext.state.CookieProvider());

Legenda.escapeHTML = function(str){
    return str.replace(/&/g, "&amp;").replace(/"/g, "&quot;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
};

Legenda.getWindowInnerSize = function() {
	var x,y;
	if (window.innerHeight) // all except Explorer
	{
		x = window.innerWidth;
		y = window.innerHeight;
	}
	else if (document.documentElement && document.documentElement.clientHeight)
		// Explorer 6 Strict Mode
	{
		x = document.documentElement.clientWidth;
		y = document.documentElement.clientHeight;
	}
	else if (document.body) // other Explorers
	{
		x = document.body.clientWidth;
		y = document.body.clientHeight;
	}
	return {width: x, height: y};	
};

Legenda.headerHeight = 220;

Legenda.getBodySize = function() {
	var windowInnerSize = Legenda.getWindowInnerSize();
	windowInnerSize.height -= Legenda.headerHeight;
	return windowInnerSize;
};

Legenda.linkFireLock = false;


Legenda.browserLanguage = function() {
  try {
    return (navigator.browserLanguage || navigator.language || navigator.userLanguage).substr(0,2);
  }
  catch(e) {
    return undefined;
  }
};

Legenda.relationsPageSize = 25;

